Re: [Development] Qt 6 not seeing the same DPI as Qt 5

2021-11-30 Thread Thiago Macieira
On Tuesday, 30 November 2021 01:36:05 PST Ahmad Samir wrote:
> Do the - and + lines represent the same monitor? one says refresh rate is
> ~60Hz, the other says ~30Hz.

I'm not sure. For some reason, Qt 6 lists the external monitor ("DP-3-2") 
before the primary ("eDP-1") whereas Qt 5 does the opposite. So I rewrote the 
diff to display only the relevant info and I might have screwed up.

Here's the diff without the second monitor connected:

 Screens: 1, High DPI scaling: active
 # 0 "eDP-1" Depth: 24 Primary: yes
-  Manufacturer: Sharp Corporation
+  Manufacturer: 
   Model: 
   Serial number: 
   Geometry: 1920x1200+0+0 (native: 3840x2400+0+0) Available: 1920x1151+0+0
-  Physical size: 288x180 mm  Refresh: 59.9939 Hz Power state: 0
-  Physical DPI: 169.333,169.333 Logical DPI: 120,120 (native: 240,240) 
Subpixel_None
-  High DPI scaling factor: 2 DevicePixelRatio: 2 Pixel density: 1
-  Primary orientation: 2 Orientation: 2 Native orientation: 0 
OrientationUpdateMask: 0
+  Physical size: 406x254 mm  Refresh: 59.9939 Hz Power state: 0
+  Physical DPI: 120.118,120 Logical DPI: 96,96 (native: 240,240) 
Subpixel_None
+  High DPI scaling factor: 2 DevicePixelRatio: 2
+  Primary orientation: 2 Orientation: 2 Native orientation: 0

This is *with* Xft.dpi set in xrdb. Both files are attached (yes, I built Qt 5 
with GLES instead of GL).

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering
Qt 6.3.0 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 11.2.1 
20210816 [revision 056e324ce46a7924b5cf10f61010cf9dd2ca10e9]) on "xcb" 
OS: openSUSE Tumbleweed [linux version 5.15.2-1-default]

Architecture: x86_64; features: SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX AVX2

Environment:
  QEMU_AUDIO_DRV="pa"
  QTEST_COLORED="1"
  QTLIBDIR="/home/tjmaciei/obj/qt/qt6/qtbase/lib"
  QTOBJDIR="/home/tjmaciei/obj/qt/qt6/qtbase"
  QTSRCDIR="/home/tjmaciei/src/qt/qt6/qtbase"
  QT_AUTO_SCREEN_SCALE_FACTOR="0"
  QT_FORCE_STDERR_LOGGING="1"
  QT_IM_MODULE="xim"
  QT_IM_SWITCHER="imsw-multi"
  QT_MESSAGE_PATTERN="[%{time boot}] 
%{if-warning}%{endif}%{if-fatal}%{endif}%{if-critical}%{endif}%{appname}(%{pid}
 %{threadid})(%{function}):%{if-category} %{category}:%{endif} %{message}"
  QT_SCREEN_SCALE_FACTORS="2;2"
  QT_SELECT="6"

Features: QT_NO_EXCEPTIONS

Library info:
  PrefixPath: /home/tjmaciei/obj/qt/qt6/qtbase
  DocumentationPath: /home/tjmaciei/obj/qt/qt6/qtbase/doc
  HeadersPath: /home/tjmaciei/obj/qt/qt6/qtbase/include
  LibrariesPath: /home/tjmaciei/obj/qt/qt6/qtbase/lib
  LibraryExecutablesPath: /home/tjmaciei/obj/qt/qt6/qtbase/libexec
  BinariesPath: /home/tjmaciei/obj/qt/qt6/qtbase/bin
  PluginsPath: /home/tjmaciei/obj/qt/qt6/qtbase/plugins
  QmlImportsPath: /home/tjmaciei/obj/qt/qt6/qtbase/qml
  ArchDataPath: /home/tjmaciei/obj/qt/qt6/qtbase
  DataPath: /home/tjmaciei/obj/qt/qt6/qtbase
  TranslationsPath: /home/tjmaciei/obj/qt/qt6/qtbase/translations
  ExamplesPath: /home/tjmaciei/obj/qt/qt6/qtbase/examples
  TestsPath: /home/tjmaciei/obj/qt/qt6/qtbase/tests
  SettingsPath: /home/tjmaciei/obj/qt/qt6/qtbase/etc/xdg

