Re: Rotating (efi) framebuffer console

From: Milan Obuch <freebsd-hackers_at_dino.sk>
Date: Fri, 25 Feb 2022 14:23:21 UTC
On Sat, 5 Feb 2022 20:50:41 +0000
Stefan Grundmann <sg2342@googlemail.com> wrote:

> Hi,
> 
> the screen of my brand new GPD Pocket 3 (tiger lake) laptop is in
> portrait mode and reports a resolution of 1200x1920. I have another
> older device with the same issue (a GPD Pocket 1).
> In 2019 johalun@FreeBSD.org wrote on the freebsd-current about an
> Lenovo Ideapad with a portrait mode screen and raised the question if
> it would be good to support rotation of the vt_fb console.
>

Hi,

I just acquired a GPD Micro PC, which shows exactly the same issue,
albeit with different resolution. Your patch comes just in time for
me...

> Since the new GPD Pocket 3 is a nice device and rather well supported
> in FreeBSD, i thought "how hard can it be" (OpenBSD has fb console
> rotation and Linux has fbcon=rotate..)
>
> The patch (against stable/13, at the end of this mail) works for
> me(tm): Whenever the width of a frambuffer device is smaller than
> it's height; a portrait mode screen is assumed and the screen is
> rotated by 90 degrees clockwise.
>

After patching fresh stable/13 sources, doing full rebuild and
reinstall, this works for me nicely. Thanks for the patch.

> I write this here for two reasons:
>
> 1. give others with similar hardware a chance to avoid the
> neck-craning issue
>

Thanks, this helps. I could use this device now in console mode with no
issue. Just one small thing remains - loader output is still rotated. I
have no idea how could this issue be solved properly, possibly similar
patch for screen driver in loader (I did not look in the sources in
stand directory).

> 2. offer to work on something that can be reviewed and merged e. g.
>    - implement the rest of the transformations (180 degrees, 270
> degrees)
>    - boot-time variable to select behavior
>    - vt(4) man page update
>
> For 2. i would like to know if vt_fb.c is even the right place to do
> this. The framebuffer code in the loader could also get this feature.
>

[ snip ]

I'd like to ask whether you have some more hacks - for now, pressing
power button while running FreeBSD does nothing, some driver/handler is
missing, possibly for other parts of hardware as well, but overall,
device runs nicely under FreeBSD. I am going to try X here, but this
requires some work to build :)

Once again, thanks for the patch.

Regards,
Milan