Skip to content

Commit 6b8562c

Browse files
committed
drm/sun4i: engine: Create an atomic_begin callback
We have to implement some display engine specific behaviours in atomic_begin. Let's add a function for that. Reviewed-by: Chen-Yu Tsai <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/44110951ae0cc13767fefc7fc1d9e2ec782d0a40.1516613040.git-series.maxime.ripard@free-electrons.com
1 parent 3004f75 commit 6b8562c

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

drivers/gpu/drm/sun4i/sun4i_crtc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc,
6464
{
6565
struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
6666
struct drm_device *dev = crtc->dev;
67+
struct sunxi_engine *engine = scrtc->engine;
6768
unsigned long flags;
6869

6970
if (crtc->state->event) {
@@ -73,7 +74,10 @@ static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc,
7374
scrtc->event = crtc->state->event;
7475
spin_unlock_irqrestore(&dev->event_lock, flags);
7576
crtc->state->event = NULL;
76-
}
77+
}
78+
79+
if (engine->ops->atomic_begin)
80+
engine->ops->atomic_begin(engine, old_state);
7781
}
7882

7983
static void sun4i_crtc_atomic_flush(struct drm_crtc *crtc,

drivers/gpu/drm/sun4i/sunxi_engine.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ struct sunxi_engine;
2222
* implement the proper behaviour.
2323
*/
2424
struct sunxi_engine_ops {
25+
/**
26+
* @atomic_begin:
27+
*
28+
* This callback allows to prepare our engine for an atomic
29+
* update. This is mirroring the
30+
* &drm_crtc_helper_funcs.atomic_begin callback, so any
31+
* documentation there applies.
32+
*
33+
* This function is optional.
34+
*/
35+
void (*atomic_begin)(struct sunxi_engine *engine,
36+
struct drm_crtc_state *old_state);
37+
2538
/**
2639
* @atomic_check:
2740
*

0 commit comments

Comments
 (0)