Skip to content

Commit a4ec240

Browse files
robclarkemersion
authored andcommitted
drm/prime: Unbreak virtgpu dma-buf export
virtgpu "vram" GEM objects do not implement obj->get_sg_table(). But they also don't use drm_gem_map_dma_buf(). In fact they may not even have guest visible pages. But it is perfectly fine to export and share with other virtual devices. Reported-by: Dominik Behr <[email protected]> Fixes: 207395d ("drm/prime: reject DMA-BUF attach when get_sg_table is missing") Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Simon Ser <[email protected]> Signed-off-by: Simon Ser <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent be14184 commit a4ec240

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/gpu/drm/drm_prime.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,12 @@ int drm_gem_map_attach(struct dma_buf *dma_buf,
582582
{
583583
struct drm_gem_object *obj = dma_buf->priv;
584584

585-
if (!obj->funcs->get_sg_table)
585+
/*
586+
* drm_gem_map_dma_buf() requires obj->get_sg_table(), but drivers
587+
* that implement their own ->map_dma_buf() do not.
588+
*/
589+
if (dma_buf->ops->map_dma_buf == drm_gem_map_dma_buf &&
590+
!obj->funcs->get_sg_table)
586591
return -ENOSYS;
587592

588593
return drm_gem_pin(obj);

0 commit comments

Comments
 (0)