[<prev] [next>] [day] [month] [year] [list]
Message-ID:
<TY4PR01MB144322177A6B8D2D538DAC6E4983EA@TY4PR01MB14432.jpnprd01.prod.outlook.com>
Date: Tue, 26 Aug 2025 02:40:00 +0800
From: Shengyu Qu <wiagn233@...look.com>
To: alexander.deucher@....com,
christian.koenig@....com,
airlied@...il.com,
simona@...ll.ch,
harry.wentland@....com,
sunpeng.li@....com,
siqueira@...lia.com,
maarten.lankhorst@...ux.intel.com,
mripard@...nel.org,
tzimmermann@...e.de,
contact@...aelrc.com,
lijo.lazar@....com,
jesse.zhang@....com,
tim.huang@....com,
dark_sylinc@...oo.com.ar,
mario.limonciello@....com,
alex.hung@....com,
aurabindo.pillai@....com,
sunil.khatri@....com,
chiahsuan.chung@....com,
mwen@...lia.com,
Roman.Li@....com,
Wayne.Lin@....com,
dominik.kaszewski@....com,
alvin.lee2@....com,
Aric.Cyr@....com,
Austin.Zheng@....com,
Sung.Lee@....com,
PeiChen.Huang@....com,
dillon.varone@....com,
Richard.Chiang@....com,
ryanseto@....com,
linux@...blig.org,
haoping.liu@....com,
Relja.Vojvodic@....com,
Yihan.Zhu@....com,
Samson.Tam@....com,
amd-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org,
wayland-devel@...ts.freedesktop.org
Cc: Shengyu Qu <wiagn233@...look.com>
Subject: [PATCH v2 1/2] drm/connector: Add "pixel_encoding" to switch between RGB & YUV color output modes
This patch adds "pixel_encoding" connector property, which allows user to
switch to different pixel encodings. This is useful and could solve some
problems that auto switch would do something wrong(Basically because of
wrong EDID info).
Supported encodings are: "auto" (0) (Default and original behavior), "rgb"
(1), "ycbcr444" (2), "ycbcr422" (4), and "ycbcr420" (8).
Signed-off-by: Matias N. Goldberg <dark_sylinc@...oo.com.ar>
Signed-off-by: Rafael Carvalho <contact@...aelrc.com>
Signed-off-by: Shengyu Qu <wiagn233@...look.com>
---
drivers/gpu/drm/drm_modes.c | 32 ++++++++++++++++++++++++++++++++
include/drm/drm_connector.h | 7 +++++++
2 files changed, 39 insertions(+)
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index e72f855fc495..ac2265e71b00 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -2162,6 +2162,35 @@ static int drm_mode_parse_tv_mode(const char *delim,
return 0;
}
+static int drm_mode_parse_pixel_encoding(const char *delim,
+ struct drm_cmdline_mode *mode)
+{
+ const char *value;
+
+ if (*delim != '=')
+ return -EINVAL;
+
+ value = delim + 1;
+ delim = strchr(value, ',');
+ if (!delim)
+ delim = value + strlen(value);
+
+ if (!strncmp(value, "auto", delim - value))
+ mode->pixel_encoding = 0;
+ else if (!strncmp(value, "rgb", delim - value))
+ mode->pixel_encoding = DRM_COLOR_FORMAT_RGB444;
+ else if (!strncmp(value, "ycbcr444", delim - value))
+ mode->pixel_encoding = DRM_COLOR_FORMAT_YCBCR444;
+ else if (!strncmp(value, "ycbcr422", delim - value))
+ mode->pixel_encoding = DRM_COLOR_FORMAT_YCBCR422;
+ else if (!strncmp(value, "ycbcr420", delim - value))
+ mode->pixel_encoding = DRM_COLOR_FORMAT_YCBCR420;
+ else
+ return -EINVAL;
+
+ return 0;
+}
+
static int drm_mode_parse_cmdline_options(const char *str,
bool freestanding,
const struct drm_connector *connector,
@@ -2234,6 +2263,9 @@ static int drm_mode_parse_cmdline_options(const char *str,
} else if (!strncmp(option, "tv_mode", delim - option)) {
if (drm_mode_parse_tv_mode(delim, mode))
return -EINVAL;
+ } else if (!strncmp(option, "pixel_encoding", delim - option)) {
+ if (drm_mode_parse_pixel_encoding(delim, mode))
+ return -EINVAL;
} else {
return -EINVAL;
}
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index f13d597370a3..fdaa86d25d6d 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -1723,6 +1723,13 @@ struct drm_cmdline_mode {
* Did the mode have a preferred TV mode?
*/
bool tv_mode_specified;
+
+ /**
+ * @pixel_encoding:
+ *
+ * Output pixel format encoding.
+ */
+ unsigned int pixel_encoding;
};
/**
--
2.43.0
Powered by blists - more mailing lists