diff options
author | Rob Clark <[email protected]> | 2017-08-24 09:34:48 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2017-10-24 12:56:51 -0400 |
commit | eed9685dd6619ec7598e8c3fd81117d36010510d (patch) | |
tree | 32b4b7948357bca78ac988c076070ea258f1521c /src | |
parent | 9c32333a58e2792a062bd82374ea88222d718959 (diff) |
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 <[email protected]>
Diffstat (limited to 'src')
9 files changed, 20 insertions, 12 deletions
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_draw.c b/src/gallium/drivers/freedreno/a5xx/fd5_draw.c index d1f1d039b69..1e9117a5b96 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 c2142b5a214..8f0f78861cf 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 e17dcf7b684..20480f4f8c1 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 393b485a096..f10f7ef4ea5 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 f20c6ac120e..e3d200aa3a1 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 96cee1aee84..724ef69dc24 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 73c36911471..c92573ec936 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 5aa90ced69c..266908c0bc4 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 c5018da4bc5..68518ef721b 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; |