Standard paths [*...* denote writable entry]:
  DesktopLocation: "Desktop" */home/tjmaciei/Desktop*
  DocumentsLocation: "Documents" */home/tjmaciei/Documents*
  FontsLocation: "Fonts" */home/tjmaciei/.local/share/fonts* 
/home/tjmaciei/.fonts /home/tjmaciei/.local/share/flatpak/exports/share/fonts 
/var/lib/flatpak/exports/share/fonts /usr/share/fonts
  ApplicationsLocation: "Applications" 
*/home/tjmaciei/.local/share/applications* 
/home/tjmaciei/.local/share/flatpak/exports/share/applications 
/var/lib/flatpak/exports/share/applications /usr/share/applications
  MusicLocation: "Music" */home/tjmaciei*
  MoviesLocation: "Movies" */home/tjmaciei/Videos*
  PicturesLocation: "Pictures" */home/tjmaciei/Pictures*
  TempLocation: "Temporary Directory" */tmp*
  HomeLocation: "Home" */home/tjmaciei*
  AppLocalDataLocation: "Application Data" 
*/home/tjmaciei/.local/share/QtProject/qtdiag* 
/home/tjmaciei/.local/share/flatpak/exports/share/QtProject/qtdiag 
/var/lib/flatpak/exports/share/QtProject/qtdiag /usr/share/QtProject/qtdiag
  CacheLocation: "Cache" */home/tjmaciei/.cache/QtProject/qtdiag*
  GenericDataLocation: "Shared Data" */home/tjmaciei/.local/share* 
/home/tjmaciei/.local/share/flatpak/exports/share 
/var/lib/flatpak/exports/share /usr/share
  RuntimeLocation: "Runtime" */run/user/1000*
  ConfigLocation: "Configuration" */home/tjmaciei/.config* 
/home/tjmaciei/.config/kdedefaults /etc/xdg /usr/etc/xdg
  DownloadLocation: "Download" */home/tjmaciei*
  GenericCacheLocation: "Shared Cache" */home/tjmaciei/.cache*
  GenericConfigLocation: "Shared Configuration" */home/tjmaciei/.config* 
/home/tjmaciei/.config/kdedefaults /etc/xdg /usr/etc/xdg
  AppDataLocation: "Application Configuration" 
*/home/tjmaciei/.local/share/QtProject/qtdiag* 
/home/tjmaciei/.local/share/flatpak/exports/share/QtProject/qtdiag 

Re: [Development] Qt 6 not seeing the same DPI as Qt 5

2021-11-30 Thread Ahmad Samir

On 29/11/21 18:41, Thiago Macieira wrote:

I'll probably have to report this as a bug, but just in case someone has seen
it before:

$ diff -u qtdiag5 qtdiag6
[...]
Geometry: 1920x1200+0+0 (native: 3840x2400+0+0) Available: 1920x1200+0+0
Virtual geometry: 5760x1200+0+0 Available: 5760x1200+0+0
2 virtual siblings
-  Physical size: 288x180 mm  Refresh: 59.9939 Hz Power state: 0
-  Physical DPI: 169.333,169.333 Logical DPI: 120.118,120 (native:
240.236,240) Subpixel_None
+  Physical size: 406x228.6 mm  Refresh: 29.9806 Hz Power state: 0
+  Physical DPI: 120.118,120 Logical DPI: 96,96 Subpixel_None
High DPI scaling factor: 2 DevicePixelRatio: 2



