ret = i2c_add_adapter(&priv->ddc);
KUNIT_ASSERT_EQ(test, ret, 0);
ret = kunit_add_action_or_reset(test, i2c_del_adapter_wrapper, &priv->ddc);
KUNIT_ASSERT_EQ(test, ret, 0);
test->priv = priv; return 0;
}
/* * Test that the registration of a bog standard connector works as * expected and doesn't report any error.
*/ staticvoid drm_test_drmm_connector_init(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; int ret;
/* * Test that the registration of a connector without a DDC adapter * doesn't report any error.
*/ staticvoid drm_test_drmm_connector_init_null_ddc(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; int ret;
/* * Test that the registration of a connector succeeds for all possible * connector types.
*/ staticvoid drm_test_drmm_connector_init_type_valid(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; unsignedint connector_type = *(unsignedint *)test->param_value; int ret;
/* * Test that the initialization of a bog standard dynamic connector works * as expected and doesn't report any error.
*/ staticvoid drm_test_drm_connector_dynamic_init(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; struct drm_connector *connector = &priv->connector; int ret;
/* * Test that the initialization of a dynamic connector without a DDC adapter * doesn't report any error.
*/ staticvoid drm_test_drm_connector_dynamic_init_null_ddc(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; struct drm_connector *connector = &priv->connector; int ret;
/* * Test that the initialization of a dynamic connector doesn't add the * connector to the connector list.
*/ staticvoid drm_test_drm_connector_dynamic_init_not_added(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; struct drm_connector *connector = &priv->connector; int ret;
/* TODO: Check property value in the connector state. */
}
/* * Test that the initialization of a dynamic connector adds all the expected * properties to it.
*/ staticvoid drm_test_drm_connector_dynamic_init_properties(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; struct drm_connector *connector = &priv->connector; struct drm_mode_config *config = &priv->drm.mode_config; conststruct drm_property *props[] = {
config->edid_property,
config->dpms_property,
config->link_status_property,
config->non_desktop_property,
config->tile_property,
config->prop_crtc_id,
}; int ret; int i;
ret = drm_connector_dynamic_init(&priv->drm, connector,
&dummy_dynamic_init_funcs,
DRM_MODE_CONNECTOR_DisplayPort,
&priv->ddc);
KUNIT_ASSERT_EQ(test, ret, 0);
for (i = 0; i < ARRAY_SIZE(props); i++)
test_connector_property(test, connector, props[i]);
}
/* * Test that the initialization of a dynamic connector succeeds for all * possible connector types.
*/ staticvoid drm_test_drm_connector_dynamic_init_type_valid(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; struct drm_connector *connector = &priv->connector; unsignedint connector_type = *(unsignedint *)test->param_value; int ret;
/* * Test that the initialization of a dynamic connector sets the expected name * for it for all possible connector types.
*/ staticvoid drm_test_drm_connector_dynamic_init_name(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; struct drm_connector *connector = &priv->connector; unsignedint connector_type = *(unsignedint *)test->param_value; char expected_name[128]; int ret;
ret = drm_connector_dynamic_init(&priv->drm, connector,
&dummy_dynamic_init_funcs,
connector_type,
&priv->ddc);
KUNIT_ASSERT_EQ(test, ret, 0);
/* * Test that registration of a dynamic connector adds it to the connector list.
*/ staticvoid drm_test_drm_connector_dynamic_register_early_on_list(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; struct drm_connector *connector = &priv->connector; int ret;
/* * Test that the registration of a dynamic connector before the drm device is * registered results in deferring the connector's user interface registration.
*/ staticvoid drm_test_drm_connector_dynamic_register_early_defer(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; struct drm_connector *connector = &priv->connector; int ret;
ret = drm_connector_dynamic_register(connector);
KUNIT_ASSERT_EQ(test, ret, 0);
/* * Test that the registration of a dynamic connector fails, if this is done before * the connector is initialized.
*/ staticvoid drm_test_drm_connector_dynamic_register_early_no_init(struct kunit *test)
{ struct drm_connector *connector; int ret;
ret = drm_connector_dynamic_register(connector);
KUNIT_ASSERT_EQ(test, ret, -EINVAL);
}
/* * Test that the registration of a dynamic connector before the drm device is * registered results in deferring adding a mode object for the connector.
*/ staticvoid drm_test_drm_connector_dynamic_register_early_no_mode_object(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; struct drm_connector *connector = &priv->connector; struct drm_connector *tmp_connector; int ret;
ret = drm_connector_dynamic_register(&priv->connector);
KUNIT_ASSERT_EQ(test, ret, 0);
/* * Test that the registration of a dynamic connector doesn't get deferred if * this is done after the drm device is registered.
*/ staticvoid drm_test_drm_connector_dynamic_register_no_defer(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; int ret;
/* * Test that the registration of a dynamic connector fails if this is done after the * drm device is registered, but before the connector is initialized.
*/ staticvoid drm_test_drm_connector_dynamic_register_no_init(struct kunit *test)
{ struct drm_connector *connector; int ret;
ret = drm_connector_dynamic_register(connector);
KUNIT_ASSERT_EQ(test, ret, -EINVAL);
}
/* * Test that the registration of a dynamic connector after the drm device is * registered adds the mode object for the connector.
*/ staticvoid drm_test_drm_connector_dynamic_register_mode_object(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; struct drm_connector *connector = &priv->connector; struct drm_connector *tmp_connector; int ret;
/* * Test that the registration of a dynamic connector after the drm device is * registered adds the connector to sysfs.
*/ staticvoid drm_test_drm_connector_dynamic_register_sysfs(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; struct drm_connector *connector = &priv->connector; int ret;
KUNIT_ASSERT_NULL(test, connector->kdev);
ret = drm_connector_dynamic_register(connector);
KUNIT_ASSERT_EQ(test, ret, 0);
KUNIT_ASSERT_NOT_NULL(test, connector->kdev);
}
/* * Test that the registration of a dynamic connector after the drm device is * registered sets the connector's sysfs name as expected.
*/ staticvoid drm_test_drm_connector_dynamic_register_sysfs_name(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; struct drm_connector *connector = &priv->connector; char expected_name[128]; int ret;
ret = drm_connector_dynamic_register(connector);
KUNIT_ASSERT_EQ(test, ret, 0);
/* * Test that the registration of a dynamic connector after the drm device is * registered adds the connector to debugfs.
*/ staticvoid drm_test_drm_connector_dynamic_register_debugfs(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; int ret;
/* * Test that the registration of a bog standard connector works as * expected and doesn't report any error.
*/ staticvoid drm_test_connector_hdmi_init_valid(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; int ret;
/* * Test that the registration of a connector without a DDC adapter * doesn't report any error.
*/ staticvoid drm_test_connector_hdmi_init_null_ddc(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; int ret;
/* * Test that the registration of an HDMI connector with a NULL vendor * fails.
*/ staticvoid drm_test_connector_hdmi_init_null_vendor(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; int ret;
/* * Test that the registration of an HDMI connector with a NULL product * fails.
*/ staticvoid drm_test_connector_hdmi_init_null_product(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; int ret;
/* * Test that the registration of a connector with a valid, shorter than * the max length, product name succeeds, and is stored padded with 0.
*/ staticvoid drm_test_connector_hdmi_init_product_valid(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; constunsignedchar expected_product[DRM_CONNECTOR_HDMI_PRODUCT_LEN] = { 'P', 'r', 'o', 'd',
}; constchar *product_name = "Prod"; int ret;
/* * Test that the registration of a connector with a valid, at max * length, product name succeeds, and is stored padded without any * trailing \0.
*/ staticvoid drm_test_connector_hdmi_init_product_length_exact(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; constunsignedchar expected_product[DRM_CONNECTOR_HDMI_PRODUCT_LEN] = { 'P', 'r', 'o', 'd', 'u', 'c', 't', 'P', 'r', 'o', 'd', 'u', 'c', 't', 'P', 'r',
}; constchar *product_name = "ProductProductPr"; int ret;
/* * Test that the registration of a connector with a product name larger * than the maximum length fails.
*/ staticvoid drm_test_connector_hdmi_init_product_length_too_long(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; constchar *product_name = "ProductProductProduct"; int ret;
/* * Test that the registration of a connector with a vendor name smaller * than the maximum length succeeds, and is stored padded with zeros.
*/ staticvoid drm_test_connector_hdmi_init_vendor_valid(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; constchar expected_vendor[DRM_CONNECTOR_HDMI_VENDOR_LEN] = { 'V', 'e', 'n', 'd',
}; constchar *vendor_name = "Vend"; int ret;
/* * Test that the registration of a connector with a vendor name at the * maximum length succeeds, and is stored padded without the trailing * zero.
*/ staticvoid drm_test_connector_hdmi_init_vendor_length_exact(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; constchar expected_vendor[DRM_CONNECTOR_HDMI_VENDOR_LEN] = { 'V', 'e', 'n', 'd', 'o', 'r', 'V', 'e',
}; constchar *vendor_name = "VendorVe"; int ret;
/* * Test that the registration of a connector with a vendor name larger * than the maximum length fails.
*/ staticvoid drm_test_connector_hdmi_init_vendor_length_too_long(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; constchar *vendor_name = "VendorVendor"; int ret;
/* * Test that the registration of a connector with an invalid maximum bpc * count fails.
*/ staticvoid drm_test_connector_hdmi_init_bpc_invalid(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; int ret;
/* * Test that the registration of a connector with a null maximum bpc * count fails.
*/ staticvoid drm_test_connector_hdmi_init_bpc_null(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; int ret;
/* * Test that the registration of a connector with a maximum bpc count of * 8 succeeds, registers the max bpc property, but doesn't register the * HDR output metadata one.
*/ staticvoid drm_test_connector_hdmi_init_bpc_8(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; struct drm_connector_state *state; struct drm_connector *connector = &priv->connector; struct drm_property *prop;
uint64_t val; int ret;
/* * Test that the registration of a connector with a maximum bpc count of * 10 succeeds and registers the max bpc and HDR output metadata * properties.
*/ staticvoid drm_test_connector_hdmi_init_bpc_10(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; struct drm_connector_state *state; struct drm_connector *connector = &priv->connector; struct drm_property *prop;
uint64_t val; int ret;
/* * Test that the registration of a connector with a maximum bpc count of * 12 succeeds and registers the max bpc and HDR output metadata * properties.
*/ staticvoid drm_test_connector_hdmi_init_bpc_12(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; struct drm_connector_state *state; struct drm_connector *connector = &priv->connector; struct drm_property *prop;
uint64_t val; int ret;
/* * Test that the registration of an HDMI connector with no supported * format fails.
*/ staticvoid drm_test_connector_hdmi_init_formats_empty(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; int ret;
/* * Test that the registration of an HDMI connector not listing RGB as a * supported format fails.
*/ staticvoid drm_test_connector_hdmi_init_formats_no_rgb(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; int ret;
/* * Test that the registration of an HDMI connector succeeds only when * the presence of YUV420 in the supported formats matches the value * of the ycbcr_420_allowed flag.
*/ staticvoid drm_test_connector_hdmi_init_formats_yuv420_allowed(struct kunit *test)
{ conststruct drm_connector_hdmi_init_formats_yuv420_allowed_test *params; struct drm_connector_init_priv *priv = test->priv; int ret;
/* * Test that the registration of an HDMI connector with an HDMI * connector type succeeds.
*/ staticvoid drm_test_connector_hdmi_init_type_valid(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; unsignedint connector_type = *(unsignedint *)test->param_value; int ret;
/* * Test that the registration of an HDMI connector with an !HDMI * connector type fails.
*/ staticvoid drm_test_connector_hdmi_init_type_invalid(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; unsignedint connector_type = *(unsignedint *)test->param_value; int ret;
/* * Test that for a given mode, with 8bpc and an RGB output the TMDS * character rate is equal to the mode pixel clock.
*/ staticvoid drm_test_drm_hdmi_compute_mode_clock_rgb(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; conststruct drm_display_mode *mode; unsignedlonglong rate; struct drm_device *drm = &priv->drm;
/* * Test that for a given mode, with 10bpc and an RGB output the TMDS * character rate is equal to 1.25 times the mode pixel clock.
*/ staticvoid drm_test_drm_hdmi_compute_mode_clock_rgb_10bpc(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; conststruct drm_display_mode *mode; unsignedlonglong rate; struct drm_device *drm = &priv->drm;
/* * Test that for the VIC-1 mode, with 10bpc and an RGB output the TMDS * character rate computation fails.
*/ staticvoid drm_test_drm_hdmi_compute_mode_clock_rgb_10bpc_vic_1(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; conststruct drm_display_mode *mode; unsignedlonglong rate; struct drm_device *drm = &priv->drm;
/* * Test that for a given mode, with 12bpc and an RGB output the TMDS * character rate is equal to 1.5 times the mode pixel clock.
*/ staticvoid drm_test_drm_hdmi_compute_mode_clock_rgb_12bpc(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; conststruct drm_display_mode *mode; unsignedlonglong rate; struct drm_device *drm = &priv->drm;
/* * Test that for the VIC-1 mode, with 12bpc and an RGB output the TMDS * character rate computation fails.
*/ staticvoid drm_test_drm_hdmi_compute_mode_clock_rgb_12bpc_vic_1(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; conststruct drm_display_mode *mode; unsignedlonglong rate; struct drm_device *drm = &priv->drm;
/* * Test that for a mode with the pixel repetition flag, the TMDS * character rate is indeed double the mode pixel clock.
*/ staticvoid drm_test_drm_hdmi_compute_mode_clock_rgb_double(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; conststruct drm_display_mode *mode; unsignedlonglong rate; struct drm_device *drm = &priv->drm;
/* * Test that for a given mode listed supporting it and an YUV420 output * with 10bpc, the TMDS character rate is equal to 0.625 times the mode * pixel clock.
*/ staticvoid drm_test_connector_hdmi_compute_mode_clock_yuv420_10_bpc(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; conststruct drm_display_mode *mode; struct drm_device *drm = &priv->drm; unsignedint vic =
drm_hdmi_compute_mode_clock_yuv420_vic_valid_tests[0]; unsignedlonglong rate;
/* * Test that for a given mode listed supporting it and an YUV420 output * with 12bpc, the TMDS character rate is equal to 0.75 times the mode * pixel clock.
*/ staticvoid drm_test_connector_hdmi_compute_mode_clock_yuv420_12_bpc(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; conststruct drm_display_mode *mode; struct drm_device *drm = &priv->drm; unsignedint vic =
drm_hdmi_compute_mode_clock_yuv420_vic_valid_tests[0]; unsignedlonglong rate;
/* * Test that for a given mode, the computation of the TMDS character * rate with 8bpc and a YUV422 output succeeds and returns a rate equal * to the mode pixel clock.
*/ staticvoid drm_test_connector_hdmi_compute_mode_clock_yuv422_8_bpc(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; conststruct drm_display_mode *mode; struct drm_device *drm = &priv->drm; unsignedlonglong rate;
/* * Test that for a given mode, the computation of the TMDS character * rate with 10bpc and a YUV422 output succeeds and returns a rate equal * to the mode pixel clock.
*/ staticvoid drm_test_connector_hdmi_compute_mode_clock_yuv422_10_bpc(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; conststruct drm_display_mode *mode; struct drm_device *drm = &priv->drm; unsignedlonglong rate;
/* * Test that for a given mode, the computation of the TMDS character * rate with 12bpc and a YUV422 output succeeds and returns a rate equal * to the mode pixel clock.
*/ staticvoid drm_test_connector_hdmi_compute_mode_clock_yuv422_12_bpc(struct kunit *test)
{ struct drm_connector_init_priv *priv = test->priv; conststruct drm_display_mode *mode; struct drm_device *drm = &priv->drm; unsignedlonglong rate;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.