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.
This commit is contained in:
committed by
Georges Basile Stavracas Neto
parent
e41e845272
commit
4cda05f270
@@ -134,3 +134,21 @@ extern struct gs_texture *device_texture_create_from_dmabuf(
|
||||
device, width, height, drm_format, color_format, n_planes, fds,
|
||||
strides, offsets, modifiers);
|
||||
}
|
||||
|
||||
extern bool device_query_dmabuf_capabilities(gs_device_t *device,
|
||||
enum gs_dmabuf_flags *dmabuf_flags,
|
||||
uint32_t **drm_formats,
|
||||
size_t *n_formats)
|
||||
{
|
||||
return gl_vtable->device_query_dmabuf_capabilities(
|
||||
device, dmabuf_flags, drm_formats, n_formats);
|
||||
}
|
||||
|
||||
extern bool device_query_dmabuf_modifiers_for_format(gs_device_t *device,
|
||||
uint32_t drm_format,
|
||||
uint64_t **modifiers,
|
||||
size_t *n_modifiers)
|
||||
{
|
||||
return gl_vtable->device_query_dmabuf_modifiers_for_format(
|
||||
device, drm_format, modifiers, n_modifiers);
|
||||
}
|
||||
|
@@ -59,4 +59,13 @@ struct gl_winsys_vtable {
|
||||
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 (*device_query_dmabuf_capabilities)(
|
||||
gs_device_t *device, enum gs_dmabuf_flags *dmabuf_flags,
|
||||
uint32_t **drm_formats, size_t *n_formats);
|
||||
|
||||
bool (*device_query_dmabuf_modifiers_for_format)(gs_device_t *device,
|
||||
uint32_t drm_format,
|
||||
uint64_t **modifiers,
|
||||
size_t *n_modifiers);
|
||||
};
|
||||
|
@@ -363,6 +363,30 @@ static struct gs_texture *gl_wayland_egl_device_texture_create_from_dmabuf(
|
||||
fds, strides, offsets, modifiers);
|
||||
}
|
||||
|
||||
static bool gl_wayland_egl_device_query_dmabuf_capabilities(
|
||||
gs_device_t *device, enum gs_dmabuf_flags *dmabuf_flags,
|
||||
uint32_t **drm_formats, size_t *n_formats)
|
||||
{
|
||||
UNUSED_PARAMETER(device);
|
||||
UNUSED_PARAMETER(dmabuf_flags);
|
||||
UNUSED_PARAMETER(drm_formats);
|
||||
UNUSED_PARAMETER(n_formats);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool gl_wayland_egl_device_query_dmabuf_modifiers_for_format(
|
||||
gs_device_t *device, uint32_t drm_format, uint64_t **modifiers,
|
||||
size_t *n_modifiers)
|
||||
{
|
||||
UNUSED_PARAMETER(device);
|
||||
UNUSED_PARAMETER(drm_format);
|
||||
UNUSED_PARAMETER(modifiers);
|
||||
UNUSED_PARAMETER(n_modifiers);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static const struct gl_winsys_vtable egl_wayland_winsys_vtable = {
|
||||
.windowinfo_create = gl_wayland_egl_windowinfo_create,
|
||||
.windowinfo_destroy = gl_wayland_egl_windowinfo_destroy,
|
||||
@@ -380,6 +404,10 @@ static const struct gl_winsys_vtable egl_wayland_winsys_vtable = {
|
||||
.device_present = gl_wayland_egl_device_present,
|
||||
.device_texture_create_from_dmabuf =
|
||||
gl_wayland_egl_device_texture_create_from_dmabuf,
|
||||
.device_query_dmabuf_capabilities =
|
||||
gl_wayland_egl_device_query_dmabuf_capabilities,
|
||||
.device_query_dmabuf_modifiers_for_format =
|
||||
gl_wayland_egl_device_query_dmabuf_modifiers_for_format,
|
||||
};
|
||||
|
||||
const struct gl_winsys_vtable *gl_wayland_egl_get_winsys_vtable(void)
|
||||
|
@@ -649,6 +649,30 @@ static struct gs_texture *gl_x11_egl_device_texture_create_from_dmabuf(
|
||||
fds, strides, offsets, modifiers);
|
||||
}
|
||||
|
||||
static bool gl_x11_egl_device_query_dmabuf_capabilities(
|
||||
gs_device_t *device, enum gs_dmabuf_flags *dmabuf_flags,
|
||||
uint32_t **drm_formats, size_t *n_formats)
|
||||
{
|
||||
UNUSED_PARAMETER(device);
|
||||
UNUSED_PARAMETER(dmabuf_flags);
|
||||
UNUSED_PARAMETER(drm_formats);
|
||||
UNUSED_PARAMETER(n_formats);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool gl_x11_egl_device_query_dmabuf_modifiers_for_format(
|
||||
gs_device_t *device, uint32_t drm_format, uint64_t **modifiers,
|
||||
size_t *n_modifiers)
|
||||
{
|
||||
UNUSED_PARAMETER(device);
|
||||
UNUSED_PARAMETER(drm_format);
|
||||
UNUSED_PARAMETER(modifiers);
|
||||
UNUSED_PARAMETER(n_modifiers);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static const struct gl_winsys_vtable egl_x11_winsys_vtable = {
|
||||
.windowinfo_create = gl_x11_egl_windowinfo_create,
|
||||
.windowinfo_destroy = gl_x11_egl_windowinfo_destroy,
|
||||
@@ -666,6 +690,10 @@ static const struct gl_winsys_vtable egl_x11_winsys_vtable = {
|
||||
.device_present = gl_x11_egl_device_present,
|
||||
.device_texture_create_from_dmabuf =
|
||||
gl_x11_egl_device_texture_create_from_dmabuf,
|
||||
.device_query_dmabuf_capabilities =
|
||||
gl_x11_egl_device_query_dmabuf_capabilities,
|
||||
.device_query_dmabuf_modifiers_for_format =
|
||||
gl_x11_egl_device_query_dmabuf_modifiers_for_format,
|
||||
};
|
||||
|
||||
const struct gl_winsys_vtable *gl_x11_egl_get_winsys_vtable(void)
|
||||
|
@@ -599,6 +599,30 @@ static struct gs_texture *gl_x11_glx_device_texture_create_from_dmabuf(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool gl_x11_glx_device_query_dmabuf_capabilities(
|
||||
gs_device_t *device, enum gs_dmabuf_flags *dmabuf_flags,
|
||||
uint32_t **drm_formats, size_t *n_formats)
|
||||
{
|
||||
UNUSED_PARAMETER(device);
|
||||
UNUSED_PARAMETER(dmabuf_flags);
|
||||
UNUSED_PARAMETER(drm_formats);
|
||||
UNUSED_PARAMETER(n_formats);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool gl_x11_glx_device_query_dmabuf_modifiers_for_format(
|
||||
gs_device_t *device, uint32_t drm_format, uint64_t **modifiers,
|
||||
size_t *n_modifiers)
|
||||
{
|
||||
UNUSED_PARAMETER(device);
|
||||
UNUSED_PARAMETER(drm_format);
|
||||
UNUSED_PARAMETER(modifiers);
|
||||
UNUSED_PARAMETER(n_modifiers);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static const struct gl_winsys_vtable glx_winsys_vtable = {
|
||||
.windowinfo_create = gl_x11_glx_windowinfo_create,
|
||||
.windowinfo_destroy = gl_x11_glx_windowinfo_destroy,
|
||||
@@ -616,6 +640,10 @@ static const struct gl_winsys_vtable glx_winsys_vtable = {
|
||||
.device_present = gl_x11_glx_device_present,
|
||||
.device_texture_create_from_dmabuf =
|
||||
gl_x11_glx_device_texture_create_from_dmabuf,
|
||||
.device_query_dmabuf_capabilities =
|
||||
gl_x11_glx_device_query_dmabuf_capabilities,
|
||||
.device_query_dmabuf_modifiers_for_format =
|
||||
gl_x11_glx_device_query_dmabuf_modifiers_for_format,
|
||||
};
|
||||
|
||||
const struct gl_winsys_vtable *gl_x11_glx_get_winsys_vtable(void)
|
||||
|
Reference in New Issue
Block a user