intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: Hans de Goede <hdegoede@redhat.com>
Subject: Re: [PATCH 2/3] drm/i915: Determine DSI panel orientation from VBT
Date: Mon, 22 Oct 2018 16:07:27 +0300	[thread overview]
Message-ID: <87tvledt9s.fsf@intel.com> (raw)
In-Reply-To: <20181019195948.26811-2-ville.syrjala@linux.intel.com>

On Fri, 19 Oct 2018, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> VBT appears to have two (or possibly three) ways to indicate the panel
> rotation. The first is in the MIPI config block, but that apparenly
> usually (maybe always?) indicates 0 degrees despite the actual panel
> orientation. The second way to indicate this is in the general features
> block, which can just indicate whether 180 degress rotation is used.
> The third might be a separate rotation data block, but that is not
> at all documented so who knows what it may contain.
>
> Let's try the first two. We first try the DSI specicic VBT
> information, and it it doesn't look trustworthy (ie. indicates
> 0 degrees) we fall back to the 180 degree thing. Just to avoid too
> many changes in one go we shall also keep the hardware readout path
> for now.
>
> If this works for more than just my VLV FFRD the question becomes
> how many of the panel orientation quirks are now redundant?
>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h   |  2 ++
>  drivers/gpu/drm/i915/intel_bios.c | 31 +++++++++++++++++++++++++++++++
>  drivers/gpu/drm/i915/vlv_dsi.c    | 11 ++++++++++-
>  3 files changed, 43 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 3017ef037fed..115d5963e5a6 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1102,6 +1102,7 @@ struct intel_vbt_data {
>  	unsigned int panel_type:4;
>  	int lvds_ssc_freq;
>  	unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */
> +	enum drm_panel_orientation orientation;
>  
>  	enum drrs_support_type drrs_type;
>  
> @@ -1147,6 +1148,7 @@ struct intel_vbt_data {
>  		u8 *data;
>  		const u8 *sequence[MIPI_SEQ_MAX];
>  		u8 *deassert_seq; /* Used by fixup_mipi_sequences() */
> +		enum drm_panel_orientation orientation;

Would be nice to expose just one orientation field, but I guess we need
the duplication... *sigh*

>  	} dsi;
>  
>  	int crt_ddc_pin;
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 1faa494e2bc9..a4bfd92212df 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -420,6 +420,13 @@ parse_general_features(struct drm_i915_private *dev_priv,
>  		intel_bios_ssc_frequency(dev_priv, general->ssc_freq);
>  	dev_priv->vbt.display_clock_mode = general->display_clock_mode;
>  	dev_priv->vbt.fdi_rx_polarity_inverted = general->fdi_rx_polarity_inverted;
> +	if (bdb->version >= 181) {
> +		dev_priv->vbt.orientation = general->rotate_180 ?
> +			DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP :
> +			DRM_MODE_PANEL_ORIENTATION_NORMAL;
> +	} else {
> +		dev_priv->vbt.orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
> +	}
>  	DRM_DEBUG_KMS("BDB_GENERAL_FEATURES int_tv_support %d int_crt_support %d lvds_use_ssc %d lvds_ssc_freq %d display_clock_mode %d fdi_rx_polarity_inverted %d\n",
>  		      dev_priv->vbt.int_tv_support,
>  		      dev_priv->vbt.int_crt_support,
> @@ -852,6 +859,30 @@ parse_mipi_config(struct drm_i915_private *dev_priv,
>  
>  	parse_dsi_backlight_ports(dev_priv, bdb->version, port);
>  
> +	/* FIXME is the 90 vs. 270 correct? */

*sigh* Your guess is as good as mine.

> +	switch (config->rotation) {
> +	case ENABLE_ROTATION_0:
> +		/*
> +		 * Most (all?) VBTs claim 0 degrees despite having
> +		 * an upside down panel, thus we do not trust this.
> +		 */
> +		dev_priv->vbt.dsi.orientation =
> +			DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
> +		break;
> +	case ENABLE_ROTATION_90:
> +		dev_priv->vbt.dsi.orientation =
> +			DRM_MODE_PANEL_ORIENTATION_RIGHT_UP;
> +		break;
> +	case ENABLE_ROTATION_180:
> +		dev_priv->vbt.dsi.orientation =
> +			DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP;
> +		break;
> +	case ENABLE_ROTATION_270:
> +		dev_priv->vbt.dsi.orientation =
> +			DRM_MODE_PANEL_ORIENTATION_LEFT_UP;
> +		break;
> +	}
> +
>  	/* We have mandatory mipi config blocks. Initialize as generic panel */
>  	dev_priv->vbt.dsi.panel_id = MIPI_DSI_GENERIC_PANEL_ID;
>  }
> diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
> index 893839ea0ff9..a3119ec3189a 100644
> --- a/drivers/gpu/drm/i915/vlv_dsi.c
> +++ b/drivers/gpu/drm/i915/vlv_dsi.c
> @@ -1704,7 +1704,8 @@ vlv_dsi_get_hw_panel_orientation(struct intel_connector *connector)
>  	return orientation;
>  }
>  
> -static int intel_dsi_get_panel_orientation(struct intel_connector *connector)
> +static enum drm_panel_orientation
> +intel_dsi_get_panel_orientation(struct intel_connector *connector)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
>  	enum drm_panel_orientation orientation;
> @@ -1715,6 +1716,14 @@ static int intel_dsi_get_panel_orientation(struct intel_connector *connector)
>  			return orientation;
>  	}
>  
> +	orientation = dev_priv->vbt.dsi.orientation;
> +	if (orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
> +		return orientation;
> +
> +	orientation = dev_priv->vbt.orientation;
> +	if (orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
> +		return orientation;

I take it you wrote patch 3/3 separately to perhaps apply it much later?
Otherwise the series could be simplified. So in the mean time with just
the first two applied, would it make sense to debug log if there's a
discrepancy between what we read out and what the VBT says?

Either way,

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> +
>  	return DRM_MODE_PANEL_ORIENTATION_NORMAL;
>  }

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-10-22 13:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-19 19:59 [PATCH 1/3] drm/i915: Fix the VLV/CHV DSI panel orientation hw readout Ville Syrjala
2018-10-19 19:59 ` [PATCH 2/3] drm/i915: Determine DSI panel orientation from VBT Ville Syrjala
2018-10-22 13:07   ` Jani Nikula [this message]
2018-10-22 13:25     ` Ville Syrjälä
2018-10-22 14:20   ` [PATCH v2 " Ville Syrjala
2018-10-22 14:52     ` Jani Nikula
2018-10-19 19:59 ` [PATCH 3/3] drm/i915: Remove the hardware readout path for DSI panel orientation Ville Syrjala
2018-10-19 20:11   ` Chris Wilson
2018-10-19 20:12     ` Chris Wilson
2018-10-22 13:09   ` Jani Nikula
2018-10-22 14:02     ` Hans de Goede
2018-10-22 14:20   ` [PATCH v2 " Ville Syrjala
2018-10-22 12:51 ` [PATCH 1/3] drm/i915: Fix the VLV/CHV DSI panel orientation hw readout Jani Nikula
2018-10-22 13:13   ` Ville Syrjälä
2018-10-22 14:19 ` [PATCH v2 " Ville Syrjala
2018-10-22 19:41   ` Hans de Goede
2018-11-13 16:00     ` Ville Syrjälä
2018-10-22 16:26 ` ✗ Fi.CI.SPARSE: warning for series starting with [v2,1/3] drm/i915: Fix the VLV/CHV DSI panel orientation hw readout (rev4) Patchwork
2018-10-22 16:49 ` ✓ Fi.CI.BAT: success " Patchwork
2018-10-22 19:53 ` ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tvledt9s.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).