public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/kwin] rawhide: Fix for kwin crashing on user switching
@ 2026-09-16 16:10 Steve Cossette
  0 siblings, 0 replies; only message in thread
From: Steve Cossette @ 2026-09-16 16:10 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/kwin
Branch : rawhide
Commit : acd4e403e246bfe31986db5075e5f520df151521
Author : Steve Cossette <farchord@gmail.com>
Date   : 2026-09-16T12:09:57-04:00
Stats  : +154/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/kwin/c/acd4e403e246bfe31986db5075e5f520df151521?branch=rawhide

Log:
Fix for kwin crashing on user switching

---
diff --git a/79c0aca568e281c2af8b7820281e7c38b31cf90d.patch b/79c0aca568e281c2af8b7820281e7c38b31cf90d.patch
new file mode 100644
index 0000000..c7ec95f
--- /dev/null
+++ b/79c0aca568e281c2af8b7820281e7c38b31cf90d.patch
@@ -0,0 +1,145 @@
+From 79c0aca568e281c2af8b7820281e7c38b31cf90d Mon Sep 17 00:00:00 2001
+From: Xaver Hugl <xaver.hugl@kde.org>
+Date: Wed, 16 Sep 2026 14:43:11 +0200
+Subject: [PATCH] core/gbmgraphicsbufferallocator: destroy gbm_bo as soon as
+ possible
+
+This avoids crashing when the buffer outlives the allocator, which is
+sometimes required when rendering to the buffer. The buffer's life
+time is instead simply bound to the dmabuf file descriptor.
+
+To make that possible, this also removes the ability to map gbm
+buffers, but that was unused anyways. If we need it again, it would
+be pretty trivial to add it back for linear buffers specifically.
+
+BUG: 525748
+
+
+(cherry picked from commit e3908ecea5b5e93e5d43712e3cd035a69197ace1)
+
+Co-authored-by: Xaver Hugl <xaver.hugl@kde.org>
+---
+ src/core/gbmgraphicsbufferallocator.cpp | 52 ++++---------------------
+ 1 file changed, 7 insertions(+), 45 deletions(-)
+
+diff --git a/src/core/gbmgraphicsbufferallocator.cpp b/src/core/gbmgraphicsbufferallocator.cpp
+index defdacd5432..d27fc00542f 100644
+--- a/src/core/gbmgraphicsbufferallocator.cpp
++++ b/src/core/gbmgraphicsbufferallocator.cpp
+@@ -67,12 +67,9 @@ class GbmGraphicsBuffer : public GraphicsBuffer
+     Q_OBJECT
+ 
+ public:
+-    GbmGraphicsBuffer(DmaBufAttributes attributes, gbm_bo *handle);
++    explicit GbmGraphicsBuffer(DmaBufAttributes attributes);
+     ~GbmGraphicsBuffer() override;
+ 
+-    Map map(MapFlags flags) override;
+-    void unmap() override;
+-
+     QSize size() const override;
+     bool hasAlphaChannel() const override;
+     const DmaBufAttributes *dmabufAttributes() const override;
+@@ -81,11 +78,6 @@ public:
+     uint32_t pitch() const override;
+ 
+ private:
+-    gbm_bo *m_bo;
+-    void *m_mapPtr = nullptr;
+-    void *m_mapData = nullptr;
+-    // the stride of the buffer mapping can be different from the stride of the buffer itself
+-    uint32_t m_mapStride = 0;
+     DmaBufAttributes m_dmabufAttributes;
+     QSize m_size;
+     bool m_hasAlphaChannel;
+@@ -185,11 +177,11 @@ static GraphicsBuffer *allocateDmaBuf(gbm_device *device, dev_t deviceId, const
+                                                    flags);
+         if (bo) {
+             std::optional<DmaBufAttributes> attributes = dmaBufAttributesForBo(bo, deviceId);
++            gbm_bo_destroy(bo);
+             if (!attributes.has_value()) {
+-                gbm_bo_destroy(bo);
+                 return nullptr;
+             }
+-            return new GbmGraphicsBuffer(std::move(attributes.value()), bo);
++            return new GbmGraphicsBuffer(std::move(attributes.value()));
+         }
+     }
+ 
+@@ -206,8 +198,8 @@ static GraphicsBuffer *allocateDmaBuf(gbm_device *device, dev_t deviceId, const
+                                flags);
+     if (bo) {
+         std::optional<DmaBufAttributes> attributes = dmaBufAttributesForBo(bo, deviceId);
++        gbm_bo_destroy(bo);
+         if (!attributes.has_value()) {
+-            gbm_bo_destroy(bo);
+             return nullptr;
+         }
+         if (flags & GBM_BO_USE_LINEAR) {
+@@ -215,7 +207,7 @@ static GraphicsBuffer *allocateDmaBuf(gbm_device *device, dev_t deviceId, const
+         } else {
+             attributes->modifier = DRM_FORMAT_MOD_INVALID;
+         }
+-        return new GbmGraphicsBuffer(std::move(attributes.value()), bo);
++        return new GbmGraphicsBuffer(std::move(attributes.value()));
+     }
+ 
+     return nullptr;
+@@ -241,9 +233,8 @@ GraphicsBuffer *GbmGraphicsBufferAllocator::allocate(const GraphicsBufferOptions
+     return allocateDmaBuf(m_device->gbmDevice(), m_device->deviceId(), options);
+ }
+ 
+-GbmGraphicsBuffer::GbmGraphicsBuffer(DmaBufAttributes attributes, gbm_bo *handle)
+-    : m_bo(handle)
+-    , m_dmabufAttributes(std::move(attributes))
++GbmGraphicsBuffer::GbmGraphicsBuffer(DmaBufAttributes attributes)
++    : m_dmabufAttributes(std::move(attributes))
+     , m_size(m_dmabufAttributes.width, m_dmabufAttributes.height)
+     , m_hasAlphaChannel(alphaChannelFromDrmFormat(m_dmabufAttributes.format))
+ {
+@@ -251,8 +242,6 @@ GbmGraphicsBuffer::GbmGraphicsBuffer(DmaBufAttributes attributes, gbm_bo *handle
+ 
+ GbmGraphicsBuffer::~GbmGraphicsBuffer()
+ {
+-    unmap();
+-    gbm_bo_destroy(m_bo);
+ }
+ 
+ QSize GbmGraphicsBuffer::size() const
+@@ -285,33 +274,6 @@ uint32_t GbmGraphicsBuffer::pitch() const
+     return m_dmabufAttributes.pitch[0];
+ }
+ 
+-GraphicsBuffer::Map GbmGraphicsBuffer::map(MapFlags flags)
+-{
+-    if (!m_mapPtr) {
+-        uint32_t access = 0;
+-        if (flags & MapFlag::Read) {
+-            access |= GBM_BO_TRANSFER_READ;
+-        }
+-        if (flags & MapFlag::Write) {
+-            access |= GBM_BO_TRANSFER_WRITE;
+-        }
+-        m_mapPtr = gbm_bo_map(m_bo, 0, 0, m_dmabufAttributes.width, m_dmabufAttributes.height, access, &m_mapStride, &m_mapData);
+-    }
+-    return Map{
+-        .data = m_mapPtr,
+-        .stride = m_mapStride,
+-    };
+-}
+-
+-void GbmGraphicsBuffer::unmap()
+-{
+-    if (m_mapPtr) {
+-        gbm_bo_unmap(m_bo, m_mapData);
+-        m_mapPtr = nullptr;
+-        m_mapData = nullptr;
+-    }
+-}
+-
+ DumbGraphicsBuffer::DumbGraphicsBuffer(int drmFd, uint32_t handle, DmaBufAttributes attributes)
+     : m_drmFd(drmFd)
+     , m_handle(handle)
+-- 
+GitLab
+

diff --git a/kwin.spec b/kwin.spec
index 7d63450..2257a18 100644
--- a/kwin.spec
+++ b/kwin.spec
@@ -1,6 +1,6 @@
 Name:    kwin
 Version: 6.7.90
-Release: 1%{?dist}
+Release: 2%{?dist}
 Summary: KDE Window manager
 
 License: BSD-2-Clause AND BSD-3-Clause AND CC0-1.0 AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-only AND GPL-3.0-or-later AND LGPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND LGPL-3.0-only AND (GPL-2.0-only OR GPL-3.0-only) AND (LGPL-2.1-only OR LGPL-3.0-only) AND MIT
@@ -12,6 +12,11 @@ Source0: http://download.kde.org/%{stable_kf6}/plasma/%{maj_ver_kf6}.%{min_ver_k
 Source1: http://download.kde.org/%{stable_kf6}/plasma/%{maj_ver_kf6}.%{min_ver_kf6}.%{bug_ver_kf6}/%{name}-%{version}.tar.xz.sig
 
 ## upstream patches
+# Fix for kwin crashing when you switch users
+# https://invent.kde.org/plasma/kwin/-/commit/79c0aca568e281c2af8b7820281e7c38b31cf90d
+
+Patch0:  79c0aca568e281c2af8b7820281e7c38b31cf90d.patch
+
 
 ## proposed patches
 
@@ -283,6 +288,9 @@ ln -sr %{buildroot}%{_kf6_bindir}/kwin_wayland %{buildroot}%{_bindir}/kwin
 
 
 %changelog
+* Wed Sep 16 2026 Steve Cossette <farchord@gmail.com> - 6.7.90-2
+- Fix for kwin crashing on user switching
+
 * Thu Sep 10 2026 Steve Cossette <farchord@gmail.com> - 6.7.90-1
 - 6.7.90
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-16 16:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16 16:10 [rpms/kwin] rawhide: Fix for kwin crashing on user switching Steve Cossette

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox