[PATCH] drm/tilcdc: Force recalculation of vrefresh in tilcdc_crtc_set_mode()

Kevin Hao kexin.hao at windriver.com
Thu Oct 12 09:53:16 UTC 2017


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 at windriver.com>
> Fixes: 11abbc9f39e0 ("drm/tilcdc: Set framebuffer DMA address to HW only if CRTC is enabled")
> Cc: <stable at vger.kernel.org> # v4.11+
> Signed-off-by: Jyri Sarha <jsarha at 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
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20171012/9e99b4ca/attachment-0001.sig>


More information about the dri-devel mailing list