[kwin] [Bug 443357] Real cursor position is slightly offset from displayed position on Wayland in virtual machine

2021-10-06 Thread Andrey
https://bugs.kde.org/show_bug.cgi?id=443357

Andrey  changed:

   What|Removed |Added

 Resolution|FIXED   |DUPLICATE

--- Comment #10 from Andrey  ---


*** This bug has been marked as a duplicate of bug 427060 ***

-- 
You are receiving this mail because:
You are watching all bug changes.

[kwin] [Bug 443357] Real cursor position is slightly offset from displayed position on Wayland in virtual machine

2021-10-06 Thread Adam Williamson
https://bugs.kde.org/show_bug.cgi?id=443357

--- Comment #9 from Adam Williamson  ---
Thanks for the check, both of you. I've applied that to our package downstream.
Sounds like no more upstream 5.22 releases are planned, so I won't bother
submitting it for that branch.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kwin] [Bug 443357] Real cursor position is slightly offset from displayed position on Wayland in virtual machine

2021-10-06 Thread Andrey
https://bugs.kde.org/show_bug.cgi?id=443357

--- Comment #8 from Andrey  ---
(In reply to Adam Williamson from comment #5)
> CCing Andrey Butirsky, who wrote the fix on the development
> branch - Andrey, would you possibly have time to see if this can be fixed on
> the 5.22 code? Thanks!

If it's still needed - your patch above looks OK

-- 
You are receiving this mail because:
You are watching all bug changes.

[kwin] [Bug 443357] Real cursor position is slightly offset from displayed position on Wayland in virtual machine

2021-10-06 Thread David Edmundson
https://bugs.kde.org/show_bug.cgi?id=443357

David Edmundson  changed:

   What|Removed |Added

 Status|REPORTED|RESOLVED
 Resolution|--- |FIXED
 CC||k...@davidedmundson.co.uk

--- Comment #7 from David Edmundson  ---
>Aha. Looks like this was fixed on the development branch:

Indeed.

That patch looks ok.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kwin] [Bug 443357] Real cursor position is slightly offset from displayed position on Wayland in virtual machine

2021-10-06 Thread Adam Williamson
https://bugs.kde.org/show_bug.cgi?id=443357

--- Comment #6 from Adam Williamson  ---
Oh, hmm, think I may have managed it myself after all. Does anyone see anything
wrong with this?

diff --git a/src/plugins/platforms/drm/drm_output.cpp
b/src/plugins/platforms/drm/drm_output.cpp
index 917bb857d..7ee387219 100644
--- a/src/plugins/platforms/drm/drm_output.cpp
+++ b/src/plugins/platforms/drm/drm_output.cpp
@@ -102,10 +102,15 @@ bool DrmOutput::hideCursor()
 return drmModeSetCursor(m_gpu->fd(), m_crtc->id(), 0, 0, 0) == 0;
 }

