freedreno: fence fix
authorRob Clark <robclark@freedesktop.org>
Sun, 16 Aug 2015 23:18:22 +0000 (19:18 -0400)
committerRob Clark <robclark@freedesktop.org>
Tue, 18 Aug 2015 19:36:30 +0000 (15:36 -0400)
Don't take current timestamp/fence from current ring, as we might have
already rolled over to new rb.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/freedreno_context.c
src/gallium/drivers/freedreno/freedreno_fence.c
src/gallium/drivers/freedreno/freedreno_fence.h

index 8e6d43150cea1fdfa4be55ee291e8d11aea1e125..0b6b9fbbe7a361de57074884191a0f84002fed3c 100644 (file)
@@ -131,11 +131,13 @@ static void
 fd_context_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
                unsigned flags)
 {
+       struct fd_ringbuffer *ring = fd_context(pctx)->ring;
+
        fd_context_render(pctx);
 
        if (fence) {
                fd_screen_fence_ref(pctx->screen, fence, NULL);
-               *fence = fd_fence_create(pctx);
+               *fence = fd_fence_create(pctx, fd_ringbuffer_timestamp(ring));
        }
 }
 
index 04a9feacd5854af51f498522864e426e02d0591d..337359c1a5b8df97f507308b2d2227fad9eaf697 100644 (file)
@@ -78,7 +78,8 @@ boolean fd_screen_fence_finish(struct pipe_screen *screen,
        return true;
 }
 
-struct pipe_fence_handle * fd_fence_create(struct pipe_context *pctx)
+struct pipe_fence_handle * fd_fence_create(struct pipe_context *pctx,
+               uint32_t timestamp)
 {
        struct pipe_fence_handle *fence;
        struct fd_context *ctx = fd_context(pctx);
@@ -91,7 +92,7 @@ struct pipe_fence_handle * fd_fence_create(struct pipe_context *pctx)
 
        fence->ctx = ctx;
        fence->screen = ctx->screen;
-       fence->timestamp = fd_ringbuffer_timestamp(ctx->ring);
+       fence->timestamp = timestamp;
 
        return fence;
 }
index e36bcc4d1f2bf106a37bf2ab9155f411f552133c..9bb3e21a4649ce38620a5533a9f2d4efa90ee70f 100644 (file)
@@ -39,6 +39,7 @@ boolean fd_screen_fence_signalled(struct pipe_screen *screen,
 boolean fd_screen_fence_finish(struct pipe_screen *screen,
                struct pipe_fence_handle *pfence,
                uint64_t timeout);
-struct pipe_fence_handle * fd_fence_create(struct pipe_context *pctx);
+struct pipe_fence_handle * fd_fence_create(struct pipe_context *pctx,
+               uint32_t timestamp);
 
 #endif /* FREEDRENO_FENCE_H_ */