Skip to content

Commit 656e5f6

Browse files
committed
drm/sun4i: engine: Add a custom crtc atomic_check
We have some restrictions on what the planes and CRTC can provide that are tied to only one generation of display engines. For example, on the first generation, we can only have one YUV plane or one plane that uses the frontend output. Let's allow our engines to provide an atomic_check callback to validate the current configuration. Reviewed-by: Chen-Yu Tsai <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/e5f5f144e5c20d348cdb29933ae876c105bec017.1516613040.git-series.maxime.ripard@free-electrons.com
1 parent d540f82 commit 656e5f6

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

drivers/gpu/drm/sun4i/sun4i_crtc.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ static struct drm_encoder *sun4i_crtc_get_encoder(struct drm_crtc *crtc)
4646
return NULL;
4747
}
4848

49+
static int sun4i_crtc_atomic_check(struct drm_crtc *crtc,
50+
struct drm_crtc_state *state)
51+
{
52+
struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
53+
struct sunxi_engine *engine = scrtc->engine;
54+
int ret = 0;
55+
56+
if (engine && engine->ops && engine->ops->atomic_check)
57+
ret = engine->ops->atomic_check(engine, state);
58+
59+
return ret;
60+
}
61+
4962
static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc,
5063
struct drm_crtc_state *old_state)
5164
{
@@ -125,6 +138,7 @@ static void sun4i_crtc_mode_set_nofb(struct drm_crtc *crtc)
125138
}
126139

127140
static const struct drm_crtc_helper_funcs sun4i_crtc_helper_funcs = {
141+
.atomic_check = sun4i_crtc_atomic_check,
128142
.atomic_begin = sun4i_crtc_atomic_begin,
129143
.atomic_flush = sun4i_crtc_atomic_flush,
130144
.atomic_enable = sun4i_crtc_atomic_enable,

drivers/gpu/drm/sun4i/sunxi_engine.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,23 @@ struct sunxi_engine;
2222
* implement the proper behaviour.
2323
*/
2424
struct sunxi_engine_ops {
25+
/**
26+
* @atomic_check:
27+
*
28+
* This callback allows to validate plane-update related CRTC
29+
* constraints specific to engines. This is mirroring the
30+
* &drm_crtc_helper_funcs.atomic_check callback, so any
31+
* documentation there applies.
32+
*
33+
* This function is optional.
34+
*
35+
* RETURNS:
36+
*
37+
* 0 on success or a negative error code.
38+
*/
39+
int (*atomic_check)(struct sunxi_engine *engine,
40+
struct drm_crtc_state *state);
41+
2542
/**
2643
* @commit:
2744
*

0 commit comments

Comments
 (0)