Skip to content

Commit

Permalink
mitigate ds artifacting and update linux-dmabuf comments
Browse files Browse the repository at this point in the history
with this commit artifacting now only occurs when the
client's fps is above the refresh rate of the monitor
  • Loading branch information
ikalco committed Jul 19, 2024
1 parent 656f505 commit 9c24ec6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/helpers/Monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,7 @@ bool CMonitor::attemptDirectScanout() {
// and comes from the appropriate device. This may implode on multi-gpu!!

output->state->setBuffer(PSURFACE->current.buffer);
output->state->setPresentationMode(Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_VSYNC);

if (!state.test())
return false;
Expand Down
9 changes: 3 additions & 6 deletions src/protocols/LinuxDMABUF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,8 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
std::vector<std::pair<SP<CMonitor>, SDMABUFTranche>> tches;

if (g_pCompositor->m_pAqBackend->hasSession()) {
// this assumes there's 1 device used for scanout and each monitor never changes its primary plane
// this assumes there's only 1 device used for both scanout and rendering
// also that each monitor never changes its primary plane

for (auto& mon : g_pCompositor->m_vMonitors) {
auto tranche = SDMABUFTranche{
Expand Down Expand Up @@ -594,18 +595,14 @@ void CLinuxDMABufV1Protocol::updateScanoutTranche(SP<CWLSurfaceResource> surface

LOGM(LOG, "updateScanoutTranche: sending a scanout tranche");

// send a dedicated scanout tranche that contains formats that:
// - match the format of the output
// - are not linear or implicit

struct wl_array deviceArr = {
.size = sizeof(mainDevice),
.data = (void*)&mainDevice,
};
feedbackResource->resource->sendMainDevice(&deviceArr);

// prioritize scnaout tranche but have renderer fallback tranche
// also yes flags can be duped here because different tranche flags (ds and no ds)
// also yes formats can be duped here because different tranche flags (ds and no ds)
feedbackResource->sendTranche(monitorTranche);
feedbackResource->sendTranche(formatTable->rendererTranche);

Expand Down
7 changes: 4 additions & 3 deletions src/render/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,9 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(pMonitor->ID);
}

if (!pMonitor->output->needsFrame && pMonitor->forceFullFrames == 0)
return;

// tearing and DS first
bool shouldTear = false;
if (pMonitor->tearingState.nextRenderTorn) {
Expand Down Expand Up @@ -1211,9 +1214,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
clock_gettime(CLOCK_MONOTONIC, &now);

// check the damage
bool hasChanged = pMonitor->output->needsFrame || pMonitor->damage.hasChanged();

if (!hasChanged && *PDAMAGETRACKINGMODE != DAMAGE_TRACKING_NONE && pMonitor->forceFullFrames == 0 && damageBlinkCleanup == 0)
if (!pMonitor->damage.hasChanged() && *PDAMAGETRACKINGMODE != DAMAGE_TRACKING_NONE && damageBlinkCleanup == 0)
return;

if (*PDAMAGETRACKINGMODE == -1) {
Expand Down

0 comments on commit 9c24ec6

Please sign in to comment.