mirror of
https://github.com/hyprwm/aquamarine.git
synced 2024-11-17 00:15:59 +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,
|
||||
MULTIGPU, params.scanout)));
|
||||
|
||||
const auto FORMATS = CURSOR ?
|
||||
swapchain->backendImpl->getCursorFormats() :
|
||||
(swapchain->backendImpl->getRenderableFormats().size() == 0 ? swapchain->backendImpl->getRenderFormats() : swapchain->backendImpl->getRenderableFormats());
|
||||
const auto FORMATS = CURSOR ? swapchain->backendImpl->getCursorFormats() : swapchain->backendImpl->getRenderFormats();
|
||||
const auto RENDERABLE = swapchain->backendImpl->getRenderableFormats();
|
||||
|
||||
std::vector<uint64_t> explicitModifiers;
|
||||
|
||||
|
@ -95,6 +94,21 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti
|
|||
if (m == DRM_FORMAT_MOD_INVALID)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -507,7 +507,7 @@ void Aquamarine::CDRMBackend::buildGlFormats(const std::vector<SGLFormat>& fmts)
|
|||
if (fmt.external)
|
||||
continue;
|
||||
|
||||
if (auto it = std::find_if(result.begin(), result.end(), [fmt] (const auto& e) { return fmt.drmFormat == e.drmFormat; }); it != result.end()) {
|
||||
if (auto it = std::find_if(result.begin(), result.end(), [fmt](const auto& e) { return fmt.drmFormat == e.drmFormat; }); it != result.end()) {
|
||||
it->modifiers.emplace_back(fmt.modifier);
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue