diff options
| author | UjinT34 <41110182+UjinT34@users.noreply.github.com> | 2026-03-07 16:13:34 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-07 13:13:34 +0000 |
| commit | 966f20d305345b3042dc1d37a1dd8833f3a4783b (patch) | |
| tree | 3e8515b7a0f6fde7bf3137aac7124ae90e5951ec /src/helpers/Monitor.cpp | |
| parent | 32e75e3e320fb66ab517a378df645f3d29b3a209 (diff) | |
renderer: refactor resources and flags (#13471)
Diffstat (limited to 'src/helpers/Monitor.cpp')
| -rw-r--r-- | src/helpers/Monitor.cpp | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index 07156ff1..ad1439a1 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -71,8 +71,8 @@ CMonitor::CMonitor(SP<Aquamarine::IOutput> output_) : m_state(this), m_output(ou CMonitor::~CMonitor() { m_events.destroy.emit(); - if (g_pHyprOpenGL) - g_pHyprOpenGL->destroyMonitorResources(m_self); + if (g_pHyprRenderer && g_pHyprRenderer->glBackend()) + g_pHyprRenderer->glBackend()->destroyMonitorResources(m_self); } void CMonitor::onConnect(bool noRule) { @@ -380,8 +380,8 @@ void CMonitor::onDisconnect(bool destroy) { Log::logger->log(Log::DEBUG, "onDisconnect called for {}", m_output->name); m_events.disconnect.emit(); - if (g_pHyprOpenGL) - g_pHyprOpenGL->destroyMonitorResources(m_self); + if (g_pHyprRenderer && g_pHyprRenderer->glBackend()) + g_pHyprRenderer->glBackend()->destroyMonitorResources(m_self); // record what workspace this monitor was on if (m_activeWorkspace) { @@ -1047,8 +1047,17 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) { updateMatrix(); - if (WAS10B != m_enabled10bit || OLDRES != m_pixelSize) - g_pHyprOpenGL->destroyMonitorResources(m_self); + if ((WAS10B != m_enabled10bit || OLDRES != m_pixelSize)) { + m_mirrorFB.reset(); + m_offloadFB.reset(); + m_mirrorSwapFB.reset(); + m_blurFB.reset(); + m_offMainFB.reset(); + m_stencilTex.reset(); + + if (g_pHyprRenderer && g_pHyprRenderer->glBackend()) + g_pHyprRenderer->glBackend()->destroyMonitorResources(m_self); + } g_pCompositor->scheduleMonitorStateRecheck(); @@ -1965,7 +1974,7 @@ bool CMonitor::attemptDirectScanout() { m_output->state->addDamage(PSURFACE->m_current.accumulateBufferDamage()); // multigpu needs a fence to trigger fence syncing blits and also committing with the recreated dgpu fence - if (!DRM::sameGpu(m_output->getBackend()->preferredAllocator()->drmFD(), g_pCompositor->m_drm.fd) && g_pHyprOpenGL->explicitSyncSupported()) { + if (!DRM::sameGpu(m_output->getBackend()->preferredAllocator()->drmFD(), g_pCompositor->m_drm.fd) && g_pHyprRenderer->explicitSyncSupported()) { auto sync = CEGLSync::create(); if (sync->fd().isValid()) { @@ -2196,6 +2205,19 @@ NColorManagement::SImageDescription::SPCMasteringLuminances CMonitor::getMasteri }; } +uint32_t CMonitor::getPreferredReadFormat() { + static const auto PFORCE8BIT = CConfigValue<Hyprlang::INT>("misc:screencopy_force_8b"); + + auto monFmt = m_output->state->state().drmFormat; + + if (*PFORCE8BIT) + if (monFmt == DRM_FORMAT_BGRA1010102 || monFmt == DRM_FORMAT_ARGB2101010 || monFmt == DRM_FORMAT_XRGB2101010 || monFmt == DRM_FORMAT_BGRX1010102 || + monFmt == DRM_FORMAT_XBGR2101010) + monFmt = DRM_FORMAT_XRGB8888; + + return monFmt; +} + bool CMonitor::needsCM() { const auto SRC_DESC = getFSImageDescription(); return SRC_DESC.has_value() && SRC_DESC.value() != m_imageDescription; |
