From patchwork Tue Sep 4 00:57:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilia Mirkin X-Patchwork-Id: 10586421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 71BF614E0 for ; Tue, 4 Sep 2018 00:57:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5837128EA4 for ; Tue, 4 Sep 2018 00:57:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48FA028EA6; Tue, 4 Sep 2018 00:57:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DC12528EA4 for ; Tue, 4 Sep 2018 00:57:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 08C5389C93; Tue, 4 Sep 2018 00:57:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by gabe.freedesktop.org (Postfix) with ESMTPS id C146789C9C; Tue, 4 Sep 2018 00:57:48 +0000 (UTC) Received: by mail-qk1-x743.google.com with SMTP id f17-v6so1360865qkh.4; Mon, 03 Sep 2018 17:57:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=uV2RjrbKPKJx1st4CFFeBVHBzNW/BfTVXe/lkglmQWA=; b=VNHWTbTgjild52lH0rRdVO3fJ3CRjoVuLwCoir5Ayhe1KQ6UXixYU0V9LHmUCDdcHK SHq2E8wnsyvEKNy2NSTLC8S/zY5gYPYi8P5dRX4C14V9K4jCpoo0BMioFnYAw69yv6pc YC7V1hMvw88T6ShqiJ+3FmR3VdGdi3vWQJIBoCrrj/eaa4fX0b936ZlgFz0xEFDs2/cN KgFwjwCHNIj0GR8U3zuJQV50TRBNdT6t3mWewFpKfPrVkL8klCrvSepc5ysmXcyWInuf TprW/QnWTROmckrAftuKfzxIHjNV03AL77ExR2HshS4cIDb0Bk5ON31c4vnNAf9Sbryt MEEw== X-Gm-Message-State: APzg51CxlJTmJ5r5UZRGJP0Nenz7Oyyjt905LmM28gx1IerwWGvo2ibG 8JabkT2iKT3hXDESgp7JBfY= X-Google-Smtp-Source: ANB0VdYKmnsPAhSHZ04SWswV7pm0qM+y7RBzenQxV8N9WP/dKZPRsO8okj68CfL4r/QuI8aqfi4G7w== X-Received: by 2002:a37:cc59:: with SMTP id r86-v6mr27246712qki.272.1536022667960; Mon, 03 Sep 2018 17:57:47 -0700 (PDT) Received: from athos.fios-router.home (pool-108-29-13-48.nycmny.fios.verizon.net. [108.29.13.48]) by smtp.gmail.com with ESMTPSA id o68-v6sm9779960qkf.9.2018.09.03.17.57.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Sep 2018 17:57:47 -0700 (PDT) From: Ilia Mirkin To: Ben Skeggs , nouveau@lists.freedesktop.org Subject: [PATCH 1/5] drm/nouveau/disp: add a way to configure scrambling/tmds for hdmi 2.0 Date: Mon, 3 Sep 2018 20:57:33 -0400 Message-Id: <20180904005737.5346-2-imirkin@alum.mit.edu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180904005737.5346-1-imirkin@alum.mit.edu> References: <20180904005737.5346-1-imirkin@alum.mit.edu> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP High pixel clocks are required to use a 40 TMDS divider instead of 10, and even low ones may optionally use scrambling depending on device support. Signed-off-by: Ilia Mirkin --- drivers/gpu/drm/nouveau/include/nvif/cl5070.h | 5 ++++- drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h | 1 + drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c | 10 ++++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/nouveau/include/nvif/cl5070.h b/drivers/gpu/drm/nouveau/include/nvif/cl5070.h index 7cdf53615d7b..bced81987269 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/cl5070.h +++ b/drivers/gpu/drm/nouveau/include/nvif/cl5070.h @@ -69,7 +69,10 @@ struct nv50_disp_sor_hdmi_pwr_v0 { __u8 rekey; __u8 avi_infoframe_length; __u8 vendor_infoframe_length; - __u8 pad06[2]; +#define NV50_DISP_SOR_HDMI_PWR_V0_SCDC_SCRAMBLE (1 << 0) +#define NV50_DISP_SOR_HDMI_PWR_V0_SCDC_DIV_BY_4 (1 << 1) + __u8 scdc; + __u8 pad07[1]; }; struct nv50_disp_sor_lvds_script_v0 { diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h index e0b4e0c5704e..57ffadc6a38e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h @@ -60,6 +60,7 @@ struct nvkm_ior_func { void (*ctrl)(struct nvkm_ior *, int head, bool enable, u8 max_ac_packet, u8 rekey, u8 *avi, u8 avi_size, u8 *vendor, u8 vendor_size); + void (*scdc)(struct nvkm_ior *, int head, u8 scdc); } hdmi; struct { diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c index 3aa5a2879239..5f758948d6e1 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c @@ -176,9 +176,10 @@ nv50_disp_root_mthd_(struct nvkm_object *object, u32 mthd, void *data, u32 size) nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size); if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d " - "max_ac_packet %d rekey %d\n", + "max_ac_packet %d rekey %d scdc %d\n", args->v0.version, args->v0.state, - args->v0.max_ac_packet, args->v0.rekey); + args->v0.max_ac_packet, args->v0.rekey, + args->v0.scdc); if (args->v0.max_ac_packet > 0x1f || args->v0.rekey > 0x7f) return -EINVAL; if ((args->v0.avi_infoframe_length @@ -202,6 +203,11 @@ nv50_disp_root_mthd_(struct nvkm_object *object, u32 mthd, void *data, u32 size) args->v0.max_ac_packet, args->v0.rekey, avi, avi_size, vendor, vendor_size); + + if (outp->ior->func->hdmi.scdc) + outp->ior->func->hdmi.scdc( + outp->ior, hidx, args->v0.scdc); + return 0; } break; From patchwork Tue Sep 4 00:57:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilia Mirkin X-Patchwork-Id: 10586431 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8D06214E0 for ; Tue, 4 Sep 2018 00:58:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C88228EA4 for ; Tue, 4 Sep 2018 00:58:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F4ED28FB2; Tue, 4 Sep 2018 00:58:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 07C1528EA4 for ; Tue, 4 Sep 2018 00:58:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1C2EB6E2FD; Tue, 4 Sep 2018 00:57:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt0-x241.google.com (mail-qt0-x241.google.com [IPv6:2607:f8b0:400d:c0d::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7F31B89C9C; Tue, 4 Sep 2018 00:57:49 +0000 (UTC) Received: by mail-qt0-x241.google.com with SMTP id m13-v6so2283755qth.1; Mon, 03 Sep 2018 17:57:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ctSylRXtLFKRuOUzVs+toHfdjSIpug6teTcRhsJuMV4=; b=ao+1outgmHpX7yAMR52Q18/FBvy8CeqvnavcBu3AtS9ZWdItHuCg/zRAqYaRpyKXDc HxEAguBGUa0Scr6fnGMeTuJR0zx37Y2KAlwFLg90jFzMsVfXNgE00bOQN9XpBqkiv42y cNFi3wYn6KFePjWMrSNUh8q8EkRXnXfKMCsSxxJfocLIdDCh66PwmCq6bP22t0noHU2f hJBp55g+qAgCWUL/7UwrhMNuT1aYb8PcTLQPsxS3fB06DoTEJ9GrydgDP26IPdFbyH1J 7cRsXED/Pkg3RACFD01USjqnqPlHVooIRqcx3ZRpmfTEmThw33ozmqmesqT0ht9B5FF0 URKQ== X-Gm-Message-State: APzg51BS6TEvEncZd4pM9ca6+/izQa5zm/Al3fJWkqbFouCWrPc6nP96 jSxTRPJguqxOYkY0tr70gvE= X-Google-Smtp-Source: ANB0VdbPYQKQ6VfEm5YEYymWFi1A+wK61VBnD0I9aaPKw2NdSGHVDPbyCTQX230rh6Pa6cCvKPNgAg== X-Received: by 2002:ac8:2c72:: with SMTP id e47-v6mr28170198qta.60.1536022668684; Mon, 03 Sep 2018 17:57:48 -0700 (PDT) Received: from athos.fios-router.home (pool-108-29-13-48.nycmny.fios.verizon.net. [108.29.13.48]) by smtp.gmail.com with ESMTPSA id o68-v6sm9779960qkf.9.2018.09.03.17.57.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Sep 2018 17:57:48 -0700 (PDT) From: Ilia Mirkin To: Ben Skeggs , nouveau@lists.freedesktop.org Subject: [PATCH 2/5] drm/nouveau/disp/gm200-: add scdc parameter setter Date: Mon, 3 Sep 2018 20:57:34 -0400 Message-Id: <20180904005737.5346-3-imirkin@alum.mit.edu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180904005737.5346-1-imirkin@alum.mit.edu> References: <20180904005737.5346-1-imirkin@alum.mit.edu> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Ilia Mirkin --- drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild | 1 + .../gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c | 34 ++++++++++++++++++++++ drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h | 2 ++ .../gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c | 1 + .../gpu/drm/nouveau/nvkm/engine/disp/sorgv100.c | 1 + 5 files changed, 39 insertions(+) create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild index 3d485dbf310a..8089ac9a12e2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild @@ -50,6 +50,7 @@ nvkm-y += nvkm/engine/disp/hdmig84.o nvkm-y += nvkm/engine/disp/hdmigt215.o nvkm-y += nvkm/engine/disp/hdmigf119.o nvkm-y += nvkm/engine/disp/hdmigk104.o +nvkm-y += nvkm/engine/disp/hdmigm200.o nvkm-y += nvkm/engine/disp/hdmigv100.o nvkm-y += nvkm/engine/disp/conn.o diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c new file mode 100644 index 000000000000..ad5f658c3f6d --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c @@ -0,0 +1,34 @@ +/* + * Copyright 2018 Ilia Mirkin + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: Ilia Mirkin + */ +#include "hdmi.h" + +void +gm200_hdmi_scdc(struct nvkm_ior *ior, int head, u8 scdc) +{ + struct nvkm_device *device = ior->disp->engine.subdev.device; + const u32 hoff = head * 0x800; + const u32 ctrl = scdc & 0x3; + + nvkm_mask(device, 0x61c5bc + hoff, 0x00000003, ctrl); +} diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h index 57ffadc6a38e..cf640141ad23 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h @@ -144,6 +144,8 @@ void gf119_hdmi_ctrl(struct nvkm_ior *, int, bool, u8, u8, u8 *, u8 , u8 *, u8); void gk104_hdmi_ctrl(struct nvkm_ior *, int, bool, u8, u8, u8 *, u8 , u8 *, u8); void gv100_hdmi_ctrl(struct nvkm_ior *, int, bool, u8, u8, u8 *, u8 , u8 *, u8); +void gm200_hdmi_scdc(struct nvkm_ior *, int, u8); + void gt215_hda_hpd(struct nvkm_ior *, int, bool); void gt215_hda_eld(struct nvkm_ior *, u8 *, u8); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c index d892bdf04034..384f82652bec 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c @@ -99,6 +99,7 @@ gm200_sor = { .clock = gf119_sor_clock, .hdmi = { .ctrl = gk104_hdmi_ctrl, + .scdc = gm200_hdmi_scdc, }, .dp = { .lanes = { 0, 1, 2, 3 }, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgv100.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgv100.c index 040db8a338de..8ba881a729ee 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgv100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgv100.c @@ -88,6 +88,7 @@ gv100_sor = { .clock = gf119_sor_clock, .hdmi = { .ctrl = gv100_hdmi_ctrl, + .scdc = gm200_hdmi_scdc, }, .dp = { .lanes = { 0, 1, 2, 3 }, From patchwork Tue Sep 4 00:57:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilia Mirkin X-Patchwork-Id: 10586425 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 636C8180E for ; Tue, 4 Sep 2018 00:58:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E21028EA4 for ; Tue, 4 Sep 2018 00:58:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 422C428FB2; Tue, 4 Sep 2018 00:58:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EB73C28EA4 for ; Tue, 4 Sep 2018 00:58:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7575C6E2EA; Tue, 4 Sep 2018 00:57:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt0-x243.google.com (mail-qt0-x243.google.com [IPv6:2607:f8b0:400d:c0d::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1C41489C9C; Tue, 4 Sep 2018 00:57:50 +0000 (UTC) Received: by mail-qt0-x243.google.com with SMTP id o15-v6so2255468qtk.6; Mon, 03 Sep 2018 17:57:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ClyVvli6+TC5Lc4/PGrTZDB07iVXOrWw7ZL0aYtDHjs=; b=P9gHYzgugzisfZTljuCa2ELx95qt5ABzYsxWHf0WMhNKAkd9k+YoRjv1l9f/asVi6r MDLL3bRTHJp92MpTK3QmqtSgYTZB31ealbyjFk17NFuf4IkPEYZ7TEPtik/G1rL6l2Q3 YF69E8RoZXDnvmVKGUdSdkTkAczdvlkYvE6hHHaFeMmYyL6EyjgIjBpfwMSweyyCn+jI zyZDZn3/aSrWWbM1pZy+l5wXdcQ9Odt4cJqQAHF6EBNlN23NbCvznFVvhymmj/OHEYQP 72hQGBwI/Qs0BsL75lm+y6Bc4X+ng+jRJO3R/QHnoaG3Y+1dX1WKnwT1Ujrqj4cefpvG NeDg== X-Gm-Message-State: APzg51BZYQLWsG6NciviwwOf8SNAc45NEHDut2sVManFCo7jeBIKbuVj lT4VjQYwvfHcU5d0t7g8LqM= X-Google-Smtp-Source: ANB0VdYG0REkfTFB2A1IaC5dTHh1TB36EK3Rcrv/cWTIa0+63wOLj9FFgLWei8+qBo5tva6qsA2pQw== X-Received: by 2002:ac8:2f24:: with SMTP id j33-v6mr27342318qta.93.1536022669259; Mon, 03 Sep 2018 17:57:49 -0700 (PDT) Received: from athos.fios-router.home (pool-108-29-13-48.nycmny.fios.verizon.net. [108.29.13.48]) by smtp.gmail.com with ESMTPSA id o68-v6sm9779960qkf.9.2018.09.03.17.57.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Sep 2018 17:57:48 -0700 (PDT) From: Ilia Mirkin To: Ben Skeggs , nouveau@lists.freedesktop.org Subject: [PATCH 3/5] drm/nouveau/disp: keep track of high-speed state, program into clock Date: Mon, 3 Sep 2018 20:57:35 -0400 Message-Id: <20180904005737.5346-4-imirkin@alum.mit.edu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180904005737.5346-1-imirkin@alum.mit.edu> References: <20180904005737.5346-1-imirkin@alum.mit.edu> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The register programmed by the clock method needs to contain a different setting for the link speed as well as special divider settings. Signed-off-by: Ilia Mirkin --- drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c | 2 ++ drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h | 5 +++++ drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c | 11 +++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c index ad5f658c3f6d..9b16a08eb4d9 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c @@ -31,4 +31,6 @@ gm200_hdmi_scdc(struct nvkm_ior *ior, int head, u8 scdc) const u32 ctrl = scdc & 0x3; nvkm_mask(device, 0x61c5bc + hoff, 0x00000003, ctrl); + + ior->tmds.high_speed = !!(scdc & 0x2); } diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h index cf640141ad23..e2e0515a178c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h @@ -40,6 +40,11 @@ struct nvkm_ior { u8 nr; u8 bw; } dp; + + /* Armed TMDS state. */ + struct { + bool high_speed; + } tmds; }; struct nvkm_ior_func { diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c index e6e6dfbb1283..456a5a143522 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c @@ -120,13 +120,16 @@ void gf119_sor_clock(struct nvkm_ior *sor) { struct nvkm_device *device = sor->disp->engine.subdev.device; - const int div = sor->asy.link == 3; const u32 soff = nv50_ior_base(sor); + u32 div1 = sor->asy.link == 3; + u32 div2 = sor->asy.link == 3; if (sor->asy.proto == TMDS) { - /* NFI why, but this sets DP_LINK_BW_2_7 when using TMDS. */ - nvkm_mask(device, 0x612300 + soff, 0x007c0000, 0x0a << 18); + const u32 speed = sor->tmds.high_speed ? 0x14 : 0x0a; + nvkm_mask(device, 0x612300 + soff, 0x007c0000, speed << 18); + if (sor->tmds.high_speed) + div2 = 1; } - nvkm_mask(device, 0x612300 + soff, 0x00000707, (div << 8) | div); + nvkm_mask(device, 0x612300 + soff, 0x00000707, (div2 << 8) | div1); } void From patchwork Tue Sep 4 00:57:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilia Mirkin X-Patchwork-Id: 10586427 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB40B14BD for ; Tue, 4 Sep 2018 00:58:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9990628FB1 for ; Tue, 4 Sep 2018 00:58:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DEFB28FB4; Tue, 4 Sep 2018 00:58:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 343F728FB1 for ; Tue, 4 Sep 2018 00:58:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 395B06E2F4; Tue, 4 Sep 2018 00:57:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by gabe.freedesktop.org (Postfix) with ESMTPS id D93C689DA4; Tue, 4 Sep 2018 00:57:50 +0000 (UTC) Received: by mail-qk1-x742.google.com with SMTP id f17-v6so1360894qkh.4; Mon, 03 Sep 2018 17:57:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=m6zpOU2F5KfatNehn+11PsgJRuEkUFcKRjqqjY8G0Gs=; b=dXmgopT2t+N1X/lfW7zeZz5PilG98xpDHvlvhBjMejn9Uir7gtMDYv4pmeiA6LJXEO 0llI//vpZIjA6Ocl4neFDQ+TEwbVy9J2mbWDk8HnCIZdPZZVWhmq83Upkue/7WmNiqoz pLe0Vg99dUW8F5j6Z1Cn7aECGC47Eou4vLK4mCMKdLFyoWNFQ5Fs+0QoOOhiWhbiju5w 2tKFMZKysIKfZQacjSWQzFVt8ALRM4SSpo0UXeZ+QBH8aHXODyH1oXKae4pKCegrbWBi n66ClJspugsrIHFhcKu1szj6P5XlePt2xcDo5YWC/ti88GyNlebUBxFzqfpAzvLKadrZ UlXQ== X-Gm-Message-State: APzg51A4tS9QavxI+9SyP+Fs46O2zNBbFH7pHUOoAfAG+9EICd2RqqHd W9Wcc9NDbhGdFGbnEd53KKZ+LEkQ X-Google-Smtp-Source: ANB0VdYhqLU09t0dgH1WILp6VIxobAIgx12sFQQz3afDa/ztKEvoRGym4w6s2wOXGc+2dZHGhTIuKg== X-Received: by 2002:a37:a54f:: with SMTP id o76-v6mr26213375qke.125.1536022669914; Mon, 03 Sep 2018 17:57:49 -0700 (PDT) Received: from athos.fios-router.home (pool-108-29-13-48.nycmny.fios.verizon.net. [108.29.13.48]) by smtp.gmail.com with ESMTPSA id o68-v6sm9779960qkf.9.2018.09.03.17.57.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Sep 2018 17:57:49 -0700 (PDT) From: Ilia Mirkin To: Ben Skeggs , nouveau@lists.freedesktop.org Subject: [PATCH 4/5] drm/nouveau/disp: add support for setting scdc parameters for high modes Date: Mon, 3 Sep 2018 20:57:36 -0400 Message-Id: <20180904005737.5346-5-imirkin@alum.mit.edu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180904005737.5346-1-imirkin@alum.mit.edu> References: <20180904005737.5346-1-imirkin@alum.mit.edu> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP When SCDC is supported, make sure that we configure the GPU and monitor to the same parameters. Signed-off-by: Ilia Mirkin --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 40 ++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c index 9bae4db84cfb..77cf5878896e 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -506,6 +507,7 @@ nv50_hdmi_disable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc) static void nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode) { + struct nouveau_drm *drm = nouveau_drm(encoder->dev); struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc); struct nv50_disp *disp = nv50_disp(encoder->dev); @@ -523,9 +525,12 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode) .pwr.rekey = 56, /* binary driver, and tegra, constant */ }; struct nouveau_connector *nv_connector; + struct drm_hdmi_info *hdmi; u32 max_ac_packet; union hdmi_infoframe avi_frame; union hdmi_infoframe vendor_frame; + bool scdc_supported, high_tmds_clock_ratio = false, scrambling = false; + u8 config; int ret; int size; @@ -533,8 +538,11 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode) if (!drm_detect_hdmi_monitor(nv_connector->edid)) return; + hdmi = &nv_connector->base.display_info.hdmi; + scdc_supported = hdmi->scdc.supported; + ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame.avi, mode, - false); + scdc_supported); if (!ret) { /* We have an AVI InfoFrame, populate it to the display */ args.pwr.avi_infoframe_length @@ -557,12 +565,42 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode) max_ac_packet -= 18; /* constant from tegra */ args.pwr.max_ac_packet = max_ac_packet / 32; + if (hdmi->scdc.scrambling.supported) { + high_tmds_clock_ratio = mode->clock > 340000; + scrambling = high_tmds_clock_ratio || + hdmi->scdc.scrambling.low_rates; + } + + args.pwr.scdc = + NV50_DISP_SOR_HDMI_PWR_V0_SCDC_SCRAMBLE * scrambling | + NV50_DISP_SOR_HDMI_PWR_V0_SCDC_DIV_BY_4 * high_tmds_clock_ratio; + size = sizeof(args.base) + sizeof(args.pwr) + args.pwr.avi_infoframe_length + args.pwr.vendor_infoframe_length; nvif_mthd(&disp->disp->object, 0, &args, size); + nv50_audio_enable(encoder, mode); + + /* If SCDC is supported by the downstream monitor, update + * divider / scrambling settings to what we programmed above. + */ + if (!hdmi->scdc.scrambling.supported) + return; + + ret = drm_scdc_readb(nv_encoder->i2c, SCDC_TMDS_CONFIG, &config); + if (ret < 0) { + NV_ERROR(drm, "Failure to read SCDC_TMDS_CONFIG: %d\n", ret); + return; + } + config &= ~(SCDC_TMDS_BIT_CLOCK_RATIO_BY_40 | SCDC_SCRAMBLING_ENABLE); + config |= SCDC_TMDS_BIT_CLOCK_RATIO_BY_40 * high_tmds_clock_ratio; + config |= SCDC_SCRAMBLING_ENABLE * scrambling; + ret = drm_scdc_writeb(nv_encoder->i2c, SCDC_TMDS_CONFIG, config); + if (ret < 0) + NV_ERROR(drm, "Failure to write SCDC_TMDS_CONFIG = 0x%02x: %d\n", + config, ret); } /****************************************************************************** From patchwork Tue Sep 4 00:57:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilia Mirkin X-Patchwork-Id: 10586429 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4180D14E0 for ; Tue, 4 Sep 2018 00:58:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30CE928EA4 for ; Tue, 4 Sep 2018 00:58:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23A1928FB2; Tue, 4 Sep 2018 00:58:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C3F4428EA4 for ; Tue, 4 Sep 2018 00:58:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 37BB76E2FF; Tue, 4 Sep 2018 00:57:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9D11D6E2EA; Tue, 4 Sep 2018 00:57:51 +0000 (UTC) Received: by mail-qk1-x744.google.com with SMTP id c126-v6so1354016qkd.7; Mon, 03 Sep 2018 17:57:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=FUfPiv2eHhT7fUhppotX6OeWh8GSXZAwcVWziUTItqg=; b=QAf3Ef6QmX5F3hTCkLAnt1ikx5FFuwVVZwnTi2MPgCVMWwuCorB1MiO5bV2Hjj8Wq9 nkz4D0S4UytMB2e8XUIWGfWDt8c2kpmRBgCrIBed8mSpf3QXV8ywmV/GJyEu1lVOr1UW YPA81kpXfHhrAHSyoEwU7NS5NbTUiUt4jsf8lA9nncQtRYE/nbni4MG8JW0OnS01EQxh 6qv0Kj+obCCvmd01HM3TPRvIGcX5ThF1pmuM99ud+D43IkZyyLV/sggX2DA40w+EstAk g608DHHC3fqqzDk29dYz7QUBLP2WxS68nVbZrw6YM5zncnbJtxUnCqxzpoZfOewB+PwD t/Qw== X-Gm-Message-State: APzg51B7GBf+UEtHuDxsjoRLV/7Qhbdgg+BC1dTOldXSPOq6avzJ4kzS Vk9PDjfiVLUiXb+OfLczOeHx9XVj X-Google-Smtp-Source: ANB0VdY7WmnxlY855T3Y3HcSz4lFHC98WbETnBGLYVA01Z7DgwVaZS/oiZK1hffnSpEBp79FWqiPCw== X-Received: by 2002:a37:9a8a:: with SMTP id c132-v6mr26514538qke.153.1536022670669; Mon, 03 Sep 2018 17:57:50 -0700 (PDT) Received: from athos.fios-router.home (pool-108-29-13-48.nycmny.fios.verizon.net. [108.29.13.48]) by smtp.gmail.com with ESMTPSA id o68-v6sm9779960qkf.9.2018.09.03.17.57.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Sep 2018 17:57:50 -0700 (PDT) From: Ilia Mirkin To: Ben Skeggs , nouveau@lists.freedesktop.org Subject: [PATCH 5/5] drm/nouveau/disp: take sink support into account for exposing 594mhz Date: Mon, 3 Sep 2018 20:57:37 -0400 Message-Id: <20180904005737.5346-6-imirkin@alum.mit.edu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180904005737.5346-1-imirkin@alum.mit.edu> References: <20180904005737.5346-1-imirkin@alum.mit.edu> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Scrambling is required for supporting any mode over 340MHz. If it's not supported, reject any modes that would require it. Signed-off-by: Ilia Mirkin --- drivers/gpu/drm/nouveau/nouveau_connector.c | 34 +++++++++++++++++++---------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index af68eae4c626..64228cc1412c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -977,18 +977,33 @@ nouveau_connector_get_modes(struct drm_connector *connector) } static unsigned -get_tmds_link_bandwidth(struct drm_connector *connector, bool hdmi) +get_tmds_link_bandwidth(struct drm_connector *connector) { 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; + struct drm_display_info *info = NULL; + const unsigned duallink_scale = + nouveau_duallink && nv_encoder->dcb->duallink_possible ? 2 : 1; + + if (drm_detect_hdmi_monitor(nv_connector->edid)) + info = &nv_connector->base.display_info; - if (hdmi) { + if (info) { 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.chipset >= 0x120) { + const int max_tmds_clock = + info->hdmi.scdc.scrambling.supported ? + 594000 : 340000; + return info->max_tmds_clock ? + min(info->max_tmds_clock, max_tmds_clock) : + max_tmds_clock; + } if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_KEPLER) return 297000; if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_FERMI) @@ -996,13 +1011,13 @@ get_tmds_link_bandwidth(struct drm_connector *connector, bool hdmi) } if (dcb->location != DCB_LOC_ON_CHIP || drm->client.device.info.chipset >= 0x46) - return 165000; + return 165000 * duallink_scale; else if (drm->client.device.info.chipset >= 0x40) - return 155000; + return 155000 * duallink_scale; else if (drm->client.device.info.chipset >= 0x18) - return 135000; + return 135000 * duallink_scale; else - return 112000; + return 112000 * duallink_scale; } static enum drm_mode_status @@ -1014,7 +1029,6 @@ nouveau_connector_mode_valid(struct drm_connector *connector, struct drm_encoder *encoder = to_drm_encoder(nv_encoder); unsigned min_clock = 25000, max_clock = min_clock; unsigned clock = mode->clock; - bool hdmi; switch (nv_encoder->dcb->type) { case DCB_OUTPUT_LVDS: @@ -1027,11 +1041,7 @@ nouveau_connector_mode_valid(struct drm_connector *connector, max_clock = 400000; break; case DCB_OUTPUT_TMDS: - hdmi = drm_detect_hdmi_monitor(nv_connector->edid); - max_clock = get_tmds_link_bandwidth(connector, hdmi); - if (!hdmi && nouveau_duallink && - nv_encoder->dcb->duallink_possible) - max_clock *= 2; + max_clock = get_tmds_link_bandwidth(connector); break; case DCB_OUTPUT_ANALOG: max_clock = nv_encoder->dcb->crtconf.maxfreq;