From: Daniel Vetter Subject: Re: [PATCH 3/3] drm/i915: explicitly set up PIPECONF (and gamma table) on haswell Date: Thu, 13 Jun 2013 12:01:40 +0200 Message-ID: <20130613100139.GC23483@phenom.ffwll.local> References: <1371077699-30702-1-git-send-email-daniel.vetter@ffwll.ch> <1371077699-30702-3-git-send-email-daniel.vetter@ffwll.ch> <20130613075752.GS5004@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-ee0-f44.google.com (mail-ee0-f44.google.com [74.125.83.44]) by gabe.freedesktop.org (Postfix) with ESMTP id 1B435E5EB5 for ; Thu, 13 Jun 2013 03:01:44 -0700 (PDT) Received: by mail-ee0-f44.google.com with SMTP id c13so5016466eek.3 for ; Thu, 13 Jun 2013 03:01:44 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20130613075752.GS5004@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Cc: Daniel Vetter , Intel Graphics Development List-Id: intel-gfx@lists.freedesktop.org On Thu, Jun 13, 2013 at 10:57:52AM +0300, Ville Syrj=E4l=E4 wrote: > On Thu, Jun 13, 2013 at 12:54:59AM +0200, Daniel Vetter wrote: > > Again we don't really support different settings, so don't let the > > BIOS sneak stuff through. > > = > > Since the motivation for this patch series is to ensure we have the > > correct gamma table mode selected also add the required write to the > > GAMMA_MODE register to select the 8bit legacy table. > > = > > And since I find lowercase letters in #defines offensive, also > > bikeshed those. > > = > > Signed-off-by: Daniel Vetter > > --- > > drivers/gpu/drm/i915/i915_reg.h | 6 +++--- > > drivers/gpu/drm/i915/intel_display.c | 7 ++++--- > > 2 files changed, 7 insertions(+), 6 deletions(-) > > = > > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i91= 5_reg.h > > index 01e8783..8136b00 100644 > > --- a/drivers/gpu/drm/i915/i915_reg.h > > +++ b/drivers/gpu/drm/i915/i915_reg.h > > @@ -3670,9 +3670,9 @@ > > #define _GAMMA_MODE_B 0x4ac80 > > #define GAMMA_MODE(pipe) _PIPE(pipe, _GAMMA_MODE_A, _GAMMA_MODE_B) > > #define GAMMA_MODE_MODE_MASK (3 << 0) > > -#define GAMMA_MODE_MODE_8bit (0 << 0) > > -#define GAMMA_MODE_MODE_10bit (1 << 0) > > -#define GAMMA_MODE_MODE_12bit (2 << 0) > > +#define GAMMA_MODE_MODE_8BIT (0 << 0) > > +#define GAMMA_MODE_MODE_10BIT (1 << 0) > > +#define GAMMA_MODE_MODE_12BIT (2 << 0) > > #define GAMMA_MODE_MODE_SPLIT (3 << 0) > > = > > /* interrupts */ > > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i91= 5/intel_display.c > > index 4ca0273..e1184eb 100644 > > --- a/drivers/gpu/drm/i915/intel_display.c > > +++ b/drivers/gpu/drm/i915/intel_display.c > > @@ -5393,13 +5393,11 @@ static void haswell_set_pipeconf(struct drm_crt= c *crtc) > > enum transcoder cpu_transcoder =3D intel_crtc->config.cpu_transcoder; > > uint32_t val; > > = > > - val =3D I915_READ(PIPECONF(cpu_transcoder)); > > + val =3D 0; > > = > > - val &=3D ~(PIPECONF_DITHER_EN | PIPECONF_DITHER_TYPE_MASK); > > if (intel_crtc->config.dither) > > val |=3D (PIPECONF_DITHER_EN | PIPECONF_DITHER_TYPE_SP); > > = > > - val &=3D ~PIPECONF_INTERLACE_MASK_HSW; > > if (intel_crtc->config.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE) > > val |=3D PIPECONF_INTERLACED_ILK; > > else > > @@ -5407,6 +5405,9 @@ static void haswell_set_pipeconf(struct drm_crtc = *crtc) > > = > > I915_WRITE(PIPECONF(cpu_transcoder), val); > > POSTING_READ(PIPECONF(cpu_transcoder)); > > + > > + I915_WRITE(GAMMA_MODE(intel_crtc->pipe), GAMMA_MODE_MODE_8BIT); > > + POSTING_READ(GAMMA_MODE(intel_crtc->pipe)); > = > Why the POSTING_READ()? In fact, why do we have any posting reads in > xxx_set_pipeconf()? Cargo-culting at its best ;-) But I think cleaning that up is best left to another series ... -Daniel -- = Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch