Message ID | 20190114153118.8024-1-narmstrong@baylibre.com (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Neil Armstrong |
Headers | show |
Series | [v2] drm/meson: Fix atomic mode switching regression | expand |
On Mon, Jan 14, 2019 at 04:31:18PM +0100, Neil Armstrong wrote: > Since commit 2bcd3ecab773 when switching mode from X11 (ubuntu mate for > example) the display gets blurry, looking like an invalid framebuffer width. > > This commit fixed atomic crtc modesetting in a totally wrong way and > introduced a local unnecessary ->enabled crtc state. > > This commit reverts the crctc _begin() and _enable() changes and simply > adds drm_atomic_helper_commit_tail_rpm as helper. > > Reported-by: Tony McKahan <tonymckahan@gmail.com> > Suggested-by: Daniel Vetter <daniel@ffwll.ch> > Fixes: 2bcd3ecab773 ("drm/meson: Fixes for drm_crtc_vblank_on/off support") > Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> For the record (I already acked this on irc): Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> > --- > drivers/gpu/drm/meson/meson_crtc.c | 23 ++--------------------- > drivers/gpu/drm/meson/meson_drv.c | 6 ++++++ > 2 files changed, 8 insertions(+), 21 deletions(-) > > Changes since v1: > - drop the unecessary local ->enabled logic > - use drm_atomic_helper_commit_tail_rpm as atomic_commit_tail helper > > diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c > index 75d97f1b2e8f..4f5c67f70c4d 100644 > --- a/drivers/gpu/drm/meson/meson_crtc.c > +++ b/drivers/gpu/drm/meson/meson_crtc.c > @@ -46,7 +46,6 @@ struct meson_crtc { > struct drm_crtc base; > struct drm_pending_vblank_event *event; > struct meson_drm *priv; > - bool enabled; > }; > #define to_meson_crtc(x) container_of(x, struct meson_crtc, base) > > @@ -82,7 +81,8 @@ static const struct drm_crtc_funcs meson_crtc_funcs = { > > }; > > -static void meson_crtc_enable(struct drm_crtc *crtc) > +static void meson_crtc_atomic_enable(struct drm_crtc *crtc, > + struct drm_crtc_state *old_state) > { > struct meson_crtc *meson_crtc = to_meson_crtc(crtc); > struct drm_crtc_state *crtc_state = crtc->state; > @@ -108,20 +108,6 @@ static void meson_crtc_enable(struct drm_crtc *crtc) > > drm_crtc_vblank_on(crtc); > > - meson_crtc->enabled = true; > -} > - > -static void meson_crtc_atomic_enable(struct drm_crtc *crtc, > - struct drm_crtc_state *old_state) > -{ > - struct meson_crtc *meson_crtc = to_meson_crtc(crtc); > - struct meson_drm *priv = meson_crtc->priv; > - > - DRM_DEBUG_DRIVER("\n"); > - > - if (!meson_crtc->enabled) > - meson_crtc_enable(crtc); > - > priv->viu.osd1_enabled = true; > } > > @@ -153,8 +139,6 @@ static void meson_crtc_atomic_disable(struct drm_crtc *crtc, > > crtc->state->event = NULL; > } > - > - meson_crtc->enabled = false; > } > > static void meson_crtc_atomic_begin(struct drm_crtc *crtc, > @@ -163,9 +147,6 @@ static void meson_crtc_atomic_begin(struct drm_crtc *crtc, > struct meson_crtc *meson_crtc = to_meson_crtc(crtc); > unsigned long flags; > > - if (crtc->state->enable && !meson_crtc->enabled) > - meson_crtc_enable(crtc); > - > if (crtc->state->event) { > WARN_ON(drm_crtc_vblank_get(crtc) != 0); > > diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c > index 3ee4d4a4ecba..a74d861ddceb 100644 > --- a/drivers/gpu/drm/meson/meson_drv.c > +++ b/drivers/gpu/drm/meson/meson_drv.c > @@ -75,6 +75,11 @@ static const struct drm_mode_config_funcs meson_mode_config_funcs = { > .fb_create = drm_gem_fb_create, > }; > > + > +static const struct drm_mode_config_helper_funcs meson_mode_config_helpers = { > + .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm, > +}; > + > static irqreturn_t meson_irq(int irq, void *arg) > { > struct drm_device *dev = arg; > @@ -266,6 +271,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) > drm->mode_config.max_width = 3840; > drm->mode_config.max_height = 2160; > drm->mode_config.funcs = &meson_mode_config_funcs; > + drm->mode_config.helper_private = &meson_mode_config_helpers; > > /* Hardware Initialization */ > > -- > 2.20.1 >
On 15/01/2019 13:06, Daniel Vetter wrote: > On Mon, Jan 14, 2019 at 04:31:18PM +0100, Neil Armstrong wrote: >> Since commit 2bcd3ecab773 when switching mode from X11 (ubuntu mate for >> example) the display gets blurry, looking like an invalid framebuffer width. >> >> This commit fixed atomic crtc modesetting in a totally wrong way and >> introduced a local unnecessary ->enabled crtc state. >> >> This commit reverts the crctc _begin() and _enable() changes and simply >> adds drm_atomic_helper_commit_tail_rpm as helper. >> >> Reported-by: Tony McKahan <tonymckahan@gmail.com> >> Suggested-by: Daniel Vetter <daniel@ffwll.ch> >> Fixes: 2bcd3ecab773 ("drm/meson: Fixes for drm_crtc_vblank_on/off support") >> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> > > For the record (I already acked this on irc): Thanks, I got it, I was checking against the known regression to see if it doesn't add a new one ! > > Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Applied to drm-misc-fixes Neil >> --- >> drivers/gpu/drm/meson/meson_crtc.c | 23 ++--------------------- >> drivers/gpu/drm/meson/meson_drv.c | 6 ++++++ >> 2 files changed, 8 insertions(+), 21 deletions(-) >> >> Changes since v1: >> - drop the unecessary local ->enabled logic >> - use drm_atomic_helper_commit_tail_rpm as atomic_commit_tail helper >> >> diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c >> index 75d97f1b2e8f..4f5c67f70c4d 100644 >> --- a/drivers/gpu/drm/meson/meson_crtc.c >> +++ b/drivers/gpu/drm/meson/meson_crtc.c >> @@ -46,7 +46,6 @@ struct meson_crtc { >> struct drm_crtc base; >> struct drm_pending_vblank_event *event; >> struct meson_drm *priv; >> - bool enabled; >> }; >> #define to_meson_crtc(x) container_of(x, struct meson_crtc, base) >> >> @@ -82,7 +81,8 @@ static const struct drm_crtc_funcs meson_crtc_funcs = { >> >> }; >> >> -static void meson_crtc_enable(struct drm_crtc *crtc) >> +static void meson_crtc_atomic_enable(struct drm_crtc *crtc, >> + struct drm_crtc_state *old_state) >> { >> struct meson_crtc *meson_crtc = to_meson_crtc(crtc); >> struct drm_crtc_state *crtc_state = crtc->state; >> @@ -108,20 +108,6 @@ static void meson_crtc_enable(struct drm_crtc *crtc) >> >> drm_crtc_vblank_on(crtc); >> >> - meson_crtc->enabled = true; >> -} >> - >> -static void meson_crtc_atomic_enable(struct drm_crtc *crtc, >> - struct drm_crtc_state *old_state) >> -{ >> - struct meson_crtc *meson_crtc = to_meson_crtc(crtc); >> - struct meson_drm *priv = meson_crtc->priv; >> - >> - DRM_DEBUG_DRIVER("\n"); >> - >> - if (!meson_crtc->enabled) >> - meson_crtc_enable(crtc); >> - >> priv->viu.osd1_enabled = true; >> } >> >> @@ -153,8 +139,6 @@ static void meson_crtc_atomic_disable(struct drm_crtc *crtc, >> >> crtc->state->event = NULL; >> } >> - >> - meson_crtc->enabled = false; >> } >> >> static void meson_crtc_atomic_begin(struct drm_crtc *crtc, >> @@ -163,9 +147,6 @@ static void meson_crtc_atomic_begin(struct drm_crtc *crtc, >> struct meson_crtc *meson_crtc = to_meson_crtc(crtc); >> unsigned long flags; >> >> - if (crtc->state->enable && !meson_crtc->enabled) >> - meson_crtc_enable(crtc); >> - >> if (crtc->state->event) { >> WARN_ON(drm_crtc_vblank_get(crtc) != 0); >> >> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c >> index 3ee4d4a4ecba..a74d861ddceb 100644 >> --- a/drivers/gpu/drm/meson/meson_drv.c >> +++ b/drivers/gpu/drm/meson/meson_drv.c >> @@ -75,6 +75,11 @@ static const struct drm_mode_config_funcs meson_mode_config_funcs = { >> .fb_create = drm_gem_fb_create, >> }; >> >> + >> +static const struct drm_mode_config_helper_funcs meson_mode_config_helpers = { >> + .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm, >> +}; >> + >> static irqreturn_t meson_irq(int irq, void *arg) >> { >> struct drm_device *dev = arg; >> @@ -266,6 +271,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) >> drm->mode_config.max_width = 3840; >> drm->mode_config.max_height = 2160; >> drm->mode_config.funcs = &meson_mode_config_funcs; >> + drm->mode_config.helper_private = &meson_mode_config_helpers; >> >> /* Hardware Initialization */ >> >> -- >> 2.20.1 >> >
Hi Stable kernel team, On 14/01/2019 16:31, Neil Armstrong wrote: > Since commit 2bcd3ecab773 when switching mode from X11 (ubuntu mate for > example) the display gets blurry, looking like an invalid framebuffer width. > > This commit fixed atomic crtc modesetting in a totally wrong way and > introduced a local unnecessary ->enabled crtc state. > > This commit reverts the crctc _begin() and _enable() changes and simply > adds drm_atomic_helper_commit_tail_rpm as helper. > > Reported-by: Tony McKahan <tonymckahan@gmail.com> > Suggested-by: Daniel Vetter <daniel@ffwll.ch> > Fixes: 2bcd3ecab773 ("drm/meson: Fixes for drm_crtc_vblank_on/off support") > Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> This fix has landed in linus master with id ce0210c12433031aba3bbacd75f4c02ab77f2004 could it be applied to 4.19 and 4.20 stable trees ? Thanks, Neil > --- > drivers/gpu/drm/meson/meson_crtc.c | 23 ++--------------------- > drivers/gpu/drm/meson/meson_drv.c | 6 ++++++ > 2 files changed, 8 insertions(+), 21 deletions(-) > > Changes since v1: > - drop the unecessary local ->enabled logic > - use drm_atomic_helper_commit_tail_rpm as atomic_commit_tail helper > > diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c > index 75d97f1b2e8f..4f5c67f70c4d 100644 > --- a/drivers/gpu/drm/meson/meson_crtc.c > +++ b/drivers/gpu/drm/meson/meson_crtc.c > @@ -46,7 +46,6 @@ struct meson_crtc { > struct drm_crtc base; > struct drm_pending_vblank_event *event; > struct meson_drm *priv; > - bool enabled; > }; > #define to_meson_crtc(x) container_of(x, struct meson_crtc, base) > > @@ -82,7 +81,8 @@ static const struct drm_crtc_funcs meson_crtc_funcs = { > > }; > > -static void meson_crtc_enable(struct drm_crtc *crtc) > +static void meson_crtc_atomic_enable(struct drm_crtc *crtc, > + struct drm_crtc_state *old_state) > { > struct meson_crtc *meson_crtc = to_meson_crtc(crtc); > struct drm_crtc_state *crtc_state = crtc->state; > @@ -108,20 +108,6 @@ static void meson_crtc_enable(struct drm_crtc *crtc) > > drm_crtc_vblank_on(crtc); > > - meson_crtc->enabled = true; > -} > - > -static void meson_crtc_atomic_enable(struct drm_crtc *crtc, > - struct drm_crtc_state *old_state) > -{ > - struct meson_crtc *meson_crtc = to_meson_crtc(crtc); > - struct meson_drm *priv = meson_crtc->priv; > - > - DRM_DEBUG_DRIVER("\n"); > - > - if (!meson_crtc->enabled) > - meson_crtc_enable(crtc); > - > priv->viu.osd1_enabled = true; > } > > @@ -153,8 +139,6 @@ static void meson_crtc_atomic_disable(struct drm_crtc *crtc, > > crtc->state->event = NULL; > } > - > - meson_crtc->enabled = false; > } > > static void meson_crtc_atomic_begin(struct drm_crtc *crtc, > @@ -163,9 +147,6 @@ static void meson_crtc_atomic_begin(struct drm_crtc *crtc, > struct meson_crtc *meson_crtc = to_meson_crtc(crtc); > unsigned long flags; > > - if (crtc->state->enable && !meson_crtc->enabled) > - meson_crtc_enable(crtc); > - > if (crtc->state->event) { > WARN_ON(drm_crtc_vblank_get(crtc) != 0); > > diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c > index 3ee4d4a4ecba..a74d861ddceb 100644 > --- a/drivers/gpu/drm/meson/meson_drv.c > +++ b/drivers/gpu/drm/meson/meson_drv.c > @@ -75,6 +75,11 @@ static const struct drm_mode_config_funcs meson_mode_config_funcs = { > .fb_create = drm_gem_fb_create, > }; > > + > +static const struct drm_mode_config_helper_funcs meson_mode_config_helpers = { > + .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm, > +}; > + > static irqreturn_t meson_irq(int irq, void *arg) > { > struct drm_device *dev = arg; > @@ -266,6 +271,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) > drm->mode_config.max_width = 3840; > drm->mode_config.max_height = 2160; > drm->mode_config.funcs = &meson_mode_config_funcs; > + drm->mode_config.helper_private = &meson_mode_config_helpers; > > /* Hardware Initialization */ > >
On Mon, Jan 28, 2019 at 05:21:12PM +0100, Neil Armstrong wrote: > Hi Stable kernel team, > > On 14/01/2019 16:31, Neil Armstrong wrote: > > Since commit 2bcd3ecab773 when switching mode from X11 (ubuntu mate for > > example) the display gets blurry, looking like an invalid framebuffer width. > > > > This commit fixed atomic crtc modesetting in a totally wrong way and > > introduced a local unnecessary ->enabled crtc state. > > > > This commit reverts the crctc _begin() and _enable() changes and simply > > adds drm_atomic_helper_commit_tail_rpm as helper. > > > > Reported-by: Tony McKahan <tonymckahan@gmail.com> > > Suggested-by: Daniel Vetter <daniel@ffwll.ch> > > Fixes: 2bcd3ecab773 ("drm/meson: Fixes for drm_crtc_vblank_on/off support") > > Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> > > This fix has landed in linus master with id ce0210c12433031aba3bbacd75f4c02ab77f2004 > > could it be applied to 4.19 and 4.20 stable trees ? Now queued up, thanks. greg k-h
diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c index 75d97f1b2e8f..4f5c67f70c4d 100644 --- a/drivers/gpu/drm/meson/meson_crtc.c +++ b/drivers/gpu/drm/meson/meson_crtc.c @@ -46,7 +46,6 @@ struct meson_crtc { struct drm_crtc base; struct drm_pending_vblank_event *event; struct meson_drm *priv; - bool enabled; }; #define to_meson_crtc(x) container_of(x, struct meson_crtc, base) @@ -82,7 +81,8 @@ static const struct drm_crtc_funcs meson_crtc_funcs = { }; -static void meson_crtc_enable(struct drm_crtc *crtc) +static void meson_crtc_atomic_enable(struct drm_crtc *crtc, + struct drm_crtc_state *old_state) { struct meson_crtc *meson_crtc = to_meson_crtc(crtc); struct drm_crtc_state *crtc_state = crtc->state; @@ -108,20 +108,6 @@ static void meson_crtc_enable(struct drm_crtc *crtc) drm_crtc_vblank_on(crtc); - meson_crtc->enabled = true; -} - -static void meson_crtc_atomic_enable(struct drm_crtc *crtc, - struct drm_crtc_state *old_state) -{ - struct meson_crtc *meson_crtc = to_meson_crtc(crtc); - struct meson_drm *priv = meson_crtc->priv; - - DRM_DEBUG_DRIVER("\n"); - - if (!meson_crtc->enabled) - meson_crtc_enable(crtc); - priv->viu.osd1_enabled = true; } @@ -153,8 +139,6 @@ static void meson_crtc_atomic_disable(struct drm_crtc *crtc, crtc->state->event = NULL; } - - meson_crtc->enabled = false; } static void meson_crtc_atomic_begin(struct drm_crtc *crtc, @@ -163,9 +147,6 @@ static void meson_crtc_atomic_begin(struct drm_crtc *crtc, struct meson_crtc *meson_crtc = to_meson_crtc(crtc); unsigned long flags; - if (crtc->state->enable && !meson_crtc->enabled) - meson_crtc_enable(crtc); - if (crtc->state->event) { WARN_ON(drm_crtc_vblank_get(crtc) != 0); diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 3ee4d4a4ecba..a74d861ddceb 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -75,6 +75,11 @@ static const struct drm_mode_config_funcs meson_mode_config_funcs = { .fb_create = drm_gem_fb_create, }; + +static const struct drm_mode_config_helper_funcs meson_mode_config_helpers = { + .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm, +}; + static irqreturn_t meson_irq(int irq, void *arg) { struct drm_device *dev = arg; @@ -266,6 +271,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) drm->mode_config.max_width = 3840; drm->mode_config.max_height = 2160; drm->mode_config.funcs = &meson_mode_config_funcs; + drm->mode_config.helper_private = &meson_mode_config_helpers; /* Hardware Initialization */
Since commit 2bcd3ecab773 when switching mode from X11 (ubuntu mate for example) the display gets blurry, looking like an invalid framebuffer width. This commit fixed atomic crtc modesetting in a totally wrong way and introduced a local unnecessary ->enabled crtc state. This commit reverts the crctc _begin() and _enable() changes and simply adds drm_atomic_helper_commit_tail_rpm as helper. Reported-by: Tony McKahan <tonymckahan@gmail.com> Suggested-by: Daniel Vetter <daniel@ffwll.ch> Fixes: 2bcd3ecab773 ("drm/meson: Fixes for drm_crtc_vblank_on/off support") Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> --- drivers/gpu/drm/meson/meson_crtc.c | 23 ++--------------------- drivers/gpu/drm/meson/meson_drv.c | 6 ++++++ 2 files changed, 8 insertions(+), 21 deletions(-) Changes since v1: - drop the unecessary local ->enabled logic - use drm_atomic_helper_commit_tail_rpm as atomic_commit_tail helper