[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241202-nickel-rottweiler-of-hail-c9ec8b@houat>
Date: Mon, 2 Dec 2024 11:32:21 +0100
From: Maxime Ripard <mripard@...nel.org>
To: Sean Nyekjaer <sean@...nix.com>
Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, Chen-Yu Tsai <wens@...e.org>,
Jernej Skrabec <jernej.skrabec@...il.com>, Samuel Holland <samuel@...lland.org>,
Yannick Fertre <yannick.fertre@...s.st.com>, Raphael Gallais-Pou <raphael.gallais-pou@...s.st.com>,
Philippe Cornu <philippe.cornu@...s.st.com>, Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>, dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-sunxi@...ts.linux.dev,
linux-stm32@...md-mailman.stormreply.com
Subject: Re: [PATCH v2 1/3] drm/modes: introduce drm_mode_validate_mode()
helper function
On Tue, Nov 26, 2024 at 02:30:53PM +0100, Sean Nyekjaer wrote:
> Hi Maxime,
>
> On Tue, Nov 26, 2024 at 08:36:01AM +0100, Sean Nyekjaer wrote:
> > Hi Maxime,
> >
>
> [...]
>
> > >
> > > We probably need some kunit tests here too.
> >
> > Good idea, will be my first :)
> >
>
> Would something like this work?
>
> 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 294773342e71..26e4ff02df85 100644
> --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> @@ -1364,6 +1364,7 @@ static void drm_test_check_output_bpc_format_display_rgb_only(struct kunit *test
> struct drm_connector_state *conn_state;
> struct drm_display_info *info;
> struct drm_display_mode *preferred;
> + enum drm_mode_status mode_status;
> unsigned long long rate;
> struct drm_connector *conn;
> struct drm_device *drm;
> @@ -1408,6 +1409,9 @@ static void drm_test_check_output_bpc_format_display_rgb_only(struct kunit *test
> rate = drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_YUV422);
> KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000);
>
> + mode_status = drm_mode_check_pixel_clock(preferred, rate);
> + KUNIT_ASSERT_EQ(test, mode_status, MODE_OK);
> +
Not really. You need to test that function, and ideally only that
function, with a bunch of random inputs, including the error conditions.
Maxime
Download attachment "signature.asc" of type "application/pgp-signature" (274 bytes)
Powered by blists - more mailing lists