[Mesa-dev] [PATCH] i915: Set swrast_texture_image::Buffer and ::Map during swrast mapping

Ian Romanick idr at freedesktop.org
Tue Feb 14 10:57:17 PST 2012

From: Ian Romanick <ian.d.romanick at intel.com>

Before calling _tnl_run_pipeline, the i915 driver maps all textures
used in vertex shaders (via intel_tex_map_images).  Later run_vp tries
to map the textures again (via _swrast_map_texture).  However, this
just replaces the actual mappings with NULL pointers.  When the
pointers are dereferened, a segfault occurs.

Setting swrast_texture_image::Buffer in intel_tex_map_images works
around the problem, but I have a hard time believing this is the right

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Eric Anholt <eric at anholt.net>
Cc: Brian Paul <brianp at vmware.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45882
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45885
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45886
 src/mesa/drivers/dri/intel/intel_tex_validate.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c
index b96f2a4..b91f364 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c
@@ -158,6 +158,7 @@ intel_tex_map_image_for_swrast(struct intel_context *intel,
       intel_image->base.Map = intel_region_map(intel, mt->region, mode) +
 	 (x + y * mt->region->pitch) * mt->cpp;
+      intel_image->base.Buffer = intel_image->base.Map;
    intel_image->base.RowStride = mt->region->pitch;
@@ -170,6 +171,7 @@ intel_tex_unmap_image_for_swrast(struct intel_context *intel,
    if (intel_image && intel_image->mt) {
       intel_region_unmap(intel, intel_image->mt->region);
       intel_image->base.Map = NULL;
+      intel_image->base.Buffer = NULL;

More information about the mesa-dev mailing list