Replies: 11 comments 19 replies
-
REALLY WANT THIS!!!!! |
Beta Was this translation helpful? Give feedback.
-
Hello, Are you sure is not already the case? , the GPL function mentioned in the Phoronix article is used. you can see the use of the GPL function. |
Beta Was this translation helpful? Give feedback.
-
Yes, it will create a DMABUF for export, but will not use one from another source for import. You can see that it's not even implemented as an IOCTL, only export is, see: open-gpu-kernel-modules/kernel-open/nvidia/nv.c Line 2339 in d8f3bcf The proprietary closed driver has an import implemented, but only if the |
Beta Was this translation helpful? Give feedback.
-
I am under the impression that hybrid GPU laptops - i.e. laptops with an integrated Intel GPU ("iGPU") and a discrete Nvidia GPU ("dGPU") - might be suffering from a lacking DMABUF implementation, too. In a scenario where the Nvidia GPU drives the external monitor (due to physical wiring), but where the Intel GPU continues to supply the data to be displayed (reverse PRIME configuration - see https://wiki.archlinux.org/title/PRIME#Reverse_PRIME), a very high amount of CPU is expended by the X server to do "something" - copying of data into the Nvidia framebuffer, for displaying. All this CPU consumption takes away available CPU resources, adds heat output, and increases fan noise. The other way around - running the Nvidia GPU as the primary renderer ("PRIME") - does not exhibit this massive consumption of CPU, even when rendering to a 3072 x 1920 (3K) laptop screen. |
Beta Was this translation helpful? Give feedback.
-
I really don't know what userspace APIs have to do with kernel documentation (where dmabuf hasn't been a problem for almost a decade btw). |
Beta Was this translation helpful? Give feedback.
-
So you're right that, at the moment, importing a DMA-BUF from another driver as an EGLImage doesn't work. However we actually do have the infrastructure to do this in our kernel modules. Our X driver uses it for reverse-PRIME support, for example. The problem is just that this wasn't wired up in EGL. Fortunately, this has been fixed and should be working as of the next driver release (525). Unfortunately, looking at https://github.com/gnif/LookingGlass/blob/master/client/renderers/EGL/texture_dmabuf.c#L125-L141 it seems that you then proceed to bind the EGLImage to GL_TEXTURE_2D. If no format modifier is provided when creating the EGLImage, we assume it's pitch-linear. The problem is that we only allow linear buffers to be bound to GL_TEXTURE_EXTERNAL_OES. This is indicated by the fact that eglQueryDmaBufModifiersEXT sets the external_only flag for DRM_FORMAT_MOD_LINEAR. Depending on how you use this texture, it may be possible to simply bind it to GL_TEXTURE_EXTERNAL_OES instead of GL_TEXTURE_2D. I believe the only restriction is that you can't attach it to an FBO. |
Beta Was this translation helpful? Give feedback.
-
@erik-kz, @cubanismo, any plans on implementing the x dri3 extension? currently there is no way to export an x pixmap as a dma buf to e.g. import it in vulkan and that's... a little bit sad because other ways are incredibly slow and inefficient. |
Beta Was this translation helpful? Give feedback.
-
Does this change anything for your purposes @gnif ?
|
Beta Was this translation helpful? Give feedback.
-
Thank you to everyone involved in resolving this issue. I’m happy to report that, with the latest drivers and kernel updates, both streaming and screen recording have improved significantly over the past year. I understand that reaching this point took a tremendous amount of work across multiple teams and projects, and I’m deeply grateful for all the effort that went into making this happen. |
Beta Was this translation helpful? Give feedback.
-
Now that the sources are no longer restricted from using GPL symbols, can we please have true Linux DMABUF import support?
Currently NVIDIA reports
EGL_EXT_image_dma_buf_import
however this is not true DMABUF support according to the Linux gfx documentation for DMABUF. Instead the driver is using some internal proprietary format that makes it impossible to use a DMABUF provided by another driver, such as Intel/AMD or some other external device like a capture card or even just local system RAM.In the past NVIDIA have made several attempts to get true DMABUF support into the kernel which was rejected due to the GPL symbols being unavailable to them, see:
https://www.phoronix.com/scan.php?page=news_item&px=MTIwNDI
https://www.phoronix.com/scan.php?page=news_item&px=MTA1OTU
This would greatly benefit projects like Looking Glass where we are importing full screen textures directly from memory shared with a VM which is writing into the shared memory.
Note: This is already working on AMD and Intel GPUs . Currently we recommend against using NVidia GPUs to our user base due to the lack of this feature.
See our kernel module here where we create a valid DMABUF from shared RAM: https://github.com/gnif/LookingGlass/tree/master/module
Beta Was this translation helpful? Give feedback.
All reactions