Skip to content

Commit

Permalink
renderer: disable explicit if aquamarine output doesn't support it (h…
Browse files Browse the repository at this point in the history
…yprwm#9396) (hyprwm#9398)

The explicit settings ignore the aquamarine output.supportsExplicit
attribute, which creates glitches on drivers not supporting explicit
sync (example: freedreno).

If the output has been set as not supporting explicit, disable the
explicit settings.
  • Loading branch information
aruhier authored and andrewandreii committed Feb 15, 2025
1 parent fe57acd commit 9c8a04f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/helpers/Monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,7 @@ bool CMonitor::attemptDirectScanout() {
return false;
}

auto explicitOptions = g_pHyprRenderer->getExplicitSyncSettings();
auto explicitOptions = g_pHyprRenderer->getExplicitSyncSettings(output);

// wait for the explicit fence if present, and if kms explicit is allowed
bool DOEXPLICIT = PSURFACE->syncobj && PSURFACE->syncobj->current.acquireTimeline && PSURFACE->syncobj->current.acquireTimeline->timeline && explicitOptions.explicitKMSEnabled;
Expand Down
14 changes: 11 additions & 3 deletions src/render/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,7 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
}
}

auto explicitOptions = getExplicitSyncSettings();
auto explicitOptions = getExplicitSyncSettings(pMonitor->output);
if (!explicitOptions.explicitEnabled)
return ok;

Expand Down Expand Up @@ -2293,7 +2293,7 @@ void CHyprRenderer::endRender() {
if (m_eRenderMode == RENDER_MODE_NORMAL) {
PMONITOR->output->state->setBuffer(m_pCurrentBuffer);

auto explicitOptions = getExplicitSyncSettings();
auto explicitOptions = getExplicitSyncSettings(PMONITOR->output);

if (PMONITOR->inTimeline && explicitOptions.explicitEnabled && explicitOptions.explicitKMSEnabled) {
auto sync = g_pHyprOpenGL->createEGLSync({});
Expand Down Expand Up @@ -2336,14 +2336,22 @@ bool CHyprRenderer::isNvidia() {
return m_bNvidia;
}

SExplicitSyncSettings CHyprRenderer::getExplicitSyncSettings() {
SExplicitSyncSettings CHyprRenderer::getExplicitSyncSettings(SP<Aquamarine::IOutput> output) {
static auto PENABLEEXPLICIT = CConfigValue<Hyprlang::INT>("render:explicit_sync");
static auto PENABLEEXPLICITKMS = CConfigValue<Hyprlang::INT>("render:explicit_sync_kms");

SExplicitSyncSettings settings;
settings.explicitEnabled = *PENABLEEXPLICIT;
settings.explicitKMSEnabled = *PENABLEEXPLICITKMS;

if (!output->supportsExplicit) {
Debug::log(LOG, "Renderer: the aquamarine output does not support explicit, explicit settings are disabled.");
settings.explicitEnabled = false;
settings.explicitKMSEnabled = false;

return settings;
}

if (*PENABLEEXPLICIT == 2 /* auto */)
settings.explicitEnabled = true;
if (*PENABLEEXPLICITKMS == 2 /* auto */) {
Expand Down
2 changes: 1 addition & 1 deletion src/render/Renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class CHyprRenderer {
bool isNvidia();
void makeEGLCurrent();
void unsetEGL();
SExplicitSyncSettings getExplicitSyncSettings();
SExplicitSyncSettings getExplicitSyncSettings(SP<Aquamarine::IOutput> output);
void addWindowToRenderUnfocused(PHLWINDOW window);
void makeWindowSnapshot(PHLWINDOW);
void makeRawWindowSnapshot(PHLWINDOW, CFramebuffer*);
Expand Down

0 comments on commit 9c8a04f

Please sign in to comment.