From 2b26c738b7e9b5801a0ac62048b6401f4d5630a2 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Wed, 26 Jun 2024 22:35:22 +0200 Subject: [PATCH] get dma formats from aq --- src/helpers/Format.hpp | 6 ++---- src/protocols/LinuxDMABUF.cpp | 13 +++++++++---- src/protocols/LinuxDMABUF.hpp | 1 - src/protocols/MesaDRM.cpp | 2 +- src/render/OpenGL.cpp | 4 ++-- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/helpers/Format.hpp b/src/helpers/Format.hpp index c0dabdd5..a0ac9c32 100644 --- a/src/helpers/Format.hpp +++ b/src/helpers/Format.hpp @@ -2,6 +2,7 @@ #include #include "math/Math.hpp" +#include typedef uint32_t DRMFormat; typedef uint32_t SHMFormat; @@ -18,10 +19,7 @@ struct SPixelFormat { Vector2D blockSize; }; -struct SDRMFormat { - DRMFormat format = 0; /* DRM_FORMAT_INVALID */ - std::vector mods; -}; +typedef Aquamarine::SDRMFormat SDRMFormat; namespace FormatUtils { SHMFormat drmToShm(DRMFormat drm); diff --git a/src/protocols/LinuxDMABUF.cpp b/src/protocols/LinuxDMABUF.cpp index 6167ec3f..713ad14e 100644 --- a/src/protocols/LinuxDMABUF.cpp +++ b/src/protocols/LinuxDMABUF.cpp @@ -26,8 +26,8 @@ CCompiledDMABUFFeedback::CCompiledDMABUFFeedback(dev_t device, std::vector> formats; for (auto& t : tranches_) { for (auto& fmt : t.formats) { - for (auto& mod : fmt.mods) { - formats.insert(std::make_pair<>(fmt.format, mod)); + for (auto& mod : fmt.modifiers) { + formats.insert(std::make_pair<>(fmt.drmFormat, mod)); } } } @@ -387,11 +387,16 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const mainDevice = *dev; - auto fmts = g_pHyprOpenGL->getDRMFormats(); + // FIXME: this will break on multi-gpu + std::vector aqFormats; + for (auto& impl : g_pCompositor->m_pAqBackend->getImplementations()) { + aqFormats = impl->getRenderFormats(); + break; + } SDMABufTranche tranche = { .device = *dev, - .formats = fmts, + .formats = aqFormats, }; std::vector tches; diff --git a/src/protocols/LinuxDMABUF.hpp b/src/protocols/LinuxDMABUF.hpp index e845352c..4e1636d0 100644 --- a/src/protocols/LinuxDMABUF.hpp +++ b/src/protocols/LinuxDMABUF.hpp @@ -10,7 +10,6 @@ #include class CDMABuffer; -struct SDRMFormat; class CWLSurfaceResource; class CLinuxDMABuffer { diff --git a/src/protocols/MesaDRM.cpp b/src/protocols/MesaDRM.cpp index ab77cb4d..04a8831c 100644 --- a/src/protocols/MesaDRM.cpp +++ b/src/protocols/MesaDRM.cpp @@ -87,7 +87,7 @@ CMesaDRMResource::CMesaDRMResource(SP resource_) : resource(resource_) { auto fmts = g_pHyprOpenGL->getDRMFormats(); for (auto& fmt : fmts) { - resource->sendFormat(fmt.format); + resource->sendFormat(fmt.drmFormat); } } diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 8faf693c..f833f875 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -344,8 +344,8 @@ void CHyprOpenGLImpl::initDRMFormats() { mods.push_back(DRM_FORMAT_MOD_INVALID); dmaFormats.push_back(SDRMFormat{ - .format = fmt, - .mods = mods, + .drmFormat = fmt, + .modifiers = mods, }); std::vector> modifierData;