As titled, in Raspian Lite, if I enable OpenGL (fake KMS) I'm unable to rotate the screen using the /boot/config.txt
file
I tried:
display_hdmi_rotate=1
and
display_rotate=1
with no success, any help?
-
The documentation says display_rotate should do it and another option for LCD is lcd_rotate. Does it rotate with OpenGL not enabled, just to clarify the rotation works for the display in use? Also is it on a Pi4 or Pi400 as I've seen issues reported about rotation using the config.txt file. raspberrypi-spy.co.uk/2017/11/…Andy Anderson– Andy Anderson2021年09月28日 19:03:40 +00:00Commented Sep 28, 2021 at 19:03
-
both lcd_rotate and display_rotate dos NOT work with OpenGL enable, display_rotate works as expected with OpenGL disabled. I'm testing on raspberry 4 and zero WLuigi F– Luigi F2021年09月29日 13:27:03 +00:00Commented Sep 29, 2021 at 13:27
1 Answer 1
Rotating the screen for the Raspberry Pi 4
Due to the new video driver used for by the Raspberry Pi 4, you are unable to rotate the screen using the old /boot/config.txt method. If you want to rotate the screen on a Pi 4, we recommend that you use the Screen Configuration tool as it is much simpler to use. Instead you will need to make use of the xrandr command. 1. In the terminal of your Raspberry Pi run one of the following commands. If you want the rotation to affect the second HDMI slot try using HDMI-2 instead of HDMI-1 in the commands below. DISPLAY=:0 xrandr --output HDMI-1 --rotate normal This command resets the rotation back to normal. DISPLAY=:0 xrandr --output HDMI-1 --rotate left The command above rotates the screen output to the left. This is the equivalent of rotating by 90 degrees. DISPLAY=:0 xrandr --output HDMI-1 --rotate right This line rotates the screen to the right. This command is the same as turning the screen by 270 degrees. DISPLAY=:0 xrandr --output HDMI-1 --rotate inverted This final command flips the screen. This behavior is the same as rotating the screen by 180 degrees.
Rotating the screen for the Raspberry Pi 3 and Earlier
1. Within the terminal on your Raspberry Pi, begin editing the boot configuration file by running the following command. sudo nano /boot/config.txt 2. Within this file is where we will be able to change the screen rotation. First, you have to decide how you want your screen rotated. A number from 0 to 4 represents each of the possible rotations that the Raspberry Pi supports. A rotation of 90 degrees is 1, 180 degrees is 2, and 270 degrees is 3. Based on how you want the display rotated, enter one of the following lines to the bottom of the file. If you want to rotate the orientation of the LCD connection, instead you can use display_lcd_rotate instead of display_hdmi_rotate. display_hdmi_rotate=0 This setting will reset the rotation of your Pi’s screen to normal. This setting represents the default behavior. display_hdmi_rotate=1 Using this setting will rotate the screen by 90 degrees. This option is equivalent to rotating the screen to the right. display_hdmi_rotate=2 With this option, you will be rotating the output of the display by 180 degrees. This is the same behavior as inverting the screen. display_hdmi_rotate=3 Changing this option to 3 will rotate the screen by 270 degrees. This would be the same as rotating your screen to the left. 3. Once you have entered the line you want, please save the file by pressing CTRL + X, then Y, followed by ENTER. 4. For the new rotation setting to take effect, you will need to restart your Raspberry Pi. You can restart your Raspberry Pi easily by using the command below. sudo reboot With that done, you should now have successfully rotated the display output of your Raspberry Pi.
Taken from: https://pimylifeup.com/raspberry-pi-rotate-screen/
-
Andy thanks, I already tried but unfortunately doesn't work. DISPLAY=:0 xrandr --output HDMI-0 --left return me "Can't open the display". I tried from ssh console and directly using the keyboard attached to the raspberry, I'm running raspian lite (no x server)Luigi F– Luigi F2021年09月29日 13:24:38 +00:00Commented Sep 29, 2021 at 13:24
-
@LuigiF Have you found a solution to rotate the screen? I'm facing the same issue as you ("can't open the display").AdrienTorris– AdrienTorris2022年11月30日 15:10:02 +00:00Commented Nov 30, 2022 at 15:10
-
I used the UI interface (RPI preferences, screen, ...) and it did the job, but I would be interested to know if it's possible to do it by command line or on the RPI boot.AdrienTorris– AdrienTorris2022年11月30日 16:17:43 +00:00Commented Nov 30, 2022 at 16:17