obs-studio/libobs-opengl/gl-egl-common.h
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

36 lines
1.1 KiB
C

#pragma once
#include "gl-nix.h"
#include <glad/glad_egl.h>
const char *gl_egl_error_to_string(EGLint error_number);
struct gs_texture *
gl_egl_create_dmabuf_image(EGLDisplay egl_display, unsigned int width,
unsigned int height, uint32_t drm_format,
enum gs_color_format color_format, uint32_t n_planes,
const int *fds, const uint32_t *strides,
const uint32_t *offsets, const uint64_t *modifiers);
bool gl_egl_query_dmabuf_capabilities(EGLDisplay egl_display,
enum gs_dmabuf_flags *dmabuf_flags,
uint32_t **drm_format, size_t *n_formats);
bool gl_egl_query_dmabuf_modifiers_for_format(EGLDisplay egl_display,
uint32_t drm_format,
uint64_t **modifiers,
size_t *n_modifiers);
struct gs_texture *
gl_egl_create_texture_from_pixmap(EGLDisplay egl_display, uint32_t width,
uint32_t height,
enum gs_color_format color_format,
EGLint target, EGLClientBuffer pixmap);
bool gl_egl_enum_adapters(EGLDisplay display,
bool (*callback)(void *param, const char *name,
uint32_t id),
void *param);
uint32_t gs_get_adapter_count();