Closed PotatoMania closed 2 weeks ago
Thanks for the report, and you're totally correct that we need to handle the condition.
I had been stopping and restarting my display numerous times through kmstest
, but that obviously didn't hit the same situation you have.
I think the correct logic is actually
if (!vc4_encoder || vc4_encoder->type != VC4_ENCODER_TYPE_DSI0)
CRTC_WRITE(PV_INTEN, 0);
as if the crtc isn't connected to an encoder we want to disable the interrupts. It'll always get enabled again in vc4_enable_vblank
I'll give it a test and create a PR.
I tested the updated logic and the bug looks fixed to me :D
More context:
prepare_prev_first
to workSee PR #6151
Describe the bug
It seems commit 63c0bcc4b7474c220c47a661526744edac18e75a introduced a bug, that when re-enabling DSI panels, the driver may fail due to NULL pointer dereference.
https://github.com/raspberrypi/linux/blob/dda85fda5b2dda7c4e2ba18770bd2033313006d2/drivers/gpu/drm/vc4/vc4_crtc.c#L826-L841
Here
vc4_encoder
may be NULL in some cases.Steps to reproduce the behaviour
Running sway, run the following script to turn off/on the display, maybe a few times
Device (s)
Raspberry Pi CM3 Lite, Raspberry Pi CM4
System
dda85fda5b2dda7c4e2ba18770bd2033313006d2
)Logs
When error occurs:
Additional context
I changed
if (vc4_encoder->type != VC4_ENCODER_TYPE_DSI0)
toif (vc4_encoder && vc4_encoder->type != VC4_ENCODER_TYPE_DSI0)
and the error never shows up. But I think it's not a desired behavior.