From patchwork Wed Mar 17 18:57:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12146817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86CDCC433E0 for ; Wed, 17 Mar 2021 18:59:53 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3019864F53 for ; Wed, 17 Mar 2021 18:59:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3019864F53 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 809866E235; Wed, 17 Mar 2021 18:59:52 +0000 (UTC) Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by gabe.freedesktop.org (Postfix) with ESMTPS id E81756E235 for ; Wed, 17 Mar 2021 18:59:50 +0000 (UTC) Received: by mail-lj1-x232.google.com with SMTP id r20so4547643ljk.4 for ; Wed, 17 Mar 2021 11:59:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=aD+bgjnKcQpwKrmLfaSDWL9bnCurIUYHlVG+1S8dJKA=; b=GLqxKP2AkQDjOLk5j9uCP5FFyjIyG4W97tRtbx10R4PH/u3Ln9VZxZLz1DAC8C4dNr qo4LLTOSN5RtI6AYFPfDD/m9l6QHva4BWF6FfQW4AnMKR3pG6mw9UzWGWGDxdzgeYa83 uUZOa9VQOs9fZ1fSsZzdJWkMOwDKAawrjvqwzInnBqocIhPbVSCvLUD/nKbc0JzaLlPR gbNZr8Poe5rQylaLaAymiEwLalXQXU8dVmRfWQR18Il1u5F5vA7kPtd0ot2S1/5jT9+p QWmgn4re6E6L+AnG1lRJUdyVwaGPQ1yjx2mjUdcyV9W9vG1i1N5zFb79k+OBOfsoch0M hJnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=aD+bgjnKcQpwKrmLfaSDWL9bnCurIUYHlVG+1S8dJKA=; b=ca2xr2cVKulFInNLdIvWHWwwJ0g8JSLNd5roqCv0av2NVOpiQj++P6AVxqyM3Dg4Oa et5r08VqX/EkNFxj5o4n4GzdlKmOkuvgh1arF1YVkFz8Xq6teAEU3KErCItdzRvgIBU+ 4dQmLKWdN4lPQ24X7gfn+bvGtjJN9DB9mKrFIIUS4OlEIEI5r9ZdfJLTm554AQGDJm9C RDNvsf8bdEsAxKl20aPut9ulRa33/astx/Wpimd+Bm6Yqg/j2EU3X0dgnWEsPOBcVFZp UwkqC9F5Ukniwai4fVkK8Fye4ETxRTzz/sqA+MhaRgH7W0wWX/8T4NdA4YRLFSk1nJgm /org== X-Gm-Message-State: AOAM530rUWOLZnSkjsugydZi21hnF9FyelvN26iutFKinLushCqjWKRn WmAViyvR0NIlgoXk4O0FAeA= X-Google-Smtp-Source: ABdhPJw7gmOvSc1phTvkBLht6+c1l9w9p/jqGkafXriP21VPiDj23QRwlBPp4ZpspzWV79C6lnb4QA== X-Received: by 2002:a2e:8909:: with SMTP id d9mr3181547lji.442.1616007589343; Wed, 17 Mar 2021 11:59:49 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id b28sm3442482lfo.219.2021.03.17.11.59.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 11:59:48 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Matt Merhar , Peter Geis , Nicolas Chauvet , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH v16 0/2] Add memory bandwidth management to NVIDIA Tegra DRM driver Date: Wed, 17 Mar 2021 21:57:32 +0300 Message-Id: <20210317185734.14661-1-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-pm@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This series adds memory bandwidth management to the NVIDIA Tegra DRM driver, which is done using interconnect framework. It fixes display corruption that happens due to insufficient memory bandwidth. Changelog: v16: - Implemented suggestions that were given by Michał Mirosław to v15. - Added r-b from Michał Mirosław to the debug-stats patch. - Rebased on top of a recent linux-next. - Removed bandwidth scaling based on width difference of src/dst windows since it's not actual anymore. Apparently the recent memory driver changes fixed problems that I witnessed before. - Average bandwidth calculation now won't overflow for 4k resolutions. - Average bandwidth calculation now uses the size of the visible area instead of the src area since debug stats of the memory controller clearly show that downscaled window takes less bandwidth, proportionally to the scaled size. - Bandwidth calculation now uses "adjusted mode" of the CRTC, which is what used for h/w programming, instead of the mode that was requested by userspace, although the two usually match in practice. v15: - Corrected tegra_plane_icc_names[] NULL-check that was partially lost by accident in v14 after unsuccessful rebase. v14: - Made improvements that were suggested by Michał Mirosław to v13: - Changed 'unsigned int' to 'bool'. - Renamed functions which calculate bandwidth state. - Reworked comment in the code that explains why downscaled plane require higher bandwidth. - Added round-up to bandwidth calculation. - Added sanity checks of the plane index and fixed out-of-bounds access which happened on T124 due to the cursor plane index. v13: - No code changes. Patches missed v5.12, re-sending them for v5.13. Dmitry Osipenko (2): drm/tegra: dc: Support memory bandwidth management drm/tegra: dc: Extend debug stats with total number of events drivers/gpu/drm/tegra/Kconfig | 1 + drivers/gpu/drm/tegra/dc.c | 362 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/tegra/dc.h | 19 ++ drivers/gpu/drm/tegra/drm.c | 14 ++ drivers/gpu/drm/tegra/hub.c | 3 + drivers/gpu/drm/tegra/plane.c | 116 +++++++++++ drivers/gpu/drm/tegra/plane.h | 15 ++ 7 files changed, 530 insertions(+)