summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-04-03 02:15:18 +0000
committerAlyssa Rosenzweig <[email protected]>2019-04-04 03:51:43 +0000
commit3b38a7e5050935ec0eed9d99c7b6a1afb997b798 (patch)
treee81f4391e944b71bbe6f75ec28c460c4d4fa3a57 /src
parent7e8de5a707f7279929d7396550024b8cdc6a8c61 (diff)
panfrost: Cleanup some indirection in pan_resource
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/panfrost/pan_resource.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 3d93fd0dc4d..f7df1353d68 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -448,36 +448,33 @@ panfrost_tile_texture(struct panfrost_screen *screen, struct panfrost_resource *
}
static void
-panfrost_unmap_bo(struct panfrost_context *ctx,
- struct pipe_transfer *transfer)
+panfrost_transfer_unmap(struct pipe_context *pctx,
+ struct pipe_transfer *transfer)
{
+ struct panfrost_context *ctx = pan_context(pctx);
+
+ /* Gallium expects writeback here, so we tile */
+
struct panfrost_gtransfer *trans = pan_transfer(transfer);
- struct panfrost_bo *bo = (struct panfrost_bo *)pan_resource(transfer->resource)->bo;
- if (transfer->usage & PIPE_TRANSFER_WRITE) {
+ if (trans->map) {
struct panfrost_resource *prsrc = (struct panfrost_resource *) transfer->resource;
-
- /* Gallium thinks writeback happens here; instead, this is our cue to tile */
- if (bo->layout == PAN_AFBC) {
- DBG("Warning: writes to afbc surface can't possibly work out well for you...\n");
- } else if (bo->layout == PAN_TILED) {
- struct pipe_context *gallium = (struct pipe_context *) ctx;
- struct panfrost_screen *screen = pan_screen(gallium->screen);
- assert(transfer->box.depth == 1);
- panfrost_tile_texture(screen, prsrc, trans);
+ struct panfrost_bo *bo = prsrc->bo;
+
+ if (transfer->usage & PIPE_TRANSFER_WRITE) {
+
+ if (bo->layout == PAN_AFBC) {
+ DBG("Unimplemented: writes to AFBC\n");
+ } else if (bo->layout == PAN_TILED) {
+ struct pipe_context *gallium = (struct pipe_context *) ctx;
+ struct panfrost_screen *screen = pan_screen(gallium->screen);
+ assert(transfer->box.depth == 1);
+ panfrost_tile_texture(screen, prsrc, trans);
+ }
}
- }
-
- free(trans->map);
-}
-
-static void
-panfrost_transfer_unmap(struct pipe_context *pctx,
- struct pipe_transfer *transfer)
-{
- struct panfrost_context *ctx = pan_context(pctx);
- panfrost_unmap_bo(ctx, transfer);
+ free(trans->map);
+ }
/* Derefence the resource */
pipe_resource_reference(&transfer->resource, NULL);