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 15/15] drm/tests: hdmi: Add test for unsuccessful forced fallback to YUV420
Date: Thu, 10 Apr 2025 15:07:40 +0300 [thread overview]
Message-ID: <a4a2680a-eaf7-4505-afbd-b3a71dd46d5a@collabora.com> (raw)
In-Reply-To: <20250410-singing-scarlet-carp-d136f9@houat>
On 4/10/25 12:21 PM, Maxime Ripard wrote:
> Hi,
>
> On Wed, Mar 26, 2025 at 12:20:04PM +0200, Cristian Ciocaltea wrote:
>> Provide test to verify a forced 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 | 46 ++++++++++++++++++++++
>> 1 file changed, 46 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 99bedb2d6f555b3b140256000dfa7491d2a8f515..c2976b42aa2aacd2a68a871bffe97e795ca713d4 100644
>> --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>> +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
>> @@ -1493,6 +1493,51 @@ static void drm_test_check_max_tmds_rate_format_fallback_yuv420(struct kunit *te
>> 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
>> + * an unsuccessful forced fallback attempt.
>
> What do you mean by "forced"?
I wanted to describe the context where there's no alternative other than
doing the fallback. Should we replace with "mandatory" maybe?
>> + */
>> +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_display_info *info;
>> + struct drm_display_mode *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(test,
>> + BIT(HDMI_COLORSPACE_RGB),
>> + 12,
>> + 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);
>> +
>> + 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_enable_crtc_connector(test, drm,
>> + crtc, conn,
>> + yuv420_only_mode,
>> + &ctx);
>> + KUNIT_EXPECT_LT(test, ret, 0);
>
> I think that's where your current approach falls a bit short. You should
> really craft the state yourself and check the returned value of
> drm_atomic_check_only(), not rely on
> drm_kunit_helper_enable_crtc_connector() doing the right thing, when it
> doesn't really tell you :)
Ack.
>
>> + drm_modeset_drop_locks(&ctx);
>> + drm_modeset_acquire_fini(&ctx);
>> +}
>> +
>
> We still need to do the same with a driver that supports both, but the
> monitor doesn't.
Ack.
Thanks,
Cristian
prev parent reply other threads:[~2025-04-10 12:07 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
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 [this message]
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=a4a2680a-eaf7-4505-afbd-b3a71dd46d5a@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®