Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display with orientation: left/right flipped #3185

Closed
freefos opened this issue Jan 11, 2024 · 14 comments · Fixed by #3188
Closed

Display with orientation: left/right flipped #3185

freefos opened this issue Jan 11, 2024 · 14 comments · Fixed by #3188
Assignees
Labels

Comments

@freefos
Copy link

freefos commented Jan 11, 2024

Hi,

After the 123-mir2.16.1 update, the frame screen is rotated 180 degrees.

kiosk_rotation180
The boot animation is still correct.

Reverted back to 121-mir2.15.0 and everything is back to normal.

This is my display configuration

layouts:
# keys here are layout labels (used for atomically switching between them).
# The yaml anchor 'the_default' is used to alias the 'default' label

  default:
    cards:
    # a list of cards (currently matched by card-id)

    - card-id: 0
      HDMI-A-1:
        # This output supports the following modes: [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected]
        #
        # Uncomment the following to enforce the selected configuration.
        # Or amend as desired.
        #
        state: enabled  # {enabled, disabled}, defaults to enabled
        mode: [email protected]    # Defaults to preferred mode
        position: [0, 0]        # Defaults to [0, 0]
        orientation: left       # {normal, left, right, inverted}, defaults to normal
        scale: 1
        group: 0        # Outputs with the same non-zero value are treated as a single display

  side_by_side:
    cards:
    # a list of cards (currently matched by card-id)

    - card-id: 0
      HDMI-A-1:
        # This output supports the following modes: [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected]
        #
        # Uncomment the following to enforce the selected configuration.
        # Or amend as desired.
        #
        state: enabled  # {enabled, disabled}, defaults to enabled
        mode: [email protected]    # Defaults to preferred mode
        position: [0, 0]        # Defaults to [0, 0]
        orientation: left       # {normal, left, right, inverted}, defaults to normal
        scale: 1
        group: 0        # Outputs with the same non-zero value are treated as a single display

What could be the issue here?

@Saviq Saviq added the bug label Jan 11, 2024
@Saviq
Copy link
Collaborator

Saviq commented Jan 11, 2024

Hi @freefos, sorry that happened to you… can you post frame's logs for the initial display configuration?

I suspect the output name might have changed, and your previous configuration misses the setting for the new output name…

I will also suggest you subscribe to https://discourse.ubuntu.com/c/mir/15, we had this version in the candidate channel for a few weeks, would've been good if you tested it before.

@Saviq Saviq added question and removed bug labels Jan 11, 2024
@Saviq
Copy link
Collaborator

Saviq commented Jan 11, 2024

@freefos I just confirmed that this behaves correctly on all the hardware I have to hand…

$ snap install ubuntu-frame --revision 7257
ubuntu-frame 121-mir2.15.0 from Canonical✓ installed

# … Frame displays in "normal" orientation

$ snap get ubuntu-frame display
layouts:
# keys here are layout labels (used for atomically switching between them).                                                                                                                               
# The yaml anchor 'the_default' is used to alias the 'default' label                                                                                                                                      
                                                  
  default:
    cards:
    # a list of cards (currently matched by card-id)
                                                  
    - card-id: 0          
      HDMI-A-1:
        # This output supports the following modes: [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected], [email protected] 
        #
        # Uncomment the following to enforce the selected configuration.
        # Or amend as desired.                                                                       
        #                                                                                                                                                                                                 
        state: enabled  # {enabled, disabled}, defaults to enabled
        mode: [email protected]    # Defaults to preferred mode
        position: [0, 0]        # Defaults to [0, 0]
        orientation: normal     # {normal, left, right, inverted}, defaults to normal
        scale: 1
        group: 0        # Outputs with the same non-zero value are treated as a single display
                                                  
  side_by_side:                                                                                                                                                                                           
    cards:
    # a list of cards (currently matched by card-id)

    - card-id: 0
      HDMI-A-1:
        # This output supports the following modes: [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected], [email protected], [email protected], [email protected],
        # [email protected], [email protected], [email protected] 
        #
        # Uncomment the following to enforce the selected configuration.
        # Or amend as desired.
        #
        state: enabled  # {enabled, disabled}, defaults to enabled
        mode: [email protected]    # Defaults to preferred mode
        position: [0, 0]        # Defaults to [0, 0]
        orientation: normal     # {normal, left, right, inverted}, defaults to normal
        scale: 1
        group: 0        # Outputs with the same non-zero value are treated as a single display
$ snap set ubuntu-frame display="                                                       
layouts:
  default:
    cards:
    - card-id: 0
      HDMI-A-1:
        orientation: left
"

# Frame displays in `left` orientation
$ snap refresh ubuntu-frame --channel 22/stable
ubuntu-frame (22/stable) 123-mir2.16.1 from Canonical✓ refreshed

# Frame displays in `left` orientation

I would also suggest trimming your display configuration to just the values you want changed, no need for the comments and defaults, they make it trickier to read.

