From: Maxime Ripard Date: Fri, 14 Apr 2023 09:26:58 +0000 (+0200) Subject: drm/vc4: tests: Add function to lookup a plane for a CRTC X-Git-Tag: accepted/tizen/unified/20240422.153132~350 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=21fe63b1fa58ec3b98493ba04571e6f9d174b245;p=platform%2Fkernel%2Flinux-rpi.git 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 --- diff --git a/drivers/gpu/drm/vc4/tests/vc4_mock.h b/drivers/gpu/drm/vc4/tests/vc4_mock.h index d5e1fbf..fabae9f 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_mock.h +++ b/drivers/gpu/drm/vc4/tests/vc4_mock.h @@ -21,6 +21,20 @@ struct drm_crtc *vc4_find_crtc_for_encoder(struct kunit *test, return NULL; } +static inline +struct drm_plane *vc4_mock_find_plane_for_crtc(struct kunit *test, + struct drm_crtc *crtc) +{ + struct drm_device *drm = crtc->dev; + struct drm_plane *plane; + + drm_for_each_plane(plane, drm) + if (plane->possible_crtcs & drm_crtc_mask(crtc)) + return plane; + + return NULL; +} + struct vc4_dummy_plane { struct vc4_plane plane; };