gallium: kill is_resource_referenced
authorMarek Olšák <maraeo@gmail.com>
Mon, 7 Mar 2011 21:35:49 +0000 (22:35 +0100)
committerMarek Olšák <maraeo@gmail.com>
Fri, 11 Mar 2011 20:39:30 +0000 (21:39 +0100)
Only st/xorg used it and even incorrectly with regards to pipelined transfers.

44 files changed:
src/gallium/auxiliary/util/u_resource.c
src/gallium/auxiliary/util/u_transfer.c
src/gallium/auxiliary/util/u_transfer.h
src/gallium/drivers/cell/ppu/cell_context.c
src/gallium/drivers/failover/fo_context.c
src/gallium/drivers/galahad/glhd_context.c
src/gallium/drivers/i915/i915_resource.c
src/gallium/drivers/i915/i915_resource_buffer.c
src/gallium/drivers/i915/i915_resource_texture.c
src/gallium/drivers/i965/brw_resource_buffer.c
src/gallium/drivers/i965/brw_resource_texture.c
src/gallium/drivers/identity/id_context.c
src/gallium/drivers/llvmpipe/lp_flush.c
src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/llvmpipe/lp_texture.c
src/gallium/drivers/llvmpipe/lp_texture.h
src/gallium/drivers/noop/noop_pipe.c
src/gallium/drivers/nouveau/nouveau_buffer.c
src/gallium/drivers/nouveau/nouveau_screen.c
src/gallium/drivers/nouveau/nouveau_screen.h
src/gallium/drivers/nv50/nv50_miptree.c
src/gallium/drivers/nv50/nv50_resource.c
src/gallium/drivers/nvc0/nvc0_miptree.c
src/gallium/drivers/nvc0/nvc0_resource.c
src/gallium/drivers/nvfx/nvfx_resource.c
src/gallium/drivers/r300/r300_resource.c
src/gallium/drivers/r300/r300_screen_buffer.c
src/gallium/drivers/r300/r300_screen_buffer.h
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r600/r600_buffer.c
src/gallium/drivers/r600/r600_resource.c
src/gallium/drivers/r600/r600_texture.c
src/gallium/drivers/rbug/rbug_context.c
src/gallium/drivers/softpipe/sp_context.c
src/gallium/drivers/softpipe/sp_context.h
src/gallium/drivers/softpipe/sp_flush.c
src/gallium/drivers/svga/svga_resource.c
src/gallium/drivers/svga/svga_resource_buffer.c
src/gallium/drivers/svga/svga_resource_texture.c
src/gallium/drivers/trace/tr_context.c
src/gallium/include/pipe/p_context.h
src/gallium/include/pipe/p_defines.h
src/gallium/state_trackers/xorg/xorg_renderer.c
src/gallium/state_trackers/xorg/xorg_xv.c

index ea6896b430f91da19d0e6ecd93a7c33037897bb8..50a7cd4d55b0b9356c99cfdf8ebd4d73ad7121e3 100644 (file)
@@ -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,
index b6c63d9642f9914d98832ceeb659b0c2503253a7..7e72a59ee00a97e1381f62e349c6aabbfe2346b8 100644 (file)
@@ -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,
index 8cf9c418b040fdbe0b4bbc7b7458f0cb6efd8706..5b5ddeb4abacbeb54f16728e1f65095d45831bdc 100644 (file)
@@ -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,
index f9b83c8666c1d6464f5abf92a77c8c8346007934..58e647a39fa0c027a03ccf775cf4b2fed4d3448b 100644 (file)
@@ -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;
index d60718d971661f0121ffc6eda89ff1453551f17c..b536dc4afabb30cfc47ab3add4053997d1b49adb 100644 (file)
@@ -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;
 
index 75e4c253dd98ab1f6115089518965b8573275835..1dc652c6bd9de1fa9ad6fba26a24e8dcb8014f29 100644 (file)
@@ -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;
index 499233ceb9be1d5f2e86c7299a2c68846e3d5574..7f52ba11d61a64ad472bce83cf7a4e79eba19940 100644 (file)
@@ -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;
index 51482f54fc4eba9d0951bb99733e27e5fbc49d43..77c03450b3a24b81449838c82d2cca95a8e1bdcf 100644 (file)
@@ -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 */
index aad5235a6ad3c2bb26632f627bde0f525f5d62f7..df60493b5e43a8ea3a6de7c4e39372cc2619a79d 100644 (file)
@@ -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 */
index afb96ee3e7fd6b0ab718cde45514f71f82974d13..32dc54f2b26d6d497375302907f47003ca9e945d 100644 (file)
@@ -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 */
index 0cb895f35dee26488f3fddde0c41f84181d55a68..71a182902483ed65134a2087471ccc5de0a2ceab 100644 (file)
@@ -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 */
index b533abe24c6145df45e783d190bdaa69e56ac441..5c865f8a22c2064a83ae2c035604d164d674465b 100644 (file)
@@ -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;
index 6118164b20b0fb4f353cec54c739471e01b4a4c6..343c6145e7ea6ea273411c78af4009b3a6285bd2 100644 (file)
@@ -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) {
          /*
index 7b7b2721ba886648f3fda5e2eb7de78f207056d4..41d8fa6d124e41fc8fbbdff08f19e835cb6187ab 100644 (file)
@@ -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;
 }
 
 
index 9753da5e57e8e62663f5851cb5875c8436e4cc21..2e6a4bd7dc888422e5650f2dce7b184d40511465 100644 (file)
@@ -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;
index b789c0f4090a1bd1602627db9b84cc2f210e9746..b4a0dfd1c36e3e7bb444930f67937d7f84dbb1e7 100644 (file)
@@ -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 */
index 3680f4622da82339a792a786ab386568f8495832..90b6ebf36b5a6c35965156f8e52e298c6ddd481a 100644 (file)
@@ -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;
index d0cc29104b84a880ff46a2949ee8e48a8dfa0b65..01d3aa46d0ee7636fd58194b310af7c09932f84a 100644 (file)
@@ -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 */
index 3111bef7a22b945033056ce22dcdabf671d9bd07..d6c2a0a199a1cfbbaaaa0f7f2c7b72b9ce080ba9 100644 (file)
@@ -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)
 {
index c091abf27860e5c7573910e858b66549b0c08277..186ada3967754b8f910044b0971b346b50114d4b 100644 (file)
@@ -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 *);
index ae6b26af1ebfb2fd8803b20d1e8fb208ab2d4145..9eeca05ada3f0f3a7ad5e39d1f946418dd88c437 100644 (file)
@@ -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 */
index 2a2fb0e32bc97a1bec0e36ad515b18c38a0a23ed..1ae4d70a84571e3e406af641c9ef3c2c305419dc 100644 (file)
@@ -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;
 }
