From: Anuj Phogat <anuj.phogat@gmail.com>
To: Anuj Phogat <anuj.phogat@gmail.com>
Cc: mesa-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] intel: Fix a case when mapping large texture fails
Date: Wed, 07 Mar 2012 16:28:58 -0800 [thread overview]
Message-ID: <4F57FD4A.9090305@gmail.com> (raw)
In-Reply-To: <1330371946-7566-1-git-send-email-anuj.phogat@gmail.com>
On Mon 27 Feb 2012 11:45:46 AM PST, 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@gmail.com>
> ---
> src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 26 ++++++++++++++++-------
> src/mesa/drivers/dri/intel/intel_regions.c | 7 ++++-
> 2 files changed, 23 insertions(+), 10 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> index 5290da4..507702a 100644
> --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> @@ -702,15 +702,20 @@ intel_miptree_map_gtt(struct intel_context *intel,
> y /= bh;
>
> base = intel_region_map(intel, mt->region, map->mode);
> - /* Note that in the case of cube maps, the caller must have passed the slice
> - * number referencing the face.
> - */
> - intel_miptree_get_image_offset(mt, level, 0, slice, &image_x, &image_y);
> - x += image_x;
> - y += image_y;
>
> - map->stride = mt->region->pitch * mt->cpp;
> - map->ptr = base + y * map->stride + x * mt->cpp;
> + if (base == NULL)
> + map->ptr = NULL;
> + else {
> + /* Note that in the case of cube maps, the caller must have passed the
> + * slice number referencing the face.
> + */
> + intel_miptree_get_image_offset(mt, level, 0, slice, &image_x, &image_y);
> + x += image_x;
> + y += image_y;
> +
> + map->stride = mt->region->pitch * mt->cpp;
> + map->ptr = base + y * map->stride + x * mt->cpp;
> + }
>
> DBG("%s: %d,%d %dx%d from mt %p (%s) %d,%d = %p/%d\n", __FUNCTION__,
> map->x, map->y, map->w, map->h,
> @@ -1063,6 +1068,11 @@ intel_miptree_map(struct intel_context *intel,
>
> *out_ptr = map->ptr;
> *out_stride = map->stride;
> +
> + if (map->ptr == NULL) {
> + mt->level[level].slice[slice].map = NULL;
> + free(map);
> + }
> }
>
> 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++;
> + }
> }
>
> return region->map;
Any comments on this patch?
prev parent reply other threads:[~2012-03-08 0:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-27 19:45 [PATCH] intel: Fix a case when mapping large texture fails Anuj Phogat
2012-03-08 0:28 ` Anuj Phogat [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F57FD4A.9090305@gmail.com \
--to=anuj.phogat@gmail.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mesa-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox