From: Rob Clark Date: Tue, 30 Jul 2019 15:12:46 +0000 (-0700) Subject: freedreno: drop unused fd_fence_ref param X-Git-Tag: android-x86-9.0-r1~3501 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=c93eae7f108d81239a03a195db334d41322d9152;p=android-x86%2Fexternal-mesa.git freedreno: drop unused fd_fence_ref param The pscreen param was just there to satisfy pipe_screen::fence_reference But some of the internal uses passed NULL for screen. Which is a bit ugly. Instead drop the param and add a shim function to plug into the screen. Signed-off-by: Rob Clark Reviewed-by: Eric Anholt --- diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c index f8fdc33ec72..51725c4aa75 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c @@ -663,7 +663,7 @@ handle_rgba_blit(struct fd_context *ctx, const struct pipe_blit_info *info) if (!can_do_blit(info)) return false; - fd_fence_ref(ctx->base.screen, &ctx->last_fence, NULL); + fd_fence_ref(&ctx->last_fence, NULL); batch = fd_bc_alloc_batch(&ctx->screen->batch_cache, ctx, true); diff --git a/src/gallium/drivers/freedreno/freedreno_batch.c b/src/gallium/drivers/freedreno/freedreno_batch.c index 61b5496efa5..35a88dfe1e2 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch.c +++ b/src/gallium/drivers/freedreno/freedreno_batch.c @@ -139,7 +139,7 @@ batch_fini(struct fd_batch *batch) /* in case batch wasn't flushed but fence was created: */ fd_fence_populate(batch->fence, 0, -1); - fd_fence_ref(NULL, &batch->fence, NULL); + fd_fence_ref(&batch->fence, NULL); fd_ringbuffer_del(batch->draw); if (!batch->nondraw) { diff --git a/src/gallium/drivers/freedreno/freedreno_blitter.c b/src/gallium/drivers/freedreno/freedreno_blitter.c index 5938a88ae06..86bfda42310 100644 --- a/src/gallium/drivers/freedreno/freedreno_blitter.c +++ b/src/gallium/drivers/freedreno/freedreno_blitter.c @@ -80,7 +80,7 @@ static void fd_blitter_pipe_begin(struct fd_context *ctx, bool render_cond, bool discard, enum fd_render_stage stage) { - fd_fence_ref(ctx->base.screen, &ctx->last_fence, NULL); + fd_fence_ref(&ctx->last_fence, NULL); util_blitter_save_fragment_constant_buffer_slot(ctx->blitter, ctx->constbuf[PIPE_SHADER_FRAGMENT].cb); diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c index ad03ac30fb8..b2ac396d9d1 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.c +++ b/src/gallium/drivers/freedreno/freedreno_context.c @@ -53,7 +53,7 @@ fd_context_flush(struct pipe_context *pctx, struct pipe_fence_handle **fencep, * a fence, re-use the last one: */ if (ctx->last_fence) { - fd_fence_ref(pctx->screen, &fence, ctx->last_fence); + fd_fence_ref(&fence, ctx->last_fence); goto out; } @@ -61,7 +61,7 @@ fd_context_flush(struct pipe_context *pctx, struct pipe_fence_handle **fencep, return; /* Take a ref to the batch's fence (batch can be unref'd when flushed: */ - fd_fence_ref(pctx->screen, &fence, batch->fence); + fd_fence_ref(&fence, batch->fence); /* TODO is it worth trying to figure out if app is using fence-fd's, to * avoid requesting one every batch? @@ -78,11 +78,11 @@ fd_context_flush(struct pipe_context *pctx, struct pipe_fence_handle **fencep, out: if (fencep) - fd_fence_ref(pctx->screen, fencep, fence); + fd_fence_ref(fencep, fence); - fd_fence_ref(pctx->screen, &ctx->last_fence, fence); + fd_fence_ref(&ctx->last_fence, fence); - fd_fence_ref(pctx->screen, &fence, NULL); + fd_fence_ref(&fence, NULL); } static void @@ -162,7 +162,7 @@ fd_context_destroy(struct pipe_context *pctx) DBG(""); - fd_fence_ref(pctx->screen, &ctx->last_fence, NULL); + fd_fence_ref(&ctx->last_fence, NULL); if (ctx->screen->reorder && util_queue_is_initialized(&ctx->flush_queue)) util_queue_destroy(&ctx->flush_queue); diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c index 2bb19d37d4e..059de2ec8c6 100644 --- a/src/gallium/drivers/freedreno/freedreno_draw.c +++ b/src/gallium/drivers/freedreno/freedreno_draw.c @@ -93,7 +93,7 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) return; } - fd_fence_ref(pctx->screen, &ctx->last_fence, NULL); + fd_fence_ref(&ctx->last_fence, NULL); /* Upload a user index buffer. */ struct pipe_resource *indexbuf = NULL; @@ -311,7 +311,7 @@ fd_clear(struct pipe_context *pctx, unsigned buffers, if (!fd_render_condition_check(pctx)) return; - fd_fence_ref(pctx->screen, &ctx->last_fence, NULL); + fd_fence_ref(&ctx->last_fence, NULL); if (ctx->in_blit) { fd_batch_reset(batch); diff --git a/src/gallium/drivers/freedreno/freedreno_fence.c b/src/gallium/drivers/freedreno/freedreno_fence.c index be104dc8978..9d49f10ed94 100644 --- a/src/gallium/drivers/freedreno/freedreno_fence.c +++ b/src/gallium/drivers/freedreno/freedreno_fence.c @@ -70,8 +70,7 @@ static void fd_fence_destroy(struct pipe_fence_handle *fence) FREE(fence); } -void fd_fence_ref(struct pipe_screen *pscreen, - struct pipe_fence_handle **ptr, +void fd_fence_ref(struct pipe_fence_handle **ptr, struct pipe_fence_handle *pfence) { if (pipe_reference(&(*ptr)->reference, &pfence->reference)) diff --git a/src/gallium/drivers/freedreno/freedreno_fence.h b/src/gallium/drivers/freedreno/freedreno_fence.h index 425c1906760..f0bc21bc890 100644 --- a/src/gallium/drivers/freedreno/freedreno_fence.h +++ b/src/gallium/drivers/freedreno/freedreno_fence.h @@ -31,10 +31,9 @@ void fd_fence_populate(struct pipe_fence_handle *fence, uint32_t timestamp, int fence_fd); -void fd_fence_ref(struct pipe_screen *pscreen, - struct pipe_fence_handle **ptr, +void fd_fence_ref(struct pipe_fence_handle **ptr, struct pipe_fence_handle *pfence); -bool fd_fence_finish(struct pipe_screen *screen, +bool fd_fence_finish(struct pipe_screen *pscreen, struct pipe_context *ctx, struct pipe_fence_handle *pfence, uint64_t timeout); diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index e9cd34aa384..b1c53707501 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -750,6 +750,13 @@ fd_screen_bo_from_handle(struct pipe_screen *pscreen, return bo; } +static void _fd_fence_ref(struct pipe_screen *pscreen, + struct pipe_fence_handle **ptr, + struct pipe_fence_handle *pfence) +{ + fd_fence_ref(ptr, pfence); +} + struct pipe_screen * fd_screen_create(struct fd_device *dev, struct renderonly *ro) { @@ -936,7 +943,7 @@ fd_screen_create(struct fd_device *dev, struct renderonly *ro) pscreen->get_timestamp = fd_screen_get_timestamp; - pscreen->fence_reference = fd_fence_ref; + pscreen->fence_reference = _fd_fence_ref; pscreen->fence_finish = fd_fence_finish; pscreen->fence_get_fd = fd_fence_get_fd;