common/drm-formats: Add function to map Cogl → DRM
It's basically the reverse mapping. It does not deal with multiplanar formats. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3175>
This commit is contained in:
parent
fdc3f3fec3
commit
b814aff600
@ -51,3 +51,25 @@ meta_cogl_pixel_format_from_drm_format (uint32_t drm_format,
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
meta_drm_format_from_cogl_pixel_format (CoglPixelFormat cogl_format,
|
||||||
|
uint32_t *out_drm_format)
|
||||||
|
{
|
||||||
|
const size_t n = G_N_ELEMENTS (meta_cogl_drm_format_map);
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
if (meta_cogl_drm_format_map[i].cogl_format == cogl_format)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == n)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (out_drm_format)
|
||||||
|
*out_drm_format = meta_cogl_drm_format_map[i].drm_format;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
@ -81,4 +81,7 @@ gboolean meta_cogl_pixel_format_from_drm_format (uint32_t drm_for
|
|||||||
CoglPixelFormat *out_format,
|
CoglPixelFormat *out_format,
|
||||||
MetaMultiTextureFormat *out_multi_texture_format);
|
MetaMultiTextureFormat *out_multi_texture_format);
|
||||||
|
|
||||||
|
gboolean meta_drm_format_from_cogl_pixel_format (CoglPixelFormat cogl_format,
|
||||||
|
uint32_t *out_drm_format);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
Loading…
Reference in New Issue
Block a user