From: Rob Clark Date: Thu, 24 Aug 2017 13:34:48 +0000 (-0400) Subject: freedreno: per-context fd_pipe X-Git-Tag: upstream/18.1.0~4833 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eed9685dd6619ec7598e8c3fd81117d36010510d;p=platform%2Fupstream%2Fmesa.git freedreno: per-context fd_pipe To enable per-context priorities, we need to have per-context pipe's. Unfortunately we still need to keep the global screen pipe, mostly just for screen->get_timestamp(). Signed-off-by: Rob Clark --- diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_draw.c b/src/gallium/drivers/freedreno/a5xx/fd5_draw.c index d1f1d03..1e9117a 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_draw.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_draw.c @@ -194,7 +194,7 @@ fd5_clear_lrz(struct fd_batch *batch, struct fd_resource *zsbuf, double depth) // draw if (!batch->lrz_clear) { - batch->lrz_clear = fd_ringbuffer_new(batch->ctx->screen->pipe, 0x1000); + batch->lrz_clear = fd_ringbuffer_new(batch->ctx->pipe, 0x1000); fd_ringbuffer_set_parent(batch->lrz_clear, batch->gmem); } diff --git a/src/gallium/drivers/freedreno/freedreno_batch.c b/src/gallium/drivers/freedreno/freedreno_batch.c index c2142b5..8f0f788 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch.c +++ b/src/gallium/drivers/freedreno/freedreno_batch.c @@ -53,9 +53,9 @@ batch_init(struct fd_batch *batch) size = 0x100000; } - batch->draw = fd_ringbuffer_new(ctx->screen->pipe, size); - batch->binning = fd_ringbuffer_new(ctx->screen->pipe, size); - batch->gmem = fd_ringbuffer_new(ctx->screen->pipe, size); + batch->draw = fd_ringbuffer_new(ctx->pipe, size); + batch->binning = fd_ringbuffer_new(ctx->pipe, size); + batch->gmem = fd_ringbuffer_new(ctx->pipe, size); fd_ringbuffer_set_parent(batch->gmem, NULL); fd_ringbuffer_set_parent(batch->draw, batch->gmem); diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c index e17dcf7..20480f4 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.c +++ b/src/gallium/drivers/freedreno/freedreno_context.c @@ -144,6 +144,7 @@ fd_context_destroy(struct pipe_context *pctx) } fd_device_del(ctx->dev); + fd_pipe_del(ctx->pipe); if (fd_mesa_debug & (FD_DBG_BSTAT | FD_DBG_MSGS)) { printf("batch_total=%u, batch_sysmem=%u, batch_gmem=%u, batch_restore=%u\n", @@ -251,6 +252,7 @@ fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen, int i; ctx->screen = screen; + ctx->pipe = fd_pipe_new(screen->dev, FD_PIPE_3D); ctx->primtypes = primtypes; ctx->primtype_mask = 0; diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h index 393b485..f10f7ef 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.h +++ b/src/gallium/drivers/freedreno/freedreno_context.h @@ -156,6 +156,7 @@ struct fd_context { struct fd_device *dev; struct fd_screen *screen; + struct fd_pipe *pipe; struct util_queue flush_queue; diff --git a/src/gallium/drivers/freedreno/freedreno_fence.c b/src/gallium/drivers/freedreno/freedreno_fence.c index f20c6ac..e3d200a 100644 --- a/src/gallium/drivers/freedreno/freedreno_fence.c +++ b/src/gallium/drivers/freedreno/freedreno_fence.c @@ -69,7 +69,7 @@ boolean fd_fence_finish(struct pipe_screen *pscreen, return ret == 0; } - if (fd_pipe_wait_timeout(fence->screen->pipe, fence->timestamp, timeout)) + if (fd_pipe_wait_timeout(fence->ctx->pipe, fence->timestamp, timeout)) return false; return true; diff --git a/src/gallium/drivers/freedreno/freedreno_query_acc.c b/src/gallium/drivers/freedreno/freedreno_query_acc.c index 96cee1a..724ef69 100644 --- a/src/gallium/drivers/freedreno/freedreno_query_acc.c +++ b/src/gallium/drivers/freedreno/freedreno_query_acc.c @@ -66,7 +66,7 @@ realloc_query_bo(struct fd_context *ctx, struct fd_acc_query *aq) /* don't assume the buffer is zero-initialized: */ rsc = fd_resource(aq->prsc); - fd_bo_cpu_prep(rsc->bo, ctx->screen->pipe, DRM_FREEDRENO_PREP_WRITE); + fd_bo_cpu_prep(rsc->bo, ctx->pipe, DRM_FREEDRENO_PREP_WRITE); map = fd_bo_map(rsc->bo); memset(map, 0, aq->provider->size); @@ -142,7 +142,7 @@ fd_acc_get_query_result(struct fd_context *ctx, struct fd_query *q, return false; } - ret = fd_bo_cpu_prep(rsc->bo, ctx->screen->pipe, + ret = fd_bo_cpu_prep(rsc->bo, ctx->pipe, DRM_FREEDRENO_PREP_READ | DRM_FREEDRENO_PREP_NOSYNC); if (ret) return false; @@ -154,7 +154,7 @@ fd_acc_get_query_result(struct fd_context *ctx, struct fd_query *q, fd_batch_flush(rsc->write_batch, true); /* get the result: */ - fd_bo_cpu_prep(rsc->bo, ctx->screen->pipe, DRM_FREEDRENO_PREP_READ); + fd_bo_cpu_prep(rsc->bo, ctx->pipe, DRM_FREEDRENO_PREP_READ); void *ptr = fd_bo_map(rsc->bo); p->result(ctx, ptr, result); diff --git a/src/gallium/drivers/freedreno/freedreno_query_hw.c b/src/gallium/drivers/freedreno/freedreno_query_hw.c index 73c3691..c92573e 100644 --- a/src/gallium/drivers/freedreno/freedreno_query_hw.c +++ b/src/gallium/drivers/freedreno/freedreno_query_hw.c @@ -218,7 +218,7 @@ fd_hw_get_query_result(struct fd_context *ctx, struct fd_query *q, if (!rsc->bo) return false; - ret = fd_bo_cpu_prep(rsc->bo, ctx->screen->pipe, + ret = fd_bo_cpu_prep(rsc->bo, ctx->pipe, DRM_FREEDRENO_PREP_READ | DRM_FREEDRENO_PREP_NOSYNC); if (ret) return false; @@ -245,7 +245,7 @@ fd_hw_get_query_result(struct fd_context *ctx, struct fd_query *q, if (!rsc->bo) continue; - fd_bo_cpu_prep(rsc->bo, ctx->screen->pipe, DRM_FREEDRENO_PREP_READ); + fd_bo_cpu_prep(rsc->bo, ctx->pipe, DRM_FREEDRENO_PREP_READ); void *ptr = fd_bo_map(rsc->bo); diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index 5aa90ce..266908c 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -512,7 +512,7 @@ fd_resource_transfer_map(struct pipe_context *pctx, */ bool needs_flush = pending(rsc, !!(usage & PIPE_TRANSFER_WRITE)); bool busy = needs_flush || (0 != fd_bo_cpu_prep(rsc->bo, - ctx->screen->pipe, op | DRM_FREEDRENO_PREP_NOSYNC)); + ctx->pipe, op | DRM_FREEDRENO_PREP_NOSYNC)); /* if we need to flush/stall, see if we can make a shadow buffer * to avoid this: @@ -553,7 +553,7 @@ fd_resource_transfer_map(struct pipe_context *pctx, * completed. */ if (busy) { - ret = fd_bo_cpu_prep(rsc->bo, ctx->screen->pipe, op); + ret = fd_bo_cpu_prep(rsc->bo, ctx->pipe, op); if (ret) goto fail; } diff --git a/src/gallium/drivers/freedreno/freedreno_screen.h b/src/gallium/drivers/freedreno/freedreno_screen.h index c5018da..68518ef 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.h +++ b/src/gallium/drivers/freedreno/freedreno_screen.h @@ -72,6 +72,11 @@ struct fd_screen { void *compiler; /* currently unused for a2xx */ struct fd_device *dev; + + /* NOTE: we still need a pipe associated with the screen in a few + * places, like screen->get_timestamp(). For anything context + * related, use ctx->pipe instead. + */ struct fd_pipe *pipe; int64_t cpu_gpu_time_delta;