mirror of
https://github.com/hyprwm/aquamarine.git
synced 2024-11-17 01:25:59 +01:00
gbm: improve trace logging around allocs
This commit is contained in:
parent
8079098326
commit
1e43d9a719
1 changed files with 27 additions and 21 deletions
|
@ -70,8 +70,10 @@ 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 ? swapchain->backendImpl->getCursorFormats() : swapchain->backendImpl->getRenderFormats();
|
const auto FORMATS = CURSOR ? swapchain->backendImpl->getCursorFormats() : swapchain->backendImpl->getRenderFormats();
|
||||||
const auto RENDERABLE = swapchain->backendImpl->getRenderableFormats();
|
const auto RENDERABLE = swapchain->backendImpl->getRenderableFormats();
|
||||||
|
|
||||||
|
TRACE(allocator->backend->log(AQ_LOG_TRACE, std::format("GBM: Available formats: {}", FORMATS.size())));
|
||||||
|
|
||||||
std::vector<uint64_t> explicitModifiers;
|
std::vector<uint64_t> explicitModifiers;
|
||||||
|
|
||||||
|
@ -88,30 +90,34 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti
|
||||||
|
|
||||||
// check if we can use modifiers. If the requested support has any explicit modifier
|
// check if we can use modifiers. If the requested support has any explicit modifier
|
||||||
// supported by the primary backend, we can.
|
// supported by the primary backend, we can.
|
||||||
for (auto& f : FORMATS) {
|
if (!RENDERABLE.empty()) {
|
||||||
if (f.drmFormat != attrs.format)
|
TRACE(allocator->backend->log(AQ_LOG_TRACE, std::format("GBM: Renderable has {} formats, clipping", RENDERABLE.size())));
|
||||||
continue;
|
|
||||||
|
|
||||||
for (auto& m : f.modifiers) {
|
for (auto& f : FORMATS) {
|
||||||
if (m == DRM_FORMAT_MOD_INVALID)
|
if (f.drmFormat != attrs.format)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!RENDERABLE.empty() && params.scanout && !CURSOR && !MULTIGPU) {
|
for (auto& m : f.modifiers) {
|
||||||
// regular scanout plane, check if the format is renderable
|
if (m == DRM_FORMAT_MOD_INVALID)
|
||||||
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;
|
continue;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
explicitModifiers.push_back(m);
|
if (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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue