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 committed 2025-07-26 00:45:31 -07:00
1 parent 448623de5a
commit ab096b7e78
4 files changed
+10 -1

No files matched your search

+4 -1
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);
+2
View File
@@ -68,6 +68,8 @@ struct WlBufferRequest {
dev_t device = 0;
StackList<DmaFormat, 1> formats;
} dmabuf;
void reset();
};
class WlBuffer {
@@ -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()
@@ -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 {