Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hardware cursor is broken after mesa upgrade to 24.2.0 from 24.1.6 #2492

Open
xiaohuirong opened this issue Oct 9, 2024 · 10 comments
Open
Labels

Comments

@xiaohuirong
Copy link

Describe the bug
My graphics card is an AMD RX580. After upgrading Mesa from version 24.1.6 to 24.2.0, the hardware cursor broke, and Wayfire started using the software cursor.

To Reproduce
Steps to reproduce the behavior:

  1. activate the showrepaint plugin, observe the rendering box of the cursor when moving it.
    mpv-shot0001

Expected behavior
mpv-shot0002

Wayfire version

0.8.1.r320.g7dfe9149-1

Related issues:
hyprwm/Hyprland#7577
https://gitlab.freedesktop.org/mesa/mesa/-/issues/11817
hyprwm/aquamarine#71

@xiaohuirong xiaohuirong added the bug label Oct 9, 2024
@ammen99
Copy link
Member

ammen99 commented Oct 9, 2024

Haven't looked very deeply into the hyprland issue but hw cursors are managed pretty much entirely in wlroots, there isn't much we can do about them.

I would try the PR for wlroots 0.18 support in Wayfire, if the issue is present in wlroots 0.18, then open an issue on the wlroots bug tracker.

@xiaohuirong
Copy link
Author

Thank you for your quick response. I will try to add the DRM_FORMAT_MOD_INVALID modifier to the cursor based on the Hyprland patch.

@xiaohuirong
Copy link
Author

I wrote the following patch, which fixes this issue.

diff --git a/render/allocator/gbm.c b/render/allocator/gbm.c
index da035c668..056c99ca6 100644
--- a/render/allocator/gbm.c
+++ b/render/allocator/gbm.c
@@ -113,7 +113,15 @@ static struct wlr_gbm_buffer *create_buffer(struct wlr_gbm_allocator *alloc,
 		errno = 0;
 		bo = gbm_bo_create(gbm_device, width, height, format->format, usage);
 		has_modifier = false;
+	} else {
+		uint64_t modifier = gbm_bo_get_modifier(bo);
+		if (format->len == 1 &&
+				format->modifiers[0] == DRM_FORMAT_MOD_LINEAR && modifier == DRM_FORMAT_MOD_INVALID) {
+			fallback_modifier = DRM_FORMAT_MOD_LINEAR;
+			has_modifier = false;
+		}
 	}
+
 	if (bo == NULL) {
 		wlr_log_errno(WLR_ERROR, "gbm_bo_create failed");
 		return NULL;

@xiaohuirong
Copy link
Author

xiaohuirong commented Oct 9, 2024

The upstream issue still exists, so it's better to reopen it and close it after the upstream issue is fixed.

@xiaohuirong xiaohuirong reopened this Oct 9, 2024
@soreau
Copy link
Member

soreau commented Oct 9, 2024

Does it make a difference if you try running wayfire with WLR_DRM_NO_MODIFIERS=1 set?

@xiaohuirong
Copy link
Author

The issue is still there

Does it make a difference if you try running wayfire with WLR_DRM_NO_MODIFIERS=1 set?

Adding this environment variable did not fix the issue.

@soreau
Copy link
Member

soreau commented Oct 9, 2024

It seems this is an issue that can be fixed in either wlroots or mesa, but not wayfire. I would recommend filing a report with wlroots and/or mesa.

@xiaohuirong
Copy link
Author

It seems this is an issue that can be fixed in either wlroots or mesa, but not wayfire. I would recommend filing a report with wlroots and/or mesa.

Okay, I will file a report for wlroots.

@xiaohuirong
Copy link
Author

xiaohuirong commented Oct 9, 2024

Here is the report sent to wlroots.
https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3905

@soreau
Copy link
Member

soreau commented Oct 9, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants