Skip to content

drm/vc4: Fix out of order frames during asynchronous page flips - #4925

Merged
pelwell merged 1 commit into
raspberrypi:rpi-5.15.yfrom
mripard:rpi/5.15-out-of-order-frames
Mar 4, 2022
Merged

pelwell merged 1 commit into
raspberrypi:rpi-5.15.yfrom
mripard:rpi/5.15-out-of-order-frames

Conversation

@mripard

@mripard mripard commented Mar 4, 2022

Copy link
Copy Markdown
Contributor

This a port of the PR #4571 for 5.15, with the updated function name that was broken before.

@pelwell

pelwell commented Mar 4, 2022

Copy link
Copy Markdown
Contributor

Did you push the wrong patch? That looks like a direct cherry-pick of f694d1c.

@pelwell

pelwell commented Mar 4, 2022

Copy link
Copy Markdown
Contributor

It can wait until next week, though.

@popcornmix

Copy link
Copy Markdown
Collaborator

Agreed - this doesn't build on 5.15 due to dma fence api changes.

When doing an asynchronous page flip (PAGE_FLIP ioctl with the
DRM_MODE_PAGE_FLIP_ASYNC flag set), the current code waits for the
possible GPU buffer being rendered through a call to
vc4_queue_seqno_cb().

On the BCM2835-37, the GPU driver is part of the vc4 driver and that
function is defined in vc4_gem.c to wait for the buffer to be rendered,
and once it's done, call a callback.

However, on the BCM2711 used on the RaspberryPi4, the GPU driver is
separate (v3d) and that function won't do anything. This was working
because we were going into a path, due to uninitialized variables, that
was always scheduling the callback.

However, we were never actually waiting for the buffer to be rendered
which was resulting in frames being displayed out of order.

The generic API to signal those kind of completion in the kernel are the
DMA fences, and fortunately the v3d drivers supports them and signal
when its job is done. That API also provides an equivalent function that
allows to have a callback being executed when the fence is signalled as
done.

Let's change our driver a bit to rely on the previous function for the
older SoCs, and on DMA fences for the BCM2711.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
@mripard
mripard force-pushed the rpi/5.15-out-of-order-frames branch from b8ad842 to a81cb73 Compare March 4, 2022 19:09
@mripard

mripard commented Mar 4, 2022

Copy link
Copy Markdown
Contributor Author

Did you push the wrong patch? That looks like a direct cherry-pick of f694d1c.

No, I forgot to commit the changes I had locally... It should be ok now, sorry

@popcornmix

Copy link
Copy Markdown
Collaborator

This compiles now and kodi still runs. I don't have a test app that shows the out-of-order issue (but if it worked on 5.10 the odds seem good).

@pelwell
pelwell merged commit a2117c5 into raspberrypi:rpi-5.15.y Mar 4, 2022
@bluestang2006

Copy link
Copy Markdown

This compiles now and kodi still runs. I don't have a test app that shows the out-of-order issue (but if it worked on 5.10 the odds seem good).

Just tested this patch applied to rpi-5.16.y and it fixes the vsync issue with Quake3e and another OpenGL app I saw this issue with. Thanks for the fix. Closed #4901.

popcornmix added a commit to raspberrypi/firmware that referenced this pull request Mar 11, 2022
kernel: ARM: dts: bcm2711-rpi-ds: Disable the BCM2835 STC
See: #1702

kernel: KMS Writeback Fixes
See: raspberrypi/linux#4924

kernel: staging: vc04_services: codec: Add support for V4L2_PIX_FMT_RGBA32 format
See: raspberrypi/linux#4931

kernel: drm/vc4: Fix out of order frames during asynchronous page flips
See: raspberrypi/linux#4925
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Mar 11, 2022
kernel: ARM: dts: bcm2711-rpi-ds: Disable the BCM2835 STC
See: raspberrypi/firmware#1702

kernel: KMS Writeback Fixes
See: raspberrypi/linux#4924

kernel: staging: vc04_services: codec: Add support for V4L2_PIX_FMT_RGBA32 format
See: raspberrypi/linux#4931

kernel: drm/vc4: Fix out of order frames during asynchronous page flips
See: raspberrypi/linux#4925
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

Successfully merging this pull request may close these issues.

4 participants