drm/connector: hdmi: Factor out bpc and format computation logic
authorCristian Ciocaltea <cristian.ciocaltea@collabora.com>
Tue, 27 May 2025 12:11:13 +0000 (15:11 +0300)
committerMaxime Ripard <mripard@kernel.org>
Mon, 2 Jun 2025 09:02:32 +0000 (11:02 +0200)
commit4809299addb8c7d82a1d0917f0472c60ca07926a
treeb6f4175acbecdf1cadef932a7d90e012b6a727c4
parentb01ea9acde62e405692270387dcaa4d5f1b30db0
drm/connector: hdmi: Factor out bpc and format computation logic

In preparation to support fallback to an alternative output format, e.g.
YUV420, when RGB cannot be used for any of the available color depths,
move the bpc try loop out of hdmi_compute_config() and, instead, make it
part of hdmi_compute_format(), while adding a new parameter to the
latter holding the output format to be checked and eventually set.

Since this helper now also changes hdmi.output_bpc in addition to
hdmi.output_format, highlight the extended functionality by renaming it
to hdmi_compute_format_bpc().

This improves code reusability and further extensibility, without
introducing any functional changes.

Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Link: https://lore.kernel.org/r/20250527-hdmi-conn-yuv-v5-5-74c9c4a8ac0c@collabora.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>
drivers/gpu/drm/display/drm_hdmi_state_helper.c