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
Attachment:
signature.asc
Description: PGP signature