Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1280536 > unrolled thread

[RFC PATCH 0/9] drm/rockchip: covert to support atomic API

Started byMark Yao <mark.yao@rock-chips.com>
First post2015-12-01 04:30 +0100
Last post2015-12-01 04:40 +0100
Articles 6 on this page of 26 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [RFC PATCH 0/9] drm/rockchip: covert to support atomic API Mark Yao <mark.yao@rock-chips.com> - 2015-12-01 04:30 +0100
    [RFC PATCH 2/9] drm/rockchip: Use new vblank api drm_crtc_vblank_* Mark Yao <mark.yao@rock-chips.com> - 2015-12-01 04:30 +0100
      Re: [RFC PATCH 2/9] drm/rockchip: Use new vblank api drm_crtc_vblank_* Daniel Stone <daniel@fooishbar.org> - 2015-12-01 09:00 +0100
        Re: [RFC PATCH 2/9] drm/rockchip: Use new vblank api drm_crtc_vblank_* Mark yao <mark.yao@rock-chips.com> - 2015-12-01 09:40 +0100
          Re: [RFC PATCH 2/9] drm/rockchip: Use new vblank api  drm_crtc_vblank_* Daniel Vetter <daniel@ffwll.ch> - 2015-12-01 10:10 +0100
            Re: [RFC PATCH 2/9] drm/rockchip: Use new vblank api drm_crtc_vblank_* Mark yao <mark.yao@rock-chips.com> - 2015-12-01 10:50 +0100
    [RFC PATCH 4/9] drm/rockchip: support atomic asynchronous commit Mark Yao <mark.yao@rock-chips.com> - 2015-12-01 04:30 +0100
    [RFC PATCH 1/9] drm/rockchip: vop: replace dpms with enable/disable Mark Yao <mark.yao@rock-chips.com> - 2015-12-01 04:30 +0100
    [RFC PATCH 3/9] drm/rockchip: Convert to support atomic API Mark Yao <mark.yao@rock-chips.com> - 2015-12-01 04:30 +0100
      Re: [RFC PATCH 3/9] drm/rockchip: Convert to support atomic API Daniel Stone <daniel@fooishbar.org> - 2015-12-01 09:20 +0100
        Re: [RFC PATCH 3/9] drm/rockchip: Convert to support atomic API Mark yao <mark.yao@rock-chips.com> - 2015-12-01 10:30 +0100
        Re: [RFC PATCH 3/9] drm/rockchip: Convert to support atomic API Mark yao <mark.yao@rock-chips.com> - 2015-12-01 10:40 +0100
          Re: [RFC PATCH 3/9] drm/rockchip: Convert to support atomic API Daniel Stone <daniel@fooishbar.org> - 2015-12-02 15:20 +0100
            Re: [RFC PATCH 3/9] drm/rockchip: Convert to support atomic API Daniel Stone <daniel@fooishbar.org> - 2015-12-02 15:30 +0100
            Re: [RFC PATCH 3/9] drm/rockchip: Convert to support atomic API Mark yao <mark.yao@rock-chips.com> - 2015-12-11 07:30 +0100
    [RFC PATCH 8/9] drm: bridge/dw_hdmi: Covert to support atomic API Mark Yao <mark.yao@rock-chips.com> - 2015-12-01 04:40 +0100
      Re: [RFC PATCH 8/9] drm: bridge/dw_hdmi: Covert to support atomic API Daniel Vetter <daniel@ffwll.ch> - 2015-12-01 08:30 +0100
        Re: [RFC PATCH 8/9] drm: bridge/dw_hdmi: Covert to support atomic  API Mark yao <mark.yao@rock-chips.com> - 2015-12-01 09:10 +0100
      [PATCH] drm: bridge/dw_hdmi: add atomic API support Mark Yao <mark.yao@rock-chips.com> - 2015-12-01 09:20 +0100
    [RFC PATCH 7/9] drm/rockchip: force enable vop when do mode setting Mark Yao <mark.yao@rock-chips.com> - 2015-12-01 04:40 +0100
      Re: [RFC PATCH 7/9] drm/rockchip: force enable vop when do mode  setting Thierry Reding <thierry.reding@gmail.com> - 2015-12-02 18:00 +0100
        Re: [RFC PATCH 7/9] drm/rockchip: force enable vop when do mode  setting Daniel Vetter <daniel@ffwll.ch> - 2015-12-02 23:20 +0100
          Re: [RFC PATCH 7/9] drm/rockchip: force enable vop when do mode setting Mark yao <mark.yao@rock-chips.com> - 2015-12-03 03:00 +0100
    [RFC PATCH 6/9] drm/rockchip: direct config connecter gate and out_mode Mark Yao <mark.yao@rock-chips.com> - 2015-12-01 04:40 +0100
    [RFC PATCH 9/9] drm/rockchip: dw_hdmi: use encoder enable function Mark Yao <mark.yao@rock-chips.com> - 2015-12-01 04:40 +0100
    [RFC PATCH 5/9] drm/rockchip: Optimization vop mode set Mark Yao <mark.yao@rock-chips.com> - 2015-12-01 04:40 +0100

