kms-connector: Add "max bpc" property
This limits the bits-per-channel colour depth of the signal that the connector is allowed to output. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
This commit is contained in:
parent
f765437410
commit
33ee155630
@ -39,6 +39,7 @@ typedef enum _MetaKmsConnectorProp
|
||||
META_KMS_CONNECTOR_PROP_SCALING_MODE,
|
||||
META_KMS_CONNECTOR_PROP_PANEL_ORIENTATION,
|
||||
META_KMS_CONNECTOR_PROP_NON_DESKTOP,
|
||||
META_KMS_CONNECTOR_PROP_MAX_BPC,
|
||||
META_KMS_CONNECTOR_N_PROPS
|
||||
} MetaKmsConnectorProp;
|
||||
|
||||
|
@ -190,6 +190,19 @@ has_privacy_screen_software_toggle (MetaKmsConnector *connector)
|
||||
META_KMS_CONNECTOR_PROP_PRIVACY_SCREEN_SW_STATE) != 0;
|
||||
}
|
||||
|
||||
const MetaKmsRange *
|
||||
meta_kms_connector_get_max_bpc (MetaKmsConnector *connector)
|
||||
{
|
||||
const MetaKmsRange *range = NULL;
|
||||
|
||||
if (connector->current_state &&
|
||||
meta_kms_connector_get_prop_id (connector,
|
||||
META_KMS_CONNECTOR_PROP_MAX_BPC))
|
||||
range = &connector->current_state->max_bpc;
|
||||
|
||||
return range;
|
||||
}
|
||||
|
||||
static void
|
||||
sync_fd_held (MetaKmsConnector *connector,
|
||||
MetaKmsImplDevice *impl_device)
|
||||
@ -308,6 +321,14 @@ state_set_properties (MetaKmsConnectorState *state,
|
||||
prop = &props[META_KMS_CONNECTOR_PROP_PRIVACY_SCREEN_HW_STATE];
|
||||
if (prop->prop_id)
|
||||
set_privacy_screen (state, connector, prop);
|
||||
|
||||
prop = &props[META_KMS_CONNECTOR_PROP_MAX_BPC];
|
||||
if (prop->prop_id)
|
||||
{
|
||||
state->max_bpc.value = prop->value;
|
||||
state->max_bpc.min_value = prop->range_min;
|
||||
state->max_bpc.max_value = prop->range_max;
|
||||
}
|
||||
}
|
||||
|
||||
static CoglSubpixelOrder
|
||||
@ -622,6 +643,11 @@ meta_kms_connector_state_changes (MetaKmsConnectorState *state,
|
||||
if (!kms_modes_equal (state->modes, new_state->modes))
|
||||
return META_KMS_RESOURCE_CHANGE_FULL;
|
||||
|
||||
if (state->max_bpc.value != new_state->max_bpc.value ||
|
||||
state->max_bpc.min_value != new_state->max_bpc.min_value ||
|
||||
state->max_bpc.max_value != new_state->max_bpc.max_value)
|
||||
return META_KMS_RESOURCE_CHANGE_FULL;
|
||||
|
||||
if (state->privacy_screen_state != new_state->privacy_screen_state)
|
||||
return META_KMS_RESOURCE_CHANGE_PRIVACY_SCREEN;
|
||||
|
||||
@ -940,6 +966,11 @@ init_properties (MetaKmsConnector *connector,
|
||||
.name = "non-desktop",
|
||||
.type = DRM_MODE_PROP_RANGE,
|
||||
},
|
||||
[META_KMS_CONNECTOR_PROP_MAX_BPC] =
|
||||
{
|
||||
.name = "max bpc",
|
||||
.type = DRM_MODE_PROP_RANGE,
|
||||
},
|
||||
},
|
||||
.dpms_enum = {
|
||||
[META_KMS_CONNECTOR_DPMS_ON] =
|
||||
|
@ -59,6 +59,8 @@ typedef struct _MetaKmsConnectorState
|
||||
gboolean hotplug_mode_update;
|
||||
|
||||
MetaMonitorTransform panel_orientation_transform;
|
||||
|
||||
MetaKmsRange max_bpc;
|
||||
} MetaKmsConnectorState;
|
||||
|
||||
META_EXPORT_TEST
|
||||
@ -83,4 +85,6 @@ gboolean meta_kms_connector_is_underscanning_supported (MetaKmsConnector *connec
|
||||
|
||||
gboolean meta_kms_connector_is_privacy_screen_supported (MetaKmsConnector *connector);
|
||||
|
||||
const MetaKmsRange * meta_kms_connector_get_max_bpc (MetaKmsConnector *connector);
|
||||
|
||||
#endif /* META_KMS_CONNECTOR_H */
|
||||
|
Loading…
Reference in New Issue
Block a user