drm/tests: Add output formats tests

Now that we track the HDMI output format as part of the connector state,
let's add a few tests to make sure it works as expected.

Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240527-kms-hdmi-connector-state-v15-8-c5af16c3aae2@kernel.org
Signed-off-by: Maxime Ripard <mripard@kernel.org>
This commit is contained in:
Maxime Ripard
2024-05-27 15:57:57 +02:00
parent 948f01d5e5
commit 08eeaa134e
2 changed files with 130 additions and 1 deletions

View File

@@ -349,6 +349,15 @@ static void drm_test_check_output_bpc_crtc_mode_not_changed(struct kunit *test)
static struct kunit_case drm_atomic_helper_connector_hdmi_check_tests[] = {
KUNIT_CASE(drm_test_check_output_bpc_crtc_mode_changed),
KUNIT_CASE(drm_test_check_output_bpc_crtc_mode_not_changed),
/*
* TODO: We should have tests to check that a change in the
* format triggers a CRTC mode change just like we do for the
* RGB Quantization and BPC.
*
* However, we don't have any way to control which format gets
* picked up aside from changing the BPC or mode which would
* already trigger a mode change.
*/
{ }
};
@@ -429,10 +438,33 @@ static void drm_test_check_bpc_12_value(struct kunit *test)
KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 0);
}
/*
* Test that the value of the output format property out of reset is set
* to RGB, even if the driver supports more than that.
*/
static void drm_test_check_format_value(struct kunit *test)
{
struct drm_atomic_helper_connector_hdmi_priv *priv;
struct drm_connector_state *conn_state;
struct drm_connector *conn;
priv = drm_atomic_helper_connector_hdmi_init(test,
BIT(HDMI_COLORSPACE_RGB) |
BIT(HDMI_COLORSPACE_YUV422) |
BIT(HDMI_COLORSPACE_YUV444),
8);
KUNIT_ASSERT_NOT_NULL(test, priv);
conn = &priv->connector;
conn_state = conn->state;
KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB);
}
static struct kunit_case drm_atomic_helper_connector_hdmi_reset_tests[] = {
KUNIT_CASE(drm_test_check_bpc_8_value),
KUNIT_CASE(drm_test_check_bpc_10_value),
KUNIT_CASE(drm_test_check_bpc_12_value),
KUNIT_CASE(drm_test_check_format_value),
{ }
};