Page 2 of 2 — ← Prev page 1 [2]


#1282023 — Re: [RFC PATCH 7/9] drm/rockchip: force enable vop when do mode setting

FromThierry Reding <thierry.reding@gmail.com>
Date2015-12-02 18:00 +0100
SubjectRe: [RFC PATCH 7/9] drm/rockchip: force enable vop when do mode setting
Message-ID<qBiV5-1mH-37@gated-at.bofh.it>
In reply to#1280544

[Multipart message — attachments visible in raw view] — view raw

On Tue, Dec 01, 2015 at 11:32:01AM +0800, Mark Yao wrote:
> When do mode setting, mean that we want to enable display output,
> but sometimes, vop_crtc_enable is after mode_set, we can't allow
> that, so force enable vop in mode setting.
> 
> Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index c65b454..7c07537 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -1110,6 +1110,7 @@ static void vop_crtc_mode_set_nofb(struct drm_crtc *crtc)
>  	u16 vact_end = vact_st + vdisplay;
>  	uint32_t val;
>  
> +	vop_crtc_enable(crtc);
>  	/*
>  	 * If dclk rate is zero, mean that scanout is stop,
>  	 * we don't need wait any more.

Have you considered simply moving everything into ->enable()? That's
what I did for Tegra, for much the same reasons that you gave in the
commit message. Doing so gives you a much simpler call graph. Really
the only thing you need to do is move around the code, and perhaps a
different way to get ahold of the display mode, but you can use the
Tegra driver as a reference for how to do that.

Thierry

[toc] | [prev] | [next] | [standalone]


#1282471 — Re: [RFC PATCH 7/9] drm/rockchip: force enable vop when do mode setting

FromDaniel Vetter <daniel@ffwll.ch>
Date2015-12-02 23:20 +0100
SubjectRe: [RFC PATCH 7/9] drm/rockchip: force enable vop when do mode setting
Message-ID<qBnUK-4LF-21@gated-at.bofh.it>
In reply to#1282023
On Wed, Dec 02, 2015 at 05:55:36PM +0100, Thierry Reding wrote:
> On Tue, Dec 01, 2015 at 11:32:01AM +0800, Mark Yao wrote:
> > When do mode setting, mean that we want to enable display output,
> > but sometimes, vop_crtc_enable is after mode_set, we can't allow
> > that, so force enable vop in mode setting.
> > 
> > Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
> > ---
> >  drivers/gpu/drm/rockchip/rockchip_drm_vop.c |    1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> > index c65b454..7c07537 100644
> > --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> > @@ -1110,6 +1110,7 @@ static void vop_crtc_mode_set_nofb(struct drm_crtc *crtc)
> >  	u16 vact_end = vact_st + vdisplay;
> >  	uint32_t val;
> >  
> > +	vop_crtc_enable(crtc);
> >  	/*
> >  	 * If dclk rate is zero, mean that scanout is stop,
> >  	 * we don't need wait any more.
> 
> Have you considered simply moving everything into ->enable()? That's
> what I did for Tegra, for much the same reasons that you gave in the
> commit message. Doing so gives you a much simpler call graph. Really
> the only thing you need to do is move around the code, and perhaps a
> different way to get ahold of the display mode, but you can use the
> Tegra driver as a reference for how to do that.

Yeah if writing mode related registers requires the thing to be on on your
hw then you can't use the ->mode_set hooks. Those are explicitly called
when everything is off (not just sometimes, at least with atomic helpers).

Like Thierry said the recommendation is to just shovel that code into
->enable hooks. ->mode_set_nofb is mostly there to support easier
transition for drivers which started with the legacy crtc helpers.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1282643 — Re: [RFC PATCH 7/9] drm/rockchip: force enable vop when do mode setting

FromMark yao <mark.yao@rock-chips.com>
Date2015-12-03 03:00 +0100
SubjectRe: [RFC PATCH 7/9] drm/rockchip: force enable vop when do mode setting
Message-ID<qBrlE-6L5-7@gated-at.bofh.it>
In reply to#1282471
On 2015年12月03日 06:17, Daniel Vetter wrote:
> On Wed, Dec 02, 2015 at 05:55:36PM +0100, Thierry Reding wrote:
>> On Tue, Dec 01, 2015 at 11:32:01AM +0800, Mark Yao wrote:
>>> When do mode setting, mean that we want to enable display output,
>>> but sometimes, vop_crtc_enable is after mode_set, we can't allow
>>> that, so force enable vop in mode setting.
>>>
>>> Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
>>> ---
>>>   drivers/gpu/drm/rockchip/rockchip_drm_vop.c |    1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
>>> index c65b454..7c07537 100644
>>> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
>>> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
>>> @@ -1110,6 +1110,7 @@ static void vop_crtc_mode_set_nofb(struct drm_crtc *crtc)
>>>   	u16 vact_end = vact_st + vdisplay;
>>>   	uint32_t val;
>>>   
>>> +	vop_crtc_enable(crtc);
>>>   	/*
>>>   	 * If dclk rate is zero, mean that scanout is stop,
>>>   	 * we don't need wait any more.
>> Have you considered simply moving everything into ->enable()? That's
>> what I did for Tegra, for much the same reasons that you gave in the
>> commit message. Doing so gives you a much simpler call graph. Really
>> the only thing you need to do is move around the code, and perhaps a
>> different way to get ahold of the display mode, but you can use the
>> Tegra driver as a reference for how to do that.
> Yeah if writing mode related registers requires the thing to be on on your
> hw then you can't use the ->mode_set hooks. Those are explicitly called
> when everything is off (not just sometimes, at least with atomic helpers).
>
> Like Thierry said the recommendation is to just shovel that code into
> ->enable hooks. ->mode_set_nofb is mostly there to support easier
> transition for drivers which started with the legacy crtc helpers.
> -Daniel

Good, thanks, actually it solve my confusion.

-- 
Mark Yao


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1280545 — [RFC PATCH 6/9] drm/rockchip: direct config connecter gate and out_mode

FromMark Yao <mark.yao@rock-chips.com>
Date2015-12-01 04:40 +0100
Subject[RFC PATCH 6/9] drm/rockchip: direct config connecter gate and out_mode
Message-ID<qAJXj-4df-11@gated-at.bofh.it>
In reply to#1280536
Both connecter gate and out_mode are not conflict with mode set
configure. Direct setting connecter gate and out_mode, that allow
connector do rockchip_drm_crtc_mode_config after mode set.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   41 ++++++++++++---------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 6317dea..c65b454 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -90,9 +90,6 @@ struct vop {
 	struct drm_device *drm_dev;
 	bool is_enabled;
 
-	int connector_type;
-	int connector_out_mode;
-
 	/* mutex vsync_ work */
 	struct mutex vsync_mutex;
 	bool vsync_work_pending;
