summaryrefslogtreecommitdiff
path: root/src/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'src/helpers')
-rw-r--r--src/helpers/Monitor.cpp15
-rw-r--r--src/helpers/Monitor.hpp3
2 files changed, 17 insertions, 1 deletions
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp
index 685009fd..5b01d651 100644
--- a/src/helpers/Monitor.cpp
+++ b/src/helpers/Monitor.cpp
@@ -832,6 +832,21 @@ bool CMonitor::attemptDirectScanout() {
// FIXME: make sure the buffer actually follows the available scanout dmabuf formats
// and comes from the appropriate device. This may implode on multi-gpu!!
+
+ const auto params = PSURFACE->current.buffer->buffer->dmabuf();
+ // scanout buffer isn't dmabuf, so no scanout
+ if (!params.success)
+ return false;
+
+ // entering into scanout, so save monitor format
+ if (lastScanout.expired())
+ prevDrmFormat = drmFormat;
+
+ if (drmFormat != params.format) {
+ output->state->setFormat(params.format);
+ drmFormat = params.format;
+ }
+
output->state->setBuffer(PSURFACE->current.buffer->buffer.lock());
output->state->setPresentationMode(tearingState.activelyTearing ? Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_IMMEDIATE :
Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_VSYNC);
diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp
index 01a5d28d..203cac90 100644
--- a/src/helpers/Monitor.hpp
+++ b/src/helpers/Monitor.hpp
@@ -100,7 +100,8 @@ class CMonitor {
std::optional<Vector2D> forceSize;
SP<Aquamarine::SOutputMode> currentMode;
SP<Aquamarine::CSwapchain> cursorSwapchain;
- uint32_t drmFormat = DRM_FORMAT_INVALID;
+ uint32_t drmFormat = DRM_FORMAT_INVALID;
+ uint32_t prevDrmFormat = DRM_FORMAT_INVALID;
bool dpmsStatus = true;
bool vrrActive = false; // this can be TRUE even if VRR is not active in the case that this display does not support it.