diff options
author | Keith Packard <keithp@keithp.com> | 2008-12-15 15:41:28 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-01-06 09:31:39 -0800 |
commit | 90b28a56553d809374fa6d9b9529b7a8b583488c (patch) | |
tree | e1f963eaa2f490a65327e8e8eb737435c896b16c /src/i965_render.c | |
parent | 8237faf8f3ca73ecdf0ef009a7d361b318726f6f (diff) |
Handle drm_bo_map failure in 965 video and composite paths.
These two paths allocate a number of objects directly.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/i965_render.c')
-rw-r--r-- | src/i965_render.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/i965_render.c b/src/i965_render.c index 3b0ee35d..00cb0514 100644 --- a/src/i965_render.c +++ b/src/i965_render.c @@ -1065,7 +1065,13 @@ _emit_batch_header_for_composite_internal (ScrnInfoPtr pScrn, Bool check_twice) surface_state_bo = dri_bo_alloc (pI830->bufmgr, "surface_state", 3 * sizeof (brw_surface_state_padded), 4096); - dri_bo_map (surface_state_bo, 1); + if (dri_bo_map (surface_state_bo, 1) != 0) { + dri_bo_unreference (surface_state_bo); + dri_bo_unreference (render_state->vertex_buffer_bo); + render_state->vertex_buffer_bo = NULL; + + return FALSE; + } /* Set up the state buffer for the destination surface */ i965_set_picture_surface_state(surface_state_bo, 0, pDstPicture, pDst, TRUE); @@ -1083,7 +1089,15 @@ _emit_batch_header_for_composite_internal (ScrnInfoPtr pScrn, Bool check_twice) /* Set up the binding table of surface indices to surface state. */ binding_table_bo = dri_bo_alloc (pI830->bufmgr, "binding_table", 3 * sizeof (uint32_t), 4096); - dri_bo_map (binding_table_bo, 1); + if (dri_bo_map (binding_table_bo, 1) != 0) { + dri_bo_unreference(binding_table_bo); + dri_bo_unreference(surface_state_bo); + dri_bo_unreference (render_state->vertex_buffer_bo); + render_state->vertex_buffer_bo = NULL; + + return FALSE; + } + binding_table = binding_table_bo->virtual; binding_table[0] = 0 * sizeof (brw_surface_state_padded) + surface_state_bo->offset; dri_bo_emit_reloc (binding_table_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, @@ -1495,7 +1509,9 @@ i965_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, _emit_batch_header_for_composite (pScrn); /* Map the vertex_buffer buffer object so we can write to it. */ - dri_bo_map (render_state->vertex_buffer_bo, 1); + if (dri_bo_map (render_state->vertex_buffer_bo, 1) != 0) + return; /* XXX what else to do here? */ + vb = render_state->vertex_buffer_bo->virtual; i = render_state->vb_offset; |