git: 54f2b0ad7dc5 - main - x11-wm/hyprland: switch to wlroots-devel after d3cd6c622a6d
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 03 May 2023 17:35:02 UTC
The branch main has been updated by jbeich: URL: https://cgit.FreeBSD.org/ports/commit/?id=54f2b0ad7dc5f52d49cd3670edbc6b56e65d494d commit 54f2b0ad7dc5f52d49cd3670edbc6b56e65d494d Author: Jan Beich <jbeich@FreeBSD.org> AuthorDate: 2023-05-03 17:01:20 +0000 Commit: Jan Beich <jbeich@FreeBSD.org> CommitDate: 2023-05-03 17:34:06 +0000 x11-wm/hyprland: switch to wlroots-devel after d3cd6c622a6d Fixes hard-to-bisect performance degradation since 0.24.0. --- x11-wm/hyprland/Makefile | 4 +- x11-wm/hyprland/files/patch-system-wlroots | 2 +- x11-wm/hyprland/files/patch-wlroots-0.16 | 322 ----------------------------- 3 files changed, 4 insertions(+), 324 deletions(-) diff --git a/x11-wm/hyprland/Makefile b/x11-wm/hyprland/Makefile index f8ca16c6ba1a..dd8af42e2843 100644 --- a/x11-wm/hyprland/Makefile +++ b/x11-wm/hyprland/Makefile @@ -1,6 +1,7 @@ PORTNAME= hyprland DISTVERSIONPREFIX= v DISTVERSION= 0.25.0 +PORTREVISION= 1 CATEGORIES= x11-wm wayland MAINTAINER= jbeich@FreeBSD.org @@ -13,7 +14,7 @@ LICENSE_FILE= ${WRKSRC}/LICENSE BUILD_DEPENDS= cmake:devel/cmake-core \ evdev-proto>0:devel/evdev-proto \ wayland-protocols>=1.25:graphics/wayland-protocols \ - wlroots>=0.16.0<0.17.0:x11-toolkits/wlroots + wlroots>=0.16.0.346<0.17.0:x11-toolkits/wlroots LIB_DEPENDS= libwayland-server.so:graphics/wayland \ libwlroots.so:x11-toolkits/wlroots \ libinput.so:x11/libinput \ @@ -90,4 +91,5 @@ bundled-libcxx: .endif .endif # exists(/usr/lib/libc++.so) +.include "${.CURDIR:H:H}/x11-toolkits/wlroots-devel/override.mk" .include <bsd.port.mk> diff --git a/x11-wm/hyprland/files/patch-system-wlroots b/x11-wm/hyprland/files/patch-system-wlroots index d25e5aff58c8..0f099fd8359d 100644 --- a/x11-wm/hyprland/files/patch-system-wlroots +++ b/x11-wm/hyprland/files/patch-system-wlroots @@ -8,7 +8,7 @@ Allow system wlroots to reduce maintenance (wlroots has tons of options) -wlroots = subproject('wlroots', default_options: ['examples=false']) -have_xwlr = wlroots.get_variable('features').get('xwayland') -+wlroots = dependency('wlroots', version: ['>=0.16.0', '<0.17.0'], default_options: ['examples=false']) ++wlroots = dependency('wlroots', version: ['>=0.17.0', '<0.18.0'], default_options: ['examples=false']) +have_xwlr = wlroots.get_variable(pkgconfig: 'have_xwayland', internal: 'have_xwayland') == 'true' xcb_dep = dependency('xcb', required: get_option('xwayland')) diff --git a/x11-wm/hyprland/files/patch-wlroots-0.16 b/x11-wm/hyprland/files/patch-wlroots-0.16 deleted file mode 100644 index 0cd0eed17660..000000000000 --- a/x11-wm/hyprland/files/patch-wlroots-0.16 +++ /dev/null @@ -1,322 +0,0 @@ -Revert to wlroots 0.16 API as 0.17 is a moving target, so hard to -use as system package with more than one consumer. - -https://github.com/hyprwm/Hyprland/commit/df132e5ff339 -https://github.com/hyprwm/Hyprland/commit/c012e3d66b21 -https://github.com/hyprwm/Hyprland/commit/d6b3bfc48e22 -https://github.com/hyprwm/Hyprland/commit/a46abd8b1ada -https://github.com/hyprwm/Hyprland/commit/a34b74766193 -https://github.com/hyprwm/Hyprland/commit/1a5d5bf6201b -https://github.com/hyprwm/Hyprland/commit/d03dcc3d9941 - ---- src/Compositor.cpp.orig 2023-05-03 16:15:08 UTC -+++ src/Compositor.cpp -@@ -104,7 +104,7 @@ void CCompositor::initServer() { - if (LOGWLR && std::string(LOGWLR) == "1") - wlr_log_init(WLR_DEBUG, Debug::wlrLog); - -- m_sWLRBackend = wlr_backend_autocreate(m_sWLDisplay, &m_sWLRSession); -+ m_sWLRBackend = wlr_backend_autocreate(m_sWLDisplay); - - if (!m_sWLRBackend) { - Debug::log(CRIT, "m_sWLRBackend was NULL!"); -@@ -127,10 +127,11 @@ void CCompositor::initServer() { - wlr_renderer_init_wl_shm(m_sWLRRenderer, m_sWLDisplay); - - if (wlr_renderer_get_dmabuf_texture_formats(m_sWLRRenderer)) { -- if (wlr_renderer_get_drm_fd(m_sWLRRenderer) >= 0) -+ if (wlr_renderer_get_drm_fd(m_sWLRRenderer) >= 0) { - wlr_drm_create(m_sWLDisplay, m_sWLRRenderer); -+ } - -- m_sWLRLinuxDMABuf = wlr_linux_dmabuf_v1_create_with_renderer(m_sWLDisplay, 4, m_sWLRRenderer); -+ m_sWLRLinuxDMABuf = wlr_linux_dmabuf_v1_create(m_sWLDisplay, m_sWLRRenderer); - } - - m_sWLRAllocator = wlr_allocator_autocreate(m_sWLRBackend, m_sWLRRenderer); -@@ -147,7 +148,7 @@ void CCompositor::initServer() { - throw std::runtime_error("wlr_gles2_renderer_get_egl() failed!"); - } - -- m_sWLRCompositor = wlr_compositor_create(m_sWLDisplay, 6, m_sWLRRenderer); -+ m_sWLRCompositor = wlr_compositor_create(m_sWLDisplay, m_sWLRRenderer); - m_sWLRSubCompositor = wlr_subcompositor_create(m_sWLDisplay); - m_sWLRDataDevMgr = wlr_data_device_manager_create(m_sWLDisplay); - -@@ -187,7 +188,7 @@ void CCompositor::initServer() { - - m_sWLRIdle = wlr_idle_create(m_sWLDisplay); - -- m_sWLRLayerShell = wlr_layer_shell_v1_create(m_sWLDisplay, 4); -+ m_sWLRLayerShell = wlr_layer_shell_v1_create(m_sWLDisplay); - - m_sWLRServerDecoMgr = wlr_server_decoration_manager_create(m_sWLDisplay); - m_sWLRXDGDecoMgr = wlr_xdg_decoration_manager_v1_create(m_sWLDisplay); -@@ -227,6 +228,8 @@ void CCompositor::initServer() { - wlr_xdg_foreign_v2_create(m_sWLDisplay, m_sWLRForeignRegistry); - - m_sWLRPointerGestures = wlr_pointer_gestures_v1_create(m_sWLDisplay); -+ -+ m_sWLRSession = wlr_backend_get_session(m_sWLRBackend); - - m_sWLRTextInputMgr = wlr_text_input_manager_v3_create(m_sWLDisplay); - ---- src/events/Events.hpp.orig 2023-05-03 16:15:08 UTC -+++ src/events/Events.hpp -@@ -97,7 +97,6 @@ namespace Events { - // Monitor part 2 the sequel - DYNLISTENFUNC(monitorFrame); - DYNLISTENFUNC(monitorDestroy); -- DYNLISTENFUNC(monitorStateRequest); - DYNLISTENFUNC(monitorDamage); - DYNLISTENFUNC(monitorNeedsFrame); - DYNLISTENFUNC(monitorCommit); ---- src/events/Monitors.cpp.orig 2023-05-03 16:15:08 UTC -+++ src/events/Monitors.cpp -@@ -193,13 +193,6 @@ void Events::listener_monitorDestroy(void* owner, void - } - } - --void Events::listener_monitorStateRequest(void* owner, void* data) { -- const auto PMONITOR = (CMonitor*)owner; -- const auto E = (wlr_output_event_request_state*)data; -- -- wlr_output_commit_state(PMONITOR->output, E->state); --} -- - void Events::listener_monitorDamage(void* owner, void* data) { - const auto PMONITOR = (CMonitor*)owner; - const auto E = (wlr_output_event_damage*)data; ---- src/events/Windows.cpp.orig 2023-05-03 16:15:08 UTC -+++ src/events/Windows.cpp -@@ -863,7 +863,7 @@ void Events::listener_activateXDG(wl_listener* listene - - Debug::log(LOG, "Activate request for surface at %lx", E->surface); - -- if (!wlr_xdg_surface_try_from_wlr_surface(E->surface)) -+ if (!wlr_surface_is_xdg_surface(E->surface)) - return; - - const auto PWINDOW = g_pCompositor->getWindowFromSurface(E->surface); ---- src/helpers/Monitor.cpp.orig 2023-05-03 16:15:08 UTC -+++ src/helpers/Monitor.cpp -@@ -19,13 +19,11 @@ void CMonitor::onConnect(bool noRule) { - void CMonitor::onConnect(bool noRule) { - hyprListener_monitorDestroy.removeCallback(); - hyprListener_monitorFrame.removeCallback(); -- hyprListener_monitorStateRequest.removeCallback(); - hyprListener_monitorDamage.removeCallback(); - hyprListener_monitorNeedsFrame.removeCallback(); - hyprListener_monitorCommit.removeCallback(); - hyprListener_monitorFrame.initCallback(&output->events.frame, &Events::listener_monitorFrame, this); - hyprListener_monitorDestroy.initCallback(&output->events.destroy, &Events::listener_monitorDestroy, this); -- hyprListener_monitorStateRequest.initCallback(&output->events.request_state, &Events::listener_monitorStateRequest, this); - hyprListener_monitorDamage.initCallback(&output->events.damage, &Events::listener_monitorDamage, this); - hyprListener_monitorNeedsFrame.initCallback(&output->events.needs_frame, &Events::listener_monitorNeedsFrame, this); - hyprListener_monitorCommit.initCallback(&output->events.commit, &Events::listener_monitorCommit, this); -@@ -249,7 +247,7 @@ void CMonitor::onDisconnect() { - if (!BACKUPMON) { - Debug::log(WARN, "Unplugged last monitor, entering an unsafe state. Good luck my friend."); - -- hyprListener_monitorStateRequest.removeCallback(); -+ hyprListener_monitorMode.removeCallback(); - hyprListener_monitorDestroy.removeCallback(); - - g_pCompositor->m_bUnsafeState = true; -@@ -307,7 +305,7 @@ void CMonitor::onDisconnect() { - std::erase_if(g_pCompositor->m_vMonitors, [&](std::shared_ptr<CMonitor>& el) { return el.get() == this; }); - } - --void CMonitor::addDamage(const pixman_region32_t* rg) { -+void CMonitor::addDamage(pixman_region32_t* rg) { - static auto* const PZOOMFACTOR = &g_pConfigManager->getConfigValuePtr("misc:cursor_zoom_factor")->floatValue; - if (*PZOOMFACTOR != 1.f && g_pCompositor->getMonitorFromCursor() == this) { - wlr_damage_ring_add_whole(&damage); ---- src/helpers/Monitor.hpp.orig 2023-05-03 16:15:08 UTC -+++ src/helpers/Monitor.hpp -@@ -64,7 +64,7 @@ class CMonitor { - - DYNLISTENER(monitorFrame); - DYNLISTENER(monitorDestroy); -- DYNLISTENER(monitorStateRequest); -+ DYNLISTENER(monitorMode); - DYNLISTENER(monitorDamage); - DYNLISTENER(monitorNeedsFrame); - DYNLISTENER(monitorCommit); -@@ -76,7 +76,7 @@ class CMonitor { - // methods - void onConnect(bool noRule); - void onDisconnect(); -- void addDamage(const pixman_region32_t* rg); -+ void addDamage(pixman_region32_t* rg); - void addDamage(const wlr_box* box); - void setMirror(const std::string&); - bool isMirror(); ---- src/helpers/SubsurfaceTree.cpp.orig 2023-05-03 16:15:08 UTC -+++ src/helpers/SubsurfaceTree.cpp -@@ -6,8 +6,8 @@ void addSurfaceGlobalOffset(SSurfaceTreeNode* node, in - if (!node->pSurface || !node->pSurface->exists()) - return; - -- *lx += node->pSurface->wlr()->current.dx; -- *ly += node->pSurface->wlr()->current.dy; -+ *lx += node->pSurface->wlr()->sx; -+ *ly += node->pSurface->wlr()->sy; - - if (node->offsetfn) { - // This is the root node ---- src/managers/XWaylandManager.cpp.orig 2023-05-03 16:15:08 UTC -+++ src/managers/XWaylandManager.cpp -@@ -35,16 +35,16 @@ void CHyprXWaylandManager::activateSurface(wlr_surface - if (!pSurface) - return; - -- if (wlr_xdg_surface_try_from_wlr_surface(pSurface)) { -- const auto PSURF = wlr_xdg_surface_try_from_wlr_surface(pSurface); -+ if (wlr_surface_is_xdg_surface(pSurface)) { -+ const auto PSURF = wlr_xdg_surface_from_wlr_surface(pSurface); - if (PSURF && PSURF->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) { - wlr_xdg_toplevel_set_activated(PSURF->toplevel, activate); - } -- } else if (wlr_xwayland_surface_try_from_wlr_surface(pSurface)) { -- wlr_xwayland_surface_activate(wlr_xwayland_surface_try_from_wlr_surface(pSurface), activate); -+ } else if (wlr_surface_is_xwayland_surface(pSurface)) { -+ wlr_xwayland_surface_activate(wlr_xwayland_surface_from_wlr_surface(pSurface), activate); - - if (activate) -- wlr_xwayland_surface_restack(wlr_xwayland_surface_try_from_wlr_surface(pSurface), nullptr, XCB_STACK_MODE_ABOVE); -+ wlr_xwayland_surface_restack(wlr_xwayland_surface_from_wlr_surface(pSurface), nullptr, XCB_STACK_MODE_ABOVE); - } - } - ---- src/managers/input/InputMethodRelay.cpp.orig 2023-05-03 16:15:08 UTC -+++ src/managers/input/InputMethodRelay.cpp -@@ -184,8 +184,8 @@ void CInputMethodRelay::updateInputPopup(SIMEPopup* pP - Vector2D parentPos; - Vector2D parentSize; - -- if (wlr_layer_surface_v1_try_from_wlr_surface(PFOCUSEDSURFACE)) { -- const auto PLS = g_pCompositor->getLayerSurfaceFromWlr(wlr_layer_surface_v1_try_from_wlr_surface(PFOCUSEDSURFACE)); -+ if (wlr_surface_is_layer_surface(PFOCUSEDSURFACE)) { -+ const auto PLS = g_pCompositor->getLayerSurfaceFromWlr(wlr_layer_surface_v1_from_wlr_surface(PFOCUSEDSURFACE)); - - if (PLS) { - parentPos = Vector2D(PLS->geometry.x, PLS->geometry.y) + g_pCompositor->getMonitorFromID(PLS->monitorID)->vecPosition; -@@ -292,8 +292,8 @@ void CInputMethodRelay::damagePopup(SIMEPopup* pPopup) - - const auto PFOCUSEDSURFACE = focusedSurface(PFOCUSEDTI); - -- if (wlr_layer_surface_v1_try_from_wlr_surface(PFOCUSEDSURFACE)) { -- const auto PLS = g_pCompositor->getLayerSurfaceFromWlr(wlr_layer_surface_v1_try_from_wlr_surface(PFOCUSEDSURFACE)); -+ if (wlr_surface_is_layer_surface(PFOCUSEDSURFACE)) { -+ const auto PLS = g_pCompositor->getLayerSurfaceFromWlr(wlr_layer_surface_v1_from_wlr_surface(PFOCUSEDSURFACE)); - - if (PLS) { - parentPos = Vector2D(PLS->geometry.x, PLS->geometry.y) + g_pCompositor->getMonitorFromID(PLS->monitorID)->vecPosition; ---- src/protocols/ToplevelExport.cpp.orig 2023-05-03 16:15:08 UTC -+++ src/protocols/ToplevelExport.cpp -@@ -373,7 +373,8 @@ bool CToplevelExportProtocolManager::copyFrameShm(SScr - g_pHyprRenderer->renderWindow(frame->pWindow, PMONITOR, now, false, RENDER_PASS_ALL, true, true); - g_pHyprRenderer->m_bBlockSurfaceFeedback = false; - -- if (frame->overlayCursor && wlr_renderer_begin(g_pCompositor->m_sWLRRenderer, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y)) { -+ if (frame->overlayCursor) { -+ wlr_renderer_begin(g_pCompositor->m_sWLRRenderer, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y); - // hack le massive - wlr_output_cursor* cursor; - const auto OFFSET = frame->pWindow->m_vRealPosition.vec() - PMONITOR->vecPosition; ---- src/render/Renderer.cpp.orig 2023-05-03 16:15:08 UTC -+++ src/render/Renderer.cpp -@@ -37,7 +37,7 @@ void renderSurface(struct wlr_surface* surface, int x, - rounding -= 1; // to fix a border issue - - if (RDATA->surface && surface == RDATA->surface) { -- if (wlr_xwayland_surface_try_from_wlr_surface(surface) && !wlr_xwayland_surface_try_from_wlr_surface(surface)->has_alpha && RDATA->fadeAlpha * RDATA->alpha == 1.f) { -+ if (wlr_surface_is_xwayland_surface(surface) && !wlr_xwayland_surface_from_wlr_surface(surface)->has_alpha && RDATA->fadeAlpha * RDATA->alpha == 1.f) { - g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, rounding, true); - } else { - if (RDATA->blur) -@@ -697,9 +697,6 @@ bool CHyprRenderer::attemptDirectScanout(CMonitor* pMo - if (!pMonitor->mirrors.empty() || pMonitor->isMirror() || m_bDirectScanoutBlocked) - return false; // do not DS if this monitor is being mirrored. Will break the functionality. - -- if (!wlr_output_is_direct_scanout_allowed(pMonitor->output)) -- return false; -- - const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pMonitor->activeWorkspace); - - if (!PWORKSPACE || !PWORKSPACE->m_bHasFullscreenWindow || g_pInputManager->m_sDrag.drag || g_pCompositor->m_sSeat.exclusiveClient || pMonitor->specialWorkspaceID) -@@ -971,7 +968,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) - damageBlinkCleanup = 0; - } - -- if (wlr_renderer_begin(g_pCompositor->m_sWLRRenderer, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y)) { -+ wlr_renderer_begin(g_pCompositor->m_sWLRRenderer, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y); - if (pMonitor == g_pCompositor->getMonitorFromCursor() && *PZOOMFACTOR != 1.f) { - wlr_output_lock_software_cursors(pMonitor->output, true); - wlr_output_render_software_cursors(pMonitor->output, NULL); -@@ -979,7 +976,6 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) - } else - wlr_output_render_software_cursors(pMonitor->output, NULL); - wlr_renderer_end(g_pCompositor->m_sWLRRenderer); -- } - } - - if (pMonitor == g_pCompositor->getMonitorFromCursor()) -@@ -1081,20 +1077,48 @@ void CHyprRenderer::setWindowScanoutMode(CWindow* pWin - return; - } - -- const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); -+ const auto RENDERERDRMFD = wlr_renderer_get_drm_fd(g_pCompositor->m_sWLRRenderer); -+ const auto BACKENDDRMFD = wlr_backend_get_drm_fd(g_pCompositor->m_sWLRBackend); - -- const wlr_linux_dmabuf_feedback_v1_init_options INIT_OPTIONS = { -- .main_renderer = g_pCompositor->m_sWLRRenderer, -- .scanout_primary_output = PMONITOR->output, -+ if (RENDERERDRMFD < 0 || BACKENDDRMFD < 0) -+ return; -+ -+ auto deviceIDFromFD = [](int fd, unsigned long* deviceID) -> bool { -+ struct stat stat; -+ if (fstat(fd, &stat) != 0) { -+ return false; -+ } -+ *deviceID = stat.st_rdev; -+ return true; - }; - -- wlr_linux_dmabuf_feedback_v1 feedback = {0}; -+ unsigned long rendererDevice, scanoutDevice; -+ if (!deviceIDFromFD(RENDERERDRMFD, &rendererDevice) || !deviceIDFromFD(BACKENDDRMFD, &scanoutDevice)) -+ return; - -- if (!wlr_linux_dmabuf_feedback_v1_init_with_options(&feedback, &INIT_OPTIONS)) -+ const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); -+ -+ const auto POUTPUTFORMATS = wlr_output_get_primary_formats(PMONITOR->output, WLR_BUFFER_CAP_DMABUF); -+ if (!POUTPUTFORMATS) - return; - -- wlr_linux_dmabuf_v1_set_surface_feedback(g_pCompositor->m_sWLRLinuxDMABuf, pWindow->m_pWLSurface.wlr(), &feedback); -- wlr_linux_dmabuf_feedback_v1_finish(&feedback); -+ const auto PRENDERERFORMATS = wlr_renderer_get_dmabuf_texture_formats(g_pCompositor->m_sWLRRenderer); -+ wlr_drm_format_set scanoutFormats = {0}; -+ -+ if (!wlr_drm_format_set_intersect(&scanoutFormats, POUTPUTFORMATS, PRENDERERFORMATS)) -+ return; -+ -+ const wlr_linux_dmabuf_feedback_v1_tranche TRANCHES[] = { -+ {.target_device = scanoutDevice, .flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT, .formats = &scanoutFormats}, -+ {.target_device = rendererDevice, .formats = PRENDERERFORMATS}}; -+ -+ const wlr_linux_dmabuf_feedback_v1 FEEDBACK = {.main_device = rendererDevice, .tranches_len = sizeof(TRANCHES) / sizeof(TRANCHES[0]), .tranches = TRANCHES}; -+ -+ if (!wlr_linux_dmabuf_v1_set_surface_feedback(g_pCompositor->m_sWLRLinuxDMABuf, pWindow->m_pWLSurface.wlr(), &FEEDBACK)) { -+ Debug::log(ERR, "Error in scanout mode setting: wlr_linux_dmabuf_v1_set_surface_feedback returned false."); -+ } -+ -+ wlr_drm_format_set_finish(&scanoutFormats); - - Debug::log(LOG, "Scanout mode ON set for %lx", pWindow); - }