freedreno: Use staging transfer if mmap fails
With externaly imported resources, we can have situations where we can't mmap and directly access linear buffers. So use the staging blit path for this case. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16086>
This commit is contained in:
@@ -790,6 +790,16 @@ resource_transfer_map_unsync(struct pipe_context *pctx,
|
||||
char *buf;
|
||||
|
||||
buf = fd_bo_map(rsc->bo);
|
||||
|
||||
/* With imported bo's allocated by something outside of mesa, when
|
||||
* running in a VM (using virtio_gpu kernel driver) we could end up in
|
||||
* a situation where we have a linear bo, but are unable to mmap it
|
||||
* because it was allocated without the VIRTGPU_BLOB_FLAG_USE_MAPPABLE
|
||||
* flag. So we need end up needing to do a staging blit instead:
|
||||
*/
|
||||
if (!buf)
|
||||
return resource_transfer_map_staging(pctx, prsc, level, usage, box, trans);
|
||||
|
||||
offset = box->y / util_format_get_blockheight(format) * trans->b.b.stride +
|
||||
box->x / util_format_get_blockwidth(format) * rsc->layout.cpp +
|
||||
fd_resource_offset(rsc, level, box->z);
|
||||
|
||||
Reference in New Issue
Block a user