-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drm/vc4: tests: Convert to plane creation helper
Now that we have a plane create helper for kunit mocked drivers, let's convert to it in vc4. Reviewed-by: Maíra Canal <mcanal@igalia.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240527-kms-hdmi-connector-state-v15-27-c5af16c3aae2@kernel.org Signed-off-by: Maxime Ripard <mripard@kernel.org>
- Loading branch information
Maxime Ripard
committed
May 28, 2024
1 parent
27e0a19
commit b3bf195
Showing
1 changed file
with
8 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,25 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
|
||
#include <drm/drm_atomic_state_helper.h> | ||
#include <drm/drm_fourcc.h> | ||
#include <drm/drm_modeset_helper_vtables.h> | ||
#include <drm/drm_kunit_helpers.h> | ||
#include <drm/drm_plane.h> | ||
|
||
#include <kunit/test.h> | ||
|
||
#include "vc4_mock.h" | ||
|
||
static const struct drm_plane_helper_funcs vc4_dummy_plane_helper_funcs = { | ||
}; | ||
|
||
static const struct drm_plane_funcs vc4_dummy_plane_funcs = { | ||
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state, | ||
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, | ||
.reset = drm_atomic_helper_plane_reset, | ||
}; | ||
|
||
static const uint32_t vc4_dummy_plane_formats[] = { | ||
DRM_FORMAT_XRGB8888, | ||
}; | ||
|
||
struct drm_plane *vc4_dummy_plane(struct kunit *test, struct drm_device *drm, | ||
enum drm_plane_type type) | ||
{ | ||
struct drm_plane *plane; | ||
|
||
plane = __drmm_universal_plane_alloc(drm, sizeof(struct drm_plane), 0, | ||
0, | ||
&vc4_dummy_plane_funcs, | ||
vc4_dummy_plane_formats, | ||
ARRAY_SIZE(vc4_dummy_plane_formats), | ||
NULL, | ||
DRM_PLANE_TYPE_PRIMARY, | ||
NULL); | ||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, plane); | ||
KUNIT_ASSERT_EQ(test, type, DRM_PLANE_TYPE_PRIMARY); | ||
|
||
drm_plane_helper_add(plane, &vc4_dummy_plane_helper_funcs); | ||
plane = drm_kunit_helper_create_primary_plane(test, drm, | ||
NULL, | ||
NULL, | ||
NULL, 0, | ||
NULL); | ||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, plane); | ||
|
||
return plane; | ||
} |