Re: [PATCH v5 20/22] drm/vc4: vec: Convert to the new TV mode property

From: Mateusz Kwiatkowski
Date: Sun Oct 16 2022 - 14:56:35 EST


Hi Maxime,

Urgh. I cannot send e-mails apparently today, as I removed the second half of
the previous message. Here goes:

> @@ -454,13 +563,6 @@ static int vc4_vec_encoder_atomic_check(struct drm_encoder *encoder,
> struct drm_connector_state *conn_state)
> {
> const struct drm_display_mode *mode = &crtc_state->adjusted_mode;

You could add here something like:

+ const struct vc4_vec_tv_mode *tv_mode =
+ vc4_vec_tv_mode_lookup(conn_state->tv.mode);
+
+ if (!tv_mode)
+ return -EINVAL;

This should explicitly make it impossible to enter the equivalent condition in
vc4_vec_encoder_enable() that causes the problem mentioned in the previous
e-mail.

This is probably basically impossible already, but I triggered that when testing
a follow-up change I'd like to post shortly.

> - const struct vc4_vec_tv_mode *vec_mode;
> -
> - vec_mode = &vc4_vec_tv_modes[conn_state->tv.legacy_mode];
> -
> - if (conn_state->crtc &&
> - !drm_mode_equal(vec_mode->mode, &crtc_state->adjusted_mode))
> - return -EINVAL;

If you're removing the reference mode, then I think you should at least add
checks that the crtc_clock is set to 13.5 MHz (it's otherwise ignored) and that
crtc_htotal is either 858 or 864 (using a switch over reference_mode->htotal as
I proposed in my comment to patch 19/22 would double as such check), as all
other values causes VEC to output garbage.

Best regards,
Mateusz Kwiatkowski