From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
To: Maxime Ripard <mripard@kernel.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Dave Stevenson <dave.stevenson@raspberrypi.com>,
Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
kernel@collabora.com, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 13/15] drm/tests: hdmi: Add limited range tests for YUV420 mode
Date: Thu, 10 Apr 2025 14:23:54 +0300 [thread overview]
Message-ID: <4df10482-2082-4542-912f-c9ebc3803b6f@collabora.com> (raw)
In-Reply-To: <20250410-daffodil-toucanet-of-effort-b4dcbd@houat>
On 4/10/25 10:18 AM, Maxime Ripard wrote:
> On Wed, Mar 26, 2025 at 12:20:02PM +0200, 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.
>>
>> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
>> ---
>> drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 89 +++++++++++++++-
>> drivers/gpu/drm/tests/drm_kunit_edid.h | 112 +++++++++++++++++++++
>> 2 files changed, 196 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 6897515189a0649a267196b246944efc92ace336..3fae7ccf65309a1d8a4acf12de961713b9163096 100644
>> --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>> +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>> @@ -731,6 +731,88 @@ 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(test,
>> + BIT(HDMI_COLORSPACE_RGB) |
>> + BIT(HDMI_COLORSPACE_YUV420),
>> + 8,
>> + 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_enable_crtc_connector(test, drm,
>> + crtc, conn,
>> + mode, &ctx);
>> + KUNIT_ASSERT_EQ(test, ret, 0);
>
> drm_kunit_helper_enable_crtc_connector() can return EDEADLK, so you need
> to handle it and restart the sequence if it happens.
Right, there are actually many users of the helper since
6a5c0ad7e08e ("drm/tests: hdmi_state_helpers: Switch to new helper")
Probably a stupid question, as I haven't checked which are the mandatory
operations of the restart sequence, but I wonder if this could be
handled inside the helper instead of trying to fix all test cases.
>> + state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
>> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
>> +
>> + conn_state = drm_atomic_get_connector_state(state, conn);
>> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
>
> Ditto.
>
>> + conn_state->hdmi.broadcast_rgb = broadcast_rgb;
>> +
>> + ret = drm_atomic_check_only(state);
>> + KUNIT_ASSERT_EQ(test, ret, 0);
>> +
>> + conn_state = drm_atomic_get_connector_state(state, conn);
>> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
>
> Ditto, but I'm not sure you need drm_atomic_get_connector_state() here.
> We know at this point that the state is there and we don't need to
> allocate it anymore. drm_atomic_get_new_connector_state() will probably
> be enough
Will check.
> and that one can't return EDEADLK.
Same question as above, could we handle EDEADLK at helper(s) level to
avoid open coding the restart sequence?
Thanks,
Cristian
next prev parent reply other threads:[~2025-04-10 11:23 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-26 10:19 [PATCH v3 00/15] drm/connector: hdmi: Allow using the YUV420 output format Cristian Ciocaltea
2025-03-26 10:19 ` [PATCH v3 01/15] drm/connector: hdmi: Evaluate limited range after computing format Cristian Ciocaltea
2025-03-26 10:19 ` [PATCH v3 02/15] drm/connector: hdmi: Add support for YUV420 format verification Cristian Ciocaltea
2025-04-09 15:04 ` Maxime Ripard
2025-03-26 10:19 ` [PATCH v3 03/15] drm/connector: hdmi: Improve debug message for supported format Cristian Ciocaltea
2025-03-26 10:19 ` [PATCH v3 04/15] drm/connector: hdmi: Add missing bpc debug info to hdmi_try_format_bpc() Cristian Ciocaltea
2025-03-30 21:18 ` Dmitry Baryshkov
2025-03-26 10:19 ` [PATCH v3 05/15] drm/connector: hdmi: Rename hdmi_compute_format() internal helper Cristian Ciocaltea
2025-03-26 10:19 ` [PATCH v3 06/15] drm/connector: hdmi: Factor out bpc and format computation logic Cristian Ciocaltea
2025-04-09 15:02 ` Maxime Ripard
2025-04-10 10:06 ` Cristian Ciocaltea
2025-03-26 10:19 ` [PATCH v3 07/15] drm/connector: hdmi: Use YUV420 output format as an RGB fallback Cristian Ciocaltea
2025-04-09 15:09 ` Maxime Ripard
2025-04-10 10:08 ` Cristian Ciocaltea
2025-03-26 10:19 ` [PATCH v3 08/15] drm/tests: hdmi: Add macros to simplify EDID setup Cristian Ciocaltea
2025-04-09 15:11 ` Maxime Ripard
2025-03-26 10:19 ` [PATCH v3 09/15] drm/tests: hdmi: Fixup CamelCase warning Cristian Ciocaltea
2025-04-09 15:13 ` Maxime Ripard
2025-04-10 10:16 ` Cristian Ciocaltea
2025-03-26 10:19 ` [PATCH v3 10/15] drm/tests: hdmi: Replace open coded EDID setup Cristian Ciocaltea
2025-04-09 15:15 ` Maxime Ripard
2025-04-10 10:27 ` Cristian Ciocaltea
2025-03-26 10:20 ` [PATCH v3 11/15] drm/tests: hdmi: Drop unused drm_kunit_helper_connector_hdmi_init_funcs() Cristian Ciocaltea
2025-04-09 15:24 ` Maxime Ripard
2025-04-10 10:37 ` Cristian Ciocaltea
2025-03-26 10:20 ` [PATCH v3 12/15] drm/tests: hdmi: Setup ycbcr_420_allowed before initializing connector Cristian Ciocaltea
2025-04-09 15:15 ` Maxime Ripard
2025-03-26 10:20 ` [PATCH v3 13/15] drm/tests: hdmi: Add limited range tests for YUV420 mode Cristian Ciocaltea
2025-04-10 7:18 ` Maxime Ripard
2025-04-10 11:23 ` Cristian Ciocaltea [this message]
2025-03-26 10:20 ` [PATCH v3 14/15] drm/tests: hdmi: Add max TMDS rate fallback " Cristian Ciocaltea
2025-04-10 8:35 ` Maxime Ripard
2025-04-10 12:00 ` Cristian Ciocaltea
2025-03-26 10:20 ` [PATCH v3 15/15] drm/tests: hdmi: Add test for unsuccessful forced fallback to YUV420 Cristian Ciocaltea
2025-04-10 9:21 ` Maxime Ripard
2025-04-10 12:07 ` Cristian Ciocaltea
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4df10482-2082-4542-912f-c9ebc3803b6f@collabora.com \
--to=cristian.ciocaltea@collabora.com \
--cc=airlied@gmail.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=dmitry.baryshkov@linaro.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®