[PATCH] drm/nouveau: Use drm_crtc_vblank_off/on

Daniel Vetter daniel at ffwll.ch
Tue Nov 15 21:59:36 UTC 2016


On Mon, Nov 14, 2016 at 12:41:01PM +0100, Daniel Vetter wrote:
> With atomic nv50+ is already converted over to them, but the old
> display code is still using it. Found in a 2 year old patch I have
> lying around to un-export these old helpers!
> 
> v2: Drop the hand-rolled versions from resume/suspend code. Now that
> crtc callbacks do this, we don't need a special case for s/r anymore.
> 
> v3: Remove unused variables.
> 
> Cc: Mario Kleiner <mario.kleiner.de at gmail.com>
> Cc: Ben Skeggs <bskeggs at redhat.com>
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> ---
>  drivers/gpu/drm/nouveau/dispnv04/crtc.c   |  4 ++--
>  drivers/gpu/drm/nouveau/nouveau_display.c | 11 +----------
>  2 files changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> index 0cb7a18cde26..59d1d1c5de5f 100644
> --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> @@ -702,7 +702,7 @@ static void nv_crtc_prepare(struct drm_crtc *crtc)
>  	if (nv_two_heads(dev))
>  		NVSetOwner(dev, nv_crtc->index);
>  
> -	drm_vblank_pre_modeset(dev, nv_crtc->index);
> +	drm_crtc_vblank_off(crtc);
>  	funcs->dpms(crtc, DRM_MODE_DPMS_OFF);
>  
>  	NVBlankScreen(dev, nv_crtc->index, true);
> @@ -734,7 +734,7 @@ static void nv_crtc_commit(struct drm_crtc *crtc)
>  #endif
>  
>  	funcs->dpms(crtc, DRM_MODE_DPMS_ON);
> -	drm_vblank_post_modeset(dev, nv_crtc->index);
> +	drm_crtc_vblank_on(crtc);
>  }
>  
>  static void nv_crtc_destroy(struct drm_crtc *crtc)
> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
> index 75c90a8da18a..76c342bf047b 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> @@ -380,15 +380,10 @@ nouveau_display_fini(struct drm_device *dev, bool suspend)
>  	struct nouveau_display *disp = nouveau_display(dev);
>  	struct nouveau_drm *drm = nouveau_drm(dev);
>  	struct drm_connector *connector;
> -	int head;
>  
>  	if (!suspend)
>  		drm_crtc_force_disable_all(dev);
>  
> -	/* Make sure that drm and hw vblank irqs get properly disabled. */
> -	for (head = 0; head < dev->mode_config.num_crtc; head++)
> -		drm_vblank_off(dev, head);
> -

compared with the pre-atomic-rebase patch and realized we still need this
part for pre-nv50, since we don't force-disable all the crtc on suspend.
Atomic otoh does that, so should be all good. With that change it again
matches a patch Mario tested (except for nv50), so figured it should be
safe and applied it to drm-misc.
-Daniel

>  	/* disable flip completion events */
>  	nvif_notify_put(&drm->flip);
>  
> @@ -723,7 +718,7 @@ nouveau_display_resume(struct drm_device *dev, bool runtime)
>  	struct nouveau_display *disp = nouveau_display(dev);
>  	struct nouveau_drm *drm = nouveau_drm(dev);
>  	struct drm_crtc *crtc;
> -	int ret, head;
> +	int ret;
>  
>  	if (dev->mode_config.funcs->atomic_commit) {
>  		nouveau_display_init(dev);
> @@ -777,10 +772,6 @@ nouveau_display_resume(struct drm_device *dev, bool runtime)
>  
>  	drm_helper_resume_force_mode(dev);
>  
> -	/* Make sure that drm and hw vblank irqs get resumed if needed. */
> -	for (head = 0; head < dev->mode_config.num_crtc; head++)
> -		drm_vblank_on(dev, head);
> -
>  	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
>  		struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
>  
> -- 
> 2.10.2
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list