From bc3f66311da13b614650ad8711a8a8bb7e4a2b5b Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 29 Apr 2021 11:10:46 -0700 Subject: [PATCH] freedreno: Flush resources harder pctx->flush_resource() has the same expectations that the resource can be shared with an external client as pctx->flush(), but without the convenience of a fence to know *when* the resource must be visible to that external client. So we need to ensure the batch is flushed all the way to the kernel so that implicit-sync can do it's job. Fixes: e9a9ac6f77f ("freedreno/drm: Async submit support") Signed-off-by: Rob Clark Part-of: --- src/gallium/drivers/freedreno/freedreno_resource.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index da19157348c..2adaf60ddf4 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -641,9 +641,18 @@ flush_resource(struct fd_context *ctx, struct fd_resource *rsc, } static void -fd_flush_resource(struct pipe_context *pctx, struct pipe_resource *prsc) in_dt +fd_flush_resource(struct pipe_context *pctx, struct pipe_resource *prsc) + in_dt { - flush_resource(fd_context(pctx), fd_resource(prsc), PIPE_MAP_READ); + struct fd_context *ctx = fd_context(pctx); + struct fd_resource *rsc = fd_resource(prsc); + + flush_resource(ctx, rsc, PIPE_MAP_READ); + + /* If we had to flush a batch, make sure it makes it's way all the + * way to the kernel: + */ + fd_resource_wait(ctx, rsc, FD_BO_PREP_FLUSH); } static void