1
0
Fork 0

kms/plane: Parse IN_FORMATS via prop table parse vfunc

With the aim at always using the property table to fetch and parse
property metadata, move IN_FORMATS handling to the property table, using
the newly introduced parse vfunc.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
This commit is contained in:
Jonas Ådahl 2020-07-14 15:07:33 +02:00 committed by Marge Bot
parent 1b3e8b4a27
commit 2b7b4576fb
2 changed files with 21 additions and 23 deletions

View file

@ -29,6 +29,7 @@
typedef enum _MetaKmsPlaneProp
{
META_KMS_PLANE_PROP_TYPE = 0,
META_KMS_PLANE_PROP_IN_FORMATS,
META_KMS_PLANE_PROP_SRC_X,
META_KMS_PLANE_PROP_SRC_Y,
META_KMS_PLANE_PROP_SRC_W,

View file

@ -252,10 +252,14 @@ free_modifier_array (GArray *array)
}
static void
parse_formats (MetaKmsPlane *plane,
MetaKmsImplDevice *impl_device,
uint32_t blob_id)
parse_formats (MetaKmsImplDevice *impl_device,
MetaKmsProp *prop,
drmModePropertyPtr drm_prop,
uint64_t drm_prop_value,
gpointer user_data)
{
MetaKmsPlane *plane = user_data;
uint64_t blob_id;
int fd;
drmModePropertyBlobPtr blob;
struct drm_format_modifier_blob *blob_fmt;
@ -265,6 +269,7 @@ parse_formats (MetaKmsPlane *plane,
g_return_if_fail (g_hash_table_size (plane->formats_modifiers) == 0);
blob_id = drm_prop_value;
if (blob_id == 0)
return;
@ -349,25 +354,11 @@ static const uint32_t drm_default_formats[] =
};
static void
init_formats (MetaKmsPlane *plane,
MetaKmsImplDevice *impl_device,
drmModePlane *drm_plane,
drmModeObjectProperties *drm_plane_props)
init_legacy_formats (MetaKmsPlane *plane,
MetaKmsImplDevice *impl_device,
drmModePlane *drm_plane,
drmModeObjectProperties *drm_plane_props)
{
drmModePropertyPtr prop;
int idx;
prop = meta_kms_impl_device_find_property (impl_device, drm_plane_props,
"IN_FORMATS", &idx);
if (prop)
{
uint32_t blob_id;
blob_id = drm_plane_props->prop_values[idx];
parse_formats (plane, impl_device, blob_id);
drmModeFreeProperty (prop);
}
if (g_hash_table_size (plane->formats_modifiers) == 0)
{
set_formats_from_array (plane,
@ -399,6 +390,12 @@ init_properties (MetaKmsPlane *plane,
.name = "type",
.type = DRM_MODE_PROP_ENUM,
},
[META_KMS_PLANE_PROP_IN_FORMATS] =
{
.name = "IN_FORMATS",
.type = DRM_MODE_PROP_BLOB,
.parse = parse_formats,
},
[META_KMS_PLANE_PROP_SRC_X] =
{
.name = "SRC_X",
@ -458,7 +455,7 @@ init_properties (MetaKmsPlane *plane,
drm_plane_props->count_props,
plane->prop_table.props,
META_KMS_PLANE_N_PROPS,
NULL);
plane);
}
MetaKmsPlane *
@ -476,9 +473,9 @@ meta_kms_plane_new (MetaKmsPlaneType type,
plane->device = meta_kms_impl_device_get_device (impl_device);
init_rotations (plane, impl_device, drm_plane_props);
init_formats (plane, impl_device, drm_plane, drm_plane_props);
init_properties (plane, impl_device, drm_plane, drm_plane_props);
init_legacy_formats (plane, impl_device, drm_plane, drm_plane_props);
return plane;
}