venus: renderer to check map size only when mappable
Cc: 21.2.3 mesa-stable Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Chia-I Wu <olvaffe@gmail.com> Reviewed-by: Ryan Neph <ryanneph@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12687>
This commit is contained in:
@@ -1173,15 +1173,20 @@ virtgpu_bo_create_from_dma_buf(struct vn_renderer *renderer,
|
||||
if (info.blob_mem != VIRTGPU_BLOB_MEM_HOST3D)
|
||||
goto fail;
|
||||
|
||||
if (info.size < size)
|
||||
goto fail;
|
||||
|
||||
/* blob_flags is not passed to the kernel and is only for internal use
|
||||
* on imports. Set it to what works best for us.
|
||||
*/
|
||||
blob_flags = virtgpu_bo_blob_flags(flags, 0);
|
||||
blob_flags |= VIRTGPU_BLOB_FLAG_USE_SHAREABLE;
|
||||
mmap_size = size;
|
||||
|
||||
/* mmap_size is only used when mappable */
|
||||
mmap_size = 0;
|
||||
if (blob_flags & VIRTGPU_BLOB_FLAG_USE_MAPPABLE) {
|
||||
if (info.size < size)
|
||||
goto fail;
|
||||
|
||||
mmap_size = size;
|
||||
}
|
||||
} else {
|
||||
/* must be classic resource here
|
||||
* set blob_flags to 0 to fail virtgpu_bo_map
|
||||
|
||||
Reference in New Issue
Block a user