diff options
author | Yiwei Zhang <zzyiwei@chromium.org> | 2021-04-27 00:03:21 +0000 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-04-27 00:15:39 +0000 |
commit | 282e2c949663505115bc2b862b70e0ad43a59222 (patch) | |
tree | 66dfc1f1360cbea066cd04e2964c38798a364e0a | |
parent | 6b18fcb38badfe5f02c554d8997a0c6696d9ab99 (diff) |
venus: set bo->size to 0 for classic resource
bo->size is not used for classic resource since mapping is not allowed.
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10259>
-rw-r--r-- | src/virtio/vulkan/vn_renderer_virtgpu.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/virtio/vulkan/vn_renderer_virtgpu.c b/src/virtio/vulkan/vn_renderer_virtgpu.c index 8d9069c31f9..245b5e94941 100644 --- a/src/virtio/vulkan/vn_renderer_virtgpu.c +++ b/src/virtio/vulkan/vn_renderer_virtgpu.c @@ -1118,17 +1118,25 @@ virtgpu_bo_init_dmabuf(struct vn_renderer_bo *_bo, if (virtgpu_ioctl_resource_info(gpu, gem_handle, &info)) goto fail; - /* must be VIRTGPU_BLOB_MEM_HOST3D or classic */ - if (info.blob_mem && info.blob_mem != VIRTGPU_BLOB_MEM_HOST3D) - goto fail; + if (info.blob_mem) { + /* must be VIRTGPU_BLOB_MEM_HOST3D */ + if (info.blob_mem != VIRTGPU_BLOB_MEM_HOST3D) + goto fail; - if (size && info.size < size) - goto fail; + if (size && info.size < size) + goto fail; + + bo->blob_flags = virtgpu_bo_blob_flags(flags, external_handles); + bo->size = size ? size : info.size; + } else { + /* must be classic resource here + * set blob_flags to 0 to fail virtgpu_bo_map + * set size to 0 since mapping is not allowed + */ + bo->blob_flags = 0; + bo->size = 0; + } - /* set blob_flags to 0 for classic resources to fail virtgpu_bo_map */ - bo->blob_flags = - info.blob_mem ? virtgpu_bo_blob_flags(flags, external_handles) : 0; - bo->size = size ? size : info.size; bo->gem_handle = gem_handle; bo->base.res_id = info.res_handle; |