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

ts_calibrate screen freezes on kernels >5.6/8 and intel graphic hardware #202

Open
pfink-christ opened this issue Aug 22, 2022 · 0 comments

Comments

@pfink-christ
Copy link
Contributor

pfink-christ commented Aug 22, 2022

Hi @merge we discovered that ts_calibrate is not working reliably on newer kernels on some devices.

Specifically this means that the calibration cross hangs in the left top corner while the calibration beneath is working as expected.
Initially we saw the problem with a debian kernel/image update from 4.19 to 5.10.

After ruling out other factors and a long (or actually two) kernel bisect rounds i narrowed the problem down to two commits where the behavior changes:

After commit 64914da24ea9 it was not possible to start ts_calibrate on a fresh ubuntu with mainline kernel multiple times. With this change ts_calibrate sometimes vanishes into the background or you could only start it one, twice, four times...but after enough starts you would finally end up with it starting, but still seeing the ubuntu desktop and only seeing it briefly after 5 touches.
I tested a possible solution to counter what I understood from the change and some other sources. It seems to improve the start behavior....but one single time out of a lot of tries I was able to get the old behavior with the next try being ok again. So maybe there was some other issue or it doesn't really solve the problem. I don't know. Here is the possible solution that I came up with...has to to with how the drm master acquires access (or something like that) and because it's not forced unconditionally anymore you have to switch to KD_TEXT first before KD_GRAPHICS. I tried to find my source where I read this, but could not find it anymore...thinking about it makes me wonder if I really understood it correctly. Nevertheless it improves the behavior for me:

--- a/tests/fbutils-linux.c
+++ b/tests/fbutils-linux.c
@@ -112,6 +112,10 @@ int open_framebuffer(void)
                }
 #endif

+               /* set to console mode first because of kernel change */
+               if (ioctl(con_fd, KDSETMODE, KD_TEXT) < 0)
+                       perror("KDSETMODE");
+
                if (ioctl(con_fd, KDSETMODE, KD_GRAPHICS) < 0) {
                        perror("KDSETMODE");
                        close(con_fd);

This fixes ts_calibrate until 691f7ba58d52 where FBC is activated. This might be only relevant for some hardware, as I'm on intel i3-7100U and celeron N3350.

Here currently my workaround is just deactivating framebuffer compression:

echo 0 > /sys/kernel/debug/dri/0/i915_params/enable_fbc or adding i915.enable_fbc=0 to the kernel cmdline.

This also makes the first workaround abundant. I just added it for full disclosure.

If more people encounter this problem I would suggest integrating other countermeasures directly into fbutils-linux.c where we force fbc to invalidate and recompress the buffer. Maybe the idea from the comment to call intel_fbc_invalidate/flush() would be the way to go, but currently I didn't research this any further. Just wanted to publish my workaround for other people having such problems.

@merge if you have specific ideas how and if you want to tackle this issue I'm willing to create a proposal and a PR. But currently I'm a bit out of my waters as far as framebuffer and drm are concerned.

Regards,
Peter

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

No branches or pull requests

1 participant