drm: bridge/dw_hdmi: Filter modes > 165MHz for DVI
Subsystems (3)
PATCH 1/1 drm: bridge/dw_hdmi: Filter modes > 165MHz for DVI
If you plug in a DVI monitor to your HDMI port, you need to filter out clocks > 165MHz. That's because 165MHz is the maximum clock rate that we can run single-link DVI at.
If you want to run high resolutions to DVI, you'd need some type of an active adapter that pretended that it was HDMI, interpreted the signal, and produced a new dual link DVI signal at a lower clock rate.
---
Note: this patch was tested against a 3.14 kernel with backports. It was only compile tested against linuxnext, but the code is sufficiently similar that I'm convinced it will work there.
drivers/gpu/drm/bridge/dw_hdmi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/bridge/dw_hdmi.c +4 -0
@@ -1421,8 +1421,12 @@ dw_hdmi_connector_mode_valid(struct drm_connector *connector, {struct dw_hdmi *hdmi =container_of (connector, struct dw_hdmi, connector); +struct hdmi_vmode *vmode = &hdmi->hdmi_data.video_mode;enum drm_mode_status mode_status =MODE_OK ; +if (mode->clock >165000 && vmode->mdvi) +return MODE_BAD ; +if (hdmi->plat_data->mode_valid) mode_status = hdmi->plat_data->mode_valid (connector, mode);
Signature · 1 line
2.4.3.573.g4eafbef
Quoted 8 lines · Doug Anderson
If you plug in a DVI monitor to your HDMI port, you need to filter out clocks > 165MHz. That's because 165MHz is the maximum clock rate that we can run single-link DVI at.
If you want to run high resolutions to DVI, you'd need some type of an active adapter that pretended that it was HDMI, interpreted the signal, and produced a new dual link DVI signal at a lower clock rate.
Quoted 5 lines
Signed-off-by Doug Anderson <[email protected]>---
Note: this patch was tested against a 3.14 kernel with backports. It was only compile tested against linuxnext, but the code is sufficiently similar that I'm convinced it will work there.
Really? I have to wonder what your testing was...
hdmi->vic = drm_match_cea_mode(mode);
if (!hdmi->vic) {
dev_dbg(hdmi->dev, "Non-CEA mode used in HDMI\n");
hdmi->hdmi_data.video_mode.mdvi = true;
} else {
dev_dbg(hdmi->dev, "CEA mode used vic=%d\n", hdmi->vic);
hdmi->hdmi_data.video_mode.mdvi = false;
}mdvi indicates whether the _currently set mode_ is a CEA mode or not (imho, it's mis-named). It doesn't indicate whether we have a HDMI display device or a DVI display device connected, which seems to be what you want to use it for below.
To sort that, what you need to do is detect a HDMI display device using drm_detect_hdmi_monitor() on the EDID received from the device before parsing the modes, and save that value in a dw_hdmi struct member, and I'd suggest that it's a top-level struct member, not buried in 'hdmi_data' or 'video_mode'.
Signature · 6 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Russell,
Quoted 32 lines · Russell King - ARM Linux
Quoted 8 lines · Doug Anderson
If you plug in a DVI monitor to your HDMI port, you need to filter out clocks > 165MHz. That's because 165MHz is the maximum clock rate that we can run single-link DVI at.
If you want to run high resolutions to DVI, you'd need some type of an active adapter that pretended that it was HDMI, interpreted the signal, and produced a new dual link DVI signal at a lower clock rate.
Quoted 5 lines
Signed-off-by Doug Anderson <[email protected]>---
Note: this patch was tested against a 3.14 kernel with backports. It was only compile tested against linuxnext, but the code is sufficiently similar that I'm convinced it will work there.Really? I have to wonder what your testing was...
hdmi->vic = drm_match_cea_mode(mode); if (!hdmi->vic) { dev_dbg(hdmi->dev, "Non-CEA mode used in HDMI\n"); hdmi->hdmi_data.video_mode.mdvi = true; } else { dev_dbg(hdmi->dev, "CEA mode used vic=%d\n", hdmi->vic); hdmi->hdmi_data.video_mode.mdvi = false; }mdvi indicates whether the
_currentlysetmode_is a CEA mode or not (imho, it's mis-named). It doesn't indicate whether we have a HDMI display device or a DVI display device connected, which seems to be what you want to use it for below.
Quoted 5 lines
To sort that, what you need to do is detect a HDMI display device using
drm_detect_hdmi_monitor()on the EDID received from the device before parsing the modes, and save that value in adw_hdmistruct member, and I'd suggest that it's a top-level struct member, not buried in 'hdmi_data' or 'video_mode'.
OK, so clearly my patch won't work against mainline. I guess it's a good thing that I pointed out that it was only tested locally (would have been better to test against mainline, but I don't think that's so easy since there are several unlanded patches in mainline for Rockchip).
As pointed out by others at <http://crosreview.com/278255>, locally our kernel has a slightly older version of
<https://lkml.org/lkml/2015/2/28/291>, which would change mdvi to be as needed.
...so I guess my change is blocked on someone reviewing/landing that series. If that series is rejected (or is changed sufficiently so that mdvi no longer is set via drm_detect_hdmi_monitor() then my patch will need to be re-spun.
-Doug
Quoted 42 lines · Doug Anderson
Russell,
Quoted 32 lines · Russell King - ARM Linux
Quoted 8 lines · Doug Anderson
If you plug in a DVI monitor to your HDMI port, you need to filter out clocks > 165MHz. That's because 165MHz is the maximum clock rate that we can run single-link DVI at.
If you want to run high resolutions to DVI, you'd need some type of an active adapter that pretended that it was HDMI, interpreted the signal, and produced a new dual link DVI signal at a lower clock rate.
Quoted 5 lines
Signed-off-by Doug Anderson <[email protected]>---
Note: this patch was tested against a 3.14 kernel with backports. It was only compile tested against linuxnext, but the code is sufficiently similar that I'm convinced it will work there.Really? I have to wonder what your testing was...
hdmi->vic = drm_match_cea_mode(mode); if (!hdmi->vic) { dev_dbg(hdmi->dev, "Non-CEA mode used in HDMI\n"); hdmi->hdmi_data.video_mode.mdvi = true; } else { dev_dbg(hdmi->dev, "CEA mode used vic=%d\n", hdmi->vic); hdmi->hdmi_data.video_mode.mdvi = false; }mdvi indicates whether the
_currentlysetmode_is a CEA mode or not (imho, it's mis-named). It doesn't indicate whether we have a HDMI display device or a DVI display device connected, which seems to be what you want to use it for below.Quoted 5 lines
To sort that, what you need to do is detect a HDMI display device using
drm_detect_hdmi_monitor()on the EDID received from the device before parsing the modes, and save that value in adw_hdmistruct member, and I'd suggest that it's a top-level struct member, not buried in 'hdmi_data' or 'video_mode'.
Quoted 5 lines
OK, so clearly my patch won't work against mainline. I guess it's a good thing that I pointed out that it was only tested locally (would have been better to test against mainline, but I don't think that's so easy since there are several unlanded patches in mainline for Rockchip).
As far as I'm aware, Freescale's original BSP version was the same, as is their later BSPs, and Jon's maintained 3.14-stable kernel.
Quoted 4 lines
As pointed out by others at <http://crosreview.com/278255>, locally our kernel has a slightly older version of
<https://lkml.org/lkml/2015/2/28/291>, which would change mdvi to be as needed.
Please don't post unreliable lkml.org URLs, please use some other archive site. I can't access this URL at the moment.
Quoted 4 lines
...so I guess my change is blocked on someone reviewing/landing that series. If that series is rejected (or is changed sufficiently so that mdvi no longer is set via
drm_detect_hdmi_monitor()then my patch will need to be re-spun.
That's not what I said. I said mdvi is set according to whether the mode being set is a CEA mode or not. We need something set according to the return value of drm_detect_hdmi_monitor(), which will tell us if the connected sink is a HDMI device or a DVI device (based upon the EDID.)
A thought occurs to me this morning though: what happens if you connect a DVI monitor to an AV receiver which is then connected to this device. Does the resulting EDID contain the HDMI vendor ID? If it does, it means that drm_detect_hdmi_monitor() will return true, indicating that the connected device is HDMI, and we will still allow modes greater than 165MHz.
That's probably a scenario that should be checked at some point... and it would throw a question mark over whether this is the correct approach to limit the video modes.
Signature · 6 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Russell,
Quoted 8 lines · Russell King - ARM Linux
Quoted 5 lines
OK, so clearly my patch won't work against mainline. I guess it's a good thing that I pointed out that it was only tested locally (would have been better to test against mainline, but I don't think that's so easy since there are several unlanded patches in mainline for Rockchip).
As far as I'm aware, Freescale's original BSP version was the same, as is their later BSPs, and Jon's maintained 3.14-stable kernel.
Was "the same"? You mean was untested, or was 3.14? It is probably not the same "3.14 with backports" that I'm testing on, which includes backports + things from the mailing list that haven't landed yet, as many of the unlanded patches are things that make Rockchip HDMI work more correctly. Perhaps I should have called my tree "3.14 with backports + unlanded patches" or "the chromeos 3.14 tree" to make it clearer.
In general I haven't been posting patches that I've made to HDMI since it appears that our tree has significant differences from mainline. In this case the function I was touching looked identical to mainline so I figured posting a patch seemed reasonable.
Quoted 7 lines
Quoted 4 lines
As pointed out by others at <http://crosreview.com/278255>, locally our kernel has a slightly older version of
<https://lkml.org/lkml/2015/2/28/291>, which would change mdvi to be as needed.Please don't post unreliable lkml.org URLs, please use some other archive site. I can't access this URL at the moment.
Perhaps you can try <https://patchwork.kernel.org/patch/5906771/>
Quoted 7 lines
Quoted 4 lines
...so I guess my change is blocked on someone reviewing/landing that series. If that series is rejected (or is changed sufficiently so that mdvi no longer is set via
drm_detect_hdmi_monitor()then my patch will need to be re-spun.That's not what I said. I said mdvi is set according to whether the mode being set is a CEA mode or not.
Perhaps now that you can access the patch with the patchwork link you can re-read my email. If/when that patch lands then mdvi _will_ be set as per drm_detect_hdmi_monitor().
Quoted 6 lines
A thought occurs to me this morning though: what happens if you connect a DVI monitor to an AV receiver which is then connected to this device. Does the resulting EDID contain the HDMI vendor ID? If it does, it means that
drm_detect_hdmi_monitor()will return true, indicating that the connected device is HDMI, and we will still allow modes greater than 165MHz.
I am nowhere near an HDMI expert. If you have a better suggestion then I'm more than happy for you to post it and drop my patch. In my non-expert opinion, it would seem awfully strange for an AV receiver to modify the EDID though unless it was actively interpreting the signal and generating a whole new signal on the other end. In any case, perhaps you can find such a device and that will give insight to how we should deal with it. Until such a device is found, it seems fruitless to speculate.
Personally, I was pointed at "drivers/gpu/drm/i915/intel_hdmi.c". If you look there you will find a similar bit of code.
To summarize: I am not planning to spin my patch. I am hopeful that folks could review Yakir's series. Would it help if he re-sent it with different people in the "To" line?
Maybe when Yakir spins his series next he can include my patch?
-Doug
Quoted 10 lines · Doug Anderson
Russell,
Quoted 6 lines · Russell King - ARM Linux
Quoted 5 lines
OK, so clearly my patch won't work against mainline. I guess it's a good thing that I pointed out that it was only tested locally (would have been better to test against mainline, but I don't think that's so easy since there are several unlanded patches in mainline for Rockchip).
Quoted 4 lines
Quoted 2 lines
As far as I'm aware, Freescale's original BSP version was the same, as is their later BSPs, and Jon's maintained 3.14-stable kernel.
Was "the same"? You mean was untested, or was 3.14?
I'm saying that the mdvi thing behaves the same in all the kernel sources I've seen of this driver, and I'm unaware of anything that changes it - and I've been looking at Jon's 3.14-stable kernels as well as Freescale's git repository.
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
As pointed out by others at <http://crosreview.com/278255>, locally our kernel has a slightly older version of
<https://lkml.org/lkml/2015/2/28/291>, which would change mdvi to be as needed.Please don't post unreliable lkml.org URLs, please use some other archive site. I can't access this URL at the moment.
Perhaps you can try <https://patchwork.kernel.org/patch/5906771/>
Something like that needs to be done, but let's get rid of the mdvi thing in struct hdmi_vmode - it doesn't belong there, it isn't part of the currently set video mode, but becomes a property of the connected sink.
I'd also prefer it to be called "is_dvi_sink", especially as its function is changing from "is it a CEA mode" to "is the attached device a DVI sink".
Even better would be to call it "is_hdmi_sink" to maintain positive logic with single-negation where required, rather than double- negation in places.
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
...so I guess my change is blocked on someone reviewing/landing that series. If that series is rejected (or is changed sufficiently so that mdvi no longer is set via
drm_detect_hdmi_monitor()then my patch will need to be re-spun.That's not what I said. I said mdvi is set according to whether the mode being set is a CEA mode or not.
Perhaps now that you can access the patch with the patchwork link you can re-read my email. If/when that patch lands then mdvi _will_ be set as per
drm_detect_hdmi_monitor().
Well, I object to that patch (see above.)
Quoted 8 lines
I am nowhere near an HDMI expert. If you have a better suggestion then I'm more than happy for you to post it and drop my patch. In my non-expert opinion, it would seem awfully strange for an AV receiver to modify the EDID though unless it was actively interpreting the signal and generating a whole new signal on the other end. In any case, perhaps you can find such a device and that will give insight to how we should deal with it. Until such a device is found, it seems fruitless to speculate.
Neither am I, but I have had the ability to do some testing with AV receivers in the path of a HDMI device, and I've seen how they behave. (I made copious notes on this, which I intend to publish when I have a round tuit.) Unfortunately, I have no DVI devices to test with, and DVI devices are a dying breed - most monitors today come with HDMI sockets instead.
Quoted 2 lines
Personally, I was pointed at "
drivers/gpu/drm/i915/intel_hdmi.c". If you look there you will find a similar bit of code.
Yea, I've also been using that for inspiration too, but I put personal testing above what's in someone elses driver. :)
Quoted 3 lines
To summarize: I am not planning to spin my patch. I am hopeful that folks could review Yakir's series. Would it help if he re-sent it with different people in the "To" line?
That's a shame... I'm not inclined to Ack it as-is - and I'd also like to see Yakir's patch reworked as I mentioned above.
Signature · 6 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 8 lines · Russell King - ARM Linux
Quoted 1 line · Doug Anderson
Perhaps you can try <https://patchwork.kernel.org/patch/5906771/>
Something like that needs to be done, but let's get rid of the mdvi thing in struct
hdmi_vmode- it doesn't belong there, it isn't part of the currently set video mode, but becomes a property of the connected sink.
Quoted 7 lines
I'd also prefer it to be called "
is_dvi_sink", especially as its function is changing from "is it a CEA mode" to "is the attached device a DVI sink".Even better would be to call it "
is_hdmi_sink" to maintain positive logic with single-negation where required, rather than double- negation in places.
This is actually a _very_ important point. Changing the function of mdvi when it's used in multiple places throughout the driver is not on - it's too big a change:
/*check csc whether needed activated in HDMI mode */
cscon = (is_color_space_conversion(hdmi) &&
!hdmi->hdmi_data.video_mode.mdvi);
inv_val |= (vmode->mdvi ?
HDMI_FC_INVIDCONF_DVI_MODEZ_DVI_MODE :
HDMI_FC_INVIDCONF_DVI_MODEZ_HDMI_MODE);
if (hdmi->cable_plugin && !hdmi->hdmi_data.video_mode.mdvi)
hdmi_enable_overflow_interrupts(hdmi);It's unclear what the effect would be to change the meaning of mdvi from "this is a CEA mode" to "the attached device is DVI" in all these locations, and it's just not on to do this in a patch which merely says:
If the monitor support audio, so we should support audio for it, even if the display resolution is No-CEA mode.
In other words, doesn't even describe this change.
In any case, this patch has been dropped from more recent audio driver series.
So, what I'd like to see is a patch series which starts with the change below, and builds on that, with explainations why each change is needed. This is important, as this is shared IP, and we need to make sure that we don't regress non-Rockchip users of this IP. I'll try and do some work in this area if nothing crops up in the next month.
drivers/gpu/drm/bridge/dw_hdmi.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/bridge/dw_hdmi.c +5 -0
@@ -119,6 +119,8 @@ struct dw_hdmi {u8 edid[HDMI_EDID_LEN ];bool cable_plugin; +bool sink_is_hdmi; +bool sink_has_audio;bool phy_enabled;struct drm_display_mode previous_mode;
@@ -1402,6 +1404,9 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector) edid =drm_get_edid (connector, hdmi->ddc);if (edid) { + hdmi->sink_is_hdmi =drm_detect_hdmi_monitor (edid); + hdmi->sink_has_audio =drm_detect_monitor_audio (edid); +dev_dbg (hdmi->dev,"got edid: width[%d] x height[%d]\n" , edid->width_cm, edid->height_cm);
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net.
Russell,
Quoted 5 lines · Russell King - ARM Linux
So, what I'd like to see is a patch series which starts with the change below, and builds on that, with explainations why each change is needed. This is important, as this is shared IP, and we need to make sure that we don't regress non-Rockchip users of this IP. I'll try and do some work in this area if nothing crops up in the next month.
OK. I've mostly been jumping in here to do a bugfix or two, not to take over maintenance of the driver. My general policy is to submit things upstream if at all possible, but I think in the case of HDMI we are just too different from upstream for this to be easy.
I'll let you and Yakir figure out the way forward to keep everyone happy. If that means you submitting some patches then great. If that means Yakir submitting some patches then that's great too. In such a case you can consider my patch to be a bug report and I'll be happy with folks figure out the proper way to do this in the upstream driver. :)
-Doug
Russell,
Quoted 7 lines · Russell King - ARM Linux
Quoted 1 line
Perhaps you can try <https://patchwork.kernel.org/patch/5906771/>
Something like that needs to be done, but let's get rid of the mdvi thing in struct
hdmi_vmode- it doesn't belong there, it isn't part of the currently set video mode, but becomes a property of the connected sink.
Quoted 7 lines
I'd also prefer it to be called "
is_dvi_sink", especially as its function is changing from "is it a CEA mode" to "is the attached device a DVI sink".Even better would be to call it "
is_hdmi_sink" to maintain positive logic with single-negation where required, rather than double- negation in places.
Yakir: sounds like you now have some feedback on your patch now. Perhaps you can spin it with Russell's feedback?
When you send it next, please make sure you include Russell in the "To" line. Based at looking at who committed things to dw_hdmi in the past, I've been sending my patches "To":
Philipp Zabel
Russell King
Thierry Reding
...so perhaps that would be good for you to do, too?
Quoted 9 lines
Quoted 8 lines
I am nowhere near an HDMI expert. If you have a better suggestion then I'm more than happy for you to post it and drop my patch. In my non-expert opinion, it would seem awfully strange for an AV receiver to modify the EDID though unless it was actively interpreting the signal and generating a whole new signal on the other end. In any case, perhaps you can find such a device and that will give insight to how we should deal with it. Until such a device is found, it seems fruitless to speculate.
Quoted 6 lines
Neither am I, but I have had the ability to do some testing with AV receivers in the path of a HDMI device, and I've seen how they behave. (I made copious notes on this, which I intend to publish when I have a round tuit.) Unfortunately, I have no DVI devices to test with, and DVI devices are a dying breed - most monitors today come with HDMI sockets instead.
Ah, OK. Have you seen any that specifically confuse the DVI vs. HDMI bits?
I still have copious DVI devices around, personally. I could have sworn that supporting "older hardware" was actually pretty important in Linux. ...and I can still buy plenty of DVI devices out there.
Quoted 2 lines
That's a shame... I'm not inclined to Ack it as-is - and I'd also like to see Yakir's patch reworked as I mentioned above.
Perhaps when Yakir spins his series he can include a patch like mine in it. It doesn't make sense for me to re-spin it until his is resolved.
-Doug
Doug & Russell,
Quoted 20 lines · Doug Anderson
Russell,
Quoted 6 lines · Russell King - ARM Linux
Quoted 1 line
Perhaps you can try <https://patchwork.kernel.org/patch/5906771/>
Something like that needs to be done, but let's get rid of the mdvi thing in struct
hdmi_vmode- it doesn't belong there, it isn't part of the currently set video mode, but becomes a property of the connected sink.Quoted 7 lines
I'd also prefer it to be called "
is_dvi_sink", especially as its function is changing from "is it a CEA mode" to "is the attached device a DVI sink".Even better would be to call it "
is_hdmi_sink" to maintain positive logic with single-negation where required, rather than double- negation in places.Yakir: sounds like you now have some feedback on your patch now. Perhaps you can spin it with Russell's feedback?
Quoted 8 lines
When you send it next, please make sure you include Russell in the "To" line. Based at looking at who committed things to
dw_hdmiin the past, I've been sending my patches "To":
Philipp Zabel
Russell King
Thierry Reding...so perhaps that would be good for you to do, too?
Okay, thanks for your remind.
Quoted 21 lines
Quoted 8 lines
Quoted 8 lines
I am nowhere near an HDMI expert. If you have a better suggestion then I'm more than happy for you to post it and drop my patch. In my non-expert opinion, it would seem awfully strange for an AV receiver to modify the EDID though unless it was actively interpreting the signal and generating a whole new signal on the other end. In any case, perhaps you can find such a device and that will give insight to how we should deal with it. Until such a device is found, it seems fruitless to speculate.
Quoted 6 lines
Neither am I, but I have had the ability to do some testing with AV receivers in the path of a HDMI device, and I've seen how they behave. (I made copious notes on this, which I intend to publish when I have a round tuit.) Unfortunately, I have no DVI devices to test with, and DVI devices are a dying breed - most monitors today come with HDMI sockets instead.
Ah, OK. Have you seen any that specifically confuse the DVI vs. HDMI bits?
I still have copious DVI devices around, personally. I could have sworn that supporting "older hardware" was actually pretty important in Linux. ...and I can still buy plenty of DVI devices out there.
Quoted 5 lines
Quoted 2 lines
That's a shame... I'm not inclined to Ack it as-is - and I'd also like to see Yakir's patch reworked as I mentioned above.
Perhaps when Yakir spins his series he can include a patch like mine in it. It doesn't make sense for me to re-spin it until his is resolved.
I will rebase on russell series and re-send my patch today.
- Yakir
Quoted 4 lines
-Doug
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel