Skip to content

Commit

Permalink
drm/vc4: tests: Remove vc4_dummy_plane structure
Browse files Browse the repository at this point in the history
The vc4_dummy_plane structure was introduced as a mean to add
mock-specific fields.

However, we never really used it and it's still strictly equivalent to
vc4_plane (which is in the same situation vs drm_plane), so we can
simply remove the vc4_dummy_plane structure and make the mock code
cleaner.

Reviewed-by: Maíra Canal <mcanal@igalia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240527-kms-hdmi-connector-state-v15-26-c5af16c3aae2@kernel.org
Signed-off-by: Maxime Ripard <mripard@kernel.org>
  • Loading branch information
mripard committed May 28, 2024
1 parent b47a72f commit 27e0a19
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
6 changes: 2 additions & 4 deletions drivers/gpu/drm/vc4/tests/vc4_mock.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,14 @@ static const struct vc4_mock_desc vc5_mock =
static int __build_one_pipe(struct kunit *test, struct drm_device *drm,
const struct vc4_mock_pipe_desc *pipe)
{
struct vc4_dummy_plane *dummy_plane;
struct drm_plane *plane;
struct vc4_dummy_crtc *dummy_crtc;
struct drm_crtc *crtc;
unsigned int i;

dummy_plane = vc4_dummy_plane(test, drm, DRM_PLANE_TYPE_PRIMARY);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dummy_plane);
plane = vc4_dummy_plane(test, drm, DRM_PLANE_TYPE_PRIMARY);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, plane);

plane = &dummy_plane->plane.base;
dummy_crtc = vc4_mock_pv(test, drm, plane, pipe->data);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dummy_crtc);

Expand Down
9 changes: 2 additions & 7 deletions drivers/gpu/drm/vc4/tests/vc4_mock.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,8 @@ struct drm_crtc *vc4_find_crtc_for_encoder(struct kunit *test,
return NULL;
}

struct vc4_dummy_plane {
struct vc4_plane plane;
};

struct vc4_dummy_plane *vc4_dummy_plane(struct kunit *test,
struct drm_device *drm,
enum drm_plane_type type);
struct drm_plane *vc4_dummy_plane(struct kunit *test, struct drm_device *drm,
enum drm_plane_type type);

struct vc4_dummy_crtc {
struct vc4_crtc crtc;
Expand Down
14 changes: 5 additions & 9 deletions drivers/gpu/drm/vc4/tests/vc4_mock_plane.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,22 @@ static const uint32_t vc4_dummy_plane_formats[] = {
DRM_FORMAT_XRGB8888,
};

struct vc4_dummy_plane *vc4_dummy_plane(struct kunit *test,
struct drm_device *drm,
enum drm_plane_type type)
struct drm_plane *vc4_dummy_plane(struct kunit *test, struct drm_device *drm,
enum drm_plane_type type)
{
struct vc4_dummy_plane *dummy_plane;
struct drm_plane *plane;

dummy_plane = drmm_universal_plane_alloc(drm,
struct vc4_dummy_plane, plane.base,
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, dummy_plane);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, plane);

plane = &dummy_plane->plane.base;
drm_plane_helper_add(plane, &vc4_dummy_plane_helper_funcs);

return dummy_plane;
return plane;
}

0 comments on commit 27e0a19

Please sign in to comment.