onscreen/native: Use max bpc support from OutputInfo

The max bpc support is already tracked in the OutputInfo, so let's use
that instead of querying the KMS Connector directly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
This commit is contained in:
Sebastian Wick 2024-01-23 20:49:54 +01:00 committed by Marge Bot
parent 8acf250583
commit 706bee2a58
4 changed files with 30 additions and 20 deletions

View File

@ -261,6 +261,14 @@ meta_kms_connector_is_broadcast_rgb_supported (MetaKmsConnector *connector,
return !!(connector->current_state->broadcast_rgb.supported & (1 << 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 static void
set_panel_orientation (MetaKmsConnectorState *state, set_panel_orientation (MetaKmsConnectorState *state,
MetaKmsProp *panel_orientation) MetaKmsProp *panel_orientation)

View File

@ -107,3 +107,6 @@ gboolean meta_kms_connector_is_broadcast_rgb_supported (MetaKmsConnector *conn
MetaOutputRGBRange broadcast_rgb); MetaOutputRGBRange broadcast_rgb);
gboolean meta_kms_connector_is_hdr_metadata_supported (MetaKmsConnector *connector); gboolean meta_kms_connector_is_hdr_metadata_supported (MetaKmsConnector *connector);
gboolean meta_kms_connector_is_max_bpc_supported (MetaKmsConnector *connector,
int max_bpc);

View File

@ -430,6 +430,8 @@ meta_kms_update_set_max_bpc (MetaKmsUpdate *update,
MetaKmsConnectorUpdate *connector_update; MetaKmsConnectorUpdate *connector_update;
g_assert (meta_kms_connector_get_device (connector) == update->device); 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 = ensure_connector_update (update, connector);
connector_update->max_bpc.value = max_bpc; connector_update->max_bpc.value = max_bpc;

View File

@ -624,31 +624,28 @@ static void
set_max_bpc (MetaOutputKms *output_kms, set_max_bpc (MetaOutputKms *output_kms,
MetaKmsUpdate *kms_update) MetaKmsUpdate *kms_update)
{ {
MetaOutput *output = META_OUTPUT (output_kms);
const MetaOutputInfo *output_info = meta_output_get_info (output);
MetaKmsConnector *kms_connector = MetaKmsConnector *kms_connector =
meta_output_kms_get_kms_connector (output_kms); meta_output_kms_get_kms_connector (output_kms);
const MetaKmsRange *range;
range = meta_kms_connector_get_max_bpc (kms_connector);
if (range)
{
MetaOutput *output = META_OUTPUT (output_kms);
unsigned int max_bpc; unsigned int max_bpc;
if (!meta_output_get_max_bpc (output, &max_bpc)) if (!meta_output_get_max_bpc (output, &max_bpc))
return; return;
if (max_bpc >= range->min_value && max_bpc <= range->max_value) if (output_info->max_bpc_min == 0 && output_info->max_bpc_max == 0)
{ return;
meta_kms_update_set_max_bpc (kms_update, kms_connector, max_bpc);
} if (max_bpc < output_info->max_bpc_min || max_bpc > output_info->max_bpc_max)
else
{ {
g_warning ("Ignoring out of range value %u for max bpc (%u-%u)", g_warning ("Ignoring out of range value %u for max bpc (%u-%u)",
max_bpc, max_bpc,
(unsigned) range->min_value, (unsigned) output_info->max_bpc_min,
(unsigned) range->max_value); (unsigned) output_info->max_bpc_max);
} return;
} }
meta_kms_update_set_max_bpc (kms_update, kms_connector, max_bpc);
} }
static void static void