v2: clean up left over comments
    don't overwrite hdmimhz parameter
    cap to 297MHz

Signed-off-by: Karol Herbst <[email protected]>
---
 drm/nouveau/dispnv50/disp.c     |  5 +++++
 drm/nouveau/nouveau_connector.c | 15 ++++++++++-----
 drm/nouveau/nouveau_encoder.h   |  4 ++++
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drm/nouveau/dispnv50/disp.c b/drm/nouveau/dispnv50/disp.c
index fa23d7a2..103433cb 100644
--- a/drm/nouveau/dispnv50/disp.c
+++ b/drm/nouveau/dispnv50/disp.c
@@ -1433,7 +1433,12 @@ nv50_sor_create(struct drm_connector *connector, struct 
dcb_output *dcbe,
        case DCB_OUTPUT_LVDS: type = DRM_MODE_ENCODER_LVDS; break;
        case DCB_OUTPUT_DP:
                nv_encoder->dp.no_interlace = caps->sor[or].dp.no_interlace;
+               type = DRM_MODE_ENCODER_TMDS;
+               break;
        case DCB_OUTPUT_TMDS:
+               nv_encoder->tmds.max_mhz = caps->sor[or].tmds.max_mhz;
+               type = DRM_MODE_ENCODER_TMDS;
+               break;
        default:
                type = DRM_MODE_ENCODER_TMDS;
                break;
diff --git a/drm/nouveau/nouveau_connector.c b/drm/nouveau/nouveau_connector.c
index 074e6d52..65fac604 100644
--- a/drm/nouveau/nouveau_connector.c
+++ b/drm/nouveau/nouveau_connector.c
@@ -980,15 +980,20 @@ static unsigned
 get_tmds_link_bandwidth(struct drm_connector *connector, bool hdmi)
 {
        struct nouveau_connector *nv_connector = nouveau_connector(connector);
+       struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
        struct nouveau_drm *drm = nouveau_drm(connector->dev);
        struct dcb_output *dcb = nv_connector->detected_encoder->dcb;
 
+       if (hdmi && nouveau_hdmimhz > 0)
+               return nouveau_hdmimhz * 1000;
+
+       if (nv_encoder->tmds.max_mhz)
+               /* no HDMI 2.0 for now and not quite clear if we can use
+                 * higher HDMI clocks than 297MHz
+                 */
+               return min(297, nv_encoder->tmds.max_mhz) * 1000;
+
        if (hdmi) {
-               if (nouveau_hdmimhz > 0)
-                       return nouveau_hdmimhz * 1000;
-               /* Note: these limits are conservative, some Fermi's
-                * can do 297 MHz. Unclear how this can be determined.
-                */
                if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_KEPLER)
                        return 297000;
                if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_FERMI)
diff --git a/drm/nouveau/nouveau_encoder.h b/drm/nouveau/nouveau_encoder.h
index f74af5ce..fbef9dc0 100644
--- a/drm/nouveau/nouveau_encoder.h
+++ b/drm/nouveau/nouveau_encoder.h
@@ -65,6 +65,10 @@ struct nouveau_encoder {
                        int link_bw;
                        bool no_interlace;
                } dp;
+
+               struct {
+                       uint16_t max_mhz;
+               } tmds;
        };
 
        void (*enc_save)(struct drm_encoder *encoder);
-- 
2.17.1

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

Reply via email to