wayland/screencopy: reset buffer requests between frames

Prevents buffer requests from collecting a huge set of duplicate
dmabuf and shm formats.
This commit is contained in:
outfoxxed 2025-07-26 00:09:28 -07:00
parent 448623de5a
commit ab096b7e78
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
4 changed files with 10 additions and 1 deletions

View file

@ -22,6 +22,8 @@ namespace {
QS_LOGGING_CATEGORY(logBuffer, "quickshell.wayland.buffer", QtWarningMsg);
}
void WlBufferRequest::reset() { *this = WlBufferRequest(); }
WlBuffer* WlBufferSwapchain::createBackbuffer(const WlBufferRequest& request, bool* newBuffer) {
auto& buffer = this->presentSecondBuffer ? this->buffer1 : this->buffer2;
@ -53,7 +55,8 @@ bool WlBufferManager::isReady() const { return this->p->mReady; }
<< " (disabled: " << dmabufDisabled << ')';
for (const auto& [format, modifiers]: request.dmabuf.formats) {
qCDebug(logBuffer) << " Format" << dmabuf::FourCCStr(format);
qCDebug(logBuffer).nospace() << " Format " << dmabuf::FourCCStr(format)
<< (modifiers.length() == 0 ? " (No modifiers specified)" : "");
for (const auto& modifier: modifiers) {
qCDebug(logBuffer) << " Explicit Modifier" << dmabuf::FourCCModStr(modifier);

View file

@ -68,6 +68,8 @@ struct WlBufferRequest {
dev_t device = 0;
StackList<DmaFormat, 1> formats;
} dmabuf;
void reset();
};
class WlBuffer {

View file

@ -64,6 +64,8 @@ void HyprlandScreencopyContext::onToplevelDestroyed() {
void HyprlandScreencopyContext::captureFrame() {
if (this->object()) return;
this->request.reset();
this->init(this->manager->capture_toplevel_with_wlr_toplevel_handle(
this->paintCursors ? 1 : 0,
this->handle->object()

View file

@ -65,6 +65,8 @@ void WlrScreencopyContext::onScreenDestroyed() {
void WlrScreencopyContext::captureFrame() {
if (this->object()) return;
this->request.reset();
if (this->region.isEmpty()) {
this->init(manager->capture_output(this->paintCursors ? 1 : 0, screen->output()));
} else {