openwrt/target/linux/bcm27xx/patches-6.6/950-0626-drm-vc4-tests-Add-BCM2712-mock-driver.patch

88 lines
2.8 KiB
Diff
Raw Normal View History

From 222226c0b1a941ebc01ab71ddcf5405f9103f9ab Mon Sep 17 00:00:00 2001
From: Maxime Ripard <maxime@cerno.tech>
Date: Fri, 17 Feb 2023 13:38:10 +0100
Subject: [PATCH 0626/1085] drm/vc4: tests: Add BCM2712 mock driver
The BCM2712 has a simpler pipeline that can only output to a writeback
connector and two HDMI controllers.
Let's allow our kunit tests to create a mock of that pipeline.
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
drivers/gpu/drm/vc4/tests/vc4_mock.c | 29 ++++++++++++++++++++++++++++
drivers/gpu/drm/vc4/tests/vc4_mock.h | 1 +
drivers/gpu/drm/vc4/vc4_drv.h | 2 ++
3 files changed, 32 insertions(+)
--- a/drivers/gpu/drm/vc4/tests/vc4_mock.c
+++ b/drivers/gpu/drm/vc4/tests/vc4_mock.c
@@ -106,6 +106,26 @@ static const struct vc4_mock_desc vc5_mo
DRM_MODE_CONNECTOR_HDMIA)),
);
+static const struct vc4_mock_desc vc6_mock =
+ VC4_MOCK_DESC(
+ VC4_MOCK_CRTC_DESC(&bcm2712_mop_data.base,
+ VC4_MOCK_OUTPUT_DESC(VC4_ENCODER_TYPE_TXP0,
+ DRM_MODE_ENCODER_VIRTUAL,
+ DRM_MODE_CONNECTOR_WRITEBACK)),
+ VC4_MOCK_CRTC_DESC(&bcm2712_moplet_data.base,
+ VC4_MOCK_OUTPUT_DESC(VC4_ENCODER_TYPE_TXP1,
+ DRM_MODE_ENCODER_VIRTUAL,
+ DRM_MODE_CONNECTOR_WRITEBACK)),
+ VC4_MOCK_PIXELVALVE_DESC(&bcm2712_pv0_data,
+ VC4_MOCK_OUTPUT_DESC(VC4_ENCODER_TYPE_HDMI0,
+ DRM_MODE_ENCODER_TMDS,
+ DRM_MODE_CONNECTOR_HDMIA)),
+ VC4_MOCK_PIXELVALVE_DESC(&bcm2712_pv1_data,
+ VC4_MOCK_OUTPUT_DESC(VC4_ENCODER_TYPE_HDMI1,
+ DRM_MODE_ENCODER_TMDS,
+ DRM_MODE_CONNECTOR_HDMIA)),
+);
+
static int __build_one_pipe(struct kunit *test, struct drm_device *drm,
const struct vc4_mock_pipe_desc *pipe)
{
@@ -178,6 +198,10 @@ static struct vc4_dev *__mock_device(str
drv = &vc5_drm_driver;
desc = &vc5_mock;
break;
+ case VC4_GEN_6:
+ drv = &vc5_drm_driver;
+ desc = &vc6_mock;
+ break;
default:
return NULL;
@@ -224,3 +248,8 @@ struct vc4_dev *vc5_mock_device(struct k
{
return __mock_device(test, VC4_GEN_5);
}
+
+struct vc4_dev *vc6_mock_device(struct kunit *test)
+{
+ return __mock_device(test, VC4_GEN_6);
+}
--- a/drivers/gpu/drm/vc4/tests/vc4_mock.h
+++ b/drivers/gpu/drm/vc4/tests/vc4_mock.h
@@ -55,6 +55,7 @@ struct vc4_dummy_output *vc4_dummy_outpu
struct vc4_dev *vc4_mock_device(struct kunit *test);
struct vc4_dev *vc5_mock_device(struct kunit *test);
+struct vc4_dev *vc6_mock_device(struct kunit *test);
struct vc4_dummy_output *
vc4_mock_atomic_add_output(struct kunit *test,
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -555,6 +555,8 @@ struct vc4_txp_data {
unsigned int supports_40bit_addresses:1;
};
+extern const struct vc4_txp_data bcm2712_mop_data;
+extern const struct vc4_txp_data bcm2712_moplet_data;
extern const struct vc4_txp_data bcm2835_txp_data;
struct vc4_pv_data {