Skip to content

Commit dd63250

Browse files
committed
drm/sun4i: backend: Make sure we don't have a commit pending
If we try to read the backend registers while it fetches the new values, we end up with the value of some random register instead of the one we asked for. In order to prevent that, let's make sure that the very first thing we do during our atomic modesetting is to let the commit bit come to a rest. We don't have to worry about anything else since the only time we will trigger a new transaction is during the atomic_commit which comes much later. Reviewed-by: Chen-Yu Tsai <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/35604307e5bde2b85c674de79fa7c4d55700f085.1516613040.git-series.maxime.ripard@free-electrons.com
1 parent 5d68be9 commit dd63250

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/gpu/drm/sun4i/sun4i_backend.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,17 @@ static bool sun4i_backend_plane_uses_frontend(struct drm_plane_state *state)
296296
return sun4i_backend_plane_uses_scaler(state);
297297
}
298298

299+
static void sun4i_backend_atomic_begin(struct sunxi_engine *engine,
300+
struct drm_crtc_state *old_state)
301+
{
302+
u32 val;
303+
304+
WARN_ON(regmap_read_poll_timeout(engine->regs,
305+
SUN4I_BACKEND_REGBUFFCTL_REG,
306+
val, !(val & SUN4I_BACKEND_REGBUFFCTL_LOADCTL),
307+
100, 50000));
308+
}
309+
299310
static int sun4i_backend_atomic_check(struct sunxi_engine *engine,
300311
struct drm_crtc_state *crtc_state)
301312
{
@@ -478,6 +489,7 @@ static struct sun4i_frontend *sun4i_backend_find_frontend(struct sun4i_drv *drv,
478489
}
479490

480491
static const struct sunxi_engine_ops sun4i_backend_engine_ops = {
492+
.atomic_begin = sun4i_backend_atomic_begin,
481493
.atomic_check = sun4i_backend_atomic_check,
482494
.commit = sun4i_backend_commit,
483495
.layers_init = sun4i_layers_init,

0 commit comments

Comments
 (0)