openwrt/target/linux/bcm27xx/patches-6.1/950-0984-drm-vc4-tests-Add-helper-to-add-a-new-plane-to-a-sta.patch
Marty Jones 2e715fb4fc bcm27xx: update 6.1 patches to latest version
Add support for BCM2712 (Raspberry Pi 5).
3bb5880ab3
Patches were generated from the diff between linux kernel branch linux-6.1.y
and rpi-6.1.y from raspberry pi kernel source:
- git format-patch linux-6.1.y...rpi-6.1.y

Build system: x86_64
Build-tested: bcm2708, bcm2709, bcm2710, bcm2711
Run-tested: bcm2710/RPi3B, bcm2711/RPi4B

Signed-off-by: Marty Jones <mj8263788@gmail.com>
[Remove applied and reverted patches, squash patches and config commits]
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-01-25 17:46:45 +01:00

63 lines
1.9 KiB
Diff

From a2f912c44b98acb6c10c977db105e199011c09b5 Mon Sep 17 00:00:00 2001
From: Maxime Ripard <maxime@cerno.tech>
Date: Fri, 14 Apr 2023 12:57:53 +0200
Subject: [PATCH] drm/vc4: tests: Add helper to add a new plane to a state
We'll start to add some tests for the plane state logic, so let's create
a helper to add a plane to an existing atomic state.
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
drivers/gpu/drm/vc4/tests/vc4_mock.h | 4 ++++
drivers/gpu/drm/vc4/tests/vc4_mock_plane.c | 22 ++++++++++++++++++++++
2 files changed, 26 insertions(+)
--- a/drivers/gpu/drm/vc4/tests/vc4_mock.h
+++ b/drivers/gpu/drm/vc4/tests/vc4_mock.h
@@ -42,6 +42,10 @@ struct vc4_dummy_plane {
struct vc4_dummy_plane *vc4_dummy_plane(struct kunit *test,
struct drm_device *drm,
enum drm_plane_type type);
+struct drm_plane *
+vc4_mock_atomic_add_plane(struct kunit *test,
+ struct drm_atomic_state *state,
+ struct drm_crtc *crtc);
struct vc4_dummy_crtc {
struct vc4_crtc crtc;
--- a/drivers/gpu/drm/vc4/tests/vc4_mock_plane.c
+++ b/drivers/gpu/drm/vc4/tests/vc4_mock_plane.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include <drm/drm_atomic_state_helper.h>
+#include <drm/drm_atomic_uapi.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_modeset_helper_vtables.h>
#include <drm/drm_plane.h>
@@ -46,3 +47,24 @@ struct vc4_dummy_plane *vc4_dummy_plane(
return dummy_plane;
}
+
+struct drm_plane *
+vc4_mock_atomic_add_plane(struct kunit *test,
+ struct drm_atomic_state *state,
+ struct drm_crtc *crtc)
+{
+ struct drm_plane_state *plane_state;
+ struct drm_plane *plane;
+ int ret;
+
+ plane = vc4_mock_find_plane_for_crtc(test, crtc);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, plane);
+
+ plane_state = drm_atomic_get_plane_state(state, plane);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, plane_state);
+
+ ret = drm_atomic_set_crtc_for_plane(plane_state, crtc);
+ KUNIT_EXPECT_EQ(test, ret, 0);
+
+ return plane;
+}