ebab218cf3c447264fbd2cc929f99f628210cdb6
[openwrt/staging/jow.git] /
1 From 3320e449e40eeb49b601dcbbd4bd72b8cb8f3054 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Fri, 14 Apr 2023 11:26:58 +0200
4 Subject: [PATCH] drm/vc4: tests: Add function to lookup a plane for a CRTC
5
6 Some tests will need to find a plane to run a test on for a given CRTC.
7 Let's create a small helper to do that.
8
9 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
10 ---
11 drivers/gpu/drm/vc4/tests/vc4_mock.h | 14 ++++++++++++++
12 1 file changed, 14 insertions(+)
13
14 --- a/drivers/gpu/drm/vc4/tests/vc4_mock.h
15 +++ b/drivers/gpu/drm/vc4/tests/vc4_mock.h
16 @@ -21,6 +21,20 @@ struct drm_crtc *vc4_find_crtc_for_encod
17 return NULL;
18 }
19
20 +static inline
21 +struct drm_plane *vc4_mock_find_plane_for_crtc(struct kunit *test,
22 + struct drm_crtc *crtc)
23 +{
24 + struct drm_device *drm = crtc->dev;
25 + struct drm_plane *plane;
26 +
27 + drm_for_each_plane(plane, drm)
28 + if (plane->possible_crtcs & drm_crtc_mask(crtc))
29 + return plane;
30 +
31 + return NULL;
32 +}
33 +
34 struct vc4_dummy_plane {
35 struct vc4_plane plane;
36 };