etnaviv: store updated usage in pipe_transfer object
authorChristian Gmeiner <christian.gmeiner@gmail.com>
Fri, 6 Sep 2019 19:21:26 +0000 (21:21 +0200)
committerChristian Gmeiner <christian.gmeiner@gmail.com>
Sun, 20 Oct 2019 09:03:06 +0000 (09:03 +0000)
Store the changed usage in the newly created transfer object.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
src/gallium/drivers/etnaviv/etnaviv_transfer.c

index ade4e877bf1cb91994542a5d0574fcca466a20e5..62b876f2d995826d279701d1648341c686f19ed9 100644 (file)
@@ -199,14 +199,6 @@ etna_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc,
    /* slab_alloc() doesn't zero */
    memset(trans, 0, sizeof(*trans));
 
-   ptrans = &trans->base;
-   pipe_resource_reference(&ptrans->resource, prsc);
-   ptrans->level = level;
-   ptrans->usage = usage;
-   ptrans->box = *box;
-
-   assert(level <= prsc->last_level);
-
    /* Upgrade DISCARD_RANGE to WHOLE_RESOURCE if the whole resource is
     * being mapped. If we add buffer reallocation to avoid CPU/GPU sync this
     * check needs to be extended to coherent mappings and shared resources.
@@ -221,6 +213,14 @@ etna_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc,
       usage |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
    }
 
+   ptrans = &trans->base;
+   pipe_resource_reference(&ptrans->resource, prsc);
+   ptrans->level = level;
+   ptrans->usage = usage;
+   ptrans->box = *box;
+
+   assert(level <= prsc->last_level);
+
    if (rsc->texture && !etna_resource_newer(rsc, etna_resource(rsc->texture))) {
       /* We have a texture resource which is the same age or newer than the
        * render resource. Use the texture resource, which avoids bouncing