From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 3/3] drm/i915: Make sure vsyncshift is positive Date: Sat, 29 Mar 2014 10:40:31 +0100 Message-ID: <20140329094031.GO22327@phenom.ffwll.local> References: <1396042172-32495-1-git-send-email-ville.syrjala@linux.intel.com> <1396042172-32495-4-git-send-email-ville.syrjala@linux.intel.com> <20140328151155.4cfcdce7@jbarnes-desktop> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by gabe.freedesktop.org (Postfix) with ESMTP id AF71C6E8C3 for ; Sat, 29 Mar 2014 02:40:35 -0700 (PDT) Received: by mail-ee0-f49.google.com with SMTP id c41so4886244eek.36 for ; Sat, 29 Mar 2014 02:40:34 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20140328151155.4cfcdce7@jbarnes-desktop> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Jesse Barnes Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Fri, Mar 28, 2014 at 03:11:55PM -0700, Jesse Barnes wrote: > On Fri, 28 Mar 2014 23:29:32 +0200 > ville.syrjala@linux.intel.com wrote: > = > > From: Ville Syrj=E4l=E4 > > = > > If vsyncshift comes out as negative, add one htotal to it to get the > > corresponding positive value. > > = > > This is rather theoretical as it would require a mode where the > > hsync+back porch is very long and the active+front porch very short. > > = > > Signed-off-by: Ville Syrj=E4l=E4 > > --- > > drivers/gpu/drm/i915/intel_display.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > = > > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i91= 5/intel_display.c > > index 3ab40e3..7d3b18b 100644 > > --- a/drivers/gpu/drm/i915/intel_display.c > > +++ b/drivers/gpu/drm/i915/intel_display.c > > @@ -5377,7 +5377,8 @@ static void intel_set_pipe_timings(struct intel_c= rtc *intel_crtc) > > enum transcoder cpu_transcoder =3D intel_crtc->config.cpu_transcoder; > > struct drm_display_mode *adjusted_mode =3D > > &intel_crtc->config.adjusted_mode; > > - uint32_t vsyncshift =3D 0, crtc_vtotal, crtc_vblank_end; > > + uint32_t crtc_vtotal, crtc_vblank_end; > > + int vsyncshift =3D 0; > > = > > /* We need to be careful not to changed the adjusted mode, for otherw= ise > > * the hw state checker will get angry at the mismatch. */ > > @@ -5394,6 +5395,8 @@ static void intel_set_pipe_timings(struct intel_c= rtc *intel_crtc) > > else > > vsyncshift =3D adjusted_mode->crtc_hsync_start - > > adjusted_mode->crtc_htotal / 2; > > + if (vsyncshift < 0) > > + vsyncshift +=3D adjusted_mode->crtc_htotal; > > } > > = > > if (INTEL_INFO(dev)->gen > 3) > = > = > Funky indeed. I wonder if we should congratulate the user if we detect > this configuration. "Achievement unlocked: funky mode timings!". Would be a neat bounty-hunt sprinkling this all over ... > = > Reviewed-by: Jesse Barnes All 3 merged, thanks for patches&review. -Daniel -- = Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch