gbm: guard for drm renderer being present before clearing

ref #56
This commit is contained in:
Vaxry 2024-08-19 18:26:21 +02:00
parent 71da3e00a0
commit 696a5ad4ec
3 changed files with 4 additions and 3 deletions

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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.");