* [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format
@ 2025-04-25 10:26 Cristian Ciocaltea
2025-04-25 10:26 ` [PATCH v4 01/23] drm/connector: hdmi: Evaluate limited range after computing format Cristian Ciocaltea
` (22 more replies)
0 siblings, 23 replies; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:26 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Provide the basic support to enable using YUV420 as an RGB fallback when
computing the best output format and color depth.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
Changes in v4:
- Collected R-b tags from Maxime and Dmitry
- Squashed "drm/connector: hdmi: Rename hdmi_compute_format() internal
helper" into "drm/connector: hdmi: Factor out bpc and format
computation logic" and moved the TODO hunk to next patch (Maxime)
- Logged a debug message in "drm/connector: hdmi: Use YUV420 output
format as an RGB fallback" for hdmi_compute_format_bpc() (Maxime)
- Reworded "drm/tests: hdmi: Fixup CamelCase warning" to "drm/tests:
hdmi: Replace '[_]MHz' with 'mhz'"
- Reworked the patches simplifying EDID setup: ended up with just a new
__connector_hdmi_init() function and a single helper macro (Maxime)
- Added new patches to handle EDEADLK:
* "drm/tests: helpers: Add a (re)try helper variant to enable CRTC connector"
* "drm/tests: hdmi: Switch to drm_kunit_helper_try_enable_crtc_connector()"
* "drm/tests: hdmi: Add macro to support EDEADLK handling"
* "drm/tests: hdmi: Restart atomic sequence on EDEADLK"
* "drm/tests: hdmi: Switch to drm_atomic_get_new_connector_state() where possible"
- Updated all YUV420 test cases:
* Moved function renames and EDID content to dedicated patches
* Improved error handling
* Reworded a few comment blocks
* Hand-crafted the state and used drm_atomic_check_only() in
drm_test_check_driver_unsupported_fallback_yuv420()
- Added "drm/tests: hdmi: Add test for unsupported RGB/YUV420 mode"
- Rebased series onto drm-misc-next from 2025-04-22
- Link to v3: https://lore.kernel.org/r/20250326-hdmi-conn-yuv-v3-0-294d3ebbb4b2@collabora.com
Changes in v3:
- Collected R-b tags from Dmitry and Maxime
- Updated debug messages in "drm/connector: hdmi: Add support for YUV420
format verification" to avoid referencing VIC (Maxime)
- Reworked "drm/connector: hdmi: Use YUV420 output format as an RGB
fallback" and moved some parts to separate patches:
* drm/connector: hdmi: Add missing bpc debug info to hdmi_try_format_bpc()
* drm/connector: hdmi: Rename hdmi_compute_format() internal helper
* drm/connector: hdmi: Factor out bpc and format computation logic
- Reworked "drm/tests: hdmi: Add macros to simplify EDID setup" by
renaming the new helpers and moving the conversion to separate
patches (Maxime):
* drm/tests: hdmi: Fixup CamelCase warning
* drm/tests: hdmi: Replace open coded EDID setup
* drm/tests: hdmi: Drop unused drm_kunit_helper_connector_hdmi_init_funcs()
- Moved connector_hdmi_init_with_edid_funcs() changes from "drm/tests:
hdmi: Add limited range tests for YUV420 mode") to "drm/tests: hdmi:
Setup ycbcr_420_allowed before initializing connector"
- Got rid of the floating-point operation in "drm/tests: hdmi: Add max
TMDS rate fallback tests for YUV420 mode" in order to fix the build
errors reported by some kernel test robots
- Added new patch "drm/tests: hdmi: Add test for unsuccessful forced
fallback to YUV420"
- Rebased series onto drm-misc-next from 2025-03-25
- Link to v2: https://lore.kernel.org/r/20250311-hdmi-conn-yuv-v2-0-fbdb94f02562@collabora.com
Changes in v2:
- Provided the missing Fixes tag on first patch (Dmitry)
- Added patch "drm/connector: hdmi: Improve debug message for supported
format"
- Reworked "drm/connector: hdmi: Use YUV420 output format as an RGB
fallback" so that the fallback to YUV420 will be attempted only when
RGB cannot be supported for any of the available color depths (Maxime)
- Added a patch to simplify EDID setup in KUnit cases
- Added two patches extending KUnit coverage for YUV420 by providing
tests for limited range and max TMDS rate fallback
- Rebased series onto drm-misc-next-2025-03-06
- Link to v1: https://lore.kernel.org/r/20241130-hdmi-conn-yuv-v1-0-254279a08671@collabora.com
---
Cristian Ciocaltea (23):
drm/connector: hdmi: Evaluate limited range after computing format
drm/connector: hdmi: Add support for YUV420 format verification
drm/connector: hdmi: Improve debug message for supported format
drm/connector: hdmi: Add missing bpc debug info to hdmi_try_format_bpc()
drm/connector: hdmi: Factor out bpc and format computation logic
drm/connector: hdmi: Use YUV420 output format as an RGB fallback
drm/tests: hdmi: Replace '[_]MHz' with 'mhz'
drm/tests: hdmi: Add macro to simplify EDID setup
drm/tests: hdmi: Replace open coded EDID setup
drm/tests: hdmi: Drop unused drm_kunit_helper_connector_hdmi_init_funcs()
drm/tests: hdmi: Setup ycbcr_420_allowed before initializing connector
drm/tests: helpers: Add a (re)try helper variant to enable CRTC connector
drm/tests: hdmi: Switch to drm_kunit_helper_try_enable_crtc_connector()
drm/tests: hdmi: Add macro to support EDEADLK handling
drm/tests: hdmi: Restart atomic sequence on EDEADLK
drm/tests: hdmi: Switch to drm_atomic_get_new_connector_state() where possible
drm/tests: hdmi: Provide EDID supporting 4K@30Hz with YUV420 only
drm/tests: hdmi: Add limited range tests for YUV420 mode
drm/tests: hdmi: Rename max TMDS rate fallback tests
drm/tests: hdmi: Provide EDID supporting 4K@30Hz with RGB/YUV
drm/tests: hdmi: Add max TMDS rate fallback tests for YUV420 mode
drm/tests: hdmi: Add test for unsuccessful fallback to YUV420
drm/tests: hdmi: Add test for unsupported RGB/YUV420 mode
drivers/gpu/drm/display/drm_hdmi_state_helper.c | 118 ++-
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 903 +++++++++++++++------
drivers/gpu/drm/tests/drm_kunit_edid.h | 232 ++++++
drivers/gpu/drm/tests/drm_kunit_helpers.c | 39 +
include/drm/drm_kunit_helpers.h | 7 +
5 files changed, 992 insertions(+), 307 deletions(-)
---
base-commit: a49ce9cc85a82d5c5d65186f5a8fda0ebfcff571
change-id: 20241130-hdmi-conn-yuv-e1fa596df768
^ permalink raw reply [flat|nested] 52+ messages in thread
* [PATCH v4 01/23] drm/connector: hdmi: Evaluate limited range after computing format
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
@ 2025-04-25 10:26 ` Cristian Ciocaltea
2025-04-25 10:26 ` [PATCH v4 02/23] drm/connector: hdmi: Add support for YUV420 format verification Cristian Ciocaltea
` (21 subsequent siblings)
22 siblings, 0 replies; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:26 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Evaluating the requirement to use a limited RGB quantization range
involves a verification of the output format, among others, but this is
currently performed before actually computing the format, hence relying
on the old connector state.
Move the call to hdmi_is_limited_range() after hdmi_compute_config() to
ensure the verification is done on the updated output format.
Fixes: 027d43590649 ("drm/connector: hdmi: Add RGB Quantization Range to the connector state")
Reviewed-by: Dmitry Baryshkov <lumag@kernel.org>
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/display/drm_hdmi_state_helper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
index d9d9948b29e9d5ef9bc9cc9108b3ace4aca2e3ae..45b154c8abb2cc731bf4be472e58815cf47463d4 100644
--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -798,12 +798,12 @@ int drm_atomic_helper_connector_hdmi_check(struct drm_connector *connector,
if (!new_conn_state->crtc || !new_conn_state->best_encoder)
return 0;
- new_conn_state->hdmi.is_limited_range = hdmi_is_limited_range(connector, new_conn_state);
-
ret = hdmi_compute_config(connector, new_conn_state, mode);
if (ret)
return ret;
+ new_conn_state->hdmi.is_limited_range = hdmi_is_limited_range(connector, new_conn_state);
+
ret = hdmi_generate_infoframes(connector, new_conn_state);
if (ret)
return ret;
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 02/23] drm/connector: hdmi: Add support for YUV420 format verification
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
2025-04-25 10:26 ` [PATCH v4 01/23] drm/connector: hdmi: Evaluate limited range after computing format Cristian Ciocaltea
@ 2025-04-25 10:26 ` Cristian Ciocaltea
2025-04-25 10:26 ` [PATCH v4 03/23] drm/connector: hdmi: Improve debug message for supported format Cristian Ciocaltea
` (20 subsequent siblings)
22 siblings, 0 replies; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:26 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Provide the necessary constraints verification in
sink_supports_format_bpc() in order to support handling of YUV420
output format.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/display/drm_hdmi_state_helper.c | 39 +++++++++++++++++++++++--
1 file changed, 36 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
index 45b154c8abb2cc731bf4be472e58815cf47463d4..eb284032ea794838f333ce639243540fca91dbdb 100644
--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -3,6 +3,7 @@
#include <drm/drm_atomic.h>
#include <drm/drm_connector.h>
#include <drm/drm_edid.h>
+#include <drm/drm_modes.h>
#include <drm/drm_print.h>
#include <drm/display/drm_hdmi_audio_helper.h>
@@ -407,6 +408,11 @@ sink_supports_format_bpc(const struct drm_connector *connector,
return false;
}
+ if (drm_mode_is_420_only(info, mode) && format != HDMI_COLORSPACE_YUV420) {
+ drm_dbg_kms(dev, "Mode can be only supported in YUV420 format.\n");
+ return false;
+ }
+
switch (format) {
case HDMI_COLORSPACE_RGB:
drm_dbg_kms(dev, "RGB Format, checking the constraints.\n");
@@ -437,9 +443,36 @@ sink_supports_format_bpc(const struct drm_connector *connector,
return true;
case HDMI_COLORSPACE_YUV420:
- /* TODO: YUV420 is unsupported at the moment. */
- drm_dbg_kms(dev, "YUV420 format isn't supported yet.\n");
- return false;
+ drm_dbg_kms(dev, "YUV420 format, checking the constraints.\n");
+
+ if (!(info->color_formats & DRM_COLOR_FORMAT_YCBCR420)) {
+ drm_dbg_kms(dev, "Sink doesn't support YUV420.\n");
+ return false;
+ }
+
+ if (!drm_mode_is_420(info, mode)) {
+ drm_dbg_kms(dev, "Mode cannot be supported in YUV420 format.\n");
+ return false;
+ }
+
+ if (bpc == 10 && !(info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_30)) {
+ drm_dbg_kms(dev, "10 BPC but sink doesn't support Deep Color 30.\n");
+ return false;
+ }
+
+ if (bpc == 12 && !(info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_36)) {
+ drm_dbg_kms(dev, "12 BPC but sink doesn't support Deep Color 36.\n");
+ return false;
+ }
+
+ if (bpc == 16 && !(info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_48)) {
+ drm_dbg_kms(dev, "16 BPC but sink doesn't support Deep Color 48.\n");
+ return false;
+ }
+
+ drm_dbg_kms(dev, "YUV420 format supported in that configuration.\n");
+
+ return true;
case HDMI_COLORSPACE_YUV422:
drm_dbg_kms(dev, "YUV422 format, checking the constraints.\n");
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 03/23] drm/connector: hdmi: Improve debug message for supported format
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
2025-04-25 10:26 ` [PATCH v4 01/23] drm/connector: hdmi: Evaluate limited range after computing format Cristian Ciocaltea
2025-04-25 10:26 ` [PATCH v4 02/23] drm/connector: hdmi: Add support for YUV420 format verification Cristian Ciocaltea
@ 2025-04-25 10:26 ` Cristian Ciocaltea
2025-04-25 10:26 ` [PATCH v4 04/23] drm/connector: hdmi: Add missing bpc debug info to hdmi_try_format_bpc() Cristian Ciocaltea
` (19 subsequent siblings)
22 siblings, 0 replies; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:26 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Add the missing 'bpc' string to the debug message indicating the
supported format identified within hdmi_try_format_bpc() helper.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/display/drm_hdmi_state_helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
index eb284032ea794838f333ce639243540fca91dbdb..a0cb3163f457635cf27e53b009bd83f85eee9336 100644
--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -596,7 +596,7 @@ hdmi_try_format_bpc(const struct drm_connector *connector,
return false;
}
- drm_dbg_kms(dev, "%s output format supported with %u (TMDS char rate: %llu Hz)\n",
+ drm_dbg_kms(dev, "%s output format supported with %u bpc (TMDS char rate: %llu Hz)\n",
drm_hdmi_connector_get_output_format_name(fmt),
bpc, conn_state->hdmi.tmds_char_rate);
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 04/23] drm/connector: hdmi: Add missing bpc debug info to hdmi_try_format_bpc()
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (2 preceding siblings ...)
2025-04-25 10:26 ` [PATCH v4 03/23] drm/connector: hdmi: Improve debug message for supported format Cristian Ciocaltea
@ 2025-04-25 10:26 ` Cristian Ciocaltea
2025-04-25 10:26 ` [PATCH v4 05/23] drm/connector: hdmi: Factor out bpc and format computation logic Cristian Ciocaltea
` (18 subsequent siblings)
22 siblings, 0 replies; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:26 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
The very first debug message in hdmi_try_format_bpc() is incomplete, as
it doesn't provide the given bpc in addition to the tried format.
Add the missing debug information and drop the now redundant message
from hdmi_compute_config().
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/display/drm_hdmi_state_helper.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
index a0cb3163f457635cf27e53b009bd83f85eee9336..f54eb5c594cddbd67dfacb5e06d54e9ce7851013 100644
--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -578,8 +578,9 @@ hdmi_try_format_bpc(const struct drm_connector *connector,
struct drm_device *dev = connector->dev;
int ret;
- drm_dbg_kms(dev, "Trying %s output format\n",
- drm_hdmi_connector_get_output_format_name(fmt));
+ drm_dbg_kms(dev, "Trying %s output format with %u bpc\n",
+ drm_hdmi_connector_get_output_format_name(fmt),
+ bpc);
if (!sink_supports_format_bpc(connector, info, mode, fmt, bpc)) {
drm_dbg_kms(dev, "%s output format not supported with %u bpc\n",
@@ -638,8 +639,6 @@ hdmi_compute_config(const struct drm_connector *connector,
int ret;
for (bpc = max_bpc; bpc >= 8; bpc -= 2) {
- drm_dbg_kms(dev, "Trying with a %d bpc output\n", bpc);
-
ret = hdmi_compute_format(connector, conn_state, mode, bpc);
if (ret)
continue;
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 05/23] drm/connector: hdmi: Factor out bpc and format computation logic
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (3 preceding siblings ...)
2025-04-25 10:26 ` [PATCH v4 04/23] drm/connector: hdmi: Add missing bpc debug info to hdmi_try_format_bpc() Cristian Ciocaltea
@ 2025-04-25 10:26 ` Cristian Ciocaltea
2025-04-25 10:26 ` [PATCH v4 06/23] drm/connector: hdmi: Use YUV420 output format as an RGB fallback Cristian Ciocaltea
` (17 subsequent siblings)
22 siblings, 0 replies; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:26 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
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>
---
drivers/gpu/drm/display/drm_hdmi_state_helper.c | 60 ++++++++++++-------------
1 file changed, 30 insertions(+), 30 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
index f54eb5c594cddbd67dfacb5e06d54e9ce7851013..9e0a468073acbb2477eff1abef1c09d63620afaa 100644
--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -605,45 +605,22 @@ hdmi_try_format_bpc(const struct drm_connector *connector,
}
static int
-hdmi_compute_format(const struct drm_connector *connector,
- struct drm_connector_state *conn_state,
- const struct drm_display_mode *mode,
- unsigned int bpc)
-{
- struct drm_device *dev = connector->dev;
-
- /*
- * TODO: Add support for YCbCr420 output for HDMI 2.0 capable
- * devices, for modes that only support YCbCr420.
- */
- if (hdmi_try_format_bpc(connector, conn_state, mode, bpc, HDMI_COLORSPACE_RGB)) {
- conn_state->hdmi.output_format = HDMI_COLORSPACE_RGB;
- return 0;
- }
-
- drm_dbg_kms(dev, "Failed. No Format Supported for that bpc count.\n");
-
- return -EINVAL;
-}
-
-static int
-hdmi_compute_config(const struct drm_connector *connector,
- struct drm_connector_state *conn_state,
- const struct drm_display_mode *mode)
+hdmi_compute_format_bpc(const struct drm_connector *connector,
+ struct drm_connector_state *conn_state,
+ const struct drm_display_mode *mode,
+ unsigned int max_bpc, enum hdmi_colorspace fmt)
{
struct drm_device *dev = connector->dev;
- unsigned int max_bpc = clamp_t(unsigned int,
- conn_state->max_bpc,
- 8, connector->max_bpc);
unsigned int bpc;
int ret;
for (bpc = max_bpc; bpc >= 8; bpc -= 2) {
- ret = hdmi_compute_format(connector, conn_state, mode, bpc);
- if (ret)
+ ret = hdmi_try_format_bpc(connector, conn_state, mode, bpc, fmt);
+ if (!ret)
continue;
conn_state->hdmi.output_bpc = bpc;
+ conn_state->hdmi.output_format = fmt;
drm_dbg_kms(dev,
"Mode %ux%u @ %uHz: Found configuration: bpc: %u, fmt: %s, clock: %llu\n",
@@ -655,9 +632,32 @@ hdmi_compute_config(const struct drm_connector *connector,
return 0;
}
+ drm_dbg_kms(dev, "Failed. %s output format not supported for any bpc count.\n",
+ drm_hdmi_connector_get_output_format_name(fmt));
+
return -EINVAL;
}
+static int
+hdmi_compute_config(const struct drm_connector *connector,
+ struct drm_connector_state *conn_state,
+ const struct drm_display_mode *mode)
+{
+ unsigned int max_bpc = clamp_t(unsigned int,
+ conn_state->max_bpc,
+ 8, connector->max_bpc);
+ int ret;
+
+ /*
+ * TODO: Add support for YCbCr420 output for HDMI 2.0 capable
+ * devices, for modes that only support YCbCr420.
+ */
+ ret = hdmi_compute_format_bpc(connector, conn_state, mode, max_bpc,
+ HDMI_COLORSPACE_RGB);
+
+ return ret;
+}
+
static int hdmi_generate_avi_infoframe(const struct drm_connector *connector,
struct drm_connector_state *conn_state)
{
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 06/23] drm/connector: hdmi: Use YUV420 output format as an RGB fallback
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (4 preceding siblings ...)
2025-04-25 10:26 ` [PATCH v4 05/23] drm/connector: hdmi: Factor out bpc and format computation logic Cristian Ciocaltea
@ 2025-04-25 10:26 ` Cristian Ciocaltea
2025-05-13 13:35 ` Maxime Ripard
2025-04-25 10:26 ` [PATCH v4 07/23] drm/tests: hdmi: Replace '[_]MHz' with 'mhz' Cristian Ciocaltea
` (16 subsequent siblings)
22 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:26 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Try to make use of YUV420 when computing the best output format and
RGB cannot be supported for any of the available color depths.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/display/drm_hdmi_state_helper.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
index 9e0a468073acbb2477eff1abef1c09d63620afaa..1fba10b92a6baa49150b6ff1e96bf2c2739bf269 100644
--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -648,14 +648,26 @@ hdmi_compute_config(const struct drm_connector *connector,
8, connector->max_bpc);
int ret;
- /*
- * TODO: Add support for YCbCr420 output for HDMI 2.0 capable
- * devices, for modes that only support YCbCr420.
- */
ret = hdmi_compute_format_bpc(connector, conn_state, mode, max_bpc,
HDMI_COLORSPACE_RGB);
+ if (!ret)
+ return 0;
- return ret;
+ if (!connector->ycbcr_420_allowed) {
+ drm_dbg_kms(connector->dev,
+ "YUV420 output format not allowed for connector.\n");
+ return -EINVAL;
+ }
+
+ ret = hdmi_compute_format_bpc(connector, conn_state, mode, max_bpc,
+ HDMI_COLORSPACE_YUV420);
+ if (ret) {
+ drm_dbg_kms(connector->dev,
+ "YUV420 output format doesn't work.\n");
+ return ret;
+ }
+
+ return 0;
}
static int hdmi_generate_avi_infoframe(const struct drm_connector *connector,
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 07/23] drm/tests: hdmi: Replace '[_]MHz' with 'mhz'
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (5 preceding siblings ...)
2025-04-25 10:26 ` [PATCH v4 06/23] drm/connector: hdmi: Use YUV420 output format as an RGB fallback Cristian Ciocaltea
@ 2025-04-25 10:26 ` Cristian Ciocaltea
2025-04-26 2:06 ` Dmitry Baryshkov
2025-04-25 10:26 ` [PATCH v4 08/23] drm/tests: hdmi: Add macro to simplify EDID setup Cristian Ciocaltea
` (15 subsequent siblings)
22 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:26 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Improve consistency throughout drm_hdmi_state_helper_test.c by replacing
the two occurrences of '[_]MHz' substring with 'mhz'.
As a bonus, this also helps getting rid of checkpatch.pl complaint:
CHECK: Avoid CamelCase: <reject_100_MHz_connector_hdmi_funcs>
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index 7ffd666753b10bc991894e238206a3c5328d0e23..c8dc6fa0f925e35e9903a18bac7f78f9d8165960 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -89,15 +89,15 @@ static const struct drm_connector_hdmi_funcs reject_connector_hdmi_funcs = {
};
static enum drm_mode_status
-reject_100MHz_connector_tmds_char_rate_valid(const struct drm_connector *connector,
+reject_100mhz_connector_tmds_char_rate_valid(const struct drm_connector *connector,
const struct drm_display_mode *mode,
unsigned long long tmds_rate)
{
return (tmds_rate > 100ULL * 1000 * 1000) ? MODE_BAD : MODE_OK;
}
-static const struct drm_connector_hdmi_funcs reject_100_MHz_connector_hdmi_funcs = {
- .tmds_char_rate_valid = reject_100MHz_connector_tmds_char_rate_valid,
+static const struct drm_connector_hdmi_funcs reject_100mhz_connector_hdmi_funcs = {
+ .tmds_char_rate_valid = reject_100mhz_connector_tmds_char_rate_valid,
};
static int dummy_connector_get_modes(struct drm_connector *connector)
@@ -1934,7 +1934,7 @@ static void drm_test_check_mode_valid_reject_rate(struct kunit *test)
priv = drm_kunit_helper_connector_hdmi_init_funcs(test,
BIT(HDMI_COLORSPACE_RGB),
8,
- &reject_100_MHz_connector_hdmi_funcs);
+ &reject_100mhz_connector_hdmi_funcs);
KUNIT_ASSERT_NOT_NULL(test, priv);
conn = &priv->connector;
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 08/23] drm/tests: hdmi: Add macro to simplify EDID setup
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (6 preceding siblings ...)
2025-04-25 10:26 ` [PATCH v4 07/23] drm/tests: hdmi: Replace '[_]MHz' with 'mhz' Cristian Ciocaltea
@ 2025-04-25 10:26 ` Cristian Ciocaltea
2025-04-28 9:52 ` Jani Nikula
2025-05-13 13:45 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 09/23] drm/tests: hdmi: Replace open coded " Cristian Ciocaltea
` (14 subsequent siblings)
22 siblings, 2 replies; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:26 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Factor out the HDMI connector initialization from
drm_kunit_helper_connector_hdmi_init_funcs() into a common
__connector_hdmi_init() function, while extending its functionality to
allow setting custom (i.e. non-default) EDID data.
Introduce a macro as a wrapper over the new helper to allow dropping the
open coded EDID setup from all test cases.
The actual conversion will be handled separately; for now just apply it
to drm_kunit_helper_connector_hdmi_init() helper.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 46 +++++++++++++---------
1 file changed, 28 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index c8dc6fa0f925e35e9903a18bac7f78f9d8165960..36734639d19a3f279abc4631eb19d5c2b20ca315 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -140,10 +140,11 @@ static const struct drm_connector_funcs dummy_connector_funcs = {
static
struct drm_atomic_helper_connector_hdmi_priv *
-drm_kunit_helper_connector_hdmi_init_funcs(struct kunit *test,
- unsigned int formats,
- unsigned int max_bpc,
- const struct drm_connector_hdmi_funcs *hdmi_funcs)
+__connector_hdmi_init(struct kunit *test,
+ unsigned int formats,
+ unsigned int max_bpc,
+ const struct drm_connector_hdmi_funcs *hdmi_funcs,
+ const char *edid_data, size_t edid_len)
{
struct drm_atomic_helper_connector_hdmi_priv *priv;
struct drm_connector *conn;
@@ -197,29 +198,38 @@ drm_kunit_helper_connector_hdmi_init_funcs(struct kunit *test,
drm_mode_config_reset(drm);
+ if (edid_data && edid_len) {
+ ret = set_connector_edid(test, &priv->connector, edid_data, edid_len);
+ KUNIT_ASSERT_GT(test, ret, 0);
+ }
+
return priv;
}
+static
+struct drm_atomic_helper_connector_hdmi_priv *
+drm_kunit_helper_connector_hdmi_init_funcs(struct kunit *test,
+ unsigned int formats,
+ unsigned int max_bpc,
+ const struct drm_connector_hdmi_funcs *hdmi_funcs)
+{
+ return __connector_hdmi_init(test, formats, max_bpc, hdmi_funcs, NULL, 0);
+}
+
+#define drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, formats, max_bpc, funcs, edid) \
+ __connector_hdmi_init(test, formats, max_bpc, funcs, edid, ARRAY_SIZE(edid))
+
static
struct drm_atomic_helper_connector_hdmi_priv *
drm_kunit_helper_connector_hdmi_init(struct kunit *test,
unsigned int formats,
unsigned int max_bpc)
{
- struct drm_atomic_helper_connector_hdmi_priv *priv;
- int ret;
-
- priv = drm_kunit_helper_connector_hdmi_init_funcs(test,
- formats, max_bpc,
- &dummy_connector_hdmi_funcs);
- KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv);
-
- ret = set_connector_edid(test, &priv->connector,
- test_edid_hdmi_1080p_rgb_max_200mhz,
- ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz));
- KUNIT_ASSERT_GT(test, ret, 0);
-
- return priv;
+ return drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ formats,
+ max_bpc,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_max_200mhz);
}
/*
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 09/23] drm/tests: hdmi: Replace open coded EDID setup
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (7 preceding siblings ...)
2025-04-25 10:26 ` [PATCH v4 08/23] drm/tests: hdmi: Add macro to simplify EDID setup Cristian Ciocaltea
@ 2025-04-25 10:27 ` Cristian Ciocaltea
2025-05-15 15:35 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 10/23] drm/tests: hdmi: Drop unused drm_kunit_helper_connector_hdmi_init_funcs() Cristian Ciocaltea
` (13 subsequent siblings)
22 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:27 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Make use of the recently introduced macros to reduce boilerplate code
around EDID setup. This also helps dropping the redundant calls to
set_connector_edid().
No functional changes intended.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 234 ++++++++-------------
1 file changed, 92 insertions(+), 142 deletions(-)
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index 36734639d19a3f279abc4631eb19d5c2b20ca315..921afb732797f1530d3857ea6d951c5df79d42b4 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -762,19 +762,16 @@ static void drm_test_check_output_bpc_crtc_mode_changed(struct kunit *test)
struct drm_crtc *crtc;
int ret;
- priv = drm_kunit_helper_connector_hdmi_init(test,
- BIT(HDMI_COLORSPACE_RGB),
- 10);
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB),
+ 10,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz);
KUNIT_ASSERT_NOT_NULL(test, priv);
drm = &priv->drm;
crtc = priv->crtc;
conn = &priv->connector;
- ret = set_connector_edid(test, conn,
- test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,
- ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz));
- KUNIT_ASSERT_GT(test, ret, 0);
-
preferred = find_preferred_mode(conn);
KUNIT_ASSERT_NOT_NULL(test, preferred);
@@ -841,19 +838,16 @@ static void drm_test_check_output_bpc_crtc_mode_not_changed(struct kunit *test)
struct drm_crtc *crtc;
int ret;
- priv = drm_kunit_helper_connector_hdmi_init(test,
- BIT(HDMI_COLORSPACE_RGB),
- 10);
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB),
+ 10,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz);
KUNIT_ASSERT_NOT_NULL(test, priv);
drm = &priv->drm;
crtc = priv->crtc;
conn = &priv->connector;
- ret = set_connector_edid(test, conn,
- test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,
- ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz));
- KUNIT_ASSERT_GT(test, ret, 0);
-
preferred = find_preferred_mode(conn);
KUNIT_ASSERT_NOT_NULL(test, preferred);
@@ -915,21 +909,18 @@ static void drm_test_check_output_bpc_dvi(struct kunit *test)
struct drm_crtc *crtc;
int ret;
- priv = drm_kunit_helper_connector_hdmi_init(test,
- BIT(HDMI_COLORSPACE_RGB) |
- BIT(HDMI_COLORSPACE_YUV422) |
- BIT(HDMI_COLORSPACE_YUV444),
- 12);
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB) |
+ BIT(HDMI_COLORSPACE_YUV422) |
+ BIT(HDMI_COLORSPACE_YUV444),
+ 12,
+ &dummy_connector_hdmi_funcs,
+ test_edid_dvi_1080p);
KUNIT_ASSERT_NOT_NULL(test, priv);
drm = &priv->drm;
crtc = priv->crtc;
conn = &priv->connector;
- ret = set_connector_edid(test, conn,
- test_edid_dvi_1080p,
- ARRAY_SIZE(test_edid_dvi_1080p));
- KUNIT_ASSERT_GT(test, ret, 0);
-
info = &conn->display_info;
KUNIT_ASSERT_FALSE(test, info->is_hdmi);
@@ -969,19 +960,16 @@ static void drm_test_check_tmds_char_rate_rgb_8bpc(struct kunit *test)
struct drm_crtc *crtc;
int ret;
- priv = drm_kunit_helper_connector_hdmi_init(test,
- BIT(HDMI_COLORSPACE_RGB),
- 8);
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB),
+ 8,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_max_200mhz);
KUNIT_ASSERT_NOT_NULL(test, priv);
drm = &priv->drm;
crtc = priv->crtc;
conn = &priv->connector;
- ret = set_connector_edid(test, conn,
- test_edid_hdmi_1080p_rgb_max_200mhz,
- ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz));
- KUNIT_ASSERT_GT(test, ret, 0);
-
preferred = find_preferred_mode(conn);
KUNIT_ASSERT_NOT_NULL(test, preferred);
KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK);
@@ -1021,19 +1009,16 @@ static void drm_test_check_tmds_char_rate_rgb_10bpc(struct kunit *test)
struct drm_crtc *crtc;
int ret;
- priv = drm_kunit_helper_connector_hdmi_init(test,
- BIT(HDMI_COLORSPACE_RGB),
- 10);
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB),
+ 10,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz);
KUNIT_ASSERT_NOT_NULL(test, priv);
drm = &priv->drm;
crtc = priv->crtc;
conn = &priv->connector;
- ret = set_connector_edid(test, conn,
- test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz,
- ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz));
- KUNIT_ASSERT_GT(test, ret, 0);
-
preferred = find_preferred_mode(conn);
KUNIT_ASSERT_NOT_NULL(test, preferred);
KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK);
@@ -1073,19 +1058,16 @@ static void drm_test_check_tmds_char_rate_rgb_12bpc(struct kunit *test)
struct drm_crtc *crtc;
int ret;
- priv = drm_kunit_helper_connector_hdmi_init(test,
- BIT(HDMI_COLORSPACE_RGB),
- 12);
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB),
+ 12,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz);
KUNIT_ASSERT_NOT_NULL(test, priv);
drm = &priv->drm;
crtc = priv->crtc;
conn = &priv->connector;
- ret = set_connector_edid(test, conn,
- test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz,
- ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz));
- KUNIT_ASSERT_GT(test, ret, 0);
-
preferred = find_preferred_mode(conn);
KUNIT_ASSERT_NOT_NULL(test, preferred);
KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK);
@@ -1191,19 +1173,16 @@ static void drm_test_check_max_tmds_rate_bpc_fallback(struct kunit *test)
struct drm_crtc *crtc;
int ret;
- priv = drm_kunit_helper_connector_hdmi_init(test,
- BIT(HDMI_COLORSPACE_RGB),
- 12);
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB),
+ 12,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz);
KUNIT_ASSERT_NOT_NULL(test, priv);
drm = &priv->drm;
crtc = priv->crtc;
conn = &priv->connector;
- ret = set_connector_edid(test, conn,
- test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,
- ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz));
- KUNIT_ASSERT_GT(test, ret, 0);
-
info = &conn->display_info;
KUNIT_ASSERT_TRUE(test, info->is_hdmi);
KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0);
@@ -1263,21 +1242,18 @@ static void drm_test_check_max_tmds_rate_format_fallback(struct kunit *test)
struct drm_crtc *crtc;
int ret;
- priv = drm_kunit_helper_connector_hdmi_init(test,
- BIT(HDMI_COLORSPACE_RGB) |
- BIT(HDMI_COLORSPACE_YUV422) |
- BIT(HDMI_COLORSPACE_YUV444),
- 12);
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB) |
+ BIT(HDMI_COLORSPACE_YUV422) |
+ BIT(HDMI_COLORSPACE_YUV444),
+ 12,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz);
KUNIT_ASSERT_NOT_NULL(test, priv);
drm = &priv->drm;
crtc = priv->crtc;
conn = &priv->connector;
- ret = set_connector_edid(test, conn,
- test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,
- ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz));
- KUNIT_ASSERT_GT(test, ret, 0);
-
info = &conn->display_info;
KUNIT_ASSERT_TRUE(test, info->is_hdmi);
KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0);
@@ -1331,20 +1307,17 @@ static void drm_test_check_output_bpc_format_vic_1(struct kunit *test)
struct drm_crtc *crtc;
int ret;
- priv = drm_kunit_helper_connector_hdmi_init(test,
- BIT(HDMI_COLORSPACE_RGB) |
- BIT(HDMI_COLORSPACE_YUV422) |
- BIT(HDMI_COLORSPACE_YUV444),
- 12);
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB) |
+ BIT(HDMI_COLORSPACE_YUV422) |
+ BIT(HDMI_COLORSPACE_YUV444),
+ 12,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz);
KUNIT_ASSERT_NOT_NULL(test, priv);
drm = &priv->drm;
conn = &priv->connector;
- ret = set_connector_edid(test, conn,
- test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,
- ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz));
- KUNIT_ASSERT_GT(test, ret, 0);
-
info = &conn->display_info;
KUNIT_ASSERT_TRUE(test, info->is_hdmi);
KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0);
@@ -1398,19 +1371,16 @@ static void drm_test_check_output_bpc_format_driver_rgb_only(struct kunit *test)
struct drm_crtc *crtc;
int ret;
- priv = drm_kunit_helper_connector_hdmi_init(test,
- BIT(HDMI_COLORSPACE_RGB),
- 12);
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB),
+ 12,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz);
KUNIT_ASSERT_NOT_NULL(test, priv);
drm = &priv->drm;
crtc = priv->crtc;
conn = &priv->connector;
- ret = set_connector_edid(test, conn,
- test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,
- ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz));
- KUNIT_ASSERT_GT(test, ret, 0);
-
info = &conn->display_info;
KUNIT_ASSERT_TRUE(test, info->is_hdmi);
KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0);
@@ -1468,21 +1438,18 @@ static void drm_test_check_output_bpc_format_display_rgb_only(struct kunit *test
struct drm_crtc *crtc;
int ret;
- priv = drm_kunit_helper_connector_hdmi_init(test,
- BIT(HDMI_COLORSPACE_RGB) |
- BIT(HDMI_COLORSPACE_YUV422) |
- BIT(HDMI_COLORSPACE_YUV444),
- 12);
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB) |
+ BIT(HDMI_COLORSPACE_YUV422) |
+ BIT(HDMI_COLORSPACE_YUV444),
+ 12,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_max_200mhz);
KUNIT_ASSERT_NOT_NULL(test, priv);
drm = &priv->drm;
crtc = priv->crtc;
conn = &priv->connector;
- ret = set_connector_edid(test, conn,
- test_edid_hdmi_1080p_rgb_max_200mhz,
- ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz));
- KUNIT_ASSERT_GT(test, ret, 0);
-
info = &conn->display_info;
KUNIT_ASSERT_TRUE(test, info->is_hdmi);
KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0);
@@ -1541,19 +1508,16 @@ static void drm_test_check_output_bpc_format_driver_8bpc_only(struct kunit *test
struct drm_crtc *crtc;
int ret;
- priv = drm_kunit_helper_connector_hdmi_init(test,
- BIT(HDMI_COLORSPACE_RGB),
- 8);
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB),
+ 8,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz);
KUNIT_ASSERT_NOT_NULL(test, priv);
drm = &priv->drm;
crtc = priv->crtc;
conn = &priv->connector;
- ret = set_connector_edid(test, conn,
- test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz,
- ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz));
- KUNIT_ASSERT_GT(test, ret, 0);
-
info = &conn->display_info;
KUNIT_ASSERT_TRUE(test, info->is_hdmi);
KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0);
@@ -1604,21 +1568,18 @@ static void drm_test_check_output_bpc_format_display_8bpc_only(struct kunit *tes
struct drm_crtc *crtc;
int ret;
- priv = drm_kunit_helper_connector_hdmi_init(test,
- BIT(HDMI_COLORSPACE_RGB) |
- BIT(HDMI_COLORSPACE_YUV422) |
- BIT(HDMI_COLORSPACE_YUV444),
- 12);
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB) |
+ BIT(HDMI_COLORSPACE_YUV422) |
+ BIT(HDMI_COLORSPACE_YUV444),
+ 12,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_max_340mhz);
KUNIT_ASSERT_NOT_NULL(test, priv);
drm = &priv->drm;
crtc = priv->crtc;
conn = &priv->connector;
- ret = set_connector_edid(test, conn,
- test_edid_hdmi_1080p_rgb_max_340mhz,
- ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_340mhz));
- KUNIT_ASSERT_GT(test, ret, 0);
-
info = &conn->display_info;
KUNIT_ASSERT_TRUE(test, info->is_hdmi);
KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0);
@@ -1937,28 +1898,20 @@ static void drm_test_check_mode_valid(struct kunit *test)
static void drm_test_check_mode_valid_reject_rate(struct kunit *test)
{
struct drm_atomic_helper_connector_hdmi_priv *priv;
- struct drm_connector *conn;
struct drm_display_mode *preferred;
- int ret;
- priv = drm_kunit_helper_connector_hdmi_init_funcs(test,
- BIT(HDMI_COLORSPACE_RGB),
- 8,
- &reject_100mhz_connector_hdmi_funcs);
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB),
+ 8,
+ &reject_100mhz_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_max_200mhz);
KUNIT_ASSERT_NOT_NULL(test, priv);
- conn = &priv->connector;
-
- ret = set_connector_edid(test, conn,
- test_edid_hdmi_1080p_rgb_max_200mhz,
- ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz));
- KUNIT_ASSERT_GT(test, ret, 0);
-
/*
* Unlike the drm_test_check_mode_valid() here 1080p is rejected, but
* 480p is allowed.
*/
- preferred = find_preferred_mode(conn);
+ preferred = find_preferred_mode(&priv->connector);
KUNIT_ASSERT_NOT_NULL(test, preferred);
KUNIT_EXPECT_EQ(test, preferred->hdisplay, 640);
KUNIT_EXPECT_EQ(test, preferred->vdisplay, 480);
@@ -1976,12 +1929,14 @@ static void drm_test_check_mode_valid_reject(struct kunit *test)
struct drm_atomic_helper_connector_hdmi_priv *priv;
struct drm_connector *conn;
struct drm_display_mode *preferred;
+ unsigned char no_edid[] = {};
int ret;
- priv = drm_kunit_helper_connector_hdmi_init_funcs(test,
- BIT(HDMI_COLORSPACE_RGB),
- 8,
- &reject_connector_hdmi_funcs);
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB),
+ 8,
+ &reject_connector_hdmi_funcs,
+ no_edid);
KUNIT_ASSERT_NOT_NULL(test, priv);
conn = &priv->connector;
@@ -2006,20 +1961,15 @@ static void drm_test_check_mode_valid_reject_max_clock(struct kunit *test)
struct drm_atomic_helper_connector_hdmi_priv *priv;
struct drm_connector *conn;
struct drm_display_mode *preferred;
- int ret;
- priv = drm_kunit_helper_connector_hdmi_init(test,
- BIT(HDMI_COLORSPACE_RGB),
- 8);
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB),
+ 8,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_max_100mhz);
KUNIT_ASSERT_NOT_NULL(test, priv);
conn = &priv->connector;
-
- ret = set_connector_edid(test, conn,
- test_edid_hdmi_1080p_rgb_max_100mhz,
- ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_100mhz));
- KUNIT_ASSERT_GT(test, ret, 0);
-
KUNIT_ASSERT_EQ(test, conn->display_info.max_tmds_clock, 100 * 1000);
preferred = find_preferred_mode(conn);
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 10/23] drm/tests: hdmi: Drop unused drm_kunit_helper_connector_hdmi_init_funcs()
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (8 preceding siblings ...)
2025-04-25 10:27 ` [PATCH v4 09/23] drm/tests: hdmi: Replace open coded " Cristian Ciocaltea
@ 2025-04-25 10:27 ` Cristian Ciocaltea
2025-05-16 13:06 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 11/23] drm/tests: hdmi: Setup ycbcr_420_allowed before initializing connector Cristian Ciocaltea
` (12 subsequent siblings)
22 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:27 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
After updating the code to make use of the new EDID setup helper,
drm_kunit_helper_connector_hdmi_init_funcs() became unused, hence drop
it.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index 921afb732797f1530d3857ea6d951c5df79d42b4..6b4000aea2f2eff373c803d95c3304281c879176 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -206,16 +206,6 @@ __connector_hdmi_init(struct kunit *test,
return priv;
}
-static
-struct drm_atomic_helper_connector_hdmi_priv *
-drm_kunit_helper_connector_hdmi_init_funcs(struct kunit *test,
- unsigned int formats,
- unsigned int max_bpc,
- const struct drm_connector_hdmi_funcs *hdmi_funcs)
-{
- return __connector_hdmi_init(test, formats, max_bpc, hdmi_funcs, NULL, 0);
-}
-
#define drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, formats, max_bpc, funcs, edid) \
__connector_hdmi_init(test, formats, max_bpc, funcs, edid, ARRAY_SIZE(edid))
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 11/23] drm/tests: hdmi: Setup ycbcr_420_allowed before initializing connector
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (9 preceding siblings ...)
2025-04-25 10:27 ` [PATCH v4 10/23] drm/tests: hdmi: Drop unused drm_kunit_helper_connector_hdmi_init_funcs() Cristian Ciocaltea
@ 2025-04-25 10:27 ` Cristian Ciocaltea
2025-04-25 10:27 ` [PATCH v4 12/23] drm/tests: helpers: Add a (re)try helper variant to enable CRTC connector Cristian Ciocaltea
` (11 subsequent siblings)
22 siblings, 0 replies; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:27 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Initializing HDMI connector via drmm_connector_hdmi_init() requires its
->ycbcr_420_allowed flag to be adjusted according to the supported
formats passed as function argument, prior to the actual invocation.
In order to allow providing test coverage for YUV420 modes, ensure the
flag is properly setup.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index 6b4000aea2f2eff373c803d95c3304281c879176..323863a24a498d220f9fb73081abfbb00575c370 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -183,6 +183,8 @@ __connector_hdmi_init(struct kunit *test,
enc->possible_crtcs = drm_crtc_mask(priv->crtc);
conn = &priv->connector;
+ conn->ycbcr_420_allowed = !!(formats & BIT(HDMI_COLORSPACE_YUV420));
+
ret = drmm_connector_hdmi_init(drm, conn,
"Vendor", "Product",
&dummy_connector_funcs,
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 12/23] drm/tests: helpers: Add a (re)try helper variant to enable CRTC connector
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (10 preceding siblings ...)
2025-04-25 10:27 ` [PATCH v4 11/23] drm/tests: hdmi: Setup ycbcr_420_allowed before initializing connector Cristian Ciocaltea
@ 2025-04-25 10:27 ` Cristian Ciocaltea
2025-05-16 13:15 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 13/23] drm/tests: hdmi: Switch to drm_kunit_helper_try_enable_crtc_connector() Cristian Ciocaltea
` (10 subsequent siblings)
22 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:27 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Provide a wrapper over drm_kunit_helper_enable_crtc_connector() to
automatically handle EDEADLK.
This is going to help improve the error handling in a bunch of test
cases without open coding the restart of the atomic sequence.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/tests/drm_kunit_helpers.c | 39 +++++++++++++++++++++++++++++++
include/drm/drm_kunit_helpers.h | 7 ++++++
2 files changed, 46 insertions(+)
diff --git a/drivers/gpu/drm/tests/drm_kunit_helpers.c b/drivers/gpu/drm/tests/drm_kunit_helpers.c
index 5f7257840d8ef0aeabe5f00802f5037ed652ae66..4e1174c50b1f2b6358eb740cd73c6d86e53d0df9 100644
--- a/drivers/gpu/drm/tests/drm_kunit_helpers.c
+++ b/drivers/gpu/drm/tests/drm_kunit_helpers.c
@@ -332,6 +332,45 @@ int drm_kunit_helper_enable_crtc_connector(struct kunit *test,
}
EXPORT_SYMBOL_GPL(drm_kunit_helper_enable_crtc_connector);
+/**
+ * drm_kunit_helper_try_enable_crtc_connector - (Re)tries to enable a CRTC -> Connector output
+ * @test: The test context object
+ * @drm: The device to alloc the plane for
+ * @crtc: The CRTC to enable
+ * @connector: The Connector to enable
+ * @mode: The display mode to configure the CRTC with
+ * @ctx: Locking context
+ *
+ * This function is a wrapper over @drm_kunit_helper_enable_crtc_connector
+ * to automatically handle EDEADLK and (re)try to enable the route from
+ * @crtc to @connector, with the given @mode.
+ *
+ * Returns:
+ *
+ * A pointer to the new CRTC, or an ERR_PTR() otherwise.
+ */
+int drm_kunit_helper_try_enable_crtc_connector(struct kunit *test,
+ struct drm_device *drm,
+ struct drm_crtc *crtc,
+ struct drm_connector *connector,
+ const struct drm_display_mode *mode,
+ struct drm_modeset_acquire_ctx *ctx)
+{
+ int ret;
+
+retry_enable:
+ ret = drm_kunit_helper_enable_crtc_connector(test, drm, crtc, connector,
+ mode, ctx);
+ if (ret == -EDEADLK) {
+ ret = drm_modeset_backoff(ctx);
+ if (!ret)
+ goto retry_enable;
+ }
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(drm_kunit_helper_try_enable_crtc_connector);
+
static void kunit_action_drm_mode_destroy(void *ptr)
{
struct drm_display_mode *mode = ptr;
diff --git a/include/drm/drm_kunit_helpers.h b/include/drm/drm_kunit_helpers.h
index 4948379237e96163dfda0d2f180c0c564e7d110e..bc6cd2fcc3174fb0996d189d9f6f4d32cf013731 100644
--- a/include/drm/drm_kunit_helpers.h
+++ b/include/drm/drm_kunit_helpers.h
@@ -126,6 +126,13 @@ int drm_kunit_helper_enable_crtc_connector(struct kunit *test,
const struct drm_display_mode *mode,
struct drm_modeset_acquire_ctx *ctx);
+int drm_kunit_helper_try_enable_crtc_connector(struct kunit *test,
+ struct drm_device *drm,
+ struct drm_crtc *crtc,
+ struct drm_connector *connector,
+ const struct drm_display_mode *mode,
+ struct drm_modeset_acquire_ctx *ctx);
+
int drm_kunit_add_mode_destroy_action(struct kunit *test,
struct drm_display_mode *mode);
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 13/23] drm/tests: hdmi: Switch to drm_kunit_helper_try_enable_crtc_connector()
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (11 preceding siblings ...)
2025-04-25 10:27 ` [PATCH v4 12/23] drm/tests: helpers: Add a (re)try helper variant to enable CRTC connector Cristian Ciocaltea
@ 2025-04-25 10:27 ` Cristian Ciocaltea
2025-04-25 10:27 ` [PATCH v4 14/23] drm/tests: hdmi: Add macro to support EDEADLK handling Cristian Ciocaltea
` (9 subsequent siblings)
22 siblings, 0 replies; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:27 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Enable automatic handling of EDEADLK by switching from
drm_kunit_helper_enable_crtc_connector() to
drm_kunit_helper_try_enable_crtc_connector().
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 180 ++++++++++-----------
1 file changed, 88 insertions(+), 92 deletions(-)
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index 323863a24a498d220f9fb73081abfbb00575c370..c8969ee6518954ab4496d3a4398f428bf4104a36 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -257,10 +257,10 @@ static void drm_test_check_broadcast_rgb_crtc_mode_changed(struct kunit *test)
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_ASSERT_EQ(test, ret, 0);
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
@@ -326,10 +326,10 @@ static void drm_test_check_broadcast_rgb_crtc_mode_not_changed(struct kunit *tes
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_ASSERT_EQ(test, ret, 0);
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
@@ -397,10 +397,10 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode(struct kunit *test)
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_ASSERT_EQ(test, ret, 0);
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
@@ -457,10 +457,9 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode_vic_1(struct kunit *test)
KUNIT_ASSERT_NOT_NULL(test, mode);
crtc = priv->crtc;
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- mode,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ mode, &ctx);
KUNIT_ASSERT_EQ(test, ret, 0);
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
@@ -518,10 +517,10 @@ static void drm_test_check_broadcast_rgb_full_cea_mode(struct kunit *test)
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_ASSERT_EQ(test, ret, 0);
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
@@ -580,10 +579,9 @@ static void drm_test_check_broadcast_rgb_full_cea_mode_vic_1(struct kunit *test)
KUNIT_ASSERT_NOT_NULL(test, mode);
crtc = priv->crtc;
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- mode,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ mode, &ctx);
KUNIT_ASSERT_EQ(test, ret, 0);
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
@@ -643,10 +641,10 @@ static void drm_test_check_broadcast_rgb_limited_cea_mode(struct kunit *test)
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_ASSERT_EQ(test, ret, 0);
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
@@ -705,10 +703,9 @@ static void drm_test_check_broadcast_rgb_limited_cea_mode_vic_1(struct kunit *te
KUNIT_ASSERT_NOT_NULL(test, mode);
crtc = priv->crtc;
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- mode,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ mode, &ctx);
KUNIT_ASSERT_EQ(test, ret, 0);
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
@@ -769,10 +766,10 @@ static void drm_test_check_output_bpc_crtc_mode_changed(struct kunit *test)
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_ASSERT_EQ(test, ret, 0);
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
@@ -845,10 +842,10 @@ static void drm_test_check_output_bpc_crtc_mode_not_changed(struct kunit *test)
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_ASSERT_EQ(test, ret, 0);
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
@@ -921,10 +918,10 @@ static void drm_test_check_output_bpc_dvi(struct kunit *test)
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_ASSERT_EQ(test, ret, 0);
conn_state = conn->state;
@@ -968,10 +965,10 @@ static void drm_test_check_tmds_char_rate_rgb_8bpc(struct kunit *test)
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_ASSERT_EQ(test, ret, 0);
conn_state = conn->state;
@@ -1017,10 +1014,10 @@ static void drm_test_check_tmds_char_rate_rgb_10bpc(struct kunit *test)
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_ASSERT_EQ(test, ret, 0);
conn_state = conn->state;
@@ -1066,10 +1063,10 @@ static void drm_test_check_tmds_char_rate_rgb_12bpc(struct kunit *test)
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_ASSERT_EQ(test, ret, 0);
conn_state = conn->state;
@@ -1117,10 +1114,10 @@ static void drm_test_check_hdmi_funcs_reject_rate(struct kunit *test)
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_ASSERT_EQ(test, ret, 0);
/* You shouldn't be doing that at home. */
@@ -1191,10 +1188,10 @@ static void drm_test_check_max_tmds_rate_bpc_fallback(struct kunit *test)
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_EXPECT_EQ(test, ret, 0);
conn_state = conn->state;
@@ -1265,10 +1262,10 @@ static void drm_test_check_max_tmds_rate_format_fallback(struct kunit *test)
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_EXPECT_EQ(test, ret, 0);
conn_state = conn->state;
@@ -1330,10 +1327,9 @@ static void drm_test_check_output_bpc_format_vic_1(struct kunit *test)
drm_modeset_acquire_init(&ctx, 0);
crtc = priv->crtc;
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- mode,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ mode, &ctx);
KUNIT_EXPECT_EQ(test, ret, 0);
conn_state = conn->state;
@@ -1397,10 +1393,10 @@ static void drm_test_check_output_bpc_format_driver_rgb_only(struct kunit *test)
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_EXPECT_EQ(test, ret, 0);
conn_state = conn->state;
@@ -1466,10 +1462,10 @@ static void drm_test_check_output_bpc_format_display_rgb_only(struct kunit *test
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_EXPECT_EQ(test, ret, 0);
conn_state = conn->state;
@@ -1526,10 +1522,10 @@ static void drm_test_check_output_bpc_format_driver_8bpc_only(struct kunit *test
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_EXPECT_EQ(test, ret, 0);
conn_state = conn->state;
@@ -1588,10 +1584,10 @@ static void drm_test_check_output_bpc_format_display_8bpc_only(struct kunit *tes
drm_modeset_acquire_init(&ctx, 0);
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_EXPECT_EQ(test, ret, 0);
conn_state = conn->state;
@@ -1631,10 +1627,10 @@ static void drm_test_check_disable_connector(struct kunit *test)
drm = &priv->drm;
crtc = priv->crtc;
- ret = drm_kunit_helper_enable_crtc_connector(test, drm,
- crtc, conn,
- preferred,
- &ctx);
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
KUNIT_ASSERT_EQ(test, ret, 0);
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 14/23] drm/tests: hdmi: Add macro to support EDEADLK handling
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (12 preceding siblings ...)
2025-04-25 10:27 ` [PATCH v4 13/23] drm/tests: hdmi: Switch to drm_kunit_helper_try_enable_crtc_connector() Cristian Ciocaltea
@ 2025-04-25 10:27 ` Cristian Ciocaltea
2025-05-19 7:22 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 15/23] drm/tests: hdmi: Restart atomic sequence on EDEADLK Cristian Ciocaltea
` (8 subsequent siblings)
22 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:27 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
In preparation to improve error handling throughout all test cases,
introduce a macro to check for EDEADLK and automate the restart of the
atomic sequence.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index c8969ee6518954ab4496d3a4398f428bf4104a36..c8bb131d63ea6d0c9e166c8d9ba5e403118cd9f1 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -224,6 +224,16 @@ drm_kunit_helper_connector_hdmi_init(struct kunit *test,
test_edid_hdmi_1080p_rgb_max_200mhz);
}
+#define drm_kunit_atomic_restart_on_deadlock(ret, state, ctx, start) do { \
+ if (ret == -EDEADLK) { \
+ if (state) \
+ drm_atomic_state_clear(state); \
+ ret = drm_modeset_backoff(ctx); \
+ if (!ret) \
+ goto start; \
+ } \
+} while (0)
+
/*
* Test that if we change the RGB quantization property to a different
* value, we trigger a mode change on the connector's CRTC, which will
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 15/23] drm/tests: hdmi: Restart atomic sequence on EDEADLK
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (13 preceding siblings ...)
2025-04-25 10:27 ` [PATCH v4 14/23] drm/tests: hdmi: Add macro to support EDEADLK handling Cristian Ciocaltea
@ 2025-04-25 10:27 ` Cristian Ciocaltea
2025-04-25 10:27 ` [PATCH v4 16/23] drm/tests: hdmi: Switch to drm_atomic_get_new_connector_state() where possible Cristian Ciocaltea
` (7 subsequent siblings)
22 siblings, 0 replies; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:27 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Make use of the newly introduced drm_kunit_atomic_restart_on_deadlock()
helper to handle EDEADLK errors throughout all test cases.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 38 ++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index c8bb131d63ea6d0c9e166c8d9ba5e403118cd9f1..8c795eeb1090b50993c1907a9fc5bb72baa556e1 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -276,7 +276,9 @@ static void drm_test_check_broadcast_rgb_crtc_mode_changed(struct kunit *test)
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+retry:
new_conn_state = drm_atomic_get_connector_state(state, conn);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state);
old_conn_state = drm_atomic_get_old_connector_state(state, conn);
@@ -289,6 +291,7 @@ static void drm_test_check_broadcast_rgb_crtc_mode_changed(struct kunit *test)
new_conn_state->hdmi.broadcast_rgb);
ret = drm_atomic_check_only(state);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_EQ(test, ret, 0);
new_conn_state = drm_atomic_get_new_connector_state(state, conn);
@@ -345,7 +348,9 @@ static void drm_test_check_broadcast_rgb_crtc_mode_not_changed(struct kunit *tes
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+retry:
new_conn_state = drm_atomic_get_connector_state(state, conn);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state);
old_conn_state = drm_atomic_get_old_connector_state(state, conn);
@@ -354,6 +359,7 @@ static void drm_test_check_broadcast_rgb_crtc_mode_not_changed(struct kunit *tes
new_conn_state->hdmi.broadcast_rgb = old_conn_state->hdmi.broadcast_rgb;
ret = drm_atomic_check_only(state);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_EQ(test, ret, 0);
old_conn_state = drm_atomic_get_old_connector_state(state, conn);
@@ -416,7 +422,9 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode(struct kunit *test)
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+retry:
conn_state = drm_atomic_get_connector_state(state, conn);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
KUNIT_ASSERT_EQ(test,
@@ -424,6 +432,7 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode(struct kunit *test)
DRM_HDMI_BROADCAST_RGB_AUTO);
ret = drm_atomic_check_only(state);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_EQ(test, ret, 0);
conn_state = drm_atomic_get_connector_state(state, conn);
@@ -475,7 +484,9 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode_vic_1(struct kunit *test)
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+retry:
conn_state = drm_atomic_get_connector_state(state, conn);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
KUNIT_ASSERT_EQ(test,
@@ -483,6 +494,7 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode_vic_1(struct kunit *test)
DRM_HDMI_BROADCAST_RGB_AUTO);
ret = drm_atomic_check_only(state);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_EQ(test, ret, 0);
conn_state = drm_atomic_get_connector_state(state, conn);
@@ -536,12 +548,15 @@ static void drm_test_check_broadcast_rgb_full_cea_mode(struct kunit *test)
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+retry:
conn_state = drm_atomic_get_connector_state(state, conn);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
conn_state->hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_FULL;
ret = drm_atomic_check_only(state);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_EQ(test, ret, 0);
conn_state = drm_atomic_get_connector_state(state, conn);
@@ -597,12 +612,15 @@ static void drm_test_check_broadcast_rgb_full_cea_mode_vic_1(struct kunit *test)
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+retry:
conn_state = drm_atomic_get_connector_state(state, conn);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
conn_state->hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_FULL;
ret = drm_atomic_check_only(state);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_EQ(test, ret, 0);
conn_state = drm_atomic_get_connector_state(state, conn);
@@ -660,12 +678,15 @@ static void drm_test_check_broadcast_rgb_limited_cea_mode(struct kunit *test)
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+retry:
conn_state = drm_atomic_get_connector_state(state, conn);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
conn_state->hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_LIMITED;
ret = drm_atomic_check_only(state);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_EQ(test, ret, 0);
conn_state = drm_atomic_get_connector_state(state, conn);
@@ -721,12 +742,15 @@ static void drm_test_check_broadcast_rgb_limited_cea_mode_vic_1(struct kunit *te
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+retry:
conn_state = drm_atomic_get_connector_state(state, conn);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
conn_state->hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_LIMITED;
ret = drm_atomic_check_only(state);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_EQ(test, ret, 0);
conn_state = drm_atomic_get_connector_state(state, conn);
@@ -785,7 +809,9 @@ static void drm_test_check_output_bpc_crtc_mode_changed(struct kunit *test)
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+retry:
new_conn_state = drm_atomic_get_connector_state(state, conn);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state);
old_conn_state = drm_atomic_get_old_connector_state(state, conn);
@@ -798,6 +824,7 @@ static void drm_test_check_output_bpc_crtc_mode_changed(struct kunit *test)
new_conn_state->max_requested_bpc);
ret = drm_atomic_check_only(state);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_EQ(test, ret, 0);
old_conn_state = drm_atomic_get_old_connector_state(state, conn);
@@ -861,7 +888,9 @@ static void drm_test_check_output_bpc_crtc_mode_not_changed(struct kunit *test)
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+retry:
new_conn_state = drm_atomic_get_connector_state(state, conn);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state);
old_conn_state = drm_atomic_get_old_connector_state(state, conn);
@@ -872,6 +901,7 @@ static void drm_test_check_output_bpc_crtc_mode_not_changed(struct kunit *test)
old_conn_state->hdmi.output_bpc);
ret = drm_atomic_check_only(state);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_EQ(test, ret, 0);
old_conn_state = drm_atomic_get_old_connector_state(state, conn);
@@ -1136,12 +1166,15 @@ static void drm_test_check_hdmi_funcs_reject_rate(struct kunit *test)
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+retry:
crtc_state = drm_atomic_get_crtc_state(state, crtc);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
crtc_state->connectors_changed = true;
ret = drm_atomic_check_only(state);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_EXPECT_LT(test, ret, 0);
drm_modeset_drop_locks(&ctx);
@@ -1646,7 +1679,9 @@ static void drm_test_check_disable_connector(struct kunit *test)
state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+retry:
crtc_state = drm_atomic_get_crtc_state(state, crtc);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
crtc_state->active = false;
@@ -1654,12 +1689,15 @@ static void drm_test_check_disable_connector(struct kunit *test)
KUNIT_EXPECT_EQ(test, ret, 0);
conn_state = drm_atomic_get_connector_state(state, conn);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_EXPECT_EQ(test, ret, 0);
ret = drm_atomic_check_only(state);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_EQ(test, ret, 0);
drm_modeset_drop_locks(&ctx);
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 16/23] drm/tests: hdmi: Switch to drm_atomic_get_new_connector_state() where possible
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (14 preceding siblings ...)
2025-04-25 10:27 ` [PATCH v4 15/23] drm/tests: hdmi: Restart atomic sequence on EDEADLK Cristian Ciocaltea
@ 2025-04-25 10:27 ` Cristian Ciocaltea
2025-05-19 7:23 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 17/23] drm/tests: hdmi: Provide EDID supporting 4K@30Hz with YUV420 only Cristian Ciocaltea
` (6 subsequent siblings)
22 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:27 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Replace the calls to drm_atomic_get_connector_state() with
drm_atomic_get_new_connector_state() for cases which do not require
allocating the connector state, e.g. after drm_atomic_check_only() when
the intent is to only read the new connector state.
The rational is to avoid the need to handle the potential EDEADLK error
returned by the former helper, which would require restarting the entire
atomic sequence.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index 8c795eeb1090b50993c1907a9fc5bb72baa556e1..ae58d1f747e84f99e72624396af1f51fe498f931 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -435,7 +435,7 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode(struct kunit *test)
drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_EQ(test, ret, 0);
- conn_state = drm_atomic_get_connector_state(state, conn);
+ conn_state = drm_atomic_get_new_connector_state(state, conn);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
KUNIT_EXPECT_TRUE(test, conn_state->hdmi.is_limited_range);
@@ -497,7 +497,7 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode_vic_1(struct kunit *test)
drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_EQ(test, ret, 0);
- conn_state = drm_atomic_get_connector_state(state, conn);
+ conn_state = drm_atomic_get_new_connector_state(state, conn);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
KUNIT_EXPECT_FALSE(test, conn_state->hdmi.is_limited_range);
@@ -559,7 +559,7 @@ static void drm_test_check_broadcast_rgb_full_cea_mode(struct kunit *test)
drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_EQ(test, ret, 0);
- conn_state = drm_atomic_get_connector_state(state, conn);
+ conn_state = drm_atomic_get_new_connector_state(state, conn);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
KUNIT_ASSERT_EQ(test,
@@ -623,7 +623,7 @@ static void drm_test_check_broadcast_rgb_full_cea_mode_vic_1(struct kunit *test)
drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_EQ(test, ret, 0);
- conn_state = drm_atomic_get_connector_state(state, conn);
+ conn_state = drm_atomic_get_new_connector_state(state, conn);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
KUNIT_ASSERT_EQ(test,
@@ -689,7 +689,7 @@ static void drm_test_check_broadcast_rgb_limited_cea_mode(struct kunit *test)
drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_EQ(test, ret, 0);
- conn_state = drm_atomic_get_connector_state(state, conn);
+ conn_state = drm_atomic_get_new_connector_state(state, conn);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
KUNIT_ASSERT_EQ(test,
@@ -753,7 +753,7 @@ static void drm_test_check_broadcast_rgb_limited_cea_mode_vic_1(struct kunit *te
drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
KUNIT_ASSERT_EQ(test, ret, 0);
- conn_state = drm_atomic_get_connector_state(state, conn);
+ conn_state = drm_atomic_get_new_connector_state(state, conn);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
KUNIT_ASSERT_EQ(test,
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 17/23] drm/tests: hdmi: Provide EDID supporting 4K@30Hz with YUV420 only
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (15 preceding siblings ...)
2025-04-25 10:27 ` [PATCH v4 16/23] drm/tests: hdmi: Switch to drm_atomic_get_new_connector_state() where possible Cristian Ciocaltea
@ 2025-04-25 10:27 ` Cristian Ciocaltea
2025-05-19 7:57 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 18/23] drm/tests: hdmi: Add limited range tests for YUV420 mode Cristian Ciocaltea
` (5 subsequent siblings)
22 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:27 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Create a test EDID advertising the following capabilities:
Max resolution:
- 1920x1080@60Hz with RGB, YUV444, YUV422
- 3840x2160@30Hz with YUV420 only
Max BPC: 16 for all modes
Max TMDS clock: 200 MHz
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/tests/drm_kunit_edid.h | 118 +++++++++++++++++++++++++++++++++
1 file changed, 118 insertions(+)
diff --git a/drivers/gpu/drm/tests/drm_kunit_edid.h b/drivers/gpu/drm/tests/drm_kunit_edid.h
index 6358397a5d7ab0bcdea1c824fc9fd382560f4b0e..027d8aa5bccd0ee101fbe7e147f0e418581e9c3d 100644
--- a/drivers/gpu/drm/tests/drm_kunit_edid.h
+++ b/drivers/gpu/drm/tests/drm_kunit_edid.h
@@ -583,4 +583,122 @@ static const unsigned char test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz[] = {
0x00, 0x00, 0x00, 0x8c
};
+/*
+ * Max resolution:
+ * - 1920x1080@60Hz with RGB, YUV444, YUV422
+ * - 3840x2160@30Hz with YUV420 only
+ * Max BPC: 16 for all modes
+ * Max TMDS clock: 200 MHz
+ *
+ * edid-decode (hex):
+ *
+ * 00 ff ff ff ff ff ff 00 31 d8 34 00 00 00 00 00
+ * ff 23 01 03 80 60 36 78 0f ee 91 a3 54 4c 99 26
+ * 0f 50 54 20 00 00 01 01 01 01 01 01 01 01 01 01
+ * 01 01 01 01 01 01 02 3a 80 18 71 38 2d 40 58 2c
+ * 45 00 c0 1c 32 00 00 1e 00 00 00 fc 00 54 65 73
+ * 74 20 45 44 49 44 0a 20 20 20 00 00 00 fd 00 18
+ * 55 18 5e 11 00 0a 20 20 20 20 20 20 00 00 00 10
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 bb
+ *
+ * 02 03 29 31 42 90 5f 6c 03 0c 00 10 00 78 28 20
+ * 00 00 01 03 6d d8 5d c4 01 28 80 07 00 00 00 00
+ * 00 00 e3 0f 00 00 e2 0e 5f 00 00 00 00 00 00 00
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ca
+ *
+ * ----------------
+ *
+ * Block 0, Base EDID:
+ * EDID Structure Version & Revision: 1.3
+ * Vendor & Product Identification:
+ * Manufacturer: LNX
+ * Model: 52
+ * Model year: 2025
+ * Basic Display Parameters & Features:
+ * Digital display
+ * Maximum image size: 96 cm x 54 cm
+ * Gamma: 2.20
+ * RGB color display
+ * Default (sRGB) color space is primary color space
+ * First detailed timing is the preferred timing
+ * Supports GTF timings within operating range
+ * Color Characteristics:
+ * Red : 0.6396, 0.3300
+ * Green: 0.2998, 0.5996
+ * Blue : 0.1503, 0.0595
+ * White: 0.3125, 0.3291
+ * Established Timings I & II:
+ * DMT 0x04: 640x480 59.940476 Hz 4:3 31.469 kHz 25.175000 MHz
+ * Standard Timings: none
+ * Detailed Timing Descriptors:
+ * DTD 1: 1920x1080 60.000000 Hz 16:9 67.500 kHz 148.500000 MHz (960 mm x 540 mm)
+ * Hfront 88 Hsync 44 Hback 148 Hpol P
+ * Vfront 4 Vsync 5 Vback 36 Vpol P
+ * Display Product Name: 'Test EDID'
+ * Display Range Limits:
+ * Monitor ranges (GTF): 24-85 Hz V, 24-94 kHz H, max dotclock 170 MHz
+ * Dummy Descriptor:
+ * Extension blocks: 1
+ * Checksum: 0xbb
+ *
+ * ----------------
+ *
+ * Block 1, CTA-861 Extension Block:
+ * Revision: 3
+ * Supports YCbCr 4:4:4
+ * Supports YCbCr 4:2:2
+ * Native detailed modes: 1
+ * Video Data Block:
+ * VIC 16: 1920x1080 60.000000 Hz 16:9 67.500 kHz 148.500000 MHz (native)
+ * VIC 95: 3840x2160 30.000000 Hz 16:9 67.500 kHz 297.000000 MHz
+ * Vendor-Specific Data Block (HDMI), OUI 00-0C-03:
+ * Source physical address: 1.0.0.0
+ * DC_48bit
+ * DC_36bit
+ * DC_30bit
+ * DC_Y444
+ * Maximum TMDS clock: 200 MHz
+ * Extended HDMI video details:
+ * Vendor-Specific Data Block (HDMI Forum), OUI C4-5D-D8:
+ * Version: 1
+ * Maximum TMDS Character Rate: 200 MHz
+ * SCDC Present
+ * Supports 16-bits/component Deep Color 4:2:0 Pixel Encoding
+ * Supports 12-bits/component Deep Color 4:2:0 Pixel Encoding
+ * Supports 10-bits/component Deep Color 4:2:0 Pixel Encoding
+ * YCbCr 4:2:0 Capability Map Data Block:
+ * Empty Capability Map
+ * YCbCr 4:2:0 Video Data Block:
+ * VIC 95: 3840x2160 30.000000 Hz 16:9 67.500 kHz 297.000000 MHz
+ * Checksum: 0xca
+ */
+static const unsigned char test_edid_hdmi_1080p_rgb_yuv_4k_yuv420_dc_max_200mhz[] = {
+ 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x31, 0xd8, 0x34, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0x23, 0x01, 0x03, 0x80, 0x60, 0x36, 0x78,
+ 0x0f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, 0x0f, 0x50, 0x54, 0x20,
+ 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3a, 0x80, 0x18, 0x71, 0x38,
+ 0x2d, 0x40, 0x58, 0x2c, 0x45, 0x00, 0xc0, 0x1c, 0x32, 0x00, 0x00, 0x1e,
+ 0x00, 0x00, 0x00, 0xfc, 0x00, 0x54, 0x65, 0x73, 0x74, 0x20, 0x45, 0x44,
+ 0x49, 0x44, 0x0a, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x18,
+ 0x55, 0x18, 0x5e, 0x11, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xbb, 0x02, 0x03, 0x29, 0x31,
+ 0x42, 0x90, 0x5f, 0x6c, 0x03, 0x0c, 0x00, 0x10, 0x00, 0x78, 0x28, 0x20,
+ 0x00, 0x00, 0x01, 0x03, 0x6d, 0xd8, 0x5d, 0xc4, 0x01, 0x28, 0x80, 0x07,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe3, 0x0f, 0x00, 0x00, 0xe2, 0x0e,
+ 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xca
+};
+
#endif // DRM_KUNIT_EDID_H_
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 18/23] drm/tests: hdmi: Add limited range tests for YUV420 mode
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (16 preceding siblings ...)
2025-04-25 10:27 ` [PATCH v4 17/23] drm/tests: hdmi: Provide EDID supporting 4K@30Hz with YUV420 only Cristian Ciocaltea
@ 2025-04-25 10:27 ` Cristian Ciocaltea
2025-05-19 7:58 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 19/23] drm/tests: hdmi: Rename max TMDS rate fallback tests Cristian Ciocaltea
` (4 subsequent siblings)
22 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:27 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Provide tests to verify that drm_atomic_helper_connector_hdmi_check()
helper behaviour when using YUV420 output format is to always set the
limited RGB quantization range to 'limited', no matter what the value of
Broadcast RGB property is.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 93 ++++++++++++++++++++--
1 file changed, 88 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index ae58d1f747e84f99e72624396af1f51fe498f931..6dae9a56bf1bccd39f6b79f6ad9f943538d0ad36 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -766,6 +766,92 @@ static void drm_test_check_broadcast_rgb_limited_cea_mode_vic_1(struct kunit *te
drm_modeset_acquire_fini(&ctx);
}
+/*
+ * Test that for an HDMI connector, with an HDMI monitor, we will
+ * get a limited RGB Quantization Range with a YUV420 mode, no
+ * matter what the value of the Broadcast RGB property is set to.
+ */
+static void drm_test_check_broadcast_rgb_cea_mode_yuv420(struct kunit *test)
+{
+ struct drm_atomic_helper_connector_hdmi_priv *priv;
+ enum drm_hdmi_broadcast_rgb broadcast_rgb;
+ struct drm_modeset_acquire_ctx ctx;
+ struct drm_connector_state *conn_state;
+ struct drm_atomic_state *state;
+ struct drm_display_mode *mode;
+ struct drm_connector *conn;
+ struct drm_device *drm;
+ struct drm_crtc *crtc;
+ int ret;
+
+ broadcast_rgb = *(enum drm_hdmi_broadcast_rgb *)test->param_value;
+
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB) |
+ BIT(HDMI_COLORSPACE_YUV420),
+ 8,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_yuv_4k_yuv420_dc_max_200mhz);
+ KUNIT_ASSERT_NOT_NULL(test, priv);
+
+ drm = &priv->drm;
+ crtc = priv->crtc;
+ conn = &priv->connector;
+ KUNIT_ASSERT_TRUE(test, conn->display_info.is_hdmi);
+
+ mode = drm_kunit_display_mode_from_cea_vic(test, drm, 95);
+ KUNIT_ASSERT_NOT_NULL(test, mode);
+
+ drm_modeset_acquire_init(&ctx, 0);
+
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ mode, &ctx);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+
+retry:
+ conn_state = drm_atomic_get_connector_state(state, conn);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
+
+ conn_state->hdmi.broadcast_rgb = broadcast_rgb;
+
+ ret = drm_atomic_check_only(state);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ conn_state = drm_atomic_get_new_connector_state(state, conn);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
+
+ KUNIT_ASSERT_EQ(test, conn_state->hdmi.broadcast_rgb, broadcast_rgb);
+ KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_YUV420);
+
+ KUNIT_EXPECT_TRUE(test, conn_state->hdmi.is_limited_range);
+
+ drm_modeset_drop_locks(&ctx);
+ drm_modeset_acquire_fini(&ctx);
+}
+
+static const enum drm_hdmi_broadcast_rgb check_broadcast_rgb_cea_mode_yuv420_tests[] = {
+ DRM_HDMI_BROADCAST_RGB_AUTO,
+ DRM_HDMI_BROADCAST_RGB_FULL,
+ DRM_HDMI_BROADCAST_RGB_LIMITED,
+};
+
+static void
+check_broadcast_rgb_cea_mode_yuv420_desc(const enum drm_hdmi_broadcast_rgb *broadcast_rgb,
+ char *desc)
+{
+ sprintf(desc, "%s", drm_hdmi_connector_get_broadcast_rgb_name(*broadcast_rgb));
+}
+
+KUNIT_ARRAY_PARAM(check_broadcast_rgb_cea_mode_yuv420,
+ check_broadcast_rgb_cea_mode_yuv420_tests,
+ check_broadcast_rgb_cea_mode_yuv420_desc);
+
/*
* Test that if we change the maximum bpc property to a different value,
* we trigger a mode change on the connector's CRTC, which will in turn
@@ -1711,11 +1797,8 @@ static struct kunit_case drm_atomic_helper_connector_hdmi_check_tests[] = {
KUNIT_CASE(drm_test_check_broadcast_rgb_full_cea_mode_vic_1),
KUNIT_CASE(drm_test_check_broadcast_rgb_limited_cea_mode),
KUNIT_CASE(drm_test_check_broadcast_rgb_limited_cea_mode_vic_1),
- /*
- * TODO: When we'll have YUV output support, we need to check
- * that the limited range is always set to limited no matter
- * what the value of Broadcast RGB is.
- */
+ KUNIT_CASE_PARAM(drm_test_check_broadcast_rgb_cea_mode_yuv420,
+ check_broadcast_rgb_cea_mode_yuv420_gen_params),
KUNIT_CASE(drm_test_check_broadcast_rgb_crtc_mode_changed),
KUNIT_CASE(drm_test_check_broadcast_rgb_crtc_mode_not_changed),
KUNIT_CASE(drm_test_check_disable_connector),
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 19/23] drm/tests: hdmi: Rename max TMDS rate fallback tests
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (17 preceding siblings ...)
2025-04-25 10:27 ` [PATCH v4 18/23] drm/tests: hdmi: Add limited range tests for YUV420 mode Cristian Ciocaltea
@ 2025-04-25 10:27 ` Cristian Ciocaltea
2025-05-19 8:38 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 20/23] drm/tests: hdmi: Provide EDID supporting 4K@30Hz with RGB/YUV Cristian Ciocaltea
` (3 subsequent siblings)
22 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:27 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
In preparation to extend the max TMDS rate fallback tests for covering
YUV420 output, update the rather generic function names
drm_test_check_max_tmds_rate_{bpc|format}_fallback() to properly
indicate the intended test cases.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index 6dae9a56bf1bccd39f6b79f6ad9f943538d0ad36..faec7aa6fd55faae2207072b67ef3d372dc1695e 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -1278,7 +1278,7 @@ static void drm_test_check_hdmi_funcs_reject_rate(struct kunit *test)
* Then we will pick the latter, and the computed TMDS character rate
* will be equal to 1.25 times the mode pixel clock.
*/
-static void drm_test_check_max_tmds_rate_bpc_fallback(struct kunit *test)
+static void drm_test_check_max_tmds_rate_bpc_fallback_rgb(struct kunit *test)
{
struct drm_atomic_helper_connector_hdmi_priv *priv;
struct drm_modeset_acquire_ctx ctx;
@@ -1347,7 +1347,7 @@ static void drm_test_check_max_tmds_rate_bpc_fallback(struct kunit *test)
* Then we will prefer to keep the RGB format with a lower bpc over
* picking YUV422.
*/
-static void drm_test_check_max_tmds_rate_format_fallback(struct kunit *test)
+static void drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv422(struct kunit *test)
{
struct drm_atomic_helper_connector_hdmi_priv *priv;
struct drm_modeset_acquire_ctx ctx;
@@ -1803,8 +1803,8 @@ static struct kunit_case drm_atomic_helper_connector_hdmi_check_tests[] = {
KUNIT_CASE(drm_test_check_broadcast_rgb_crtc_mode_not_changed),
KUNIT_CASE(drm_test_check_disable_connector),
KUNIT_CASE(drm_test_check_hdmi_funcs_reject_rate),
- KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback),
- KUNIT_CASE(drm_test_check_max_tmds_rate_format_fallback),
+ KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_rgb),
+ KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv422),
KUNIT_CASE(drm_test_check_output_bpc_crtc_mode_changed),
KUNIT_CASE(drm_test_check_output_bpc_crtc_mode_not_changed),
KUNIT_CASE(drm_test_check_output_bpc_dvi),
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 20/23] drm/tests: hdmi: Provide EDID supporting 4K@30Hz with RGB/YUV
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (18 preceding siblings ...)
2025-04-25 10:27 ` [PATCH v4 19/23] drm/tests: hdmi: Rename max TMDS rate fallback tests Cristian Ciocaltea
@ 2025-04-25 10:27 ` Cristian Ciocaltea
2025-05-19 7:57 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 21/23] drm/tests: hdmi: Add max TMDS rate fallback tests for YUV420 mode Cristian Ciocaltea
` (2 subsequent siblings)
22 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:27 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Create a test EDID advertising the following capabilities:
Max resolution: 3840x2160@30Hz with RGB, YUV444, YUV422, YUV420
Max BPC: 16 for all modes
Max TMDS clock: 340 MHz
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/tests/drm_kunit_edid.h | 114 +++++++++++++++++++++++++++++++++
1 file changed, 114 insertions(+)
diff --git a/drivers/gpu/drm/tests/drm_kunit_edid.h b/drivers/gpu/drm/tests/drm_kunit_edid.h
index 027d8aa5bccd0ee101fbe7e147f0e418581e9c3d..02e2761b3b1f9f7d778e13745c29956b3687404c 100644
--- a/drivers/gpu/drm/tests/drm_kunit_edid.h
+++ b/drivers/gpu/drm/tests/drm_kunit_edid.h
@@ -701,4 +701,118 @@ static const unsigned char test_edid_hdmi_1080p_rgb_yuv_4k_yuv420_dc_max_200mhz[
0x00, 0x00, 0x00, 0xca
};
+/*
+ * Max resolution: 3840x2160@30Hz with RGB, YUV444, YUV422, YUV420
+ * Max BPC: 16 for all modes
+ * Max TMDS clock: 340 MHz
+ *
+ * edid-decode (hex):
+ *
+ * 00 ff ff ff ff ff ff 00 31 d8 34 00 00 00 00 00
+ * ff 23 01 03 80 60 36 78 0f ee 91 a3 54 4c 99 26
+ * 0f 50 54 20 00 00 01 01 01 01 01 01 01 01 01 01
+ * 01 01 01 01 01 01 04 74 00 30 f2 70 5a 80 b0 58
+ * 8a 00 40 84 63 00 00 1e 00 00 00 fc 00 54 65 73
+ * 74 20 45 44 49 44 0a 20 20 20 00 00 00 fd 00 18
+ * 55 18 5e 22 00 0a 20 20 20 20 20 20 00 00 00 10
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 ce
+ *
+ * 02 03 27 31 41 5f 6c 03 0c 00 10 00 78 44 20 00
+ * 00 01 03 6d d8 5d c4 01 44 80 07 00 00 00 00 00
+ * 00 e3 0f 01 00 e1 0e 00 00 00 00 00 00 00 00 00
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 84
+ *
+ * ----------------
+ *
+ * Block 0, Base EDID:
+ * EDID Structure Version & Revision: 1.3
+ * Vendor & Product Identification:
+ * Manufacturer: LNX
+ * Model: 52
+ * Model year: 2025
+ * Basic Display Parameters & Features:
+ * Digital display
+ * Maximum image size: 96 cm x 54 cm
+ * Gamma: 2.20
+ * RGB color display
+ * Default (sRGB) color space is primary color space
+ * First detailed timing is the preferred timing
+ * Supports GTF timings within operating range
+ * Color Characteristics:
+ * Red : 0.6396, 0.3300
+ * Green: 0.2998, 0.5996
+ * Blue : 0.1503, 0.0595
+ * White: 0.3125, 0.3291
+ * Established Timings I & II:
+ * DMT 0x04: 640x480 59.940476 Hz 4:3 31.469 kHz 25.175000 MHz
+ * Standard Timings: none
+ * Detailed Timing Descriptors:
+ * DTD 1: 3840x2160 30.000000 Hz 16:9 67.500 kHz 297.000000 MHz (1600 mm x 900 mm)
+ * Hfront 176 Hsync 88 Hback 296 Hpol P
+ * Vfront 8 Vsync 10 Vback 72 Vpol P
+ * Display Product Name: 'Test EDID'
+ * Display Range Limits:
+ * Monitor ranges (GTF): 24-85 Hz V, 24-94 kHz H, max dotclock 340 MHz
+ * Dummy Descriptor:
+ * Extension blocks: 1
+ * Checksum: 0xce
+ *
+ * ----------------
+ *
+ * Block 1, CTA-861 Extension Block:
+ * Revision: 3
+ * Supports YCbCr 4:4:4
+ * Supports YCbCr 4:2:2
+ * Native detailed modes: 1
+ * Video Data Block:
+ * VIC 95: 3840x2160 30.000000 Hz 16:9 67.500 kHz 297.000000 MHz
+ * Vendor-Specific Data Block (HDMI), OUI 00-0C-03:
+ * Source physical address: 1.0.0.0
+ * DC_48bit
+ * DC_36bit
+ * DC_30bit
+ * DC_Y444
+ * Maximum TMDS clock: 340 MHz
+ * Extended HDMI video details:
+ * Vendor-Specific Data Block (HDMI Forum), OUI C4-5D-D8:
+ * Version: 1
+ * Maximum TMDS Character Rate: 340 MHz
+ * SCDC Present
+ * Supports 16-bits/component Deep Color 4:2:0 Pixel Encoding
+ * Supports 12-bits/component Deep Color 4:2:0 Pixel Encoding
+ * Supports 10-bits/component Deep Color 4:2:0 Pixel Encoding
+ * YCbCr 4:2:0 Capability Map Data Block:
+ * VIC 95: 3840x2160 30.000000 Hz 16:9 67.500 kHz 297.000000 MHz
+ * YCbCr 4:2:0 Video Data Block:
+ * Checksum: 0x84
+ */
+static const unsigned char test_edid_hdmi_4k_rgb_yuv420_dc_max_340mhz[] = {
+ 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x31, 0xd8, 0x34, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0x23, 0x01, 0x03, 0x80, 0x60, 0x36, 0x78,
+ 0x0f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, 0x0f, 0x50, 0x54, 0x20,
+ 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x74, 0x00, 0x30, 0xf2, 0x70,
+ 0x5a, 0x80, 0xb0, 0x58, 0x8a, 0x00, 0x40, 0x84, 0x63, 0x00, 0x00, 0x1e,
+ 0x00, 0x00, 0x00, 0xfc, 0x00, 0x54, 0x65, 0x73, 0x74, 0x20, 0x45, 0x44,
+ 0x49, 0x44, 0x0a, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x18,
+ 0x55, 0x18, 0x5e, 0x22, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xce, 0x02, 0x03, 0x27, 0x31,
+ 0x41, 0x5f, 0x6c, 0x03, 0x0c, 0x00, 0x10, 0x00, 0x78, 0x44, 0x20, 0x00,
+ 0x00, 0x01, 0x03, 0x6d, 0xd8, 0x5d, 0xc4, 0x01, 0x44, 0x80, 0x07, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xe3, 0x0f, 0x01, 0x00, 0xe1, 0x0e, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x84
+};
+
#endif // DRM_KUNIT_EDID_H_
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 21/23] drm/tests: hdmi: Add max TMDS rate fallback tests for YUV420 mode
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (19 preceding siblings ...)
2025-04-25 10:27 ` [PATCH v4 20/23] drm/tests: hdmi: Provide EDID supporting 4K@30Hz with RGB/YUV Cristian Ciocaltea
@ 2025-04-25 10:27 ` Cristian Ciocaltea
2025-05-19 8:40 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 22/23] drm/tests: hdmi: Add test for unsuccessful fallback to YUV420 Cristian Ciocaltea
2025-04-25 10:27 ` [PATCH v4 23/23] drm/tests: hdmi: Add test for unsupported RGB/YUV420 mode Cristian Ciocaltea
22 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:27 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Provide tests to verify drm_atomic_helper_connector_hdmi_check() helper
fallback behavior when using YUV420 output format.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 146 +++++++++++++++++++++
1 file changed, 146 insertions(+)
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index faec7aa6fd55faae2207072b67ef3d372dc1695e..e7e55db0add5b28ba7114d45a272d98daed2513c 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -1334,6 +1334,76 @@ static void drm_test_check_max_tmds_rate_bpc_fallback_rgb(struct kunit *test)
drm_modeset_acquire_fini(&ctx);
}
+/*
+ * Test that if:
+ * - We have an HDMI connector and a display supporting both RGB and YUV420
+ * - The chosen mode can be supported in YUV420 output format only
+ * - The chosen mode has a TMDS character rate higher than the display
+ * supports in YUV420/12bpc
+ * - The chosen mode has a TMDS character rate lower than the display
+ * supports in YUV420/10bpc.
+ *
+ * Then we will pick the latter, and the computed TMDS character rate
+ * will be equal to 1.25 * 0.5 times the mode pixel clock.
+ */
+static void drm_test_check_max_tmds_rate_bpc_fallback_yuv420(struct kunit *test)
+{
+ struct drm_atomic_helper_connector_hdmi_priv *priv;
+ struct drm_modeset_acquire_ctx ctx;
+ struct drm_connector_state *conn_state;
+ struct drm_display_info *info;
+ struct drm_display_mode *yuv420_only_mode;
+ unsigned long long rate;
+ struct drm_connector *conn;
+ struct drm_device *drm;
+ struct drm_crtc *crtc;
+ int ret;
+
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB) |
+ BIT(HDMI_COLORSPACE_YUV420),
+ 12,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_yuv_4k_yuv420_dc_max_200mhz);
+ KUNIT_ASSERT_NOT_NULL(test, priv);
+
+ drm = &priv->drm;
+ crtc = priv->crtc;
+ conn = &priv->connector;
+ info = &conn->display_info;
+ KUNIT_ASSERT_TRUE(test, info->is_hdmi);
+ KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0);
+ KUNIT_ASSERT_TRUE(test, conn->ycbcr_420_allowed);
+
+ yuv420_only_mode = drm_kunit_display_mode_from_cea_vic(test, drm, 95);
+ KUNIT_ASSERT_NOT_NULL(test, yuv420_only_mode);
+ KUNIT_ASSERT_TRUE(test, drm_mode_is_420_only(info, yuv420_only_mode));
+
+ rate = drm_hdmi_compute_mode_clock(yuv420_only_mode, 12, HDMI_COLORSPACE_YUV420);
+ KUNIT_ASSERT_GT(test, rate, info->max_tmds_clock * 1000);
+
+ rate = drm_hdmi_compute_mode_clock(yuv420_only_mode, 10, HDMI_COLORSPACE_YUV420);
+ KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000);
+
+ drm_modeset_acquire_init(&ctx, 0);
+
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ yuv420_only_mode,
+ &ctx);
+ KUNIT_EXPECT_EQ(test, ret, 0);
+
+ conn_state = conn->state;
+ KUNIT_ASSERT_NOT_NULL(test, conn_state);
+
+ KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 10);
+ KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_YUV420);
+ KUNIT_EXPECT_EQ(test, conn_state->hdmi.tmds_char_rate, yuv420_only_mode->clock * 625);
+
+ drm_modeset_drop_locks(&ctx);
+ drm_modeset_acquire_fini(&ctx);
+}
+
/*
* Test that if:
* - We have an HDMI connector supporting both RGB and YUV422 and up to
@@ -1407,6 +1477,80 @@ static void drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv422(struct kunit
drm_modeset_acquire_fini(&ctx);
}
+/*
+ * Test that if:
+ * - We have an HDMI connector supporting both RGB and YUV420 and up to
+ * 12 bpc
+ * - The chosen mode has a TMDS character rate higher than the display
+ * supports in RGB/10bpc but lower than the display supports in
+ * RGB/8bpc
+ * - The chosen mode has a TMDS character rate lower than the display
+ * supports in YUV420/12bpc.
+ *
+ * Then we will prefer to keep the RGB format with a lower bpc over
+ * picking YUV420.
+ */
+static void drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv420(struct kunit *test)
+{
+ struct drm_atomic_helper_connector_hdmi_priv *priv;
+ struct drm_modeset_acquire_ctx ctx;
+ struct drm_connector_state *conn_state;
+ struct drm_display_info *info;
+ struct drm_display_mode *preferred;
+ unsigned long long rate;
+ struct drm_connector *conn;
+ struct drm_device *drm;
+ struct drm_crtc *crtc;
+ int ret;
+
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB) |
+ BIT(HDMI_COLORSPACE_YUV420),
+ 12,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_4k_rgb_yuv420_dc_max_340mhz);
+ KUNIT_ASSERT_NOT_NULL(test, priv);
+
+ drm = &priv->drm;
+ crtc = priv->crtc;
+ conn = &priv->connector;
+ info = &conn->display_info;
+ KUNIT_ASSERT_TRUE(test, info->is_hdmi);
+ KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0);
+ KUNIT_ASSERT_TRUE(test, conn->ycbcr_420_allowed);
+
+ preferred = find_preferred_mode(conn);
+ KUNIT_ASSERT_NOT_NULL(test, preferred);
+ KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK);
+ KUNIT_ASSERT_TRUE(test, drm_mode_is_420_also(info, preferred));
+
+ rate = drm_hdmi_compute_mode_clock(preferred, 8, HDMI_COLORSPACE_RGB);
+ KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000);
+
+ rate = drm_hdmi_compute_mode_clock(preferred, 10, HDMI_COLORSPACE_RGB);
+ KUNIT_ASSERT_GT(test, rate, info->max_tmds_clock * 1000);
+
+ rate = drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_YUV420);
+ KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000);
+
+ drm_modeset_acquire_init(&ctx, 0);
+
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
+ KUNIT_EXPECT_EQ(test, ret, 0);
+
+ conn_state = conn->state;
+ KUNIT_ASSERT_NOT_NULL(test, conn_state);
+
+ KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 8);
+ KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB);
+
+ drm_modeset_drop_locks(&ctx);
+ drm_modeset_acquire_fini(&ctx);
+}
+
/*
* Test that if a driver and screen supports RGB and YUV formats, and we
* try to set the VIC 1 mode, we end up with 8bpc RGB even if we could
@@ -1804,7 +1948,9 @@ static struct kunit_case drm_atomic_helper_connector_hdmi_check_tests[] = {
KUNIT_CASE(drm_test_check_disable_connector),
KUNIT_CASE(drm_test_check_hdmi_funcs_reject_rate),
KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_rgb),
+ KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_yuv420),
KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv422),
+ KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv420),
KUNIT_CASE(drm_test_check_output_bpc_crtc_mode_changed),
KUNIT_CASE(drm_test_check_output_bpc_crtc_mode_not_changed),
KUNIT_CASE(drm_test_check_output_bpc_dvi),
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 22/23] drm/tests: hdmi: Add test for unsuccessful fallback to YUV420
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (20 preceding siblings ...)
2025-04-25 10:27 ` [PATCH v4 21/23] drm/tests: hdmi: Add max TMDS rate fallback tests for YUV420 mode Cristian Ciocaltea
@ 2025-04-25 10:27 ` Cristian Ciocaltea
2025-05-19 8:41 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 23/23] drm/tests: hdmi: Add test for unsupported RGB/YUV420 mode Cristian Ciocaltea
22 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:27 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Provide test to verify a mandatory fallback to YUV420 output cannot
succeed when driver doesn't advertise YUV420 support.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 72 ++++++++++++++++++++++
1 file changed, 72 insertions(+)
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index e7e55db0add5b28ba7114d45a272d98daed2513c..d79084cfb516b69c4244098c0767d604ad02f2c3 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -1551,6 +1551,77 @@ static void drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv420(struct kunit
drm_modeset_acquire_fini(&ctx);
}
+/*
+ * Test that if a driver supports only RGB, but the chosen mode can be
+ * supported by the screen only in YUV420 output format, we end up with
+ * unsuccessful fallback attempts.
+ */
+static void drm_test_check_driver_unsupported_fallback_yuv420(struct kunit *test)
+{
+ struct drm_atomic_helper_connector_hdmi_priv *priv;
+ struct drm_modeset_acquire_ctx ctx;
+ struct drm_connector_state *conn_state;
+ struct drm_crtc_state *crtc_state;
+ struct drm_atomic_state *state;
+ struct drm_display_info *info;
+ struct drm_display_mode *preferred, *yuv420_only_mode;
+ struct drm_connector *conn;
+ struct drm_device *drm;
+ struct drm_crtc *crtc;
+ int ret;
+
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB),
+ 12,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_yuv_4k_yuv420_dc_max_200mhz);
+ KUNIT_ASSERT_NOT_NULL(test, priv);
+
+ drm = &priv->drm;
+ crtc = priv->crtc;
+ conn = &priv->connector;
+ info = &conn->display_info;
+ KUNIT_ASSERT_TRUE(test, info->is_hdmi);
+ KUNIT_ASSERT_FALSE(test, conn->ycbcr_420_allowed);
+
+ preferred = find_preferred_mode(conn);
+ KUNIT_ASSERT_NOT_NULL(test, preferred);
+ KUNIT_ASSERT_FALSE(test, drm_mode_is_420_also(info, preferred));
+
+ yuv420_only_mode = drm_kunit_display_mode_from_cea_vic(test, drm, 95);
+ KUNIT_ASSERT_NOT_NULL(test, yuv420_only_mode);
+ KUNIT_ASSERT_TRUE(test, drm_mode_is_420_only(info, yuv420_only_mode));
+
+ drm_modeset_acquire_init(&ctx, 0);
+
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred, &ctx);
+ KUNIT_EXPECT_EQ(test, ret, 0);
+
+ conn_state = conn->state;
+ KUNIT_ASSERT_NOT_NULL(test, conn_state);
+ KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB);
+
+ state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+
+retry:
+ crtc_state = drm_atomic_get_crtc_state(state, crtc);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
+
+ ret = drm_atomic_set_mode_for_crtc(crtc_state, yuv420_only_mode);
+ KUNIT_EXPECT_EQ(test, ret, 0);
+
+ ret = drm_atomic_check_only(state);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
+ KUNIT_ASSERT_LT(test, ret, 0);
+
+ drm_modeset_drop_locks(&ctx);
+ drm_modeset_acquire_fini(&ctx);
+}
+
/*
* Test that if a driver and screen supports RGB and YUV formats, and we
* try to set the VIC 1 mode, we end up with 8bpc RGB even if we could
@@ -1951,6 +2022,7 @@ static struct kunit_case drm_atomic_helper_connector_hdmi_check_tests[] = {
KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_yuv420),
KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv422),
KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv420),
+ KUNIT_CASE(drm_test_check_driver_unsupported_fallback_yuv420),
KUNIT_CASE(drm_test_check_output_bpc_crtc_mode_changed),
KUNIT_CASE(drm_test_check_output_bpc_crtc_mode_not_changed),
KUNIT_CASE(drm_test_check_output_bpc_dvi),
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v4 23/23] drm/tests: hdmi: Add test for unsupported RGB/YUV420 mode
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
` (21 preceding siblings ...)
2025-04-25 10:27 ` [PATCH v4 22/23] drm/tests: hdmi: Add test for unsuccessful fallback to YUV420 Cristian Ciocaltea
@ 2025-04-25 10:27 ` Cristian Ciocaltea
2025-05-19 8:42 ` Maxime Ripard
22 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-25 10:27 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Provide a test to verify that if both driver and screen support RGB and
YUV420 formats, drm_atomic_helper_connector_hdmi_check() cannot succeed
when trying to set a mode unsupported by the display.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 66 ++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index d79084cfb516b69c4244098c0767d604ad02f2c3..6337a1c52b86810c638f446c4995e7ee63dbc084 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -1622,6 +1622,71 @@ static void drm_test_check_driver_unsupported_fallback_yuv420(struct kunit *test
drm_modeset_acquire_fini(&ctx);
}
+/*
+ * Test that if a driver and screen supports RGB and YUV420 formats, but the
+ * chosen mode cannot be supported by the screen, we end up with unsuccessful
+ * fallback attempts.
+ */
+static void drm_test_check_display_unsupported_fallback_rgb_yuv420(struct kunit *test)
+{
+ struct drm_atomic_helper_connector_hdmi_priv *priv;
+ struct drm_modeset_acquire_ctx ctx;
+ struct drm_crtc_state *crtc_state;
+ struct drm_atomic_state *state;
+ struct drm_display_info *info;
+ struct drm_display_mode *preferred, *unsupported_mode;
+ struct drm_connector *conn;
+ struct drm_device *drm;
+ struct drm_crtc *crtc;
+ int ret;
+
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB) |
+ BIT(HDMI_COLORSPACE_YUV420),
+ 10,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_4k_rgb_yuv420_dc_max_340mhz);
+ KUNIT_ASSERT_NOT_NULL(test, priv);
+
+ drm = &priv->drm;
+ crtc = priv->crtc;
+ conn = &priv->connector;
+ info = &conn->display_info;
+ KUNIT_ASSERT_TRUE(test, info->is_hdmi);
+ KUNIT_ASSERT_TRUE(test, conn->ycbcr_420_allowed);
+
+ preferred = find_preferred_mode(conn);
+ KUNIT_ASSERT_NOT_NULL(test, preferred);
+
+ unsupported_mode = drm_kunit_display_mode_from_cea_vic(test, drm, 96);
+ KUNIT_ASSERT_NOT_NULL(test, unsupported_mode);
+
+ drm_modeset_acquire_init(&ctx, 0);
+
+ ret = drm_kunit_helper_try_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred, &ctx);
+ KUNIT_EXPECT_EQ(test, ret, 0);
+
+ state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+
+retry:
+ crtc_state = drm_atomic_get_crtc_state(state, crtc);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
+
+ ret = drm_atomic_set_mode_for_crtc(crtc_state, unsupported_mode);
+ KUNIT_EXPECT_EQ(test, ret, 0);
+
+ ret = drm_atomic_check_only(state);
+ drm_kunit_atomic_restart_on_deadlock(ret, state, &ctx, retry);
+ KUNIT_ASSERT_LT(test, ret, 0);
+
+ drm_modeset_drop_locks(&ctx);
+ drm_modeset_acquire_fini(&ctx);
+}
+
/*
* Test that if a driver and screen supports RGB and YUV formats, and we
* try to set the VIC 1 mode, we end up with 8bpc RGB even if we could
@@ -2023,6 +2088,7 @@ static struct kunit_case drm_atomic_helper_connector_hdmi_check_tests[] = {
KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv422),
KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv420),
KUNIT_CASE(drm_test_check_driver_unsupported_fallback_yuv420),
+ KUNIT_CASE(drm_test_check_display_unsupported_fallback_rgb_yuv420),
KUNIT_CASE(drm_test_check_output_bpc_crtc_mode_changed),
KUNIT_CASE(drm_test_check_output_bpc_crtc_mode_not_changed),
KUNIT_CASE(drm_test_check_output_bpc_dvi),
--
2.49.0
^ permalink raw reply related [flat|nested] 52+ messages in thread
* Re: [PATCH v4 07/23] drm/tests: hdmi: Replace '[_]MHz' with 'mhz'
2025-04-25 10:26 ` [PATCH v4 07/23] drm/tests: hdmi: Replace '[_]MHz' with 'mhz' Cristian Ciocaltea
@ 2025-04-26 2:06 ` Dmitry Baryshkov
0 siblings, 0 replies; 52+ messages in thread
From: Dmitry Baryshkov @ 2025-04-26 2:06 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Dmitry Baryshkov, kernel,
dri-devel, linux-kernel
On Fri, Apr 25, 2025 at 01:26:58PM +0300, Cristian Ciocaltea wrote:
> Improve consistency throughout drm_hdmi_state_helper_test.c by replacing
> the two occurrences of '[_]MHz' substring with 'mhz'.
>
> As a bonus, this also helps getting rid of checkpatch.pl complaint:
>
> CHECK: Avoid CamelCase: <reject_100_MHz_connector_hdmi_funcs>
>
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
> ---
> drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 08/23] drm/tests: hdmi: Add macro to simplify EDID setup
2025-04-25 10:26 ` [PATCH v4 08/23] drm/tests: hdmi: Add macro to simplify EDID setup Cristian Ciocaltea
@ 2025-04-28 9:52 ` Jani Nikula
2025-04-29 9:58 ` Cristian Ciocaltea
2025-05-13 13:45 ` Maxime Ripard
1 sibling, 1 reply; 52+ messages in thread
From: Jani Nikula @ 2025-04-28 9:52 UTC (permalink / raw)
To: Cristian Ciocaltea, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Dave Stevenson,
Dmitry Baryshkov, Dmitry Baryshkov, Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
On Fri, 25 Apr 2025, Cristian Ciocaltea <cristian.ciocaltea@collabora.com> wrote:
> Factor out the HDMI connector initialization from
> drm_kunit_helper_connector_hdmi_init_funcs() into a common
> __connector_hdmi_init() function, while extending its functionality to
> allow setting custom (i.e. non-default) EDID data.
>
> Introduce a macro as a wrapper over the new helper to allow dropping the
> open coded EDID setup from all test cases.
>
> The actual conversion will be handled separately; for now just apply it
> to drm_kunit_helper_connector_hdmi_init() helper.
>
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
> ---
> drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 46 +++++++++++++---------
> 1 file changed, 28 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> index c8dc6fa0f925e35e9903a18bac7f78f9d8165960..36734639d19a3f279abc4631eb19d5c2b20ca315 100644
> --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> @@ -140,10 +140,11 @@ static const struct drm_connector_funcs dummy_connector_funcs = {
>
> static
> struct drm_atomic_helper_connector_hdmi_priv *
> -drm_kunit_helper_connector_hdmi_init_funcs(struct kunit *test,
> - unsigned int formats,
> - unsigned int max_bpc,
> - const struct drm_connector_hdmi_funcs *hdmi_funcs)
> +__connector_hdmi_init(struct kunit *test,
> + unsigned int formats,
> + unsigned int max_bpc,
> + const struct drm_connector_hdmi_funcs *hdmi_funcs,
> + const char *edid_data, size_t edid_len)
char* is weird for EDID data, but it's a pre-existing thing, and
actually making it unsigned char or u8 isn't much better.
A follow-up could switch edid_data to just const void *, and ditto for
set_connector_edid() and current_edid member in struct
drm_atomic_helper_connector_hdmi_priv.
BR,
Jani.
> {
> struct drm_atomic_helper_connector_hdmi_priv *priv;
> struct drm_connector *conn;
> @@ -197,29 +198,38 @@ drm_kunit_helper_connector_hdmi_init_funcs(struct kunit *test,
>
> drm_mode_config_reset(drm);
>
> + if (edid_data && edid_len) {
> + ret = set_connector_edid(test, &priv->connector, edid_data, edid_len);
> + KUNIT_ASSERT_GT(test, ret, 0);
> + }
> +
> return priv;
> }
>
> +static
> +struct drm_atomic_helper_connector_hdmi_priv *
> +drm_kunit_helper_connector_hdmi_init_funcs(struct kunit *test,
> + unsigned int formats,
> + unsigned int max_bpc,
> + const struct drm_connector_hdmi_funcs *hdmi_funcs)
> +{
> + return __connector_hdmi_init(test, formats, max_bpc, hdmi_funcs, NULL, 0);
> +}
> +
> +#define drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, formats, max_bpc, funcs, edid) \
> + __connector_hdmi_init(test, formats, max_bpc, funcs, edid, ARRAY_SIZE(edid))
> +
> static
> struct drm_atomic_helper_connector_hdmi_priv *
> drm_kunit_helper_connector_hdmi_init(struct kunit *test,
> unsigned int formats,
> unsigned int max_bpc)
> {
> - struct drm_atomic_helper_connector_hdmi_priv *priv;
> - int ret;
> -
> - priv = drm_kunit_helper_connector_hdmi_init_funcs(test,
> - formats, max_bpc,
> - &dummy_connector_hdmi_funcs);
> - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv);
> -
> - ret = set_connector_edid(test, &priv->connector,
> - test_edid_hdmi_1080p_rgb_max_200mhz,
> - ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz));
> - KUNIT_ASSERT_GT(test, ret, 0);
> -
> - return priv;
> + return drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
> + formats,
> + max_bpc,
> + &dummy_connector_hdmi_funcs,
> + test_edid_hdmi_1080p_rgb_max_200mhz);
> }
>
> /*
--
Jani Nikula, Intel
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 08/23] drm/tests: hdmi: Add macro to simplify EDID setup
2025-04-28 9:52 ` Jani Nikula
@ 2025-04-29 9:58 ` Cristian Ciocaltea
0 siblings, 0 replies; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-04-29 9:58 UTC (permalink / raw)
To: Jani Nikula, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Dave Stevenson, Dmitry Baryshkov,
Dmitry Baryshkov
Cc: kernel, dri-devel, linux-kernel
Hi Jani,
On 4/28/25 12:52 PM, Jani Nikula wrote:
> On Fri, 25 Apr 2025, Cristian Ciocaltea <cristian.ciocaltea@collabora.com> wrote:
>> Factor out the HDMI connector initialization from
>> drm_kunit_helper_connector_hdmi_init_funcs() into a common
>> __connector_hdmi_init() function, while extending its functionality to
>> allow setting custom (i.e. non-default) EDID data.
>>
>> Introduce a macro as a wrapper over the new helper to allow dropping the
>> open coded EDID setup from all test cases.
>>
>> The actual conversion will be handled separately; for now just apply it
>> to drm_kunit_helper_connector_hdmi_init() helper.
>>
>> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
>> ---
>> drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 46 +++++++++++++---------
>> 1 file changed, 28 insertions(+), 18 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>> index c8dc6fa0f925e35e9903a18bac7f78f9d8165960..36734639d19a3f279abc4631eb19d5c2b20ca315 100644
>> --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>> +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>> @@ -140,10 +140,11 @@ static const struct drm_connector_funcs dummy_connector_funcs = {
>>
>> static
>> struct drm_atomic_helper_connector_hdmi_priv *
>> -drm_kunit_helper_connector_hdmi_init_funcs(struct kunit *test,
>> - unsigned int formats,
>> - unsigned int max_bpc,
>> - const struct drm_connector_hdmi_funcs *hdmi_funcs)
>> +__connector_hdmi_init(struct kunit *test,
>> + unsigned int formats,
>> + unsigned int max_bpc,
>> + const struct drm_connector_hdmi_funcs *hdmi_funcs,
>> + const char *edid_data, size_t edid_len)
>
> char* is weird for EDID data, but it's a pre-existing thing, and
> actually making it unsigned char or u8 isn't much better.
>
> A follow-up could switch edid_data to just const void *, and ditto for
> set_connector_edid() and current_edid member in struct
> drm_atomic_helper_connector_hdmi_priv.
Noted for next revision (if required), otherwise I'll handle it separately.
Thanks,
Cristian
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 06/23] drm/connector: hdmi: Use YUV420 output format as an RGB fallback
2025-04-25 10:26 ` [PATCH v4 06/23] drm/connector: hdmi: Use YUV420 output format as an RGB fallback Cristian Ciocaltea
@ 2025-05-13 13:35 ` Maxime Ripard
2025-05-15 12:44 ` Cristian Ciocaltea
0 siblings, 1 reply; 52+ messages in thread
From: Maxime Ripard @ 2025-05-13 13:35 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov, kernel,
dri-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1556 bytes --]
Hi,
On Fri, Apr 25, 2025 at 01:26:57PM +0300, Cristian Ciocaltea wrote:
> Try to make use of YUV420 when computing the best output format and
> RGB cannot be supported for any of the available color depths.
>
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
> ---
> drivers/gpu/drm/display/drm_hdmi_state_helper.c | 22 +++++++++++++++++-----
> 1 file changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> index 9e0a468073acbb2477eff1abef1c09d63620afaa..1fba10b92a6baa49150b6ff1e96bf2c2739bf269 100644
> --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> @@ -648,14 +648,26 @@ hdmi_compute_config(const struct drm_connector *connector,
> 8, connector->max_bpc);
> int ret;
>
> - /*
> - * TODO: Add support for YCbCr420 output for HDMI 2.0 capable
> - * devices, for modes that only support YCbCr420.
> - */
> ret = hdmi_compute_format_bpc(connector, conn_state, mode, max_bpc,
> HDMI_COLORSPACE_RGB);
> + if (!ret)
> + return 0;
Sorry, I missed it on the previous iteration, but this condition
inversion compared to the rest of the function is throwing me off :)
I believe something like
If (ret) {
if (connector->ycbcr_420_allowed) {
hdmi_compute_format_bpc(..., HDMI_COLORSPACE_YUV420)
} else {
drm_dbg_kms("Can't use YUV420")
}
}
Would be more natural
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 08/23] drm/tests: hdmi: Add macro to simplify EDID setup
2025-04-25 10:26 ` [PATCH v4 08/23] drm/tests: hdmi: Add macro to simplify EDID setup Cristian Ciocaltea
2025-04-28 9:52 ` Jani Nikula
@ 2025-05-13 13:45 ` Maxime Ripard
1 sibling, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-05-13 13:45 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: dri-devel, kernel, linux-kernel, Dave Stevenson, David Airlie,
Dmitry Baryshkov, Dmitry Baryshkov, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, Thomas Zimmermann
On Fri, 25 Apr 2025 13:26:59 +0300, Cristian Ciocaltea wrote:
> Factor out the HDMI connector initialization from
> drm_kunit_helper_connector_hdmi_init_funcs() into a common
> __connector_hdmi_init() function, while extending its functionality to
> allow setting custom (i.e. non-default) EDID data.
>
>
> [ ... ]
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 06/23] drm/connector: hdmi: Use YUV420 output format as an RGB fallback
2025-05-13 13:35 ` Maxime Ripard
@ 2025-05-15 12:44 ` Cristian Ciocaltea
2025-05-15 14:52 ` Maxime Ripard
0 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-05-15 12:44 UTC (permalink / raw)
To: Maxime Ripard
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov, kernel,
dri-devel, linux-kernel
Hi Maxime,
On 5/13/25 4:35 PM, Maxime Ripard wrote:
> Hi,
>
> On Fri, Apr 25, 2025 at 01:26:57PM +0300, Cristian Ciocaltea wrote:
>> Try to make use of YUV420 when computing the best output format and
>> RGB cannot be supported for any of the available color depths.
>>
>> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
>> ---
>> drivers/gpu/drm/display/drm_hdmi_state_helper.c | 22 +++++++++++++++++-----
>> 1 file changed, 17 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
>> index 9e0a468073acbb2477eff1abef1c09d63620afaa..1fba10b92a6baa49150b6ff1e96bf2c2739bf269 100644
>> --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
>> +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
>> @@ -648,14 +648,26 @@ hdmi_compute_config(const struct drm_connector *connector,
>> 8, connector->max_bpc);
>> int ret;
>>
>> - /*
>> - * TODO: Add support for YCbCr420 output for HDMI 2.0 capable
>> - * devices, for modes that only support YCbCr420.
>> - */
>> ret = hdmi_compute_format_bpc(connector, conn_state, mode, max_bpc,
>> HDMI_COLORSPACE_RGB);
>> + if (!ret)
>> + return 0;
>
> Sorry, I missed it on the previous iteration, but this condition
> inversion compared to the rest of the function is throwing me off :)
>
> I believe something like
>
> If (ret) {
> if (connector->ycbcr_420_allowed) {
> hdmi_compute_format_bpc(..., HDMI_COLORSPACE_YUV420)
> } else {
> drm_dbg_kms("Can't use YUV420")
> }
> }
>
> Would be more natural
Yep, will do.
Please let me know if I can start preparing v5, as I'm not sure if you
managed to also check the test-related patches.
Thanks,
Cristian
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 06/23] drm/connector: hdmi: Use YUV420 output format as an RGB fallback
2025-05-15 12:44 ` Cristian Ciocaltea
@ 2025-05-15 14:52 ` Maxime Ripard
0 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-05-15 14:52 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov, kernel,
dri-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2087 bytes --]
On Thu, May 15, 2025 at 03:44:18PM +0300, Cristian Ciocaltea wrote:
> Hi Maxime,
>
> On 5/13/25 4:35 PM, Maxime Ripard wrote:
> > Hi,
> >
> > On Fri, Apr 25, 2025 at 01:26:57PM +0300, Cristian Ciocaltea wrote:
> >> Try to make use of YUV420 when computing the best output format and
> >> RGB cannot be supported for any of the available color depths.
> >>
> >> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
> >> ---
> >> drivers/gpu/drm/display/drm_hdmi_state_helper.c | 22 +++++++++++++++++-----
> >> 1 file changed, 17 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> >> index 9e0a468073acbb2477eff1abef1c09d63620afaa..1fba10b92a6baa49150b6ff1e96bf2c2739bf269 100644
> >> --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> >> +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> >> @@ -648,14 +648,26 @@ hdmi_compute_config(const struct drm_connector *connector,
> >> 8, connector->max_bpc);
> >> int ret;
> >>
> >> - /*
> >> - * TODO: Add support for YCbCr420 output for HDMI 2.0 capable
> >> - * devices, for modes that only support YCbCr420.
> >> - */
> >> ret = hdmi_compute_format_bpc(connector, conn_state, mode, max_bpc,
> >> HDMI_COLORSPACE_RGB);
> >> + if (!ret)
> >> + return 0;
> >
> > Sorry, I missed it on the previous iteration, but this condition
> > inversion compared to the rest of the function is throwing me off :)
> >
> > I believe something like
> >
> > If (ret) {
> > if (connector->ycbcr_420_allowed) {
> > hdmi_compute_format_bpc(..., HDMI_COLORSPACE_YUV420)
> > } else {
> > drm_dbg_kms("Can't use YUV420")
> > }
> > }
> >
> > Would be more natural
>
> Yep, will do.
>
> Please let me know if I can start preparing v5, as I'm not sure if you
> managed to also check the test-related patches.
I haven't gotten through the whole series yet, sorry. I hope to finish
it by ~ the middle of next week.
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 09/23] drm/tests: hdmi: Replace open coded EDID setup
2025-04-25 10:27 ` [PATCH v4 09/23] drm/tests: hdmi: Replace open coded " Cristian Ciocaltea
@ 2025-05-15 15:35 ` Maxime Ripard
0 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-05-15 15:35 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: dri-devel, kernel, linux-kernel, Dave Stevenson, David Airlie,
Dmitry Baryshkov, Dmitry Baryshkov, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, Thomas Zimmermann
On Fri, 25 Apr 2025 13:27:00 +0300, Cristian Ciocaltea wrote:
> Make use of the recently introduced macros to reduce boilerplate code
> around EDID setup. This also helps dropping the redundant calls to
> set_connector_edid().
>
> No functional changes intended.
>
> [ ... ]
Acked-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 10/23] drm/tests: hdmi: Drop unused drm_kunit_helper_connector_hdmi_init_funcs()
2025-04-25 10:27 ` [PATCH v4 10/23] drm/tests: hdmi: Drop unused drm_kunit_helper_connector_hdmi_init_funcs() Cristian Ciocaltea
@ 2025-05-16 13:06 ` Maxime Ripard
0 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-05-16 13:06 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: dri-devel, kernel, linux-kernel, Dave Stevenson, David Airlie,
Dmitry Baryshkov, Dmitry Baryshkov, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, Thomas Zimmermann
On Fri, 25 Apr 2025 13:27:01 +0300, Cristian Ciocaltea wrote:
> After updating the code to make use of the new EDID setup helper,
> drm_kunit_helper_connector_hdmi_init_funcs() became unused, hence drop
> it.
>
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
>
> [ ... ]
Acked-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 12/23] drm/tests: helpers: Add a (re)try helper variant to enable CRTC connector
2025-04-25 10:27 ` [PATCH v4 12/23] drm/tests: helpers: Add a (re)try helper variant to enable CRTC connector Cristian Ciocaltea
@ 2025-05-16 13:15 ` Maxime Ripard
2025-05-19 10:20 ` Cristian Ciocaltea
0 siblings, 1 reply; 52+ messages in thread
From: Maxime Ripard @ 2025-05-16 13:15 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov, kernel,
dri-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2623 bytes --]
Hi,
On Fri, Apr 25, 2025 at 01:27:03PM +0300, Cristian Ciocaltea wrote:
> Provide a wrapper over drm_kunit_helper_enable_crtc_connector() to
> automatically handle EDEADLK.
>
> This is going to help improve the error handling in a bunch of test
> cases without open coding the restart of the atomic sequence.
>
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
> ---
> drivers/gpu/drm/tests/drm_kunit_helpers.c | 39 +++++++++++++++++++++++++++++++
> include/drm/drm_kunit_helpers.h | 7 ++++++
> 2 files changed, 46 insertions(+)
>
> diff --git a/drivers/gpu/drm/tests/drm_kunit_helpers.c b/drivers/gpu/drm/tests/drm_kunit_helpers.c
> index 5f7257840d8ef0aeabe5f00802f5037ed652ae66..4e1174c50b1f2b6358eb740cd73c6d86e53d0df9 100644
> --- a/drivers/gpu/drm/tests/drm_kunit_helpers.c
> +++ b/drivers/gpu/drm/tests/drm_kunit_helpers.c
> @@ -332,6 +332,45 @@ int drm_kunit_helper_enable_crtc_connector(struct kunit *test,
> }
> EXPORT_SYMBOL_GPL(drm_kunit_helper_enable_crtc_connector);
>
> +/**
> + * drm_kunit_helper_try_enable_crtc_connector - (Re)tries to enable a CRTC -> Connector output
> + * @test: The test context object
> + * @drm: The device to alloc the plane for
> + * @crtc: The CRTC to enable
> + * @connector: The Connector to enable
> + * @mode: The display mode to configure the CRTC with
> + * @ctx: Locking context
> + *
> + * This function is a wrapper over @drm_kunit_helper_enable_crtc_connector
> + * to automatically handle EDEADLK and (re)try to enable the route from
> + * @crtc to @connector, with the given @mode.
> + *
> + * Returns:
> + *
> + * A pointer to the new CRTC, or an ERR_PTR() otherwise.
> + */
> +int drm_kunit_helper_try_enable_crtc_connector(struct kunit *test,
> + struct drm_device *drm,
> + struct drm_crtc *crtc,
> + struct drm_connector *connector,
> + const struct drm_display_mode *mode,
> + struct drm_modeset_acquire_ctx *ctx)
> +{
> + int ret;
> +
> +retry_enable:
> + ret = drm_kunit_helper_enable_crtc_connector(test, drm, crtc, connector,
> + mode, ctx);
> + if (ret == -EDEADLK) {
> + ret = drm_modeset_backoff(ctx);
> + if (!ret)
> + goto retry_enable;
> + }
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(drm_kunit_helper_try_enable_crtc_connector);
I'm not sure it's a good idea. This function might affect the locking
context of the caller without even reporting it.
Generally speaking, I'd really prefer to have explicit locking, even if
it means slightly more boilerplate.
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 14/23] drm/tests: hdmi: Add macro to support EDEADLK handling
2025-04-25 10:27 ` [PATCH v4 14/23] drm/tests: hdmi: Add macro to support EDEADLK handling Cristian Ciocaltea
@ 2025-05-19 7:22 ` Maxime Ripard
2025-05-19 10:35 ` Cristian Ciocaltea
0 siblings, 1 reply; 52+ messages in thread
From: Maxime Ripard @ 2025-05-19 7:22 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov, kernel,
dri-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1677 bytes --]
Hi,
On Fri, Apr 25, 2025 at 01:27:05PM +0300, Cristian Ciocaltea wrote:
> In preparation to improve error handling throughout all test cases,
> introduce a macro to check for EDEADLK and automate the restart of the
> atomic sequence.
>
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
> ---
> drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> index c8969ee6518954ab4496d3a4398f428bf4104a36..c8bb131d63ea6d0c9e166c8d9ba5e403118cd9f1 100644
> --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> @@ -224,6 +224,16 @@ drm_kunit_helper_connector_hdmi_init(struct kunit *test,
> test_edid_hdmi_1080p_rgb_max_200mhz);
> }
>
> +#define drm_kunit_atomic_restart_on_deadlock(ret, state, ctx, start) do { \
> + if (ret == -EDEADLK) { \
> + if (state) \
> + drm_atomic_state_clear(state); \
> + ret = drm_modeset_backoff(ctx); \
> + if (!ret) \
> + goto start; \
> + } \
> +} while (0)
> +
I'm not sure here either, for pretty much the same reason. As far as
locking goes, I really think we should prefer something explicit even if
it means a bit more boilerplate.
If you still want to push this forward though, this has nothing to do
with kunit so it should be made a common helper. I do think it should be
done in a separate series though. Ever-expanding series are a nightmare,
both to contribute and to review :)
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 16/23] drm/tests: hdmi: Switch to drm_atomic_get_new_connector_state() where possible
2025-04-25 10:27 ` [PATCH v4 16/23] drm/tests: hdmi: Switch to drm_atomic_get_new_connector_state() where possible Cristian Ciocaltea
@ 2025-05-19 7:23 ` Maxime Ripard
0 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-05-19 7:23 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: dri-devel, kernel, linux-kernel, Dave Stevenson, David Airlie,
Dmitry Baryshkov, Dmitry Baryshkov, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, Thomas Zimmermann
On Fri, 25 Apr 2025 13:27:07 +0300, Cristian Ciocaltea wrote:
> Replace the calls to drm_atomic_get_connector_state() with
> drm_atomic_get_new_connector_state() for cases which do not require
> allocating the connector state, e.g. after drm_atomic_check_only() when
> the intent is to only read the new connector state.
>
>
> [ ... ]
Acked-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 17/23] drm/tests: hdmi: Provide EDID supporting 4K@30Hz with YUV420 only
2025-04-25 10:27 ` [PATCH v4 17/23] drm/tests: hdmi: Provide EDID supporting 4K@30Hz with YUV420 only Cristian Ciocaltea
@ 2025-05-19 7:57 ` Maxime Ripard
0 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-05-19 7:57 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: dri-devel, kernel, linux-kernel, Dave Stevenson, David Airlie,
Dmitry Baryshkov, Dmitry Baryshkov, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, Thomas Zimmermann
On Fri, 25 Apr 2025 13:27:08 +0300, Cristian Ciocaltea wrote:
> Create a test EDID advertising the following capabilities:
>
> Max resolution:
> - 1920x1080@60Hz with RGB, YUV444, YUV422
> - 3840x2160@30Hz with YUV420 only
>
> [ ... ]
Acked-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 20/23] drm/tests: hdmi: Provide EDID supporting 4K@30Hz with RGB/YUV
2025-04-25 10:27 ` [PATCH v4 20/23] drm/tests: hdmi: Provide EDID supporting 4K@30Hz with RGB/YUV Cristian Ciocaltea
@ 2025-05-19 7:57 ` Maxime Ripard
0 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-05-19 7:57 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: dri-devel, kernel, linux-kernel, Dave Stevenson, David Airlie,
Dmitry Baryshkov, Dmitry Baryshkov, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, Thomas Zimmermann
On Fri, 25 Apr 2025 13:27:11 +0300, Cristian Ciocaltea wrote:
> Create a test EDID advertising the following capabilities:
>
> Max resolution: 3840x2160@30Hz with RGB, YUV444, YUV422, YUV420
> Max BPC: 16 for all modes
> Max TMDS clock: 340 MHz
>
> [ ... ]
Acked-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 18/23] drm/tests: hdmi: Add limited range tests for YUV420 mode
2025-04-25 10:27 ` [PATCH v4 18/23] drm/tests: hdmi: Add limited range tests for YUV420 mode Cristian Ciocaltea
@ 2025-05-19 7:58 ` Maxime Ripard
0 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-05-19 7:58 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: dri-devel, kernel, linux-kernel, Dave Stevenson, David Airlie,
Dmitry Baryshkov, Dmitry Baryshkov, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, Thomas Zimmermann
On Fri, 25 Apr 2025 13:27:09 +0300, Cristian Ciocaltea wrote:
> Provide tests to verify that drm_atomic_helper_connector_hdmi_check()
> helper behaviour when using YUV420 output format is to always set the
> limited RGB quantization range to 'limited', no matter what the value of
> Broadcast RGB property is.
>
>
> [ ... ]
Acked-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 19/23] drm/tests: hdmi: Rename max TMDS rate fallback tests
2025-04-25 10:27 ` [PATCH v4 19/23] drm/tests: hdmi: Rename max TMDS rate fallback tests Cristian Ciocaltea
@ 2025-05-19 8:38 ` Maxime Ripard
0 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-05-19 8:38 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: dri-devel, kernel, linux-kernel, Dave Stevenson, David Airlie,
Dmitry Baryshkov, Dmitry Baryshkov, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, Thomas Zimmermann
On Fri, 25 Apr 2025 13:27:10 +0300, Cristian Ciocaltea wrote:
> In preparation to extend the max TMDS rate fallback tests for covering
> YUV420 output, update the rather generic function names
> drm_test_check_max_tmds_rate_{bpc|format}_fallback() to properly
> indicate the intended test cases.
>
>
> [ ... ]
Acked-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 21/23] drm/tests: hdmi: Add max TMDS rate fallback tests for YUV420 mode
2025-04-25 10:27 ` [PATCH v4 21/23] drm/tests: hdmi: Add max TMDS rate fallback tests for YUV420 mode Cristian Ciocaltea
@ 2025-05-19 8:40 ` Maxime Ripard
0 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-05-19 8:40 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: dri-devel, kernel, linux-kernel, Dave Stevenson, David Airlie,
Dmitry Baryshkov, Dmitry Baryshkov, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, Thomas Zimmermann
On Fri, 25 Apr 2025 13:27:12 +0300, Cristian Ciocaltea wrote:
> Provide tests to verify drm_atomic_helper_connector_hdmi_check() helper
> fallback behavior when using YUV420 output format.
>
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 22/23] drm/tests: hdmi: Add test for unsuccessful fallback to YUV420
2025-04-25 10:27 ` [PATCH v4 22/23] drm/tests: hdmi: Add test for unsuccessful fallback to YUV420 Cristian Ciocaltea
@ 2025-05-19 8:41 ` Maxime Ripard
0 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-05-19 8:41 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: dri-devel, kernel, linux-kernel, Dave Stevenson, David Airlie,
Dmitry Baryshkov, Dmitry Baryshkov, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, Thomas Zimmermann
On Fri, 25 Apr 2025 13:27:13 +0300, Cristian Ciocaltea wrote:
> Provide test to verify a mandatory fallback to YUV420 output cannot
> succeed when driver doesn't advertise YUV420 support.
>
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 23/23] drm/tests: hdmi: Add test for unsupported RGB/YUV420 mode
2025-04-25 10:27 ` [PATCH v4 23/23] drm/tests: hdmi: Add test for unsupported RGB/YUV420 mode Cristian Ciocaltea
@ 2025-05-19 8:42 ` Maxime Ripard
2025-05-19 10:55 ` Cristian Ciocaltea
0 siblings, 1 reply; 52+ messages in thread
From: Maxime Ripard @ 2025-05-19 8:42 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov, kernel,
dri-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2566 bytes --]
Hi,
On Fri, Apr 25, 2025 at 01:27:14PM +0300, Cristian Ciocaltea wrote:
> Provide a test to verify that if both driver and screen support RGB and
> YUV420 formats, drm_atomic_helper_connector_hdmi_check() cannot succeed
> when trying to set a mode unsupported by the display.
>
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
> ---
> drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 66 ++++++++++++++++++++++
> 1 file changed, 66 insertions(+)
>
> diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> index d79084cfb516b69c4244098c0767d604ad02f2c3..6337a1c52b86810c638f446c4995e7ee63dbc084 100644
> --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> @@ -1622,6 +1622,71 @@ static void drm_test_check_driver_unsupported_fallback_yuv420(struct kunit *test
> drm_modeset_acquire_fini(&ctx);
> }
>
> +/*
> + * Test that if a driver and screen supports RGB and YUV420 formats, but the
> + * chosen mode cannot be supported by the screen, we end up with unsuccessful
> + * fallback attempts.
> + */
> +static void drm_test_check_display_unsupported_fallback_rgb_yuv420(struct kunit *test)
> +{
> + struct drm_atomic_helper_connector_hdmi_priv *priv;
> + struct drm_modeset_acquire_ctx ctx;
> + struct drm_crtc_state *crtc_state;
> + struct drm_atomic_state *state;
> + struct drm_display_info *info;
> + struct drm_display_mode *preferred, *unsupported_mode;
> + struct drm_connector *conn;
> + struct drm_device *drm;
> + struct drm_crtc *crtc;
> + int ret;
> +
> + priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
> + BIT(HDMI_COLORSPACE_RGB) |
> + BIT(HDMI_COLORSPACE_YUV420),
> + 10,
> + &dummy_connector_hdmi_funcs,
> + test_edid_hdmi_4k_rgb_yuv420_dc_max_340mhz);
> + KUNIT_ASSERT_NOT_NULL(test, priv);
> +
> + drm = &priv->drm;
> + crtc = priv->crtc;
> + conn = &priv->connector;
> + info = &conn->display_info;
> + KUNIT_ASSERT_TRUE(test, info->is_hdmi);
> + KUNIT_ASSERT_TRUE(test, conn->ycbcr_420_allowed);
> +
> + preferred = find_preferred_mode(conn);
> + KUNIT_ASSERT_NOT_NULL(test, preferred);
> +
> + unsupported_mode = drm_kunit_display_mode_from_cea_vic(test, drm, 96);
> + KUNIT_ASSERT_NOT_NULL(test, unsupported_mode);
I'm not sure what this one is supposed to test. If the mode is
unsupported by the screen, it will be for both YUV and RGB, right? So
what are we testing here?
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 12/23] drm/tests: helpers: Add a (re)try helper variant to enable CRTC connector
2025-05-16 13:15 ` Maxime Ripard
@ 2025-05-19 10:20 ` Cristian Ciocaltea
0 siblings, 0 replies; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-05-19 10:20 UTC (permalink / raw)
To: Maxime Ripard
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov, kernel,
dri-devel, linux-kernel
Hi Maxime,
On 5/16/25 4:15 PM, Maxime Ripard wrote:
> Hi,
>
> On Fri, Apr 25, 2025 at 01:27:03PM +0300, Cristian Ciocaltea wrote:
>> Provide a wrapper over drm_kunit_helper_enable_crtc_connector() to
>> automatically handle EDEADLK.
>>
>> This is going to help improve the error handling in a bunch of test
>> cases without open coding the restart of the atomic sequence.
>>
>> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
>> ---
>> drivers/gpu/drm/tests/drm_kunit_helpers.c | 39 +++++++++++++++++++++++++++++++
>> include/drm/drm_kunit_helpers.h | 7 ++++++
>> 2 files changed, 46 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/tests/drm_kunit_helpers.c b/drivers/gpu/drm/tests/drm_kunit_helpers.c
>> index 5f7257840d8ef0aeabe5f00802f5037ed652ae66..4e1174c50b1f2b6358eb740cd73c6d86e53d0df9 100644
>> --- a/drivers/gpu/drm/tests/drm_kunit_helpers.c
>> +++ b/drivers/gpu/drm/tests/drm_kunit_helpers.c
>> @@ -332,6 +332,45 @@ int drm_kunit_helper_enable_crtc_connector(struct kunit *test,
>> }
>> EXPORT_SYMBOL_GPL(drm_kunit_helper_enable_crtc_connector);
>>
>> +/**
>> + * drm_kunit_helper_try_enable_crtc_connector - (Re)tries to enable a CRTC -> Connector output
>> + * @test: The test context object
>> + * @drm: The device to alloc the plane for
>> + * @crtc: The CRTC to enable
>> + * @connector: The Connector to enable
>> + * @mode: The display mode to configure the CRTC with
>> + * @ctx: Locking context
>> + *
>> + * This function is a wrapper over @drm_kunit_helper_enable_crtc_connector
>> + * to automatically handle EDEADLK and (re)try to enable the route from
>> + * @crtc to @connector, with the given @mode.
>> + *
>> + * Returns:
>> + *
>> + * A pointer to the new CRTC, or an ERR_PTR() otherwise.
>> + */
>> +int drm_kunit_helper_try_enable_crtc_connector(struct kunit *test,
>> + struct drm_device *drm,
>> + struct drm_crtc *crtc,
>> + struct drm_connector *connector,
>> + const struct drm_display_mode *mode,
>> + struct drm_modeset_acquire_ctx *ctx)
>> +{
>> + int ret;
>> +
>> +retry_enable:
>> + ret = drm_kunit_helper_enable_crtc_connector(test, drm, crtc, connector,
>> + mode, ctx);
>> + if (ret == -EDEADLK) {
>> + ret = drm_modeset_backoff(ctx);
>> + if (!ret)
>> + goto retry_enable;
>> + }
>> +
>> + return ret;
>> +}
>> +EXPORT_SYMBOL_GPL(drm_kunit_helper_try_enable_crtc_connector);
>
> I'm not sure it's a good idea. This function might affect the locking
> context of the caller without even reporting it.
>
> Generally speaking, I'd really prefer to have explicit locking, even if
> it means slightly more boilerplate.
Ack.
Will drop this patch and the next one for now, and sort this out in a
separate series.
Thanks,
Cristian
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 14/23] drm/tests: hdmi: Add macro to support EDEADLK handling
2025-05-19 7:22 ` Maxime Ripard
@ 2025-05-19 10:35 ` Cristian Ciocaltea
2025-05-22 16:06 ` Maxime Ripard
0 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-05-19 10:35 UTC (permalink / raw)
To: Maxime Ripard
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov, kernel,
dri-devel, linux-kernel
On 5/19/25 10:22 AM, Maxime Ripard wrote:
> Hi,
>
> On Fri, Apr 25, 2025 at 01:27:05PM +0300, Cristian Ciocaltea wrote:
>> In preparation to improve error handling throughout all test cases,
>> introduce a macro to check for EDEADLK and automate the restart of the
>> atomic sequence.
>>
>> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
>> ---
>> drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>> index c8969ee6518954ab4496d3a4398f428bf4104a36..c8bb131d63ea6d0c9e166c8d9ba5e403118cd9f1 100644
>> --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>> +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>> @@ -224,6 +224,16 @@ drm_kunit_helper_connector_hdmi_init(struct kunit *test,
>> test_edid_hdmi_1080p_rgb_max_200mhz);
>> }
>>
>> +#define drm_kunit_atomic_restart_on_deadlock(ret, state, ctx, start) do { \
>> + if (ret == -EDEADLK) { \
>> + if (state) \
>> + drm_atomic_state_clear(state); \
>> + ret = drm_modeset_backoff(ctx); \
>> + if (!ret) \
>> + goto start; \
>> + } \
>> +} while (0)
>> +
>
> I'm not sure here either, for pretty much the same reason. As far as
> locking goes, I really think we should prefer something explicit even if
> it means a bit more boilerplate.
>
> If you still want to push this forward though, this has nothing to do
> with kunit so it should be made a common helper.
Ack.
> I do think it should be
> done in a separate series though. Ever-expanding series are a nightmare,
> both to contribute and to review :)
Indeed, let me take this separately.
If you agree, I'd prefer to drop EDEADLK handling from the new tests as
well, to allow sorting this out for all in a consistent manner.
Thanks,
Cristian
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 23/23] drm/tests: hdmi: Add test for unsupported RGB/YUV420 mode
2025-05-19 8:42 ` Maxime Ripard
@ 2025-05-19 10:55 ` Cristian Ciocaltea
2025-05-22 16:16 ` Maxime Ripard
0 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-05-19 10:55 UTC (permalink / raw)
To: Maxime Ripard
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov, kernel,
dri-devel, linux-kernel
On 5/19/25 11:42 AM, Maxime Ripard wrote:
> Hi,
>
> On Fri, Apr 25, 2025 at 01:27:14PM +0300, Cristian Ciocaltea wrote:
>> Provide a test to verify that if both driver and screen support RGB and
>> YUV420 formats, drm_atomic_helper_connector_hdmi_check() cannot succeed
>> when trying to set a mode unsupported by the display.
>>
>> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
>> ---
>> drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 66 ++++++++++++++++++++++
>> 1 file changed, 66 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>> index d79084cfb516b69c4244098c0767d604ad02f2c3..6337a1c52b86810c638f446c4995e7ee63dbc084 100644
>> --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>> +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>> @@ -1622,6 +1622,71 @@ static void drm_test_check_driver_unsupported_fallback_yuv420(struct kunit *test
>> drm_modeset_acquire_fini(&ctx);
>> }
>>
>> +/*
>> + * Test that if a driver and screen supports RGB and YUV420 formats, but the
>> + * chosen mode cannot be supported by the screen, we end up with unsuccessful
>> + * fallback attempts.
>> + */
>> +static void drm_test_check_display_unsupported_fallback_rgb_yuv420(struct kunit *test)
>> +{
>> + struct drm_atomic_helper_connector_hdmi_priv *priv;
>> + struct drm_modeset_acquire_ctx ctx;
>> + struct drm_crtc_state *crtc_state;
>> + struct drm_atomic_state *state;
>> + struct drm_display_info *info;
>> + struct drm_display_mode *preferred, *unsupported_mode;
>> + struct drm_connector *conn;
>> + struct drm_device *drm;
>> + struct drm_crtc *crtc;
>> + int ret;
>> +
>> + priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
>> + BIT(HDMI_COLORSPACE_RGB) |
>> + BIT(HDMI_COLORSPACE_YUV420),
>> + 10,
>> + &dummy_connector_hdmi_funcs,
>> + test_edid_hdmi_4k_rgb_yuv420_dc_max_340mhz);
>> + KUNIT_ASSERT_NOT_NULL(test, priv);
>> +
>> + drm = &priv->drm;
>> + crtc = priv->crtc;
>> + conn = &priv->connector;
>> + info = &conn->display_info;
>> + KUNIT_ASSERT_TRUE(test, info->is_hdmi);
>> + KUNIT_ASSERT_TRUE(test, conn->ycbcr_420_allowed);
>> +
>> + preferred = find_preferred_mode(conn);
>> + KUNIT_ASSERT_NOT_NULL(test, preferred);
>> +
>> + unsupported_mode = drm_kunit_display_mode_from_cea_vic(test, drm, 96);
>> + KUNIT_ASSERT_NOT_NULL(test, unsupported_mode);
>
> I'm not sure what this one is supposed to test. If the mode is
> unsupported by the screen, it will be for both YUV and RGB, right? So
> what are we testing here?
That would be the case suggested at [1]:
"We still need to do the same with a driver that supports both, but the
monitor doesn't."
Should we drop it?
[1] https://lore.kernel.org/all/20250410-singing-scarlet-carp-d136f9@houat/
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 14/23] drm/tests: hdmi: Add macro to support EDEADLK handling
2025-05-19 10:35 ` Cristian Ciocaltea
@ 2025-05-22 16:06 ` Maxime Ripard
2025-05-22 16:47 ` Cristian Ciocaltea
0 siblings, 1 reply; 52+ messages in thread
From: Maxime Ripard @ 2025-05-22 16:06 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov, kernel,
dri-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2234 bytes --]
On Mon, May 19, 2025 at 01:35:46PM +0300, Cristian Ciocaltea wrote:
> On 5/19/25 10:22 AM, Maxime Ripard wrote:
> > Hi,
> >
> > On Fri, Apr 25, 2025 at 01:27:05PM +0300, Cristian Ciocaltea wrote:
> >> In preparation to improve error handling throughout all test cases,
> >> introduce a macro to check for EDEADLK and automate the restart of the
> >> atomic sequence.
> >>
> >> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
> >> ---
> >> drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 10 ++++++++++
> >> 1 file changed, 10 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> >> index c8969ee6518954ab4496d3a4398f428bf4104a36..c8bb131d63ea6d0c9e166c8d9ba5e403118cd9f1 100644
> >> --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> >> +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> >> @@ -224,6 +224,16 @@ drm_kunit_helper_connector_hdmi_init(struct kunit *test,
> >> test_edid_hdmi_1080p_rgb_max_200mhz);
> >> }
> >>
> >> +#define drm_kunit_atomic_restart_on_deadlock(ret, state, ctx, start) do { \
> >> + if (ret == -EDEADLK) { \
> >> + if (state) \
> >> + drm_atomic_state_clear(state); \
> >> + ret = drm_modeset_backoff(ctx); \
> >> + if (!ret) \
> >> + goto start; \
> >> + } \
> >> +} while (0)
> >> +
> >
> > I'm not sure here either, for pretty much the same reason. As far as
> > locking goes, I really think we should prefer something explicit even if
> > it means a bit more boilerplate.
> >
> > If you still want to push this forward though, this has nothing to do
> > with kunit so it should be made a common helper.
>
> Ack.
>
> > I do think it should be
> > done in a separate series though. Ever-expanding series are a nightmare,
> > both to contribute and to review :)
>
> Indeed, let me take this separately.
>
> If you agree, I'd prefer to drop EDEADLK handling from the new tests as
> well, to allow sorting this out for all in a consistent manner.
We can't unfortunately. Most CI runners now run with WW_DEBUG that will
test for EDEADBLK handling.
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 23/23] drm/tests: hdmi: Add test for unsupported RGB/YUV420 mode
2025-05-19 10:55 ` Cristian Ciocaltea
@ 2025-05-22 16:16 ` Maxime Ripard
2025-05-22 17:37 ` Cristian Ciocaltea
0 siblings, 1 reply; 52+ messages in thread
From: Maxime Ripard @ 2025-05-22 16:16 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov, kernel,
dri-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 3283 bytes --]
Hi,
On Mon, May 19, 2025 at 01:55:10PM +0300, Cristian Ciocaltea wrote:
> On 5/19/25 11:42 AM, Maxime Ripard wrote:
> > Hi,
> >
> > On Fri, Apr 25, 2025 at 01:27:14PM +0300, Cristian Ciocaltea wrote:
> >> Provide a test to verify that if both driver and screen support RGB and
> >> YUV420 formats, drm_atomic_helper_connector_hdmi_check() cannot succeed
> >> when trying to set a mode unsupported by the display.
> >>
> >> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
> >> ---
> >> drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 66 ++++++++++++++++++++++
> >> 1 file changed, 66 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> >> index d79084cfb516b69c4244098c0767d604ad02f2c3..6337a1c52b86810c638f446c4995e7ee63dbc084 100644
> >> --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> >> +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> >> @@ -1622,6 +1622,71 @@ static void drm_test_check_driver_unsupported_fallback_yuv420(struct kunit *test
> >> drm_modeset_acquire_fini(&ctx);
> >> }
> >>
> >> +/*
> >> + * Test that if a driver and screen supports RGB and YUV420 formats, but the
> >> + * chosen mode cannot be supported by the screen, we end up with unsuccessful
> >> + * fallback attempts.
> >> + */
> >> +static void drm_test_check_display_unsupported_fallback_rgb_yuv420(struct kunit *test)
> >> +{
> >> + struct drm_atomic_helper_connector_hdmi_priv *priv;
> >> + struct drm_modeset_acquire_ctx ctx;
> >> + struct drm_crtc_state *crtc_state;
> >> + struct drm_atomic_state *state;
> >> + struct drm_display_info *info;
> >> + struct drm_display_mode *preferred, *unsupported_mode;
> >> + struct drm_connector *conn;
> >> + struct drm_device *drm;
> >> + struct drm_crtc *crtc;
> >> + int ret;
> >> +
> >> + priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
> >> + BIT(HDMI_COLORSPACE_RGB) |
> >> + BIT(HDMI_COLORSPACE_YUV420),
> >> + 10,
> >> + &dummy_connector_hdmi_funcs,
> >> + test_edid_hdmi_4k_rgb_yuv420_dc_max_340mhz);
> >> + KUNIT_ASSERT_NOT_NULL(test, priv);
> >> +
> >> + drm = &priv->drm;
> >> + crtc = priv->crtc;
> >> + conn = &priv->connector;
> >> + info = &conn->display_info;
> >> + KUNIT_ASSERT_TRUE(test, info->is_hdmi);
> >> + KUNIT_ASSERT_TRUE(test, conn->ycbcr_420_allowed);
> >> +
> >> + preferred = find_preferred_mode(conn);
> >> + KUNIT_ASSERT_NOT_NULL(test, preferred);
> >> +
> >> + unsupported_mode = drm_kunit_display_mode_from_cea_vic(test, drm, 96);
> >> + KUNIT_ASSERT_NOT_NULL(test, unsupported_mode);
> >
> > I'm not sure what this one is supposed to test. If the mode is
> > unsupported by the screen, it will be for both YUV and RGB, right? So
> > what are we testing here?
>
> That would be the case suggested at [1]:
>
> "We still need to do the same with a driver that supports both, but the
> monitor doesn't."
>
> Should we drop it?
Ah, I see. I meant that we should normally end up with YUV420 (so mode
is supported by the monitor, but the resolution is too high for RGB and
we should pick YUV instead), but the monitor doesn't support it and thus
we fail.
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 14/23] drm/tests: hdmi: Add macro to support EDEADLK handling
2025-05-22 16:06 ` Maxime Ripard
@ 2025-05-22 16:47 ` Cristian Ciocaltea
2025-05-26 6:44 ` Maxime Ripard
0 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-05-22 16:47 UTC (permalink / raw)
To: Maxime Ripard
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov, kernel,
dri-devel, linux-kernel
On 5/22/25 7:06 PM, Maxime Ripard wrote:
> On Mon, May 19, 2025 at 01:35:46PM +0300, Cristian Ciocaltea wrote:
>> On 5/19/25 10:22 AM, Maxime Ripard wrote:
>>> Hi,
>>>
>>> On Fri, Apr 25, 2025 at 01:27:05PM +0300, Cristian Ciocaltea wrote:
>>>> In preparation to improve error handling throughout all test cases,
>>>> introduce a macro to check for EDEADLK and automate the restart of the
>>>> atomic sequence.
>>>>
>>>> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
>>>> ---
>>>> drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 10 ++++++++++
>>>> 1 file changed, 10 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>>>> index c8969ee6518954ab4496d3a4398f428bf4104a36..c8bb131d63ea6d0c9e166c8d9ba5e403118cd9f1 100644
>>>> --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>>>> +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>>>> @@ -224,6 +224,16 @@ drm_kunit_helper_connector_hdmi_init(struct kunit *test,
>>>> test_edid_hdmi_1080p_rgb_max_200mhz);
>>>> }
>>>>
>>>> +#define drm_kunit_atomic_restart_on_deadlock(ret, state, ctx, start) do { \
>>>> + if (ret == -EDEADLK) { \
>>>> + if (state) \
>>>> + drm_atomic_state_clear(state); \
>>>> + ret = drm_modeset_backoff(ctx); \
>>>> + if (!ret) \
>>>> + goto start; \
>>>> + } \
>>>> +} while (0)
>>>> +
>>>
>>> I'm not sure here either, for pretty much the same reason. As far as
>>> locking goes, I really think we should prefer something explicit even if
>>> it means a bit more boilerplate.
>>>
>>> If you still want to push this forward though, this has nothing to do
>>> with kunit so it should be made a common helper.
>>
>> Ack.
>>
>>> I do think it should be
>>> done in a separate series though. Ever-expanding series are a nightmare,
>>> both to contribute and to review :)
>>
>> Indeed, let me take this separately.
>>
>> If you agree, I'd prefer to drop EDEADLK handling from the new tests as
>> well, to allow sorting this out for all in a consistent manner.
>
> We can't unfortunately. Most CI runners now run with WW_DEBUG that will
> test for EDEADBLK handling.
Ok, in that case I'll proceed with the explicit error handling for the
new tests only. And as soon as the series gets merged, I'll come up
with a common helper and apply it for all tests.
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 23/23] drm/tests: hdmi: Add test for unsupported RGB/YUV420 mode
2025-05-22 16:16 ` Maxime Ripard
@ 2025-05-22 17:37 ` Cristian Ciocaltea
2025-05-27 12:59 ` Maxime Ripard
0 siblings, 1 reply; 52+ messages in thread
From: Cristian Ciocaltea @ 2025-05-22 17:37 UTC (permalink / raw)
To: Maxime Ripard
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov, kernel,
dri-devel, linux-kernel
Hi Maxime,
On 5/22/25 7:16 PM, Maxime Ripard wrote:
> Hi,
>
> On Mon, May 19, 2025 at 01:55:10PM +0300, Cristian Ciocaltea wrote:
>> On 5/19/25 11:42 AM, Maxime Ripard wrote:
>>> Hi,
>>>
>>> On Fri, Apr 25, 2025 at 01:27:14PM +0300, Cristian Ciocaltea wrote:
>>>> Provide a test to verify that if both driver and screen support RGB and
>>>> YUV420 formats, drm_atomic_helper_connector_hdmi_check() cannot succeed
>>>> when trying to set a mode unsupported by the display.
>>>>
>>>> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
>>>> ---
>>>> drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 66 ++++++++++++++++++++++
>>>> 1 file changed, 66 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>>>> index d79084cfb516b69c4244098c0767d604ad02f2c3..6337a1c52b86810c638f446c4995e7ee63dbc084 100644
>>>> --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>>>> +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>>>> @@ -1622,6 +1622,71 @@ static void drm_test_check_driver_unsupported_fallback_yuv420(struct kunit *test
>>>> drm_modeset_acquire_fini(&ctx);
>>>> }
>>>>
>>>> +/*
>>>> + * Test that if a driver and screen supports RGB and YUV420 formats, but the
>>>> + * chosen mode cannot be supported by the screen, we end up with unsuccessful
>>>> + * fallback attempts.
>>>> + */
>>>> +static void drm_test_check_display_unsupported_fallback_rgb_yuv420(struct kunit *test)
>>>> +{
>>>> + struct drm_atomic_helper_connector_hdmi_priv *priv;
>>>> + struct drm_modeset_acquire_ctx ctx;
>>>> + struct drm_crtc_state *crtc_state;
>>>> + struct drm_atomic_state *state;
>>>> + struct drm_display_info *info;
>>>> + struct drm_display_mode *preferred, *unsupported_mode;
>>>> + struct drm_connector *conn;
>>>> + struct drm_device *drm;
>>>> + struct drm_crtc *crtc;
>>>> + int ret;
>>>> +
>>>> + priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
>>>> + BIT(HDMI_COLORSPACE_RGB) |
>>>> + BIT(HDMI_COLORSPACE_YUV420),
>>>> + 10,
>>>> + &dummy_connector_hdmi_funcs,
>>>> + test_edid_hdmi_4k_rgb_yuv420_dc_max_340mhz);
>>>> + KUNIT_ASSERT_NOT_NULL(test, priv);
>>>> +
>>>> + drm = &priv->drm;
>>>> + crtc = priv->crtc;
>>>> + conn = &priv->connector;
>>>> + info = &conn->display_info;
>>>> + KUNIT_ASSERT_TRUE(test, info->is_hdmi);
>>>> + KUNIT_ASSERT_TRUE(test, conn->ycbcr_420_allowed);
>>>> +
>>>> + preferred = find_preferred_mode(conn);
>>>> + KUNIT_ASSERT_NOT_NULL(test, preferred);
>>>> +
>>>> + unsupported_mode = drm_kunit_display_mode_from_cea_vic(test, drm, 96);
>>>> + KUNIT_ASSERT_NOT_NULL(test, unsupported_mode);
>>>
>>> I'm not sure what this one is supposed to test. If the mode is
>>> unsupported by the screen, it will be for both YUV and RGB, right? So
>>> what are we testing here?
>>
>> That would be the case suggested at [1]:
>>
>> "We still need to do the same with a driver that supports both, but the
>> monitor doesn't."
>>
>> Should we drop it?
>
> Ah, I see. I meant that we should normally end up with YUV420 (so mode
> is supported by the monitor, but the resolution is too high for RGB and
> we should pick YUV instead), but the monitor doesn't support it and thus
> we fail.
If I get it right, to verify this scenario we'd need a new test EDID
that basically advertises an RGB mode which is not actually supported by
the screen, i.e. the mode requires a TMDS rate which exceeds the maximum
supported by the display for any of the available color depths.
But that's not something we should encounter in practice, is it? I mean
the EDID would be wrong, as it doesn't match the hardware capabilities.
Regardless, assuming this is solely for the purpose of testing the
framework, I will try to come up with a test case. The only problem
is generating the EDID - which is a really annoying process, as I've
already mentioned a while ago [1].
Hence I'm wondering if we could move on without it for the moment (I'll
get back to it ASAP).
[1] https://lore.kernel.org/all/8b0a8a7a-456a-487f-853e-5ec3e11129d7@collabora.com/
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 14/23] drm/tests: hdmi: Add macro to support EDEADLK handling
2025-05-22 16:47 ` Cristian Ciocaltea
@ 2025-05-26 6:44 ` Maxime Ripard
0 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-05-26 6:44 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov, kernel,
dri-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2695 bytes --]
On Thu, May 22, 2025 at 07:47:00PM +0300, Cristian Ciocaltea wrote:
> On 5/22/25 7:06 PM, Maxime Ripard wrote:
> > On Mon, May 19, 2025 at 01:35:46PM +0300, Cristian Ciocaltea wrote:
> >> On 5/19/25 10:22 AM, Maxime Ripard wrote:
> >>> Hi,
> >>>
> >>> On Fri, Apr 25, 2025 at 01:27:05PM +0300, Cristian Ciocaltea wrote:
> >>>> In preparation to improve error handling throughout all test cases,
> >>>> introduce a macro to check for EDEADLK and automate the restart of the
> >>>> atomic sequence.
> >>>>
> >>>> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
> >>>> ---
> >>>> drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 10 ++++++++++
> >>>> 1 file changed, 10 insertions(+)
> >>>>
> >>>> diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> >>>> index c8969ee6518954ab4496d3a4398f428bf4104a36..c8bb131d63ea6d0c9e166c8d9ba5e403118cd9f1 100644
> >>>> --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> >>>> +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> >>>> @@ -224,6 +224,16 @@ drm_kunit_helper_connector_hdmi_init(struct kunit *test,
> >>>> test_edid_hdmi_1080p_rgb_max_200mhz);
> >>>> }
> >>>>
> >>>> +#define drm_kunit_atomic_restart_on_deadlock(ret, state, ctx, start) do { \
> >>>> + if (ret == -EDEADLK) { \
> >>>> + if (state) \
> >>>> + drm_atomic_state_clear(state); \
> >>>> + ret = drm_modeset_backoff(ctx); \
> >>>> + if (!ret) \
> >>>> + goto start; \
> >>>> + } \
> >>>> +} while (0)
> >>>> +
> >>>
> >>> I'm not sure here either, for pretty much the same reason. As far as
> >>> locking goes, I really think we should prefer something explicit even if
> >>> it means a bit more boilerplate.
> >>>
> >>> If you still want to push this forward though, this has nothing to do
> >>> with kunit so it should be made a common helper.
> >>
> >> Ack.
> >>
> >>> I do think it should be
> >>> done in a separate series though. Ever-expanding series are a nightmare,
> >>> both to contribute and to review :)
> >>
> >> Indeed, let me take this separately.
> >>
> >> If you agree, I'd prefer to drop EDEADLK handling from the new tests as
> >> well, to allow sorting this out for all in a consistent manner.
> >
> > We can't unfortunately. Most CI runners now run with WW_DEBUG that will
> > test for EDEADBLK handling.
>
> Ok, in that case I'll proceed with the explicit error handling for the
> new tests only. And as soon as the series gets merged, I'll come up
> with a common helper and apply it for all tests.
Sounds like a good plan :)
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v4 23/23] drm/tests: hdmi: Add test for unsupported RGB/YUV420 mode
2025-05-22 17:37 ` Cristian Ciocaltea
@ 2025-05-27 12:59 ` Maxime Ripard
0 siblings, 0 replies; 52+ messages in thread
From: Maxime Ripard @ 2025-05-27 12:59 UTC (permalink / raw)
To: Cristian Ciocaltea
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Dmitry Baryshkov, Dmitry Baryshkov, kernel,
dri-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 4496 bytes --]
On Thu, May 22, 2025 at 08:37:31PM +0300, Cristian Ciocaltea wrote:
> Hi Maxime,
>
> On 5/22/25 7:16 PM, Maxime Ripard wrote:
> > Hi,
> >
> > On Mon, May 19, 2025 at 01:55:10PM +0300, Cristian Ciocaltea wrote:
> >> On 5/19/25 11:42 AM, Maxime Ripard wrote:
> >>> Hi,
> >>>
> >>> On Fri, Apr 25, 2025 at 01:27:14PM +0300, Cristian Ciocaltea wrote:
> >>>> Provide a test to verify that if both driver and screen support RGB and
> >>>> YUV420 formats, drm_atomic_helper_connector_hdmi_check() cannot succeed
> >>>> when trying to set a mode unsupported by the display.
> >>>>
> >>>> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
> >>>> ---
> >>>> drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 66 ++++++++++++++++++++++
> >>>> 1 file changed, 66 insertions(+)
> >>>>
> >>>> diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> >>>> index d79084cfb516b69c4244098c0767d604ad02f2c3..6337a1c52b86810c638f446c4995e7ee63dbc084 100644
> >>>> --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> >>>> +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> >>>> @@ -1622,6 +1622,71 @@ static void drm_test_check_driver_unsupported_fallback_yuv420(struct kunit *test
> >>>> drm_modeset_acquire_fini(&ctx);
> >>>> }
> >>>>
> >>>> +/*
> >>>> + * Test that if a driver and screen supports RGB and YUV420 formats, but the
> >>>> + * chosen mode cannot be supported by the screen, we end up with unsuccessful
> >>>> + * fallback attempts.
> >>>> + */
> >>>> +static void drm_test_check_display_unsupported_fallback_rgb_yuv420(struct kunit *test)
> >>>> +{
> >>>> + struct drm_atomic_helper_connector_hdmi_priv *priv;
> >>>> + struct drm_modeset_acquire_ctx ctx;
> >>>> + struct drm_crtc_state *crtc_state;
> >>>> + struct drm_atomic_state *state;
> >>>> + struct drm_display_info *info;
> >>>> + struct drm_display_mode *preferred, *unsupported_mode;
> >>>> + struct drm_connector *conn;
> >>>> + struct drm_device *drm;
> >>>> + struct drm_crtc *crtc;
> >>>> + int ret;
> >>>> +
> >>>> + priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
> >>>> + BIT(HDMI_COLORSPACE_RGB) |
> >>>> + BIT(HDMI_COLORSPACE_YUV420),
> >>>> + 10,
> >>>> + &dummy_connector_hdmi_funcs,
> >>>> + test_edid_hdmi_4k_rgb_yuv420_dc_max_340mhz);
> >>>> + KUNIT_ASSERT_NOT_NULL(test, priv);
> >>>> +
> >>>> + drm = &priv->drm;
> >>>> + crtc = priv->crtc;
> >>>> + conn = &priv->connector;
> >>>> + info = &conn->display_info;
> >>>> + KUNIT_ASSERT_TRUE(test, info->is_hdmi);
> >>>> + KUNIT_ASSERT_TRUE(test, conn->ycbcr_420_allowed);
> >>>> +
> >>>> + preferred = find_preferred_mode(conn);
> >>>> + KUNIT_ASSERT_NOT_NULL(test, preferred);
> >>>> +
> >>>> + unsupported_mode = drm_kunit_display_mode_from_cea_vic(test, drm, 96);
> >>>> + KUNIT_ASSERT_NOT_NULL(test, unsupported_mode);
> >>>
> >>> I'm not sure what this one is supposed to test. If the mode is
> >>> unsupported by the screen, it will be for both YUV and RGB, right? So
> >>> what are we testing here?
> >>
> >> That would be the case suggested at [1]:
> >>
> >> "We still need to do the same with a driver that supports both, but the
> >> monitor doesn't."
> >>
> >> Should we drop it?
> >
> > Ah, I see. I meant that we should normally end up with YUV420 (so mode
> > is supported by the monitor, but the resolution is too high for RGB and
> > we should pick YUV instead), but the monitor doesn't support it and thus
> > we fail.
>
> If I get it right, to verify this scenario we'd need a new test EDID
> that basically advertises an RGB mode which is not actually supported by
> the screen, i.e. the mode requires a TMDS rate which exceeds the maximum
> supported by the display for any of the available color depths.
>
> But that's not something we should encounter in practice, is it? I mean
> the EDID would be wrong, as it doesn't match the hardware capabilities.
>
> Regardless, assuming this is solely for the purpose of testing the
> framework, I will try to come up with a test case. The only problem
> is generating the EDID - which is a really annoying process, as I've
> already mentioned a while ago [1].
>
> Hence I'm wondering if we could move on without it for the moment (I'll
> get back to it ASAP).
Oh, right, you're correct, I think we don't need to care, and we can
just skip that patch.
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 52+ messages in thread
end of thread, other threads:[~2025-05-27 12:59 UTC | newest]
Thread overview: 52+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-25 10:26 [PATCH v4 00/23] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
2025-04-25 10:26 ` [PATCH v4 01/23] drm/connector: hdmi: Evaluate limited range after computing format Cristian Ciocaltea
2025-04-25 10:26 ` [PATCH v4 02/23] drm/connector: hdmi: Add support for YUV420 format verification Cristian Ciocaltea
2025-04-25 10:26 ` [PATCH v4 03/23] drm/connector: hdmi: Improve debug message for supported format Cristian Ciocaltea
2025-04-25 10:26 ` [PATCH v4 04/23] drm/connector: hdmi: Add missing bpc debug info to hdmi_try_format_bpc() Cristian Ciocaltea
2025-04-25 10:26 ` [PATCH v4 05/23] drm/connector: hdmi: Factor out bpc and format computation logic Cristian Ciocaltea
2025-04-25 10:26 ` [PATCH v4 06/23] drm/connector: hdmi: Use YUV420 output format as an RGB fallback Cristian Ciocaltea
2025-05-13 13:35 ` Maxime Ripard
2025-05-15 12:44 ` Cristian Ciocaltea
2025-05-15 14:52 ` Maxime Ripard
2025-04-25 10:26 ` [PATCH v4 07/23] drm/tests: hdmi: Replace '[_]MHz' with 'mhz' Cristian Ciocaltea
2025-04-26 2:06 ` Dmitry Baryshkov
2025-04-25 10:26 ` [PATCH v4 08/23] drm/tests: hdmi: Add macro to simplify EDID setup Cristian Ciocaltea
2025-04-28 9:52 ` Jani Nikula
2025-04-29 9:58 ` Cristian Ciocaltea
2025-05-13 13:45 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 09/23] drm/tests: hdmi: Replace open coded " Cristian Ciocaltea
2025-05-15 15:35 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 10/23] drm/tests: hdmi: Drop unused drm_kunit_helper_connector_hdmi_init_funcs() Cristian Ciocaltea
2025-05-16 13:06 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 11/23] drm/tests: hdmi: Setup ycbcr_420_allowed before initializing connector Cristian Ciocaltea
2025-04-25 10:27 ` [PATCH v4 12/23] drm/tests: helpers: Add a (re)try helper variant to enable CRTC connector Cristian Ciocaltea
2025-05-16 13:15 ` Maxime Ripard
2025-05-19 10:20 ` Cristian Ciocaltea
2025-04-25 10:27 ` [PATCH v4 13/23] drm/tests: hdmi: Switch to drm_kunit_helper_try_enable_crtc_connector() Cristian Ciocaltea
2025-04-25 10:27 ` [PATCH v4 14/23] drm/tests: hdmi: Add macro to support EDEADLK handling Cristian Ciocaltea
2025-05-19 7:22 ` Maxime Ripard
2025-05-19 10:35 ` Cristian Ciocaltea
2025-05-22 16:06 ` Maxime Ripard
2025-05-22 16:47 ` Cristian Ciocaltea
2025-05-26 6:44 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 15/23] drm/tests: hdmi: Restart atomic sequence on EDEADLK Cristian Ciocaltea
2025-04-25 10:27 ` [PATCH v4 16/23] drm/tests: hdmi: Switch to drm_atomic_get_new_connector_state() where possible Cristian Ciocaltea
2025-05-19 7:23 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 17/23] drm/tests: hdmi: Provide EDID supporting 4K@30Hz with YUV420 only Cristian Ciocaltea
2025-05-19 7:57 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 18/23] drm/tests: hdmi: Add limited range tests for YUV420 mode Cristian Ciocaltea
2025-05-19 7:58 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 19/23] drm/tests: hdmi: Rename max TMDS rate fallback tests Cristian Ciocaltea
2025-05-19 8:38 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 20/23] drm/tests: hdmi: Provide EDID supporting 4K@30Hz with RGB/YUV Cristian Ciocaltea
2025-05-19 7:57 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 21/23] drm/tests: hdmi: Add max TMDS rate fallback tests for YUV420 mode Cristian Ciocaltea
2025-05-19 8:40 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 22/23] drm/tests: hdmi: Add test for unsuccessful fallback to YUV420 Cristian Ciocaltea
2025-05-19 8:41 ` Maxime Ripard
2025-04-25 10:27 ` [PATCH v4 23/23] drm/tests: hdmi: Add test for unsupported RGB/YUV420 mode Cristian Ciocaltea
2025-05-19 8:42 ` Maxime Ripard
2025-05-19 10:55 ` Cristian Ciocaltea
2025-05-22 16:16 ` Maxime Ripard
2025-05-22 17:37 ` Cristian Ciocaltea
2025-05-27 12:59 ` Maxime Ripard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).