mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 <lumag@kernel.org>,
	kernel@collabora.com, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 23/23] drm/tests: hdmi: Add test for unsupported RGB/YUV420 mode
Date: Thu, 22 May 2025 20:37:31 +0300	[thread overview]
Message-ID: <2a8554af-5b5b-4402-a065-a3e765f9ca4f@collabora.com> (raw)
In-Reply-To: <20250522-mutant-emu-of-youth-ae70cd@houat>

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/


  reply	other threads:[~2025-05-22 17:37 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-05-27 12:59           ` Maxime Ripard

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=2a8554af-5b5b-4402-a065-a3e765f9ca4f@collabora.com \
    --to=cristian.ciocaltea@collabora.com \
    --cc=airlied@gmail.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumag@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®