Mesa (master): intel: Add some defense against buffer allocation failure for subimage blits

Chris Wilson ickle at kemper.freedesktop.org
Wed Mar 30 10:16:28 UTC 2011


Module: Mesa
Branch: master
Commit: 5eb9f687087a4bc71775a32efcd848fc6cd67694
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5eb9f687087a4bc71775a32efcd848fc6cd67694

Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Mar  4 15:04:36 2011 +0000

intel: Add some defense against buffer allocation failure for subimage blits

Once more! This time without the unwarranted conversion from
drm_intel_bo_alloc_tiled.

Signed-off-by: [a very embarrassed] Chris Wilson <chris at chris-wilson.co.uk>

---

 src/mesa/drivers/dri/intel/intel_tex_subimage.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
index 6b7f13f..8b43c40 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
@@ -92,6 +92,7 @@ intelTexSubimage(struct gl_context * ctx,
       {
 	 unsigned long pitch;
 	 uint32_t tiling_mode = I915_TILING_NONE;
+
 	 temp_bo = drm_intel_bo_alloc_tiled(intel->bufmgr,
 					    "subimage blit bo",
 					    width, height,
@@ -99,7 +100,14 @@ intelTexSubimage(struct gl_context * ctx,
 					    &tiling_mode,
 					    &pitch,
 					    0);
-	 drm_intel_gem_bo_map_gtt(temp_bo);
+         if (temp_bo == NULL)
+            return;
+
+	 if (drm_intel_gem_bo_map_gtt(temp_bo)) {
+            drm_intel_bo_unreference(temp_bo);
+            return;
+         }
+
 	 texImage->Data = temp_bo->virtual;
 	 texImage->ImageOffsets[0] = 0;
 	 dstRowStride = pitch;




More information about the mesa-commit mailing list