mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
kms/impl-device: Make property ID lookup also handle parsing
Values may need to be processed and parsed in custom ways; make this possible via the property table infrastructure using a callback. Will be used for e.g. parsing rotation and formats. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
This commit is contained in:
parent
a9ae202327
commit
1b3e8b4a27
@ -612,9 +612,11 @@ init_properties (MetaKmsConnector *connector,
|
||||
|
||||
meta_kms_impl_device_init_prop_table (impl_device,
|
||||
drm_connector->props,
|
||||
drm_connector->prop_values,
|
||||
drm_connector->count_props,
|
||||
connector->prop_table.props,
|
||||
META_KMS_CONNECTOR_N_PROPS);
|
||||
META_KMS_CONNECTOR_N_PROPS,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static char *
|
||||
|
@ -266,9 +266,11 @@ init_proporties (MetaKmsCrtc *crtc,
|
||||
|
||||
meta_kms_impl_device_init_prop_table (impl_device,
|
||||
drm_props->props,
|
||||
drm_props->prop_values,
|
||||
drm_props->count_props,
|
||||
crtc->prop_table.props,
|
||||
META_KMS_CRTC_N_PROPS);
|
||||
META_KMS_CRTC_N_PROPS,
|
||||
NULL);
|
||||
|
||||
drmModeFreeObjectProperties (drm_props);
|
||||
}
|
||||
|
@ -360,9 +360,11 @@ find_prop (MetaKmsProp *props,
|
||||
void
|
||||
meta_kms_impl_device_init_prop_table (MetaKmsImplDevice *impl_device,
|
||||
uint32_t *drm_props,
|
||||
uint64_t *drm_prop_values,
|
||||
int n_drm_props,
|
||||
MetaKmsProp *props,
|
||||
int n_props)
|
||||
int n_props,
|
||||
gpointer user_data)
|
||||
{
|
||||
int fd;
|
||||
uint32_t i;
|
||||
@ -396,6 +398,13 @@ meta_kms_impl_device_init_prop_table (MetaKmsImplDevice *impl_device,
|
||||
|
||||
prop->prop_id = drm_props[i];
|
||||
|
||||
if (prop->parse)
|
||||
{
|
||||
prop->parse (impl_device, prop,
|
||||
drm_prop, drm_prop_values[i],
|
||||
user_data);
|
||||
}
|
||||
|
||||
drmModeFreeProperty (drm_prop);
|
||||
}
|
||||
}
|
||||
|
@ -35,13 +35,20 @@ typedef struct _MetaKmsDeviceCaps
|
||||
uint64_t cursor_height;
|
||||
} MetaKmsDeviceCaps;
|
||||
|
||||
typedef struct _MetaKmsProp
|
||||
typedef struct _MetaKmsProp MetaKmsProp;
|
||||
|
||||
struct _MetaKmsProp
|
||||
{
|
||||
const char *name;
|
||||
uint32_t type;
|
||||
void (* parse) (MetaKmsImplDevice *impl_device,
|
||||
MetaKmsProp *prop,
|
||||
drmModePropertyPtr drm_prop,
|
||||
uint64_t value,
|
||||
gpointer user_data);
|
||||
|
||||
uint32_t prop_id;
|
||||
} MetaKmsProp;
|
||||
};
|
||||
|
||||
#define META_TYPE_KMS_IMPL_DEVICE (meta_kms_impl_device_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaKmsImplDevice, meta_kms_impl_device,
|
||||
@ -87,9 +94,11 @@ MetaKmsPlane * meta_kms_impl_device_add_fake_plane (MetaKmsImplDevice *impl_devi
|
||||
|
||||
void meta_kms_impl_device_init_prop_table (MetaKmsImplDevice *impl_device,
|
||||
uint32_t *drm_props,
|
||||
uint64_t *drm_props_values,
|
||||
int n_drm_props,
|
||||
MetaKmsProp *props,
|
||||
int n_props);
|
||||
int n_props,
|
||||
gpointer user_data);
|
||||
|
||||
int meta_kms_impl_device_close (MetaKmsImplDevice *impl_device);
|
||||
|
||||
|
@ -454,9 +454,11 @@ init_properties (MetaKmsPlane *plane,
|
||||
|
||||
meta_kms_impl_device_init_prop_table (impl_device,
|
||||
drm_plane_props->props,
|
||||
drm_plane_props->prop_values,
|
||||
drm_plane_props->count_props,
|
||||
plane->prop_table.props,
|
||||
META_KMS_PLANE_N_PROPS);
|
||||
META_KMS_PLANE_N_PROPS,
|
||||
NULL);
|
||||
}
|
||||
|
||||
MetaKmsPlane *
|
||||
|
Loading…
Reference in New Issue
Block a user