drm/prime: Unbreak virtgpu dma-buf export
authorjsg <jsg@openbsd.org>
Thu, 11 Apr 2024 03:31:39 +0000 (03:31 +0000)
committerjsg <jsg@openbsd.org>
Thu, 11 Apr 2024 03:31:39 +0000 (03:31 +0000)
From Rob Clark
cc4d9f0597ee1f1f94323611ae5d7473ddf2a99a in linux-6.6.y/6.6.26
a4ec240f6b7c21cf846d10017c3ce423a0eae92c in mainline linux

sys/dev/pci/drm/drm_prime.c

index 25812a3..b5b9057 100644 (file)
@@ -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);