From patchwork Sat Sep 21 08:17:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13808796 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 477BA15445D for ; Sat, 21 Sep 2024 08:17:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726906661; cv=none; b=GcggHBs4XdFf1SPOBkALxOwklo1lfXpqPcRqK2XV34CvKWRXrU9p5nEkj1AFeltmSArbCorSPuslRgLn5E3iEoDLqGcKna1ct3ImeeZpQzZMtk6p4Dec65dHx/bXEIyMquUQsZrhCoWyomtJjCE7N3+kM2D/vVKoimwXm1n+cB0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726906661; c=relaxed/simple; bh=xLM1ISnVwa/GRZKkuzfezgSM5E3kbR2k0DPUIeRVKCA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bO007QvsATe1RQvkos19W88nzgXRtK/mcJd/CVeentE5YGnOcwLGCmN5O5kCD1IQHXRBzrrNVD4fpRROevOMhPYdCMHP/54CMXNPMVlufwXznTr2G1tBDFGdgOof3tApOScXMRTIpy7t91my2KLldHldgHInc9yEz5kKznKSmu4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=DkLovxu6; arc=none smtp.client-ip=209.85.167.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DkLovxu6" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-53661ac5ba1so2948841e87.2 for ; Sat, 21 Sep 2024 01:17:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726906657; x=1727511457; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=wmjLhN45ALPPiR+iRXWQ3K4t8AHpJus0NbAIqkjIKHc=; b=DkLovxu6zG2bLv74huUg7OrL4cbvrBlARZzFJhpbQGd9n2+Skj6hk5D4X446I6uuiq mEYTkk4Sf80XJ0isThjV3MdVaV8/GmeT/5jPNFTqHtywA9x6fZHpjYjG33SJBLFWTyCB /qwM2FPdRj09VpFenXVVCYCcJLdf5nyMDVFn0VS83ttMi39GksfpGHGBt8epuDT0LkUc FTcLNnf7vUjfArUu3Pg6nClr0BwnscGwDnOgp9RIq/TiVxxrs4Xk+iDv7K3R7kUdJrv4 HjqspIJJuhEXGX4E1iJCS5rbIkg9YoIXSC13LUtJ1AwN9V25lVRKBaA2TW3oay+Hxjjx hZhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726906657; x=1727511457; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wmjLhN45ALPPiR+iRXWQ3K4t8AHpJus0NbAIqkjIKHc=; b=bG7X6vIGgL4JT5o7KAwMaa0x8LqQ3KzosRZYWINQXe0Ipqt2uor2dgOfhO1ItZOZL8 rbK8tdltC6RZB4oxRl8PLieqoAbQkIR1MwuFiKFKsu0Gih7MJJ4PIGrsN7ryXcW4Cccd t8Ot2Xzxh33Ypj1r9m0Ge99Arsb8gdxcyR3iL9jfdk2UmrmJWWoeFGgN2/VR1yY0j04b /YFli/S9JFt3/+oaLt/9ePyRCe6Z0TOoSDCgLb5eFQoBamJQ+ZdrjB2BCt7oM5BkQGeV 5MbIuaos8BfApFHzkciygnexRPNG/QDZABx+sLc11+x/r0lTajxOZGzREID/oH8d2PN3 1ORA== X-Forwarded-Encrypted: i=1; AJvYcCUpXdgiR7hqsI2yfWA3+h21isQqr7Ea0lIG/HdItezB7LcWJNgj96fnb4rgy9eDCS0BobDnVvd/0rheTHZ2@vger.kernel.org X-Gm-Message-State: AOJu0YzVYpnjAHbqNkKbYVEEkYm/0Sq24m1ins1vaXA7669/PieB5nYQ Evwdz34T0Koe6R2NbjkUuiIsa7M4q9ZbjqxrJDmE6qTHuE/1+1DV3CIhKwIrBA8= X-Google-Smtp-Source: AGHT+IGxbdLlaIHZI3XMOG8yIZU4pHHubytur/pR5AgxpylOBi198gvBqPuSta56H37+ZeQhmJjWRQ== X-Received: by 2002:a05:6512:12c4:b0:535:6cef:ffb8 with SMTP id 2adb3069b0e04-536ac338a9amr3458360e87.54.1726906657229; Sat, 21 Sep 2024 01:17:37 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-536870968d1sm2466380e87.175.2024.09.21.01.17.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Sep 2024 01:17:36 -0700 (PDT) From: Dmitry Baryshkov Date: Sat, 21 Sep 2024 11:17:29 +0300 Subject: [PATCH 1/4] drm/msm: move MDSS registers to separate header file Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240921-msm-mdss-ubwc-v1-1-411dcf309d05@linaro.org> References: <20240921-msm-mdss-ubwc-v1-0-411dcf309d05@linaro.org> In-Reply-To: <20240921-msm-mdss-ubwc-v1-0-411dcf309d05@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3169; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=xLM1ISnVwa/GRZKkuzfezgSM5E3kbR2k0DPUIeRVKCA=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ9q7RvmrvSzz6qY77lq3Y239d6FM0cAjy46E/LzRb+T8l 7k7xzuyk9GYhYGRi0FWTJHFp6Blasym5LAPO6bWwwxiZQKZwsDFKQATWfKD/X/tKw3dxFsN4Ym3 YpXVTZRYN9jL5NXWnOlYHOdqu9t9jWvgkaZ1dg9d/m195H6t7pqhXHZW3vPbCv1xiybfcZVc++V Dpt+F+mzlxzUmP1ofvWll2bBo4S+FXC9uy0ym9lCl9w8LbgucNHoix1W5a5bYwzKbPX9L3Jju2H VOve4vPsk2Y7K33OLwstK9t2LUFy5huLT0oIqVwgV7nT+v7z49EbNsq2WfFa/VM9tb7TvDfvJ7L 1N3WOb5/1ebqSTvlijxz65FZ2y09hxzSJ88tYmxLs6zoXjeeTGFJYWhLsvepWpK/85wCVr12z3W jc9xzuuo6wzS9luXBKZYamvWSKsfZvv+tPuFQRuf9rY8AA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A In preparation of adding more registers, move MDSS-related headers to the separate top-level file. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/Makefile | 1 + drivers/gpu/drm/msm/registers/display/mdp5.xml | 16 ---------------- drivers/gpu/drm/msm/registers/display/mdss.xml | 23 +++++++++++++++++++++++ 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile index 13110fcc46a8..db2174e2efa8 100644 --- a/drivers/gpu/drm/msm/Makefile +++ b/drivers/gpu/drm/msm/Makefile @@ -210,6 +210,7 @@ DISPLAY_HEADERS = \ generated/mdp4.xml.h \ generated/mdp5.xml.h \ generated/mdp_common.xml.h \ + generated/mdss.xml.h \ generated/sfpb.xml.h $(addprefix $(obj)/,$(adreno-y)): $(addprefix $(obj)/,$(ADRENO_HEADERS)) diff --git a/drivers/gpu/drm/msm/registers/display/mdp5.xml b/drivers/gpu/drm/msm/registers/display/mdp5.xml index 92f3263af170..8c9c4af350aa 100644 --- a/drivers/gpu/drm/msm/registers/display/mdp5.xml +++ b/drivers/gpu/drm/msm/registers/display/mdp5.xml @@ -9,22 +9,6 @@ xsi:schemaLocation="https://gitlab.freedesktop.org/freedreno/ rules-fd.xsd"> - - - - - - - - - - - - - - - - diff --git a/drivers/gpu/drm/msm/registers/display/mdss.xml b/drivers/gpu/drm/msm/registers/display/mdss.xml new file mode 100644 index 000000000000..9354cfffb730 --- /dev/null +++ b/drivers/gpu/drm/msm/registers/display/mdss.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + From patchwork Sat Sep 21 08:17:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13808798 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1966E2D7B8 for ; Sat, 21 Sep 2024 08:17:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726906662; cv=none; b=isshp63TgI/ZMBoL33T0Vbk4jLGfSoZ8mE4JSk+rUXFBwJQEGYDtFuv7bH8UYhO/0NJUo6PO40NQO8/6AXos6YjmzbDDEG05lyj1XY/7mjIJYTGfYO13F162CgzOelWKuupbSayApgs/m6cO5chxz0fBGqVEmJPsa95VQb0P23Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726906662; c=relaxed/simple; bh=G6PowQr5FW3NdBDRADRSrKvw2U+ewXo5XcoYzvoJ6Pw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NIO9RmMoT+y0jMH2nrzPU/t0Ku8lFcu1L57AC2tMF7q6BX+wq2IKWWyNIaNGcPZCF3l8G8qsAef/r3ho9ZB2Tevr2p3MAEfWFaPHckzaSo5QFypSNSUyqhSnQ+VVCRks6+p0T1FMIPK7UoYtivmKDmiJa+DoBAON7NdhTue+tqo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=pVkrmkmC; arc=none smtp.client-ip=209.85.208.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pVkrmkmC" Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2f66423686bso23818411fa.3 for ; Sat, 21 Sep 2024 01:17:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726906658; x=1727511458; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Od53nvDeJ6X0bdgIyj/l8ko1IVye/qAo8uvg9IuTxGE=; b=pVkrmkmCCcCyHnAtBzgQICROgSFWWAQ2pTtWpbpzkhOLVEDuMpXiRrPQudCdvO7mVt 5AZQIA5nfLknYf147Xydxo2GXUW83Q2KrCgrNvOX38hlMxfyYsuVe2dl3JoF32CbgCCb RPH5aDlTFUUrm3xajYgYiivZeoAgdzC0GMRtSKjshrPhMkJDGU8HLpoabIipjHITyaKf focj7KnsRc4JL4FJuHYBqoJnDsPbPRKFog2DazG/j/w19hOnBQk8MqHz4mEnwmMgenFA I9FKQ2tuu2apvdvlLjQvrmQLwtfM07Btk68WeAKdht5gMBUDcO2lVze0M+F8ICc9iH0+ D9mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726906658; x=1727511458; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Od53nvDeJ6X0bdgIyj/l8ko1IVye/qAo8uvg9IuTxGE=; b=q/TOkGFEf3lApa2KTWeb+wcnNuxE6JpSuQlQxcgPnqgHF+v3lPO/JatJH80cl5WHPa QDE2QxQ3ZFwCJI/Jn2ldzMTTpi+F8dmtnLsL2ey+4Y2CPaMSWhOfXSJSSCMSuc3HOFAp gNF5JpFDJMkpo3Mb+Dxvh93c4yJlQVzms3ygUtj0Ej9mKo7FfMvkZCZUMtGDYrTkz36j cAPWUJ1WAYDE9T+8NCA06ybeZo+sF9KEfaFF0ZbaZq6XDz1xevGg7R2XRPS7xaZ8HReU TgczFhOMT+5eE5sZbZbIZ1y/WbrUHjSodC/PJe1SRS1/xBC85/DnDQYQRPKXWvtjxC64 ZAPw== X-Forwarded-Encrypted: i=1; AJvYcCUbxJph4HHBXTYInUXOGUZpLJrcIa4ylTM/4UVEwhQtCsVB6txMA+rkBYYR07XZ1nr30VpYkVHaqXc43omF@vger.kernel.org X-Gm-Message-State: AOJu0Yxp7nawzmd8aD8PpscRh7iZJWz1PlYct77psHnfIAPATNa6DEdJ pRtIGgaukimkgkgX+AtLxdih4eXda4kIRT6Mnh8nrx8kdhHUiXDE6TwTJpbza4g= X-Google-Smtp-Source: AGHT+IETJ3Ky8mWo/JLPiPgVUT28m25lTztokOWEmapijuMHe9ti1rkaEQDPEbL5hoAyCuOwe3QvXQ== X-Received: by 2002:a05:6512:2208:b0:536:14a1:d645 with SMTP id 2adb3069b0e04-536ad3c9aefmr2997424e87.44.1726906658018; Sat, 21 Sep 2024 01:17:38 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-536870968d1sm2466380e87.175.2024.09.21.01.17.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Sep 2024 01:17:37 -0700 (PDT) From: Dmitry Baryshkov Date: Sat, 21 Sep 2024 11:17:30 +0300 Subject: [PATCH 2/4] drm/msm/mdss: use register definitions instead of hand-coding them Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240921-msm-mdss-ubwc-v1-2-411dcf309d05@linaro.org> References: <20240921-msm-mdss-ubwc-v1-0-411dcf309d05@linaro.org> In-Reply-To: <20240921-msm-mdss-ubwc-v1-0-411dcf309d05@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4880; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=G6PowQr5FW3NdBDRADRSrKvw2U+ewXo5XcoYzvoJ6Pw=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBm7oEf05dbGt5Lc6aHVGnCmSnC98kTf0qX6d9UE NnCD/w7AaqJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZu6BHwAKCRCLPIo+Aiko 1dcDCACg5ArOXMPZTRiJhXhrpweO8bTOXVhdYdh/WLR70YN5xSIeKiL6XFSJMwK2Sf/5QdIPwit nyF2N7SRgIbtc5i6+CPjY1UnAd4jC3KbAJYj5xXbEvcse3JL7J69jyo9EjN+3fkdRpGdaebVPtJ gvge8Of9xdqhu4ruDUrXLtOhly39eJNgQuZp4IaSLE+7uSWXfPbUXte0KdBVEwvLKobTzVjBfn0 xA5B6HQSvB6Jazb6SxWSGLE+lYFDlPIQdF79sOxj2e10qYxDDVY3te0rhlXJ96j6aAtZHe4z5x7 Xu2D+JHnnr5aRg2XxLNx2zE4tc/6TsbAe2E3UD2sKbf10bkE X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Move existing register definitions to mdss.xml and use generated defines for registers access instead of hand-coding everything in the source file. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/msm_mdss.c | 35 +++++++++++--------------- drivers/gpu/drm/msm/registers/display/mdss.xml | 6 +++++ 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c index faa88fd6eb4d..ca9b7f953ac4 100644 --- a/drivers/gpu/drm/msm/msm_mdss.c +++ b/drivers/gpu/drm/msm/msm_mdss.c @@ -19,13 +19,7 @@ #include "msm_mdss.h" #include "msm_kms.h" -#define HW_REV 0x0 -#define HW_INTR_STATUS 0x0010 - -#define UBWC_DEC_HW_VERSION 0x58 -#define UBWC_STATIC 0x144 -#define UBWC_CTRL_2 0x150 -#define UBWC_PREDICTION_MODE 0x154 +#include #define MIN_IB_BW 400000000UL /* Min ib vote 400MB */ @@ -83,7 +77,7 @@ static void msm_mdss_irq(struct irq_desc *desc) chained_irq_enter(chip, desc); - interrupts = readl_relaxed(msm_mdss->mmio + HW_INTR_STATUS); + interrupts = readl_relaxed(msm_mdss->mmio + REG_MDSS_HW_INTR_STATUS); while (interrupts) { irq_hw_number_t hwirq = fls(interrupts) - 1; @@ -173,7 +167,7 @@ static void msm_mdss_setup_ubwc_dec_20(struct msm_mdss *msm_mdss) { const struct msm_mdss_data *data = msm_mdss->mdss_data; - writel_relaxed(data->ubwc_static, msm_mdss->mmio + UBWC_STATIC); + writel_relaxed(data->ubwc_static, msm_mdss->mmio + REG_MDSS_UBWC_STATIC); } static void msm_mdss_setup_ubwc_dec_30(struct msm_mdss *msm_mdss) @@ -189,7 +183,7 @@ static void msm_mdss_setup_ubwc_dec_30(struct msm_mdss *msm_mdss) if (data->ubwc_enc_version == UBWC_1_0) value |= BIT(8); - writel_relaxed(value, msm_mdss->mmio + UBWC_STATIC); + writel_relaxed(value, msm_mdss->mmio + REG_MDSS_UBWC_STATIC); } static void msm_mdss_setup_ubwc_dec_40(struct msm_mdss *msm_mdss) @@ -200,21 +194,22 @@ static void msm_mdss_setup_ubwc_dec_40(struct msm_mdss *msm_mdss) (data->highest_bank_bit & 0x7) << 4 | (data->macrotile_mode & 0x1) << 12; - writel_relaxed(value, msm_mdss->mmio + UBWC_STATIC); + writel_relaxed(value, msm_mdss->mmio + REG_MDSS_UBWC_STATIC); if (data->ubwc_enc_version == UBWC_3_0) { - writel_relaxed(1, msm_mdss->mmio + UBWC_CTRL_2); - writel_relaxed(0, msm_mdss->mmio + UBWC_PREDICTION_MODE); + writel_relaxed(1, msm_mdss->mmio + REG_MDSS_UBWC_CTRL_2); + writel_relaxed(0, msm_mdss->mmio + REG_MDSS_UBWC_PREDICTION_MODE); } else { if (data->ubwc_dec_version == UBWC_4_3) - writel_relaxed(3, msm_mdss->mmio + UBWC_CTRL_2); + writel_relaxed(3, msm_mdss->mmio + REG_MDSS_UBWC_CTRL_2); else - writel_relaxed(2, msm_mdss->mmio + UBWC_CTRL_2); - writel_relaxed(1, msm_mdss->mmio + UBWC_PREDICTION_MODE); + writel_relaxed(2, msm_mdss->mmio + REG_MDSS_UBWC_CTRL_2); + writel_relaxed(1, msm_mdss->mmio + REG_MDSS_UBWC_PREDICTION_MODE); } } -#define MDSS_HW_MAJ_MIN GENMASK(31, 16) +#define MDSS_HW_MAJ_MIN \ + (MDSS_HW_VERSION_MAJOR__MASK | MDSS_HW_VERSION_MINOR__MASK) #define MDSS_HW_MSM8996 0x1007 #define MDSS_HW_MSM8937 0x100e @@ -235,7 +230,7 @@ static const struct msm_mdss_data *msm_mdss_generate_mdp5_mdss_data(struct msm_m if (!data) return NULL; - hw_rev = readl_relaxed(mdss->mmio + HW_REV); + hw_rev = readl_relaxed(mdss->mmio + REG_MDSS_HW_VERSION); hw_rev = FIELD_GET(MDSS_HW_MAJ_MIN, hw_rev); if (hw_rev == MDSS_HW_MSM8996 || @@ -334,9 +329,9 @@ static int msm_mdss_enable(struct msm_mdss *msm_mdss) dev_err(msm_mdss->dev, "Unsupported UBWC decoder version %x\n", msm_mdss->mdss_data->ubwc_dec_version); dev_err(msm_mdss->dev, "HW_REV: 0x%x\n", - readl_relaxed(msm_mdss->mmio + HW_REV)); + readl_relaxed(msm_mdss->mmio + REG_MDSS_HW_VERSION)); dev_err(msm_mdss->dev, "UBWC_DEC_HW_VERSION: 0x%x\n", - readl_relaxed(msm_mdss->mmio + UBWC_DEC_HW_VERSION)); + readl_relaxed(msm_mdss->mmio + REG_MDSS_UBWC_DEC_HW_VERSION)); break; } diff --git a/drivers/gpu/drm/msm/registers/display/mdss.xml b/drivers/gpu/drm/msm/registers/display/mdss.xml index 9354cfffb730..ac85caf1575c 100644 --- a/drivers/gpu/drm/msm/registers/display/mdss.xml +++ b/drivers/gpu/drm/msm/registers/display/mdss.xml @@ -18,6 +18,12 @@ xsi:schemaLocation="https://gitlab.freedesktop.org/freedreno/ rules-fd.xsd"> + + + + + + From patchwork Sat Sep 21 08:17:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13808799 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D1F215C138 for ; Sat, 21 Sep 2024 08:17:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726906665; cv=none; b=GohD2dXr4/Y0M1sbLt1pmLGwcRL1PCiv0/clfhwmpgEi2kFj9AwyDF/oBLr8mOTpyFNlOOPxyMzTxYVpgUIkuPrqngTQUaoc2iIFMFHC+hUDlwQM9KOeVcFQa1HHdcQWGhDpS/fIlt3icx38d8igKQ2BaSvMmyIJJwRSaFpEne8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726906665; c=relaxed/simple; bh=utH3zMLcvKLREFFdRj1W6cb06ULAA1VlL6GfopIfnMQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g4u0Whpv6r79O49dnUDev+LtzfZQPxdG+H2k63ZgMEeI/bteIT67nppaBFWjXxpwoHHaOAXkAEzzWb/61XVWkRrILWefmYVvsoq5VfWf51I/I16YdtphIP2cVax/JIRu4QUQph+9LKFYJQR/Eot72w6F2R/bs2TTDV1T8IPvgDE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=VvltQT1U; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VvltQT1U" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-535dc4ec181so2782540e87.3 for ; Sat, 21 Sep 2024 01:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726906661; x=1727511461; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ixfycQ+OhOhX9IuLXKX0B+HAxSW+VAgfI+FMAgQa7F8=; b=VvltQT1UTJkuKnWBGz9/QeMYNBNig+NeOXPN45IBqgOCR/2OWaErcxcz2Se7dUVYvy GKNEzzOSagXhv726nExrv2h0IMdv7X7d3AzW8IkwFZmpinwSzBGkIxqqzwmmNZ5ALqGe mkV6Hv7rjqlVRl0VK1W3UELd56p7hPxZctm8JXHng6rU5o8AnyYs9o71zVzrzoPlTjjs GKi4JK0KDeSzCYVXRuZ4yON5+XqXtK22d27K0PTeXotU3r5Uw+jqJLMHk6oIMcLruacj hNoj2N8I0oy+XsAwuBQq/hmZCC0eFmGBoR66o3B5c0HPRDxpjJl1JUBnmYSA3VpiN8Qw D7rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726906661; x=1727511461; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ixfycQ+OhOhX9IuLXKX0B+HAxSW+VAgfI+FMAgQa7F8=; b=d0OxsLc2HF32Ag2gzlbno3aLbXc7tzOtezwwZDhFZozcjb8vpq0iYDj9G3uYcC1Tas MEN/6qSXrSZ15sNDu47qgpsCk1zHPE3RgOw25BGKSi6LN0ss/PrIqkQ2u9RqQyET8CjG vOhHl0F1CCYSC0/JYclJ0RZ6pVapLpP0hOxOfoqfiINbLiHLjeIHzjQk6Gek3ILIabPg JdtmvCPKnqU8kv/BTBiwopM5S4ZIqIvuplBbUlGoAibu9VOiHHQzcNvNiHfr+J/YqM4m xnwiZMNZBVe/kTJcTlEi4s+ARbP2QKn5e4tEsyTdTFrdtReUE5FgtBFnEfuTy42RJKPf 0kAw== X-Forwarded-Encrypted: i=1; AJvYcCUsZ3pMWyqJKJbyGgLRar+yBWqz53Llrti5Z2UKmC/F7P0pg4f0tECXDoYAkbaOiSS2Wj5vBbwyHsb+AFjk@vger.kernel.org X-Gm-Message-State: AOJu0Yzvh4+VtYnWsbqr6jGIkpxOnv9xT8OYZPld3455StWrDS//w6cg cZ5hqqOqEPIVKvBDAMusOuHwthOYfsBL5gvqsfJyenaiyxN830Gc/GuKavN8egE= X-Google-Smtp-Source: AGHT+IEp2IVp8R8KzUBL8pFZ6IqlRNTBR0iIOqCUIF+8/lDk/lTF27LBao01hpKd+T+aKhAGMpWpcw== X-Received: by 2002:a05:6512:31cc:b0:536:5364:bc7 with SMTP id 2adb3069b0e04-536ad3f1ef3mr2941827e87.60.1726906661068; Sat, 21 Sep 2024 01:17:41 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-536870968d1sm2466380e87.175.2024.09.21.01.17.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Sep 2024 01:17:39 -0700 (PDT) From: Dmitry Baryshkov Date: Sat, 21 Sep 2024 11:17:31 +0300 Subject: [PATCH 3/4] drm/msm/mdss: define bitfields for the UBWC_STATIC register Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240921-msm-mdss-ubwc-v1-3-411dcf309d05@linaro.org> References: <20240921-msm-mdss-ubwc-v1-0-411dcf309d05@linaro.org> In-Reply-To: <20240921-msm-mdss-ubwc-v1-0-411dcf309d05@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5389; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=utH3zMLcvKLREFFdRj1W6cb06ULAA1VlL6GfopIfnMQ=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBm7oEfpeo0nvjCbwL2dXM/STLppUW5swOrto7k9 XdHqOo7RduJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZu6BHwAKCRCLPIo+Aiko 1VCqB/9LxaTlULqdwKDcuNwoJVeE49D/XErOIzKSH73pAJu7Mpe32GRuPRCDmOlTPEkxRsso+i9 l45NWc0w56sxH4PhPj7k7kb0enJOA+mF/4csROdGXG1mey2JkQ91evsX+gAdUUDJATv5tyYtKzM fclXMaHCMl8iadQpu2K9zV8c0sC7UNmbZWe5jKzuSAMeHk0kSGSt8qL2k7tKzMYIU+9slUTgemN CijIzfNW8lFkY7Ozx/N1qhjw5pX/BV2DBKRhlzyRhPJHkBPUmT9mSSbq87sQGaNNXSm6GPsz2ZS bj4qTK+Ar4E7IToM2yyfb/NxaA1DtYwZAlR7ZT1CLTc9cG0U X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Rather than hand-coding UBWC_STATIC value calculation, define corresponding bitfields and use them to setup the register value. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_mdss.c | 36 +++++++++++++++----------- drivers/gpu/drm/msm/msm_mdss.h | 3 ++- drivers/gpu/drm/msm/registers/display/mdss.xml | 11 +++++++- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c index ca9b7f953ac4..7704e1c9eb2a 100644 --- a/drivers/gpu/drm/msm/msm_mdss.c +++ b/drivers/gpu/drm/msm/msm_mdss.c @@ -173,15 +173,17 @@ static void msm_mdss_setup_ubwc_dec_20(struct msm_mdss *msm_mdss) static void msm_mdss_setup_ubwc_dec_30(struct msm_mdss *msm_mdss) { const struct msm_mdss_data *data = msm_mdss->mdss_data; - u32 value = (data->ubwc_swizzle & 0x1) | - (data->highest_bank_bit & 0x3) << 4 | - (data->macrotile_mode & 0x1) << 12; + u32 value = MDSS_UBWC_STATIC_UBWC_SWIZZLE(data->ubwc_swizzle & 0x1) | + MDSS_UBWC_STATIC_HIGHEST_BANK_BIT(data->highest_bank_bit); + + if (data->macrotile_mode) + value |= MDSS_UBWC_STATIC_MACROTILE_MODE; if (data->ubwc_enc_version == UBWC_3_0) - value |= BIT(10); + value |= MDSS_UBWC_STATIC_UNKNOWN_10; if (data->ubwc_enc_version == UBWC_1_0) - value |= BIT(8); + value |= MDSS_UBWC_STATIC_UNKNOWN_8; writel_relaxed(value, msm_mdss->mmio + REG_MDSS_UBWC_STATIC); } @@ -189,10 +191,14 @@ static void msm_mdss_setup_ubwc_dec_30(struct msm_mdss *msm_mdss) static void msm_mdss_setup_ubwc_dec_40(struct msm_mdss *msm_mdss) { const struct msm_mdss_data *data = msm_mdss->mdss_data; - u32 value = (data->ubwc_swizzle & 0x7) | - (data->ubwc_static & 0x1) << 3 | - (data->highest_bank_bit & 0x7) << 4 | - (data->macrotile_mode & 0x1) << 12; + u32 value = MDSS_UBWC_STATIC_UBWC_SWIZZLE(data->ubwc_swizzle) | + MDSS_UBWC_STATIC_HIGHEST_BANK_BIT(data->highest_bank_bit); + + if (data->unknown_3) + value |= MDSS_UBWC_STATIC_UNKNOWN_3; + + if (data->macrotile_mode) + value |= MDSS_UBWC_STATIC_MACROTILE_MODE; writel_relaxed(value, msm_mdss->mmio + REG_MDSS_UBWC_STATIC); @@ -580,7 +586,7 @@ static const struct msm_mdss_data sc7280_data = { .ubwc_enc_version = UBWC_3_0, .ubwc_dec_version = UBWC_4_0, .ubwc_swizzle = 6, - .ubwc_static = 1, + .unknown_3 = true, .highest_bank_bit = 1, .macrotile_mode = 1, .reg_bus_bw = 74000, @@ -598,7 +604,7 @@ static const struct msm_mdss_data sc8280xp_data = { .ubwc_enc_version = UBWC_4_0, .ubwc_dec_version = UBWC_4_0, .ubwc_swizzle = 6, - .ubwc_static = 1, + .unknown_3 = true, .highest_bank_bit = 3, .macrotile_mode = 1, .reg_bus_bw = 76800, @@ -661,7 +667,7 @@ static const struct msm_mdss_data sm8250_data = { .ubwc_enc_version = UBWC_4_0, .ubwc_dec_version = UBWC_4_0, .ubwc_swizzle = 6, - .ubwc_static = 1, + .unknown_3 = true, /* TODO: highest_bank_bit = 2 for LP_DDR4 */ .highest_bank_bit = 3, .macrotile_mode = 1, @@ -672,7 +678,7 @@ static const struct msm_mdss_data sm8350_data = { .ubwc_enc_version = UBWC_4_0, .ubwc_dec_version = UBWC_4_0, .ubwc_swizzle = 6, - .ubwc_static = 1, + .unknown_3 = true, /* TODO: highest_bank_bit = 2 for LP_DDR4 */ .highest_bank_bit = 3, .macrotile_mode = 1, @@ -683,7 +689,7 @@ static const struct msm_mdss_data sm8550_data = { .ubwc_enc_version = UBWC_4_0, .ubwc_dec_version = UBWC_4_3, .ubwc_swizzle = 6, - .ubwc_static = 1, + .unknown_3 = true, /* TODO: highest_bank_bit = 2 for LP_DDR4 */ .highest_bank_bit = 3, .macrotile_mode = 1, @@ -694,7 +700,7 @@ static const struct msm_mdss_data x1e80100_data = { .ubwc_enc_version = UBWC_4_0, .ubwc_dec_version = UBWC_4_3, .ubwc_swizzle = 6, - .ubwc_static = 1, + .unknown_3 = true, /* TODO: highest_bank_bit = 2 for LP_DDR4 */ .highest_bank_bit = 3, .macrotile_mode = 1, diff --git a/drivers/gpu/drm/msm/msm_mdss.h b/drivers/gpu/drm/msm/msm_mdss.h index 3afef4b1786d..69095c18ab4a 100644 --- a/drivers/gpu/drm/msm/msm_mdss.h +++ b/drivers/gpu/drm/msm/msm_mdss.h @@ -13,7 +13,8 @@ struct msm_mdss_data { u32 ubwc_swizzle; u32 ubwc_static; u32 highest_bank_bit; - u32 macrotile_mode; + bool unknown_3; + bool macrotile_mode; u32 reg_bus_bw; }; diff --git a/drivers/gpu/drm/msm/registers/display/mdss.xml b/drivers/gpu/drm/msm/registers/display/mdss.xml index ac85caf1575c..57c0bdf2ef65 100644 --- a/drivers/gpu/drm/msm/registers/display/mdss.xml +++ b/drivers/gpu/drm/msm/registers/display/mdss.xml @@ -21,7 +21,16 @@ xsi:schemaLocation="https://gitlab.freedesktop.org/freedreno/ rules-fd.xsd"> - + + + + + + + + + + From patchwork Sat Sep 21 08:17:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13808800 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FE8516BE20 for ; Sat, 21 Sep 2024 08:17:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726906667; cv=none; b=FYighczMh2LMJsWEI9F3DGya5yf4iv02mwvG5flkUboZ6vBSgZGTJr5Rh0zJkzakdSS/JSdPdt0lmWi7z4Zv6vbhAna6DRtvJWHp0Z42ISP3lDZxofO+TQoCoHfVTGRRpo4sDCF7bjHKhewftbq1yr1JEsj8wG6tIbn+CuIZ1Xc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726906667; c=relaxed/simple; bh=ScCRd7+z7cwAGX0LzQnkBaj1sUTBN7g+ylhI1wBf8No=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=d7caA8GAB2YDObqJpmy6eiNqt4FoXjaiSvhAjRoIFBD/Ef6WaOc0K9ePKi6w3rcZ27rCWLQU9YYyooyDmaxe19KIIlC4l+kr5m311lw0gid2aVwgpAddh0YeUZkuU/yHCmYtKy76eFxxATZwnkxedwYsAKugNs6jD1jl03H+Oko= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=FgAGc/r6; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FgAGc/r6" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-5365aa568ceso3432968e87.0 for ; Sat, 21 Sep 2024 01:17:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726906663; x=1727511463; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=SVsyILzzvjiOy2yaVn/07EEy8eWz3i45ZaANjyZGvio=; b=FgAGc/r6hwECoNVRH2jY/GLNV6Euzokvoicg9b4kf8Q4uWunuFtmN1A/CMWijzQRC+ ZaOha+cA77nYgaZxF7vRf8W+LDab0uVOJa3JVOat4SsgV1NInJwdNeq+LYjC5wCsOB08 R2Krb7pHj3WltBQerXzi6wKSFpjliAiLoMROecUhToSYj68hCS5s05kRc1b9LncdA0vG qseqR60LjwsBG3l85Pu226YoDhuWpRIYy2RmFbZU1mQZaO7qZRVYeup1YfoPqxdZSId/ dX9MSOAGR7Ms4f3wjb0W2Jrk1lkE1i8JAQDiBP8J0mGlYvuikwqcNRNBiija0hjETCWg FLWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726906663; x=1727511463; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SVsyILzzvjiOy2yaVn/07EEy8eWz3i45ZaANjyZGvio=; b=B+KTY9ijGHxXdRG8S8zPZwORUUPJY4BBzvJW+0rZs98CA71twocOpAtfi0VQx+tCx0 wQgfOZJcT63IPbASkc2ME7ojLhtQFtjR63TT6F1d44Q7bneGZxDfLjYUfnFm2MQfuF2U PC9Dc/nNQCs4plWzvQx79KARV3cd6mh/BlqNlHiKtpC7pL3/F5j15qFByDfeM/VWsoQe Qkpj18RRd0aetRf9iZAabFgzVnuOiD5JxaS1Wa5qIUWWfm9JyclOZ320B5i393TPU85v 7M1eLJi8Baa6v+rvdln4wq6hW9/YCWzFHhrF4TrkIEwZJI2R8cyNweGvSc513jidCx+M 9HRA== X-Forwarded-Encrypted: i=1; AJvYcCVL5uBqSq0gvhuqf/auPMXnQSu262rFnLT54xgVqyB8pAsSBlh5VhhhxU0uzPkjzr5WAGbIjM4GYWQmPZOy@vger.kernel.org X-Gm-Message-State: AOJu0Yzsz2OYGSB/e4+07dqj/Z8i6ssCoa3B2mKyjU/KuzMG4Wot+QRn In6xVILJi6TdY8QwovdwaHjJa5xXwDgyzVP6CXhqRKrlqFXIrUNftsKyv5w+3aAYu5+78mT+vA4 BIpQ= X-Google-Smtp-Source: AGHT+IFPY/W2L+v0opGRZsevBEm6pIXjNTUdy2RRjJsvIyR13eOixR1PdLXWb9cbd5UYsG/wDpqcXg== X-Received: by 2002:a05:6512:1095:b0:530:e0fd:4a97 with SMTP id 2adb3069b0e04-536ac17ba54mr4389006e87.0.1726906663478; Sat, 21 Sep 2024 01:17:43 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-536870968d1sm2466380e87.175.2024.09.21.01.17.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Sep 2024 01:17:42 -0700 (PDT) From: Dmitry Baryshkov Date: Sat, 21 Sep 2024 11:17:32 +0300 Subject: [PATCH 4/4] drm/msm/mdss: reuse defined bitfields for UBWC 2.0 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240921-msm-mdss-ubwc-v1-4-411dcf309d05@linaro.org> References: <20240921-msm-mdss-ubwc-v1-0-411dcf309d05@linaro.org> In-Reply-To: <20240921-msm-mdss-ubwc-v1-0-411dcf309d05@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2564; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=ScCRd7+z7cwAGX0LzQnkBaj1sUTBN7g+ylhI1wBf8No=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBm7oEfFUNz63SZIIIv4PSfaBvDuI15ysOw/396a 6UffauUniqJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZu6BHwAKCRCLPIo+Aiko 1dLUCACLFFbWklq276VM0/8R0H4sDEzmkz4gKnwfDpRPWAfsBCwUuuo+yznN+gqcNrh5FQKRyJq 4a6Lq5j9qgRAt92C9N3elKB+wQXyIy8k06pGS/gL/eWnx/2YpQJ1seTn0GcN9iEOEHyv2petgEK uT1h8YyflDQfylQpRjWCdItA7GaFNpShxp4W2cqcCf5LyFC7c3I1Pcvquel4wv1n15N8mc5xtvt PuSQ22r/G0Mlmt8BKBd0jpa/dGfK6YwDmSPZsYy0whHFOajAVpZXDaQBoGunDeJyGmpA0tRhLGr BQfl+po4ZAG2aTUqjR8nNkWJlMSoXHaIS+8hTXCMv7Qr31zK X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Follow other msm_mdss_setup_ubwc_dec_nn functions and use individual bits instead of just specifying the value to be programmed to the UBWC_STATIC register. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_mdss.c | 17 +++++++++++++---- drivers/gpu/drm/msm/msm_mdss.h | 1 - 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c index 7704e1c9eb2a..0b49187c52de 100644 --- a/drivers/gpu/drm/msm/msm_mdss.c +++ b/drivers/gpu/drm/msm/msm_mdss.c @@ -166,8 +166,16 @@ static int _msm_mdss_irq_domain_add(struct msm_mdss *msm_mdss) static void msm_mdss_setup_ubwc_dec_20(struct msm_mdss *msm_mdss) { const struct msm_mdss_data *data = msm_mdss->mdss_data; + u32 value = MDSS_UBWC_STATIC_UBWC_SWIZZLE(data->ubwc_swizzle) | + MDSS_UBWC_STATIC_HIGHEST_BANK_BIT(data->highest_bank_bit); - writel_relaxed(data->ubwc_static, msm_mdss->mmio + REG_MDSS_UBWC_STATIC); + if (data->unknown_3) + value |= MDSS_UBWC_STATIC_UNKNOWN_3; + + if (data->ubwc_enc_version == UBWC_1_0) + value |= MDSS_UBWC_STATIC_UNKNOWN_8; + + writel_relaxed(value, msm_mdss->mmio + REG_MDSS_UBWC_STATIC); } static void msm_mdss_setup_ubwc_dec_30(struct msm_mdss *msm_mdss) @@ -577,7 +585,8 @@ static const struct msm_mdss_data qcm2290_data = { static const struct msm_mdss_data sc7180_data = { .ubwc_enc_version = UBWC_2_0, .ubwc_dec_version = UBWC_2_0, - .ubwc_static = 0x1e, + .ubwc_swizzle = 6, + .unknown_3 = true, .highest_bank_bit = 0x1, .reg_bus_bw = 76800, }; @@ -628,7 +637,7 @@ static const struct msm_mdss_data sm6350_data = { .ubwc_enc_version = UBWC_2_0, .ubwc_dec_version = UBWC_2_0, .ubwc_swizzle = 6, - .ubwc_static = 0x1e, + .unknown_3 = true, .highest_bank_bit = 1, .reg_bus_bw = 76800, }; @@ -651,7 +660,7 @@ static const struct msm_mdss_data sm6115_data = { .ubwc_enc_version = UBWC_1_0, .ubwc_dec_version = UBWC_2_0, .ubwc_swizzle = 7, - .ubwc_static = 0x11f, + .unknown_3 = true, .highest_bank_bit = 0x1, .reg_bus_bw = 76800, }; diff --git a/drivers/gpu/drm/msm/msm_mdss.h b/drivers/gpu/drm/msm/msm_mdss.h index 69095c18ab4a..521d4e6b8043 100644 --- a/drivers/gpu/drm/msm/msm_mdss.h +++ b/drivers/gpu/drm/msm/msm_mdss.h @@ -11,7 +11,6 @@ struct msm_mdss_data { /* can be read from register 0x58 */ u32 ubwc_dec_version; u32 ubwc_swizzle; - u32 ubwc_static; u32 highest_bank_bit; bool unknown_3; bool macrotile_mode;