Do the - and + lines represent the same monitor? one says refresh rate is 
~60Hz, the other says ~30Hz.

[...]
--
Ahmad Samir
___
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development


Re: [Development] Qt 6 not seeing the same DPI as Qt 5

2021-11-29 Thread Thiago Macieira
On Monday, 29 November 2021 15:31:22 PST Tor Arne Vestbø wrote:
> The priority matters, so perhaps you have set one of the other things we
> might pick up? Xft/DPI or Xft.dpi?
> 
> https://doc-snapshots.qt.io/qt6-dev/highdpi.html#configuring-x11

Not set in X resources:
$ xrdb -query | grep -c dpi
0

I didn't even know what X settings was. A quick search found 
https://www.freedesktop.org/wiki/Specifications/XSettingsRegistry/, which led 
me to the "xsettingsd" package. But it's not set there either:

$ dump_xsettings | grep -ci dpi
0

Anyway, you're right that physical monitor sizes are known to be wildly 
broken. Therefore, relying on what XRandR reports is risky. I'll set up 
~/.Xresources.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering



___
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development


Re: [Development] Qt 6 not seeing the same DPI as Qt 5

2021-11-29 Thread Tor Arne Vestbø



On 29 Nov 2021, at 23:43, Thiago Macieira 
mailto:thiago.macie...@intel.com>> wrote:

On Monday, 29 November 2021 13:20:58 PST Tor Arne Vestbø wrote:
If you know that the physical DPI being reported is correct you can use
QT_USE_PHYSICAL_DPI to override the behavior as documented.

I did, but that makes no difference:

$ QT_USE_PHYSICAL_DPI=1 ~/obj/qt/installed/bin/qtdiag | grep DPI
 QT_USE_PHYSICAL_DPI="1"
Screens: 2, High DPI scaling: active
 Physical DPI: 120.118,120 Logical DPI: 96,96 Subpixel_None
 High DPI scaling factor: 2 DevicePixelRatio: 2
 Physical DPI: 120.118,120 Logical DPI: 96,96 Subpixel_None
 High DPI scaling factor: 2 DevicePixelRatio: 2

The priority matters, so perhaps you have set one of the other things we might 
pick up? Xft/DPI or Xft.dpi?

https://doc-snapshots.qt.io/qt6-dev/highdpi.html#configuring-x11

Cheers,
Tor Arne

___
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development


Re: [Development] Qt 6 not seeing the same DPI as Qt 5

2021-11-29 Thread Thiago Macieira
On Monday, 29 November 2021 13:20:58 PST Tor Arne Vestbø wrote:
> If you know that the physical DPI being reported is correct you can use
> QT_USE_PHYSICAL_DPI to override the behavior as documented.

I did, but that makes no difference:

$ QT_USE_PHYSICAL_DPI=1 ~/obj/qt/installed/bin/qtdiag | grep DPI
  QT_USE_PHYSICAL_DPI="1"
Screens: 2, High DPI scaling: active
  Physical DPI: 120.118,120 Logical DPI: 96,96 Subpixel_None
  High DPI scaling factor: 2 DevicePixelRatio: 2
  Physical DPI: 120.118,120 Logical DPI: 96,96 Subpixel_None
  High DPI scaling factor: 2 DevicePixelRatio: 2

> Sadly X doesn’t expose any per-monitor logical DPI. Some desktop
> environments solve it pretending like everything is rendered at 2x, with an
> Xft.dpi that matches, and then downscaling to the target monitor.

Yeah, I know. It would have helped me because of the rather different physical 
DPIs of the two monitors I use (laptop panel and external), but I can make do 
with something in-between the two.

And in my case, Wayland also has a problem for not supporting non-integer 
scale settings. 2x is too little (192 dpi) for the laptop panel and 3x (288 
dpi) is too much.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering



___
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development


Re: [Development] Qt 6 not seeing the same DPI as Qt 5

2021-11-29 Thread Tor Arne Vestbø

