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

Offset rendering on Linux since glutin upgrade #1657

Closed
FauxFaux opened this issue Jan 7, 2018 · 8 comments · Fixed by #1663
Closed

Offset rendering on Linux since glutin upgrade #1657

FauxFaux opened this issue Jan 7, 2018 · 8 comments · Fixed by #1663
Labels

Comments

@FauxFaux
Copy link

FauxFaux commented Jan 7, 2018

Since 5de27b0 ("update glutin and gl_generator"), on Ubuntu Artful (16.10) with nvidia-384, things render off-centre. Here's the cargo run --example image:

image

Here's what it should look like. Same machine, but glium at commit 63577da, before the updates. Note the (r) to the right of the L, and the even margin:

image

It's nothing to do with the window size, it happens at all sizes; the discrepancies in the above screenshots are my laziness.

Not super visually significant in this example, but presumably related to PistonDevelopers/conrod#1120 which is awful.

I am still unable to find a pure glutin example that shows the same behaviour.

@tomaka
Copy link
Member

tomaka commented Jan 8, 2018

Probably a HiDPI issue, as always.

@FauxFaux
Copy link
Author

FauxFaux commented Jan 8, 2018

I have large monitors (2 * 2560x1440), but they're not HiDPI by the normal standards, nor do I have any scaling config as far as I can remember. Issue happens in Gnome and in i3, which should use different scaling settings.

% xdpyinfo | grep -B 2 resolution
screen #0:
  dimensions:    5120x1440 pixels (1204x342 millimeters)
  resolution:    108x107 dots per inch

@tomaka tomaka added the T-bug label Jan 8, 2018
@spearman
Copy link
Contributor

Reverting the change to the X11 window get_inner_size method made in (rust-windowing/winit@4890229) seems to fix it:

spearman/winit@d3cc220

Not sure if that's the real problem or if the change was intentional and the problem is elsewhere.

@tomaka
Copy link
Member

tomaka commented Jan 16, 2018

Hmm, maybe glium applies the HiDPI stuff on top of glutin.

@daboross
Copy link
Contributor

I've been trying to replicate this on my computer running Ubuntu 16.10, but I haven't found any setting which makes DPI reported by xdpyinfo anything other than 96x96. Was there some setting you had to change to get it to 108x107 that I could also change?

@FauxFaux
Copy link
Author

Ah, right, I didn't even try changing the DPI manually. If I run xrandr --dpi 200 it gets much worse, as expected:

x

And xrandr --dpi 96 fixes it to look like the reverted commit.

@daboross
Copy link
Contributor

Ah cool! I can also reproduce this now with xrandr --dpi 200 on Xorg.

@daboross
Copy link
Contributor

daboross commented Jan 16, 2018

Alright, thank you! I think I've found the culprit in glium: it accounts for get_inner_size() returning dpi-scaled points, while the commit in winit mentioned earlier changes it to return absolute pixels. (code at https://github.com/glium/glium/blob/master/src/backend/glutin/mod.rs#L265).

This was much easier to find with the commit you found, @spearman and the isolation of the issue to the winit upgrade and dpi scaling you found, @FauxFaux.

This seems to really be just winit making a breaking change in what get_inner_size meant with the 0.9 upgrade, and the associated upgrade in glium not accounting for that change.

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.

4 participants