1 // SPDX-License-Identifier: GPL-2.0
3 #include <drm/drm_atomic_state_helper.h>
4 #include <drm/drm_fourcc.h>
5 #include <drm/drm_modeset_helper_vtables.h>
6 #include <drm/drm_plane.h>
8 #include <kunit/test.h>
12 static const struct drm_plane_helper_funcs vc4_dummy_plane_helper_funcs = {
15 static const struct drm_plane_funcs vc4_dummy_plane_funcs = {
16 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
17 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
18 .reset = drm_atomic_helper_plane_reset,
21 static const uint32_t vc4_dummy_plane_formats[] = {
25 struct vc4_dummy_plane *vc4_dummy_plane(struct kunit *test,
26 struct drm_device *drm,
27 enum drm_plane_type type)
29 struct vc4_dummy_plane *dummy_plane;
30 struct drm_plane *plane;
32 dummy_plane = drmm_universal_plane_alloc(drm,
33 struct vc4_dummy_plane, plane.base,
35 &vc4_dummy_plane_funcs,
36 vc4_dummy_plane_formats,
37 ARRAY_SIZE(vc4_dummy_plane_formats),
39 DRM_PLANE_TYPE_PRIMARY,
41 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dummy_plane);
43 plane = &dummy_plane->plane.base;
44 drm_plane_helper_add(plane, &vc4_dummy_plane_helper_funcs);