drm/vc4: Add option to call from crtc to encoder on vblank

DSI0 is misbehaving and needs to action things on vblank to
work around it.
Add a new hook to call across during vblank.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
This commit is contained in:
Dave Stevenson
2024-04-05 17:34:09 +01:00
committed by Phil Elwell
parent ec198c390e
commit 63c0bcc4b7
2 changed files with 12 additions and 1 deletions

View File

@@ -827,11 +827,14 @@ static void vc4_disable_vblank(struct drm_crtc *crtc)
{
struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
struct drm_device *dev = crtc->dev;
struct drm_encoder *encoder = vc4_get_crtc_encoder(crtc, crtc->state);
struct vc4_encoder *vc4_encoder = to_vc4_encoder(encoder);
int idx;
if (!drm_dev_enter(dev, &idx))
return;
if (vc4_encoder->type != VC4_ENCODER_TYPE_DSI0)
CRTC_WRITE(PV_INTEN, 0);
drm_dev_exit(idx);
@@ -877,7 +880,14 @@ static void vc4_crtc_handle_page_flip(struct vc4_crtc *vc4_crtc)
void vc4_crtc_handle_vblank(struct vc4_crtc *crtc)
{
struct drm_encoder *encoder = vc4_get_crtc_encoder(&crtc->base, crtc->base.state);
struct vc4_encoder *vc4_encoder = to_vc4_encoder(encoder);
crtc->t_vblank = ktime_get();
if (vc4_encoder && vc4_encoder->vblank)
vc4_encoder->vblank(encoder);
drm_crtc_handle_vblank(&crtc->base);
vc4_crtc_handle_page_flip(crtc);
}

View File

@@ -503,6 +503,7 @@ struct vc4_encoder {
void (*post_crtc_disable)(struct drm_encoder *encoder, struct drm_atomic_state *state);
void (*post_crtc_powerdown)(struct drm_encoder *encoder, struct drm_atomic_state *state);
void (*vblank)(struct drm_encoder *encoder);
};
#define to_vc4_encoder(_encoder) \