All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <j.w.r.degoede@gmail.com>
To: Daniel Vetter <daniel.vetter@intel.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Sean Paul <seanpaul@chromium.org>,
	Dave Airlie <airlied@redhat.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	intel-gfx <intel-gfx@lists.freedesktop.org>,
	linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: [PATCH v6 5/7] drm/i915: Add "panel orientation" property to the panel connector, v6.
Date: Sat, 25 Nov 2017 17:33:39 +0000	[thread overview]
Message-ID: <20171125173341.14162-6-hdegoede@redhat.com> (raw)
In-Reply-To: <20171125173341.14162-1-hdegoede@redhat.com>

Ideally we could use the VBT for this, that would be simple, in
intel_dsi_init() check dev_priv->vbt.dsi.config->rotation, set
connector->display_info.panel_orientation accordingly and call
drm_connector_init_panel_orientation_property(), done.

Unfortunately vbt.dsi.config->rotation is always 0 even on tablets
with an upside down LCD and where the GOP is properly rotating the
EFI fb in hardware.

So instead we end up reading the rotation from the primary plane.

This commit only implements the panel orientation property for DSI
panels on BYT / CHT hardware, as all known non normal oriented panels
sofar are only found on this hardware.

Changes in v2:
-Read back the rotation applied by the GOP from the primary plane
 instead of relying on dev_priv->vbt.dsi.config->rotation, because it
 seems that the VBT rotation filed is always 0 even on devices where the
 GOP does apply a rotation

Changes in v3:
-Rewrite the code to read back the orientation from the primary
 plane to contain all of this in intel_dsi.c instead of poking a bunch
 of holes between all the different layers

Changes in v6:
-Move hardware readout to intel_dsi_init()

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/gpu/drm/i915/intel_dsi.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index f09474b0c4d3..f67d321376e4 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -1666,6 +1666,27 @@ static const struct drm_connector_funcs intel_dsi_connector_funcs = {
 	.atomic_duplicate_state = intel_digital_connector_duplicate_state,
 };
 
+static int intel_dsi_get_panel_orientation(struct intel_connector *connector)
+{
+	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
+	int orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL;
+	enum i9xx_plane_id plane;
+	u32 val;
+
+	if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
+		if (connector->encoder->crtc_mask = BIT(PIPE_B))
+			plane = PLANE_B;
+		else
+			plane = PLANE_A;
+
+		val = I915_READ(DSPCNTR(plane));
+		if (val & DISPPLANE_ROTATE_180)
+			orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP;
+	}
+
+	return orientation;
+}
+
 static void intel_dsi_add_properties(struct intel_connector *connector)
 {
 	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
@@ -1681,6 +1702,13 @@ static void intel_dsi_add_properties(struct intel_connector *connector)
 								allowed_scalers);
 
 		connector->base.state->scaling_mode = DRM_MODE_SCALE_ASPECT;
+
+		connector->base.display_info.panel_orientation +			intel_dsi_get_panel_orientation(connector);
+		drm_connector_init_panel_orientation_property(
+				&connector->base,
+				connector->panel.fixed_mode->hdisplay,
+				connector->panel.fixed_mode->vdisplay);
 	}
 }
 
-- 
2.14.3


WARNING: multiple messages have this Message-ID (diff)
From: Hans de Goede <j.w.r.degoede@gmail.com>
To: Daniel Vetter <daniel.vetter@intel.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Sean Paul <seanpaul@chromium.org>,
	Dave Airlie <airlied@redhat.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	intel-gfx <intel-gfx@lists.freedesktop.org>,
	linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: [PATCH v6 5/7] drm/i915: Add "panel orientation" property to the panel connector, v6.
Date: Sat, 25 Nov 2017 18:33:39 +0100	[thread overview]
Message-ID: <20171125173341.14162-6-hdegoede@redhat.com> (raw)
In-Reply-To: <20171125173341.14162-1-hdegoede@redhat.com>

