diff options
author | Keith Whitwell <keithw@vmware.com> | 2009-11-05 13:57:05 +0000 |
---|---|---|
committer | Keith Whitwell <keithw@vmware.com> | 2009-11-05 14:01:37 +0000 |
commit | c796aed5ddad011d66e631c4cafdbf779e73f213 (patch) | |
tree | d8a510233b281c9d6a0690632948f10a03819a84 /src/gallium/drivers/i965/brw_screen_surface.c | |
parent | 31b8b1dd36d9f07a7893a89ee985d83c4d0bb95b (diff) |
i965g: add lots of error checks and early returns
Any allocation that may fail should be checked, and propogate the
error upwards. At the highest level we will flush batch and retry.
This is an alternate strategy to what the original DRI driver did of
attempting to flush batch from the lowest levels (eg inside
BEGIN_BATCH). The trouble with that strategy was that flushes could
occur at unexpected times, and additionally there was a need for a
wierd notification mechanism to propogate the 'lost context' state
back up to higher levels.
Propogating the errors directly gives us a lot of flexibility how to
deal with these states, at the expense of a lot more checking in the
code.
Will add some sanity checks later to make sure that out-of-memory
conditions are properly escalated and not lost halfway up the stack.
Diffstat (limited to 'src/gallium/drivers/i965/brw_screen_surface.c')
-rw-r--r-- | src/gallium/drivers/i965/brw_screen_surface.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/gallium/drivers/i965/brw_screen_surface.c b/src/gallium/drivers/i965/brw_screen_surface.c index 1c408e9f2e..21a7382873 100644 --- a/src/gallium/drivers/i965/brw_screen_surface.c +++ b/src/gallium/drivers/i965/brw_screen_surface.c @@ -150,9 +150,7 @@ static struct brw_surface *create_in_place_view( struct brw_screen *brw_screen, surface->pitch = tex->pitch; surface->tiling = tex->tiling; - surface->bo = tex->bo; - brw_screen->sws->bo_reference(surface->bo); - + bo_reference( &surface->bo, tex->bo ); pipe_texture_reference( &surface->base.texture, &tex->base ); surface->ss.ss0.surface_format = tex->ss.ss0.surface_format; @@ -244,11 +242,10 @@ static struct pipe_surface *brw_get_tex_surface(struct pipe_screen *screen, static void brw_tex_surface_destroy( struct pipe_surface *surf ) { struct brw_surface *surface = brw_surface(surf); - struct brw_screen *screen = brw_screen(surf->texture->screen); /* Unreference texture, shared buffer: */ - screen->sws->bo_unreference(surface->bo); + bo_reference(&surface->bo, NULL); pipe_texture_reference( &surface->base.texture, NULL ); |