Is X11 Screen Rotation Possible?
#1
Question 
I'm using X11, not Wayland, on my PinePhone and I'd love to be able to rotate the screen. Has anyone managed to do this? Or maybe someone has it working on another Pine64 device?

My XFCE display settings tell me my monitor is called "default" and the drop-down for Rotate is disabled.

I tried:

Code:
xrandr --output default --rotate right


and it tells me rotation isn't supported.

Looking around it seems my PinePhone's monitor should be detected as "DSI-1" so why is it using "default"?

I tried to add a config:

/etc/X11/xorg.conf.d/30-monitor.conf

Code:
Section "Monitor"
  Identifier "DSI-1"
  Option    "Rotate" "right"
EndSection

but it had no effect, because I think X11 still doesn't know my monitor is "DSI-1". How should it be detected?

One last thing I tried was adding:

Code:
Option "Rotate" "CW"
to /etc/X11/xorg.conf.d/20-fbturbo.conf

but that stops X from starting altogether and in the Xorg.0.log it says XRandR rotation is being disabled, so that's obviously a no-go.

Can anyone help?
  Reply
#2
Hi, to rotate the screen with `xrandr` you can use the '-o' flag (short for '--orientation')
But this won't rotate the touchscreen input. To do that you can use `xinput`
Run `xinput` with no arguments to see the list of input devices and get the touchscreen ID (look for "Goodix Capacitive TouchScreen"). For me it is id 8.

Here are the `xrandr` + `xinput` combinations for all the 4 orientations (replace $ID with the correct ID):

Code:
xrandr -o normal
xinput set-prop $ID "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1

xrandr -o left
xinput set-prop $ID "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1

xrandr -o inverted
xinput set-prop $ID "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1

xrandr -o right
xinput set-prop $ID "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1

EDIT:
You can also specify the name instead of the ID.
To do so, replace $ID with "pointer:Goodix Capacitive TouchScreen"
  Reply
#3
(09-18-2021, 04:28 AM)jlucas Wrote: Hi, to rotate the screen with `xrandr` you can use the '-o' flag (short for '--orientation')

Thanks, but when I try that I just get:

Code:
X Error of failed request:   Bad Match (invalid parameter attributes)
  Major opcode of failed request:   139 (RANDR)
  Minor opcode of failed request:    2 (RRSetScreenConfig)
  Serial number of failed request:   14
  Current serial number in output stream:   14

I'm thinking for some reason my fbturbo driver isn't providing xrandr features like orientation. The fact the only output xrandr lists is "default" makes me think it's using some kind of fallback device.

My distro is a custom Slarm64 made by swapping in the kernel and modules from Manjaro. Maybe they weren't compiled with support for this. I think I'll take a look at some other distros. Maybe Maemo Leste.

Do the commands you posted work on your PinePhone? What distro are you running?
  Reply
#4
I'm using X11 on Arch Linux.
The commands I posted are the ones I use on my script to rotate the screen.
I tested them right before I posted and they were working. Then I noticed you mentioned fbturbo - which I hadn't heard of before - so I searched for it in the repos and noticed it wasn't installed.
So I installed xf86-video-fbturbo-git and rebooted. And now xrandr gives me an error similar to yours (only difference is the "Major opcode of failed request" is 140 instead of 139, whatever that means).
As for the monitor name, mine was showing the right names, but after installing fbturbo it also listed it as "default".

Searching a bit for the error, it seems fbturbo really doesn't support xrandr rotation (https://github.com/ssvb/xf86-video-fbtur...-146012185).

