linux/drivers/gpu/drm/tests/drm_connector_test.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Kunit test for drm_modes functions
 */

#include <linux/i2c.h>

#include <drm/drm_atomic_state_helper.h>
#include <drm/drm_connector.h>
#include <drm/drm_drv.h>
#include <drm/drm_edid.h>
#include <drm/drm_kunit_helpers.h>
#include <drm/drm_modes.h>

#include <drm/display/drm_hdmi_helper.h>

#include <kunit/test.h>

#include "../drm_crtc_internal.h"

struct drm_connector_init_priv {};

static const struct drm_connector_hdmi_funcs dummy_hdmi_funcs =;

static const struct drm_connector_funcs dummy_funcs =;

static int dummy_ddc_xfer(struct i2c_adapter *adapter,
			  struct i2c_msg *msgs, int num)
{}

static u32 dummy_ddc_func(struct i2c_adapter *adapter)
{}

static const struct i2c_algorithm dummy_ddc_algorithm =;

static void i2c_del_adapter_wrapper(void *ptr)
{}

static int drm_test_connector_init(struct kunit *test)
{}

/*
 * Test that the registration of a bog standard connector works as
 * expected and doesn't report any error.
 */
static void drm_test_drmm_connector_init(struct kunit *test)
{}

/*
 * Test that the registration of a connector without a DDC adapter
 * doesn't report any error.
 */
static void drm_test_drmm_connector_init_null_ddc(struct kunit *test)
{}

/*
 * Test that the registration of a connector succeeds for all possible
 * connector types.
 */
static void drm_test_drmm_connector_init_type_valid(struct kunit *test)
{}

static const unsigned int drm_connector_init_type_valid_tests[] =;

static void drm_connector_init_type_desc(const unsigned int *type, char *desc)
{}

KUNIT_ARRAY_PARAM(drm_connector_init_type_valid,
		  drm_connector_init_type_valid_tests,
		  drm_connector_init_type_desc);

static struct kunit_case drmm_connector_init_tests[] =;

static struct kunit_suite drmm_connector_init_test_suite =;

/*
 * Test that the registration of a bog standard connector works as
 * expected and doesn't report any error.
 */
static void drm_test_connector_hdmi_init_valid(struct kunit *test)
{}

/*
 * Test that the registration of a connector without a DDC adapter
 * doesn't report any error.
 */
static void drm_test_connector_hdmi_init_null_ddc(struct kunit *test)
{}

/*
 * Test that the registration of an HDMI connector with a NULL vendor
 * fails.
 */
static void drm_test_connector_hdmi_init_null_vendor(struct kunit *test)
{}

/*
 * Test that the registration of an HDMI connector with a NULL product
 * fails.
 */
static void drm_test_connector_hdmi_init_null_product(struct kunit *test)
{}

/*
 * Test that the registration of a connector with a valid, shorter than
 * the max length, product name succeeds, and is stored padded with 0.
 */
static void drm_test_connector_hdmi_init_product_valid(struct kunit *test)
{}

/*
 * Test that the registration of a connector with a valid, at max
 * length, product name succeeds, and is stored padded without any
 * trailing \0.
 */
static void drm_test_connector_hdmi_init_product_length_exact(struct kunit *test)
{}

/*
 * Test that the registration of a connector with a product name larger
 * than the maximum length fails.
 */
static void drm_test_connector_hdmi_init_product_length_too_long(struct kunit *test)
{}

/*
 * Test that the registration of a connector with a vendor name smaller
 * than the maximum length succeeds, and is stored padded with zeros.
 */
static void drm_test_connector_hdmi_init_vendor_valid(struct kunit *test)
{}

/*
 * Test that the registration of a connector with a vendor name at the
 * maximum length succeeds, and is stored padded without the trailing
 * zero.
 */
static void drm_test_connector_hdmi_init_vendor_length_exact(struct kunit *test)
{}

/*
 * Test that the registration of a connector with a vendor name larger
 * than the maximum length fails.
 */
static void drm_test_connector_hdmi_init_vendor_length_too_long(struct kunit *test)
{}

/*
 * Test that the registration of a connector with an invalid maximum bpc
 * count fails.
 */
static void drm_test_connector_hdmi_init_bpc_invalid(struct kunit *test)
{}

/*
 * Test that the registration of a connector with a null maximum bpc
 * count fails.
 */
static void drm_test_connector_hdmi_init_bpc_null(struct kunit *test)
{}

