Message ID | 2c4b6086-00d6-9297-6ac7-4327e9a81208@xs4all.nl (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Hans, On Thu, Nov 30, 2017 at 06:14:13PM +0100, Hans Verkuil wrote: > Hi Maxime, Chen-Yu, > > When I connect my cubieboard running 4.15-rc1 to my 4k display I get > no picture. Some digging found that there is no check against the > upper pixelclock limit of the HDMI output, so X selects a 4kp60 > format at 594 MHz, which obviously won't work. > > I whipped up the quick patch below, but this information about the > max support HDMI frequency should probably come from the device > tree. Although for the A10 and A20 I guess it could also be > hardcoded in the source since this code is only used for sun4i. > > Anyway, when I use this patch I get a proper 1080p60 picture. Thanks for that patch! > Regards, > > Hans > > Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> > --- > diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c > index dda904ec0534..dc2f550f54ff 100644 > --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c > +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c > @@ -208,8 +208,17 @@ static int sun4i_hdmi_get_modes(struct drm_connector *connector) > return ret; > } > > +static int sun4i_hdmi_mode_valid(struct drm_connector *connector, > + struct drm_display_mode *mode) > +{ > + if (mode->clock > 170000) > + return MODE_CLOCK_HIGH; > + return MODE_OK; > +} > + This is slightly more complicated than that. Even if the hardware could be capable of achieving that rate, we might not be able to reach it due to other constraints (such as other device already running that would need to run at a particular rate. A more elegant solution would be to call clk_round_rate on mode->clock and see if the rate is close enough. You can have a look at what we have in sun4i_rgb_mode_valid if you want. It's still not optimal, as we have never been able to agree on what "close enough" is and we just went to the other extreme. If you have some input on that, it would be great :) Maxime
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index dda904ec0534..dc2f550f54ff 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -208,8 +208,17 @@ static int sun4i_hdmi_get_modes(struct drm_connector *connector) return ret; } +static int sun4i_hdmi_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) +{ + if (mode->clock > 170000) + return MODE_CLOCK_HIGH; + return MODE_OK; +} + static const struct drm_connector_helper_funcs sun4i_hdmi_connector_helper_funcs = { .get_modes = sun4i_hdmi_get_modes, + .mode_valid = sun4i_hdmi_mode_valid, }; static enum drm_connector_status
Hi Maxime, Chen-Yu, When I connect my cubieboard running 4.15-rc1 to my 4k display I get no picture. Some digging found that there is no check against the upper pixelclock limit of the HDMI output, so X selects a 4kp60 format at 594 MHz, which obviously won't work. I whipped up the quick patch below, but this information about the max support HDMI frequency should probably come from the device tree. Although for the A10 and A20 I guess it could also be hardcoded in the source since this code is only used for sun4i. Anyway, when I use this patch I get a proper 1080p60 picture. Regards, Hans Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> ---