st/xorg: Flush render cache if but only if a source has pending write operations.
authorMichel Dänzer <daenzer@vmware.com>
Fri, 25 Sep 2009 18:49:53 +0000 (20:49 +0200)
committerMichel Dänzer <daenzer@vmware.com>
Fri, 25 Sep 2009 18:49:53 +0000 (20:49 +0200)
src/gallium/state_trackers/xorg/xorg_composite.c

index a97cad48b52e8c887adac7a99d758da1dd89a9ac..9d15a615f158cfa263ac351f883ae225b8ece6d1 100644 (file)
@@ -465,6 +465,12 @@ bind_samplers(struct exa_context *exa, int op,
    memset(&src_sampler, 0, sizeof(struct pipe_sampler_state));
    memset(&mask_sampler, 0, sizeof(struct pipe_sampler_state));
 
+   if ((pSrc && exa->pipe->is_texture_referenced(exa->pipe, pSrc->tex, 0, 0) &
+        PIPE_REFERENCED_FOR_WRITE) ||
+       (pMask && exa->pipe->is_texture_referenced(exa->pipe, pMask->tex, 0, 0) &
+        PIPE_REFERENCED_FOR_WRITE))
+      exa->pipe->flush(exa->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
+
    if (pSrcPicture && pSrc) {
       unsigned src_wrap = render_repeat_to_gallium(
          pSrcPicture->repeatType);
@@ -995,7 +1001,9 @@ void xorg_copy_pixmap(struct exa_context *ctx,
    struct pipe_texture *dst = dst_priv->tex;
    struct pipe_texture *src = src_priv->tex;
 
-   xorg_exa_finish(ctx);
+   if (ctx->pipe->is_texture_referenced(ctx->pipe, src, 0, 0) &
+       PIPE_REFERENCED_FOR_WRITE)
+      ctx->pipe->flush(ctx->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
 
    dst_loc[0] = dx;
    dst_loc[1] = dy;