Skip to content

Commit

Permalink
gbm: guard for drm renderer being present before clearing
Browse files Browse the repository at this point in the history
ref #56
  • Loading branch information
vaxerski committed Aug 19, 2024
1 parent 71da3e0 commit 696a5ad
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/aquamarine/backend/DRM.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ namespace Aquamarine {

struct {
Hyprutils::Memory::CSharedPointer<IAllocator> allocator;
Hyprutils::Memory::CSharedPointer<CDRMRenderer> renderer;
Hyprutils::Memory::CSharedPointer<CDRMRenderer> renderer; // may be null if creation fails
} rendererState;

Hyprutils::Memory::CWeakPointer<CBackend> backend;
Expand Down
3 changes: 2 additions & 1 deletion src/allocator/GBM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti
if (params.scanout && swapchain->backendImpl->type() == AQ_BACKEND_DRM) {
// clear the buffer using the DRM renderer to avoid uninitialized mem
auto impl = (CDRMBackend*)swapchain->backendImpl.get();
impl->rendererState.renderer->clearBuffer(this);
if (impl->rendererState.renderer)
impl->rendererState.renderer->clearBuffer(this);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/backend/drm/DRM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void Aquamarine::CDRMBackend::restoreAfterVT() {
};

auto& STATE = c->output->state->state();
auto& MODE = STATE.customMode ? STATE.customMode : STATE.mode;
auto& MODE = STATE.customMode ? STATE.customMode : STATE.mode;

if (!MODE) {
backend->log(AQ_LOG_WARNING, "drm: Connector {} has output but state has no mode, will send a reset state event later.");
Expand Down

0 comments on commit 696a5ad

Please sign in to comment.