cogl/renderer: Add way to filter modifiers by external-only

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
This commit is contained in:
Jonas Ådahl 2024-07-24 14:28:22 +02:00 committed by Marge Bot
parent 4bf04585d2
commit 01dcec31b0
2 changed files with 16 additions and 1 deletions

View File

@ -43,6 +43,7 @@ typedef enum _CoglDrmModifierFilter
{
COGL_DRM_MODIFIER_FILTER_NONE = 0,
COGL_DRM_MODIFIER_FILTER_SINGLE_PLANE = 1 << 0,
COGL_DRM_MODIFIER_FILTER_NOT_EXTERNAL_ONLY = 1 << 1,
} CoglDrmModifierFilter;
/**

View File

@ -119,6 +119,7 @@ meta_render_device_gbm_query_drm_modifiers (MetaRenderDevice *render_devic
EGLDisplay egl_display;
EGLint n_modifiers;
g_autoptr (GArray) modifiers = NULL;
g_autoptr (GArray) external_onlys = NULL;
egl_display = meta_render_device_get_egl_display (render_device);
@ -146,13 +147,17 @@ meta_render_device_gbm_query_drm_modifiers (MetaRenderDevice *render_devic
modifiers = g_array_sized_new (FALSE, FALSE, sizeof (uint64_t),
n_modifiers);
external_onlys = g_array_sized_new (FALSE, FALSE, sizeof (EGLBoolean),
n_modifiers);
if (!meta_egl_query_dma_buf_modifiers (egl, egl_display,
drm_format, n_modifiers,
(EGLuint64KHR *) modifiers->data, NULL,
(EGLuint64KHR *) modifiers->data,
(EGLBoolean *) external_onlys->data,
&n_modifiers, error))
return NULL;
g_array_set_size (modifiers, n_modifiers);
g_array_set_size (external_onlys, n_modifiers);
if (filter != COGL_DRM_MODIFIER_FILTER_NONE)
{
@ -174,6 +179,15 @@ meta_render_device_gbm_query_drm_modifiers (MetaRenderDevice *render_devic
continue;
}
if (filter & COGL_DRM_MODIFIER_FILTER_NOT_EXTERNAL_ONLY)
{
EGLBoolean external_only = g_array_index (external_onlys,
EGLBoolean, i);
if (external_only)
continue;
}
g_array_append_val (filtered_modifiers, modifier);
}