summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-03-04 15:04:36 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-03-07 10:53:05 +0000
commitde7678ef521f4fb34459e407a66ab8bf8be733e1 (patch)
tree782ef5303f887d8e74b76229fa2f683ed0aa5fcc /src/mesa
parentf627d429bda8196fd20f2023374ad6d34e4becb6 (diff)
intel: Add some defense against buffer allocation failure for subimage blits
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_subimage.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
index 6b7f13ff35..d0f8294113 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
@@ -90,19 +90,19 @@ intelTexSubimage(struct gl_context * ctx,
intel->gen < 6 && target == GL_TEXTURE_2D &&
drm_intel_bo_busy(dst_bo))
{
- unsigned long pitch;
- uint32_t tiling_mode = I915_TILING_NONE;
- temp_bo = drm_intel_bo_alloc_tiled(intel->bufmgr,
- "subimage blit bo",
- width, height,
- intelImage->mt->cpp,
- &tiling_mode,
- &pitch,
- 0);
- drm_intel_gem_bo_map_gtt(temp_bo);
+ dstRowStride = width * intelImage->mt->cpp;
+ temp_bo = drm_intel_bo_alloc(intel->bufmgr, "subimage blit bo",
+ dstRowStride * height, 0);
+ if (!temp_bo)
+ 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;
intel_miptree_get_image_offset(intelImage->mt, level,
intelImage->face, 0,