From ed8b4b73d26cdff2414b4ad6dc1ccd26ceee55af Mon Sep 17 00:00:00 2001 From: Vaxry Date: Thu, 18 Jul 2024 12:35:44 +0200 Subject: [PATCH] shm drm woo --- src/protocols/core/Shm.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/protocols/core/Shm.cpp b/src/protocols/core/Shm.cpp index 109a7d04..75c2134a 100644 --- a/src/protocols/core/Shm.cpp +++ b/src/protocols/core/Shm.cpp @@ -188,11 +188,19 @@ CWLSHMProtocol::CWLSHMProtocol(const wl_interface* iface, const int& ver, const void CWLSHMProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) { if (shmFormats.empty()) { - size_t len = 0; - // TODO: support 10 bit shm - shmFormats.push_back(WL_SHM_FORMAT_ARGB8888); shmFormats.push_back(WL_SHM_FORMAT_XRGB8888); + + static const std::array supportedShmFourccFormats = { + DRM_FORMAT_XBGR8888, DRM_FORMAT_ABGR8888, DRM_FORMAT_XRGB2101010, DRM_FORMAT_ARGB2101010, DRM_FORMAT_XBGR2101010, DRM_FORMAT_ABGR2101010, + }; + + for (auto& fmt : g_pHyprOpenGL->getDRMFormats()) { + if (std::find(supportedShmFourccFormats.begin(), supportedShmFourccFormats.end(), fmt.drmFormat) == supportedShmFourccFormats.end()) + continue; + + shmFormats.push_back(fmt.drmFormat); + } } const auto RESOURCE = m_vManagers.emplace_back(makeShared(makeShared(client, ver, id)));