/*
 * 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.
 */
static void drm_test_connector_hdmi_init_bpc_8(struct kunit *test)
{}

/*
 * 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.
 */
static void drm_test_connector_hdmi_init_bpc_10(struct kunit *test)
{}

/*
 * 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.
 */
static void drm_test_connector_hdmi_init_bpc_12(struct kunit *test)
{}

/*
 * Test that the registration of an HDMI connector with no supported
 * format fails.
 */
static void drm_test_connector_hdmi_init_formats_empty(struct kunit *test)
{}

/*
 * Test that the registration of an HDMI connector not listing RGB as a
 * supported format fails.
 */
static void drm_test_connector_hdmi_init_formats_no_rgb(struct kunit *test)
{}

/*
 * Test that the registration of an HDMI connector with an HDMI
 * connector type succeeds.
 */
static void drm_test_connector_hdmi_init_type_valid(struct kunit *test)
{}

static const unsigned int drm_connector_hdmi_init_type_valid_tests[] =;

static void drm_connector_hdmi_init_type_desc(const unsigned int *type, char *desc)
{}

KUNIT_ARRAY_PARAM(drm_connector_hdmi_init_type_valid,
		  drm_connector_hdmi_init_type_valid_tests,
		  drm_connector_hdmi_init_type_desc);

/*
 * Test that the registration of an HDMI connector with an !HDMI
 * connector type fails.
 */
static void drm_test_connector_hdmi_init_type_invalid(struct kunit *test)
{}

static const unsigned int drm_connector_hdmi_init_type_invalid_tests[] =;

KUNIT_ARRAY_PARAM(drm_connector_hdmi_init_type_invalid,
		  drm_connector_hdmi_init_type_invalid_tests,
		  drm_connector_hdmi_init_type_desc);

static struct kunit_case drmm_connector_hdmi_init_tests[] =;

static struct kunit_suite drmm_connector_hdmi_init_test_suite =;

struct drm_get_tv_mode_from_name_test {};

#define TV_MODE_NAME(_name, _mode)

static void drm_test_get_tv_mode_from_name_valid(struct kunit *test)
{}

static const
struct drm_get_tv_mode_from_name_test drm_get_tv_mode_from_name_valid_tests[] =;

static void
drm_get_tv_mode_from_name_valid_desc(const struct drm_get_tv_mode_from_name_test *t,
				     char *desc)
{}

KUNIT_ARRAY_PARAM(drm_get_tv_mode_from_name_valid,
		  drm_get_tv_mode_from_name_valid_tests,
		  drm_get_tv_mode_from_name_valid_desc);

static void drm_test_get_tv_mode_from_name_truncated(struct kunit *test)
{
	const char *name = "NTS";
	int ret;

	ret = drm_get_tv_mode_from_name(name, strlen(name));
	KUNIT_EXPECT_LT(test, ret, 0);
};

static struct kunit_case drm_get_tv_mode_from_name_tests[] =;

static struct kunit_suite drm_get_tv_mode_from_name_test_suite =;

struct drm_hdmi_connector_get_broadcast_rgb_name_test {};

#define BROADCAST_RGB_TEST(_kind, _name)

static void drm_test_drm_hdmi_connector_get_broadcast_rgb_name(struct kunit *test)
{}

static const
struct drm_hdmi_connector_get_broadcast_rgb_name_test
drm_hdmi_connector_get_broadcast_rgb_name_valid_tests[] =;

static void
drm_hdmi_connector_get_broadcast_rgb_name_valid_desc(const struct drm_hdmi_connector_get_broadcast_rgb_name_test *t,
						     char *desc)
{}

KUNIT_ARRAY_PARAM(drm_hdmi_connector_get_broadcast_rgb_name_valid,
		  drm_hdmi_connector_get_broadcast_rgb_name_valid_tests,
		  drm_hdmi_connector_get_broadcast_rgb_name_valid_desc);

static void drm_test_drm_hdmi_connector_get_broadcast_rgb_name_invalid(struct kunit *test)
{
	KUNIT_EXPECT_NULL(test, drm_hdmi_connector_get_broadcast_rgb_name(3));
};

static struct kunit_case drm_hdmi_connector_get_broadcast_rgb_name_tests[] =;

static struct kunit_suite drm_hdmi_connector_get_broadcast_rgb_name_test_suite =;

struct drm_hdmi_connector_get_output_format_name_test {};

#define OUTPUT_FORMAT_TEST(_kind, _name)

