From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Subject: Re: [PATCH 1/3] drm/i915: get basic encoder state before reading CRTC state Date: Sat, 18 Jan 2014 16:01:06 +0200 Message-ID: <20140118140106.GT9454@intel.com> References: <1389993418-2133-1-git-send-email-jbarnes@virtuousgeek.org> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id B2447FB97A for ; Sat, 18 Jan 2014 06:01:10 -0800 (PST) Content-Disposition: inline In-Reply-To: <1389993418-2133-1-git-send-email-jbarnes@virtuousgeek.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: Jesse Barnes Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Fri, Jan 17, 2014 at 01:16:56PM -0800, Jesse Barnes wrote: > In DDI configs, we need to get the encoder to CRTC mapping early on so > we can read out and calculate the clock state correctly, as it depends > on the port. > = > Signed-off-by: Jesse Barnes > --- > drivers/gpu/drm/i915/intel_display.c | 59 +++++++++++++++++++++++++++---= ------ > 1 file changed, 44 insertions(+), 15 deletions(-) > = > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/= intel_display.c > index 74137d5..92f46ad 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -9476,6 +9476,22 @@ check_crtc_state(struct drm_device *dev) > "crtc's computed enabled state doesn't match tracked enabled stat= e " > "(expected %i, found %i)\n", enabled, crtc->base.enabled); > = > + > + list_for_each_entry(encoder, &dev->mode_config.encoder_list, > + base.head) { > + /* Get encoder->crtc mapping */ > + struct intel_crtc *tmp_crtc; > + enum pipe pipe; > + if (encoder->get_hw_state(encoder, &pipe)) { > + tmp_crtc =3D to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]); > + if (tmp_crtc =3D=3D crtc) { > + encoder->base.crtc =3D &tmp_crtc->base; > + encoder->get_config(encoder, > + &pipe_config); > + } > + } > + } > + > active =3D dev_priv->display.get_pipe_config(crtc, > &pipe_config); > = NAK. This will break clock readout for every other platform. For most = things we read out the .port_clock from the DPLL in .get_pipe_config() (eDP port A being the excption where intel_dp_get_config() also fills out .port_clock), and then the encoder .get_config() massages .port_clock appropriately to figure out what .crtc_clock was supposed to be. Maybe I'm missing something, but can't you just follow the eDP port A route and simply stick your intel_ddi_clock_get() into intel_ddi_get_config(), so that intel_ddi_get_config() is always responsible for filling out both .port_clock and .crtc_clock? > @@ -11109,9 +11125,26 @@ static void intel_modeset_readout_hw_state(struc= t drm_device *dev) > int i; > = > list_for_each_entry(crtc, &dev->mode_config.crtc_list, > - base.head) { > + base.head) > memset(&crtc->config, 0, sizeof(crtc->config)); > = > + list_for_each_entry(encoder, &dev->mode_config.encoder_list, > + base.head) { > + pipe =3D 0; > + > + if (encoder->get_hw_state(encoder, &pipe)) { > + crtc =3D to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]); > + encoder->base.crtc =3D &crtc->base; > + drm_mode_debug_printmodeline(&crtc->config.adjusted_mode); > + } else { > + encoder->base.crtc =3D NULL; > + } > + > + encoder->connectors_active =3D false; > + } > + > + list_for_each_entry(crtc, &dev->mode_config.crtc_list, > + base.head) { > crtc->active =3D dev_priv->display.get_pipe_config(crtc, > &crtc->config); > = > @@ -11145,22 +11178,18 @@ static void intel_modeset_readout_hw_state(stru= ct drm_device *dev) > = > list_for_each_entry(encoder, &dev->mode_config.encoder_list, > base.head) { > - pipe =3D 0; > - > - if (encoder->get_hw_state(encoder, &pipe)) { > - crtc =3D to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]); > - encoder->base.crtc =3D &crtc->base; > + if (encoder->base.crtc) { > + crtc =3D to_intel_crtc(encoder->base.crtc); > encoder->get_config(encoder, &crtc->config); > - } else { > - encoder->base.crtc =3D NULL; > - } > = > - encoder->connectors_active =3D false; > - DRM_DEBUG_KMS("[ENCODER:%d:%s] hw state readout: %s, pipe %c\n", > - encoder->base.base.id, > - drm_get_encoder_name(&encoder->base), > - encoder->base.crtc ? "enabled" : "disabled", > - pipe_name(pipe)); > + DRM_DEBUG_KMS("[ENCODER:%d:%s] hw state readout: %s, pipe %c, dp: %s\= n", > + encoder->base.base.id, > + drm_get_encoder_name(&encoder->base), > + encoder->base.crtc ? "enabled" : "disabled", > + pipe_name(crtc->pipe), > + crtc->config.has_dp_encoder ? "yes" : "no"); > + drm_mode_debug_printmodeline(&crtc->config.adjusted_mode); > + } > } > = > list_for_each_entry(connector, &dev->mode_config.connector_list, > -- = > 1.8.3.2 > = > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- = Ville Syrj=E4l=E4 Intel OTC