kms/connector: Remove getters for state tracked by KmsConnectorState
This also removes some g_return_if_fail's because the test suite expects to be able to create arbitrary KmsUpdates even if they don't make sense for the real state. We just get lucky that the test suite isn't constructing updates with color space and hdr changes, yet. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
This commit is contained in:
parent
420c8cb37f
commit
b102b6eca7
@ -138,23 +138,6 @@ meta_kms_connector_get_name (MetaKmsConnector *connector)
|
||||
return connector->name;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_kms_connector_can_clone (MetaKmsConnector *connector,
|
||||
MetaKmsConnector *other_connector)
|
||||
{
|
||||
MetaKmsConnectorState *state = connector->current_state;
|
||||
MetaKmsConnectorState *other_state = other_connector->current_state;
|
||||
|
||||
if (state->common_possible_clones == 0 ||
|
||||
other_state->common_possible_clones == 0)
|
||||
return FALSE;
|
||||
|
||||
if (state->encoder_device_idxs != other_state->encoder_device_idxs)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
MetaKmsMode *
|
||||
meta_kms_connector_get_preferred_mode (MetaKmsConnector *connector)
|
||||
{
|
||||
@ -209,34 +192,6 @@ sync_fd_held (MetaKmsConnector *connector,
|
||||
connector->fd_held = should_hold_fd;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_kms_connector_is_color_space_supported (MetaKmsConnector *connector,
|
||||
MetaOutputColorspace color_space)
|
||||
{
|
||||
return !!(connector->current_state->colorspace.supported & (1 << color_space));
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_kms_connector_is_hdr_metadata_supported (MetaKmsConnector *connector)
|
||||
{
|
||||
return connector->current_state->hdr.supported;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_kms_connector_is_broadcast_rgb_supported (MetaKmsConnector *connector,
|
||||
MetaOutputRGBRange broadcast_rgb)
|
||||
{
|
||||
return !!(connector->current_state->broadcast_rgb.supported & (1 << broadcast_rgb));
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_kms_connector_is_max_bpc_supported (MetaKmsConnector *connector,
|
||||
int max_bpc)
|
||||
{
|
||||
return max_bpc >= connector->current_state->max_bpc.min_value &&
|
||||
max_bpc <= connector->current_state->max_bpc.max_value;
|
||||
}
|
||||
|
||||
static void
|
||||
set_panel_orientation (MetaKmsConnectorState *state,
|
||||
MetaKmsProp *panel_orientation)
|
||||
@ -1251,24 +1206,21 @@ meta_kms_connector_predict_state_in_impl (MetaKmsConnector *connector,
|
||||
|
||||
if (connector_update->colorspace.has_update)
|
||||
{
|
||||
g_warn_if_fail (meta_kms_connector_is_color_space_supported (
|
||||
connector,
|
||||
connector_update->colorspace.value));
|
||||
g_warn_if_fail (current_state->colorspace.supported &
|
||||
(1 << connector_update->colorspace.value));
|
||||
current_state->colorspace.value = connector_update->colorspace.value;
|
||||
}
|
||||
|
||||
if (connector_update->hdr.has_update)
|
||||
{
|
||||
g_warn_if_fail (meta_kms_connector_is_hdr_metadata_supported (
|
||||
connector));
|
||||
g_warn_if_fail (current_state->hdr.supported);
|
||||
current_state->hdr.value = connector_update->hdr.value;
|
||||
}
|
||||
|
||||
if (connector_update->broadcast_rgb.has_update)
|
||||
{
|
||||
g_warn_if_fail (meta_kms_connector_is_broadcast_rgb_supported (
|
||||
connector,
|
||||
connector_update->broadcast_rgb.value));
|
||||
g_warn_if_fail (current_state->broadcast_rgb.supported &
|
||||
(1 << connector_update->broadcast_rgb.value));
|
||||
current_state->broadcast_rgb.value = connector_update->broadcast_rgb.value;
|
||||
}
|
||||
}
|
||||
|
@ -94,22 +94,8 @@ uint32_t meta_kms_connector_get_id (MetaKmsConnector *connector);
|
||||
|
||||
const char * meta_kms_connector_get_name (MetaKmsConnector *connector);
|
||||
|
||||
gboolean meta_kms_connector_can_clone (MetaKmsConnector *connector,
|
||||
MetaKmsConnector *other_connector);
|
||||
|
||||
META_EXPORT_TEST
|
||||
MetaKmsMode * meta_kms_connector_get_preferred_mode (MetaKmsConnector *connector);
|
||||
|
||||
META_EXPORT_TEST
|
||||
const MetaKmsConnectorState * meta_kms_connector_get_current_state (MetaKmsConnector *connector);
|
||||
|
||||
gboolean meta_kms_connector_is_color_space_supported (MetaKmsConnector *connector,
|
||||
MetaOutputColorspace color_space);
|
||||
|
||||
gboolean meta_kms_connector_is_broadcast_rgb_supported (MetaKmsConnector *connector,
|
||||
MetaOutputRGBRange broadcast_rgb);
|
||||
|
||||
gboolean meta_kms_connector_is_hdr_metadata_supported (MetaKmsConnector *connector);
|
||||
|
||||
gboolean meta_kms_connector_is_max_bpc_supported (MetaKmsConnector *connector,
|
||||
int max_bpc);
|
||||
|
@ -430,8 +430,6 @@ meta_kms_update_set_max_bpc (MetaKmsUpdate *update,
|
||||
MetaKmsConnectorUpdate *connector_update;
|
||||
|
||||
g_assert (meta_kms_connector_get_device (connector) == update->device);
|
||||
g_return_if_fail (meta_kms_connector_is_max_bpc_supported (connector,
|
||||
max_bpc));
|
||||
|
||||
connector_update = ensure_connector_update (update, connector);
|
||||
connector_update->max_bpc.value = max_bpc;
|
||||
@ -460,7 +458,6 @@ meta_kms_update_set_hdr_metadata (MetaKmsUpdate *update,
|
||||
MetaKmsConnectorUpdate *connector_update;
|
||||
|
||||
g_assert (meta_kms_connector_get_device (connector) == update->device);
|
||||
g_return_if_fail (meta_kms_connector_is_hdr_metadata_supported (connector));
|
||||
|
||||
connector_update = ensure_connector_update (update, connector);
|
||||
connector_update->hdr.has_update = TRUE;
|
||||
@ -478,8 +475,6 @@ meta_kms_update_set_broadcast_rgb (MetaKmsUpdate *update,
|
||||
MetaKmsConnectorUpdate *connector_update;
|
||||
|
||||
g_assert (meta_kms_connector_get_device (connector) == update->device);
|
||||
g_return_if_fail (meta_kms_connector_is_broadcast_rgb_supported (connector,
|
||||
rgb_range));
|
||||
|
||||
connector_update = ensure_connector_update (update, connector);
|
||||
connector_update->broadcast_rgb.has_update = TRUE;
|
||||
|
@ -75,8 +75,19 @@ gboolean
|
||||
meta_output_kms_can_clone (MetaOutputKms *output_kms,
|
||||
MetaOutputKms *other_output_kms)
|
||||
{
|
||||
return meta_kms_connector_can_clone (output_kms->kms_connector,
|
||||
other_output_kms->kms_connector);
|
||||
const MetaKmsConnectorState *state =
|
||||
meta_kms_connector_get_current_state (output_kms->kms_connector);
|
||||
const MetaKmsConnectorState *other_state =
|
||||
meta_kms_connector_get_current_state (other_output_kms->kms_connector);
|
||||
|
||||
if (state->common_possible_clones == 0 ||
|
||||
other_state->common_possible_clones == 0)
|
||||
return FALSE;
|
||||
|
||||
if (state->encoder_device_idxs != other_state->encoder_device_idxs)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GBytes *
|
||||
|
Loading…
Reference in New Issue
Block a user