diff mbox series

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

Message ID 20220221220045.11958-1-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show
Series drm/simpledrm: Add "panel orientation" property on non-upright mounted LCD panels | expand

Commit Message

Hans de Goede Feb. 21, 2022, 10 p.m. UTC
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 <javierm@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/gpu/drm/tiny/simpledrm.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Javier Martinez Canillas Feb. 22, 2022, 8:39 a.m. UTC | #1
Hello Hans,

On 2/21/22 23:00, Hans de Goede wrote:
> 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.

> 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 <javierm@redhat.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---

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

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

Best regards,
Thomas Zimmermann Feb. 22, 2022, 7:14 p.m. UTC | #2
Hi

Am 21.02.22 um 23:00 schrieb 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

Maybe '... fbcon renders sidewards.'

> 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 <javierm@redhat.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

Best regards
Thomas

> ---
>   drivers/gpu/drm/tiny/simpledrm.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
> index 04146da2d1d8..11576e0297e4 100644
> --- a/drivers/gpu/drm/tiny/simpledrm.c
> +++ b/drivers/gpu/drm/tiny/simpledrm.c
> @@ -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);
>
Hans de Goede Feb. 23, 2022, 11:25 a.m. UTC | #3
Hi,

On 2/22/22 20:14, Thomas Zimmermann wrote:
> Hi
> 
> Am 21.02.22 um 23:00 schrieb 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
> 
> 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/ ).

> 
>> 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 <javierm@redhat.com>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> 
> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

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



>> ---
>>   drivers/gpu/drm/tiny/simpledrm.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
>> index 04146da2d1d8..11576e0297e4 100644
>> --- a/drivers/gpu/drm/tiny/simpledrm.c
>> +++ b/drivers/gpu/drm/tiny/simpledrm.c
>> @@ -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);
>>   
>
Peter Robinson Feb. 23, 2022, 2:39 p.m. UTC | #4
On Wed, Feb 23, 2022 at 11:25 AM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi,
>
> On 2/22/22 20:14, Thomas Zimmermann wrote:
> > Hi
> >
> > Am 21.02.22 um 23:00 schrieb 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
> >
> > 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"

> as suggested by Javier (so s/to/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 <javierm@redhat.com>
> >> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> >
> > Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
>
> 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
>
>
>
> >> ---
> >>   drivers/gpu/drm/tiny/simpledrm.c | 3 +++
> >>   1 file changed, 3 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
> >> index 04146da2d1d8..11576e0297e4 100644
> >> --- a/drivers/gpu/drm/tiny/simpledrm.c
> >> +++ b/drivers/gpu/drm/tiny/simpledrm.c
> >> @@ -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);
> >>
> >
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
index 04146da2d1d8..11576e0297e4 100644
--- a/drivers/gpu/drm/tiny/simpledrm.c
+++ b/drivers/gpu/drm/tiny/simpledrm.c
@@ -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);