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

drm/vc4: Add 2712 support to vc4_plane_async_set_fb #5827

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

6by9
Copy link
Contributor

@6by9 6by9 commented Jan 4, 2024

vc4_plane_async_set_fb directly overwrites the plane address in the dlist entry, but hadn't been updated for the GEN6 / 2712 dlist format, corrupting the address in the process.

Add support for the 2712 dlist format to the function.

Fixes: 1ab1fbb ("drm/vc4: hvs: Support BCM2712 HVS")

drivers/gpu/drm/vc4/vc4_plane.c Show resolved Hide resolved
* atomic updates that don't do a new modeset on our plane
* also use our updated address.
*/
vc4_state->dlist[vc4_state->ptr0_offset[0]] = addr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's surprising there isn't a helper function to update hw_dlist and the shadow dlist.

Copy link
Contributor Author

@6by9 6by9 Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This it the only place that the dlist gets mangled in this way.

The fragments for each plane get created in vc[46]_plane_set_mode.
vc4_hvs_atomic_flush then assembles the fragments into a complete list in the dlist memory.

This async update is the only place that does both in one hit.

Reviewing the code it feels a little fragile based on a number of major assumptions.
AIUI it only works on the primary plane, which would normally be the bottom-most but that isn't guaranteed. vc4_state->ptr0_offset[0] is the offset within the fragment, so it only works as long as it is the bottom-most plane and hence first in the dlist.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also this:

vc4_state->dlist[vc4_state->pos0_offset] =
new_vc4_state->dlist[vc4_state->pos0_offset];
vc4_state->dlist[vc4_state->pos2_offset] =
new_vc4_state->dlist[vc4_state->pos2_offset];
vc4_state->dlist[vc4_state->ptr0_offset[0]] =
new_vc4_state->dlist[vc4_state->ptr0_offset[0]];
/* Note that we can't just call vc4_plane_write_dlist()
* because that would smash the context data that the HVS is
* currently using.
*/
writel(vc4_state->dlist[vc4_state->pos0_offset],
&vc4_state->hw_dlist[vc4_state->pos0_offset]);
writel(vc4_state->dlist[vc4_state->pos2_offset],
&vc4_state->hw_dlist[vc4_state->pos2_offset]);
writel(vc4_state->dlist[vc4_state->ptr0_offset[0]],
&vc4_state->hw_dlist[vc4_state->ptr0_offset[0]]);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As amending that one needs to be a separate patch that is ideally applied before any 2712 stuff starts to be merged, can I take it as a task to be dealt with in the mainline patches?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course.

@bluestang2006
Copy link

@6by9 I've tested your branch recently and it does fix the issue at hand. I've added some more info to the issue report...the corruption happens when vsync is disabled only.

vc4_plane_async_set_fb directly overwrites the plane address in
the dlist entry, but hadn't been updated for the GEN6 / 2712
dlist format, corrupting the address in the process.

Add support for the 2712 dlist format to the function.

Fixes: 1ab1fbb ("drm/vc4: hvs: Support BCM2712 HVS")
Signed-off-by: Dave Stevenson <[email protected]>
@6by9
Copy link
Contributor Author

6by9 commented Jan 17, 2024

Had missed that I hadn't updated this after the review comments.
Done now to address popcornmix's comment about upper address bit masking. pelwell's comment on helper function will be left to deal with when upstreaming.

@pelwell pelwell merged commit 867a01a into raspberrypi:rpi-6.6.y Jan 17, 2024
11 of 12 checks passed
@6by9
Copy link
Contributor Author

6by9 commented Jan 17, 2024

Are we planning on another 6.1 release, and hence does this warrant a backport to 6.1?

@pelwell
Copy link
Contributor

pelwell commented Jan 17, 2024

Yes we are, and yes it does. We need to bump the 6.1 stable so that it gets feature parity with the upcoming 6.6 stable.

@6by9
Copy link
Contributor Author

6by9 commented Jan 17, 2024

Yes we are, and yes it does. We need to bump the 6.1 stable so that it gets feature parity with the upcoming 6.6 stable.

OK, I'll create a backport PR.

Checking the email thread with Igalia, there's a 2nd cleanup required in the async path too, but less critical.

popcornmix added a commit to raspberrypi/firmware that referenced this pull request Jan 18, 2024
See: raspberrypi/linux#5827

kernel: drm/vc4: Fix atomic_async_check to call the right mode_set function
See: raspberrypi/linux#5860
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Jan 18, 2024
See: raspberrypi/linux#5827

kernel: drm/vc4: Fix atomic_async_check to call the right mode_set function
See: raspberrypi/linux#5860
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