On 29 Nov 2021, at 19:05, Thiago Macieira 
mailto:thiago.macie...@intel.com>> wrote:

On Monday, 29 November 2021 09:09:16 PST Tor Arne Vestbø wrote:
What's changed between 5 and 6?

https://doc-snapshots.qt.io/qt6-dev/highdpi.html#configuring-x11

Thanks, Tor Arne. I see in the link that the RandR physical DPI is marked "Qt
5 only". Why did we remove this?

It wasn’t removed per se, but we no longer pick it up by default.

The rationale for that was that physical DPI is not the same as logical DPI, 
plus that physical DPI reporter by RandR may sometimes be wildly inaccurate, 
giving surprising results for users if we picked it up.

If you know that the physical DPI being reported is correct you can use 
QT_USE_PHYSICAL_DPI to override the behavior as documented.

Sadly X doesn’t expose any per-monitor logical DPI. Some desktop environments 
solve it pretending like everything is rendered at 2x, with an Xft.dpi that 
matches, and then downscaling to the target monitor.

We tried to open a discussion about how to treat the various X DPI settings, 
logical or physical, in 
https://lists.x.org/archives/xorg-devel/2020-September/058612.html, but sadly I 
got pulled in to other stuff and wasn’t able to follow up, and there wasn’t any 
reply from the X core developers, so it stalled.

If we change things in Qt I would prefer to align how Qt behaves in this regard 
with a clear authoritative guideline from the X people on how to interpret each 
setting, and preferably this would be aligned across toolkits as well.

Cheers,
Tor Arne

___
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development


Re: [Development] Qt 6 not seeing the same DPI as Qt 5

2021-11-29 Thread Thiago Macieira
On Monday, 29 November 2021 09:19:36 PST Henry Skoglund wrote:
> Slightly offtopic but did you build your own Qt Creator using Qt 6?

Yes

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering



___
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development


Re: [Development] Qt 6 not seeing the same DPI as Qt 5

2021-11-29 Thread Thiago Macieira
On Monday, 29 November 2021 09:09:16 PST Tor Arne Vestbø wrote:
> What's changed between 5 and 6?
> 
> https://doc-snapshots.qt.io/qt6-dev/highdpi.html#configuring-x11

Thanks, Tor Arne. I see in the link that the RandR physical DPI is marked "Qt 
5 only". Why did we remove this?

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering



___
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development


Re: [Development] Qt 6 not seeing the same DPI as Qt 5

2021-11-29 Thread Henry Skoglund

On 2021-11-29 17:41, Thiago Macieira wrote:

I'll probably have to report this as a bug, but just in case someone has seen
it before:

$ diff -u qtdiag5 qtdiag6
[...]
Geometry: 1920x1200+0+0 (native: 3840x2400+0+0) Available: 1920x1200+0+0
Virtual geometry: 5760x1200+0+0 Available: 5760x1200+0+0
2 virtual siblings
-  Physical size: 288x180 mm  Refresh: 59.9939 Hz Power state: 0
-  Physical DPI: 169.333,169.333 Logical DPI: 120.118,120 (native:
240.236,240) Subpixel_None
+  Physical size: 406x228.6 mm  Refresh: 29.9806 Hz Power state: 0
+  Physical DPI: 120.118,120 Logical DPI: 96,96 Subpixel_None
High DPI scaling factor: 2 DevicePixelRatio: 2

Qt 5 agrees with xrandr:
$ xrandr | grep eDP-1
eDP-1 connected primary 3840x2400+0+0 (normal left inverted right x axis y
axis) 288mm x 180mm

I start X with the "-dpi 240" setting, which gives me the best font size to
work on either display. Qt 5 obeys it just fine, dividing it by 2 because of
the scale factor, so my desktop looks fine. However, the one Qt 6 application
I use (Qt Creator) does not and has tiny fonts. I can override it with
QT_FONT_DPI=240 in the environment, but shouldn't have to.

