* [PATCH 0/3] fb/drm: Add support for a panel-orientation connector prop
@ 2017-09-08 11:54 Hans de Goede
2017-09-08 11:54 ` [PATCH 1/3] video: fb: Make fbcon dmi quirks usuable for drm drivers too Hans de Goede
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Hans de Goede @ 2017-09-08 11:54 UTC (permalink / raw)
To: Daniel Vetter, Jani Nikula, Sean Paul, David Airlie,
Bartlomiej Zolnierkiewicz
Cc: Hans de Goede, linux-fbdev, dri-devel, Bastien Nocera
Hi All,
Some x86 clamshell design devices use portrait tablet LCD panels and a
display engine which cannot (transparently) rotate in hardware, so we
need to rotate things in software / let user space deal with this.
The fbcon code has a set of DMI based quirks to automatically detect
such tablet LCD panels and rotate the fbcon to compensate.
The plan was for userspace (e.g. a Wayland compositor) to simply read
/sys/class/graphics/fbcon/rotate and apply the rotation from there to
the LCD panel to compensate.
However this will not work when an external monitor gets plugged in,
since with fbcon rotation is not per output, so the fbcon quirk code
disables the rotation when an external monitor is present.
Using /sys/class/graphics/fbcon/rotate will not help in that case
since it will indicate no rotation is in use. So instead we are going
to need a drm connecter property for this.
This patch-series introduces such a drm connector properperty, it
consists of 3 patches:
1) Make the fbcon quirk table usable outside of the fbcon code
2) Add drm_connector_create_panel_orientation_property and
drm_connector_attach_panel_orientation_property functions
3) Hook things up in intel_panel.c
Regards,
Hans
p.s.
Note this series does not yet get the panel orientation from the VBT
on Intel devices. I think that for devices which have the panel
upside-down (rather then rotated 90 degrees) this should work, but
I've an i915 patch series pending which corrects for the upside-down
scanario fully inside the i915 driver hiding the upside-down ness
from userspace (and fbcon) and if that series gets merged then in
the upside-down case the "panel orientation" property should read
"Normal" and not "Upside Down", so I've left out hooking up the VBTs
idea of the panel orientation for now.
Note that we could use the new "panel orientation" property for the
upside-down case too and drop my "[v4] drm/i915: Deal with upside-down
mounted LCD panels" patch:
https://patchwork.freedesktop.org/patch/173781/
That patch is not universally liked anyways, so just dropping it and
using the new prop this series introduces might be best.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] video: fb: Make fbcon dmi quirks usuable for drm drivers too
2017-09-08 11:54 [PATCH 0/3] fb/drm: Add support for a panel-orientation connector prop Hans de Goede
@ 2017-09-08 11:54 ` Hans de Goede
2017-09-08 11:54 ` [PATCH 2/3] drm: Add support for a panel-orientation connector property Hans de Goede
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2017-09-08 11:54 UTC (permalink / raw)
To: Daniel Vetter, Jani Nikula, Sean Paul, David Airlie,
Bartlomiej Zolnierkiewicz
Cc: Hans de Goede, linux-fbdev, dri-devel, Bastien Nocera
Some x86 clamshell design devices use portrait tablet LCD panels and a
display engine which cannot (transparently) rotate in hardware, so we
need to rotate things in software / let user space deal with this.
The fbcon code has a set of DMI based quirks to automatically detect
such tablet LCD panels and rotate the fbcon to compensate.
The plan was for userspace (e.g. a Wayland compositor) to simply read
/sys/class/graphics/fbcon/rotate and apply the rotation from there to
the LCD panel to compensate.
However this will not work when an external monitor gets plugged in,
since with fbcon rotation is not per output, so the fbcon quirk code
disables the rotation when an external monitor is present.
Using /sys/class/graphics/fbcon/rotate will not help in that case
since it will indicate no rotation is in use. So instead we are going
to need a drm connecter property for this.
This commit is a preparation patch for adding the drm-connecter
property, by making the fbcon quirk code generally usable so that
the drm code can use it to check for rotation quirks.
Note this commit re-uses the FB_CMDLINE Kconfig option for selecting
if the quirk code should be build, since that is already selected by
both the drm and fbcon code.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/video/console/Makefile | 3 ---
drivers/video/console/fbcon.c | 22 ++++++++++++++--------
drivers/video/console/fbcon.h | 6 ------
drivers/video/fbdev/core/Makefile | 3 +++
.../core/fb_dmi_quirks.c} | 15 +++++++++------
include/linux/fb.h | 6 ++++++
6 files changed, 32 insertions(+), 23 deletions(-)
rename drivers/video/{console/fbcon_dmi_quirks.c => fbdev/core/fb_dmi_quirks.c} (91%)
diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile
index 32ee2ad37369..43bfa485db96 100644
--- a/drivers/video/console/Makefile
+++ b/drivers/video/console/Makefile
@@ -15,8 +15,5 @@ ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE_ROTATION),y)
obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon_rotate.o fbcon_cw.o fbcon_ud.o \
fbcon_ccw.o
endif
-ifeq ($(CONFIG_DMI),y)
-obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon_dmi_quirks.o
-endif
obj-$(CONFIG_FB_STI) += sticore.o
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 3db5ac2bfbb7..f33f5a61405c 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -954,10 +954,13 @@ static const char *fbcon_startup(void)
ops->cur_rotate = -1;
ops->cur_blink_jiffies = HZ / 5;
info->fbcon_par = ops;
- if (initial_rotation != -1)
- p->con_rotate = initial_rotation;
- else
- p->con_rotate = fbcon_platform_get_rotate(info);
+ p->con_rotate = initial_rotation;
+ if (p->con_rotate = -1)
+ p->con_rotate = fb_get_panel_rotate_quirk(info->var.xres,
+ info->var.yres);
+ if (p->con_rotate = -1)
+ p->con_rotate = FB_ROTATE_UR;
+
set_blitting_type(vc, info);
if (info->fix.type != FB_TYPE_TEXT) {
@@ -1094,10 +1097,13 @@ static void fbcon_init(struct vc_data *vc, int init)
ops = info->fbcon_par;
ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms);
- if (initial_rotation != -1)
- p->con_rotate = initial_rotation;
- else
- p->con_rotate = fbcon_platform_get_rotate(info);
+ p->con_rotate = initial_rotation;
+ if (p->con_rotate = -1)
+ p->con_rotate = fb_get_panel_rotate_quirk(info->var.xres,
+ info->var.yres);
+ if (p->con_rotate = -1)
+ p->con_rotate = FB_ROTATE_UR;
+
set_blitting_type(vc, info);
cols = vc->vc_cols;
diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h
index 60e25e173fdb..73add376790c 100644
--- a/drivers/video/console/fbcon.h
+++ b/drivers/video/console/fbcon.h
@@ -261,10 +261,4 @@ extern void fbcon_set_rotate(struct fbcon_ops *ops);
#define fbcon_set_rotate(x) do {} while(0)
#endif /* CONFIG_FRAMEBUFFER_CONSOLE_ROTATION */
-#ifdef CONFIG_DMI
-int fbcon_platform_get_rotate(struct fb_info *info);
-#else
-#define fbcon_platform_get_rotate(i) FB_ROTATE_UR
-#endif /* CONFIG_DMI */
-
#endif /* _VIDEO_FBCON_H */
diff --git a/drivers/video/fbdev/core/Makefile b/drivers/video/fbdev/core/Makefile
index 9e3ddf225393..b9162a2b6e88 100644
--- a/drivers/video/fbdev/core/Makefile
+++ b/drivers/video/fbdev/core/Makefile
@@ -1,4 +1,7 @@
obj-$(CONFIG_FB_CMDLINE) += fb_cmdline.o
+ifeq ($(CONFIG_DMI),y)
+obj-$(CONFIG_FB_CMDLINE) += fb_dmi_quirks.o
+endif
obj-$(CONFIG_FB_NOTIFY) += fb_notify.o
obj-$(CONFIG_FB) += fb.o
fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
diff --git a/drivers/video/console/fbcon_dmi_quirks.c b/drivers/video/fbdev/core/fb_dmi_quirks.c
similarity index 91%
rename from drivers/video/console/fbcon_dmi_quirks.c
rename to drivers/video/fbdev/core/fb_dmi_quirks.c
index 6904e47d1e51..d5fdf3245f83 100644
--- a/drivers/video/console/fbcon_dmi_quirks.c
+++ b/drivers/video/fbdev/core/fb_dmi_quirks.c
@@ -1,5 +1,5 @@
/*
- * fbcon_dmi_quirks.c -- DMI based quirk detection for fbcon
+ * fb_dmi_quirks.c -- DMI based LCD panel rotation quirk detection
*
* Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com>
*
@@ -11,7 +11,6 @@
#include <linux/dmi.h>
#include <linux/fb.h>
#include <linux/kernel.h>
-#include "fbcon.h"
/*
* Some x86 clamshell design devices use portrait tablet screens and a display
@@ -112,7 +111,11 @@ static const struct dmi_system_id rotate_data[] = {
{}
};
-int fbcon_platform_get_rotate(struct fb_info *info)
+/*
+ * Note this function returns the rotation necessary to put the display
+ * the right way up, or -1 if there is no quirk.
+ */
+int fb_get_panel_rotate_quirk(int width, int height)
{
const struct dmi_system_id *match;
const struct fbcon_dmi_rotate_data *data;
@@ -124,8 +127,7 @@ int fbcon_platform_get_rotate(struct fb_info *info)
match = dmi_first_match(match + 1)) {
data = match->driver_data;
- if (data->width != info->var.xres ||
- data->height != info->var.yres)
+ if (data->width != width || data->height != height)
continue;
if (!data->bios_dates)
@@ -141,5 +143,6 @@ int fbcon_platform_get_rotate(struct fb_info *info)
}
}
- return FB_ROTATE_UR;
+ return -1;
}
+EXPORT_SYMBOL_GPL(fb_get_panel_rotate_quirk);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index a964d076b4dc..197e07681427 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -822,6 +822,12 @@ extern int fb_find_mode(struct fb_var_screeninfo *var,
const struct fb_videomode *default_mode,
unsigned int default_bpp);
+#ifdef CONFIG_DMI
+int fb_get_panel_rotate_quirk(int width, int height);
+#else
+#define fb_get_panel_rotate_quirk(width, height) (-1)
+#endif /* CONFIG_DMI */
+
/* Convenience logging macros */
#define fb_err(fb_info, fmt, ...) \
pr_err("fb%d: " fmt, (fb_info)->node, ##__VA_ARGS__)
--
2.13.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] drm: Add support for a panel-orientation connector property
2017-09-08 11:54 [PATCH 0/3] fb/drm: Add support for a panel-orientation connector prop Hans de Goede
2017-09-08 11:54 ` [PATCH 1/3] video: fb: Make fbcon dmi quirks usuable for drm drivers too Hans de Goede
@ 2017-09-08 11:54 ` Hans de Goede
2017-09-08 11:54 ` [PATCH 3/3] drm/i915: Add "panel orientation" property to the panel connector Hans de Goede
2017-09-08 12:05 ` [PATCH 0/3] fb/drm: Add support for a panel-orientation connector prop Daniel Vetter
3 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2017-09-08 11:54 UTC (permalink / raw)
To: Daniel Vetter, Jani Nikula, Sean Paul, David Airlie,
Bartlomiej Zolnierkiewicz
Cc: Hans de Goede, linux-fbdev, dri-devel, Bastien Nocera
On some devices the LCD panel is mounted in the casing in such a way that
the up/top side of the panel does not match with the top side of the
device (e.g. it is mounted upside-down).
This commit adds the necessary infra for lcd-panel drm_connector-s to
have a "panel orientation" property to communicate how the panel is
orientated vs the casing.
Userspace can use this property to check for non-normal orientation and
then adjust the displayed image accordingly by rotating it to compensate.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/gpu/drm/drm_connector.c | 92 +++++++++++++++++++++++++++++++++++++++++
include/drm/drm_connector.h | 4 ++
include/drm/drm_mode_config.h | 7 ++++
include/uapi/drm/drm_mode.h | 7 ++++
4 files changed, 110 insertions(+)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index ba9f36cef68c..ea4cded1e328 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -665,6 +665,13 @@ static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = {
{ DRM_MODE_PICTURE_ASPECT_16_9, "16:9" },
};
+static const struct drm_prop_enum_list drm_panel_orientation_enum_list[] = {
+ { DRM_MODE_PANEL_ORIENTATION_NORMAL, "Normal" },
+ { DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP, "Upside Down" },
+ { DRM_MODE_PANEL_ORIENTATION_LEFT_UP, "Left Side Up" },
+ { DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, "Right Side Up" },
+};
+
static const struct drm_prop_enum_list drm_dvi_i_select_enum_list[] = {
{ DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */
{ DRM_MODE_SUBCONNECTOR_DVID, "DVI-D" }, /* DVI-I */
@@ -746,6 +753,18 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name,
*
* CRTC_ID:
* Mode object ID of the &drm_crtc this connector should be connected to.
+ *
+ * Connectors for LCD panels may also have one standardized property:
+ *
+ * panel orientation:
+ * On some devices the LCD panel is mounted in the casing in such a way
+ * that the up/top side of the panel does not match with the top side of
+ * the device. Userspace can use this property to check for this.
+ * Note that input coordinates from touchscreens (input devices with
+ * INPUT_PROP_DIRECT) will still map 1:1 to the actual LCD panel
+ * coordinates, so if userspace rotates the picture to adjust for
+ * the orientation it must also apply the same transformation to the
+ * touchscreen input coordinates.
*/
int drm_connector_create_standard_properties(struct drm_device *dev)
@@ -1148,6 +1167,79 @@ int drm_mode_connector_set_tile_property(struct drm_connector *connector)
EXPORT_SYMBOL(drm_mode_connector_set_tile_property);
/**
+ * drm_mode_create_panel_orientation_property - create scaling mode property
+ * @dev: DRM device
+ *
+ * Called by a driver the first time it's needed, must be attached to desired
+ * connectors.
+ */
+int drm_connector_create_panel_orientation_property(struct drm_device *dev)
+{
+ struct drm_property *panel_orientation;
+
+ if (dev->mode_config.panel_orientation_property)
+ return 0;
+
+ panel_orientation + drm_property_create_enum(dev, DRM_MODE_PROP_IMMUTABLE,
+ "panel orientation",
+ drm_panel_orientation_enum_list,
+ ARRAY_SIZE(drm_panel_orientation_enum_list));
+
+ dev->mode_config.panel_orientation_property = panel_orientation;
+
+ return 0;
+}
+EXPORT_SYMBOL(drm_connector_create_panel_orientation_property);
+
+/**
+ * drm_connector_attach_panel_orientation_property -
+ * attach panel-orientation property
+ * @connector: connector to attach panel-orientation property on.
+ * @width: width in pixels of the panel, used for panel quirk detection
+ * @height: height in pixels of the panel, used for panel quirk detection
+ * @panel_orientation: a DRM_MODE_PANEL_ORIENTATION_* value
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_connector_attach_panel_orientation_property(
+ struct drm_connector *connector, int width, int height,
+ int panel_orientation)
+{
+ int orientation;
+
+ /*
+ * Note fb_get_panel_rotate_quirk returns the rotation needed to
+ * *correct* for the panel orientation.
+ */
+ switch (fb_get_panel_rotate_quirk(width, height)) {
+ case FB_ROTATE_UR:
+ orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL;
+ break;
+ case FB_ROTATE_CW:
+ orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP;
+ break;
+ case FB_ROTATE_UD:
+ orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP;
+ break;
+ case FB_ROTATE_CCW:
+ orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP;
+ break;
+ default:
+ orientation = panel_orientation;
+ }
+
+ if (orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
+ drm_object_attach_property(&connector->base,
+ connector->dev->mode_config.panel_orientation_property,
+ orientation);
+
+ return 0;
+}
+EXPORT_SYMBOL(drm_connector_attach_panel_orientation_property);
+
+/**
* drm_mode_connector_update_edid_property - update the edid property of a connector
* @connector: drm connector
* @edid: new value of the edid property
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index ea8da401c93c..42cd07ee58fb 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -1004,6 +1004,10 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
u32 scaling_mode_mask);
int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
+int drm_connector_create_panel_orientation_property(struct drm_device *dev);
+int drm_connector_attach_panel_orientation_property(
+ struct drm_connector *connector, int width, int height,
+ int panel_orientation);
int drm_mode_connector_set_path_property(struct drm_connector *connector,
const char *path);
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 1b37368416c8..6db187e4c747 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -741,6 +741,13 @@ struct drm_mode_config {
*/
struct drm_property *suggested_y_property;
+ /**
+ * @panel_orientation_property: Optional connector property indicating
+ * how the lcd-panel is mounted inside the casing (e.g. normal or
+ * upside-down).
+ */
+ struct drm_property *panel_orientation_property;
+
/* dumb ioctl parameters */
uint32_t preferred_depth, prefer_shadow;
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index a2bb7161f020..b8b9f5abae53 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -127,6 +127,13 @@ extern "C" {
#define DRM_MODE_LINK_STATUS_GOOD 0
#define DRM_MODE_LINK_STATUS_BAD 1
+/* Panel Orientation options */
+#define DRM_MODE_PANEL_ORIENTATION_UNKNOWN -1
+#define DRM_MODE_PANEL_ORIENTATION_NORMAL 0
+#define DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP 1
+#define DRM_MODE_PANEL_ORIENTATION_LEFT_UP 2
+#define DRM_MODE_PANEL_ORIENTATION_RIGHT_UP 3
+
/*
* DRM_MODE_ROTATE_<degrees>
*
--
2.13.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] drm/i915: Add "panel orientation" property to the panel connector
2017-09-08 11:54 [PATCH 0/3] fb/drm: Add support for a panel-orientation connector prop Hans de Goede
2017-09-08 11:54 ` [PATCH 1/3] video: fb: Make fbcon dmi quirks usuable for drm drivers too Hans de Goede
2017-09-08 11:54 ` [PATCH 2/3] drm: Add support for a panel-orientation connector property Hans de Goede
@ 2017-09-08 11:54 ` Hans de Goede
2017-09-08 12:05 ` [PATCH 0/3] fb/drm: Add support for a panel-orientation connector prop Daniel Vetter
3 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2017-09-08 11:54 UTC (permalink / raw)
To: Daniel Vetter, Jani Nikula, Sean Paul, David Airlie,
Bartlomiej Zolnierkiewicz
Cc: Hans de Goede, linux-fbdev, dri-devel, Bastien Nocera
For now this is always set to DRM_MODE_PANEL_ORIENTATION_UNKNOWN
unless there is a dmi based quirk overriding the value.
In the future we should probably provide an initial value based on
the VBT (at least for some panel types).
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/gpu/drm/i915/intel_panel.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 72f8cbb237b1..4a52c9d5790a 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -1926,6 +1926,22 @@ int intel_panel_init(struct intel_panel *panel,
struct drm_display_mode *alt_fixed_mode,
struct drm_display_mode *downclock_mode)
{
+ struct intel_connector *intel_connector + container_of(panel, struct intel_connector, panel);
+ int ret;
+
+ if (fixed_mode) {
+ ret = drm_connector_create_panel_orientation_property(
+ intel_connector->base.dev);
+ if (ret)
+ return ret;
+
+ drm_connector_attach_panel_orientation_property(
+ &intel_connector->base,
+ fixed_mode->hdisplay, fixed_mode->vdisplay,
+ DRM_MODE_PANEL_ORIENTATION_UNKNOWN);
+ }
+
intel_panel_init_backlight_funcs(panel);
panel->fixed_mode = fixed_mode;
--
2.13.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] fb/drm: Add support for a panel-orientation connector prop
2017-09-08 11:54 [PATCH 0/3] fb/drm: Add support for a panel-orientation connector prop Hans de Goede
` (2 preceding siblings ...)
2017-09-08 11:54 ` [PATCH 3/3] drm/i915: Add "panel orientation" property to the panel connector Hans de Goede
@ 2017-09-08 12:05 ` Daniel Vetter
2017-09-08 15:08 ` Hans de Goede
3 siblings, 1 reply; 6+ messages in thread
From: Daniel Vetter @ 2017-09-08 12:05 UTC (permalink / raw)
To: Hans de Goede
Cc: linux-fbdev, Bartlomiej Zolnierkiewicz, dri-devel, Bastien Nocera,
Daniel Vetter
On Fri, Sep 08, 2017 at 01:54:41PM +0200, Hans de Goede wrote:
> Hi All,
>
> Some x86 clamshell design devices use portrait tablet LCD panels and a
> display engine which cannot (transparently) rotate in hardware, so we
> need to rotate things in software / let user space deal with this.
>
> The fbcon code has a set of DMI based quirks to automatically detect
> such tablet LCD panels and rotate the fbcon to compensate.
>
> The plan was for userspace (e.g. a Wayland compositor) to simply read
> /sys/class/graphics/fbcon/rotate and apply the rotation from there to
> the LCD panel to compensate.
>
> However this will not work when an external monitor gets plugged in,
> since with fbcon rotation is not per output, so the fbcon quirk code
> disables the rotation when an external monitor is present.
Hm, where is that handled? Afaiui the fbdev emulation in drm completel
hides that there's possibly multiple monitors connected, which means I
have no idea how fbcon can even figure this out. Can you give some
pointers to relevant code?
Thanks, Daniel
>
> Using /sys/class/graphics/fbcon/rotate will not help in that case
> since it will indicate no rotation is in use. So instead we are going
> to need a drm connecter property for this.
>
> This patch-series introduces such a drm connector properperty, it
> consists of 3 patches:
>
> 1) Make the fbcon quirk table usable outside of the fbcon code
> 2) Add drm_connector_create_panel_orientation_property and
> drm_connector_attach_panel_orientation_property functions
> 3) Hook things up in intel_panel.c
>
> Regards,
>
> Hans
>
>
> p.s.
>
> Note this series does not yet get the panel orientation from the VBT
> on Intel devices. I think that for devices which have the panel
> upside-down (rather then rotated 90 degrees) this should work, but
> I've an i915 patch series pending which corrects for the upside-down
> scanario fully inside the i915 driver hiding the upside-down ness
> from userspace (and fbcon) and if that series gets merged then in
> the upside-down case the "panel orientation" property should read
> "Normal" and not "Upside Down", so I've left out hooking up the VBTs
> idea of the panel orientation for now.
>
> Note that we could use the new "panel orientation" property for the
> upside-down case too and drop my "[v4] drm/i915: Deal with upside-down
> mounted LCD panels" patch:
> https://patchwork.freedesktop.org/patch/173781/
>
> That patch is not universally liked anyways, so just dropping it and
> using the new prop this series introduces might be best.
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] fb/drm: Add support for a panel-orientation connector prop
2017-09-08 12:05 ` [PATCH 0/3] fb/drm: Add support for a panel-orientation connector prop Daniel Vetter
@ 2017-09-08 15:08 ` Hans de Goede
0 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2017-09-08 15:08 UTC (permalink / raw)
To: Daniel Vetter
Cc: linux-fbdev, Bartlomiej Zolnierkiewicz, dri-devel, Bastien Nocera,
Daniel Vetter
Hi,
On 08-09-17 14:05, Daniel Vetter wrote:
> On Fri, Sep 08, 2017 at 01:54:41PM +0200, Hans de Goede wrote:
>> Hi All,
>>
>> Some x86 clamshell design devices use portrait tablet LCD panels and a
>> display engine which cannot (transparently) rotate in hardware, so we
>> need to rotate things in software / let user space deal with this.
>>
>> The fbcon code has a set of DMI based quirks to automatically detect
>> such tablet LCD panels and rotate the fbcon to compensate.
>>
>> The plan was for userspace (e.g. a Wayland compositor) to simply read
>> /sys/class/graphics/fbcon/rotate and apply the rotation from there to
>> the LCD panel to compensate.
>>
>> However this will not work when an external monitor gets plugged in,
>> since with fbcon rotation is not per output, so the fbcon quirk code
>> disables the rotation when an external monitor is present.
>
> Hm, where is that handled? Afaiui the fbdev emulation in drm completel
> hides that there's possibly multiple monitors connected, which means I
> have no idea how fbcon can even figure this out. Can you give some
> pointers to relevant code?
The quirk code is added by this commit:
https://github.com/bzolnier/linux/commit/b0d8e409c3626eae42b59a3d76574804f2cef5ef
As you can see the check for a quirk match not only checks for
DMI strings, but also for the fbcon resolution, there are 2 reasons
for this:
1) Since these devices tend to be cheap and thus sometimes have generic
DMI strings, this is an extra check to avoid false positives
2) Since fbcon rotate is an all or nothing thing (not per output)
the question becomes what to do on these devices when using an
external output. Rotating the external output seems wrong, more
wrong then leaving the internal panel as is, esp. since these
devices tend to have small screens, so when an external output
is used chances are the user will mainly be using that.
TL;DR: we do not want to do fbcon rotation to compensate for
the panel orientation when an external output is used, the
resolution check gives us this since when an external output
is present (at boot) the fbcon resolution will (almost always)
be different.
And perhaps more importantly then me coming to the conclusion that
userspace cannot use /sys/class/graphics/fbcon/rotate having the
panel orientation be a property on the drm_connector simply seems
like the right thing to do from a design perspective.
As mentioned this will also help with the upside-down LCD panel
case, in which case I believe we can simply get the orientation
from the VBT table and I expect no DMI quirks to be necessary.
Note the 90 degree rotation is not in the VBT table, I believe this
is because the hardware and thus the GOP cannot handle this.
Regards,
Hans
>> Using /sys/class/graphics/fbcon/rotate will not help in that case
>> since it will indicate no rotation is in use. So instead we are going
>> to need a drm connecter property for this.
>>
>> This patch-series introduces such a drm connector properperty, it
>> consists of 3 patches:
>>
>> 1) Make the fbcon quirk table usable outside of the fbcon code
>> 2) Add drm_connector_create_panel_orientation_property and
>> drm_connector_attach_panel_orientation_property functions
>> 3) Hook things up in intel_panel.c
>>
>> Regards,
>>
>> Hans
>>
>>
>> p.s.
>>
>> Note this series does not yet get the panel orientation from the VBT
>> on Intel devices. I think that for devices which have the panel
>> upside-down (rather then rotated 90 degrees) this should work, but
>> I've an i915 patch series pending which corrects for the upside-down
>> scanario fully inside the i915 driver hiding the upside-down ness
>> from userspace (and fbcon) and if that series gets merged then in
>> the upside-down case the "panel orientation" property should read
>> "Normal" and not "Upside Down", so I've left out hooking up the VBTs
>> idea of the panel orientation for now.
>>
>> Note that we could use the new "panel orientation" property for the
>> upside-down case too and drop my "[v4] drm/i915: Deal with upside-down
>> mounted LCD panels" patch:
>> https://patchwork.freedesktop.org/patch/173781/
>>
>> That patch is not universally liked anyways, so just dropping it and
>> using the new prop this series introduces might be best.
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-09-08 15:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-08 11:54 [PATCH 0/3] fb/drm: Add support for a panel-orientation connector prop Hans de Goede
2017-09-08 11:54 ` [PATCH 1/3] video: fb: Make fbcon dmi quirks usuable for drm drivers too Hans de Goede
2017-09-08 11:54 ` [PATCH 2/3] drm: Add support for a panel-orientation connector property Hans de Goede
2017-09-08 11:54 ` [PATCH 3/3] drm/i915: Add "panel orientation" property to the panel connector Hans de Goede
2017-09-08 12:05 ` [PATCH 0/3] fb/drm: Add support for a panel-orientation connector prop Daniel Vetter
2017-09-08 15:08 ` Hans de Goede
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).