mirror of https://gitlab.freedesktop.org/mesa/mesa
panfrost: Copy resources when necessary
If the map doesn't set MAP_DISCARD_RANGE, we do have to copy the existing contents over. MAP_WRITE on its only gives permission to replace the contents, unfortunately it does not require that the application actually do so. Closes: #7640 Fixes:0b26a9f773
("panfrost: Don't copy resources if replaced") Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Reported-by: Roman Elshin Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19576> (cherry picked from commitcf7a3906b0
)
This commit is contained in:
parent
d812245daa
commit
6c24336ea4
|
@ -121,7 +121,7 @@
|
|||
"description": "panfrost: Copy resources when necessary",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "0b26a9f773956fc00a77b0d4a7aafee5795ce935"
|
||||
},
|
||||
|
|
|
@ -941,10 +941,9 @@ panfrost_box_covers_resource(const struct pipe_resource *resource,
|
|||
const struct pipe_box *box)
|
||||
{
|
||||
return resource->last_level == 0 &&
|
||||
resource->width0 == box->width &&
|
||||
resource->height0 == box->height &&
|
||||
resource->depth0 == box->depth &&
|
||||
resource->array_size == 1;
|
||||
util_texrange_covers_whole_level(resource, 0, box->x, box->y,
|
||||
box->z, box->width, box->height,
|
||||
box->depth);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -1048,7 +1047,7 @@ panfrost_ptr_map(struct pipe_context *pctx,
|
|||
panfrost_bo_wait(bo, INT64_MAX, false);
|
||||
|
||||
create_new_bo = true;
|
||||
copy_resource = !panfrost_box_covers_resource(resource, box);
|
||||
copy_resource = !(usage & PIPE_MAP_DISCARD_WHOLE_RESOURCE);
|
||||
}
|
||||
|
||||
/* Shadowing with separate stencil may require additional accounting.
|
||||
|
|
Loading…
Reference in New Issue