Skip to contentSkip to conversation

drm/simpledrm: Add "panel orientation" property on non-upright mounted LCD panels

PATCH In review Hans de Goede 4 participants 5 messages Feb 21, 2022 – Feb 23, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/simpledrm: Add "panel orientation" property on non-upright mounted LCD panels

Some devices use e.g. a portrait panel in a standard laptop casing made for landscape panels. efifb calls drm_get_panel_orientation_quirk() and sets fb_info.fbcon_rotate_hint to make fbcon rotate the console so that it shows up-right instead of on its side.

When switching to simpledrm to fbcon renders on its side. Call the drm_connector_set_panel_orientation_with_quirk() helper to add a "panel orientation" property on devices listed in the quirk table, to make the fbcon (and aware userspace apps) rotate the image to display properly.

Cc Javier Martinez Canillas <[email protected]>
---
 drivers/gpu/drm/tiny/simpledrm.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/tiny/simpledrm.c +3 -0
index 04146da2d1d8..11576e0297e4 100644
@@ -798,6 +798,9 @@ static int simpledrm_device_init_modeset(struct simpledrm_device *sdev)
 	if (ret)
 		return ret;
 	drm_connector_helper_add(connector, &simpledrm_connector_helper_funcs);
+	drm_connector_set_panel_orientation_with_quirk(connector,
+						       DRM_MODE_PANEL_ORIENTATION_UNKNOWN,
+						       mode->hdisplay, mode->vdisplay);
 
 	formats = simpledrm_device_formats(sdev, &nformats);
 
Signature · 1 line
2.35.1
Reviewed-by on v1 1/1
#1 lore raw

Hello Hans,

Quoted 6 lines · Hans de Goede

Some devices use e.g. a portrait panel in a standard laptop casing made for landscape panels. efifb calls drm_get_panel_orientation_quirk() and sets fb_info.fbcon_rotate_hint to make fbcon rotate the console so that it shows up-right instead of on its side.

When switching to simpledrm to fbcon renders on its side. Call the

This sentence sounds a little off to me. Did you mean:

"the fbcon renders on its side." ?

Maybe you can say something like the following:

When switching to simpledrm, fbcon attachs to the fbdev emulated by the DRM core instead. And the fb_info.fbcon_rotate_hint field is set by the emulation layer, if panel orientation was set for a connector.

Quoted 8 lines

drm_connector_set_panel_orientation_with_quirk() helper to add a "panel orientation" property on devices listed in the quirk table, to make the fbcon (and aware userspace apps) rotate the image to display properly.

Cc Javier Martinez Canillas <[email protected]>

---

The patch looks good to me. Thanks a lot for fixing this

Best regards,

Signature · 3 lines
Javier Martinez Canillas
Linux Engineering
Red Hat
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Hans de Goede

Hi

Am 21.02.22 um 23:00 schrieb Hans de Goede:

Quoted 6 lines

Some devices use e.g. a portrait panel in a standard laptop casing made for landscape panels. efifb calls drm_get_panel_orientation_quirk() and sets fb_info.fbcon_rotate_hint to make fbcon rotate the console so that it shows up-right instead of on its side.

When switching to simpledrm to fbcon renders on its side. Call the

Maybe '... fbcon renders sidewards.'

Quoted 7 lines

drm_connector_set_panel_orientation_with_quirk() helper to add a "panel orientation" property on devices listed in the quirk table, to make the fbcon (and aware userspace apps) rotate the image to display properly.

Cc Javier Martinez Canillas <[email protected]>

Best regards
Thomas

Quoted 18 lines
---
  drivers/gpu/drm/tiny/simpledrm.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/tiny/simpledrm.c +3 -0
index 04146da2d1d8..11576e0297e4 100644
@@ -798,6 +798,9 @@ static int simpledrm_device_init_modeset(struct simpledrm_device *sdev)
  	if (ret)
  		return ret;
  	drm_connector_helper_add(connector, &simpledrm_connector_helper_funcs);
+	drm_connector_set_panel_orientation_with_quirk(connector,
+						       DRM_MODE_PANEL_ORIENTATION_UNKNOWN,
+						       mode->hdisplay, mode->vdisplay);
 
  	formats = simpledrm_device_formats(sdev, &nformats);
 
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
#3 lore raw

