From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jani Nikula Subject: Re: [PATCH 03/18] drm/i915: simplify intel_crtc_driving_pch Date: Thu, 25 Oct 2012 14:13:54 +0300 Message-ID: <87ehkmn6rx.fsf@intel.com> References: <1351024208-3489-1-git-send-email-przanoni@gmail.com> <1351024208-3489-4-git-send-email-przanoni@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id E538AA0969 for ; Thu, 25 Oct 2012 04:08:39 -0700 (PDT) In-Reply-To: <1351024208-3489-4-git-send-email-przanoni@gmail.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: Paulo Zanoni , intel-gfx@lists.freedesktop.org Cc: Paulo Zanoni List-Id: intel-gfx@lists.freedesktop.org On Tue, 23 Oct 2012, Paulo Zanoni wrote: > From: Paulo Zanoni > > By forking Ironlake and Haswell functions. The only callers are > {ironlake,haswell}_crtc_enable anyway, and this way we won't need to > add other checks on the Haswell version for the next gens. > > Signed-off-by: Paulo Zanoni > --- > drivers/gpu/drm/i915/intel_display.c | 31 +++++++++++-------------------- > 1 file changed, 11 insertions(+), 20 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c > index a90da35..0c4e9c5 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -2849,7 +2849,7 @@ static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc) > mutex_unlock(&dev->struct_mutex); > } > > -static bool intel_crtc_driving_pch(struct drm_crtc *crtc) > +static bool ironlake_crtc_driving_pch(struct drm_crtc *crtc) > { > struct drm_device *dev = crtc->dev; > struct intel_encoder *intel_encoder; > @@ -2859,23 +2859,6 @@ static bool intel_crtc_driving_pch(struct drm_crtc *crtc) > * must be driven by its own crtc; no sharing is possible. > */ > for_each_encoder_on_crtc(dev, crtc, intel_encoder) { > - > - /* On Haswell, LPT PCH handles the VGA connection via FDI, and Haswell > - * CPU handles all others */ > - if (IS_HASWELL(dev)) { > - /* It is still unclear how this will work on PPT, so throw up a warning */ > - WARN_ON(!HAS_PCH_LPT(dev)); > - > - if (intel_encoder->type == INTEL_OUTPUT_ANALOG) { > - DRM_DEBUG_KMS("Haswell detected DAC encoder, assuming is PCH\n"); > - return true; > - } else { > - DRM_DEBUG_KMS("Haswell detected encoder %d, assuming is CPU\n", > - intel_encoder->type); > - return false; > - } > - } > - > switch (intel_encoder->type) { > case INTEL_OUTPUT_EDP: > if (!intel_encoder_is_pch_edp(&intel_encoder->base)) > @@ -2887,6 +2870,14 @@ static bool intel_crtc_driving_pch(struct drm_crtc *crtc) > return true; > } > > +static bool haswell_crtc_driving_pch(struct drm_crtc *crtc) > +{ > + if (intel_pipe_has_type(crtc, INTEL_OUTPUT_ANALOG)) > + return true; > + else > + return false; > +} Nitpick, this could be written just: return intel_pipe_has_type(crtc, INTEL_OUTPUT_ANALOG); A pedantic observation: the previous version in intel_crtc_driving_pch unconditionally stopped at the first encoder on the crtc on HSW, this one checks that *none* of the encoders has type INTEL_OUTPUT_ANALOG before it returns false. It doesn't matter either way, does it? Reviewed-by: Jani Nikula > + > /* Program iCLKIP clock to the desired frequency */ > static void lpt_program_iclkip(struct drm_crtc *crtc) > { > @@ -3215,7 +3206,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) > I915_WRITE(PCH_LVDS, temp | LVDS_PORT_EN); > } > > - is_pch_port = intel_crtc_driving_pch(crtc); > + is_pch_port = ironlake_crtc_driving_pch(crtc); > > if (is_pch_port) { > ironlake_fdi_pll_enable(intel_crtc); > @@ -3293,7 +3284,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc) > intel_crtc->active = true; > intel_update_watermarks(dev); > > - is_pch_port = intel_crtc_driving_pch(crtc); > + is_pch_port = haswell_crtc_driving_pch(crtc); > > if (is_pch_port) { > ironlake_fdi_pll_enable(intel_crtc); > -- > 1.7.11.4 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx