summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/virtio/virtgpu_prime.c
diff options
context:
space:
mode:
authorEzequiel Garcia <ezequiel@collabora.com>2018-09-25 19:16:06 +0300
committerGerd Hoffmann <kraxel@redhat.com>2018-09-26 09:05:07 +0300
commita03fb71716ee60d1d763f1f27773cbbaec1359ed (patch)
treed1636dd2de9dff42aaad4e5fd7e8a11ec7e65d95 /drivers/gpu/drm/virtio/virtgpu_prime.c
parenta20c4173c4219d85ba7775fde584cd34305a0b3d (diff)
downloadlinux-a03fb71716ee60d1d763f1f27773cbbaec1359ed.tar.xz
virtio: Support prime objects vmap/vunmap
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 <ezequiel@collabora.com> Link: http://patchwork.freedesktop.org/patch/msgid/20180925161606.17980-4-ezequiel@collabora.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/virtio/virtgpu_prime.c')
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_prime.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/gpu/drm/virtio/virtgpu_prime.c b/drivers/gpu/drm/virtio/virtgpu_prime.c
index d27a1688714f..86ce0ae93f59 100644
--- a/drivers/gpu/drm/virtio/virtgpu_prime.c
+++ b/drivers/gpu/drm/virtio/virtgpu_prime.c
@@ -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,