Commit 2c3fb4ec authored by Jakob Bornecrantz's avatar Jakob Bornecrantz

rbug: Break out of trace

parent 92b1908d
......@@ -33,10 +33,10 @@ import common
default_statetrackers = 'mesa'
if common.default_platform in ('linux', 'freebsd', 'darwin'):
default_drivers = 'softpipe,failover,svga,i915,i965,trace,identity,llvmpipe'
default_drivers = 'softpipe,failover,svga,i915,i965,trace,rbug,identity,llvmpipe'
default_winsys = 'xlib'
elif common.default_platform in ('winddk',):
default_drivers = 'softpipe,svga,i915,i965,trace,identity'
default_drivers = 'softpipe,svga,i915,i965,trace,rbug,identity'
default_winsys = 'all'
elif common.default_platform in ('embedded',):
default_drivers = 'softpipe,llvmpipe'
......@@ -50,7 +50,7 @@ common.AddOptions(opts)
opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers,
['mesa', 'python', 'xorg']))
opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
['softpipe', 'failover', 'svga', 'i915', 'i965', 'trace', 'r300', 'identity', 'llvmpipe', 'nouveau', 'nv50', 'nvfx']))
['softpipe', 'failover', 'svga', 'i915', 'i965', 'trace', 'rbug', 'r300', 'identity', 'llvmpipe', 'nouveau', 'nv50', 'nvfx']))
opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
['xlib', 'vmware', 'i915', 'i965', 'gdi', 'radeon', 'graw-xlib']))
......@@ -102,9 +102,11 @@ Export([
#######################################################################
# Environment setup
# Always build trace, identity, softpipe, and llvmpipe (where possible)
# Always build trace, rbug, identity, softpipe, and llvmpipe (where possible)
if 'trace' not in env['drivers']:
env['drivers'].append('trace')
if 'rbug' not in env['drivers']:
env['drivers'].append('rbug')
if 'identity' not in env['drivers']:
env['drivers'].append('identity')
if 'softpipe' not in env['drivers']:
......
......@@ -108,7 +108,7 @@ EGL_DRIVERS_DIRS = glx
# Gallium directories and
GALLIUM_DIRS = auxiliary drivers state_trackers
GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a
GALLIUM_DRIVERS_DIRS = softpipe trace identity i915 i965 svga r300 nvfx nv50 failover
GALLIUM_DRIVERS_DIRS = softpipe trace rbug identity i915 i965 svga r300 nvfx nv50 failover
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
GALLIUM_WINSYS_DIRS = sw sw/xlib
GALLIUM_TARGET_DIRS = libgl-xlib
......
......@@ -6,7 +6,7 @@ CONFIG_NAME = linux-cell
# Omiting other gallium drivers:
GALLIUM_DRIVERS_DIRS = cell softpipe trace identity
GALLIUM_DRIVERS_DIRS = cell softpipe trace rbug identity
# Compiler and flags
......
......@@ -23,7 +23,7 @@ GALLIUM_DRIVERS_DIRS = softpipe
GALLIUM_STATE_TRACKERS_DIRS = es
# build egl_x11_{swrast,i915}.so
GALLIUM_DRIVERS_DIRS += trace i915
GALLIUM_DRIVERS_DIRS += trace rbug i915
GALLIUM_STATE_TRACKERS_DIRS += egl
GALLIUM_WINSYS_DIRS += drm/intel
GALLIUM_TARGET_DIRS += egl-swrast egl-i915
......@@ -474,7 +474,7 @@ GLU_DIRS="sgi"
GALLIUM_DIRS="auxiliary drivers state_trackers"
GALLIUM_TARGET_DIRS=""
GALLIUM_WINSYS_DIRS="sw"
GALLIUM_DRIVERS_DIRS="softpipe failover trace identity"
GALLIUM_DRIVERS_DIRS="softpipe failover trace rbug identity"
GALLIUM_STATE_TRACKERS_DIRS=""
case "$mesa_driver" in
......
TOP = ../../../..
include $(TOP)/configs/current
LIBNAME = rbug
C_SOURCES = \
rbug_core.c \
rbug_context.c \
rbug_objects.c \
rbug_screen.c
include ../../Makefile.template
Import('*')
env = env.Clone()
rbug = env.ConvenienceLibrary(
target = 'rbug',
source = [
'rbug_context.c',
'rbug_core.c',
'rbug_objects.c',
'rbug_screen.c',
])
Export('rbug')
This diff is collapsed.
/**************************************************************************
*
* Copyright 2010 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#ifndef RBUG_CONTEXT_H
#define RBUG_CONTEXT_H
#include "pipe/p_state.h"
#include "pipe/p_context.h"
#include "rbug_screen.h"
struct rbug_context {
struct pipe_context base; /**< base class */
struct pipe_context *pipe;
struct rbug_list list;
/* call locking */
pipe_mutex call_mutex;
/* current state */
struct {
struct rbug_shader *fs;
struct rbug_shader *vs;
struct rbug_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
unsigned num_sampler_views;
struct rbug_sampler_view *vert_sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
unsigned num_vert_sampler_views;
unsigned nr_cbufs;
struct rbug_resource *cbufs[PIPE_MAX_COLOR_BUFS];
struct rbug_resource *zsbuf;
} curr;
/* draw locking */
pipe_mutex draw_mutex;
pipe_condvar draw_cond;
unsigned draw_num_rules;
int draw_blocker;
int draw_blocked;
struct {
struct rbug_shader *fs;
struct rbug_shader *vs;
struct rbug_sampler_view *sampler_view;
struct rbug_resource *surf;
int blocker;
} draw_rule;
/* list of state objects */
pipe_mutex list_mutex;
unsigned num_shaders;
struct rbug_list shaders;
};
static INLINE struct rbug_context *
rbug_context(struct pipe_context *pipe)
{
return (struct rbug_context *)pipe;
}
/**********************************************************
* rbug_context.c
*/
struct pipe_context *
rbug_context_create(struct pipe_screen *screen, struct pipe_context *pipe);
/**********************************************************
* rbug_core.c
*/
void rbug_notify_draw_blocked(struct rbug_context *rb_context);
#endif /* RBUG_CONTEXT_H */
This diff is collapsed.
/**************************************************************************
*
* Copyright 2010 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_simple_list.h"
#include "rbug_screen.h"
#include "rbug_objects.h"
#include "rbug_context.h"
struct pipe_resource *
rbug_resource_create(struct rbug_screen *rb_screen,
struct pipe_resource *resource)
{
struct rbug_resource *rb_resource;
if(!resource)
goto error;
assert(resource->screen == rb_screen->screen);
rb_resource = CALLOC_STRUCT(rbug_resource);
if(!rb_resource)
goto error;
memcpy(&rb_resource->base, resource, sizeof(struct pipe_resource));
pipe_reference_init(&rb_resource->base.reference, 1);
rb_resource->base.screen = &rb_screen->base;
rb_resource->resource = resource;
rbug_screen_add_to_list(rb_screen, resources, rb_resource);
return &rb_resource->base;
error:
pipe_resource_reference(&resource, NULL);
return NULL;
}
void
rbug_resource_destroy(struct rbug_resource *rb_resource)
{
struct rbug_screen *rb_screen = rbug_screen(rb_resource->base.screen);
rbug_screen_remove_from_list(rb_screen, resources, rb_resource);
pipe_resource_reference(&rb_resource->resource, NULL);
FREE(rb_resource);
}
struct pipe_surface *
rbug_surface_create(struct rbug_resource *rb_resource,
struct pipe_surface *surface)
{
struct rbug_surface *rb_surface;
if(!surface)
goto error;
assert(surface->texture == rb_resource->resource);
rb_surface = CALLOC_STRUCT(rbug_surface);
if(!rb_surface)
goto error;
memcpy(&rb_surface->base, surface, sizeof(struct pipe_surface));
pipe_reference_init(&rb_surface->base.reference, 1);
rb_surface->base.texture = NULL;
pipe_resource_reference(&rb_surface->base.texture, &rb_resource->base);
rb_surface->surface = surface;
return &rb_surface->base;
error:
pipe_surface_reference(&surface, NULL);
return NULL;
}
void
rbug_surface_destroy(struct rbug_surface *rb_surface)
{
pipe_resource_reference(&rb_surface->base.texture, NULL);
pipe_surface_reference(&rb_surface->surface, NULL);
FREE(rb_surface);
}
struct pipe_sampler_view *
rbug_sampler_view_create(struct rbug_context *rb_context,
struct rbug_resource *rb_resource,
struct pipe_sampler_view *view)
{
struct rbug_sampler_view *rb_view;
if (!view)
goto error;
assert(view->texture == rb_resource->resource);
rb_view = MALLOC(sizeof(struct rbug_sampler_view));
rb_view->base = *view;
rb_view->base.reference.count = 1;
rb_view->base.texture = NULL;
pipe_resource_reference(&rb_view->base.texture, rb_resource->resource);
rb_view->base.context = rb_context->pipe;
rb_view->sampler_view = view;
return &rb_view->base;
error:
return NULL;
}
void
rbug_sampler_view_destroy(struct rbug_context *rb_context,
struct rbug_sampler_view *rb_view)
{
pipe_resource_reference(&rb_view->base.texture, NULL);
rb_context->pipe->sampler_view_destroy(rb_context->pipe,
rb_view->sampler_view);
FREE(rb_view);
}
struct pipe_transfer *
rbug_transfer_create(struct rbug_context *rb_context,
struct rbug_resource *rb_resource,
struct pipe_transfer *transfer)
{
struct rbug_transfer *rb_transfer;
if(!transfer)
goto error;
assert(transfer->resource == rb_resource->resource);
rb_transfer = CALLOC_STRUCT(rbug_transfer);
if(!rb_transfer)
goto error;
memcpy(&rb_transfer->base, transfer, sizeof(struct pipe_transfer));
rb_transfer->base.resource = NULL;
rb_transfer->transfer = transfer;
rb_transfer->pipe = rb_context->pipe;
pipe_resource_reference(&rb_transfer->base.resource, &rb_resource->base);
assert(rb_transfer->base.resource == &rb_resource->base);
return &rb_transfer->base;
error:
rb_context->pipe->transfer_destroy(rb_context->pipe, transfer);
return NULL;
}
void
rbug_transfer_destroy(struct rbug_context *rb_context,
struct rbug_transfer *rb_transfer)
{
pipe_resource_reference(&rb_transfer->base.resource, NULL);
rb_transfer->pipe->transfer_destroy(rb_context->pipe,
rb_transfer->transfer);
FREE(rb_transfer);
}
/**************************************************************************
*
* Copyright 2010 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#ifndef RBUG_OBJECTS_H
#define RBUG_OBJECTS_H
#include "pipe/p_compiler.h"
#include "pipe/p_state.h"
#include "rbug_screen.h"
struct rbug_context;
struct rbug_resource
{
struct pipe_resource base;
struct pipe_resource *resource;
struct rbug_list list;
};
struct rbug_shader
{
struct rbug_list list;
void *shader;
void *tokens;
void *replaced_shader;
void *replaced_tokens;
boolean disabled;
};
struct rbug_sampler_view
{
struct pipe_sampler_view base;
struct pipe_sampler_view *sampler_view;
};
struct rbug_surface
{
struct pipe_surface base;
struct pipe_surface *surface;
};
struct rbug_transfer
{
struct pipe_transfer base;
struct pipe_context *pipe;
struct pipe_transfer *transfer;
};
static INLINE struct rbug_resource *
rbug_resource(struct pipe_resource *_resource)
{
if (!_resource)
return NULL;
(void)rbug_screen(_resource->screen);
return (struct rbug_resource *)_resource;
}
static INLINE struct rbug_sampler_view *
rbug_sampler_view(struct pipe_sampler_view *_sampler_view)
{
if (!_sampler_view)
return NULL;
(void)rbug_resource(_sampler_view->texture);
return (struct rbug_sampler_view *)_sampler_view;
}
static INLINE struct rbug_surface *
rbug_surface(struct pipe_surface *_surface)
{
if (!_surface)
return NULL;
(void)rbug_resource(_surface->texture);
return (struct rbug_surface *)_surface;
}
static INLINE struct rbug_transfer *
rbug_transfer(struct pipe_transfer *_transfer)
{
if (!_transfer)
return NULL;
(void)rbug_resource(_transfer->resource);
return (struct rbug_transfer *)_transfer;
}
static INLINE struct rbug_shader *
rbug_shader(void *_state)
{
if (!_state)
return NULL;
return (struct rbug_shader *)_state;
}
static INLINE struct pipe_resource *
rbug_resource_unwrap(struct pipe_resource *_resource)
{
if (!_resource)
return NULL;
return rbug_resource(_resource)->resource;
}
static INLINE struct pipe_sampler_view *
rbug_sampler_view_unwrap(struct pipe_sampler_view *_sampler_view)
{
if (!_sampler_view)
return NULL;
return rbug_sampler_view(_sampler_view)->sampler_view;
}
static INLINE struct pipe_surface *
rbug_surface_unwrap(struct pipe_surface *_surface)
{
if (!_surface)
return NULL;
return rbug_surface(_surface)->surface;
}
static INLINE struct pipe_transfer *
rbug_transfer_unwrap(struct pipe_transfer *_transfer)
{
if (!_transfer)
return NULL;
return rbug_transfer(_transfer)->transfer;
}
static INLINE void *
rbug_shader_unwrap(void *_state)
{
struct rbug_shader *shader;
if (!_state)
return NULL;
shader = rbug_shader(_state);
return shader->replaced_shader ? shader->replaced_shader : shader->shader;
}
struct pipe_resource *
rbug_resource_create(struct rbug_screen *rb_screen,
struct pipe_resource *resource);
void
rbug_resource_destroy(struct rbug_resource *rb_resource);
struct pipe_surface *
rbug_surface_create(struct rbug_resource *rb_resource,
struct pipe_surface *surface);
void
rbug_surface_destroy(struct rbug_surface *rb_surface);
struct pipe_sampler_view *
rbug_sampler_view_create(struct rbug_context *rb_context,
struct rbug_resource *rb_resource,
struct pipe_sampler_view *view);
void
rbug_sampler_view_destroy(struct rbug_context *rb_context,
struct rbug_sampler_view *rb_sampler_view);
struct pipe_transfer *
rbug_transfer_create(struct rbug_context *rb_context,
struct rbug_resource *rb_resource,
struct pipe_transfer *transfer);
void
rbug_transfer_destroy(struct rbug_context *rb_context,
struct rbug_transfer *rb_transfer);
#endif /* RBUG_OBJECTS_H */
/**************************************************************************
*
* Copyright 2010 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#ifndef RBUG_PUBLIC_H
#define RBUG_PUBLIC_H
struct pipe_screen;
struct pipe_context;
struct pipe_screen *
rbug_screen_create(struct pipe_screen *screen);
#endif /* RBUG_PUBLIC_H */
This diff is collapsed.
/**************************************************************************
*
* Copyright 2010 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#ifndef RBUG_SCREEN_H
#define RBUG_SCREEN_H
#include "pipe/p_screen.h"
#include "pipe/p_defines.h"
#include "os/os_thread.h"
struct rbug_list {
struct rbug_list *next;
struct rbug_list *prev;
};
struct rbug_screen
{
struct pipe_screen base;
struct pipe_screen *screen;
struct pipe_context *private_context;
/* remote debugger */
struct rbug_rbug *rbug;
pipe_mutex list_mutex;
int num_contexts;
int num_resources;
int num_surfaces;
int num_transfers;
struct rbug_list contexts;
struct rbug_list resources;
struct rbug_list surfaces;
struct rbug_list transfers;
};
static INLINE struct rbug_screen *
rbug_screen(struct pipe_screen *screen)
{
return (struct rbug_screen *)screen;
}
#define rbug_screen_add_to_list(scr, name, obj) \
do { \
pipe_mutex_lock(scr->list_mutex); \
insert_at_head(&scr->name, &obj->list); \
scr->num_##name++; \
pipe_mutex_unlock(scr->list_mutex); \
} while (0)
#define rbug_screen_remove_from_list(scr, name, obj) \
do { \
pipe_mutex_lock(scr->list_mutex); \