Skip to content

Commit

Permalink
UPSTREAM: virtio: Support prime objects vmap/vunmap
Browse files Browse the repository at this point in the history
Implement vmap/vunmap so we can export dmabufs to
other drivers, such as video4linux.

Tested with a virtio-gpu / vivid (virtual capture driver)
pipeline, where the vivid driver imports the dmabufs exported
by virtio-gpu.

Note that dma_buf_vmap() does its own vmap counting, so
it's not needed to take care of it in the driver.

Signed-off-by: Ezequiel Garcia <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
(cherry picked from commit a03fb71716ee60d1d763f1f27773cbbaec1359ed)
Signed-off-by: Greg Hartman <[email protected]>
BUG: 139386237
Change-Id: Icab4912be0e3da5a6fd453eb42894e6a16344ad3
  • Loading branch information
ezequielgarcia authored and adelva1984 committed Aug 19, 2019
1 parent 8661999 commit 688d54f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/gpu/drm/virtio/virtgpu_prime.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,18 @@ struct drm_gem_object *virtgpu_gem_prime_import_sg_table(

void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj)
{
WARN_ONCE(1, "not implemented");
return ERR_PTR(-ENODEV);
struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(obj);
int ret;

ret = virtio_gpu_object_kmap(bo);
if (ret)
return NULL;
return bo->vmap;
}

void virtgpu_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
{
WARN_ONCE(1, "not implemented");
virtio_gpu_object_kunmap(gem_to_virtio_gpu_obj(obj));
}

int virtgpu_gem_prime_mmap(struct drm_gem_object *obj,
Expand Down

0 comments on commit 688d54f

Please sign in to comment.