Hi,

Quoted 11 lines · Thomas Zimmermann

Hi

Am 21.02.22 um 23:00 schrieb Hans de Goede:

Quoted 6 lines

Some devices use e.g. a portrait panel in a standard laptop casing made for landscape panels. efifb calls drm_get_panel_orientation_quirk() and sets fb_info.fbcon_rotate_hint to make fbcon rotate the console so that it shows up-right instead of on its side.

When switching to simpledrm to fbcon renders on its side. Call the

Maybe '... fbcon renders sidewards.'

that does not sound entirely right to me, so I've gone with:

"When switching to simpledrm the fbcon renders on its side."

as suggested by Javier (so s/to/the/ ).

Quoted 10 lines
Quoted 8 lines

drm_connector_set_panel_orientation_with_quirk() helper to add a "panel orientation" property on devices listed in the quirk table, to make the fbcon (and aware userspace apps) rotate the image to display properly.

Cc Javier Martinez Canillas <[email protected]>

Thank you both for the review/ack. I'm currently doing a test-build of drm-misc-next with the patch with amended commit msg applied. Once that is done I'll push this out to drm-misc-next.

Regards,

Hans

Quoted 18 lines
Quoted 17 lines

---
  drivers/gpu/drm/tiny/simpledrm.c | 3 +++

  1 file changed, 3 insertions(+)
drivers/gpu/drm/tiny/simpledrm.c +3 -0
index 04146da2d1d8..11576e0297e4 100644
@@ -798,6 +798,9 @@ static int simpledrm_device_init_modeset(struct simpledrm_device *sdev)
       if (ret)
           return ret;
       drm_connector_helper_add(connector, &simpledrm_connector_helper_funcs);
+    drm_connector_set_panel_orientation_with_quirk(connector,
+                               DRM_MODE_PANEL_ORIENTATION_UNKNOWN,
+                               mode->hdisplay, mode->vdisplay);
         formats = simpledrm_device_formats(sdev, &nformats);

#4 lore raw
Quoted 12 lines · Hans de Goede

Hi,

Quoted 8 lines · Thomas Zimmermann

Hi

Am 21.02.22 um 23:00 schrieb Hans de Goede:

Quoted 5 lines

Some devices use e.g. a portrait panel in a standard laptop casing made for landscape panels. efifb calls drm_get_panel_orientation_quirk() and sets fb_info.fbcon_rotate_hint to make fbcon rotate the console so that it shows up-right instead of on its side.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

When switching to simpledrm to fbcon renders on its side. Call the

Maybe '... fbcon renders sidewards.'

that does not sound entirely right to me, so I've gone with:

"When switching to simpledrm the fbcon renders on its side."

Not to completely bike shed but you could say "... the fbcon renders with the incorrect orientation"

Quoted 43 lines

as suggested by Javier (so s/to/the/ ).

Quoted 10 lines
Quoted 8 lines

drm_connector_set_panel_orientation_with_quirk() helper to add a "panel orientation" property on devices listed in the quirk table, to make the fbcon (and aware userspace apps) rotate the image to display properly.

Cc Javier Martinez Canillas <[email protected]>

Thank you both for the review/ack. I'm currently doing a test-build of drm-misc-next with the patch with amended commit msg applied. Once that is done I'll push this out to drm-misc-next.

Regards,

Hans

Quoted 18 lines
Quoted 17 lines
---
  drivers/gpu/drm/tiny/simpledrm.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/tiny/simpledrm.c +3 -0
index 04146da2d1d8..11576e0297e4 100644
@@ -798,6 +798,9 @@ static int simpledrm_device_init_modeset(struct simpledrm_device *sdev)
      if (ret)
          return ret;
      drm_connector_helper_add(connector, &simpledrm_connector_helper_funcs);
+    drm_connector_set_panel_orientation_with_quirk(connector,
+                               DRM_MODE_PANEL_ORIENTATION_UNKNOWN,
+                               mode->hdisplay, mode->vdisplay);
        formats = simpledrm_device_formats(sdev, &nformats);