mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02:00
drm/display: hdmi-state-helper: Act on color format DRM property
With the introduction of the "color format" DRM property, which allows userspace to request a specific color format, the HDMI state helper should implement this. Implement it by translating the requested drm_connector_color_format to a drm_output_color_format enum value as per the logic HDMI should use for this: Auto is translated to RGB, and a fallback to YUV420 is only performed if the original color format was auto. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-8-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
3f0f770ccc
commit
cb5c6b7e7b
|
|
@ -671,8 +671,39 @@ hdmi_compute_config(const struct drm_connector *connector,
|
|||
unsigned int max_bpc = clamp_t(unsigned int,
|
||||
conn_state->max_bpc,
|
||||
8, connector->max_bpc);
|
||||
enum drm_output_color_format fmt;
|
||||
int ret;
|
||||
|
||||
if (conn_state->color_format != DRM_CONNECTOR_COLOR_FORMAT_AUTO) {
|
||||
switch (conn_state->color_format) {
|
||||
case DRM_CONNECTOR_COLOR_FORMAT_AUTO:
|
||||
drm_warn(connector->dev, "AUTO format in non-AUTO path.\n");
|
||||
fallthrough;
|
||||
case DRM_CONNECTOR_COLOR_FORMAT_RGB444:
|
||||
fmt = DRM_OUTPUT_COLOR_FORMAT_RGB444;
|
||||
break;
|
||||
case DRM_CONNECTOR_COLOR_FORMAT_YCBCR444:
|
||||
fmt = DRM_OUTPUT_COLOR_FORMAT_YCBCR444;
|
||||
break;
|
||||
case DRM_CONNECTOR_COLOR_FORMAT_YCBCR422:
|
||||
fmt = DRM_OUTPUT_COLOR_FORMAT_YCBCR422;
|
||||
break;
|
||||
case DRM_CONNECTOR_COLOR_FORMAT_YCBCR420:
|
||||
fmt = DRM_OUTPUT_COLOR_FORMAT_YCBCR420;
|
||||
break;
|
||||
default:
|
||||
drm_dbg_kms(connector->dev, "HDMI does not support color format '%d'.\n",
|
||||
conn_state->color_format);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return hdmi_compute_format_bpc(connector, conn_state, mode, max_bpc, fmt);
|
||||
}
|
||||
|
||||
/*
|
||||
* For %DRM_CONNECTOR_COLOR_FORMAT_AUTO, try RGB first, and fall back
|
||||
* to the less bandwidth-intensive YCBCR420 if RGB fails.
|
||||
*/
|
||||
ret = hdmi_compute_format_bpc(connector, conn_state, mode, max_bpc,
|
||||
DRM_OUTPUT_COLOR_FORMAT_RGB444);
|
||||
if (ret) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user