From 1cdd74c967696fd49324a3a60b4372ed8789127e Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sat, 9 Nov 2024 19:21:41 +0000 Subject: [PATCH] fixes but kernel dies again :( --- src/allocator/DRMDumb.cpp | 10 +++++++--- src/backend/drm/DRM.cpp | 3 +-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/allocator/DRMDumb.cpp b/src/allocator/DRMDumb.cpp index e93c9aa..4d812f8 100644 --- a/src/allocator/DRMDumb.cpp +++ b/src/allocator/DRMDumb.cpp @@ -64,15 +64,19 @@ Aquamarine::CDRMDumbBuffer::CDRMDumbBuffer(const SAllocatorBufferParams& params, return; } - // null the entire buffer so we dont get garbage - memset(data, 0x00, size); + // set the entire buffer so we dont get garbage + memset(data, 0xFF, size); attrs.success = true; + + allocator->backend->log(AQ_LOG_DEBUG, std::format("DRM Dumb: Allocated a new buffer with drm id {}, size {} and format {}", idrmID, attrs.size, fourccToName(attrs.format))); } Aquamarine::CDRMDumbBuffer::~CDRMDumbBuffer() { events.destroy.emit(); + TRACE(allocator->backend->log(AQ_LOG_TRACE, std::format("DRM Dumb: dropping buffer {}", idrmID))); + if (handle == 0) return; @@ -121,7 +125,7 @@ void Aquamarine::CDRMDumbBuffer::endDataPtr() { } uint32_t Aquamarine::CDRMDumbBuffer::drmID() { - return handle; + return idrmID; } Aquamarine::CDRMDumbAllocator::~CDRMDumbAllocator() { diff --git a/src/backend/drm/DRM.cpp b/src/backend/drm/DRM.cpp index 3032c8a..1a0916a 100644 --- a/src/backend/drm/DRM.cpp +++ b/src/backend/drm/DRM.cpp @@ -1863,7 +1863,6 @@ void Aquamarine::CDRMFB::import() { TRACE(backend->backend->log(AQ_LOG_TRACE, std::format("drm: new buffer {}", id))); - // FIXME: why does this implode when it doesnt on wlroots or kwin? closeHandles(); listeners.destroyBuffer = buffer->events.destroy.registerListener([this](std::any d) { @@ -1922,7 +1921,7 @@ void Aquamarine::CDRMFB::drop() { dropped = true; - if (!id) + if (!id || buffer->drmID() /* drmID means the buffer manages itself */) return; closeHandles();