mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-05-02 18:17:50 -04:00
drm/virtio: Test for imported buffers with drm_gem_is_imported()
Instead of testing import_attach for imported GEM buffers, invoke drm_gem_is_imported() to do the test. The helper tests the dma_buf itself while import_attach is just an artifact of the import. Prepares to make import_attach optional. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://lore.kernel.org/r/20250414131507.566072-2-tzimmermann@suse.de
This commit is contained in:
committed by
Dmitry Osipenko
parent
81f6e0e0f3
commit
964f2a5c0e
@@ -366,7 +366,7 @@ static int virtio_gpu_plane_prepare_fb(struct drm_plane *plane,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
obj = new_state->fb->obj[0];
|
obj = new_state->fb->obj[0];
|
||||||
if (bo->dumb || obj->import_attach) {
|
if (bo->dumb || drm_gem_is_imported(obj)) {
|
||||||
vgplane_st->fence = virtio_gpu_fence_alloc(vgdev,
|
vgplane_st->fence = virtio_gpu_fence_alloc(vgdev,
|
||||||
vgdev->fence_drv.context,
|
vgdev->fence_drv.context,
|
||||||
0);
|
0);
|
||||||
@@ -374,7 +374,7 @@ static int virtio_gpu_plane_prepare_fb(struct drm_plane *plane,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj->import_attach) {
|
if (drm_gem_is_imported(obj)) {
|
||||||
ret = virtio_gpu_prepare_imported_obj(plane, new_state, obj);
|
ret = virtio_gpu_prepare_imported_obj(plane, new_state, obj);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_fence;
|
goto err_fence;
|
||||||
@@ -417,7 +417,7 @@ static void virtio_gpu_plane_cleanup_fb(struct drm_plane *plane,
|
|||||||
}
|
}
|
||||||
|
|
||||||
obj = state->fb->obj[0];
|
obj = state->fb->obj[0];
|
||||||
if (obj->import_attach)
|
if (drm_gem_is_imported(obj))
|
||||||
virtio_gpu_cleanup_imported_obj(obj);
|
virtio_gpu_cleanup_imported_obj(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,7 +509,7 @@ static int virtio_drm_get_scanout_buffer(struct drm_plane *plane,
|
|||||||
bo = gem_to_virtio_gpu_obj(plane->state->fb->obj[0]);
|
bo = gem_to_virtio_gpu_obj(plane->state->fb->obj[0]);
|
||||||
|
|
||||||
/* Only support mapped shmem bo */
|
/* Only support mapped shmem bo */
|
||||||
if (virtio_gpu_is_vram(bo) || bo->base.base.import_attach || !bo->base.vaddr)
|
if (virtio_gpu_is_vram(bo) || drm_gem_is_imported(&bo->base.base) || !bo->base.vaddr)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
iosys_map_set_vaddr(&sb->map[0], bo->base.vaddr);
|
iosys_map_set_vaddr(&sb->map[0], bo->base.vaddr);
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ static void virtgpu_dma_buf_free_obj(struct drm_gem_object *obj)
|
|||||||
struct virtio_gpu_device *vgdev = obj->dev->dev_private;
|
struct virtio_gpu_device *vgdev = obj->dev->dev_private;
|
||||||
struct dma_buf_attachment *attach = obj->import_attach;
|
struct dma_buf_attachment *attach = obj->import_attach;
|
||||||
|
|
||||||
if (attach) {
|
if (drm_gem_is_imported(obj)) {
|
||||||
struct dma_buf *dmabuf = attach->dmabuf;
|
struct dma_buf *dmabuf = attach->dmabuf;
|
||||||
|
|
||||||
dma_resv_lock(dmabuf->resv, NULL);
|
dma_resv_lock(dmabuf->resv, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user