Ideally we could use the VBT for this, that would be simple, in
intel_dsi_init() check dev_priv->vbt.dsi.config->rotation, set
connector->display_info.panel_orientation accordingly and call
drm_connector_init_panel_orientation_property(), done.

Unfortunately vbt.dsi.config->rotation is always 0 even on tablets
with an upside down LCD and where the GOP is properly rotating the
EFI fb in hardware.

So instead we end up reading the rotation from the primary plane.

This commit only implements the panel orientation property for DSI
panels on BYT / CHT hardware, as all known non normal oriented panels
sofar are only found on this hardware.

Changes in v2:
-Read back the rotation applied by the GOP from the primary plane
 instead of relying on dev_priv->vbt.dsi.config->rotation, because it
 seems that the VBT rotation filed is always 0 even on devices where the
 GOP does apply a rotation

Changes in v3:
-Rewrite the code to read back the orientation from the primary
 plane to contain all of this in intel_dsi.c instead of poking a bunch
 of holes between all the different layers

Changes in v6:
-Move hardware readout to intel_dsi_init()

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/gpu/drm/i915/intel_dsi.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index f09474b0c4d3..f67d321376e4 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -1666,6 +1666,27 @@ static const struct drm_connector_funcs intel_dsi_connector_funcs = {
 	.atomic_duplicate_state = intel_digital_connector_duplicate_state,
 };
 
+static int intel_dsi_get_panel_orientation(struct intel_connector *connector)
+{
+	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
+	int orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL;
+	enum i9xx_plane_id plane;
+	u32 val;
+
+	if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
+		if (connector->encoder->crtc_mask == BIT(PIPE_B))
+			plane = PLANE_B;
+		else
+			plane = PLANE_A;
+
+		val = I915_READ(DSPCNTR(plane));
+		if (val & DISPPLANE_ROTATE_180)
+			orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP;
+	}
+
+	return orientation;
+}
+
 static void intel_dsi_add_properties(struct intel_connector *connector)
 {
 	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
@@ -1681,6 +1702,13 @@ static void intel_dsi_add_properties(struct intel_connector *connector)
 								allowed_scalers);
 
 		connector->base.state->scaling_mode = DRM_MODE_SCALE_ASPECT;
+
+		connector->base.display_info.panel_orientation =
+			intel_dsi_get_panel_orientation(connector);
+		drm_connector_init_panel_orientation_property(
+				&connector->base,
+				connector->panel.fixed_mode->hdisplay,
+				connector->panel.fixed_mode->vdisplay);
 	}
 }
 