index db9117c3ff174dba217a1cd117e7693a58f06dff..bced3245524f890599a66d663d9b3090544a47cf 100644 (file)
@@ -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 */
index fb5a496b84bf30f83ba8343e7e8c38e84f548fe6..44e66314e7eccc4a43f2ca77cd0b7fddb231e90c 100644 (file)
@@ -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;
 }
index c60a7bb8b93c86c2314ce194d169914d11f5a1d5..42e77c536216381f550025c8b81644c457f99e72 100644 (file)
@@ -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;
 }
index f3d8c5b889f5c51d199c114a92991fe8e308a15a..6593474b1f052ebd4769381696239dfca0ad6240 100644 (file)
@@ -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;
 }
index 1045911f3ae8f52c75de50c096c8dab29e4f7136..986ae384fbf9774e6fba100082e071bc67c532d1 100644 (file)
 #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 */
index 14bee460d5b0602ad9d8dfc50d05518346324849..cdbc4425fcb2ffb33bcebcf888c80ad4d33f96fe 100644 (file)
@@ -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)
index 70f087a4efa34d23e03ee120f2ed1f5b8c4d241b..c650fb7ed3773709fd0c819475e7d8e527842d09 100644 (file)
@@ -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 */
index 2363cd1ebc5db5d043b56212f40ace1142022dfe..6ced719c8f01a2d708f62f32fa0bb9383de99b68 100644 (file)
@@ -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 */
index 207642ccfa90010574cd439dc837e23940ff3822..f3ab3613c84033d6a72e083f06a99976c4013b9e 100644 (file)
@@ -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;
 }
index df83302b38e9c33bce02dda13f58f4c1fe1f8bd3..10b6c0cff70838862095533c13b925518157d97c 100644 (file)
@@ -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 */
index 4a5d5413d8cd71737956e352f6af410e5e683479..f5e2d5f4d6240374ffe03a5a38b7c725e555e7f2 100644 (file)
@@ -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;
index 70fdfb7ddf3fbecc83873873ad26fc3bef95d88a..5ea2ee58219f436ba0dd371c97ab0c0bdb7c16d8 100644 (file)
@@ -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;
 
    /*
index c91709aef06303f7279b4099fbc217b810232400..a572ee8cf0020c99dbc4f330e5c83dd4908a9f7e 100644 (file)
@@ -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 */
index 00a2fafdfa290152287c45ec225242feefc1781f..f16751a2163aaa3b892da90f0b82350649e87ce9 100644 (file)
@@ -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) {
index bed15ec02e53f8d128bc7916db7d9e1e1598c0f7..6e0622a312b2379702ad6dc9fb9ede35d383846e 100644 (file)
@@ -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;
index e1f07d655b96f314c097878fa05cdaf7d956f508..b0e6d96b738c48a4e863e0e7a1ca080884162dc9 100644 (file)
@@ -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 */
index f882bfef59806b1855317aadfecd5c16f43aa187..b61f85955a2424d766f71907cd49298f51d7a7cc 100644 (file)
 #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 */
index d24cc623c2ee26c82a4061c3596e7e8fbab99969..6123873cac629c9eb5363ca8b8da4e7b629b7a0e 100644 (file)
@@ -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;
index 24ee3fe117535a2a08013e38852ba1fef7532263..4a0fbfdd4d6005c8c8f26788b9409173fc931e9e 100644 (file)
@@ -319,21 +319,6 @@ struct pipe_context {
                   unsigned flags,
                   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.
     */
index 9350a755d735f257ba21d1c14f5c11be260e29b3..200ec67834b7096ccfa748e348c95031fd9a870c 100644 (file)
@@ -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
index 3b3ae455c0b6648cad00c000483d8cb2ad378e64..3e82fa8fdc12dd160eaee335725074ab870a0118 100644 (file)
@@ -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,
index c72ba9ef8dbd67b1346d055db988a6e56c0a1acb..234574b968eb88a55a31ade5c83df3364726c746 100644 (file)
@@ -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;