@@ -1029,8 +1026,24 @@ int rockchip_drm_crtc_mode_config(struct drm_crtc *crtc,
 {
 	struct vop *vop = to_vop(crtc);
 
-	vop->connector_type = connector_type;
-	vop->connector_out_mode = out_mode;
+	if (WARN_ON(!vop->is_enabled))
+		return -EINVAL;
+
+	switch (connector_type) {
+	case DRM_MODE_CONNECTOR_LVDS:
+		VOP_CTRL_SET(vop, rgb_en, 1);
+		break;
+	case DRM_MODE_CONNECTOR_eDP:
+		VOP_CTRL_SET(vop, edp_en, 1);
+		break;
+	case DRM_MODE_CONNECTOR_HDMIA:
+		VOP_CTRL_SET(vop, hdmi_en, 1);
+		break;
+	default:
+		DRM_ERROR("unsupport connector_type[%d]\n", connector_type);
+		return -EINVAL;
+	};
+	VOP_CTRL_SET(vop, out_mode, out_mode);
 
 	return 0;
 }
@@ -1132,24 +1145,6 @@ static void vop_crtc_mode_set_nofb(struct drm_crtc *crtc)
 
 		vop_dsp_hold_valid_irq_disable(vop);
 	}
-
-	switch (vop->connector_type) {
-	case DRM_MODE_CONNECTOR_LVDS:
-		VOP_CTRL_SET(vop, rgb_en, 1);
-		break;
-	case DRM_MODE_CONNECTOR_eDP:
-		VOP_CTRL_SET(vop, edp_en, 1);
-		break;
-	case DRM_MODE_CONNECTOR_HDMIA:
-		VOP_CTRL_SET(vop, hdmi_en, 1);
-		break;
-	default:
-		DRM_ERROR("unsupport connector_type[%d]\n",
-			  vop->connector_type);
-		goto out;
-	};
-	VOP_CTRL_SET(vop, out_mode, vop->connector_out_mode);
-
 	val = 0x8;
 	val |= (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC) ? 0 : 1;
 	val |= (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC) ? 0 : (1 << 1);
