Lines Matching full:test

4  * Kunit test for drm_hdmi_state_helper functions
25 #include <kunit/test.h>
58 static int light_up_connector(struct kunit *test, in light_up_connector() argument
70 state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); in light_up_connector()
71 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); in light_up_connector()
74 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); in light_up_connector()
77 KUNIT_EXPECT_EQ(test, ret, 0); in light_up_connector()
80 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state); in light_up_connector()
83 KUNIT_EXPECT_EQ(test, ret, 0); in light_up_connector()
89 KUNIT_ASSERT_EQ(test, ret, 0); in light_up_connector()
94 static int set_connector_edid(struct kunit *test, struct drm_connector *connector, in set_connector_edid() argument
108 KUNIT_ASSERT_GT(test, ret, 0); in set_connector_edid()
167 drm_atomic_helper_connector_hdmi_init(struct kunit *test, in drm_atomic_helper_connector_hdmi_init() argument
178 dev = drm_kunit_helper_alloc_device(test); in drm_atomic_helper_connector_hdmi_init()
179 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev); in drm_atomic_helper_connector_hdmi_init()
181 priv = drm_kunit_helper_alloc_drm_device(test, dev, in drm_atomic_helper_connector_hdmi_init()
184 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv); in drm_atomic_helper_connector_hdmi_init()
185 test->priv = priv; in drm_atomic_helper_connector_hdmi_init()
188 priv->plane = drm_kunit_helper_create_primary_plane(test, drm, in drm_atomic_helper_connector_hdmi_init()
193 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->plane); in drm_atomic_helper_connector_hdmi_init()
195 priv->crtc = drm_kunit_helper_create_crtc(test, drm, in drm_atomic_helper_connector_hdmi_init()
199 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->crtc); in drm_atomic_helper_connector_hdmi_init()
203 KUNIT_ASSERT_EQ(test, ret, 0); in drm_atomic_helper_connector_hdmi_init()
216 KUNIT_ASSERT_EQ(test, ret, 0); in drm_atomic_helper_connector_hdmi_init()
223 ret = set_connector_edid(test, conn, in drm_atomic_helper_connector_hdmi_init()
226 KUNIT_ASSERT_EQ(test, ret, 0); in drm_atomic_helper_connector_hdmi_init()
232 * Test that if we change the RGB quantization property to a different
236 static void drm_test_check_broadcast_rgb_crtc_mode_changed(struct kunit *test) in drm_test_check_broadcast_rgb_crtc_mode_changed() argument
250 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_broadcast_rgb_crtc_mode_changed()
253 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_broadcast_rgb_crtc_mode_changed()
255 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_broadcast_rgb_crtc_mode_changed()
256 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_broadcast_rgb_crtc_mode_changed()
260 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_broadcast_rgb_crtc_mode_changed()
264 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_broadcast_rgb_crtc_mode_changed()
265 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_broadcast_rgb_crtc_mode_changed()
267 state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); in drm_test_check_broadcast_rgb_crtc_mode_changed()
268 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); in drm_test_check_broadcast_rgb_crtc_mode_changed()
271 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state); in drm_test_check_broadcast_rgb_crtc_mode_changed()
274 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, old_conn_state); in drm_test_check_broadcast_rgb_crtc_mode_changed()
278 KUNIT_ASSERT_NE(test, in drm_test_check_broadcast_rgb_crtc_mode_changed()
283 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_broadcast_rgb_crtc_mode_changed()
286 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state); in drm_test_check_broadcast_rgb_crtc_mode_changed()
287 KUNIT_EXPECT_EQ(test, new_conn_state->hdmi.broadcast_rgb, DRM_HDMI_BROADCAST_RGB_FULL); in drm_test_check_broadcast_rgb_crtc_mode_changed()
290 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state); in drm_test_check_broadcast_rgb_crtc_mode_changed()
291 KUNIT_EXPECT_TRUE(test, crtc_state->mode_changed); in drm_test_check_broadcast_rgb_crtc_mode_changed()
295 * Test that if we set the RGB quantization property to the same value,
299 static void drm_test_check_broadcast_rgb_crtc_mode_not_changed(struct kunit *test) in drm_test_check_broadcast_rgb_crtc_mode_not_changed() argument
313 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_broadcast_rgb_crtc_mode_not_changed()
316 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_broadcast_rgb_crtc_mode_not_changed()
318 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_broadcast_rgb_crtc_mode_not_changed()
319 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_broadcast_rgb_crtc_mode_not_changed()
323 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_broadcast_rgb_crtc_mode_not_changed()
327 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_broadcast_rgb_crtc_mode_not_changed()
328 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_broadcast_rgb_crtc_mode_not_changed()
330 state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); in drm_test_check_broadcast_rgb_crtc_mode_not_changed()
331 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); in drm_test_check_broadcast_rgb_crtc_mode_not_changed()
334 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state); in drm_test_check_broadcast_rgb_crtc_mode_not_changed()
337 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, old_conn_state); in drm_test_check_broadcast_rgb_crtc_mode_not_changed()
342 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_broadcast_rgb_crtc_mode_not_changed()
345 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, old_conn_state); in drm_test_check_broadcast_rgb_crtc_mode_not_changed()
348 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state); in drm_test_check_broadcast_rgb_crtc_mode_not_changed()
350 KUNIT_EXPECT_EQ(test, in drm_test_check_broadcast_rgb_crtc_mode_not_changed()
355 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state); in drm_test_check_broadcast_rgb_crtc_mode_not_changed()
356 KUNIT_EXPECT_FALSE(test, crtc_state->mode_changed); in drm_test_check_broadcast_rgb_crtc_mode_not_changed()
360 * Test that for an HDMI connector, with an HDMI monitor, if the
364 static void drm_test_check_broadcast_rgb_auto_cea_mode(struct kunit *test) in drm_test_check_broadcast_rgb_auto_cea_mode() argument
376 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_broadcast_rgb_auto_cea_mode()
379 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_broadcast_rgb_auto_cea_mode()
382 KUNIT_ASSERT_TRUE(test, conn->display_info.is_hdmi); in drm_test_check_broadcast_rgb_auto_cea_mode()
384 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_broadcast_rgb_auto_cea_mode()
385 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_broadcast_rgb_auto_cea_mode()
388 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_broadcast_rgb_auto_cea_mode()
389 KUNIT_ASSERT_NE(test, drm_match_cea_mode(preferred), 1); in drm_test_check_broadcast_rgb_auto_cea_mode()
393 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_broadcast_rgb_auto_cea_mode()
394 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_broadcast_rgb_auto_cea_mode()
396 state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); in drm_test_check_broadcast_rgb_auto_cea_mode()
397 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); in drm_test_check_broadcast_rgb_auto_cea_mode()
400 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); in drm_test_check_broadcast_rgb_auto_cea_mode()
402 KUNIT_ASSERT_EQ(test, in drm_test_check_broadcast_rgb_auto_cea_mode()
407 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_broadcast_rgb_auto_cea_mode()
410 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); in drm_test_check_broadcast_rgb_auto_cea_mode()
412 KUNIT_EXPECT_TRUE(test, conn_state->hdmi.is_limited_range); in drm_test_check_broadcast_rgb_auto_cea_mode()
416 * Test that for an HDMI connector, with an HDMI monitor, if the
420 static void drm_test_check_broadcast_rgb_auto_cea_mode_vic_1(struct kunit *test) in drm_test_check_broadcast_rgb_auto_cea_mode_vic_1() argument
432 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_broadcast_rgb_auto_cea_mode_vic_1()
435 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_broadcast_rgb_auto_cea_mode_vic_1()
439 KUNIT_ASSERT_TRUE(test, conn->display_info.is_hdmi); in drm_test_check_broadcast_rgb_auto_cea_mode_vic_1()
441 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_broadcast_rgb_auto_cea_mode_vic_1()
442 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_broadcast_rgb_auto_cea_mode_vic_1()
444 mode = drm_kunit_display_mode_from_cea_vic(test, drm, 1); in drm_test_check_broadcast_rgb_auto_cea_mode_vic_1()
445 KUNIT_ASSERT_NOT_NULL(test, mode); in drm_test_check_broadcast_rgb_auto_cea_mode_vic_1()
449 ret = light_up_connector(test, drm, crtc, conn, mode, ctx); in drm_test_check_broadcast_rgb_auto_cea_mode_vic_1()
450 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_broadcast_rgb_auto_cea_mode_vic_1()
452 state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); in drm_test_check_broadcast_rgb_auto_cea_mode_vic_1()
453 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); in drm_test_check_broadcast_rgb_auto_cea_mode_vic_1()
456 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); in drm_test_check_broadcast_rgb_auto_cea_mode_vic_1()
458 KUNIT_ASSERT_EQ(test, in drm_test_check_broadcast_rgb_auto_cea_mode_vic_1()
463 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_broadcast_rgb_auto_cea_mode_vic_1()
466 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); in drm_test_check_broadcast_rgb_auto_cea_mode_vic_1()
468 KUNIT_EXPECT_FALSE(test, conn_state->hdmi.is_limited_range); in drm_test_check_broadcast_rgb_auto_cea_mode_vic_1()
472 * Test that for an HDMI connector, with an HDMI monitor, if the
476 static void drm_test_check_broadcast_rgb_full_cea_mode(struct kunit *test) in drm_test_check_broadcast_rgb_full_cea_mode() argument
488 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_broadcast_rgb_full_cea_mode()
491 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_broadcast_rgb_full_cea_mode()
494 KUNIT_ASSERT_TRUE(test, conn->display_info.is_hdmi); in drm_test_check_broadcast_rgb_full_cea_mode()
496 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_broadcast_rgb_full_cea_mode()
497 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_broadcast_rgb_full_cea_mode()
500 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_broadcast_rgb_full_cea_mode()
501 KUNIT_ASSERT_NE(test, drm_match_cea_mode(preferred), 1); in drm_test_check_broadcast_rgb_full_cea_mode()
505 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_broadcast_rgb_full_cea_mode()
506 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_broadcast_rgb_full_cea_mode()
508 state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); in drm_test_check_broadcast_rgb_full_cea_mode()
509 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); in drm_test_check_broadcast_rgb_full_cea_mode()
512 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); in drm_test_check_broadcast_rgb_full_cea_mode()
517 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_broadcast_rgb_full_cea_mode()
520 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); in drm_test_check_broadcast_rgb_full_cea_mode()
522 KUNIT_ASSERT_EQ(test, in drm_test_check_broadcast_rgb_full_cea_mode()
526 KUNIT_EXPECT_FALSE(test, conn_state->hdmi.is_limited_range); in drm_test_check_broadcast_rgb_full_cea_mode()
530 * Test that for an HDMI connector, with an HDMI monitor, if the
534 static void drm_test_check_broadcast_rgb_full_cea_mode_vic_1(struct kunit *test) in drm_test_check_broadcast_rgb_full_cea_mode_vic_1() argument
546 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_broadcast_rgb_full_cea_mode_vic_1()
549 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_broadcast_rgb_full_cea_mode_vic_1()
553 KUNIT_ASSERT_TRUE(test, conn->display_info.is_hdmi); in drm_test_check_broadcast_rgb_full_cea_mode_vic_1()
555 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_broadcast_rgb_full_cea_mode_vic_1()
556 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_broadcast_rgb_full_cea_mode_vic_1()
558 mode = drm_kunit_display_mode_from_cea_vic(test, drm, 1); in drm_test_check_broadcast_rgb_full_cea_mode_vic_1()
559 KUNIT_ASSERT_NOT_NULL(test, mode); in drm_test_check_broadcast_rgb_full_cea_mode_vic_1()
563 ret = light_up_connector(test, drm, crtc, conn, mode, ctx); in drm_test_check_broadcast_rgb_full_cea_mode_vic_1()
564 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_broadcast_rgb_full_cea_mode_vic_1()
566 state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); in drm_test_check_broadcast_rgb_full_cea_mode_vic_1()
567 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); in drm_test_check_broadcast_rgb_full_cea_mode_vic_1()
570 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); in drm_test_check_broadcast_rgb_full_cea_mode_vic_1()
575 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_broadcast_rgb_full_cea_mode_vic_1()
578 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); in drm_test_check_broadcast_rgb_full_cea_mode_vic_1()
580 KUNIT_ASSERT_EQ(test, in drm_test_check_broadcast_rgb_full_cea_mode_vic_1()
584 KUNIT_EXPECT_FALSE(test, conn_state->hdmi.is_limited_range); in drm_test_check_broadcast_rgb_full_cea_mode_vic_1()
588 * Test that for an HDMI connector, with an HDMI monitor, if the
592 static void drm_test_check_broadcast_rgb_limited_cea_mode(struct kunit *test) in drm_test_check_broadcast_rgb_limited_cea_mode() argument
604 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_broadcast_rgb_limited_cea_mode()
607 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_broadcast_rgb_limited_cea_mode()
610 KUNIT_ASSERT_TRUE(test, conn->display_info.is_hdmi); in drm_test_check_broadcast_rgb_limited_cea_mode()
612 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_broadcast_rgb_limited_cea_mode()
613 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_broadcast_rgb_limited_cea_mode()
616 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_broadcast_rgb_limited_cea_mode()
617 KUNIT_ASSERT_NE(test, drm_match_cea_mode(preferred), 1); in drm_test_check_broadcast_rgb_limited_cea_mode()
621 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_broadcast_rgb_limited_cea_mode()
622 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_broadcast_rgb_limited_cea_mode()
624 state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); in drm_test_check_broadcast_rgb_limited_cea_mode()
625 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); in drm_test_check_broadcast_rgb_limited_cea_mode()
628 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); in drm_test_check_broadcast_rgb_limited_cea_mode()
633 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_broadcast_rgb_limited_cea_mode()
636 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); in drm_test_check_broadcast_rgb_limited_cea_mode()
638 KUNIT_ASSERT_EQ(test, in drm_test_check_broadcast_rgb_limited_cea_mode()
642 KUNIT_EXPECT_TRUE(test, conn_state->hdmi.is_limited_range); in drm_test_check_broadcast_rgb_limited_cea_mode()
646 * Test that for an HDMI connector, with an HDMI monitor, if the
650 static void drm_test_check_broadcast_rgb_limited_cea_mode_vic_1(struct kunit *test) in drm_test_check_broadcast_rgb_limited_cea_mode_vic_1() argument
662 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_broadcast_rgb_limited_cea_mode_vic_1()
665 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_broadcast_rgb_limited_cea_mode_vic_1()
669 KUNIT_ASSERT_TRUE(test, conn->display_info.is_hdmi); in drm_test_check_broadcast_rgb_limited_cea_mode_vic_1()
671 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_broadcast_rgb_limited_cea_mode_vic_1()
672 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_broadcast_rgb_limited_cea_mode_vic_1()
674 mode = drm_kunit_display_mode_from_cea_vic(test, drm, 1); in drm_test_check_broadcast_rgb_limited_cea_mode_vic_1()
675 KUNIT_ASSERT_NOT_NULL(test, mode); in drm_test_check_broadcast_rgb_limited_cea_mode_vic_1()
679 ret = light_up_connector(test, drm, crtc, conn, mode, ctx); in drm_test_check_broadcast_rgb_limited_cea_mode_vic_1()
680 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_broadcast_rgb_limited_cea_mode_vic_1()
682 state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); in drm_test_check_broadcast_rgb_limited_cea_mode_vic_1()
683 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); in drm_test_check_broadcast_rgb_limited_cea_mode_vic_1()
686 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); in drm_test_check_broadcast_rgb_limited_cea_mode_vic_1()
691 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_broadcast_rgb_limited_cea_mode_vic_1()
694 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); in drm_test_check_broadcast_rgb_limited_cea_mode_vic_1()
696 KUNIT_ASSERT_EQ(test, in drm_test_check_broadcast_rgb_limited_cea_mode_vic_1()
700 KUNIT_EXPECT_TRUE(test, conn_state->hdmi.is_limited_range); in drm_test_check_broadcast_rgb_limited_cea_mode_vic_1()
704 * Test that if we change the maximum bpc property to a different value,
708 static void drm_test_check_output_bpc_crtc_mode_changed(struct kunit *test) in drm_test_check_output_bpc_crtc_mode_changed() argument
722 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_output_bpc_crtc_mode_changed()
725 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_output_bpc_crtc_mode_changed()
728 ret = set_connector_edid(test, conn, in drm_test_check_output_bpc_crtc_mode_changed()
731 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_output_bpc_crtc_mode_changed()
733 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_output_bpc_crtc_mode_changed()
734 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_output_bpc_crtc_mode_changed()
737 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_output_bpc_crtc_mode_changed()
741 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_output_bpc_crtc_mode_changed()
742 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_output_bpc_crtc_mode_changed()
744 state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); in drm_test_check_output_bpc_crtc_mode_changed()
745 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); in drm_test_check_output_bpc_crtc_mode_changed()
748 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state); in drm_test_check_output_bpc_crtc_mode_changed()
751 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, old_conn_state); in drm_test_check_output_bpc_crtc_mode_changed()
755 KUNIT_ASSERT_NE(test, in drm_test_check_output_bpc_crtc_mode_changed()
760 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_output_bpc_crtc_mode_changed()
763 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, old_conn_state); in drm_test_check_output_bpc_crtc_mode_changed()
766 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state); in drm_test_check_output_bpc_crtc_mode_changed()
768 KUNIT_ASSERT_NE(test, in drm_test_check_output_bpc_crtc_mode_changed()
773 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state); in drm_test_check_output_bpc_crtc_mode_changed()
774 KUNIT_EXPECT_TRUE(test, crtc_state->mode_changed); in drm_test_check_output_bpc_crtc_mode_changed()
778 * Test that if we set the output bpc property to the same value, we
782 static void drm_test_check_output_bpc_crtc_mode_not_changed(struct kunit *test) in drm_test_check_output_bpc_crtc_mode_not_changed() argument
796 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_output_bpc_crtc_mode_not_changed()
799 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_output_bpc_crtc_mode_not_changed()
802 ret = set_connector_edid(test, conn, in drm_test_check_output_bpc_crtc_mode_not_changed()
805 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_output_bpc_crtc_mode_not_changed()
807 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_output_bpc_crtc_mode_not_changed()
808 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_output_bpc_crtc_mode_not_changed()
811 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_output_bpc_crtc_mode_not_changed()
815 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_output_bpc_crtc_mode_not_changed()
816 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_output_bpc_crtc_mode_not_changed()
818 state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); in drm_test_check_output_bpc_crtc_mode_not_changed()
819 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); in drm_test_check_output_bpc_crtc_mode_not_changed()
822 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state); in drm_test_check_output_bpc_crtc_mode_not_changed()
825 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, old_conn_state); in drm_test_check_output_bpc_crtc_mode_not_changed()
827 KUNIT_ASSERT_EQ(test, in drm_test_check_output_bpc_crtc_mode_not_changed()
832 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_output_bpc_crtc_mode_not_changed()
835 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, old_conn_state); in drm_test_check_output_bpc_crtc_mode_not_changed()
838 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state); in drm_test_check_output_bpc_crtc_mode_not_changed()
840 KUNIT_EXPECT_EQ(test, in drm_test_check_output_bpc_crtc_mode_not_changed()
845 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state); in drm_test_check_output_bpc_crtc_mode_not_changed()
846 KUNIT_EXPECT_FALSE(test, crtc_state->mode_changed); in drm_test_check_output_bpc_crtc_mode_not_changed()
850 * Test that if we have an HDMI connector but a !HDMI display, we always
853 static void drm_test_check_output_bpc_dvi(struct kunit *test) in drm_test_check_output_bpc_dvi() argument
865 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_output_bpc_dvi()
870 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_output_bpc_dvi()
873 ret = set_connector_edid(test, conn, in drm_test_check_output_bpc_dvi()
876 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_output_bpc_dvi()
879 KUNIT_ASSERT_FALSE(test, info->is_hdmi); in drm_test_check_output_bpc_dvi()
881 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_output_bpc_dvi()
882 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_output_bpc_dvi()
885 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_output_bpc_dvi()
889 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_output_bpc_dvi()
890 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_output_bpc_dvi()
893 KUNIT_ASSERT_NOT_NULL(test, conn_state); in drm_test_check_output_bpc_dvi()
895 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 8); in drm_test_check_output_bpc_dvi()
896 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); in drm_test_check_output_bpc_dvi()
900 * Test that when doing a commit which would use RGB 8bpc, the TMDS
903 static void drm_test_check_tmds_char_rate_rgb_8bpc(struct kunit *test) in drm_test_check_tmds_char_rate_rgb_8bpc() argument
914 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_tmds_char_rate_rgb_8bpc()
917 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_tmds_char_rate_rgb_8bpc()
920 ret = set_connector_edid(test, conn, in drm_test_check_tmds_char_rate_rgb_8bpc()
923 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_tmds_char_rate_rgb_8bpc()
925 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_tmds_char_rate_rgb_8bpc()
926 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_tmds_char_rate_rgb_8bpc()
929 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_tmds_char_rate_rgb_8bpc()
930 KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK); in drm_test_check_tmds_char_rate_rgb_8bpc()
934 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_tmds_char_rate_rgb_8bpc()
935 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_tmds_char_rate_rgb_8bpc()
938 KUNIT_ASSERT_NOT_NULL(test, conn_state); in drm_test_check_tmds_char_rate_rgb_8bpc()
940 KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_bpc, 8); in drm_test_check_tmds_char_rate_rgb_8bpc()
941 KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); in drm_test_check_tmds_char_rate_rgb_8bpc()
942 KUNIT_EXPECT_EQ(test, conn_state->hdmi.tmds_char_rate, preferred->clock * 1000); in drm_test_check_tmds_char_rate_rgb_8bpc()
946 * Test that when doing a commit which would use RGB 10bpc, the TMDS
950 static void drm_test_check_tmds_char_rate_rgb_10bpc(struct kunit *test) in drm_test_check_tmds_char_rate_rgb_10bpc() argument
961 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_tmds_char_rate_rgb_10bpc()
964 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_tmds_char_rate_rgb_10bpc()
967 ret = set_connector_edid(test, conn, in drm_test_check_tmds_char_rate_rgb_10bpc()
970 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_tmds_char_rate_rgb_10bpc()
972 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_tmds_char_rate_rgb_10bpc()
973 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_tmds_char_rate_rgb_10bpc()
976 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_tmds_char_rate_rgb_10bpc()
977 KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK); in drm_test_check_tmds_char_rate_rgb_10bpc()
981 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_tmds_char_rate_rgb_10bpc()
982 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_tmds_char_rate_rgb_10bpc()
985 KUNIT_ASSERT_NOT_NULL(test, conn_state); in drm_test_check_tmds_char_rate_rgb_10bpc()
987 KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_bpc, 10); in drm_test_check_tmds_char_rate_rgb_10bpc()
988 KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); in drm_test_check_tmds_char_rate_rgb_10bpc()
989 KUNIT_EXPECT_EQ(test, conn_state->hdmi.tmds_char_rate, preferred->clock * 1250); in drm_test_check_tmds_char_rate_rgb_10bpc()
993 * Test that when doing a commit which would use RGB 12bpc, the TMDS
997 static void drm_test_check_tmds_char_rate_rgb_12bpc(struct kunit *test) in drm_test_check_tmds_char_rate_rgb_12bpc() argument
1008 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_tmds_char_rate_rgb_12bpc()
1011 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_tmds_char_rate_rgb_12bpc()
1014 ret = set_connector_edid(test, conn, in drm_test_check_tmds_char_rate_rgb_12bpc()
1017 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_tmds_char_rate_rgb_12bpc()
1019 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_tmds_char_rate_rgb_12bpc()
1020 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_tmds_char_rate_rgb_12bpc()
1023 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_tmds_char_rate_rgb_12bpc()
1024 KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK); in drm_test_check_tmds_char_rate_rgb_12bpc()
1028 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_tmds_char_rate_rgb_12bpc()
1029 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_tmds_char_rate_rgb_12bpc()
1032 KUNIT_ASSERT_NOT_NULL(test, conn_state); in drm_test_check_tmds_char_rate_rgb_12bpc()
1034 KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_bpc, 12); in drm_test_check_tmds_char_rate_rgb_12bpc()
1035 KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); in drm_test_check_tmds_char_rate_rgb_12bpc()
1036 KUNIT_EXPECT_EQ(test, conn_state->hdmi.tmds_char_rate, preferred->clock * 1500); in drm_test_check_tmds_char_rate_rgb_12bpc()
1040 * Test that if we filter a rate through our hook, it's indeed rejected
1047 static void drm_test_check_hdmi_funcs_reject_rate(struct kunit *test) in drm_test_check_hdmi_funcs_reject_rate() argument
1059 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_hdmi_funcs_reject_rate()
1062 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_hdmi_funcs_reject_rate()
1064 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_hdmi_funcs_reject_rate()
1065 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_hdmi_funcs_reject_rate()
1069 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_hdmi_funcs_reject_rate()
1073 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_hdmi_funcs_reject_rate()
1074 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_hdmi_funcs_reject_rate()
1079 state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); in drm_test_check_hdmi_funcs_reject_rate()
1080 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); in drm_test_check_hdmi_funcs_reject_rate()
1083 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state); in drm_test_check_hdmi_funcs_reject_rate()
1088 KUNIT_EXPECT_LT(test, ret, 0); in drm_test_check_hdmi_funcs_reject_rate()
1092 * Test that if:
1102 static void drm_test_check_max_tmds_rate_bpc_fallback(struct kunit *test) in drm_test_check_max_tmds_rate_bpc_fallback() argument
1115 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_max_tmds_rate_bpc_fallback()
1118 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_max_tmds_rate_bpc_fallback()
1121 ret = set_connector_edid(test, conn, in drm_test_check_max_tmds_rate_bpc_fallback()
1124 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_max_tmds_rate_bpc_fallback()
1127 KUNIT_ASSERT_TRUE(test, info->is_hdmi); in drm_test_check_max_tmds_rate_bpc_fallback()
1128 KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0); in drm_test_check_max_tmds_rate_bpc_fallback()
1130 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_max_tmds_rate_bpc_fallback()
1131 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_max_tmds_rate_bpc_fallback()
1134 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_max_tmds_rate_bpc_fallback()
1135 KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK); in drm_test_check_max_tmds_rate_bpc_fallback()
1138 KUNIT_ASSERT_GT(test, rate, info->max_tmds_clock * 1000); in drm_test_check_max_tmds_rate_bpc_fallback()
1141 KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); in drm_test_check_max_tmds_rate_bpc_fallback()
1145 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_max_tmds_rate_bpc_fallback()
1146 KUNIT_EXPECT_EQ(test, ret, 0); in drm_test_check_max_tmds_rate_bpc_fallback()
1149 KUNIT_ASSERT_NOT_NULL(test, conn_state); in drm_test_check_max_tmds_rate_bpc_fallback()
1151 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 10); in drm_test_check_max_tmds_rate_bpc_fallback()
1152 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); in drm_test_check_max_tmds_rate_bpc_fallback()
1153 KUNIT_EXPECT_EQ(test, conn_state->hdmi.tmds_char_rate, preferred->clock * 1250); in drm_test_check_max_tmds_rate_bpc_fallback()
1157 * Test that if:
1169 static void drm_test_check_max_tmds_rate_format_fallback(struct kunit *test) in drm_test_check_max_tmds_rate_format_fallback() argument
1182 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_max_tmds_rate_format_fallback()
1187 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_max_tmds_rate_format_fallback()
1190 ret = set_connector_edid(test, conn, in drm_test_check_max_tmds_rate_format_fallback()
1193 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_max_tmds_rate_format_fallback()
1196 KUNIT_ASSERT_TRUE(test, info->is_hdmi); in drm_test_check_max_tmds_rate_format_fallback()
1197 KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0); in drm_test_check_max_tmds_rate_format_fallback()
1199 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_max_tmds_rate_format_fallback()
1200 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_max_tmds_rate_format_fallback()
1203 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_max_tmds_rate_format_fallback()
1204 KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK); in drm_test_check_max_tmds_rate_format_fallback()
1207 KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); in drm_test_check_max_tmds_rate_format_fallback()
1210 KUNIT_ASSERT_GT(test, rate, info->max_tmds_clock * 1000); in drm_test_check_max_tmds_rate_format_fallback()
1213 KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); in drm_test_check_max_tmds_rate_format_fallback()
1217 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_max_tmds_rate_format_fallback()
1218 KUNIT_EXPECT_EQ(test, ret, 0); in drm_test_check_max_tmds_rate_format_fallback()
1221 KUNIT_ASSERT_NOT_NULL(test, conn_state); in drm_test_check_max_tmds_rate_format_fallback()
1223 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 10); in drm_test_check_max_tmds_rate_format_fallback()
1224 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); in drm_test_check_max_tmds_rate_format_fallback()
1228 * Test that if a driver and screen supports RGB and YUV formats, and we
1232 static void drm_test_check_output_bpc_format_vic_1(struct kunit *test) in drm_test_check_output_bpc_format_vic_1() argument
1245 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_output_bpc_format_vic_1()
1250 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_output_bpc_format_vic_1()
1254 ret = set_connector_edid(test, conn, in drm_test_check_output_bpc_format_vic_1()
1257 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_output_bpc_format_vic_1()
1260 KUNIT_ASSERT_TRUE(test, info->is_hdmi); in drm_test_check_output_bpc_format_vic_1()
1261 KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0); in drm_test_check_output_bpc_format_vic_1()
1263 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_output_bpc_format_vic_1()
1264 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_output_bpc_format_vic_1()
1266 mode = drm_kunit_display_mode_from_cea_vic(test, drm, 1); in drm_test_check_output_bpc_format_vic_1()
1267 KUNIT_ASSERT_NOT_NULL(test, mode); in drm_test_check_output_bpc_format_vic_1()
1277 KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); in drm_test_check_output_bpc_format_vic_1()
1281 ret = light_up_connector(test, drm, crtc, conn, mode, ctx); in drm_test_check_output_bpc_format_vic_1()
1282 KUNIT_EXPECT_EQ(test, ret, 0); in drm_test_check_output_bpc_format_vic_1()
1285 KUNIT_ASSERT_NOT_NULL(test, conn_state); in drm_test_check_output_bpc_format_vic_1()
1287 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 8); in drm_test_check_output_bpc_format_vic_1()
1288 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); in drm_test_check_output_bpc_format_vic_1()
1292 * Test that if a driver supports only RGB but the screen also supports
1295 static void drm_test_check_output_bpc_format_driver_rgb_only(struct kunit *test) in drm_test_check_output_bpc_format_driver_rgb_only() argument
1308 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_output_bpc_format_driver_rgb_only()
1311 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_output_bpc_format_driver_rgb_only()
1314 ret = set_connector_edid(test, conn, in drm_test_check_output_bpc_format_driver_rgb_only()
1317 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_output_bpc_format_driver_rgb_only()
1320 KUNIT_ASSERT_TRUE(test, info->is_hdmi); in drm_test_check_output_bpc_format_driver_rgb_only()
1321 KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0); in drm_test_check_output_bpc_format_driver_rgb_only()
1323 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_output_bpc_format_driver_rgb_only()
1324 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_output_bpc_format_driver_rgb_only()
1327 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_output_bpc_format_driver_rgb_only()
1339 KUNIT_ASSERT_GT(test, rate, info->max_tmds_clock * 1000); in drm_test_check_output_bpc_format_driver_rgb_only()
1342 KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); in drm_test_check_output_bpc_format_driver_rgb_only()
1346 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_output_bpc_format_driver_rgb_only()
1347 KUNIT_EXPECT_EQ(test, ret, 0); in drm_test_check_output_bpc_format_driver_rgb_only()
1350 KUNIT_ASSERT_NOT_NULL(test, conn_state); in drm_test_check_output_bpc_format_driver_rgb_only()
1352 KUNIT_EXPECT_LT(test, conn_state->hdmi.output_bpc, 12); in drm_test_check_output_bpc_format_driver_rgb_only()
1353 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); in drm_test_check_output_bpc_format_driver_rgb_only()
1357 * Test that if a screen supports only RGB but the driver also supports
1360 static void drm_test_check_output_bpc_format_display_rgb_only(struct kunit *test) in drm_test_check_output_bpc_format_display_rgb_only() argument
1373 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_output_bpc_format_display_rgb_only()
1378 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_output_bpc_format_display_rgb_only()
1381 ret = set_connector_edid(test, conn, in drm_test_check_output_bpc_format_display_rgb_only()
1384 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_output_bpc_format_display_rgb_only()
1387 KUNIT_ASSERT_TRUE(test, info->is_hdmi); in drm_test_check_output_bpc_format_display_rgb_only()
1388 KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0); in drm_test_check_output_bpc_format_display_rgb_only()
1390 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_output_bpc_format_display_rgb_only()
1391 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_output_bpc_format_display_rgb_only()
1394 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_output_bpc_format_display_rgb_only()
1406 KUNIT_ASSERT_GT(test, rate, info->max_tmds_clock * 1000); in drm_test_check_output_bpc_format_display_rgb_only()
1409 KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); in drm_test_check_output_bpc_format_display_rgb_only()
1413 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_output_bpc_format_display_rgb_only()
1414 KUNIT_EXPECT_EQ(test, ret, 0); in drm_test_check_output_bpc_format_display_rgb_only()
1417 KUNIT_ASSERT_NOT_NULL(test, conn_state); in drm_test_check_output_bpc_format_display_rgb_only()
1419 KUNIT_EXPECT_LT(test, conn_state->hdmi.output_bpc, 12); in drm_test_check_output_bpc_format_display_rgb_only()
1420 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); in drm_test_check_output_bpc_format_display_rgb_only()
1424 * Test that if a display supports higher bpc but the driver only
1428 static void drm_test_check_output_bpc_format_driver_8bpc_only(struct kunit *test) in drm_test_check_output_bpc_format_driver_8bpc_only() argument
1441 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_output_bpc_format_driver_8bpc_only()
1444 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_output_bpc_format_driver_8bpc_only()
1447 ret = set_connector_edid(test, conn, in drm_test_check_output_bpc_format_driver_8bpc_only()
1450 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_output_bpc_format_driver_8bpc_only()
1453 KUNIT_ASSERT_TRUE(test, info->is_hdmi); in drm_test_check_output_bpc_format_driver_8bpc_only()
1454 KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0); in drm_test_check_output_bpc_format_driver_8bpc_only()
1456 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_output_bpc_format_driver_8bpc_only()
1457 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_output_bpc_format_driver_8bpc_only()
1460 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_output_bpc_format_driver_8bpc_only()
1467 KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); in drm_test_check_output_bpc_format_driver_8bpc_only()
1471 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_output_bpc_format_driver_8bpc_only()
1472 KUNIT_EXPECT_EQ(test, ret, 0); in drm_test_check_output_bpc_format_driver_8bpc_only()
1475 KUNIT_ASSERT_NOT_NULL(test, conn_state); in drm_test_check_output_bpc_format_driver_8bpc_only()
1477 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 8); in drm_test_check_output_bpc_format_driver_8bpc_only()
1478 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); in drm_test_check_output_bpc_format_driver_8bpc_only()
1482 * Test that if a driver supports higher bpc but the display only
1486 static void drm_test_check_output_bpc_format_display_8bpc_only(struct kunit *test) in drm_test_check_output_bpc_format_display_8bpc_only() argument
1499 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_output_bpc_format_display_8bpc_only()
1504 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_output_bpc_format_display_8bpc_only()
1507 ret = set_connector_edid(test, conn, in drm_test_check_output_bpc_format_display_8bpc_only()
1510 KUNIT_ASSERT_EQ(test, ret, 0); in drm_test_check_output_bpc_format_display_8bpc_only()
1513 KUNIT_ASSERT_TRUE(test, info->is_hdmi); in drm_test_check_output_bpc_format_display_8bpc_only()
1514 KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0); in drm_test_check_output_bpc_format_display_8bpc_only()
1516 ctx = drm_kunit_helper_acquire_ctx_alloc(test); in drm_test_check_output_bpc_format_display_8bpc_only()
1517 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); in drm_test_check_output_bpc_format_display_8bpc_only()
1520 KUNIT_ASSERT_NOT_NULL(test, preferred); in drm_test_check_output_bpc_format_display_8bpc_only()
1527 KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); in drm_test_check_output_bpc_format_display_8bpc_only()
1531 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx); in drm_test_check_output_bpc_format_display_8bpc_only()
1532 KUNIT_EXPECT_EQ(test, ret, 0); in drm_test_check_output_bpc_format_display_8bpc_only()
1535 KUNIT_ASSERT_NOT_NULL(test, conn_state); in drm_test_check_output_bpc_format_display_8bpc_only()
1537 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 8); in drm_test_check_output_bpc_format_display_8bpc_only()
1538 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); in drm_test_check_output_bpc_format_display_8bpc_only()
1587 * Test that the value of the Broadcast RGB property out of reset is set
1590 static void drm_test_check_broadcast_rgb_value(struct kunit *test) in drm_test_check_broadcast_rgb_value() argument
1596 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_broadcast_rgb_value()
1599 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_broadcast_rgb_value()
1603 KUNIT_EXPECT_EQ(test, conn_state->hdmi.broadcast_rgb, DRM_HDMI_BROADCAST_RGB_AUTO); in drm_test_check_broadcast_rgb_value()
1607 * Test that if the connector was initialised with a maximum bpc of 8,
1612 static void drm_test_check_bpc_8_value(struct kunit *test) in drm_test_check_bpc_8_value() argument
1618 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_bpc_8_value()
1621 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_bpc_8_value()
1625 KUNIT_EXPECT_EQ(test, conn_state->max_bpc, 8); in drm_test_check_bpc_8_value()
1626 KUNIT_EXPECT_EQ(test, conn_state->max_requested_bpc, 8); in drm_test_check_bpc_8_value()
1627 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 0); in drm_test_check_bpc_8_value()
1631 * Test that if the connector was initialised with a maximum bpc of 10,
1636 static void drm_test_check_bpc_10_value(struct kunit *test) in drm_test_check_bpc_10_value() argument
1642 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_bpc_10_value()
1645 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_bpc_10_value()
1649 KUNIT_EXPECT_EQ(test, conn_state->max_bpc, 10); in drm_test_check_bpc_10_value()
1650 KUNIT_EXPECT_EQ(test, conn_state->max_requested_bpc, 10); in drm_test_check_bpc_10_value()
1651 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 0); in drm_test_check_bpc_10_value()
1655 * Test that if the connector was initialised with a maximum bpc of 12,
1660 static void drm_test_check_bpc_12_value(struct kunit *test) in drm_test_check_bpc_12_value() argument
1666 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_bpc_12_value()
1669 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_bpc_12_value()
1673 KUNIT_EXPECT_EQ(test, conn_state->max_bpc, 12); in drm_test_check_bpc_12_value()
1674 KUNIT_EXPECT_EQ(test, conn_state->max_requested_bpc, 12); in drm_test_check_bpc_12_value()
1675 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 0); in drm_test_check_bpc_12_value()
1679 * Test that the value of the output format property out of reset is set
1682 static void drm_test_check_format_value(struct kunit *test) in drm_test_check_format_value() argument
1688 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_format_value()
1693 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_format_value()
1697 KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, 0); in drm_test_check_format_value()
1701 * Test that the value of the output format property out of reset is set
1704 static void drm_test_check_tmds_char_value(struct kunit *test) in drm_test_check_tmds_char_value() argument
1710 priv = drm_atomic_helper_connector_hdmi_init(test, in drm_test_check_tmds_char_value()
1715 KUNIT_ASSERT_NOT_NULL(test, priv); in drm_test_check_tmds_char_value()
1719 KUNIT_EXPECT_EQ(test, conn_state->hdmi.tmds_char_rate, 0); in drm_test_check_tmds_char_value()
1743 MODULE_DESCRIPTION("Kunit test for drm_hdmi_state_helper functions");