[Mesa-dev] [Intel-gfx] [PATCH] intel: Fix a case when mapping large texture fails

Yuanhan Liu yuanhan.liu at linux.intel.com
Tue Mar 27 00:47:48 PDT 2012


On Mon, Feb 27, 2012 at 11:45:46AM -0800, Anuj Phogat wrote:
> This patch handles a case when mapping a large texture fails
> in drm_intel_gem_bo_map_gtt(). These changes avoid assertion
> failure later in the driver as reported in following bugs:
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=44970
> https://bugs.freedesktop.org/show_bug.cgi?id=46303
> 
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> --
[..]  
>  void
> diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
> index bc83649..982d6cb 100644
> --- a/src/mesa/drivers/dri/intel/intel_regions.c
> +++ b/src/mesa/drivers/dri/intel/intel_regions.c
> @@ -124,7 +124,7 @@ intel_region_map(struct intel_context *intel, struct intel_region *region,
>      */
>  
>     _DBG("%s %p\n", __FUNCTION__, region);
> -   if (!region->map_refcount++) {
> +   if (!region->map_refcount) {
>        intel_flush(&intel->ctx);
>  
>        if (region->tiling != I915_TILING_NONE)
> @@ -133,7 +133,10 @@ intel_region_map(struct intel_context *intel, struct intel_region *region,
>  	 drm_intel_bo_map(region->bo, true);
>  
>        region->map = region->bo->virtual;
> -      ++intel->num_mapped_regions;
> +      if (region->map) {
> +         ++intel->num_mapped_regions;
> +	 region->map_refcount++;
> +      }
>     }
Hi Anuj,

The above change will make the map_refcount un-blanced since you removed
the increase to the successfully mapped region, here is a patch to fix
this issue:

----


More information about the mesa-dev mailing list