From 16a2cb4ffc0cb3f5b143b37660bd1a8e24811e3c Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 1 Jul 2024 19:23:09 +0200 Subject: [PATCH] some format fixes --- src/protocols/LinuxDMABUF.cpp | 8 +++----- src/protocols/MesaDRM.cpp | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/protocols/LinuxDMABUF.cpp b/src/protocols/LinuxDMABUF.cpp index 713ad14e..32cace3f 100644 --- a/src/protocols/LinuxDMABUF.cpp +++ b/src/protocols/LinuxDMABUF.cpp @@ -24,11 +24,9 @@ static std::optional devIDFromFD(int fd) { CCompiledDMABUFFeedback::CCompiledDMABUFFeedback(dev_t device, std::vector tranches_) { std::set> formats; - for (auto& t : tranches_) { - for (auto& fmt : t.formats) { - for (auto& mod : fmt.modifiers) { - formats.insert(std::make_pair<>(fmt.drmFormat, mod)); - } + for (auto& fmt : g_pHyprOpenGL->getDRMFormats()) { + for (auto& mod : fmt.modifiers) { + formats.insert(std::make_pair<>(fmt.drmFormat, mod)); } } diff --git a/src/protocols/MesaDRM.cpp b/src/protocols/MesaDRM.cpp index 04a8831c..e585dcec 100644 --- a/src/protocols/MesaDRM.cpp +++ b/src/protocols/MesaDRM.cpp @@ -60,10 +60,27 @@ CMesaDRMResource::CMesaDRMResource(SP resource_) : resource(resource_) { return; } + uint64_t mod = DRM_FORMAT_MOD_INVALID; + + auto fmts = g_pHyprOpenGL->getDRMFormats(); + for (auto& f : fmts) { + if (f.drmFormat != fmt) + continue; + + for (auto& m : f.modifiers) { + if (m == DRM_FORMAT_MOD_LINEAR) + continue; + + mod = m; + break; + } + break; + } + Aquamarine::SDMABUFAttrs attrs; attrs.success = true; attrs.size = {w, h}; - attrs.modifier = DRM_FORMAT_MOD_INVALID; + attrs.modifier = mod; attrs.planes = 1; attrs.offsets[0] = off0; attrs.strides[0] = str0;