Bug 481665 - Preview of rectangular region screenshot in main window is sometimes all black
Summary: Preview of rectangular region screenshot in main window is sometimes all black
Status: RESOLVED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (other bugs)
Version First Reported In: unspecified
Platform: Neon Linux
: NOR major
Target Milestone: ---
Assignee: Noah Davis
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2024-02-22 10:43 UTC by Gilberto Ferreira
Modified: 2024-03-04 14:54 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gilberto Ferreira 2024-02-22 10:43:54 UTC
SUMMARY
Spectacle gives me a black screenshot after take screenshot from retangular region.
Even with Wayland the problem occur.

STEPS TO REPRODUCE
1. Open Spectacle
2. Take a screenshot from part of the desktop
3. Black screenshot

OBSERVED RESULT
Black Screenshot

EXPECTED RESULT
Expect get a screenshot like before.

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 6.0.80
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.7.5-x64v4-xanmod1 (64-bit)
Graphics Platform: X11
Processors: 4 × AMD A12-9720P RADEON R7, 12 COMPUTE CORES 4C+8G
Memory: 15.1 GiB of RAM
Graphics Processor: AMD Radeon R7 Graphics
Manufacturer: Acer
Product Name: Aspire A515-41G
System Version: V1.09
Comment 1 Nate Graham 2024-02-22 17:30:06 UTC
I've seen this a few times over the past couple of days as well. The actual screenshot is fine; it's just the preview in the main window that's all black.

I haven't figured out how to consistently reproduce it, though.
Comment 2 Noah Davis 2024-02-28 22:44:22 UTC
I've seen it for the first time just now, but I'm still trying to figure out why it happens. It seems like the black image only happens when the capture window on my right monitor has active window focus. It doesn't even matter whether the selected region is on the left or right, it's just the active window focus that seems to make the difference. Very strange.
Comment 3 Noah Davis 2024-02-28 22:51:20 UTC
I also checked the scene graph node textures in GammaRay. I can see that the screenshot and annotations are captured and rendered correctly in the texture even when the item that's supposed to display them is black.
Comment 4 Bug Janitor Service 2024-03-04 14:52:06 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/spectacle/-/merge_requests/337
Comment 5 Noah Davis 2024-03-04 14:54:14 UTC
Git commit c03141f6cf5919cc670f1833589c1d54d7405d44 by Noah Davis.
Committed on 04/03/2024 at 14:51.
Pushed by ndavis into branch 'master'.

AnnotationViewport: Don't use TextureCanUseAtlas

It was the wrong thing to use with these textures and was likely causing the GPU to run out of memory. That caused the textures to sometimes render all black despite being perfectly fine internally.

TextureCanUseAtlas is best used with lots of small static images. Atlas texture sizes are padded to powers of two, so adding a large image to the atlas makes the atlas use up far more space than necessary. We also use mipmaps with the screenshot textures, so that uses up even more GPU memory with the already massive atlas texture.

I also removed the explicit TextureHasAlphaChannel option because it was redundant.

M  +2    -4    src/Gui/Annotations/AnnotationViewport.cpp

https://invent.kde.org/graphics/spectacle/-/commit/c03141f6cf5919cc670f1833589c1d54d7405d44