-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1280546 — [RFC PATCH 9/9] drm/rockchip: dw_hdmi: use encoder enable function

FromMark Yao <mark.yao@rock-chips.com>
Date2015-12-01 04:40 +0100
Subject[RFC PATCH 9/9] drm/rockchip: dw_hdmi: use encoder enable function
Message-ID<qAJXj-4df-15@gated-at.bofh.it>
In reply to#1280536
encoder.enable is more compatible to atomic api than encoder.prepare/commit

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index 80d6fc8..cfe052c 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -195,12 +195,15 @@ static void dw_hdmi_rockchip_encoder_mode_set(struct drm_encoder *encoder,
 {
 }
 
-static void dw_hdmi_rockchip_encoder_commit(struct drm_encoder *encoder)
+static void dw_hdmi_rockchip_encoder_enable(struct drm_encoder *encoder)
 {
 	struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder);
 	u32 val;
 	int mux;
 
+	rockchip_drm_crtc_mode_config(encoder->crtc, DRM_MODE_CONNECTOR_HDMIA,
+				      ROCKCHIP_OUT_MODE_AAAA);
+
 	mux = rockchip_drm_encoder_get_mux_id(hdmi->dev->of_node, encoder);
 	if (mux)
 		val = HDMI_SEL_VOP_LIT | (HDMI_SEL_VOP_LIT << 16);
@@ -212,17 +215,10 @@ static void dw_hdmi_rockchip_encoder_commit(struct drm_encoder *encoder)
 		(mux) ? "LIT" : "BIG");
 }
 
