summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/auxiliary/util/u_resource.c8
-rw-r--r--src/gallium/auxiliary/util/u_transfer.c7
-rw-r--r--src/gallium/auxiliary/util/u_transfer.h12
-rw-r--r--src/gallium/drivers/cell/ppu/cell_context.c14
-rw-r--r--src/gallium/drivers/failover/fo_context.c13
-rw-r--r--src/gallium/drivers/galahad/glhd_context.c18
-rw-r--r--src/gallium/drivers/i915/i915_resource.c1
-rw-r--r--src/gallium/drivers/i915/i915_resource_buffer.c1
-rw-r--r--src/gallium/drivers/i915/i915_resource_texture.c1
-rw-r--r--src/gallium/drivers/i965/brw_resource_buffer.c20
-rw-r--r--src/gallium/drivers/i965/brw_resource_texture.c43
-rw-r--r--src/gallium/drivers/identity/id_context.c18
-rw-r--r--src/gallium/drivers/llvmpipe/lp_flush.c6
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c8
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c5
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.h10
-rw-r--r--src/gallium/drivers/noop/noop_pipe.c8
-rw-r--r--src/gallium/drivers/nouveau/nouveau_buffer.c1
-rw-r--r--src/gallium/drivers/nouveau/nouveau_screen.c20
-rw-r--r--src/gallium/drivers/nouveau/nouveau_screen.h4
-rw-r--r--src/gallium/drivers/nv50/nv50_miptree.c1
-rw-r--r--src/gallium/drivers/nv50/nv50_resource.c17
-rw-r--r--src/gallium/drivers/nvc0/nvc0_miptree.c1
-rw-r--r--src/gallium/drivers/nvc0/nvc0_resource.c20
-rw-r--r--src/gallium/drivers/nvfx/nvfx_resource.c9
-rw-r--r--src/gallium/drivers/r300/r300_resource.c8
-rw-r--r--src/gallium/drivers/r300/r300_screen_buffer.c16
-rw-r--r--src/gallium/drivers/r300/r300_screen_buffer.h3
-rw-r--r--src/gallium/drivers/r300/r300_texture.c1
-rw-r--r--src/gallium/drivers/r600/r600_buffer.c9
-rw-r--r--src/gallium/drivers/r600/r600_resource.c1
-rw-r--r--src/gallium/drivers/r600/r600_texture.c9
-rw-r--r--src/gallium/drivers/rbug/rbug_context.c18
-rw-r--r--src/gallium/drivers/softpipe/sp_context.c24
-rw-r--r--src/gallium/drivers/softpipe/sp_context.h9
-rw-r--r--src/gallium/drivers/softpipe/sp_flush.c10
-rw-r--r--src/gallium/drivers/svga/svga_resource.c1
-rw-r--r--src/gallium/drivers/svga/svga_resource_buffer.c37
-rw-r--r--src/gallium/drivers/svga/svga_resource_texture.c26
-rw-r--r--src/gallium/drivers/trace/tr_context.c26
-rw-r--r--src/gallium/include/pipe/p_context.h15
-rw-r--r--src/gallium/include/pipe/p_defines.h7
-rw-r--r--src/gallium/state_trackers/xorg/xorg_renderer.c4
-rw-r--r--src/gallium/state_trackers/xorg/xorg_xv.c16
44 files changed, 44 insertions, 462 deletions
diff --git a/src/gallium/auxiliary/util/u_resource.c b/src/gallium/auxiliary/util/u_resource.c
index ea6896b430f..50a7cd4d55b 100644
--- a/src/gallium/auxiliary/util/u_resource.c
+++ b/src/gallium/auxiliary/util/u_resource.c
@@ -24,14 +24,6 @@ void u_resource_destroy_vtbl(struct pipe_screen *screen,
ur->vtbl->resource_destroy(screen, resource);
}
-unsigned u_is_resource_referenced_vtbl( struct pipe_context *pipe,
- struct pipe_resource *resource,
- unsigned level, int layer)
-{
- struct u_resource *ur = u_resource(resource);
- return ur->vtbl->is_resource_referenced(pipe, resource, level, layer);
-}
-
struct pipe_transfer *u_get_transfer_vtbl(struct pipe_context *context,
struct pipe_resource *resource,
unsigned level,
diff --git a/src/gallium/auxiliary/util/u_transfer.c b/src/gallium/auxiliary/util/u_transfer.c
index b6c63d9642f..7e72a59ee00 100644
--- a/src/gallium/auxiliary/util/u_transfer.c
+++ b/src/gallium/auxiliary/util/u_transfer.c
@@ -73,13 +73,6 @@ void u_default_transfer_flush_region( struct pipe_context *pipe,
*/
}
-unsigned u_default_is_resource_referenced( struct pipe_context *pipe,
- struct pipe_resource *resource,
- unsigned level, int layer)
-{
- return 0;
-}
-
struct pipe_transfer * u_default_get_transfer(struct pipe_context *context,
struct pipe_resource *resource,
unsigned level,
diff --git a/src/gallium/auxiliary/util/u_transfer.h b/src/gallium/auxiliary/util/u_transfer.h
index 8cf9c418b04..5b5ddeb4aba 100644
--- a/src/gallium/auxiliary/util/u_transfer.h
+++ b/src/gallium/auxiliary/util/u_transfer.h
@@ -27,10 +27,6 @@ void u_default_transfer_flush_region( struct pipe_context *pipe,
struct pipe_transfer *transfer,
const struct pipe_box *box);
-unsigned u_default_is_resource_referenced( struct pipe_context *pipe,
- struct pipe_resource *resource,
- unsigned level, int layer);
-
struct pipe_transfer * u_default_get_transfer(struct pipe_context *context,
struct pipe_resource *resource,
unsigned level,
@@ -57,10 +53,6 @@ struct u_resource_vtbl {
void (*resource_destroy)(struct pipe_screen *,
struct pipe_resource *pt);
- unsigned (*is_resource_referenced)(struct pipe_context *pipe,
- struct pipe_resource *texture,
- unsigned level, int layer);
-
struct pipe_transfer *(*get_transfer)(struct pipe_context *,
struct pipe_resource *resource,
unsigned level,
@@ -104,10 +96,6 @@ boolean u_resource_get_handle_vtbl(struct pipe_screen *screen,
void u_resource_destroy_vtbl(struct pipe_screen *screen,
struct pipe_resource *resource);
-unsigned u_is_resource_referenced_vtbl( struct pipe_context *pipe,
- struct pipe_resource *resource,
- unsigned level, int layer);
-
struct pipe_transfer *u_get_transfer_vtbl(struct pipe_context *context,
struct pipe_resource *resource,
unsigned level,
diff --git a/src/gallium/drivers/cell/ppu/cell_context.c b/src/gallium/drivers/cell/ppu/cell_context.c
index f9b83c8666c..58e647a39fa 100644
--- a/src/gallium/drivers/cell/ppu/cell_context.c
+++ b/src/gallium/drivers/cell/ppu/cell_context.c
@@ -104,18 +104,6 @@ static const struct debug_named_value cell_debug_flags[] = {
DEBUG_NAMED_VALUE_END
};
-static unsigned int
-cell_is_resource_referenced( struct pipe_context *pipe,
- struct pipe_resource *texture,
- unsigned level, int layer)
-{
- /**
- * FIXME: Optimize.
- */
-
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
struct pipe_context *
cell_create_context(struct pipe_screen *screen,
@@ -140,8 +128,6 @@ cell_create_context(struct pipe_screen *screen,
cell->pipe.clear = cell_clear;
cell->pipe.flush = cell_flush;
- cell->pipe.is_resource_referenced = cell_is_resource_referenced;
-
#if 0
cell->pipe.begin_query = cell_begin_query;
cell->pipe.end_query = cell_end_query;
diff --git a/src/gallium/drivers/failover/fo_context.c b/src/gallium/drivers/failover/fo_context.c
index d60718d9716..b536dc4afab 100644
--- a/src/gallium/drivers/failover/fo_context.c
+++ b/src/gallium/drivers/failover/fo_context.c
@@ -93,18 +93,6 @@ static void failover_draw_vbo( struct pipe_context *pipe,
}
}
-static unsigned int
-failover_is_resource_referenced( struct pipe_context *_pipe,
- struct pipe_resource *resource,
- unsigned level, int layer)
-{
- struct failover_context *failover = failover_context( _pipe );
- struct pipe_context *pipe = (failover->mode == FO_HW) ?
- failover->hw : failover->sw;
-
- return pipe->is_resource_referenced(pipe, resource, level, layer);
-}
-
struct pipe_context *failover_create( struct pipe_context *hw,
struct pipe_context *sw )
{
@@ -150,7 +138,6 @@ struct pipe_context *failover_create( struct pipe_context *hw,
#endif
failover->pipe.flush = hw->flush;
- failover->pipe.is_resource_referenced = failover_is_resource_referenced;
failover->dirty = 0;
diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c
index 75e4c253dd9..1dc652c6bd9 100644
--- a/src/gallium/drivers/galahad/glhd_context.c
+++ b/src/gallium/drivers/galahad/glhd_context.c
@@ -772,23 +772,6 @@ galahad_flush(struct pipe_context *_pipe,
fence);
}
-static unsigned int
-galahad_is_resource_referenced(struct pipe_context *_pipe,
- struct pipe_resource *_resource,
- unsigned level,
- int layer)
-{
- struct galahad_context *glhd_pipe = galahad_context(_pipe);
- struct galahad_resource *glhd_resource = galahad_resource(_resource);
- struct pipe_context *pipe = glhd_pipe->pipe;
- struct pipe_resource *resource = glhd_resource->resource;
-
- return pipe->is_resource_referenced(pipe,
- resource,
- level,
- layer);
-}
-
static struct pipe_sampler_view *
galahad_context_create_sampler_view(struct pipe_context *_pipe,
struct pipe_resource *_resource,
@@ -1038,7 +1021,6 @@ galahad_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
glhd_pipe->base.clear_render_target = galahad_clear_render_target;
glhd_pipe->base.clear_depth_stencil = galahad_clear_depth_stencil;
glhd_pipe->base.flush = galahad_flush;
- glhd_pipe->base.is_resource_referenced = galahad_is_resource_referenced;
glhd_pipe->base.create_sampler_view = galahad_context_create_sampler_view;
glhd_pipe->base.sampler_view_destroy = galahad_context_sampler_view_destroy;
glhd_pipe->base.create_surface = galahad_context_create_surface;
diff --git a/src/gallium/drivers/i915/i915_resource.c b/src/gallium/drivers/i915/i915_resource.c
index 499233ceb9b..7f52ba11d61 100644
--- a/src/gallium/drivers/i915/i915_resource.c
+++ b/src/gallium/drivers/i915/i915_resource.c
@@ -31,7 +31,6 @@ i915_resource_from_handle(struct pipe_screen * screen,
void
i915_init_resource_functions(struct i915_context *i915 )
{
- i915->base.is_resource_referenced = u_default_is_resource_referenced;
i915->base.get_transfer = u_get_transfer_vtbl;
i915->base.transfer_map = u_transfer_map_vtbl;
i915->base.transfer_flush_region = u_transfer_flush_region_vtbl;
diff --git a/src/gallium/drivers/i915/i915_resource_buffer.c b/src/gallium/drivers/i915/i915_resource_buffer.c
index 51482f54fc4..77c03450b3a 100644
--- a/src/gallium/drivers/i915/i915_resource_buffer.c
+++ b/src/gallium/drivers/i915/i915_resource_buffer.c
@@ -123,7 +123,6 @@ struct u_resource_vtbl i915_buffer_vtbl =
{
i915_buffer_get_handle, /* get_handle */
i915_buffer_destroy, /* resource_destroy */
- NULL, /* is_resource_referenced */
i915_get_transfer, /* get_transfer */
i915_transfer_destroy, /* transfer_destroy */
i915_buffer_transfer_map, /* transfer_map */
diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c
index aad5235a6ad..df60493b5e4 100644
--- a/src/gallium/drivers/i915/i915_resource_texture.c
+++ b/src/gallium/drivers/i915/i915_resource_texture.c
@@ -781,7 +781,6 @@ struct u_resource_vtbl i915_texture_vtbl =
{
i915_texture_get_handle, /* get_handle */
i915_texture_destroy, /* resource_destroy */
- NULL, /* is_resource_referenced */
i915_texture_get_transfer, /* get_transfer */
i915_transfer_destroy, /* transfer_destroy */
i915_texture_transfer_map, /* transfer_map */
diff --git a/src/gallium/drivers/i965/brw_resource_buffer.c b/src/gallium/drivers/i965/brw_resource_buffer.c
index afb96ee3e7f..32dc54f2b26 100644
--- a/src/gallium/drivers/i965/brw_resource_buffer.c
+++ b/src/gallium/drivers/i965/brw_resource_buffer.c
@@ -91,30 +91,10 @@ brw_buffer_transfer_unmap( struct pipe_context *pipe,
}
-static unsigned brw_buffer_is_referenced( struct pipe_context *pipe,
- struct pipe_resource *resource,
- unsigned level,
- int layer)
-{
- struct brw_context *brw = brw_context(pipe);
- struct brw_winsys_buffer *batch_bo = brw->batch->buf;
- struct brw_buffer *buf = brw_buffer(resource);
-
- if (buf->bo == NULL)
- return PIPE_UNREFERENCED;
-
- if (!brw_screen(pipe->screen)->sws->bo_references( batch_bo, buf->bo ))
- return PIPE_UNREFERENCED;
-
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
-
struct u_resource_vtbl brw_buffer_vtbl =
{
brw_buffer_get_handle, /* get_handle */
brw_buffer_destroy, /* resource_destroy */
- brw_buffer_is_referenced, /* is_resource_referenced */
u_default_get_transfer, /* get_transfer */
u_default_transfer_destroy, /* transfer_destroy */
brw_buffer_transfer_map, /* transfer_map */
diff --git a/src/gallium/drivers/i965/brw_resource_texture.c b/src/gallium/drivers/i965/brw_resource_texture.c
index 0cb895f35de..71a18290248 100644
--- a/src/gallium/drivers/i965/brw_resource_texture.c
+++ b/src/gallium/drivers/i965/brw_resource_texture.c
@@ -225,48 +225,6 @@ static void brw_texture_destroy(struct pipe_screen *screen,
}
-
-
-static unsigned brw_texture_is_referenced( struct pipe_context *pipe,
- struct pipe_resource *texture,
- unsigned level,
- int layer )
-{
- struct brw_context *brw = brw_context(pipe);
- struct brw_screen *bscreen = brw_screen(pipe->screen);
- struct brw_winsys_buffer *batch_bo = brw->batch->buf;
- struct brw_texture *tex = brw_texture(texture);
- struct brw_surface *surf;
- int i;
-
- /* XXX: this is subject to false positives if the underlying
- * texture BO is referenced, we can't tell whether the sub-region
- * we care about participates in that.
- */
- if (bscreen->sws->bo_references( batch_bo, tex->bo ))
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-
- /* Find any view on this texture for this level/layer and see if it
- * is referenced:
- */
- for (i = 0; i < 2; i++) {
- foreach (surf, &tex->views[i]) {
- if (surf->bo == tex->bo)
- continue;
-
- if (!(layer == -1 || surf->id.bits.layer == layer) ||
- surf->id.bits.level != level)
- continue;
-
- if (bscreen->sws->bo_references( batch_bo, surf->bo))
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
- }
- }
-
- return PIPE_UNREFERENCED;
-}
-
-
/*
* Transfer functions
*/
@@ -347,7 +305,6 @@ struct u_resource_vtbl brw_texture_vtbl =
{
brw_texture_get_handle, /* get_handle */
brw_texture_destroy, /* resource_destroy */
- brw_texture_is_referenced, /* is_resource_referenced */
brw_texture_get_transfer, /* get_transfer */
u_default_transfer_destroy, /* transfer_destroy */
brw_texture_transfer_map, /* transfer_map */
diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c
index b533abe24c6..5c865f8a22c 100644
--- a/src/gallium/drivers/identity/id_context.c
+++ b/src/gallium/drivers/identity/id_context.c
@@ -679,23 +679,6 @@ identity_flush(struct pipe_context *_pipe,
fence);
}
-static unsigned int
-identity_is_resource_referenced(struct pipe_context *_pipe,
- struct pipe_resource *_resource,
- unsigned level,
- int layer)
-{
- struct identity_context *id_pipe = identity_context(_pipe);
- struct identity_resource *id_resource = identity_resource(_resource);
- struct pipe_context *pipe = id_pipe->pipe;
- struct pipe_resource *resource = id_resource->resource;
-
- return pipe->is_resource_referenced(pipe,
- resource,
- level,
- layer);
-}
-
static struct pipe_sampler_view *
identity_context_create_sampler_view(struct pipe_context *_pipe,
struct pipe_resource *_resource,
@@ -931,7 +914,6 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
id_pipe->base.clear_render_target = identity_clear_render_target;
id_pipe->base.clear_depth_stencil = identity_clear_depth_stencil;
id_pipe->base.flush = identity_flush;
- id_pipe->base.is_resource_referenced = identity_is_resource_referenced;
id_pipe->base.create_surface = identity_context_create_surface;
id_pipe->base.surface_destroy = identity_context_surface_destroy;
id_pipe->base.create_sampler_view = identity_context_create_sampler_view;
diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c
index 6118164b20b..343c6145e7e 100644
--- a/src/gallium/drivers/llvmpipe/lp_flush.c
+++ b/src/gallium/drivers/llvmpipe/lp_flush.c
@@ -118,10 +118,10 @@ llvmpipe_flush_resource(struct pipe_context *pipe,
{
unsigned referenced;
- referenced = pipe->is_resource_referenced(pipe, resource, level, layer);
+ referenced = llvmpipe_is_resource_referenced(pipe, resource, level, layer);
- if ((referenced & PIPE_REFERENCED_FOR_WRITE) ||
- ((referenced & PIPE_REFERENCED_FOR_READ) && !read_only)) {
+ if ((referenced & LP_REFERENCED_FOR_WRITE) ||
+ ((referenced & LP_REFERENCED_FOR_READ) && !read_only)) {
if (cpu_access) {
/*
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 7b7b2721ba8..41d8fa6d124 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -753,20 +753,20 @@ lp_setup_is_resource_referenced( const struct lp_setup_context *setup,
/* check the render targets */
for (i = 0; i < setup->fb.nr_cbufs; i++) {
if (setup->fb.cbufs[i]->texture == texture)
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
+ return LP_REFERENCED_FOR_READ | LP_REFERENCED_FOR_WRITE;
}
if (setup->fb.zsbuf && setup->fb.zsbuf->texture == texture) {
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
+ return LP_REFERENCED_FOR_READ | LP_REFERENCED_FOR_WRITE;
}
/* check textures referenced by the scene */
for (i = 0; i < Elements(setup->scenes); i++) {
if (lp_scene_is_resource_referenced(setup->scenes[i], texture)) {
- return PIPE_REFERENCED_FOR_READ;
+ return LP_REFERENCED_FOR_READ;
}
}
- return PIPE_UNREFERENCED;
+ return LP_UNREFERENCED;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 9753da5e57e..2e6a4bd7dc8 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -695,7 +695,7 @@ llvmpipe_transfer_unmap(struct pipe_context *pipe,
transfer->box.z);
}
-static unsigned int
+unsigned int
llvmpipe_is_resource_referenced( struct pipe_context *pipe,
struct pipe_resource *presource,
unsigned level, int layer)
@@ -703,7 +703,7 @@ llvmpipe_is_resource_referenced( struct pipe_context *pipe,
struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
if (presource->target == PIPE_BUFFER)
- return PIPE_UNREFERENCED;
+ return LP_UNREFERENCED;
return lp_setup_is_resource_referenced(llvmpipe->setup, presource);
}
@@ -1401,7 +1401,6 @@ llvmpipe_init_context_resource_funcs(struct pipe_context *pipe)
pipe->transfer_destroy = llvmpipe_transfer_destroy;
pipe->transfer_map = llvmpipe_transfer_map;
pipe->transfer_unmap = llvmpipe_transfer_unmap;
- pipe->is_resource_referenced = llvmpipe_is_resource_referenced;
pipe->transfer_flush_region = u_default_transfer_flush_region;
pipe->transfer_inline_write = u_default_transfer_inline_write;
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.h b/src/gallium/drivers/llvmpipe/lp_texture.h
index b789c0f4090..b4a0dfd1c36 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.h
+++ b/src/gallium/drivers/llvmpipe/lp_texture.h
@@ -243,4 +243,14 @@ llvmpipe_init_screen_texture_funcs(struct pipe_screen *screen);
extern void
llvmpipe_init_context_texture_funcs(struct pipe_context *pipe);
+
+#define LP_UNREFERENCED 0
+#define LP_REFERENCED_FOR_READ (1 << 0)
+#define LP_REFERENCED_FOR_WRITE (1 << 1)
+
+unsigned int
+llvmpipe_is_resource_referenced( struct pipe_context *pipe,
+ struct pipe_resource *presource,
+ unsigned level, int layer);
+
#endif /* LP_TEXTURE_H */
diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c
index 3680f4622da..90b6ebf36b5 100644
--- a/src/gallium/drivers/noop/noop_pipe.c
+++ b/src/gallium/drivers/noop/noop_pipe.c
@@ -87,13 +87,6 @@ struct noop_resource {
struct sw_displaytarget *dt;
};
-static unsigned noop_is_resource_referenced(struct pipe_context *pipe,
- struct pipe_resource *resource,
- unsigned level, int layer)
-{
- return PIPE_UNREFERENCED;
-}
-
static struct pipe_resource *noop_resource_create(struct pipe_screen *screen,
const struct pipe_resource *templ)
{
@@ -303,7 +296,6 @@ static struct pipe_context *noop_create_context(struct pipe_screen *screen, void
ctx->transfer_unmap = noop_transfer_unmap;
ctx->transfer_destroy = noop_transfer_destroy;
ctx->transfer_inline_write = noop_transfer_inline_write;
- ctx->is_resource_referenced = noop_is_resource_referenced;
noop_init_state_functions(ctx);
return ctx;
diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c
index d0cc29104b8..01d3aa46d0e 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.c
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
@@ -314,7 +314,6 @@ const struct u_resource_vtbl nouveau_buffer_vtbl =
{
u_default_resource_get_handle, /* get_handle */
nouveau_buffer_destroy, /* resource_destroy */
- NULL, /* is_resource_referenced */
nouveau_buffer_transfer_get, /* get_transfer */
nouveau_buffer_transfer_destroy, /* transfer_destroy */
nouveau_buffer_transfer_map, /* transfer_map */
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c
index 3111bef7a22..d6c2a0a199a 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -211,26 +211,6 @@ nouveau_screen_bo_get_handle(struct pipe_screen *pscreen,
}
}
-
-unsigned int
-nouveau_reference_flags(struct nouveau_bo *bo)
-{
- uint32_t bo_flags;
- int flags = 0;
-
- bo_flags = nouveau_bo_pending(bo);
- if (bo_flags & NOUVEAU_BO_RD)
- flags |= PIPE_REFERENCED_FOR_READ;
- if (bo_flags & NOUVEAU_BO_WR)
- flags |= PIPE_REFERENCED_FOR_WRITE;
-
- return flags;
-}
-
-
-
-
-
int
nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
{
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h
index c091abf2786..186ada39677 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.h
+++ b/src/gallium/drivers/nouveau/nouveau_screen.h
@@ -74,10 +74,6 @@ nouveau_screen_bo_from_handle(struct pipe_screen *pscreen,
struct winsys_handle *whandle,
unsigned *out_stride);
-unsigned int
-nouveau_reference_flags(struct nouveau_bo *bo);
-
-
int nouveau_screen_init(struct nouveau_screen *, struct nouveau_device *);
void nouveau_screen_fini(struct nouveau_screen *);
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index ae6b26af1eb..9eeca05ada3 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -106,7 +106,6 @@ const struct u_resource_vtbl nv50_miptree_vtbl =
{
nv50_miptree_get_handle, /* get_handle */
nv50_miptree_destroy, /* resource_destroy */
- NULL, /* is_resource_referenced */
nv50_miptree_transfer_new, /* get_transfer */
nv50_miptree_transfer_del, /* transfer_destroy */
nv50_miptree_transfer_map, /* transfer_map */
diff --git a/src/gallium/drivers/nv50/nv50_resource.c b/src/gallium/drivers/nv50/nv50_resource.c
index 2a2fb0e32bc..1ae4d70a845 100644
--- a/src/gallium/drivers/nv50/nv50_resource.c
+++ b/src/gallium/drivers/nv50/nv50_resource.c
@@ -3,22 +3,6 @@
#include "nv50_resource.h"
#include "nouveau/nouveau_screen.h"
-static unsigned
-nv50_resource_is_referenced(struct pipe_context *pipe,
- struct pipe_resource *resource,
- unsigned face, int layer)
-{
- struct nv04_resource *res = nv04_resource(resource);
- unsigned flags = 0;
- unsigned bo_flags = nouveau_bo_pending(res->bo);
-
- if (bo_flags & NOUVEAU_BO_RD)
- flags = PIPE_REFERENCED_FOR_READ;
- if (bo_flags & NOUVEAU_BO_WR)
- flags |= PIPE_REFERENCED_FOR_WRITE;
-
- return flags;
-}
static struct pipe_resource *
nv50_resource_create(struct pipe_screen *screen,
@@ -52,7 +36,6 @@ nv50_init_resource_functions(struct pipe_context *pcontext)
pcontext->transfer_unmap = u_transfer_unmap_vtbl;
pcontext->transfer_destroy = u_transfer_destroy_vtbl;
pcontext->transfer_inline_write = u_transfer_inline_write_vtbl;
- pcontext->is_resource_referenced = nv50_resource_is_referenced;
pcontext->create_surface = nv50_miptree_surface_new;
pcontext->surface_destroy = nv50_miptree_surface_del;
}
diff --git a/src/gallium/drivers/nvc0/nvc0_miptree.c b/src/gallium/drivers/nvc0/nvc0_miptree.c
index db9117c3ff1..bced3245524 100644
--- a/src/gallium/drivers/nvc0/nvc0_miptree.c
+++ b/src/gallium/drivers/nvc0/nvc0_miptree.c
@@ -114,7 +114,6 @@ const struct u_resource_vtbl nvc0_miptree_vtbl =
{
nvc0_miptree_get_handle, /* get_handle */
nvc0_miptree_destroy, /* resource_destroy */
- NULL, /* is_resource_referenced */
nvc0_miptree_transfer_new, /* get_transfer */
nvc0_miptree_transfer_del, /* transfer_destroy */
nvc0_miptree_transfer_map, /* transfer_map */
diff --git a/src/gallium/drivers/nvc0/nvc0_resource.c b/src/gallium/drivers/nvc0/nvc0_resource.c
index fb5a496b84b..44e66314e7e 100644
--- a/src/gallium/drivers/nvc0/nvc0_resource.c
+++ b/src/gallium/drivers/nvc0/nvc0_resource.c
@@ -3,25 +3,6 @@
#include "nvc0_resource.h"
#include "nouveau/nouveau_screen.h"
-static unsigned
-nvc0_resource_is_referenced(struct pipe_context *pipe,
- struct pipe_resource *resource,
- unsigned face, int layer)
-{
- struct nv04_resource *res = nv04_resource(resource);
- unsigned flags = 0;
-
-#ifdef NOUVEAU_USERSPACE_MM
- flags = res->status;
-#else
- unsigned bo_flags = nouveau_bo_pending(res->bo);
- if (bo_flags & NOUVEAU_BO_RD)
- flags = PIPE_REFERENCED_FOR_READ;
- if (bo_flags & NOUVEAU_BO_WR)
- flags |= PIPE_REFERENCED_FOR_WRITE;
-#endif
- return flags;
-}
static struct pipe_resource *
nvc0_resource_create(struct pipe_screen *screen,
@@ -55,7 +36,6 @@ nvc0_init_resource_functions(struct pipe_context *pcontext)
pcontext->transfer_unmap = u_transfer_unmap_vtbl;
pcontext->transfer_destroy = u_transfer_destroy_vtbl;
pcontext->transfer_inline_write = u_transfer_inline_write_vtbl;
- pcontext->is_resource_referenced = nvc0_resource_is_referenced;
pcontext->create_surface = nvc0_miptree_surface_new;
pcontext->surface_destroy = nvc0_miptree_surface_del;
}
diff --git a/src/gallium/drivers/nvfx/nvfx_resource.c b/src/gallium/drivers/nvfx/nvfx_resource.c
index c60a7bb8b93..42e77c53621 100644
--- a/src/gallium/drivers/nvfx/nvfx_resource.c
+++ b/src/gallium/drivers/nvfx/nvfx_resource.c
@@ -4,13 +4,6 @@
#include "nvfx_resource.h"
#include "nouveau/nouveau_screen.h"
-static unsigned int
-nvfx_resource_is_referenced(struct pipe_context *pipe,
- struct pipe_resource *pr,
- unsigned level, int layer)
-{
- return !!nouveau_reference_flags(nvfx_resource(pr)->bo);
-}
static struct pipe_resource *
nvfx_resource_create(struct pipe_screen *screen,
@@ -58,8 +51,6 @@ nvfx_resource_get_handle(struct pipe_screen *pscreen,
void
nvfx_init_resource_functions(struct pipe_context *pipe)
{
- pipe->is_resource_referenced = nvfx_resource_is_referenced;
-
pipe->create_surface = nvfx_miptree_surface_new;
pipe->surface_destroy = nvfx_miptree_surface_del;
}
diff --git a/src/gallium/drivers/r300/r300_resource.c b/src/gallium/drivers/r300/r300_resource.c
index f3d8c5b889f..6593474b1f0 100644
--- a/src/gallium/drivers/r300/r300_resource.c
+++ b/src/gallium/drivers/r300/r300_resource.c
@@ -38,13 +38,6 @@ r300_resource_create(struct pipe_screen *screen,
}
-static unsigned r300_resource_is_referenced_by_cs(struct pipe_context *context,
- struct pipe_resource *buf,
- unsigned level, int layer)
-{
- return r300_buffer_is_referenced(context, buf);
-}
-
void r300_init_resource_functions(struct r300_context *r300)
{
r300->context.get_transfer = u_get_transfer_vtbl;
@@ -53,7 +46,6 @@ void r300_init_resource_functions(struct r300_context *r300)
r300->context.transfer_unmap = u_transfer_unmap_vtbl;
r300->context.transfer_destroy = u_transfer_destroy_vtbl;
r300->context.transfer_inline_write = u_transfer_inline_write_vtbl;
- r300->context.is_resource_referenced = r300_resource_is_referenced_by_cs;
r300->context.create_surface = r300_create_surface;
r300->context.surface_destroy = r300_surface_destroy;
}
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c
index 1045911f3ae..986ae384fbf 100644
--- a/src/gallium/drivers/r300/r300_screen_buffer.c
+++ b/src/gallium/drivers/r300/r300_screen_buffer.c
@@ -33,21 +33,6 @@
#include "r300_screen_buffer.h"
#include "r300_winsys.h"
-unsigned r300_buffer_is_referenced(struct pipe_context *context,
- struct pipe_resource *buf)
-{
- struct r300_context *r300 = r300_context(context);
- struct r300_resource *rbuf = r300_resource(buf);
-
- if (rbuf->b.user_ptr || rbuf->constant_buffer)
- return PIPE_UNREFERENCED;
-
- if (r300->rws->cs_is_buffer_referenced(r300->cs, rbuf->cs_buf))
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-
- return PIPE_UNREFERENCED;
-}
-
void r300_upload_index_buffer(struct r300_context *r300,
struct pipe_resource **index_buffer,
unsigned index_size, unsigned *start,
@@ -181,7 +166,6 @@ static const struct u_resource_vtbl r300_buffer_vtbl =
{
NULL, /* get_handle */
r300_buffer_destroy, /* resource_destroy */
- NULL, /* is_buffer_referenced */
r300_buffer_get_transfer, /* get_transfer */
r300_buffer_transfer_destroy, /* transfer_destroy */
r300_buffer_transfer_map, /* transfer_map */
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.h b/src/gallium/drivers/r300/r300_screen_buffer.h
index 14bee460d5b..cdbc4425fcb 100644
--- a/src/gallium/drivers/r300/r300_screen_buffer.h
+++ b/src/gallium/drivers/r300/r300_screen_buffer.h
@@ -49,9 +49,6 @@ struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen,
void *ptr, unsigned size,
unsigned bind);
-unsigned r300_buffer_is_referenced(struct pipe_context *context,
- struct pipe_resource *buf);
-
/* Inline functions. */
static INLINE struct r300_buffer *r300_buffer(struct pipe_resource *buffer)
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 70f087a4efa..c650fb7ed37 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -752,7 +752,6 @@ static const struct u_resource_vtbl r300_texture_vtbl =
{
NULL, /* get_handle */
r300_texture_destroy, /* resource_destroy */
- NULL, /* is_resource_referenced */
r300_texture_get_transfer, /* get_transfer */
r300_texture_transfer_destroy, /* transfer_destroy */
r300_texture_transfer_map, /* transfer_map */
diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c
index 2363cd1ebc5..6ced719c8f0 100644
--- a/src/gallium/drivers/r600/r600_buffer.c
+++ b/src/gallium/drivers/r600/r600_buffer.c
@@ -52,14 +52,6 @@ static void r600_buffer_destroy(struct pipe_screen *screen,
util_slab_free(&rscreen->pool_buffers, rbuffer);
}
-static unsigned r600_buffer_is_referenced_by_cs(struct pipe_context *context,
- struct pipe_resource *buf,
- unsigned level, int layer)
-{
- /* FIXME */
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
static struct pipe_transfer *r600_get_transfer(struct pipe_context *ctx,
struct pipe_resource *resource,
unsigned level,
@@ -160,7 +152,6 @@ static const struct u_resource_vtbl r600_buffer_vtbl =
{
u_default_resource_get_handle, /* get_handle */
r600_buffer_destroy, /* resource_destroy */
- r600_buffer_is_referenced_by_cs, /* is_buffer_referenced */
r600_get_transfer, /* get_transfer */
r600_transfer_destroy, /* transfer_destroy */
r600_buffer_transfer_map, /* transfer_map */
diff --git a/src/gallium/drivers/r600/r600_resource.c b/src/gallium/drivers/r600/r600_resource.c
index 207642ccfa9..f3ab3613c84 100644
--- a/src/gallium/drivers/r600/r600_resource.c
+++ b/src/gallium/drivers/r600/r600_resource.c
@@ -61,5 +61,4 @@ void r600_init_context_resource_functions(struct r600_pipe_context *r600)
r600->context.transfer_unmap = u_transfer_unmap_vtbl;
r600->context.transfer_destroy = u_transfer_destroy_vtbl;
r600->context.transfer_inline_write = u_transfer_inline_write_vtbl;
- r600->context.is_resource_referenced = u_is_resource_referenced_vtbl;
}
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index df83302b38e..10b6c0cff70 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -340,19 +340,10 @@ static void r600_texture_destroy(struct pipe_screen *screen,
FREE(rtex);
}
-static unsigned int r600_texture_is_referenced(struct pipe_context *context,
- struct pipe_resource *texture,
- unsigned level, int layer)
-{
- /* FIXME */
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
static const struct u_resource_vtbl r600_texture_vtbl =
{
r600_texture_get_handle, /* get_handle */
r600_texture_destroy, /* resource_destroy */
- r600_texture_is_referenced, /* is_resource_referenced */
r600_texture_get_transfer, /* get_transfer */
r600_texture_transfer_destroy, /* transfer_destroy */
r600_texture_transfer_map, /* transfer_map */
diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c
index 4a5d5413d8c..f5e2d5f4d62 100644
--- a/src/gallium/drivers/rbug/rbug_context.c
+++ b/src/gallium/drivers/rbug/rbug_context.c
@@ -812,23 +812,6 @@ rbug_flush(struct pipe_context *_pipe,
fence);
}
-static unsigned int
-rbug_is_resource_referenced(struct pipe_context *_pipe,
- struct pipe_resource *_resource,
- unsigned level,
- int layer)
-{
- struct rbug_context *rb_pipe = rbug_context(_pipe);
- struct rbug_resource *rb_resource = rbug_resource(_resource);
- struct pipe_context *pipe = rb_pipe->pipe;
- struct pipe_resource *resource = rb_resource->resource;
-
- return pipe->is_resource_referenced(pipe,
- resource,
- level,
- layer);
-}
-
static struct pipe_sampler_view *
rbug_context_create_sampler_view(struct pipe_context *_pipe,
struct pipe_resource *_resource,
@@ -1077,7 +1060,6 @@ rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
rb_pipe->base.clear_render_target = rbug_clear_render_target;
rb_pipe->base.clear_depth_stencil = rbug_clear_depth_stencil;
rb_pipe->base.flush = rbug_flush;
- rb_pipe->base.is_resource_referenced = rbug_is_resource_referenced;
rb_pipe->base.create_sampler_view = rbug_context_create_sampler_view;
rb_pipe->base.sampler_view_destroy = rbug_context_sampler_view_destroy;
rb_pipe->base.create_surface = rbug_context_create_surface;
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c
index 70fdfb7ddf3..5ea2ee58219 100644
--- a/src/gallium/drivers/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -148,13 +148,13 @@ softpipe_destroy( struct pipe_context *pipe )
/**
* if (the texture is being used as a framebuffer surface)
- * return PIPE_REFERENCED_FOR_WRITE
+ * return SP_REFERENCED_FOR_WRITE
* else if (the texture is a bound texture source)
- * return PIPE_REFERENCED_FOR_READ
+ * return SP_REFERENCED_FOR_READ
* else
- * return PIPE_UNREFERENCED
+ * return SP_UNREFERENCED
*/
-static unsigned int
+unsigned int
softpipe_is_resource_referenced( struct pipe_context *pipe,
struct pipe_resource *texture,
unsigned level, int layer)
@@ -163,19 +163,19 @@ softpipe_is_resource_referenced( struct pipe_context *pipe,
unsigned i;
if (texture->target == PIPE_BUFFER)
- return PIPE_UNREFERENCED;
+ return SP_UNREFERENCED;
/* check if any of the bound drawing surfaces are this texture */
if (softpipe->dirty_render_cache) {
for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
if (softpipe->framebuffer.cbufs[i] &&
softpipe->framebuffer.cbufs[i]->texture == texture) {
- return PIPE_REFERENCED_FOR_WRITE;
+ return SP_REFERENCED_FOR_WRITE;
}
}
if (softpipe->framebuffer.zsbuf &&
softpipe->framebuffer.zsbuf->texture == texture) {
- return PIPE_REFERENCED_FOR_WRITE;
+ return SP_REFERENCED_FOR_WRITE;
}
}
@@ -183,20 +183,20 @@ softpipe_is_resource_referenced( struct pipe_context *pipe,
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
if (softpipe->fragment_tex_cache[i] &&
softpipe->fragment_tex_cache[i]->texture == texture)
- return PIPE_REFERENCED_FOR_READ;
+ return SP_REFERENCED_FOR_READ;
}
for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
if (softpipe->vertex_tex_cache[i] &&
softpipe->vertex_tex_cache[i]->texture == texture)
- return PIPE_REFERENCED_FOR_READ;
+ return SP_REFERENCED_FOR_READ;
}
for (i = 0; i < PIPE_MAX_GEOMETRY_SAMPLERS; i++) {
if (softpipe->geometry_tex_cache[i] &&
softpipe->geometry_tex_cache[i]->texture == texture)
- return PIPE_REFERENCED_FOR_READ;
+ return SP_REFERENCED_FOR_READ;
}
- return PIPE_UNREFERENCED;
+ return SP_UNREFERENCED;
}
@@ -257,8 +257,6 @@ softpipe_create_context( struct pipe_screen *screen,
softpipe->pipe.clear = softpipe_clear;
softpipe->pipe.flush = softpipe_flush;
- softpipe->pipe.is_resource_referenced = softpipe_is_resource_referenced;
-
softpipe->pipe.render_condition = softpipe_render_condition;
/*
diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h
index c91709aef06..a572ee8cf00 100644
--- a/src/gallium/drivers/softpipe/sp_context.h
+++ b/src/gallium/drivers/softpipe/sp_context.h
@@ -198,4 +198,13 @@ struct pipe_context *
softpipe_create_context( struct pipe_screen *, void *priv );
+#define SP_UNREFERENCED 0
+#define SP_REFERENCED_FOR_READ (1 << 0)
+#define SP_REFERENCED_FOR_WRITE (1 << 1)
+
+unsigned int
+softpipe_is_resource_referenced( struct pipe_context *pipe,
+ struct pipe_resource *texture,
+ unsigned level, int layer);
+
#endif /* SP_CONTEXT_H */
diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c
index 00a2fafdfa2..f16751a2163 100644
--- a/src/gallium/drivers/softpipe/sp_flush.c
+++ b/src/gallium/drivers/softpipe/sp_flush.c
@@ -129,20 +129,20 @@ softpipe_flush_resource(struct pipe_context *pipe,
{
unsigned referenced;
- referenced = pipe->is_resource_referenced(pipe, texture, level, layer);
+ referenced = softpipe_is_resource_referenced(pipe, texture, level, layer);
- if ((referenced & PIPE_REFERENCED_FOR_WRITE) ||
- ((referenced & PIPE_REFERENCED_FOR_READ) && !read_only)) {
+ if ((referenced & SP_REFERENCED_FOR_WRITE) ||
+ ((referenced & SP_REFERENCED_FOR_READ) && !read_only)) {
/*
* TODO: The semantics of these flush flags are too obtuse. They should
* disappear and the pipe driver should just ensure that all visible
* side-effects happen when they need to happen.
*/
- if (referenced & PIPE_REFERENCED_FOR_WRITE)
+ if (referenced & SP_REFERENCED_FOR_WRITE)
flush_flags |= PIPE_FLUSH_RENDER_CACHE;
- if (referenced & PIPE_REFERENCED_FOR_READ)
+ if (referenced & SP_REFERENCED_FOR_READ)
flush_flags |= PIPE_FLUSH_TEXTURE_CACHE;
if (cpu_access) {
diff --git a/src/gallium/drivers/svga/svga_resource.c b/src/gallium/drivers/svga/svga_resource.c
index bed15ec02e5..6e0622a312b 100644
--- a/src/gallium/drivers/svga/svga_resource.c
+++ b/src/gallium/drivers/svga/svga_resource.c
@@ -33,7 +33,6 @@ svga_resource_from_handle(struct pipe_screen * screen,
void
svga_init_resource_functions(struct svga_context *svga)
{
- svga->pipe.is_resource_referenced = u_is_resource_referenced_vtbl;
svga->pipe.get_transfer = u_get_transfer_vtbl;
svga->pipe.transfer_map = u_transfer_map_vtbl;
svga->pipe.transfer_flush_region = u_transfer_flush_region_vtbl;
diff --git a/src/gallium/drivers/svga/svga_resource_buffer.c b/src/gallium/drivers/svga/svga_resource_buffer.c
index e1f07d655b9..b0e6d96b738 100644
--- a/src/gallium/drivers/svga/svga_resource_buffer.c
+++ b/src/gallium/drivers/svga/svga_resource_buffer.c
@@ -51,42 +51,6 @@ svga_buffer_needs_hw_storage(unsigned usage)
}
-static unsigned int
-svga_buffer_is_referenced( struct pipe_context *pipe,
- struct pipe_resource *buf,
- unsigned level, int layer)
-{
- struct svga_screen *ss = svga_screen(pipe->screen);
- struct svga_buffer *sbuf = svga_buffer(buf);
-
- /**
- * XXX: Check this.
- * The screen may cache buffer writes, but when we map, we map out
- * of those cached writes, so we don't need to set a
- * PIPE_REFERENCED_FOR_WRITE flag for cached buffers.
- */
-
- if (!sbuf->handle || ss->sws->surface_is_flushed(ss->sws, sbuf->handle))
- return PIPE_UNREFERENCED;
-
- /**
- * sws->surface_is_flushed() does not distinguish between read references
- * and write references. So assume a reference is both,
- * however, we make an exception for index- and vertex buffers, to avoid
- * a flush in st_bufferobj_get_subdata, during display list replay.
- */
-
- if (sbuf->b.b.bind & (PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER))
- return PIPE_REFERENCED_FOR_READ;
-
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
-
-
-
-
-
static void *
svga_buffer_map_range( struct pipe_screen *screen,
struct pipe_resource *buf,
@@ -274,7 +238,6 @@ struct u_resource_vtbl svga_buffer_vtbl =
{
u_default_resource_get_handle, /* get_handle */
svga_buffer_destroy, /* resource_destroy */
- svga_buffer_is_referenced, /* is_resource_referenced */
u_default_get_transfer, /* get_transfer */
u_default_transfer_destroy, /* transfer_destroy */
svga_buffer_transfer_map, /* transfer_map */
diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c
index f882bfef598..b61f85955a2 100644
--- a/src/gallium/drivers/svga/svga_resource_texture.c
+++ b/src/gallium/drivers/svga/svga_resource_texture.c
@@ -48,31 +48,6 @@
#define SVGA3D_SURFACE_HINT_SCANOUT (1 << 9)
-static unsigned int
-svga_texture_is_referenced( struct pipe_context *pipe,
- struct pipe_resource *texture,
- unsigned level, int layer)
-{
- struct svga_texture *tex = svga_texture(texture);
- struct svga_screen *ss = svga_screen(pipe->screen);
-
- /**
- * The screen does not cache texture writes.
- */
-
- if (!tex->handle || ss->sws->surface_is_flushed(ss->sws, tex->handle))
- return PIPE_UNREFERENCED;
-
- /**
- * sws->surface_is_flushed() does not distinguish between read references
- * and write references. So assume a reference is both.
- */
-
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
-
-
/*
* Helper function and arrays
*/
@@ -505,7 +480,6 @@ struct u_resource_vtbl svga_texture_vtbl =
{
svga_texture_get_handle, /* get_handle */
svga_texture_destroy, /* resource_destroy */
- svga_texture_is_referenced, /* is_resource_referenced */
svga_texture_get_transfer, /* get_transfer */
svga_texture_transfer_destroy, /* transfer_destroy */
svga_texture_transfer_map, /* transfer_map */
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index d24cc623c2e..6123873cac6 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -1219,31 +1219,6 @@ trace_context_destroy(struct pipe_context *_pipe)
FREE(tr_ctx);
}
-static unsigned int
-trace_is_resource_referenced( struct pipe_context *_pipe,
- struct pipe_resource *_resource,
- unsigned level, int layer)
-{
- struct trace_context *tr_ctx = trace_context(_pipe);
- struct trace_resource *tr_tex = trace_resource(_resource);
- struct pipe_context *pipe = tr_ctx->pipe;
- struct pipe_resource *texture = tr_tex->resource;
- unsigned int referenced;
-
- trace_dump_call_begin("pipe_context", "is_resource_referenced");
- trace_dump_arg(ptr, pipe);
- trace_dump_arg(ptr, texture);
- trace_dump_arg(uint, level);
- trace_dump_arg(int, layer);
-
- referenced = pipe->is_resource_referenced(pipe, texture, level, layer);
-
- trace_dump_ret(uint, referenced);
- trace_dump_call_end();
-
- return referenced;
-}
-
/********************************************************************
* transfer
@@ -1520,7 +1495,6 @@ trace_context_create(struct trace_screen *tr_scr,
tr_ctx->base.clear_render_target = trace_context_clear_render_target;
tr_ctx->base.clear_depth_stencil = trace_context_clear_depth_stencil;
tr_ctx->base.flush = trace_context_flush;
- tr_ctx->base.is_resource_referenced = trace_is_resource_referenced;
tr_ctx->base.get_transfer = trace_context_get_transfer;
tr_ctx->base.transfer_destroy = trace_context_transfer_destroy;
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 24ee3fe1175..4a0fbfdd4d6 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -320,21 +320,6 @@ struct pipe_context {
struct pipe_fence_handle **fence );
/**
- * Check whether a texture is referenced by an unflushed hw command.
- * The state-tracker uses this function to avoid unnecessary flushes.
- * It is safe (but wasteful) to always return
- * PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE.
- * \param pipe context whose unflushed hw commands will be checked.
- * \param texture texture to check.
- * \param level mipmap level.
- * \param layer cubemap face, 2d array or 3d slice, 0 otherwise. Use -1 for any layer.
- * \return mask of PIPE_REFERENCED_FOR_READ/WRITE or PIPE_UNREFERENCED
- */
- unsigned int (*is_resource_referenced)(struct pipe_context *pipe,
- struct pipe_resource *texture,
- unsigned level, int layer);
-
- /**
* Create a view on a texture to be used by a shader stage.
*/
struct pipe_sampler_view * (*create_sampler_view)(struct pipe_context *ctx,
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 9350a755d73..200ec67834b 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -507,13 +507,6 @@ enum pipe_shader_cap
PIPE_SHADER_CAP_SUBROUTINES, /* BGNSUB, ENDSUB, CAL, RET */
};
-/**
- * Referenced query flags.
- */
-
-#define PIPE_UNREFERENCED 0
-#define PIPE_REFERENCED_FOR_READ (1 << 0)
-#define PIPE_REFERENCED_FOR_WRITE (1 << 1)
/**
* Composite query types
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c
index 3b3ae455c0b..3e82fa8fdc1 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.c
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.c
@@ -519,10 +519,6 @@ renderer_clone_texture(struct xorg_renderer *r,
struct pipe_resource *pt;
struct pipe_resource templ;
- if (pipe->is_resource_referenced(pipe, src, 0, 0) &
- PIPE_REFERENCED_FOR_WRITE)
- pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
-
/* the coming in texture should already have that invariance */
debug_assert(screen->is_format_supported(screen, src->format,
PIPE_TEXTURE_2D, 0,
diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
index c72ba9ef8db..234574b968e 100644
--- a/src/gallium/state_trackers/xorg/xorg_xv.c
+++ b/src/gallium/state_trackers/xorg/xorg_xv.c
@@ -461,20 +461,6 @@ bind_shaders(struct xorg_xv_port_priv *port)
cso_set_fragment_shader_handle(port->r->cso, shader.fs);
}
-static INLINE void
-conditional_flush(struct pipe_context *pipe, struct pipe_resource **tex,
- int num)
-{
- int i;
- for (i = 0; i < num; ++i) {
- if (tex[i] && pipe->is_resource_referenced(pipe, tex[i], 0, 0) &
- PIPE_REFERENCED_FOR_WRITE) {
- pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
- return;
- }
- }
-}
-
static void
bind_samplers(struct xorg_xv_port_priv *port)
{
@@ -485,8 +471,6 @@ bind_samplers(struct xorg_xv_port_priv *port)
memset(&sampler, 0, sizeof(struct pipe_sampler_state));
- conditional_flush(port->r->pipe, dst, 3);
-
sampler.wrap_s = PIPE_TEX_WRAP_CLAMP;
sampler.wrap_t = PIPE_TEX_WRAP_CLAMP;
sampler.min_img_filter = PIPE_TEX_FILTER_LINEAR;