Skip to content

Commit

Permalink
fixes but kernel dies again :(
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Nov 9, 2024
1 parent cac883a commit 1cdd74c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/allocator/DRMDumb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -121,7 +125,7 @@ void Aquamarine::CDRMDumbBuffer::endDataPtr() {
}

uint32_t Aquamarine::CDRMDumbBuffer::drmID() {
return handle;
return idrmID;
}

Aquamarine::CDRMDumbAllocator::~CDRMDumbAllocator() {
Expand Down
3 changes: 1 addition & 2 deletions src/backend/drm/DRM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -1922,7 +1921,7 @@ void Aquamarine::CDRMFB::drop() {

dropped = true;

if (!id)
if (!id || buffer->drmID() /* drmID means the buffer manages itself */)
return;

closeHandles();
Expand Down

0 comments on commit 1cdd74c

Please sign in to comment.