mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 22:08:26 +02:00
vc4: When asked to discard-map a whole resource, discard it.
This saves a bunch of extra flushes when texsubimaging a whole texture that's been used for rendering, or subdataing a whole BO. In particular, this massively reduces the runtime of piglit texture-packed-formats (when the probes have been moved out of the inner loop).
This commit is contained in:
parent
a71c3b885a
commit
18ccda7b86
1 changed files with 28 additions and 14 deletions
|
|
@ -33,6 +33,20 @@
|
||||||
#include "vc4_resource.h"
|
#include "vc4_resource.h"
|
||||||
#include "vc4_tiling.h"
|
#include "vc4_tiling.h"
|
||||||
|
|
||||||
|
static void
|
||||||
|
vc4_resource_bo_alloc(struct vc4_resource *rsc)
|
||||||
|
{
|
||||||
|
struct pipe_resource *prsc = &rsc->base.b;
|
||||||
|
struct pipe_screen *pscreen = prsc->screen;
|
||||||
|
|
||||||
|
vc4_bo_unreference(&rsc->bo);
|
||||||
|
rsc->bo = vc4_bo_alloc(vc4_screen(pscreen),
|
||||||
|
rsc->slices[0].offset +
|
||||||
|
rsc->slices[0].size +
|
||||||
|
rsc->cube_map_stride * (prsc->array_size - 1),
|
||||||
|
"resource");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vc4_resource_transfer_unmap(struct pipe_context *pctx,
|
vc4_resource_transfer_unmap(struct pipe_context *pctx,
|
||||||
struct pipe_transfer *ptrans)
|
struct pipe_transfer *ptrans)
|
||||||
|
|
@ -75,15 +89,20 @@ vc4_resource_transfer_map(struct pipe_context *pctx,
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
if (usage & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE) {
|
if (usage & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE) {
|
||||||
uint32_t size = rsc->bo->size;
|
vc4_resource_bo_alloc(rsc);
|
||||||
vc4_bo_unreference(&rsc->bo);
|
} else if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED)) {
|
||||||
rsc->bo = vc4_bo_alloc(vc4->screen, size, "resource");
|
if (vc4_cl_references_bo(pctx, rsc->bo)) {
|
||||||
}
|
if ((usage & PIPE_TRANSFER_DISCARD_RANGE) &&
|
||||||
|
prsc->last_level == 0 &&
|
||||||
if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED)) {
|
prsc->width0 == box->width &&
|
||||||
if (vc4_cl_references_bo(pctx, rsc->bo))
|
prsc->height0 == box->height &&
|
||||||
|
prsc->depth0 == box->depth) {
|
||||||
|
vc4_resource_bo_alloc(rsc);
|
||||||
|
} else {
|
||||||
vc4_flush(pctx);
|
vc4_flush(pctx);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (usage & PIPE_TRANSFER_WRITE)
|
if (usage & PIPE_TRANSFER_WRITE)
|
||||||
rsc->writes++;
|
rsc->writes++;
|
||||||
|
|
@ -324,12 +343,7 @@ vc4_resource_create(struct pipe_screen *pscreen,
|
||||||
}
|
}
|
||||||
|
|
||||||
vc4_setup_slices(rsc);
|
vc4_setup_slices(rsc);
|
||||||
|
vc4_resource_bo_alloc(rsc);
|
||||||
rsc->bo = vc4_bo_alloc(vc4_screen(pscreen),
|
|
||||||
rsc->slices[0].offset +
|
|
||||||
rsc->slices[0].size +
|
|
||||||
rsc->cube_map_stride * (prsc->array_size - 1),
|
|
||||||
"resource");
|
|
||||||
if (!rsc->bo)
|
if (!rsc->bo)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue