st/dri: flush drawable textures before unreferencing
authorMarek Olšák <marek.olsak@amd.com>
Fri, 7 Mar 2014 16:25:05 +0000 (17:25 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 11 Mar 2014 17:51:20 +0000 (18:51 +0100)
This fixes piglit/fbo-sys-blit with fast clear on radeonsi.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/state_trackers/dri/drm/dri2.c

index 3d8d56973274735f29136298b208de604cf74a0e..4f2a87e86ce54f0f5bb047155d8438aad53110e3 100644 (file)
@@ -237,6 +237,14 @@ dri2_drawable_process_buffers(struct dri_context *ctx,
       if (i == ST_ATTACHMENT_DEPTH_STENCIL && alloc_depthstencil)
          continue;
 
+      /* Flush the texture before unreferencing, so that other clients can
+       * see what the driver has rendered.
+       */
+      if (i != ST_ATTACHMENT_DEPTH_STENCIL && drawable->textures[i]) {
+         struct pipe_context *pipe = ctx->st->pipe;
+         pipe->flush_resource(pipe, drawable->textures[i]);
+      }
+
       pipe_resource_reference(&drawable->textures[i], NULL);
    }