Skip to content

Set extend mode after plugging a new monitor (BugFix)#1286

Merged
Hook25 merged 17 commits intomainfrom
edid-cycle-dbus
Jul 25, 2024
Merged

Set extend mode after plugging a new monitor (BugFix)#1286
Hook25 merged 17 commits intomainfrom
edid-cycle-dbus

Conversation

@p-gentili
Copy link
Copy Markdown
Collaborator

@p-gentili p-gentili commented Jun 12, 2024

Description

The Zapper EDID cycling job is failing on laptops because Mirror mode is making the external monitor match the internal display resolution. Like this:

Testing EDID cycling on HDMI-1
switching EDID to 1920x1080
PASS
switching EDID to 1280x1024
FAIL, got 1920x1080 but 1280x1024 expected
switching EDID to 2560x1440
FAIL, got 1920x1080 but 2560x1440 expected

gnome-randr can't be used for applying monitor configurations, and in general having two utilities (xrandr and gnome-randr) for x11 and wayland doesn't help with maintainability of this test.

This PR relies on DBus and Mutter to retrieve the current monitor configuration and apply extended mode every time we switch EDID.

Resolved issues

Resolves ZAP-677

Documentation

Up to date

Tests

Tested on 202302-31240 side-loading the provider running from source. Previously failing like above (ref).

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 13, 2024

Codecov Report

Attention: Patch coverage is 95.42857% with 8 lines in your changes missing coverage. Please review.

Project coverage is 44.27%. Comparing base (76939c4) to head (3ea1eae).
Report is 174 commits behind head on main.

Files with missing lines Patch % Lines
providers/base/bin/edid_cycle.py 80.76% 4 Missing and 1 partial ⚠️
...heckbox-support/checkbox_support/parsers/xrandr.py 95.83% 0 Missing and 2 partials ⚠️
...box-support/checkbox_support/dbus/gnome_monitor.py 96.55% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1286      +/-   ##
==========================================
+ Coverage   44.10%   44.27%   +0.17%     
==========================================
  Files         358      364       +6     
  Lines       38765    38897     +132     
  Branches     6571     6584      +13     
==========================================
+ Hits        17096    17222     +126     
- Misses      21006    21007       +1     
- Partials      663      668       +5     
Flag Coverage Δ
checkbox-support 54.07% <97.98%> (+1.50%) ⬆️
provider-base 18.40% <80.76%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@p-gentili p-gentili marked this pull request as ready for review June 13, 2024 13:45
Copy link
Copy Markdown
Collaborator

@Hook25 Hook25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few changes below, but I've tried both this and the "original" script on my machine and it doesn't seem to work with i3 (unsurprisingly, as it doesn't use Mutter). My question is, how limiting is this? We do use Checkbox on non-mutter platforms as well (like Mir for example). Could this be a problem? Is it possible to somehow calculate the OBJECT_PATH, NAME and INTERFACE to "fix" this?

@p-gentili
Copy link
Copy Markdown
Collaborator Author

A few changes below, but I've tried both this and the "original" script on my machine and it doesn't seem to work with i3 (unsurprisingly, as it doesn't use Mutter). My question is, how limiting is this? We do use Checkbox on non-mutter platforms as well (like Mir for example). Could this be a problem? Is it possible to somehow calculate the OBJECT_PATH, NAME and INTERFACE to "fix" this?

With the current implementation, relying on xrandr and gnome-randr, we are covering everything X11 + Gnome Wayland. With the latest few commits I re-included support for X11 via xrandr so that the coverage is the same. I still prefer to use Mutter over xrandr on Gnome because I feel like it should handle corner cases better (let me know if you're against this choice). We'll need to add support for other Wayland compositors, such as Mir or wlroots-based.

Got part of the xrandr parser from #1229 and added support for setting a new display configuration, in extended mode.

Both handlers inherit from the same abstract class so that the interface is the same and the EDID test itself doesn't care about the actual system.

Tested on:

@fernando79513 fernando79513 added the waiting-for-changes The review has been completed but the PR is waiting for changes from the author label Jul 16, 2024
@p-gentili p-gentili removed the waiting-for-changes The review has been completed but the PR is waiting for changes from the author label Jul 23, 2024
Copy link
Copy Markdown
Collaborator

@Hook25 Hook25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, ty for having updated this

@Hook25 Hook25 merged commit f96213d into main Jul 25, 2024
@Hook25 Hook25 deleted the edid-cycle-dbus branch July 25, 2024 08:20
pedro-avalos pushed a commit that referenced this pull request Jul 29, 2024
* Change: replaced xrandr/gnome-randr with dbus signals for EDID test

* Change: moved monitor config dbus to checkbox support

* Fix: tests for edid cycle

* fixup! Fix: tests for edid cycle

* Add: reference to original script

* Change: renamed Gnome Monitor class and files

* Add: abstract class for monitor config handlers

* Add: xrandr parser

* Fix: gnome class name

* Change: helper to return the proper monitor config

* Add: tests for xrandr parser

* Change: preferred mode for dbus as well

* Change: moved named tuple back to xrandr

* Fix: moved more zapper-related function under the CM

* Fix: sorted dictionary

* Fix: docstrings and another test

* Fix: removed get max function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants