From 9ba88d0ace3dc608beea3aa4573123b394197ba5 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Thu, 22 Feb 2024 23:02:37 +0000 Subject: [PATCH] gbm: prefer linear modifiers ref #62 --- src/renderer/DMAFrame.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/renderer/DMAFrame.cpp b/src/renderer/DMAFrame.cpp index 1cbc089..e9b287d 100644 --- a/src/renderer/DMAFrame.cpp +++ b/src/renderer/DMAFrame.cpp @@ -142,7 +142,11 @@ bool CDMAFrame::onBufferDone() { goodMods.push_back(mods[i]); } - bo = gbm_bo_create_with_modifiers2(g_pHyprlock->dma.gbmDevice, scdata.w, scdata.h, scdata.fmt, goodMods.data(), goodMods.size(), flags); + uint64_t zero = 0; + bool hasLinear = std::find(goodMods.begin(), goodMods.end(), 0) != goodMods.end(); + + bo = gbm_bo_create_with_modifiers2(g_pHyprlock->dma.gbmDevice, scdata.w, scdata.h, scdata.fmt, hasLinear ? &zero : goodMods.data(), hasLinear ? 1 : goodMods.size(), + flags); } }