Daniel Gessel
Posts: 117
Joined: Sun Dec 03, 2017 1:47 am
Location: Boston area, MA, US
Contact: Website Twitter

Tearing in kmscube on Pi4

Fri Dec 20, 2019 4:04 pm

I modeled some kms based page flipping code on kmscube which I cloned from:

https://gitlab.freedesktop.org/mesa/kmscube.git

and see tearing on my Pi4 at the top of the screen.

So I went back to kmscube and modified the beginning of draw_cube_smooth (in cube-smooth.c) to draw a moving vertical red line and see tearing there too.

The beginning of draw_cube_smooth now looks like:

Code: Select all

static void draw_cube_smooth(unsigned i)
{
	ESMatrix modelview;

	/* clear the color buffer */
	glClearColor(0, 0, 0, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);

	glEnable(GL_SCISSOR_TEST);
	glClearColor(1.0, 0, 0, 1.0);
	glScissor(i * 10 % (wd - 10), 0, 10, ht);
	glClear(GL_COLOR_BUFFER_BIT);
	glDisable(GL_SCISSOR_TEST);
Can anyone confirm this, or has anyone seen other issues with tearing, before I try to figure out how to post a bug report? Thanks!

PS: I see tearing on a Pi3 as well, but it disappears after a few seconds.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7906
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Tearing in kmscube on Pi4

Fri Dec 20, 2019 5:16 pm

There is an implementation issue in FKMS at present that means we're reporting frame flip completition early. It's being investigated.

vc4-kms-v3d on a Pi3 should be clean.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
dividuum
Posts: 207
Joined: Sun Jun 16, 2013 1:18 pm
Location: Germany
Contact: Website

Re: Tearing in kmscube on Pi4

Fri Dec 20, 2019 7:08 pm

6by9 wrote:
Fri Dec 20, 2019 5:16 pm
There is an implementation issue in FKMS at present that means we're reporting frame flip completition early. It's being investigated.
That's great to hear. This tearing issue was driving me crazy and I tried a lot of variations of my vsync code to make it work. None did so far :-O

Happy to test this once it's available.
info-beamer hosted - A user and programmer friendly digital signage platform for the Pi: https://info-beamer.com/hosted

Daniel Gessel
Posts: 117
Joined: Sun Dec 03, 2017 1:47 am
Location: Boston area, MA, US
Contact: Website Twitter

Re: Tearing in kmscube on Pi4

Mon Dec 23, 2019 8:18 pm

Thanks for this info. Btw, does anybody know if Kms ioctl setcrtc waits for a vblank? I was trying to use setcrtc only to have a non-vsync path but I still seem to be limited to refresh rate.

User avatar
dividuum
Posts: 207
Joined: Sun Jun 16, 2013 1:18 pm
Location: Germany
Contact: Website

Re: Tearing in kmscube on Pi4

Thu Jan 02, 2020 4:35 pm

6by9 wrote:
Fri Dec 20, 2019 5:16 pm
There is an implementation issue in FKMS at present that means we're reporting frame flip completition early. It's being investigated.
Any hint which issue to track? Or should I open one? I guess this is an issue in the kernel, not Mesa?
info-beamer hosted - A user and programmer friendly digital signage platform for the Pi: https://info-beamer.com/hosted

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24969
Joined: Sat Jul 30, 2011 7:41 pm

Re: Tearing in kmscube on Pi4

Thu Jan 02, 2020 4:55 pm

dividuum wrote:
Thu Jan 02, 2020 4:35 pm
6by9 wrote:
Fri Dec 20, 2019 5:16 pm
There is an implementation issue in FKMS at present that means we're reporting frame flip completition early. It's being investigated.
Any hint which issue to track? Or should I open one? I guess this is an issue in the kernel, not Mesa?
It could be in the VC firmware, but @6by9 would need to confirm.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5398
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Tearing in kmscube on Pi4

Mon Jan 06, 2020 3:54 pm

jamesh wrote:
Thu Jan 02, 2020 4:55 pm
It could be in the VC firmware, but @6by9 would need to confirm.
Yes, raspberrypi/firmware is best (it is the interface between firmware and kernel, so a fix is likely to affect both).
It doesn't appear to be a mesa issue (problem not observed on vc4-kms-v3d on Pi3).

User avatar
dividuum
Posts: 207
Joined: Sun Jun 16, 2013 1:18 pm
Location: Germany
Contact: Website

Re: Tearing in kmscube on Pi4

Mon Jan 06, 2020 3:55 pm

dom wrote:
Mon Jan 06, 2020 3:54 pm
jamesh wrote:
Thu Jan 02, 2020 4:55 pm
It could be in the VC firmware, but @6by9 would need to confirm.
Yes, raspberrypi/firmware is best (it is the interface between firmware and kernel, so a fix is likely to affect both).
It doesn't appear to be a mesa issue (problem not observed on vc4-kms-v3d on Pi3).
Thanks dom.
info-beamer hosted - A user and programmer friendly digital signage platform for the Pi: https://info-beamer.com/hosted

Return to “OpenGLES”