[PATCH v2 1/3] drm: Enable PRIME import/export for all drivers
Jeffrey Hugo
quic_jhugo at quicinc.com
Tue Jun 20 15:50:31 UTC 2023
On 6/20/2023 1:59 AM, Thomas Zimmermann wrote:
> Call drm_gem_prime_handle_to_fd() and drm_gem_prime_fd_to_handle() by
> default if no PRIME import/export helpers have been set. Both functions
> are the default for almost all drivers.
>
> DRM drivers implement struct drm_driver.gem_prime_import_sg_table
> to import dma-buf objects from other drivers. Having the function
> drm_gem_prime_fd_to_handle() functions set by default allows each
> driver to import dma-buf objects to itself, even without support for
> other drivers.
>
> For drm_gem_prime_handle_to_fd() it is similar: using it by default
> allows each driver to export to itself, even without support for other
> drivers.
>
> This functionality enables userspace to share per-driver buffers
> across process boundaries via PRIME (e.g., wlroots requires this
> functionality). The patch generalizes a pattern that has previously
> been implemented by GEM VRAM helpers [1] to work with any driver.
> For example, gma500 can now run the wlroots-based sway compositor.
>
> v2:
> * clean up docs and TODO comments (Simon, Zack)
> * clean up style in drm_getcap()
>
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> Link: https://lore.kernel.org/dri-devel/20230302143502.500661-1-contact@emersion.fr/ # 1
> Reviewed-by: Simon Ser <contact at emersion.fr>
> Acked-by: Alex Deucher <alexander.deucher at amd.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo at quicinc.com>
More information about the dri-devel
mailing list