From da76a1ed9eab3d1b5cf5fae4d040f8efe08b586c Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 5 Dec 2022 19:11:02 +0000 Subject: [PATCH] block surface feedback on window sharing --- src/protocols/ToplevelExport.cpp | 2 ++ src/render/Renderer.cpp | 7 ++++--- src/render/Renderer.hpp | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/protocols/ToplevelExport.cpp b/src/protocols/ToplevelExport.cpp index 458171d0..b7751511 100644 --- a/src/protocols/ToplevelExport.cpp +++ b/src/protocols/ToplevelExport.cpp @@ -341,7 +341,9 @@ bool CToplevelExportProtocolManager::copyFrameShm(SToplevelFrame* frame, timespe g_pHyprOpenGL->clear(CColor(0, 0, 0, 255)); // render client at 0,0 + g_pHyprRenderer->m_bBlockSurfaceFeedback = g_pHyprRenderer->shouldRenderWindow(frame->pWindow); // block the feedback to avoid spamming the surface if it's visible g_pHyprRenderer->renderWindow(frame->pWindow, PMONITOR, now, false, RENDER_PASS_ALL, true, true); + g_pHyprRenderer->m_bBlockSurfaceFeedback = false; // copy pixels const auto PFORMAT = get_gles2_format_from_drm(format); diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 69adb40d..1bca6e34 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -51,9 +51,10 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) { g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, rounding, true); } - wlr_surface_send_frame_done(surface, RDATA->when); - - wlr_presentation_surface_sampled_on_output(g_pCompositor->m_sWLRPresentation, surface, RDATA->output); + if (!g_pHyprRenderer->m_bBlockSurfaceFeedback) { + wlr_surface_send_frame_done(surface, RDATA->when); + wlr_presentation_surface_sampled_on_output(g_pCompositor->m_sWLRPresentation, surface, RDATA->output); + } // reset the UV, we might've set it above g_pHyprOpenGL->m_RenderData.primarySurfaceUVTopLeft = Vector2D(-1, -1); diff --git a/src/render/Renderer.hpp b/src/render/Renderer.hpp index 068f5588..38feeb79 100644 --- a/src/render/Renderer.hpp +++ b/src/render/Renderer.hpp @@ -46,6 +46,7 @@ public: void calculateUVForWindowSurface(CWindow*, wlr_surface*, bool main = false); bool m_bWindowRequestedCursorHide = false; + bool m_bBlockSurfaceFeedback = false; CWindow* m_pLastScanout = nullptr; DAMAGETRACKINGMODES damageTrackingModeFromStr(const std::string&);