From 154bfca81c2e4a4cdceb7eea9b485722e7d1b4f0 Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 11 Apr 2024 03:31:39 +0000 Subject: [PATCH] drm/prime: Unbreak virtgpu dma-buf export From Rob Clark cc4d9f0597ee1f1f94323611ae5d7473ddf2a99a in linux-6.6.y/6.6.26 a4ec240f6b7c21cf846d10017c3ce423a0eae92c in mainline linux --- sys/dev/pci/drm/drm_prime.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/dev/pci/drm/drm_prime.c b/sys/dev/pci/drm/drm_prime.c index 25812a30d33..b5b905746ef 100644 --- a/sys/dev/pci/drm/drm_prime.c +++ b/sys/dev/pci/drm/drm_prime.c @@ -586,7 +586,16 @@ int drm_gem_map_attach(struct dma_buf *dma_buf, { struct drm_gem_object *obj = dma_buf->priv; + /* + * drm_gem_map_dma_buf() requires obj->get_sg_table(), but drivers + * that implement their own ->map_dma_buf() do not. + */ +#ifdef notyet + if (dma_buf->ops->map_dma_buf == drm_gem_map_dma_buf && + !obj->funcs->get_sg_table) +#else if (!obj->funcs->get_sg_table) +#endif return -ENOSYS; return drm_gem_pin(obj); -- 2.20.1