diff mbox

[RFC,7/9] drm/rockchip: force enable vop when do mode setting

Message ID 1448940721-23488-1-git-send-email-mark.yao@rock-chips.com (mailing list archive)
State New, archived
Headers show

Commit Message

yao mark Dec. 1, 2015, 3:32 a.m. UTC
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(+)

Comments

Thierry Reding Dec. 2, 2015, 4:55 p.m. UTC | #1
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
Daniel Vetter Dec. 2, 2015, 10:17 p.m. UTC | #2
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
yao mark Dec. 3, 2015, 1:54 a.m. UTC | #3
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.
diff mbox

Patch

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.