Skip to content

Commit a7294bc

Browse files
mripardpopcornmix
authored andcommitted
drm/vc4: tests: Use custom plane state for mock
The current mock planes were just using the regular drm_plane_state, while the driver expect struct vc4_plane_state that subclasses drm_plane_state. Hook the proper implementations of reset, duplicate_state, destroy and atomic_check to create vc4_plane_state. Signed-off-by: Maxime Ripard <maxime@cerno.tech>
1 parent 5f309f2 commit a7294bc

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

drivers/gpu/drm/vc4/tests/vc4_mock_plane.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@
77

88
#include "vc4_mock.h"
99

10+
static const struct drm_plane_helper_funcs vc4_dummy_plane_helper_funcs = {
11+
.atomic_check = vc4_plane_atomic_check,
12+
};
13+
14+
static const struct drm_plane_funcs vc4_dummy_plane_funcs = {
15+
.atomic_destroy_state = vc4_plane_destroy_state,
16+
.atomic_duplicate_state = vc4_plane_duplicate_state,
17+
.reset = vc4_plane_reset,
18+
};
19+
20+
static const uint32_t vc4_dummy_plane_formats[] = {
21+
DRM_FORMAT_XRGB8888,
22+
};
23+
1024
struct drm_plane *vc4_dummy_plane(struct kunit *test, struct drm_device *drm,
1125
enum drm_plane_type type)
1226
{

drivers/gpu/drm/vc4/vc4_drv.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,12 @@ int vc4_kms_load(struct drm_device *dev);
11031103
struct drm_plane *vc4_plane_init(struct drm_device *dev,
11041104
enum drm_plane_type type,
11051105
uint32_t possible_crtcs);
1106+
void vc4_plane_reset(struct drm_plane *plane);
1107+
void vc4_plane_destroy_state(struct drm_plane *plane,
1108+
struct drm_plane_state *state);
1109+
struct drm_plane_state *vc4_plane_duplicate_state(struct drm_plane *plane);
1110+
int vc4_plane_atomic_check(struct drm_plane *plane,
1111+
struct drm_atomic_state *state);
11061112
int vc4_plane_create_additional_planes(struct drm_device *dev);
11071113
u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist);
11081114
u32 vc4_plane_dlist_size(const struct drm_plane_state *state);

drivers/gpu/drm/vc4/vc4_plane.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ static bool plane_enabled(struct drm_plane_state *state)
280280
return state->fb && !WARN_ON(!state->crtc);
281281
}
282282

283-
static struct drm_plane_state *vc4_plane_duplicate_state(struct drm_plane *plane)
283+
struct drm_plane_state *vc4_plane_duplicate_state(struct drm_plane *plane)
284284
{
285285
struct vc4_dev *vc4 = to_vc4_dev(plane->dev);
286286
struct vc4_hvs *hvs = vc4->hvs;
@@ -334,8 +334,8 @@ static void vc4_plane_release_upm_ida(struct vc4_hvs *hvs, unsigned int upm_hand
334334
ida_free(&hvs->upm_handles, upm_handle);
335335
}
336336

337-
static void vc4_plane_destroy_state(struct drm_plane *plane,
338-
struct drm_plane_state *state)
337+
void vc4_plane_destroy_state(struct drm_plane *plane,
338+
struct drm_plane_state *state)
339339
{
340340
struct vc4_dev *vc4 = to_vc4_dev(plane->dev);
341341
struct vc4_hvs *hvs = vc4->hvs;
@@ -368,7 +368,7 @@ static void vc4_plane_destroy_state(struct drm_plane *plane,
368368
}
369369

370370
/* Called during init to allocate the plane's atomic state. */
371-
static void vc4_plane_reset(struct drm_plane *plane)
371+
void vc4_plane_reset(struct drm_plane *plane)
372372
{
373373
struct vc4_plane_state *vc4_state;
374374

@@ -2159,8 +2159,8 @@ static int vc6_plane_mode_set(struct drm_plane *plane,
21592159
* compute the dlist here and have all active plane dlists get updated
21602160
* in the CRTC's flush.
21612161
*/
2162-
static int vc4_plane_atomic_check(struct drm_plane *plane,
2163-
struct drm_atomic_state *state)
2162+
int vc4_plane_atomic_check(struct drm_plane *plane,
2163+
struct drm_atomic_state *state)
21642164
{
21652165
struct vc4_dev *vc4 = to_vc4_dev(plane->dev);
21662166
struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,

0 commit comments

Comments
 (0)