1// SPDX-License-Identifier: GPL-2.0
2
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>
7
8#include <kunit/test.h>
9
10#include "vc4_mock.h"
11
12static const struct drm_plane_helper_funcs vc4_dummy_plane_helper_funcs = {
13};
14
15static 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,
19};
20
21static const uint32_t vc4_dummy_plane_formats[] = {
22 DRM_FORMAT_XRGB8888,
23};
24
25struct vc4_dummy_plane *vc4_dummy_plane(struct kunit *test,
26 struct drm_device *drm,
27 enum drm_plane_type type)
28{
29 struct vc4_dummy_plane *dummy_plane;
30 struct drm_plane *plane;
31
32 dummy_plane = drmm_universal_plane_alloc(drm,
33 struct vc4_dummy_plane, plane.base,
34 0,
35 &vc4_dummy_plane_funcs,
36 vc4_dummy_plane_formats,
37 ARRAY_SIZE(vc4_dummy_plane_formats),
38 NULL,
39 DRM_PLANE_TYPE_PRIMARY,
40 NULL);
41 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dummy_plane);
42
43 plane = &dummy_plane->plane.base;
44 drm_plane_helper_add(plane, funcs: &vc4_dummy_plane_helper_funcs);
45
46 return dummy_plane;
47}
48

source code of linux/drivers/gpu/drm/vc4/tests/vc4_mock_plane.c