-- 
2.14.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-11-25 17:33 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-25 17:33 [PATCH v6 0/7] drm/fbdev: Panel orientation connector property support Hans de Goede
2017-11-25 17:33 ` Hans de Goede
2017-11-25 17:33 ` [PATCH v6 1/7] fbcon: Add fbcon_rotate_hint to struct fb_info Hans de Goede
2017-11-25 17:33   ` Hans de Goede
2017-11-25 17:33 ` [PATCH v6 2/7] drm: Add panel orientation quirks, v6 Hans de Goede
2017-11-25 17:33   ` Hans de Goede
2017-11-25 17:33 ` [PATCH v6 3/7] drm: Add support for a panel-orientation connector property, v6 Hans de Goede
2017-11-25 17:33   ` Hans de Goede
2017-11-25 17:33 ` [PATCH v6 4/7] drm/fb-helper: Apply panel orientation connector prop to the primary plane, v6 Hans de Goede
2017-11-25 17:33   ` Hans de Goede
2017-11-25 17:33 ` Hans de Goede [this message]
2017-11-25 17:33   ` [PATCH v6 5/7] drm/i915: Add "panel orientation" property to the panel connector, v6 Hans de Goede
2017-11-28 10:25   ` [Intel-gfx] " Daniel Vetter
2017-11-28 10:25     ` Daniel Vetter
2017-11-28 16:48     ` [Intel-gfx] " kbuild test robot
2017-11-28 16:48       ` kbuild test robot
2017-11-28 20:46     ` kbuild test robot
2017-11-28 20:46       ` kbuild test robot
2017-11-25 17:33 ` [PATCH v6 6/7] efifb: Set info->fbcon_rotate_hint based on drm_get_panel_orientation_quirk Hans de Goede
2017-11-25 17:33   ` Hans de Goede
2017-11-25 17:33 ` [PATCH v6 7/7] fbcon: Remove dmi quirk table Hans de Goede
2017-11-25 17:33   ` Hans de Goede
2017-11-25 17:37 ` ✗ Fi.CI.BAT: failure for drm/fbdev: Panel orientation connector property support (rev4) Patchwork
2017-11-25 19:16 ` [PATCH v6 0/7] drm/fbdev: Panel orientation connector property support Hans de Goede
2017-11-25 19:16   ` Hans de Goede
2017-11-25 19:16   ` [PATCH v6 1/7] fbcon: Add fbcon_rotate_hint to struct fb_info Hans de Goede
2017-11-25 19:16     ` Hans de Goede
2017-11-25 19:16   ` [PATCH v6 2/7] drm: Add panel orientation quirks, v6 Hans de Goede
2017-11-25 19:16     ` Hans de Goede
2017-11-25 19:16   ` [PATCH v6 3/7] drm: Add support for a panel-orientation connector property, v6 Hans de Goede
2017-11-25 19:16     ` Hans de Goede
2017-11-25 19:16   ` [PATCH v6 4/7] drm/fb-helper: Apply panel orientation connector prop to the primary plane, v6 Hans de Goede
2017-11-25 19:16     ` Hans de Goede
2017-11-25 19:16   ` [PATCH v6 5/7] drm/i915: Add "panel orientation" property to the panel connector, v6 Hans de Goede
2017-11-25 19:16     ` Hans de Goede
2017-11-25 19:16   ` [PATCH v6 6/7] efifb: Set info->fbcon_rotate_hint based on drm_get_panel_orientation_quirk Hans de Goede
2017-11-25 19:16     ` Hans de Goede
2017-11-25 19:16   ` [PATCH v6 7/7] fbcon: Remove dmi quirk table Hans de Goede
2017-11-25 19:16     ` Hans de Goede
2017-11-25 19:20   ` ✗ Fi.CI.BAT: failure for drm/fbdev: Panel orientation connector property support (rev5) Patchwork
2017-11-28 10:27 ` [Intel-gfx] [PATCH v6 0/7] drm/fbdev: Panel orientation connector property support Daniel Vetter
2017-11-28 10:27   ` Daniel Vetter
2017-11-28 13:36   ` Hans de Goede
2017-11-28 13:36     ` Hans de Goede
2017-11-29  9:59     ` Daniel Vetter
2017-11-29  9:59       ` Daniel Vetter
2017-11-28 15:47 [Intel-gfx] [PATCH v6 6/7] efifb: Set info->fbcon_rotate_hint based on drm_get_panel_orientation kbuild test robot
2017-11-28 15:47 ` [PATCH v6 6/7] efifb: Set info->fbcon_rotate_hint based on drm_get_panel_orientation_quirk kbuild test robot
2017-11-28 21:07 ` [Intel-gfx] [PATCH v6 6/7] efifb: Set info->fbcon_rotate_hint based on drm_get_panel_orientation kbuild test robot
2017-11-28 21:07   ` [Intel-gfx] [PATCH v6 6/7] efifb: Set info->fbcon_rotate_hint based on drm_get_panel_orientation_quirk kbuild test robot
2017-11-28 22:19 ` [Intel-gfx] [PATCH v6 6/7] efifb: Set info->fbcon_rotate_hint based on drm_get_panel_orientation kbuild test robot
2017-11-28 22:19   ` [PATCH v6 6/7] efifb: Set info->fbcon_rotate_hint based on drm_get_panel_orientation_quirk kbuild test robot

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=20171125173341.14162-6-hdegoede@redhat.com \
    --to=j.w.r.degoede@gmail.com \
    --cc=airlied@redhat.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hdegoede@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=seanpaul@chromium.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.