Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Kevin Hao <kexin.hao@windriver.com>
To: Jyri Sarha <jsarha@ti.com>
Cc: <dri-devel@lists.freedesktop.org>, <airlied@linux.ie>,
	<tomi.valkeinen@ti.com>, <laurent.pinchart@ideasonboard.com>,
	<stable@vger.kernel.org>
Subject: Re: [PATCH] drm/tilcdc: Force recalculation of vrefresh in tilcdc_crtc_set_mode()
Date: Thu, 12 Oct 2017 17:53:16 +0800	[thread overview]
Message-ID: <20171012095316.GA18038@pek-khao-d1> (raw)
In-Reply-To: <1507801165-21285-1-git-send-email-jsarha@ti.com>

[-- Attachment #1: Type: text/plain, Size: 1940 bytes --]

On Thu, Oct 12, 2017 at 12:39:25PM +0300, Jyri Sarha wrote:
> We are using the vrefresh to check if we are too close to vertical
> sync to update the two framebuffer DMA registers and risk a
> collision. The vrefresh is coming from user space and normally it is
> not used for anything. For instance xserver leaves vrefresh to zero
> causing a division by zero when setting the mode. We want to make sure
> the value is valid and force its recalculation in
> tilcdc_crtc_set_mode().
> 
> Reported-by: Kevin Hao <kexin.hao@windriver.com>
> Fixes: 11abbc9f39e0 ("drm/tilcdc: Set framebuffer DMA address to HW only if CRTC is enabled")
> Cc: <stable@vger.kernel.org> # v4.11+
> Signed-off-by: Jyri Sarha <jsarha@ti.com>
> ---
>  drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> index 704db24..aa5e87c 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> @@ -459,6 +459,16 @@ static void tilcdc_crtc_set_mode(struct drm_crtc *crtc)
>  	drm_framebuffer_get(fb);
>  
>  	crtc->hwmode = crtc->state->adjusted_mode;
> +
> +	/* We are using the vrefresh to check if we are too close to
> +	 * vertical sync to update the two framebuffer DMA registers
> +	 * and risk a collision. The vrefresh is coming from user
> +	 * space and normally it is not used for anything. We want to
> +	 * make sure the value is valid and force its recalculation
> +	 * here.
> +	 */
> +	crtc->hwmode.vrefresh = 0;

Why do we need this?

Thanks,
Kevin

> +	crtc->hwmode.vrefresh = drm_mode_vrefresh(&crtc->hwmode);
>  }
>  
>  static void tilcdc_crtc_enable(struct drm_crtc *crtc)
> -- 
> 1.9.1
> 
> 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2017-10-12  9:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-12  9:39 [PATCH] drm/tilcdc: Force recalculation of vrefresh in tilcdc_crtc_set_mode() Jyri Sarha
2017-10-12  9:53 ` Kevin Hao [this message]
2017-10-12 10:15   ` Jyri Sarha
2017-10-12 14:18 ` Jyri Sarha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171012095316.GA18038@pek-khao-d1 \
    --to=kexin.hao@windriver.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jsarha@ti.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=stable@vger.kernel.org \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox