Skip to content

Commit 2523e9d

Browse files
committed
drm/vc4: crtc: Use an union to store the page flip callback
We'll need to extend the vc4_async_flip_state structure to rely on another callback implementation, so let's move the current one into a union. Reviewed-by: Melissa Wen <mwen@igalia.com> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://lore.kernel.org/r/20220610115149.964394-10-maxime@cerno.tech
1 parent 257add9 commit 2523e9d

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

drivers/gpu/drm/vc4/vc4_crtc.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -775,17 +775,17 @@ struct vc4_async_flip_state {
775775
struct drm_framebuffer *old_fb;
776776
struct drm_pending_vblank_event *event;
777777

778-
struct vc4_seqno_cb cb;
778+
union {
779+
struct vc4_seqno_cb seqno;
780+
} cb;
779781
};
780782

781783
/* Called when the V3D execution for the BO being flipped to is done, so that
782784
* we can actually update the plane's address to point to it.
783785
*/
784786
static void
785-
vc4_async_page_flip_complete(struct vc4_seqno_cb *cb)
787+
vc4_async_page_flip_complete(struct vc4_async_flip_state *flip_state)
786788
{
787-
struct vc4_async_flip_state *flip_state =
788-
container_of(cb, struct vc4_async_flip_state, cb);
789789
struct drm_crtc *crtc = flip_state->crtc;
790790
struct drm_device *dev = crtc->dev;
791791
struct drm_plane *plane = crtc->primary;
@@ -821,6 +821,14 @@ vc4_async_page_flip_complete(struct vc4_seqno_cb *cb)
821821
kfree(flip_state);
822822
}
823823

824+
static void vc4_async_page_flip_seqno_complete(struct vc4_seqno_cb *cb)
825+
{
826+
struct vc4_async_flip_state *flip_state =
827+
container_of(cb, struct vc4_async_flip_state, cb.seqno);
828+
829+
vc4_async_page_flip_complete(flip_state);
830+
}
831+
824832
/* Implements async (non-vblank-synced) page flips.
825833
*
826834
* The page flip ioctl needs to return immediately, so we grab the
@@ -881,8 +889,8 @@ static int vc4_async_page_flip(struct drm_crtc *crtc,
881889
*/
882890
drm_atomic_set_fb_for_plane(plane->state, fb);
883891

884-
vc4_queue_seqno_cb(dev, &flip_state->cb, bo->seqno,
885-
vc4_async_page_flip_complete);
892+
vc4_queue_seqno_cb(dev, &flip_state->cb.seqno, bo->seqno,
893+
vc4_async_page_flip_seqno_complete);
886894

887895
/* Driver takes ownership of state on successful async commit. */
888896
return 0;

0 commit comments

Comments
 (0)