i965: Remember to call intel_prepare_render() before blitting.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 6 Aug 2013 21:36:09 +0000 (14:36 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 8 Aug 2013 19:12:47 +0000 (12:12 -0700)
Otherwise, blits to the window system buffer may cause crashes,
since dst_irb->mt may be NULL.

This code is lifted straight out of brw_blorp_framebuffer()'s
try_blorp_blit() helper.

Fixes crashes in Piglit's fbo-sys-blit on systems without BLORP.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65919
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
src/mesa/drivers/dri/i965/intel_fbo.c

index fb0bb71b02851171440cd3a38a7882ddca3223b6..1692325903b0600f62019fa08751015ce74a75b7 100644 (file)
@@ -695,6 +695,11 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
 {
    struct brw_context *brw = brw_context(ctx);
 
+   /* Sync up the state of window system buffers.  We need to do this before
+    * we go looking for the buffers.
+    */
+   intel_prepare_render(brw);
+
    if (mask & GL_COLOR_BUFFER_BIT) {
       GLint i;
       const struct gl_framebuffer *drawFb = ctx->DrawBuffer;