Commit graph

13 commits

Author SHA1 Message Date
Kurt Kartaltepe 3e49e89611 libobs,libobs-opengl,libobs-d3d11: Add opengl gs_enum_adapters
This adds gs_enum_adapters and gs_get_adapter_count to the opengl
backend and promotes these to multiplatform graphics functions.

However we need to make an internal device change, device_enum_adapters
must pass in the current device on opengl to ensure that adapter #0 is
the display adapter. We do this to avoid changes to plugins already
checking against obs_video_info.adapter which is always 0 and expected
to be the device OBS was initialized on.

The actual implementation reports the dri render node (or /Software).
This allows plugins to query non-video features of the adapters like
VA-API/NVENC/etc or other cross device functionality. `/Software` is
chosen to avoid opening random files in the current directory if its
passed along as a file path like the regular dri render nodes.
2024-01-27 17:51:33 -06:00
Kurt Kartaltepe 34950f7fb2 libobs-opengl: Enable imported dmabufs for rendering
For now just tag all imported images with GS_RENDER, this may not work
for some images that were produced by some hardware other than the GPU
render engines. But since we don't import VA-API decoded frames we
probably won't run into this. And we need this to render into VA-API
frames destined for encoding.
2024-01-26 20:01:58 -05:00
Kurt Kartaltepe 041fee0484 libobs-opengl: Accelerate dmabuf import
Previously we would actually initialize a texture memory that would then
also have to be deleted when we bound the EGLImage to the texture during
dmabuf import.

Instead simply do not create the dummy texture memory. One odd thing is
that we must still query the texture to ensure its initialized or
binding the EGLImage will not work. So we leave the TEXTURE_MAX_LEVEL
check.

This makes screencapture up to 100x faster on discrete intel cards and
likely has some performance benefit for amd/integrated cards. Without
this dmabufs are actually slower than shared memory for these intel
cards.
2023-02-12 19:07:05 -03:00
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 4163940137 libobs-opengl: Change log level for texture_from_pixmap
This function is expected to fail fairly often as it is the tool for
checking if windows are mapped and have a valid pixmap in the linux
capture plugin. So reduce this error to a debug message to avoid
spamming release builds.
2022-07-10 11:24:40 +10: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
Kurt Kartaltepe f695b14edc libobs-opengl: Use gl helpers in create_dmabuf_image
This replaces direct OpenGL calls to error handling helpers. Previously
this would cause errors to be misattributed to the next OpenGL functions
called.

Fixes DMA-BUF importing returning a texture on failure on KDE+NVIDIA.
2022-04-11 23:18:00 -03:00
Georges Basile Stavracas Neto e1f01554f7 libobs-opengl: Swap order of out parameters
The usual pattern of function signature is "array / n_elements",
but query_dmabuf_formats() does not follow it. Apply this order
to query_dmabuf_formats().
2021-12-30 18:41:04 -03:00
Georges Basile Stavracas Neto efb3220494 libobs-opengl: Remove unused function argument
The 'display' variable is unused, and the function is static,
so we don't need to carry the parameter.
2021-12-30 18:41:04 -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
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