panfrost: Create additional BO for the checksum of imported BOs (Bifrost)
Similar to what the blob does. My reason for doing this was mainly so traces weren't as different, which makes it more work to spot relevant differences. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4832>
This commit is contained in:
@@ -502,7 +502,6 @@ panfrost_mfbd_fragment(struct panfrost_batch *batch, bool has_draws)
|
||||
if (batch->key.nr_cbufs == 1) {
|
||||
struct pipe_surface *surf = batch->key.cbufs[0];
|
||||
struct panfrost_resource *rsrc = pan_resource(surf->texture);
|
||||
struct panfrost_bo *bo = rsrc->bo;
|
||||
|
||||
if (rsrc->checksummed) {
|
||||
unsigned level = surf->u.tex.level;
|
||||
@@ -511,7 +510,10 @@ panfrost_mfbd_fragment(struct panfrost_batch *batch, bool has_draws)
|
||||
fb.mfbd_flags |= MALI_MFBD_EXTRA;
|
||||
fbx.flags_lo |= MALI_EXTRA_PRESENT;
|
||||
fbx.checksum_stride = slice->checksum_stride;
|
||||
fbx.checksum = bo->gpu + slice->checksum_offset;
|
||||
if (slice->checksum_bo)
|
||||
fbx.checksum = slice->checksum_bo->gpu;
|
||||
else
|
||||
fbx.checksum = rsrc->bo->gpu + slice->checksum_offset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,6 +109,14 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen,
|
||||
rsc->slices[0].initialized = true;
|
||||
panfrost_resource_reset_damage(rsc);
|
||||
|
||||
if (dev->quirks & IS_BIFROST &&
|
||||
templat->bind & PIPE_BIND_RENDER_TARGET) {
|
||||
unsigned size = panfrost_compute_checksum_size(
|
||||
&rsc->slices[0], templat->width0, templat->height0);
|
||||
rsc->slices[0].checksum_bo = pan_bo_create(dev, size, 0);
|
||||
rsc->checksummed = true;
|
||||
}
|
||||
|
||||
if (dev->ro) {
|
||||
rsc->scanout =
|
||||
renderonly_create_gpu_import_for_resource(prsc, dev->ro, NULL);
|
||||
@@ -550,6 +558,9 @@ panfrost_resource_destroy(struct pipe_screen *screen,
|
||||
if (rsrc->bo)
|
||||
panfrost_bo_unreference(rsrc->bo);
|
||||
|
||||
if (rsrc->slices[0].checksum_bo)
|
||||
panfrost_bo_unreference(rsrc->slices[0].checksum_bo);
|
||||
|
||||
util_range_destroy(&rsrc->valid_buffer_range);
|
||||
ralloc_free(rsrc);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ struct panfrost_slice {
|
||||
* is its offset/stride? */
|
||||
unsigned checksum_offset;
|
||||
unsigned checksum_stride;
|
||||
struct panfrost_bo *checksum_bo;
|
||||
|
||||
/* Has anything been written to this slice? */
|
||||
bool initialized;
|
||||
|
||||
Reference in New Issue
Block a user