Skip to content

Scale factor calculation on Linux #878

Description

@taylon

Hi!

I noticed an issue with the scaling factor calculation in Linux that causes a very high scale factor to be set, which in turn makes Oni2 as an example to render like this:

Looking at

let display = Sdl2.Window.getDisplay(sdlWindow);
let dpi = Sdl2.Display.getDPI(display);
let avgDpi = (dpi.hdpi +. dpi.vdpi +. dpi.ddpi) /. 3.0;
let scaleFactor = max(1.0, floor(avgDpi /. 96.0));
I can see that the the DPI value returned by SDL2 is wrong:

[DEBUG]   +20ms Revery.Core.Window : hdpi: 130048.000000 / vdpi: 36576.000000 / ddpi: 95525.617188
[TRACE]    +0ms Revery.Core.Window : _getScaleFactor - Linux - inferring from DPI: 910.000000

I'm using a very unusual monitor resolution of 5120x1440 which might be an edge case that causes some weird bug, or it might be X returning it wrong for whatever reason.

Either way, what do you think would be a good mitigation for this?

We could say that if the resulting scaleFactor is higher than a given threshold then assume that the calculation is wrong and set it to 1.0?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-renderingArea: Rendering artifacts, features etc.bugSomething isn't workingplatform-linuxPlatform: Linux

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions