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

Desktop: Automatic scaling on HiDPI displays #960

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kajusnau
Copy link
Contributor

@kajusnau kajusnau commented Jan 23, 2025

Description of changes

  1. Automatic scaling for HiDPI displays:
    • Automatic scaling is now performed during system boot and on display-related events
    • Manual scaling settings are not supported
    • Note: Most conventional 4K TVs are quite low PPI (65-85). This means that no scaling will be applied on these displays
      If needed, we can adjust the behavior of the scaling script to check if the display is a TV and apply scaling accordingly, ignoring PPI.

Automatic Scaling Table

Condition Scaling Factor Description
TV size <= 65 inches 1.25 125% scaling for TVs up to 65 inches
TV size > 65 inches 1.50 150% scaling for TVs larger than 65 inches
PPI < 170 1 No scaling for low PPI displays
170 <= PPI < 200 1.25 125% scaling for medium PPI displays
200 <= PPI < 300 1.50 150% scaling for higher PPI displays
PPI >= 300 2 200% scaling for very high PPI displays
  1. Added wdisplays display configurator:

    • Can be opened via the XF86_Display function key (F7 on X1).
    • Known issue: wdisplays may close unexpectedly if a display is added or removed while it's open.
  2. Made minor adjustments to taskbar Quick Settings widget:

    • Updated naming conventions for built-in devices.
    • Added dynamic icons in the input/ouptut device selection lists.
  3. Adjusted ewwbar service to be reloaded more consistently:

    • The taskbar can now be reloaded quickly with systemctl --user reload ewwbar.
    • Taskbar is now reloaded on any display event (new display, removed display, display configuration change etc.).
  4. (Automated tests) added "hidpi-auto-scaling-reset" service:

    • This service should be started after logging in to reset any scaling performed at boot:
      systemctl --user start hidpi-auto-scaling-reset
    • Make sure to start the service only after the taskbar has already appeared

Future improvements/considerations

  1. Enable/disable automatic scaling as a nix config option in labwc.nix
  2. (Optional) Adjustable scaling factors based on PPI as a nix config option in labwc.nix
  3. Consider using way-displays.
    • Currently not possible due to conflicts with wdisplays - way-displays will always override any changes done by wdisplays.

Checklist for things done

  • Summary of the proposed changes in the PR description
  • More detailed description in the commit message(s)
  • Commits are squashed into relevant entities - avoid a lot of minimal dev time commits in the PR
  • Contribution guidelines followed
  • Ghaf documentation updated with the commit - https://tiiuae.github.io/ghaf/
  • PR linked to architecture documentation and requirement(s) (ticket id)
  • Test procedure described (or includes tests). Select one or more:
    • Tested on Lenovo X1 x86_64
    • Tested on Jetson Orin NX or AGX aarch64
    • Tested on Polarfire riscv64
  • Author has run make-checks and it passes
  • All automatic Github Action checks pass - see actions
  • Author has added reviewers and removed PR draft status
  • Change requires full re-installation
  • Change can be updated with nixos-rebuild ... switch

Instructions for Testing

  • List all targets that this applies to:
  • Is this a new feature
    • List the test steps to verify:
      • Verify scaling is performed on HiDPI displays as described in the table above during:
        • Boot
        • Runtime (adding, removing displays)
      • Verify scaling does not negatively affect usability
      • Verify Audio Input/Output device selection in the Quick Settings widget properly displays:
        • Dynamic icons for all devices
        • Built-in device names based on used port
  • If it is an improvement how does it impact existing functionality?

@kajusnau kajusnau requested a review from humaidq-tii January 23, 2025 08:32
@kajusnau kajusnau temporarily deployed to internal-build-workflow January 23, 2025 08:32 — with GitHub Actions Inactive
@kajusnau kajusnau self-assigned this Jan 23, 2025
@kajusnau kajusnau added the Needs Testing CI Team to pre-verify label Jan 23, 2025
@kajusnau kajusnau temporarily deployed to internal-build-workflow January 23, 2025 08:33 — with GitHub Actions Inactive
@kajusnau kajusnau temporarily deployed to internal-build-workflow January 23, 2025 09:19 — with GitHub Actions Inactive
@kajusnau kajusnau temporarily deployed to internal-build-workflow January 23, 2025 10:18 — with GitHub Actions Inactive
@kajusnau kajusnau temporarily deployed to internal-build-workflow January 23, 2025 11:03 — with GitHub Actions Inactive
@milva-unikie
Copy link

Tested on Lenovo-X1 (nixos-rebuild switch)

Issues:

  • The side of external display changes. In login screen and right after logging in it is on the left side, after that it switches to the right side. It used to be on right.

  • With my (older) X1 gen11 laptop the screen feels a bit out of focus with the scaling. It is scaled to 1.25, PPI 162. Especially some icons do not have high enough resolution and end up looking blurry. I also personally think the previous scaling was better for usability.

    • Here is comparison with the old and new scaling with 100 % zoom in Chrome.
      old
      new
    • For the higher resolution gen11 laptops the scaling is definitely needed. I don't have access to one today so could not test that yet.
  • After reset (systemctl --user start hidpi-auto-scaling-reset), removing external monitor or starting auto-scaling again (systemctl --user start hidpi-auto-scaling) causes the taskbar to not update correctly.
    broken-taskbar

Working:

  • Scaling works automatically after login and when connecting/disconnecting displays.
  • Quick settings shows dynamic icons and updates built-in device based on port.
  • Test-automation passes after a few fixes, see note below.

Notes:

  • Test-automation will need to be updated, the image recognition tool is not really able to locate the scaled icons. The solution we agreed on is to reset the scaling before tests are run. Draft PR for that is open, it is still WIP Add scaling reset to GUI Log in ci-test-automation#215

@milva-unikie milva-unikie added bug on Lenovo X1 Carbon Issues found on Lenovo X1 Carbon while checking this PR and removed Needs Testing CI Team to pre-verify labels Jan 24, 2025
@kajusnau kajusnau temporarily deployed to internal-build-workflow January 24, 2025 13:38 — with GitHub Actions Inactive
@kajusnau
Copy link
Contributor Author

I'd like to get more feedback on this, especially regarding what kind of automatic scaling we should/could do on TVs.
The positioning bug as described by Milla needs to be addressed in some way as well.
For automated UI tests - the hidpi-auto-scaling-reset service can be started after boot to reset any automatic scaling.

@johannarautanen
Copy link

In my x1 scaling is just all right with that PR#960.
Looks like it was in Milla's x1 display earlier, so you don't need magnifying glass to see what is on the display.
At least i'm happier user with this scaling :)

- Enable automatic scaling for HiDPI display
- Scaling is performed during boot and on display events
- Add wdisplays display configurator
- Reload taskbar on display config change
- Minor adjustments to taskbar audio device widgets naming and style

Signed-off-by: Kajus Naujokaitis <[email protected]>
@kajusnau kajusnau deployed to internal-build-workflow January 27, 2025 13:44 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug on Lenovo X1 Carbon Issues found on Lenovo X1 Carbon while checking this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants