diff --git a/src/Compositor.cpp b/src/Compositor.cpp index b0456358..5c0b8eaa 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -403,6 +403,9 @@ void CCompositor::initManagers(eManagersInitStage stage) { g_pPointerManager = std::make_unique(); } break; case STAGE_BASICINIT: { + Debug::log(LOG, "Creating the CHyprOpenGLImpl!"); + g_pHyprOpenGL = std::make_unique(); + Debug::log(LOG, "Creating the ProtocolManager!"); g_pProtocolManager = std::make_unique(); @@ -419,9 +422,6 @@ void CCompositor::initManagers(eManagersInitStage stage) { Debug::log(LOG, "Creating the InputManager!"); g_pInputManager = std::make_unique(); - Debug::log(LOG, "Creating the CHyprOpenGLImpl!"); - g_pHyprOpenGL = std::make_unique(); - Debug::log(LOG, "Creating the HyprRenderer!"); g_pHyprRenderer = std::make_unique(); diff --git a/src/managers/ProtocolManager.cpp b/src/managers/ProtocolManager.cpp index bd435b27..7946a3f7 100644 --- a/src/managers/ProtocolManager.cpp +++ b/src/managers/ProtocolManager.cpp @@ -44,6 +44,7 @@ #include "../protocols/core/Shm.hpp" #include "../helpers/Monitor.hpp" +#include "../render/Renderer.hpp" CProtocolManager::CProtocolManager() { @@ -103,8 +104,12 @@ CProtocolManager::CProtocolManager() { PROTO::dataWlr = std::make_unique(&zwlr_data_control_manager_v1_interface, 2, "DataDeviceWlr"); PROTO::primarySelection = std::make_unique(&zwp_primary_selection_device_manager_v1_interface, 1, "PrimarySelection"); PROTO::xwaylandShell = std::make_unique(&xwayland_shell_v1_interface, 1, "XWaylandShell"); - PROTO::mesaDRM = std::make_unique(&wl_drm_interface, 2, "MesaDRM"); - PROTO::linuxDma = std::make_unique(&zwp_linux_dmabuf_v1_interface, 5, "LinuxDMABUF"); + + if (g_pHyprOpenGL->getDRMFormats().size() > 0) { + PROTO::mesaDRM = std::make_unique(&wl_drm_interface, 2, "MesaDRM"); + PROTO::linuxDma = std::make_unique(&zwp_linux_dmabuf_v1_interface, 5, "LinuxDMABUF"); + } else + Debug::log(WARN, "ProtocolManager: Not binding linux-dmabuf and MesaDRM: DMABUF not available"); // Old protocol implementations. // TODO: rewrite them to use hyprwayland-scanner. diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index d4e8faa6..406ffdd0 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -92,7 +92,7 @@ std::vector CHyprOpenGLImpl::getModsForFormat(EGLint format) { } if (len <= 0) - return {}; + return {DRM_FORMAT_MOD_LINEAR, DRM_FORMAT_MOD_INVALID}; // assume the driver can do linear and implicit. std::vector mods; std::vector external; @@ -190,6 +190,10 @@ void CHyprOpenGLImpl::initDRMFormats() { Debug::log(LOG, "EGL: {} formats found in total. Some modifiers may be omitted as they are external-only.", dmaFormats.size()); + if (dmaFormats.size() == 0) + Debug::log(WARN, + "EGL: WARNING: No dmabuf formats were found, dmabuf will be disabled. This will degrade performance, but is most likely a driver issue or a very old GPU."); + drmFormats = dmaFormats; }