static void drm_test_drm_hdmi_connector_get_output_format_name(struct kunit *test)
{}

static const
struct drm_hdmi_connector_get_output_format_name_test
drm_hdmi_connector_get_output_format_name_valid_tests[] =;

static void
drm_hdmi_connector_get_output_format_name_valid_desc(const struct drm_hdmi_connector_get_output_format_name_test *t,
						     char *desc)
{}

KUNIT_ARRAY_PARAM(drm_hdmi_connector_get_output_format_name_valid,
		  drm_hdmi_connector_get_output_format_name_valid_tests,
		  drm_hdmi_connector_get_output_format_name_valid_desc);

static void drm_test_drm_hdmi_connector_get_output_format_name_invalid(struct kunit *test)
{
	KUNIT_EXPECT_NULL(test, drm_hdmi_connector_get_output_format_name(4));
};

static struct kunit_case drm_hdmi_connector_get_output_format_name_tests[] =;

static struct kunit_suite drm_hdmi_connector_get_output_format_name_test_suite =;

static void drm_test_drm_connector_attach_broadcast_rgb_property(struct kunit *test)
{}

static void drm_test_drm_connector_attach_broadcast_rgb_property_hdmi_connector(struct kunit *test)
{}

static struct kunit_case drm_connector_attach_broadcast_rgb_property_tests[] =;

static struct kunit_suite drm_connector_attach_broadcast_rgb_property_test_suite =;

/*
 * Test that for a given mode, with 8bpc and an RGB output the TMDS
 * character rate is equal to the mode pixel clock.
 */
static void drm_test_drm_hdmi_compute_mode_clock_rgb(struct kunit *test)
{}

/*
 * 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.
 */
static void drm_test_drm_hdmi_compute_mode_clock_rgb_10bpc(struct kunit *test)
{}

/*
 * Test that for the VIC-1 mode, with 10bpc and an RGB output the TMDS
 * character rate computation fails.
 */
static void drm_test_drm_hdmi_compute_mode_clock_rgb_10bpc_vic_1(struct kunit *test)
{}

/*
 * 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.
 */
static void drm_test_drm_hdmi_compute_mode_clock_rgb_12bpc(struct kunit *test)
{}

/*
 * Test that for the VIC-1 mode, with 12bpc and an RGB output the TMDS
 * character rate computation fails.
 */
static void drm_test_drm_hdmi_compute_mode_clock_rgb_12bpc_vic_1(struct kunit *test)
{}

/*
 * Test that for a mode with the pixel repetition flag, the TMDS
 * character rate is indeed double the mode pixel clock.
 */
static void drm_test_drm_hdmi_compute_mode_clock_rgb_double(struct kunit *test)
{}

/*
 * Test that the TMDS character rate computation for the VIC modes
 * explicitly listed in the spec as supporting YUV420 succeed and return
 * half the mode pixel clock.
 */
static void drm_test_connector_hdmi_compute_mode_clock_yuv420_valid(struct kunit *test)
{}

static const unsigned int drm_hdmi_compute_mode_clock_yuv420_vic_valid_tests[] =;

static void drm_hdmi_compute_mode_clock_yuv420_vic_desc(const unsigned int *vic, char *desc)
{}

KUNIT_ARRAY_PARAM(drm_hdmi_compute_mode_clock_yuv420_valid,
		  drm_hdmi_compute_mode_clock_yuv420_vic_valid_tests,
		  drm_hdmi_compute_mode_clock_yuv420_vic_desc);

/*
 * 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.
 */
static void drm_test_connector_hdmi_compute_mode_clock_yuv420_10_bpc(struct kunit *test)
{}

/*
 * 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.
 */
static void drm_test_connector_hdmi_compute_mode_clock_yuv420_12_bpc(struct kunit *test)
{}

/*
 * 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.
 */
static void drm_test_connector_hdmi_compute_mode_clock_yuv422_8_bpc(struct kunit *test)
{}

/*
 * 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.
 */
static void drm_test_connector_hdmi_compute_mode_clock_yuv422_10_bpc(struct kunit *test)
{}

/*
 * 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.
 */
static void drm_test_connector_hdmi_compute_mode_clock_yuv422_12_bpc(struct kunit *test)
{}

static struct kunit_case drm_hdmi_compute_mode_clock_tests[] =;

static struct kunit_suite drm_hdmi_compute_mode_clock_test_suite =;

kunit_test_suites();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();