Commit Graph

11 Commits (master)

Author SHA1 Message Date
tytan652 057e433bdb libobs-opengl: Replace OBS_UNUSED with UNUSED_PARAMETER
OBS_UNUSED is not portable to MSVC.
2022-07-20 08:22:08 +02:00
Norihiro Kamae af3890a4a9 libobs: Cleanup unused-parameters
- Add OBS_UNUSED to unused function parameters
- Remove unnecessary UNUSED_PARAMETER
Also update libobs-opengl/
2022-07-19 11:01:00 -04:00
Kurt Kartaltepe d78b27961c libobs-opengl: Add create_texture_from_pixmap for EGL
create_texture_from_pixmap is only implemented for X11/EGL where it will
bind the provided X11 pixmap to a texture with glEGLImageTargetTexture2DOES
2022-05-15 09:08:53 -03:00
columbarius b072159703 libobs-opengl: Implement DMA-BUF query functions for EGL renderer
Implement device_query_dmabuf_capabilities and
device_query_dmabuf_modifiers for EGL/Wayland and EGL/X11.
2021-12-22 14:27:53 -03:00
columbarius 4cda05f270 libobs/graphics: Add Linux-only gs_query_dmabuf_* functions
When sharing DMA-BUFs it is required the announce the underlying
hardware capabilities via supported modifiers.

Add new device_query_dmabuf_capabilities vfunc to gs_exports and connect it
to the egl implementation stubs in the supported render platforms. Add a new
public method gs_query_dmabuf_capabilities() that calls the vfunc above.

Add new device_query_dmabuf_modifiers vfunc to gs_exports and connect it
to the egl implementation in the supported render platforms. Add a new
public method gs_query_dmabuf_modifiers() that calls the vfunc above.
2021-12-22 14:27:53 -03:00
Kurt Kartaltepe 5daf3b1ad1 libobs-opengl: Ensure proper draw buffer
This commit ensures that we set the appropriate draw buffer when making
a context current. Mesa drivers enforce opengl ES semantics where the
targets passed to eglMakeCurrent are bound, but nvidia instead ignores
these parameters after the 1st eglMakeCurrent. In obs we make current
with EGL_NO_SURFACE so our draw targets end up as EGL_NONE on nvidia
and previews fail to render.

This also allows us to fail back ignoring NATIVE_RENDERABLE
requirements. Nvidia driver does not report support for this attribute
on any context and after resolving the draw target issues previews
render correctly on nvidia and intel drivers.
2021-12-13 11:37:28 -03:00
columbarius e071b5e300 libobs-opengl: Load EGL via Glad on Wayland platform
We need to have EGL extensions loaded when dealing with DMA-BUFs.

EGL_EXT_image_dma_buf_import: This extension is required to import
DMA-BUFs with the modifier-less path. It is limited to buffers with 3
planes. [1]

EGL_EXT_image_dma_buf_import_modifiers: This extension is required to
import DMA-BUFs with an explicit modifier. It raises the limit of buffer
planes to 4, which is the maximum planecount for DMA-BUFs. [2]

[1] https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import.txt
[2] https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt
2021-09-21 12:57:49 -03:00
Kurt Kartaltepe 705a47b0e4 libobs, libobs-opengl: add drm format param
This adds the drmbuf format as a parameter separate from the obs texture
format that will be used. drmbuf's may have a variety of formats that we
need to pass correctly to get a usable texture which may correspond to
multi-platform texture formats.
2021-03-29 17:00:31 -03:00
Georges Basile Stavracas Neto 7867d16e6b libobs-opengl: Implement DMA-BUF importing on EGL renderers
Implement device_texture_create_from_dmabuf for EGL/X11 and EGL/Wayland.
The code is shared between them, in a new gl-egl-common.c file.

This is currently limited to a few common RGB(A) formats for now, which
seems to cover most use cases.
2021-02-13 19:48:56 -03:00
Georges Basile Stavracas Neto f7a55f45fd libobs/graphics: Add Linux-only gs_texture_create_from_dmabuf()
DMA-BUF is a widespread Linux buffer sharing mechanism. It is what's
commonly used zero-copy screen sharing by Wayland compositors.

Add a new 'device_texture_create_from_dmabuf' vfunc to gs_exports,
and stub implementations to libobs-opengl. Add a new public method
gs_texture_create_from_dmabuf() that calls this vfunc.
2021-02-13 19:13:54 -03:00
Georges Basile Stavracas Neto eab27571d2 libobs-opengl: Introduce an EGL/Wayland renderer
Introduce a new Wayland/EGL renderer.
2021-02-09 09:39:17 -03:00