famadorian
Posts: 18
Joined: Sun Jun 13, 2021 9:21 am

Rotate Screen on Boot

Sun Apr 16, 2023 7:32 pm

I'm able to rotate the screen inside the operating system, but I want to rotate the screen when booting, to be able to see what is displayed on the bootup screen.

Any pointers as to how I can do that?

aBUGSworstnightmare
Posts: 7784
Joined: Tue Jun 30, 2015 1:35 pm

Re: Rotate Screen on Boot

Mon Apr 17, 2023 5:56 am

add the rotation parameter to your kernel command line.

The example below is for FHD on HDMI1, rotated by 180° (so it's upside down). Alter the command to the resolution and rotation (90/180/270 are valid options) of your choice. Same applies to the output you want to rotate; change as required.

Code: Select all

video=HDMI-A-1:1920x1080M@60D,rotate=180

famadorian
Posts: 18
Joined: Sun Jun 13, 2021 9:21 am

Re: Rotate Screen on Boot

Mon Apr 17, 2023 7:41 pm

This will only rotate after the kernel is loaded. I want to rotate before anything is loaded, to be able to see the screen that is shown before the kernel loads.

cleverca22
Posts: 7758
Joined: Sat Aug 18, 2012 2:33 pm

Re: Rotate Screen on Boot

Tue Apr 18, 2023 2:11 am

famadorian wrote:
Mon Apr 17, 2023 7:41 pm
This will only rotate after the kernel is loaded. I want to rotate before anything is loaded, to be able to see the screen that is shown before the kernel loads.
there is no way to rotate the hdmi diagnostics screen

and start4.elf doesnt display any text, so rotation at that stage is rather pointless

the linux kernel then follows, and thats already answered

aBUGSworstnightmare
Posts: 7784
Joined: Tue Jun 30, 2015 1:35 pm

Re: Rotate Screen on Boot

Tue Apr 18, 2023 5:01 am

Boot diagnostics screen i.e. is rendered by the firmware only. It will be shown with no uSD card present --> no uSD card, no settings for rotation!
As another example you will never be able to ratate the 'rainbow' screen; also rendered by FW.

NOTE: you can have firmware related settings active up to the point where KMS kicks in/out.
I have a screen which has some 'bad' EDID data. So, did a short test and added custom HDMI timings parameters for it to config.txt

Code: Select all

hdmi_force_hotplug=1
hdmi_ignore_edid=0xa5000080
hdmi_group=2
hdmi_mode=87
framebuffer_width=1080
framebuffer_height=1920
max_framebuffer_height=1920
max_framebuffer_width=1920
# ---------------------------------------------
# HDMI timing definitions
# ---------------------------------------------
hdmi_timings=1080 1 100 10 50 1920 1 2 2 2 0 0 0 60 0 144400000 3
display_hdmi_rotate=3
As one can see the screen is a portrait mode screen, so as long as the firmware is active It will display in native orientation.

For KMS I want it to be rotated to landscape, that's why below gets added to the kernel command line (cmdline.txt)

Code: Select all

video=HDMI-A-1:1080x1920M@60D,rotate=90 
Testing the result when booting to CLI first.
It should start portrait and at some point - when KMS takes over - be rotated to landscape.

That's working 'somehow' as expected -> screens starts in portrait and the get's rotated by KMS to landscape.
Seems firmware is igniring the frame buffer related settings as well as the rotation parameter!
Same is valid when using FKMS btw!


Anyhow, test with your screen (as you did not mention why it's mounted upside down).

famadorian
Posts: 18
Joined: Sun Jun 13, 2021 9:21 am

Re: Rotate Screen on Boot

Thu Apr 27, 2023 11:27 am

Hmm, a simple rotation as kernel parameters didn't even work for me

I just appended the video part to my cmdline.txt, but when it starts, it's still at the same rotation

console=serial0,115200 console=tty1 root=PARTUUID=5e7aee5a-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-console video=HDMI-A-1:1080x1920M@60D,rotate=90

Any ideas?;)

I'll try 180, to see what happens.

aBUGSworstnightmare
Posts: 7784
Joined: Tue Jun 30, 2015 1:35 pm

Re: Rotate Screen on Boot

Thu Apr 27, 2023 1:31 pm

famadorian wrote:
Thu Apr 27, 2023 11:27 am
Hmm, a simple rotation as kernel parameters didn't even work for me

I just appended the video part to my cmdline.txt, but when it starts, it's still at the same rotation

console=serial0,115200 console=tty1 root=PARTUUID=5e7aee5a-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-console video=HDMI-A-1:1080x1920M@60D,rotate=90

Any ideas?;)

