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

Anuj Phogat anuj.phogat at gmail.com
Tue Mar 27 12:39:34 PDT 2012


On Tue, Mar 27, 2012 at 12:47 AM, Yuanhan Liu
<yuanhan.liu at linux.intel.com>wrote:

> 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:
>
> ----
> From 3ce3f93d3378fd31df6dca24230edb52407cb9d8 Mon Sep 17 00:00:00 2001
> From: Yuanhan Liu <yuanhan.liu at linux.intel.com>
> Date: Tue, 27 Mar 2012 15:41:52 +0800
> Subject: [PATCH] intel: fix un-blanced map_refcount issue
>
> This is a regression introduced by commit cdcfd5, which forget to
> increase the map_refcount for successfully-mapped region. Thus caused a
> wrong non-blanced map_refcount.
>
> This would fix the regression found in the two following webglc testcase
> on Pineview platform:
>   texture-npot.html
>   gl-max-texture-dimensions.html
>
> Cc: Anuj Phogat <anuj.phogat at gmail.com>
> Signed-off-by: Yuanhan Liu <yuanhan.liu at linux.intel.com>
> ---
>  src/mesa/drivers/dri/intel/intel_regions.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/intel/intel_regions.c
> b/src/mesa/drivers/dri/intel/intel_regions.c
> index d2b737b..abea2bd 100644
> --- a/src/mesa/drivers/dri/intel/intel_regions.c
> +++ b/src/mesa/drivers/dri/intel/intel_regions.c
> @@ -133,10 +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;
> -      if (region->map) {
> -         intel->num_mapped_regions++;
> -         region->map_refcount++;
> -      }
> +   }
> +   if (region->map) {
> +      intel->num_mapped_regions++;
> +      region->map_refcount++;
>    }
>
>    return region->map;
> --
> 1.7.4.4
>
> Yes, I missed that. Thanks for fixing it.
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120327/250cf75d/attachment.htm>


More information about the mesa-dev mailing list