mirror of
https://github.com/hyprwm/aquamarine.git
synced 2024-12-22 20:39:49 +01:00
drm: allow multigpu blit from explicit to implicit (#114)
This commit is contained in:
parent
1af9816244
commit
9fc2d8e1fb
3 changed files with 8 additions and 11 deletions
|
@ -103,12 +103,14 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool foundFormat = false;
|
||||||
// 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 const& f : FORMATS) {
|
for (auto const& f : FORMATS) {
|
||||||
if (f.drmFormat != attrs.format)
|
if (f.drmFormat != attrs.format)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
foundFormat = true;
|
||||||
for (auto const& m : f.modifiers) {
|
for (auto const& m : f.modifiers) {
|
||||||
if (m == DRM_FORMAT_MOD_INVALID)
|
if (m == DRM_FORMAT_MOD_INVALID)
|
||||||
continue;
|
continue;
|
||||||
|
@ -134,17 +136,17 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!foundFormat) {
|
||||||
|
allocator->backend->log(AQ_LOG_ERROR, std::format("GBM: Failed to allocate a GBM buffer: format {} isn't supported by primary backend", fourccToName(attrs.format)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: Nvidia cannot render to linear buffers. What do?
|
// FIXME: Nvidia cannot render to linear buffers. What do?
|
||||||
if (MULTIGPU) {
|
if (MULTIGPU) {
|
||||||
allocator->backend->log(AQ_LOG_DEBUG, "GBM: Buffer is marked as multigpu, forcing linear");
|
allocator->backend->log(AQ_LOG_DEBUG, "GBM: Buffer is marked as multigpu, forcing linear");
|
||||||
explicitModifiers = {DRM_FORMAT_MOD_LINEAR};
|
explicitModifiers = {DRM_FORMAT_MOD_LINEAR};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (explicitModifiers.empty()) {
|
|
||||||
// fall back to using a linear buffer.
|
|
||||||
explicitModifiers.push_back(DRM_FORMAT_MOD_LINEAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t flags = GBM_BO_USE_RENDERING;
|
uint32_t flags = GBM_BO_USE_RENDERING;
|
||||||
if (params.scanout)
|
if (params.scanout)
|
||||||
flags |= GBM_BO_USE_SCANOUT;
|
flags |= GBM_BO_USE_SCANOUT;
|
||||||
|
|
|
@ -527,7 +527,7 @@ void Aquamarine::CDRMBackend::buildGlFormats(const std::vector<SGLFormat>& fmts)
|
||||||
std::vector<SDRMFormat> result;
|
std::vector<SDRMFormat> result;
|
||||||
|
|
||||||
for (auto const& fmt : fmts) {
|
for (auto const& fmt : fmts) {
|
||||||
if (fmt.external)
|
if (fmt.external && fmt.modifier != DRM_FORMAT_MOD_INVALID)
|
||||||
continue;
|
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()) {
|
||||||
|
|
|
@ -809,11 +809,6 @@ bool CDRMRenderer::verifyDestinationDMABUF(const SDMABUFAttrs& attrs) {
|
||||||
if (fmt.modifier != attrs.modifier)
|
if (fmt.modifier != attrs.modifier)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (fmt.external) {
|
|
||||||
backend->log(AQ_LOG_ERROR, "EGL (verifyDestinationDMABUF): FAIL, format is external-only");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue