mirror of
https://github.com/hyprwm/aquamarine.git
synced 2024-12-22 11:39:49 +01:00
gbm/drm: conform to different scanout requirements for different planes
ref https://github.com/hyprwm/Hyprland/issues/7005
This commit is contained in:
parent
b9ab839ab3
commit
865cd94f97
3 changed files with 13 additions and 5 deletions
|
@ -5,12 +5,14 @@
|
||||||
namespace Aquamarine {
|
namespace Aquamarine {
|
||||||
|
|
||||||
class IBackendImplementation;
|
class IBackendImplementation;
|
||||||
|
class IOutput;
|
||||||
|
|
||||||
struct SSwapchainOptions {
|
struct SSwapchainOptions {
|
||||||
size_t length = 0;
|
size_t length = 0;
|
||||||
Hyprutils::Math::Vector2D size;
|
Hyprutils::Math::Vector2D size;
|
||||||
uint32_t format = DRM_FORMAT_INVALID; // if you leave this on invalid, the swapchain will choose an appropriate format (and modifier) for you.
|
uint32_t format = DRM_FORMAT_INVALID; // if you leave this on invalid, the swapchain will choose an appropriate format (and modifier) for you.
|
||||||
bool scanout = false, cursor = false /* requires scanout = true */, multigpu = false /* if true, will force linear */;
|
bool scanout = false, cursor = false /* requires scanout = true */, multigpu = false /* if true, will force linear */;
|
||||||
|
Hyprutils::Memory::CWeakPointer<IOutput> scanoutOutput;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CSwapchain {
|
class CSwapchain {
|
||||||
|
|
|
@ -72,14 +72,20 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti
|
||||||
attrs.format = params.format;
|
attrs.format = params.format;
|
||||||
size = attrs.size;
|
size = attrs.size;
|
||||||
|
|
||||||
const bool CURSOR = params.cursor && params.scanout;
|
const bool CURSOR = params.cursor && params.scanout;
|
||||||
const bool MULTIGPU = params.multigpu && params.scanout;
|
const bool MULTIGPU = params.multigpu && params.scanout;
|
||||||
|
const bool EXPLICIT_SCANOUT = params.scanout && swapchain->currentOptions().scanoutOutput;
|
||||||
|
|
||||||
TRACE(allocator->backend->log(AQ_LOG_TRACE,
|
TRACE(allocator->backend->log(AQ_LOG_TRACE,
|
||||||
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();
|
if (EXPLICIT_SCANOUT)
|
||||||
|
TRACE(allocator->backend->log(
|
||||||
|
AQ_LOG_TRACE, std::format("GBM: Explicit scanout output, output has {} explicit formats", swapchain->currentOptions().scanoutOutput->getRenderFormats().size())));
|
||||||
|
|
||||||
|
const auto FORMATS = CURSOR ? swapchain->backendImpl->getCursorFormats() :
|
||||||
|
(EXPLICIT_SCANOUT ? swapchain->currentOptions().scanoutOutput->getRenderFormats() : 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())));
|
TRACE(allocator->backend->log(AQ_LOG_TRACE, std::format("GBM: Available formats: {}", FORMATS.size())));
|
||||||
|
|
|
@ -881,7 +881,7 @@ void Aquamarine::CDRMBackend::onReady() {
|
||||||
|
|
||||||
// swapchain has to be created here because allocator is absent in connect if not ready
|
// swapchain has to be created here because allocator is absent in connect if not ready
|
||||||
c->output->swapchain = CSwapchain::create(backend->primaryAllocator, self.lock());
|
c->output->swapchain = CSwapchain::create(backend->primaryAllocator, self.lock());
|
||||||
c->output->swapchain->reconfigure(SSwapchainOptions{.length = 0, .scanout = true, .multigpu = !!primary}); // mark the swapchain for scanout
|
c->output->swapchain->reconfigure(SSwapchainOptions{.length = 0, .scanout = true, .multigpu = !!primary, .scanoutOutput = c->output}); // mark the swapchain for scanout
|
||||||
c->output->needsFrame = true;
|
c->output->needsFrame = true;
|
||||||
|
|
||||||
backend->events.newOutput.emit(SP<IOutput>(c->output));
|
backend->events.newOutput.emit(SP<IOutput>(c->output));
|
||||||
|
@ -1283,7 +1283,7 @@ void Aquamarine::SDRMConnector::connect(drmModeConnector* connector) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
output->swapchain = CSwapchain::create(backend->backend->primaryAllocator, backend->self.lock());
|
output->swapchain = CSwapchain::create(backend->backend->primaryAllocator, backend->self.lock());
|
||||||
output->swapchain->reconfigure(SSwapchainOptions{.length = 0, .scanout = true, .multigpu = !!backend->primary}); // mark the swapchain for scanout
|
output->swapchain->reconfigure(SSwapchainOptions{.length = 0, .scanout = true, .multigpu = !!backend->primary, .scanoutOutput = output}); // mark the swapchain for scanout
|
||||||
output->needsFrame = true;
|
output->needsFrame = true;
|
||||||
backend->backend->events.newOutput.emit(SP<IOutput>(output));
|
backend->backend->events.newOutput.emit(SP<IOutput>(output));
|
||||||
output->scheduleFrame(IOutput::AQ_SCHEDULE_NEW_CONNECTOR);
|
output->scheduleFrame(IOutput::AQ_SCHEDULE_NEW_CONNECTOR);
|
||||||
|
|
Loading…
Reference in a new issue