Bug #693

Rotation doesn't work with display

Added by Hammel over 2 years ago. Updated almost 2 years ago.

Status:In ProgressStart date:02 Mar 2019
Priority:ImmediateDue date:
Assignee:Hammel% Done:


Target version:-
Severity:02 - High


Setting display_rotate=1 rotates the screen and X.org but the display only uses about half the screen space.
Setting lcd_display_rotate=1 rotates the screen but not X.org.

xrandr also doesn't seem to work but it's possible it won't work without the VC4 driver loaded. This driver can break some things. There is an alternative driver, vc4-fkms-v3d available that may work better.


Related issues

Related to Xeon - Feature #699: Create launcher for phone Closed 10 Mar 2019

Associated revisions

Revision 175dec47
Added by Hammel over 2 years ago

RM #693: Add CCW rotation support.

Revision 86e893a0
Added by Hammel over 2 years ago

RM #693: Add launcher.cfg for xeon to support rotation of the display.


#1 Updated by Hammel over 2 years ago

  • % Done changed from 0 to 10

xorg.conf can rotate and does fill the screen:

Section "Device"                                  
        Identifier          "Builtin Default fbdev Device 0" 
        Driver              "fbturbo" 
        Option              "Rotate" "CW" 

But this needs to also have tslib rotated. Doing that requires adding "rot=1" to the linear filter in /etc/ts.conf. However, that didn't seem to work when I tried it. I still get the wrong coordinates passed in. I may need to tell the launcher that we're in rotated mode, or maybe tell the touchProcessor API that we're rotated.

#2 Updated by Hammel over 2 years ago

  • Status changed from New to In Progress
  • % Done changed from 10 to 30

I found a solution for rotation but it feels a bit like a hack. First, X.org can be rotated by adding the following line to the Devices section for fbturbo.

Option              "Rotate" "CCW" 

Next, the launcher now has an -r option to enable rotation. If enabled, we swap the x and y coordinates and convert the new X to be the display height - the touch point. This means it only supports CCW rotations. That's the hack. It looks like this.

        if ( isCLIFlagSet( CLI_ROTATE) )
            piboxLogger(LOG_INFO, "Rotation is enabled.\n");
            posY = region->x;
            posX = piboxGetDisplayHeight() - region->y;
            posX = region->x;
            posY = region->y;

I didn't get the values I wanted from tslib when I told it to rotate. I still think using tslib's rotation option is the right solution so I'm going to keep working on that for a bit before committing the hack.

#3 Updated by Hammel over 2 years ago

So I played with it a bit more and realized that I not only have to rotate but invert axis configurations, but the latter requires knowing the display size when the config is created. It's not really programmatic or generic (rotation is generic - it doesn't need to know display size). So using tslib configuration isn't really useful.

So for now, even though it's a hack, I'm going with my earlier fix. There's probably a better way to do this, like by adding a config file for libpibox's tslib support that knows to rotate properly. That's something I'll need to do for all apps eventually. For now it just needs to be available for the launcher.

Still need to commit and push.

#4 Updated by Hammel over 2 years ago

  • Project changed from Xeon to libpibox
  • Target version deleted (v0.1)
  • % Done changed from 30 to 50

Committed and pushed.

Keeping it open (and moving to libpibox) till I migrate the solution to libpibox.

#5 Updated by Hammel over 2 years ago

  • Target version set to 1.1.0 - Upgrades

#6 Updated by Hammel almost 2 years ago

  • Project changed from libpibox to Xeon
  • Target version deleted (1.1.0 - Upgrades)

Moving to Xeon since none of the other systems based on PiBox require this feature.

Also available in: Atom PDF