https://bugs.kde.org/show_bug.cgi?id=400921
--- Comment #1 from gryz...@outlook.com --- After figuring out where to find the code for spectacle, I did some more experiments and could pinpoint the issue better. First of all, by running `spectacle` from the command line, I could see the following output in the terminal: > qt.qpa.xcb: QXcbConnection: XCB error: 11 (BadAlloc), sequence: 922, resource > id: 94371870, major code: 149 (Unknown), minor code: 2 > qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 923, > resource id: 94371879, major code: 149 (Unknown), minor code: 4 > qt.qpa.xcb: QXcbConnection: XCB error: 4 (BadPixmap), sequence: 925, resource > id: 94371879, major code: 148 (Unknown), minor code: 1 > qt.qpa.xcb: QXcbConnection: XCB error: 11 (BadAlloc), sequence: 926, resource > id: 94371870, major code: 149 (Unknown), minor code: 2 > qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 927, > resource id: 94371881, major code: 149 (Unknown), minor code: 4 > qt.qpa.xcb: QXcbConnection: XCB error: 4 (BadPixmap), sequence: 928, resource > id: 94371881, major code: 148 (Unknown), minor code: 1 This hints towards an allocation issue. After a fun little printf (and qDebug) session I was able to isolate this call to setGeometry[1] in the QuickEditor: - If I divide the width and height by 2, rectangular selection works but is displayed on 1/4 of the screen - If I also remove the division by the devicePixelRatio in the QML, rectangular selection works (but presumably with a downscaling followed by an upscaling, which is not optimal) After some more experimenting, it turns out that there is a cut-off when width * height becomes larger than 4Mpx (my screen resolution is 2880 x 1800 = 4.9Mpx): if less, the UI shows up[2], if more, the screen goes black and the above error messages gets printed. It definitely looks like *something* prevents allocating more than 4Mpx... but somehow it doesn't happen when scaling is set to 1? I also checked on another computer, and Spectacle works fine, even with a screen scaling factor of 4! Some more fiddling later (at this point I discovered I could set the QT_SCREEN_SCALE_FACTORS variable instead of logging out/logging in to my session, which made further experiments faster), I realized that if I keep scaling to 1 the problem does manifest itself, but the limit is now at 16Mpx instead of 4Mpx. This corresponds to a (fake) resolution of 4096x4096. This is weird, because the value passed in there is always 2880x1800 no matter what scaling factor I use, so it should already be the native resolution; no more scaling should occur. Finally, trying with 8192x8192 yield the following interesting error: > i965: Failed to submit batchbuffer: No space left on device which gives the source of the limit: the GPU driver! Indeed, xrandr reports a maximum of 8192x8192 on my MacBook, and 32767x32767 on my other laptop. After reading some more documentation on Qt HiDPI (https://doc.qt.io/qt-5/highdpi.html) it looks like: - Spectacle is taking a high DPI (native resolution) capture of the screen, then displaying it at low DPI (scaled resolution), which results in a buffer four time as big as it would need to - My graphics card driver doesn't like the point above :) - Doing `d->mQuickView->setGeometry(0, 0, pixmap.width() / devicePixelRatio, pixmap.height() / devicePixelRatio)` and removing the `Screen.devicePixelRatio` divisions in the QML actually does the right thing (i.e. the final buffer allocated on the device is the size of the screen) and does not suffer from downscaling-then-upscaling - In the multi-monitor case, there is not always a single devicePixelRatio! Given the above, it looks like the solutions are either to use a larger amount of memory than needed or properly display the rectangle selection UI across multiple screens (which I don't know if Spectacle currently does). Anyways, I think I reached the limits of what I could do, I hope this is helpful. I am willing to make a patch, but it is not clear to me what exactly said patch should do :) [1] https://cgit.kde.org/spectacle.git/tree/src/QuickEditor/QuickEditor.cpp?id=e00391c1b1f4a119a3e737a96da9057a70ae3339#n94 [2] Potentially at the wrong scale -- You are receiving this mail because: You are watching all bug changes.