Skip to content

Commit f062948

Browse files
mripardpopcornmix
authored andcommitted
drm/vc4: tests: Add function to lookup a plane for a CRTC
Some tests will need to find a plane to run a test on for a given CRTC. Let's create a small helper to do that. Signed-off-by: Maxime Ripard <maxime@cerno.tech>
1 parent 54e46da commit f062948

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/gpu/drm/vc4/tests/vc4_mock.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,24 @@ struct drm_crtc *vc4_find_crtc_for_encoder(struct kunit *test,
2121
return NULL;
2222
}
2323

24+
static inline
25+
struct drm_plane *vc4_mock_find_plane_for_crtc(struct kunit *test,
26+
struct drm_crtc *crtc)
27+
{
28+
struct drm_device *drm = crtc->dev;
29+
struct drm_plane *plane;
30+
31+
drm_for_each_plane(plane, drm)
32+
if (plane->possible_crtcs & drm_crtc_mask(crtc))
33+
return plane;
34+
35+
return NULL;
36+
}
37+
38+
struct vc4_dummy_plane {
39+
struct vc4_plane plane;
40+
};
41+
2442
struct drm_plane *vc4_dummy_plane(struct kunit *test, struct drm_device *drm,
2543
enum drm_plane_type type);
2644

0 commit comments

Comments
 (0)