mirror of
https://github.com/hyprwm/aquamarine.git
synced 2024-11-17 04:56:00 +01:00
drm: conform to both renderable and scanoutable formats in scanout buffers
fixes #28
This commit is contained in:
parent
744a383a52
commit
353dc1b729
2 changed files with 18 additions and 4 deletions
|
@ -68,9 +68,8 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti
|
||||||
std::format("GBM: Allocating a buffer: size {}, format {}, cursor: {}, multigpu: {}, scanout: {}", attrs.size, fourccToName(attrs.format), CURSOR,
|
std::format("GBM: Allocating a buffer: size {}, format {}, cursor: {}, multigpu: {}, scanout: {}", attrs.size, fourccToName(attrs.format), CURSOR,
|
||||||
MULTIGPU, params.scanout)));
|
MULTIGPU, params.scanout)));
|
||||||
|
|
||||||
const auto FORMATS = CURSOR ?
|
const auto FORMATS = CURSOR ? swapchain->backendImpl->getCursorFormats() : swapchain->backendImpl->getRenderFormats();
|
||||||
swapchain->backendImpl->getCursorFormats() :
|
const auto RENDERABLE = swapchain->backendImpl->getRenderableFormats();
|
||||||
(swapchain->backendImpl->getRenderableFormats().size() == 0 ? swapchain->backendImpl->getRenderFormats() : swapchain->backendImpl->getRenderableFormats());
|
|
||||||
|
|
||||||
std::vector<uint64_t> explicitModifiers;
|
std::vector<uint64_t> explicitModifiers;
|
||||||
|
|
||||||
|
@ -95,6 +94,21 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti
|
||||||
if (m == DRM_FORMAT_MOD_INVALID)
|
if (m == DRM_FORMAT_MOD_INVALID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!RENDERABLE.empty() && params.scanout && !CURSOR && !MULTIGPU) {
|
||||||
|
// regular scanout plane, check if the format is renderable
|
||||||
|
auto rformat = std::find_if(RENDERABLE.begin(), RENDERABLE.end(), [f](const auto& e) { return e.drmFormat == f.drmFormat; });
|
||||||
|
|
||||||
|
if (rformat == RENDERABLE.end()) {
|
||||||
|
TRACE(allocator->backend->log(AQ_LOG_TRACE, std::format("GBM: Dropping format {} as it's not renderable", fourccToName(f.drmFormat))));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (std::find(rformat->modifiers.begin(), rformat->modifiers.end(), m) == rformat->modifiers.end()) {
|
||||||
|
TRACE(allocator->backend->log(AQ_LOG_TRACE, std::format("GBM: Dropping modifier 0x{:x} as it's not renderable", m)));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
explicitModifiers.push_back(m);
|
explicitModifiers.push_back(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue