[Mesa-dev] [PATCH 08/18] i965: Drop the global GEM name from regions.

Kristian Høgsberg krh at bitplanet.net
Tue Apr 29 21:55:41 PDT 2014


On Tue, Apr 29, 2014 at 4:34 PM, Eric Anholt <eric at anholt.net> wrote:
> Once a buffer has been named, drm_intel_bo_flink() is just a getter.

Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>

> ---
>  src/mesa/drivers/dri/i965/brw_context.c       | 11 ++++++++++-
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c |  2 --
>  src/mesa/drivers/dri/i965/intel_regions.c     | 15 ---------------
>  src/mesa/drivers/dri/i965/intel_regions.h     |  5 -----
>  src/mesa/drivers/dri/i965/intel_screen.c      |  4 ++--
>  5 files changed, 12 insertions(+), 25 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
> index 28118b9..e35cc7e 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.c
> +++ b/src/mesa/drivers/dri/i965/brw_context.c
> @@ -1267,7 +1267,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)) {
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> index 58a6b86..7a60671 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -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
> diff --git a/src/mesa/drivers/dri/i965/intel_regions.c b/src/mesa/drivers/dri/i965/intel_regions.c
> index 2fc57ed..311dc2c 100644
> --- a/src/mesa/drivers/dri/i965/intel_regions.c
> +++ b/src/mesa/drivers/dri/i965/intel_regions.c
> @@ -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;
>  }
>
> diff --git a/src/mesa/drivers/dri/i965/intel_regions.h b/src/mesa/drivers/dri/i965/intel_regions.h
> index c4dd243..0ad95a7 100644
> --- a/src/mesa/drivers/dri/i965/intel_regions.h
> +++ b/src/mesa/drivers/dri/i965/intel_regions.h
> @@ -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);
>
> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
> index 81c91ec..a7b87d5 100644
> --- a/src/mesa/drivers/dri/i965/intel_screen.c
> +++ b/src/mesa/drivers/dri/i965/intel_screen.c
> @@ -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;
> @@ -1404,7 +1404,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;
> --
> 1.9.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list