@Saviq
Copy link
Collaborator

Saviq commented Jan 12, 2024

Hi @freefos, any update on this? Were you able to solve this?

@Saviq Saviq added bug and removed question labels Jan 12, 2024
@Saviq Saviq transferred this issue from canonical/ubuntu-frame Jan 12, 2024
@AlanGriffiths
Copy link
Collaborator

After discussing with @Saviq we can confirm that left and right have been switched. Will investigate

@AlanGriffiths AlanGriffiths self-assigned this Jan 12, 2024
@Saviq Saviq changed the title Screen rotated 180 degrees after 123-mir2.16.1 update Display with orientation: left/right flipped Jan 12, 2024
@freefos
Copy link
Author

freefos commented Jan 12, 2024

Hi @Saviq,

I'm sorry for not getting back to you sooner.
Here you have my log file.
kiosk1_ubuntuframe_log.txt

You've already verified that the left and right have been swapped.
I can confirm that when I switch to "right" the rotation is indeed "correct" but the touch isn't rotated correctly.

@AlanGriffiths
Copy link
Collaborator

This is weird!

I cannot reproduce on an intel system, but can on a rpi400.

@AlanGriffiths
Copy link
Collaborator

The easiest reproducer I have is to run:

miral-app -demo-server --screen-rotation

Expected: pressing Ctrl-Alt-<arrow> moves the top of the screen to the side indicated by the arrow key

Actual: On RPi400, left and right are reversed


This is not just when running on hardware, it is also when running Mir-on-X (which uses a different driver) - that must help by excluding a lot of possible causes. (The fact this is, in some way, hardware specific helps explain how we missed it)

@freefos - it looks like you're also seeing this problem on an arm64 device - can you confirm?

@AlanGriffiths
Copy link
Collaborator

Here you have my log file.
kiosk1_ubuntuframe_log.txt

Thanks, one thing that looks unusual here is that when Mir 2.16 is configuring the display we get:

< - ERROR - > gbm-kms: Failed to set CRTC: No space left on device (28)

(And this doesn't happen with Mir 2.15.)

@freefos
Copy link
Author

freefos commented Jan 15, 2024

@AlanGriffiths These devices are running in a production environment.
I can only access them remotely.

We use the Odroid m1. (8GB RAM(2GB used))
16GB EMMC

Filesystem      Size  Used Avail Use% Mounted on
tmpfs           768M   57M  711M   8% /run
/dev/mmcblk0p2   15G  2.8G   11G  21% /
tmpfs           3.8G  8.0K  3.8G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/mmcblk0p1  240M   42M  186M  19% /boot
tmpfs           768M  4.0K  768M   1% /run/user/1000

Ordered an extra device so I can play around, test stuff, and see what's going on.
It should arrive at the end of this week.

@AlanGriffiths
Copy link
Collaborator

We use the Odroid m1. (8GB RAM(2GB used))

Thanks. The internet says that's an ARM Cortex-A55: an arm64 device

@freefos
Copy link
Author

freefos commented Jan 15, 2024

@AlanGriffiths
Copy link
Collaborator

OK, the point of variation between platforms is this code, on our arm64 devices we are taking the graphics::gl::OutputSurface::Layout::TopRowFirst codepath:

void mrg::Renderer::set_output_transform(glm::mat2 const& t)
{
    auto new_display_transform = glm::mat4(t);

    switch (output_surface->layout())
    {
    case graphics::gl::OutputSurface::Layout::GL:
        break;
    case graphics::gl::OutputSurface::Layout::TopRowFirst:
        // GL is going to render in its own coordinate system, but the OutputSurface
        // wants the output to be the other way up. Get GL to render upside-down instead.
        new_display_transform *= glm::mat4{
            1.0, 0.0, 0.0, 0.0,
            0.0, -1.0, 0.0, 0.0,
            0.0, 0.0, 1.0, 0.0,
            0.0, 0.0, 0.0, 1.0
        };
        break;
    }

    if (new_display_transform != display_transform)
    {
        display_transform = new_display_transform;
        update_gl_viewport();
    }
}

The resulting new_display_transform looks wrong (and clearly has the wrong effect), but I need to understand the code better before proposing a fix.

@AlanGriffiths
Copy link
Collaborator

@freefos the fix is now part of a "call for testing"

@freefos
Copy link
Author

freefos commented Jan 26, 2024

@AlanGriffiths, @Saviq

I finally received my test device and had the time to install it.
In the future, I will be able to test things much quicker.

I can confirm that 123-mir2.16.2 fixed the orientation.

But there seems to be a new issue:
The mouse cursor is a lot slower on 123-mir2.16.2 compared to 121-mir2.15.0.

On 121-mir2.15.0 the mouse cursor moves very smooth.
On 123-mir2.16.2 the mouse cursor moves very slowly and stutters.

Here are the logs of both versions.
log_121-mir2.15.0.txt
log_123-mir2.16.2.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants