Skip to content

Commit 57fb32e

Browse files
committed
drm/vc4: hdmi: Block odd horizontal timings
The FIFO between the pixelvalve and the HDMI controller runs at 2 pixels per clock cycle, and cannot deal with odd timings. Let's reject any mode with such timings. Signed-off-by: Maxime Ripard <maxime@cerno.tech> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Link: https://patchwork.freedesktop.org/patch/msgid/20201029122522.1917579-2-maxime@cerno.tech
1 parent 63495f6 commit 57fb32e

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

drivers/gpu/drm/vc4/vc4_hdmi.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,11 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
768768
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
769769
unsigned long long pixel_rate = mode->clock * 1000;
770770

771+
if (vc4_hdmi->variant->unsupported_odd_h_timings &&
772+
((mode->hdisplay % 2) || (mode->hsync_start % 2) ||
773+
(mode->hsync_end % 2) || (mode->htotal % 2)))
774+
return -EINVAL;
775+
771776
if (pixel_rate > vc4_hdmi->variant->max_pixel_clock)
772777
return -EINVAL;
773778

@@ -780,6 +785,11 @@ vc4_hdmi_encoder_mode_valid(struct drm_encoder *encoder,
780785
{
781786
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
782787

788+
if (vc4_hdmi->variant->unsupported_odd_h_timings &&
789+
((mode->hdisplay % 2) || (mode->hsync_start % 2) ||
790+
(mode->hsync_end % 2) || (mode->htotal % 2)))
791+
return MODE_H_ILLEGAL;
792+
783793
if ((mode->clock * 1000) > vc4_hdmi->variant->max_pixel_clock)
784794
return MODE_CLOCK_HIGH;
785795

@@ -1832,6 +1842,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = {
18321842
PHY_LANE_2,
18331843
PHY_LANE_CK,
18341844
},
1845+
.unsupported_odd_h_timings = true,
18351846

18361847
.init_resources = vc5_hdmi_init_resources,
18371848
.csc_setup = vc5_hdmi_csc_setup,
@@ -1857,6 +1868,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = {
18571868
PHY_LANE_CK,
18581869
PHY_LANE_2,
18591870
},
1871+
.unsupported_odd_h_timings = true,
18601872

18611873
.init_resources = vc5_hdmi_init_resources,
18621874
.csc_setup = vc5_hdmi_csc_setup,

drivers/gpu/drm/vc4/vc4_hdmi.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ struct vc4_hdmi_variant {
6262
*/
6363
enum vc4_hdmi_phy_channel phy_lane_mapping[4];
6464

65+
/* The BCM2711 cannot deal with odd horizontal pixel timings */
66+
bool unsupported_odd_h_timings;
67+
6568
/* Callback to get the resources (memory region, interrupts,
6669
* clocks, etc) for that variant.
6770
*/

0 commit comments

Comments
 (0)