i965: Drop the global GEM name from regions.
authorEric Anholt <eric@anholt.net>
Fri, 25 Apr 2014 19:21:11 +0000 (12:21 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 1 May 2014 22:12:26 +0000 (15:12 -0700)
Once a buffer has been named, drm_intel_bo_flink() is just a getter.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.c
src/mesa/drivers/dri/i965/intel_regions.c
src/mesa/drivers/dri/i965/intel_regions.h
src/mesa/drivers/dri/i965/intel_screen.c

index cad83e24c887f3bf6f637519ac708f56ce223a92..2dbc327ffe5bbbdc935c757d7625a33b3a717d5b 100644 (file)
@@ -1259,7 +1259,16 @@ intel_process_dri2_buffer(struct brw_context *brw,
    else
       last_mt = rb->singlesample_mt;
 
-   if (last_mt && last_mt->region->name == buffer->name)
+   /* Get the name for our previous RB mt.  We know it had a name already (and
+    * thus the DRM call is just a getter), because it could only have been
+    * allocated by a previous intel_process_dri2_buffer(), so
+    * drm_intel_bo_flink() is just a getter.
+    */
+   uint32_t old_name = 0;
+   if (last_mt)
+      drm_intel_bo_flink(last_mt->region->bo, &old_name);
+
+   if (old_name == buffer->name)
       return;
 
    if (unlikely(INTEL_DEBUG & DEBUG_DRI)) {
index 58a6b86fce5243b2524a6db91182438700285fec..7a6067160304cb336571fa5531f933f9466808ce 100644 (file)
@@ -723,8 +723,6 @@ intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
    if (!singlesample_mt)
       goto fail;
 
-   singlesample_mt->region->name = region->name;
-
    /* If this miptree is capable of supporting fast color clears, set
     * mcs_state appropriately to ensure that fast clears will occur.
     * Allocation of the MCS miptree will be deferred until the first fast
index 2fc57ed926732dc830e7e1b803e11425f8350286..311dc2ce900f96a4907f0a9bc7ba41ca1cf64a92 100644 (file)
@@ -158,19 +158,6 @@ intel_region_alloc(struct intel_screen *screen,
    return region;
 }
 
-bool
-intel_region_flink(struct intel_region *region, uint32_t *name)
-{
-   if (region->name == 0) {
-      if (drm_intel_bo_flink(region->bo, &region->name))
-        return false;
-   }
-
-   *name = region->name;
-
-   return true;
-}
-
 struct intel_region *
 intel_region_alloc_for_handle(struct intel_screen *screen,
                              GLuint cpp,
@@ -200,8 +187,6 @@ intel_region_alloc_for_handle(struct intel_screen *screen,
       return NULL;
    }
 
-   region->name = handle;
-
    return region;
 }
 
index c4dd243e45c3fde0f3c2992fad7aff760e160494..0ad95a79ce50bdb2a949fa27fa8d9af8eac74f3e 100644 (file)
@@ -68,8 +68,6 @@ struct intel_region
    GLuint pitch;    /**< in bytes */
 
    uint32_t tiling; /**< Which tiling mode the region is in */
-
-   uint32_t name; /**< Global name for the bo */
 };
 
 
@@ -95,9 +93,6 @@ intel_region_alloc_for_fd(struct intel_screen *screen,
                           GLuint size,
                           int fd, const char *name);
 
-bool
-intel_region_flink(struct intel_region *region, uint32_t *name);
-
 void intel_region_reference(struct intel_region **dst,
                             struct intel_region *src);
 
index 778d5008503fdf3ba6d9c28c5eccc52ed3054fd7..976af029d9f18b56715f944224210ff45bf9441a 100644 (file)
@@ -525,7 +525,7 @@ intel_query_image(__DRIimage *image, int attrib, int *value)
       *value = image->region->bo->handle;
       return true;
    case __DRI_IMAGE_ATTRIB_NAME:
-      return intel_region_flink(image->region, (uint32_t *) value);
+      return !drm_intel_bo_flink(image->region->bo, (uint32_t *) value);
    case __DRI_IMAGE_ATTRIB_FORMAT:
       *value = image->dri_format;
       return true;
@@ -1409,7 +1409,7 @@ intelAllocateBuffer(__DRIscreen *screen,
           return NULL;
    }
 
-   intel_region_flink(intelBuffer->region, &intelBuffer->base.name);
+   drm_intel_bo_flink(intelBuffer->region->bo, &intelBuffer->base.name);
 
    intelBuffer->base.attachment = attachment;
    intelBuffer->base.cpp = intelBuffer->region->cpp;