3

I am currently working on a Kiosk system based on the Raspberry Pi 2 running Raspbian which runs a Java app. Everything works perfectly well, except for a distortion on the screen which appears while objects are moving. Normally, this wouldn’t be a problem, but I have a list on the Java app which will be extensively used by the users. The distortion is visible while scrolling on this list. The following image shows how this distortion looks like:

Distortion

The link below shows this in action:

A GIF showing the distortion

What I know so far:

  • This only occurs while the screen is rotated in portrait. I have rotated the screen by 270* by setting “display_rotate=3” in /boot/config.txt. It also appears when the screen is rotated by 90* by setting “display_rotate=1”
  • It is not dependent on the screen resolution or the “hdmi_group"
  • This doesn’t happen only on the GUI, the distortion is also visible during boot time
  • Overlocking doesn’t affect the distortion
  • It always appears on the right-bottom side of the screen
  • This issue was also present in Ubuntu Mate
8
  • If you aren't so concerned about the boot screen orientation, etc., you could try leaving the screen with its normal rotation in config.txt, and instead use xrandr (e.g. xrandr --output HDMI-0 --rotate left) with the GUI. Since that's a different mechanism, it may produce a better result. You can test it while X is running.
    – goldilocks
    Oct 14, 2015 at 16:34
  • @goldilocks I remember trying this, but without any luck. It seems that the support for xrandr is not that great in RPi. I tried executing the command but it couldn't find the HDMI-0 output, so I used "default" instead. After executing xrandr --output default --rotate left I got the error: xrandr: output default cannot use rotation "left" reflection "none".
    – DrenImeraj
    Oct 14, 2015 at 17:13
  • Hmmph. Had not noticed that before.
    – goldilocks
    Oct 14, 2015 at 17:27
  • @goldilocks I just checked and the error xrandr: output default cannot use rotation "left" reflection "none" is also present in Ubuntu Mate.
    – DrenImeraj
    Oct 15, 2015 at 9:21
  • Yes. I get the same thing using Fedora ARM, of which there is no version specifically for the pi -- they all just use the Xorg generic fbdev driver anyway. It's this that's the limitation WRT to dynamic rotation via xrandr, but apparently static rotation (i.e., configuring it to start and stay that way) is possible. I'm going to try this since I could use an actual pi xorg.conf for other reasons; check back in an hour or so.
    – goldilocks
    Oct 15, 2015 at 10:17

1 Answer 1

1

You could try the rotation using X instead of setting it in config.txt. I don't promise it will fix your issue, but it seems to work fine here for me (I did not compare it to the config.txt method, however). I believe these are two pretty distinct mechanisms.

The Xorg server on the Pi uses a generic framebuffer driver, fbdev. Note that this was not written specifically for it and should be available in any GNU/Linux ARM distro.1

A limitation of that driver is that it cannot do a dynamic rotation; normally something like xrandr --output default --rotate left could be used to rotate the screen with the server running, but this will fail on the Pi because the fbdev driver can't do that.

However, you can configure a static rotation. I created the following as /etc/X11/conf.d/rpi.conf (this directory does not exist by default on Raspbian, but you can create it, and the file, as root):

Section "Device"
        Identifier "RpiFB"
        Driver "fbdev"
        Option "rotate" "CCW"  # As in, counter clockwise
EndSection

Section "Monitor"
        Identifier "generic"
EndSection

Section "Screen"
        Identifier "screen1"
        Device "RpiFB"
        Monitor "generic"
EndSection

Section "ServerLayout"
        Identifier "slayo1"
        Screen "screen1"
EndSection

This is pretty minimal and derived from a hint here and my reading of man xorg.conf. You don't have to use it exactly as is, the key part is the Option "rotate" line in Section "Device". The possibilities are:

  • "CCW", Counter clockwise aka. left
  • "CW", Clockwise, aka. right
  • "UD", Upside down.

If it does not work, shut X down and have a look at /var/log/Xorg.0/log. If you left the Identifiers the same there should be a bit in there like:

[158797.529] (==) ServerLayout "slayo1"
[158797.529] (**) |-->Screen "screen1" (0)
[158797.529] (**) |   |-->Monitor "generic"
[158797.532] (**) |   |-->Device "RpiFB"

Somewhere after Using config directory: "/etc/X11/xorg.conf.d". If that's not there, the problem is your configuration wasn't read (but there's no reason it shouldn't be on a stock system, see man xorg.conf again). If it is, keep reading down the log -- Xorg should report your typos/errors.


1. The driver does identify the hardware (BCM2708 FB (video memory: 600kB), or 4050kB on the Pi 2) but it will do this on, e.g., a general purpose Fedora ARM distro that includes no pi specific software. I'm mentioning this to make it clear there is nothing special about the Raspbian Xorg driver and any documentation you find around for the fbdev driver, pi oriented or not, should be applicable; witness "the hint" I found about the rotate option was from a blog about DisplayLink devices.

5
  • I have created the file rpi.conf under /etc/X11/conf.d with the contents you specified. After restarting the RPi nothing happened. I tried closing X and looking at the log file /var/log/Xorg.0.log but I couldn't find "slayo1" in it, grep slayo1 /var/log/Xorg.0.log returns nothing. @goldilocks you have been most kind, thank you!
    – DrenImeraj
    Oct 15, 2015 at 14:26
  • Have a look and see which "config directory" it does claim to be using, and/or what "ServerLayout" -- some other file may be superseding this. I tested this w/ Fedora and Raspbian, BTW, so there should be a way to make it happen for you.
    – goldilocks
    Oct 15, 2015 at 14:38
  • The "config directory" seems to be /usr/share/X11/xorg.conf.d. As for the ServerLayout I can't find anything about it.
    – DrenImeraj
    Oct 15, 2015 at 14:50
  • If you put it in there, use a 99- prefix; I think precedence is given to stuff that's processed last (the /etc directory being read after the /usr one). If you can't get it to load it on Mate, you might try Ask Ubuntu or U&L for troubleshooting advice ("Xorg won't read my .conf file...").
    – goldilocks
    Oct 15, 2015 at 14:59
  • It worked, THANK YOU! I modified the file 99-fbturbo.conf located in "config directory. I added another line with the contents Option "rotate" "CCW" and the screen was rotated after restarting X. Unfortunately the performance is poor. It seems that I'll have to do what I have been avoiding this long, rotating the contents of the Java app. Thanks again!
    – DrenImeraj
    Oct 15, 2015 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.