It should be possible to have a fixed orientation other than the default with fbturbo, but apparently it reduces performance (https://github.com/ssvb/xf86-video-fbtur...t-45969823).


So if you can live without that driver, then it should work.
  Reply
#5
(09-18-2021, 11:04 AM)jlucas Wrote: Then I noticed you mentioned fbturbo - which I hadn't heard of before - so I searched for it in the repos and noticed it wasn't installed.
So I installed xf86-video-fbturbo-git and rebooted. And now xrandr gives me an error similar to yours (only difference is the "Major opcode of failed request" is 140 instead of 139, whatever that means).
As for the monitor name, mine was showing the right names, but after installing fbturbo it also listed it as "default".

That's really interesting. Thanks for testing it out. The million dollar question is what driver was X11 using before you installed fbturbo? I'm guessing something like fbdev.

(09-18-2021, 11:04 AM)jlucas Wrote: Searching a bit for the error, it seems fbturbo really doesn't support xrandr rotation (https://github.com/ssvb/xf86-video-fbtur...-146012185).

It should be possible to have a fixed orientation other than the default with fbturbo, but apparently it reduces performance (https://github.com/ssvb/xf86-video-fbtur...t-45969823).

Well done digging out that information. I'd been searching all over for an answer to this.

(09-18-2021, 11:04 AM)jlucas Wrote: So if you can live without that driver, then it should work.

Based on the name and what little I've read, fbturbo is presumably supposed to accelerate the graphics but then I get messages in my Xorg.0.log saying that hardware acceleration is unavailable so I may not have much to lose by removing it.

I've not really had a lot of time to look into hardware accelerated 3D on the PinePhone yet (with X11). I've run a few 3D games but thinking about it, they could be using software rendering.

Anyway, thanks for your help.
  Reply
#6
Hmm, I disabled fbturbo temporarily by changing the extension of my 20-fbturbo.conf file in /etc/X11/xorg.conf.d and yes that does let me then rotate the screen and my monitor then appears as "DSI-1" instead of "default" in my XFCE display settings. I even get the feeling that windows seem to move around a little more smoothly.

There are downsides, though. SDDM no longer renders its interface, instead displaying a black screen with flashing cursor and mouse pointer. I've found this issue mentioned a number of times on other sites with various different solutions, but maybe it just needs me to make a new xorg.conf, if I can only figure out what the driver should be called now. I was able to get into the desktop with Ctrl-Alt-F4, logging in and doing "startx".

I ran ioquake3 and there was loads of sort of ghosting of the textures when rotating the view. It said it was using the Mesa Lima driver so maybe that's unrelated to this particular issue.

Anyway it looks for the moment like a trade off whether I can live without dynamic screen rotation or live with these other annoyances. I'll keep tinkering with it.
  Reply
#7
(09-18-2021, 05:30 PM)acid andy Wrote: That's really interesting. Thanks for testing it out. The million dollar question is what driver was X11 using before you installed fbturbo? I'm guessing something like fbdev.
I'm glad I could help.

My Xorg log (fbturbo uninstalled):
Code:
[…]
[  1445.041] (==) Matched modesetting as autoconfigured driver 0
[  1445.041] (==) Matched fbdev as autoconfigured driver 1
[  1445.041] (==) Assigned the driver to the xf86ConfigLayout
[  1445.041] (II) LoadModule: "modesetting"
[  1445.041] (II) Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
[  1445.044] (II) Module modesetting: vendor="X.Org Foundation"
[  1445.044]    compiled for 1.20.13, module version = 1.20.13
[  1445.044]    Module class: X.Org Video Driver
[  1445.044]    ABI class: X.Org Video Driver, version 24.1
[  1445.044] (II) LoadModule: "fbdev"
[  1445.044] (WW) Warning, couldn't open module fbdev
[  1445.044] (EE) Failed to load module "fbdev" (module does not exist, 0)
[…]

So apparently it is using the "modesetting" driver, I also didn't have fbdev installed...
After installing fbdev it loads it as well, everything seems to work the same.
I can't really notice any performance changes, since most of what I do is in the terminal.
  Reply
#8
(09-18-2021, 11:04 AM)jlucas Wrote: I'm using X11 on Arch Linux.
The commands I posted are the ones I use on my script to rotate the screen.
I tested them right before I posted and they were working. Then I noticed you mentioned fbturbo - which I hadn't heard of before - so I searched for it in the repos and noticed it wasn't installed.
So I installed xf86-video-fbturbo-git and rebooted. And now xrandr gives me an error similar to yours (only difference is the "Major opcode of failed request" is 140 instead of 139, whatever that means).
As for the monitor name, mine was showing the right names, but after installing fbturbo it also listed it as "default".

Searching a bit for the error, it seems fbturbo really doesn't support xrandr rotation (https://github.com/ssvb/xf86-video-fbtur...-146012185).

It should be possible to have a fixed orientation other than the default with fbturbo, but apparently it reduces performance (https://github.com/ssvb/xf86-video-fbtur...t-45969823).


So if you can live without that driver, then it should work.

Do you have an explanation on how to use X11 on Phosh?
Because I thought the Purism team made it Wayland-only.

I never liked the whole Wayland lock-in, because why are we replacing something that has been fully functional for 24 years with something that is still far from functional 12 years after its development started?
Looks a lot like the more effort we put to make something better, the worse results we're getting in the end.
Not just with Linux, this is the case with pretty much everything in the current year.
母語は日本語ですが、英語も喋れます(ry
  Reply
#9
(09-19-2021, 06:06 AM)jlucas Wrote: So apparently it is using the "modesetting" driver, I also didn't have fbdev installed...
After installing fbdev it loads it as well, everything seems to work the same.
I can't really notice any performance changes, since most of what I do is in the terminal.

Yes at the moment I can't notice any significant difference between modesetting and fbdev either.

For anyone following this, whatever that problem is that was stopping SDDM from rendering my login screen with these drivers, I avoided it by switching to GDM. It was a lot of work getting GDM to compile on Slarm64 and building all the dependencies (and actually when first installed it wouldn't authenticate me; I had to use SDDM's PAM settings to fix that). In hindsight it might have been better to just find a way to hack an onscreen keyboard into XDM, but at least I'm back up and running and with screen rotation too! Smile

(09-20-2021, 06:09 AM)ryo Wrote: Do you have an explanation on how to use X11 on Phosh?
Because I thought the Purism team made it Wayland-only.

I never liked the whole Wayland lock-in, because why are we replacing something that has been fully functional for 24 years with something that is still far from functional 12 years after its development started?
Looks a lot like the more effort we put to make something better, the worse results we're getting in the end.
Not just with Linux, this is the case with pretty much everything in the current year.

I can't speak for jlucas but I personally didn't want to run Phosh, Wayland or systemd on my PinePhone, so I've got an XFCE desktop at the moment on it with Slarm64. I would guess it would be a lot of work to try to separate Phosh from Wayland. If you still prefer a mobile-style interface to a desktop but want X11 you might have more luck with Maemo Leste (which is apparently now based on Devuan and uses X11 I believe).
  Reply
#10
(09-20-2021, 06:09 AM)ryo Wrote: Do you have an explanation on how to use X11 on Phosh?
Because I thought the Purism team made it Wayland-only.

I never liked the whole Wayland lock-in, because why are we replacing something that has been fully functional for 24 years with something that is still far from functional 12 years after its development started?
Looks a lot like the more effort we put to make something better, the worse results we're getting in the end.
Not just with Linux, this is the case with pretty much everything in the current year.

I guess X11 clients on Phosh should work through XWayland, but I assume you meant "Phosh on X11", and don't think that's possible.
Either way, I'm not using Phosh, I'm using an archlinux barebones installation with my own sxmo-inspired build of dwm.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PinePhone Boots but only Shows Black Screen with Backlight danyeaw 1 764 06-30-2024, 10:18 AM
Last Post: danyeaw
  Boot screen stuck at 'K' because of firmware deleted. poundantisec 9 6,972 08-28-2023, 11:38 AM
Last Post: fxc
  locked out on PIN screen g40 1 1,006 06-07-2023, 10:20 PM
Last Post: Kevin Kofler
Sad New PinePhone won't boot 9/10 times - Screen is on but stays black :( dante404 8 6,791 02-03-2023, 01:27 AM
Last Post: dante404
  My screen bottom side has loosed its tactile function arbocenc 1 1,187 01-06-2023, 10:02 AM
Last Post: britelite
  "PinenotePhone": Swap E-Ink Screen Onto Pinephone? britelite 0 908 01-03-2023, 06:17 PM
Last Post: britelite
  Screen seems ok but no display UncleMeat 3 2,315 11-03-2022, 07:02 AM
Last Post: fxc
Question Black screen no matter the OS joseph303 2 2,050 07-19-2022, 01:07 AM
Last Post: joseph303
  Boot problem: wrong screen orientation Jetpac 6 4,813 07-18-2022, 12:47 PM
Last Post: fravoi
  Manjaro phosh no screen rotation sandspur 1 1,720 06-23-2022, 01:02 AM
Last Post: rapp

Forum Jump:


Users browsing this thread: 1 Guest(s)