freedreno: add a reading flag to indicate gpu is reading rsc
authorIlia Mirkin <imirkin@alum.mit.edu>
Fri, 3 Apr 2015 06:25:58 +0000 (02:25 -0400)
committerRob Clark <robclark@freedesktop.org>
Sun, 5 Apr 2015 20:36:34 +0000 (16:36 -0400)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/freedreno/freedreno_resource.c
src/gallium/drivers/freedreno/freedreno_resource.h

index 407a3528aaa26e2743b32051a0a66ec80fe073ef..6e7958d42ddb48f0cbdc4c10967892e49fb889a9 100644 (file)
@@ -123,7 +123,8 @@ fd_resource_transfer_map(struct pipe_context *pctx,
                /* If the GPU is writing to the resource, or if it is reading from the
                 * resource and we're trying to write to it, flush the renders.
                 */
-               if (rsc->dirty)
+               if (rsc->dirty ||
+                       ((ptrans->usage & PIPE_TRANSFER_WRITE) && rsc->reading))
                        fd_context_render(pctx);
 
                /* The GPU keeps track of how the various bo's are being used, and
index bad36813461f564750a35653b8e7bba0726b82db..1f246328969f0216aaabb4facae3dda51e1a2b08 100644 (file)
@@ -66,7 +66,7 @@ struct fd_resource {
        uint32_t layer_size;
        struct fd_resource_slice slices[MAX_MIP_LEVELS];
        uint32_t timestamp;
-       bool dirty;
+       bool dirty, reading;
 };
 
 static INLINE struct fd_resource *