-static void dw_hdmi_rockchip_encoder_prepare(struct drm_encoder *encoder)
-{
-	rockchip_drm_crtc_mode_config(encoder->crtc, DRM_MODE_CONNECTOR_HDMIA,
-				      ROCKCHIP_OUT_MODE_AAAA);
-}
-
 static struct drm_encoder_helper_funcs dw_hdmi_rockchip_encoder_helper_funcs = {
 	.mode_fixup = dw_hdmi_rockchip_encoder_mode_fixup,
 	.mode_set   = dw_hdmi_rockchip_encoder_mode_set,
-	.prepare    = dw_hdmi_rockchip_encoder_prepare,
-	.commit     = dw_hdmi_rockchip_encoder_commit,
+	.enable     = dw_hdmi_rockchip_encoder_enable,
 	.disable    = dw_hdmi_rockchip_encoder_disable,
 };
 
-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1280547 — [RFC PATCH 5/9] drm/rockchip: Optimization vop mode set

FromMark Yao <mark.yao@rock-chips.com>
Date2015-12-01 04:40 +0100
Subject[RFC PATCH 5/9] drm/rockchip: Optimization vop mode set
Message-ID<qAJXj-4df-7@gated-at.bofh.it>
In reply to#1280536
Rk3288 vop timing registers is immediately register, when configure
timing on display active time, will cause tearing. use dclk reset is
not a good idea to avoid this tearing. we can avoid tearing by using
standby register.

Vop standby register will take effect at end of current frame, and
go back to work immediately when exit standby.

So we can use standby register to protect this context.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   49 +++++++++++++++++++--------
 1 file changed, 34 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index a28e255..6317dea 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1098,10 +1098,40 @@ static void vop_crtc_mode_set_nofb(struct drm_crtc *crtc)
 	uint32_t val;
 
 	/*
-	 * disable dclk to stop frame scan, so that we can safe config mode and
-	 * enable iommu.
+	 * If dclk rate is zero, mean that scanout is stop,
+	 * we don't need wait any more.
 	 */
-	clk_disable(vop->dclk);
+	if (clk_get_rate(vop->dclk)) {
+		/*
+		 * Rk3288 vop timing register is immediately, when configure
+		 * display timing on display time, may cause tearing.
+		 *
+		 * Vop standby will take effect at end of current frame,
+		 * if dsp hold valid irq happen, it means standby complete.
+		 *
+		 * mode set:
+		 *    standby and wait complete --> |----
+		 *                                  | display time
+		 *                                  |----
+		 *                                  |---> dsp hold irq
+		 *     configure display timing --> |
+		 *         standby exit             |
+		 *                                  | new frame start.
+		 */
+
+		reinit_completion(&vop->dsp_hold_completion);
+		vop_dsp_hold_valid_irq_enable(vop);
+
+		spin_lock(&vop->reg_lock);
+
+		VOP_CTRL_SET(vop, standby, 1);
+
+		spin_unlock(&vop->reg_lock);
+
+		wait_for_completion(&vop->dsp_hold_completion);
+
+		vop_dsp_hold_valid_irq_disable(vop);
+	}
 
 	switch (vop->connector_type) {
 	case DRM_MODE_CONNECTOR_LVDS:
@@ -1137,20 +1167,9 @@ static void vop_crtc_mode_set_nofb(struct drm_crtc *crtc)
 	VOP_CTRL_SET(vop, vact_st_end, val);
 	VOP_CTRL_SET(vop, vpost_st_end, val);
 
-
-	/*
-	 * reset dclk, take all mode config affect, so the clk would run in
-	 * correct frame.
-	 */
-	reset_control_assert(vop->dclk_rst);
-	usleep_range(10, 20);
-	reset_control_deassert(vop->dclk_rst);
-
 	clk_set_rate(vop->dclk, adjusted_mode->clock * 1000);
-out:
-	if (clk_enable(vop->dclk) < 0)
-		dev_err(vop->dev, "failed to enable dclk - %d\n", ret_clk);
 
+	VOP_CTRL_SET(vop, standby, 0);
 }
 
 static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web