Bug 504467 - Provided by feedback screen information seems incorrect
Summary: Provided by feedback screen information seems incorrect
Status: REPORTED
Alias: None
Product: frameworks-kuserfeedback
Classification: Frameworks and Libraries
Component: Telemetry Provider (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Volker Krause
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-18 13:22 UTC by Mykola Krachkovsky
Modified: 2025-05-23 15:31 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mykola Krachkovsky 2025-05-18 13:22:49 UTC
SUMMARY
I was checking user feedback data that was sent and noticed screen information is not quite correct.
Sent telemetry states following, note that both screen marked with devicePixelRatio = 2 and dpi is strange:
```
    "screens": {
        "data": [
            {
                "devicePixelRatio": 2,
                "dpi": 94,
                "height": 800,
                "width": 1280
            },
            {
                "devicePixelRatio": 2,
                "dpi": 99,
                "height": 1152,
                "width": 2048
            }
        ],
        "description": "Розмір і роздільна здатність усіх з’єднаних із комп’ютером дисплеїв.",
        "telemetryMode": "DetailedSystemInformation"
    },
```

While `kscreen-doctor -o | grep -E 'Output|Geometry|Scale'` provides correct information:
```
Output: 1 eDP-1
        Geometry: 384,1152 1280x800
        Scale: 2
Output: 2 DP-3
        Geometry: 0,0 2048x1152
        Scale: 1.25
```
Unfortunately it doesn't say anything about DPI, checked another:
```
$ kscreen-console outputs | grep -E '(Name|Size|Scale):'

        maxSize: QSize(64000, 64000)
        minSize: QSize(0, 0)
        currentSize: QSize(2048, 1952)
Name:  "eDP-1"
MMSize:  QSize(345, 215)
Size:  QSize(2560, 1600)
Scale:  2
        Name:  ""
Name:  "DP-3"
MMSize:  QSize(527, 296)
Size:  QSize(2560, 1440)
Scale:  1.25
        Name:  "PHL 245E1"
```
So 94 = round(2560/345*25.4/2)
99 = round(2560/527*25.4/1.25)
where
 2560 — physical size of a screen (both),
 345 & 527 — size in mm
 25.4 — mm per inch
 2 & 1.25 — real scale set for screen.

STEPS TO REPRODUCE
1. Setup two screens, one with fractional scaling 1.25, other with scaling 2.
2. Check sent kuserfeedback data.

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
devicePixelRatio is set to 2 for both screens, which is misleading. Also DPI is recalculated relative to real scaling (unsure if that's intentional).
Comment 1 Nate Graham 2025-05-20 18:05:17 UTC
I wonder if it's rounding up, maybe?
Comment 2 Volker Krause 2025-05-21 15:25:25 UTC
(In reply to Nate Graham from comment #1)
> I wonder if it's rounding up, maybe?

Not on our side at least: https://invent.kde.org/frameworks/kuserfeedback/-/blob/master/src/provider/core/screeninfosource.cpp#L33 - not sure what exactly QScreen does internally though.
Comment 3 Mykola Krachkovsky 2025-05-21 16:41:11 UTC
Hmm, it seems QScreen::devicePixelRation in the ends calls to QWaylandScreen::devicePixelRatio:
https://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/platforms/wayland/qwaylandscreen.cpp#n193

Which returns Wayland output *integral* scaling.

And true fractional scaling in unknown on output level (not sure about this) until there is surface and there is ask for fractional scale:
https://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/platforms/wayland/qwaylandwindow.cpp#n240
Comment 4 Zamundaaa 2025-05-23 15:31:37 UTC
Yeah, using QScreen to get the display scale won't get you the correct values.