That logical DPI of 96 makes zero sense. It's not physically correct and is
not part of the X config. Where is it coming from?

What's changed between 5 and 6?



Slightly offtopic but did you build your own Qt Creator using Qt 6?
(The downloadable vanilla 5.0.3 is based on Qt 5.15.2).

___
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development


Re: [Development] Qt 6 not seeing the same DPI as Qt 5

2021-11-29 Thread Tor Arne Vestbø

Cheers,
Tor Arne

On 29 Nov 2021, at 17:41, Thiago Macieira 
mailto:thiago.macie...@intel.com>> wrote:

I'll probably have to report this as a bug, but just in case someone has seen
it before:

$ diff -u qtdiag5 qtdiag6
[...]
  Geometry: 1920x1200+0+0 (native: 3840x2400+0+0) Available: 1920x1200+0+0
  Virtual geometry: 5760x1200+0+0 Available: 5760x1200+0+0
  2 virtual siblings
-  Physical size: 288x180 mm  Refresh: 59.9939 Hz Power state: 0
-  Physical DPI: 169.333,169.333 Logical DPI: 120.118,120 (native:
240.236,240) Subpixel_None
+  Physical size: 406x228.6 mm  Refresh: 29.9806 Hz Power state: 0
+  Physical DPI: 120.118,120 Logical DPI: 96,96 Subpixel_None
  High DPI scaling factor: 2 DevicePixelRatio: 2

Qt 5 agrees with xrandr:
$ xrandr | grep eDP-1
eDP-1 connected primary 3840x2400+0+0 (normal left inverted right x axis y
axis) 288mm x 180mm

I start X with the "-dpi 240" setting, which gives me the best font size to
work on either display. Qt 5 obeys it just fine, dividing it by 2 because of
the scale factor, so my desktop looks fine. However, the one Qt 6 application
I use (Qt Creator) does not and has tiny fonts. I can override it with
QT_FONT_DPI=240 in the environment, but shouldn't have to.

That logical DPI of 96 makes zero sense. It's not physically correct and is
not part of the X config. Where is it coming from?

What's changed between 5 and 6?

https://doc-snapshots.qt.io/qt6-dev/highdpi.html#configuring-x11

Cheers,
Tor Arne
___
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development


[Development] Qt 6 not seeing the same DPI as Qt 5

2021-11-29 Thread Thiago Macieira
I'll probably have to report this as a bug, but just in case someone has seen 
it before:

$ diff -u qtdiag5 qtdiag6
[...]
   Geometry: 1920x1200+0+0 (native: 3840x2400+0+0) Available: 1920x1200+0+0
   Virtual geometry: 5760x1200+0+0 Available: 5760x1200+0+0
   2 virtual siblings
-  Physical size: 288x180 mm  Refresh: 59.9939 Hz Power state: 0
-  Physical DPI: 169.333,169.333 Logical DPI: 120.118,120 (native: 
240.236,240) Subpixel_None
+  Physical size: 406x228.6 mm  Refresh: 29.9806 Hz Power state: 0
+  Physical DPI: 120.118,120 Logical DPI: 96,96 Subpixel_None
   High DPI scaling factor: 2 DevicePixelRatio: 2

Qt 5 agrees with xrandr:
$ xrandr | grep eDP-1  
eDP-1 connected primary 3840x2400+0+0 (normal left inverted right x axis y 
axis) 288mm x 180mm

I start X with the "-dpi 240" setting, which gives me the best font size to 
work on either display. Qt 5 obeys it just fine, dividing it by 2 because of 
the scale factor, so my desktop looks fine. However, the one Qt 6 application 
I use (Qt Creator) does not and has tiny fonts. I can override it with 
QT_FONT_DPI=240 in the environment, but shouldn't have to. 

That logical DPI of 96 makes zero sense. It's not physically correct and is 
not part of the X config. Where is it coming from?

What's changed between 5 and 6?

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering



___
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development