I'll try 180, to see what happens.
Are you sure your screen is full HD in portrait mode (1080x1920pixels)?

What I've posted is an my last post was an example only! So in case your screen is a standard FHD in landscape orientation (1920x1080) you need to use

Code: Select all

video=HDMI-A-1:1920x1080M@60D,rotate=90
(as stated here already viewtopic.php?p=2102735#p2099990)
And you also need to make sure you you're screen is connected to HDMI-1 (the output next to uSD on a Pi400!)

famadorian
Posts: 18
Joined: Sun Jun 13, 2021 9:21 am

Re: Rotate Screen on Boot

Sun Apr 30, 2023 8:23 pm

Ok, damn, this is so weird and it's not working.

Let me start off by saying that the initial screen when I boot, before the kernel loads is 90 CCW.

After the kernel boots, this is the result of changing the variable

| config | rotation |
| 0 | 90 degrees CCW |
| 90 | 90 degrees CCW |
| 180 | 90 degrees CW |
| 270 | 90 degrees CCW |

So, 0, 90 and 270 has no effect; screen is still 90 CCW.

If I, however, set the variable to 180, then the screen is 90 degrees CW;)

Damn, any pointers?;)

famadorian
Posts: 18
Joined: Sun Jun 13, 2021 9:21 am

Re: Rotate Screen on Boot

Mon May 01, 2023 10:20 am

ok, it's this monitor.

https://www.waveshare.com/wiki/21.5inch_FHD_Monitor

It says it's 1080 x 1920, so it's actually default in portrait mode, hmm.

I will try again with that other kernel line.

famadorian
Posts: 18
Joined: Sun Jun 13, 2021 9:21 am

Re: Rotate Screen on Boot

Mon May 01, 2023 8:34 pm

ok, I've now tried all the combinations and it's the same here. The screen is 90 CCW rotated for all 0,90 and 270 and 90 CW for 180

This is for both kernel lines:

video=HDMI-A-1:1920x1080M@60D,rotate=X
video=HDMI-A-1:1080x1920M@60D,rotate=X

So, I've tried 8 possible variations of that line.

I'm stumped. Any ideas what I can try?;)

famadorian
Posts: 18
Joined: Sun Jun 13, 2021 9:21 am

Re: Rotate Screen on Boot

Sat May 06, 2023 8:04 am

Ok, it's solved:

Comment out the dtoverlay line
# Enable DRM VC4 V3D driver
#dtoverlay=vc4-kms-v3d

Now the orientation is correct, but what did I just comment out?;)

DRM VC4 V3D is not something I need?

What is it?;)

cleverca22
Posts: 7758
Joined: Sat Aug 18, 2012 2:33 pm

Re: Rotate Screen on Boot

Sat May 06, 2023 1:33 pm

that was the driver for doing all 2d and 3d acceleration, so now anything using the display will be cpu intensive

famadorian
Posts: 18
Joined: Sun Jun 13, 2021 9:21 am

Re: Rotate Screen on Boot

Sat May 06, 2023 2:05 pm

Ok, that sucks.

It won't rotate with that line enabled, so what we're gonna do with the drunken sailor?

famadorian
Posts: 18
Joined: Sun Jun 13, 2021 9:21 am

Re: Rotate Screen on Boot

Tue May 09, 2023 4:58 pm

I got this from support

thank you for your reply
If you want to modify the rotation parameters in the config file, you can only choose to comment out kms to use
Otherwise, you can only choose to use the rotation method of xrandr and the rotation method of the GUI interface, there is no other method

dixon1e
Posts: 3
Joined: Sun Sep 16, 2018 5:33 pm

Re: Rotate Screen on Boot

Wed May 24, 2023 5:39 am

Using xrandr is clear enough, it is now the only way to make the screen rotate. However my question is "where is this supposed to be executed during boot?"

The reason this is tricky is the form of the command. xrandr needs to be told which DISPLAY is in use. Here is the prototype command that works:

Code: Select all

DISPLAY=:0 xrandr --output HDMI-1 --rotate inverted
Should this be execute in:
  • an autostart command
    a systemd command
    in a .bashrc or similar

Return to “Raspberry Pi 400”