i965: Fallback on encountering a NULL render buffer
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 18 Feb 2011 17:51:10 +0000 (17:51 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 21 Feb 2011 12:59:33 +0000 (12:59 +0000)
Following a GPU hang, or other error, the render target is not likely to
have an allocated BO and so we must fallback to avoid using it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32534
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/mesa/drivers/dri/i965/brw_wm_surface_state.c

index c931df3c605cf9f1268e4ef9f66c9bec0a004e4a..601bbc7b1a0ad16418d976a74a90969a9a799000 100644 (file)
@@ -536,6 +536,11 @@ prepare_wm_surfaces(struct brw_context *brw)
         struct intel_renderbuffer *irb = intel_renderbuffer(rb);
         struct intel_region *region = irb ? irb->region : NULL;
 
+        if (region == NULL || region->buffer == NULL) {
+           brw->intel.Fallback = GL_TRUE; /* boolean, not bitfield */
+           return;
+        }
+
         brw_add_validated_bo(brw, region->buffer);
         nr_surfaces = SURF_INDEX_DRAW(i) + 1;
       }