-bool DrmOutput::showCursor(DrmDumbBuffer *c)
+bool DrmOutput::showCursor(DrmDumbBuffer *c, const QPoint &hotspot)
 {
 const QSize &s = c->size();
-if (drmModeSetCursor(m_gpu->fd(), m_crtc->id(), c->handle(), s.width(),
s.height()) == 0) {
+int ret = drmModeSetCursor2(m_gpu->fd(), m_crtc->id(), c->handle(),
s.width(), s.height(), hotspot.x(), hotspot.y());
+if (ret == ENOTSUP) {
+// for NVIDIA case that does not support drmModeSetCursor2
+ret = drmModeSetCursor(m_gpu->fd(), m_crtc->id(), c->handle(),
s.width(), s.height());
+}
+if (ret == 0) {
 if (RenderLoopPrivate::get(m_renderLoop)->presentMode ==
RenderLoopPrivate::SyncMode::Adaptive
 && isCursorVisible()) {
 m_renderLoop->scheduleRepaint();
@@ -122,7 +127,8 @@ bool DrmOutput::showCursor()
 return false;
 }

-const bool ret = showCursor(m_cursor[m_cursorIndex].data());
+const Cursor * const cursor = Cursors::self()->currentCursor();
+const bool ret = showCursor(m_cursor[m_cursorIndex].data(),
logicalToNativeMatrix(cursor->rect(), scale(),
transform()).map(cursor->hotspot()));
 if (!ret) {
 qCDebug(KWIN_DRM) << "DrmOutput::showCursor(DrmDumbBuffer) failed";
 return ret;
diff --git a/src/plugins/platforms/drm/drm_output.h
b/src/plugins/platforms/drm/drm_output.h
index 1f89f9064..af46c88a0 100644
--- a/src/plugins/platforms/drm/drm_output.h
+++ b/src/plugins/platforms/drm/drm_output.h
@@ -45,7 +45,7 @@ public:
 ///queues deleting the output after a page flip has completed.
 void teardown();
 void releaseGbm();
-bool showCursor(DrmDumbBuffer *buffer);
+bool showCursor(DrmDumbBuffer *buffer, const QPoint &hotspot);
 bool showCursor();
 bool hideCursor();
 bool updateCursor();
-- 
2.32.0

-- 
You are receiving this mail because:
You are watching all bug changes.

[kwin] [Bug 443357] Real cursor position is slightly offset from displayed position on Wayland in virtual machine

2021-10-06 Thread Adam Williamson
https://bugs.kde.org/show_bug.cgi?id=443357

Adam Williamson  changed:

   What|Removed |Added

 CC||butir...@gmail.com

--- Comment #5 from Adam Williamson  ---
So, it looks like the DrmPipeline addition changed all the cursor setting code
considerably, such that it's beyond me how the bug can be fixed on the 5.22
branch. CCing Andrey Butirsky, who wrote the fix on the development branch -
Andrey, would you possibly have time to see if this can be fixed on the 5.22
code? Thanks!

-- 
You are receiving this mail because:
You are watching all bug changes.

[kwin] [Bug 443357] Real cursor position is slightly offset from displayed position on Wayland in virtual machine

2021-10-06 Thread Adam Williamson
https://bugs.kde.org/show_bug.cgi?id=443357

Adam Williamson  changed:

   What|Removed |Added

Version|unspecified |git-stable-Plasma/5.22

--- Comment #4 from Adam Williamson  ---
Aha. Looks like this was fixed on the development branch:

https://github.com/KDE/kwin/commit/998bbf4eba724a9b94a5bae62182456b85b11383#diff-034885748897f413c645e3efd125d7c0db9a8454d580f6093e40c885d974c818

unfortunately, that was after a big change that moved a ton of code around:

https://github.com/KDE/kwin/commit/586efe94d4f3b2c9759a26f27661edcaa54dce0b#diff-034885748897f413c645e3efd125d7c0db9a8454d580f6093e40c885d974c818

I'll have a go at backporting it to the 5.22 stable branch today, as that's
what we need downstream for Fedora 35.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kwin] [Bug 443357] Real cursor position is slightly offset from displayed position on Wayland in virtual machine

2021-10-06 Thread Adam Williamson
https://bugs.kde.org/show_bug.cgi?id=443357

--- Comment #3 from Adam Williamson  ---
jadahl - who dealt with the similar problems on the mutter (GNOME) side -
passes this along:

"one possibility is that kde changed to do what mutter did for a while, which
is to emulate atomic mode setting with legacy mode setting. what mutter did was
to offset things manually, always setting a 0,0 hotspot. when the virtual
machine viewer bugs showed up, I had to re-introduce the hotspot to the atomic
mode setting layer even if it couldn't be used"

-- 
You are receiving this mail because:
You are watching all bug changes.

[kwin] [Bug 443357] Real cursor position is slightly offset from displayed position on Wayland in virtual machine

2021-10-05 Thread bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=443357

tagwer...@innerjoin.org changed:

   What|Removed |Added

 CC||tagwer...@innerjoin.org

-- 
You are receiving this mail because:
You are watching all bug changes.

[kwin] [Bug 443357] Real cursor position is slightly offset from displayed position on Wayland in virtual machine

2021-10-05 Thread Rex Dieter
https://bugs.kde.org/show_bug.cgi?id=443357

Rex Dieter  changed:

   What|Removed |Added

 CC||rdie...@gmail.com

-- 
You are receiving this mail because:
You are watching all bug changes.

[kwin] [Bug 443357] Real cursor position is slightly offset from displayed position on Wayland in virtual machine

2021-10-05 Thread Adam Williamson
https://bugs.kde.org/show_bug.cgi?id=443357

Adam Williamson  changed:

   What|Removed |Added

Summary|Don't use atomic mode   |Real cursor position is
   |setting with virtual GPUs   |slightly offset from
   |(causes cursor offset)  |displayed position on
   ||Wayland in virtual machine

-- 
You are receiving this mail because:
You are watching all bug changes.