crtc/kms: Use plane formats if no IN_FORMATS

If the IN_FORMATS property is not found, copy the formats from the DRM
plane instead. This is the fallback for getting a list of formats the
primary plane supports when DRM universal planes capability is enabled.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/341
This commit is contained in:
Pekka Paalanen 2018-11-19 13:20:37 +02:00 committed by Jonas Ådahl
parent 31d99c51cb
commit 0789c3fb9f

View File

@ -211,6 +211,21 @@ free_modifier_array (GArray *array)
g_array_free (array, TRUE);
}
static void
set_formats_from_array (MetaCrtc *crtc,
const uint32_t *formats,
size_t n_formats)
{
MetaCrtcKms *crtc_kms = crtc->driver_private;
size_t i;
for (i = 0; i < n_formats; i++)
{
g_hash_table_insert (crtc_kms->formats_modifiers,
GUINT_TO_POINTER (formats[i]), NULL);
}
}
static void
parse_formats (MetaCrtc *crtc,
int kms_fd,
@ -372,6 +387,14 @@ init_crtc_rotations (MetaCrtc *crtc,
parse_formats (crtc, kms_fd, props->prop_values[fmts_idx]);
drmModeFreeProperty (prop);
}
/* fall back to universal plane formats without modifiers */
if (g_hash_table_size (crtc_kms->formats_modifiers) == 0)
{
set_formats_from_array (crtc,
drm_plane->formats,
drm_plane->count_formats);
}
}
if (props)