Commit 0789c3fb authored by Pekka Paalanen's avatar Pekka Paalanen Committed by Jonas Ådahl

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.

GNOME/mutter!341
parent 31d99c51
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment