drm/vc4: hdmi: Block odd horizontal timings
Subsystems (3)
PATCH 1/1 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.
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 12 ++++++++++++ drivers/gpu/drm/vc4/vc4_hdmi.h | 3 +++ 2 files changed, 15 insertions(+)
drivers/gpu/drm/vc4/vc4_hdmi.c +12 -0
@@ -879,6 +879,11 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder,struct vc4_hdmi *vc4_hdmi =encoder_to_vc4_hdmi (encoder);unsigned long long pixel_rate = mode->clock *1000 ; +if (vc4_hdmi->variant->broken_odd_h_timings && + ((mode->hdisplay %2 ) || (mode->hsync_start %2 ) || + (mode->hsync_end %2 ) || (mode->htotal %2 ))) +return -EINVAL ; +if (mode->flags &DRM_MODE_FLAG_DBLCLK ) pixel_rate *=2 ;
@@ -901,6 +906,11 @@ vc4_hdmi_encoder_mode_valid(struct drm_encoder *encoder, {struct vc4_hdmi *vc4_hdmi =encoder_to_vc4_hdmi (encoder); +if (vc4_hdmi->variant->broken_odd_h_timings && + ((mode->hdisplay %2 ) || (mode->hsync_start %2 ) || + (mode->hsync_end %2 ) || (mode->htotal %2 ))) +return MODE_H_ILLEGAL ; +if ((mode->clock *1000 ) > vc4_hdmi->variant->max_pixel_clock)return MODE_CLOCK_HIGH ;
@@ -1950,6 +1960,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = {PHY_LANE_2 , PHY_LANE_CK, }, + .broken_odd_h_timings = true, .init_resources = vc5_hdmi_init_resources, .csc_setup = vc5_hdmi_csc_setup,
@@ -1975,6 +1986,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = {PHY_LANE_CK , PHY_LANE_2, }, + .broken_odd_h_timings = true, .init_resources = vc5_hdmi_init_resources, .csc_setup = vc5_hdmi_csc_setup,
drivers/gpu/drm/vc4/vc4_hdmi.h +3 -0
@@ -62,6 +62,9 @@ struct vc4_hdmi_variant {*/ enum vc4_hdmi_phy_channel phy_lane_mapping[4 ]; +/* The BCM2711 cannot deal with odd horizontal pixel timings */ +bool broken_odd_h_timings; +/* Callback to get the resources (memory region, interrupts, * clocks, etc) for that variant. */
Signature · 7 lines
2.26.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi Maxime
Quoted 7 lines · Maxime Ripard
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 <[email protected]>
It's unsupported due to the architecture rather than broken.
I'd hope the compiler would convert "% 2" to "& 1" in these cases, but it's not a critical performance path anyway.
Quoted 64 lines
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 12 ++++++++++++ drivers/gpu/drm/vc4/vc4_hdmi.h | 3 +++ 2 files changed, 15 insertions(+)drivers/gpu/drm/vc4/vc4_hdmi.c +12
-0@@ -879,6 +879,11 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder,struct vc4_hdmi *vc4_hdmi =encoder_to_vc4_hdmi (encoder);unsigned long long pixel_rate = mode->clock *1000 ; +if (vc4_hdmi->variant->broken_odd_h_timings && + ((mode->hdisplay %2 ) || (mode->hsync_start %2 ) || + (mode->hsync_end %2 ) || (mode->htotal %2 ))) +return -EINVAL ; +if (mode->flags &DRM_MODE_FLAG_DBLCLK ) pixel_rate *=2 ;@@ -901,6 +906,11 @@ vc4_hdmi_encoder_mode_valid(struct drm_encoder *encoder, {struct vc4_hdmi *vc4_hdmi =encoder_to_vc4_hdmi (encoder); +if (vc4_hdmi->variant->broken_odd_h_timings && + ((mode->hdisplay %2 ) || (mode->hsync_start %2 ) || + (mode->hsync_end %2 ) || (mode->htotal %2 ))) +return MODE_H_ILLEGAL ; +if ((mode->clock *1000 ) > vc4_hdmi->variant->max_pixel_clock)return MODE_CLOCK_HIGH ;@@ -1950,6 +1960,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = {PHY_LANE_2 , PHY_LANE_CK, }, + .broken_odd_h_timings = true, .init_resources = vc5_hdmi_init_resources, .csc_setup = vc5_hdmi_csc_setup,@@ -1975,6 +1986,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = {PHY_LANE_CK , PHY_LANE_2, }, + .broken_odd_h_timings = true, .init_resources = vc5_hdmi_init_resources, .csc_setup = vc5_hdmi_csc_setup,drivers/gpu/drm/vc4/vc4_hdmi.h +3
-1@@ -62,6 +62,9 @@ struct vc4_hdmi_variant {*/ enum vc4_hdmi_phy_channel phy_lane_mapping[4 ]; +/* The BCM2711 cannot deal with odd horizontal pixel timings */ +bool broken_odd_h_timings; +/* Callback to get the resources (memory region, interrupts, * clocks, etc) for that variant. */ --
Quoted 2 lines
2.26.2
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi!
Quoted 10 lines · Dave Stevenson
Hi Maxime
Quoted 7 lines · Maxime Ripard
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 <[email protected]>
Thanks for your review
Quoted 1 line
It's unsupported due to the architecture rather than broken.
Would you prefer s/broken/unsupported/ then?
Maxime
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Dave Stevenson
maintainerQuoted 13 lines · Maxime Ripard
Hi!
Quoted 9 lines · Dave Stevenson
Hi Maxime
Quoted 6 lines · Maxime Ripard
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.
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Signed-off-by Maxime Ripard <[email protected]>Thanks for your review
Quoted 1 line
It's unsupported due to the architecture rather than broken.
Would you prefer s/broken/unsupported/ then?
If you needed to respin then yes, but it's not that big a deal.
Dave
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 16 lines · Dave Stevenson
Quoted 15 lines · Maxime Ripard
Hi!
Quoted 10 lines · Dave Stevenson
Hi Maxime
Quoted 7 lines · Maxime Ripard
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 <[email protected]>
Quoted 7 lines
Quoted 5 lines
Thanks for your review
Quoted 1 line
It's unsupported due to the architecture rather than broken.
Would you prefer s/broken/unsupported/ then?
If you needed to respin then yes, but it's not that big a deal.
It had a merge confict (with the 10/12 bit HDMI series) so I ended up sending a new version with that fixed.
Maxime
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel