From patchwork Sat Nov 23 05:44:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13883756 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 A8A6B1632D3 for ; Sat, 23 Nov 2024 05:45:05 +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=1732340707; cv=none; b=AuPK0KijGocbGDatetDAAL3vISX8Sn2xn2bVT+cYbiT/e2ek/ULV+Loc9EYy1QNcjqoI9KDHEW8VsuD2N1qe3Gyp7TnY8rVgrFa8TauduLwaNYy9+MaKoVWY5mwK/z15npRauUBumKXnszo8OYlVlwo+PfjD7aYitw30d1Qe55U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732340707; c=relaxed/simple; bh=Y68Ugbn4mNiWYoL63ZWT5oQDamfsA6evrZEL1K8NhkE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fg/uQ9/hs19Dw8URbWxZhncsRJGPV91kppJ5IKKJ3/NkmmPv4FdqMpxxbJFh/UTnJ6UsLy03ojFPJstlkIU1RiJPUgQ1ZfrPPWggO3Z6W9mpJ+U9/hzvaCIYL+lIEMdxmHWy2a8psNN0GosGEeSOLZ18jClI5QeyW4r3olnVszE= 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=isDWXYJL; 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="isDWXYJL" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-53dd0cb9ce3so2462415e87.3 for ; Fri, 22 Nov 2024 21:45:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732340703; x=1732945503; 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=F/nCfdT94fyFdmLpDtTnLp3HU3nkqA/lIsXWnP4b+r8=; b=isDWXYJLOa3+QX6cOXy4OQtnvhgS3T2USvY/YXL9mKY/MzfCl95qpo3+vqd8M/nR0t NLgXimGyuXUSXS8x4qrDGj+ugKWiRc5SFT+nen7JTzfsaOWa5qIsaunlQ1JKTu/paEKh a08E2G35oGC5J+Zo7g51q3uCl5+JRZGJdrEoMWyhj4jhpzQSz/TyvgHImiXXwiAR/Aj1 gU4tQLo0hse/dZO3I1hYHgmoI76jTtKq4dbVa8lgdFM/x/dqqI2WwUhtu/nLcnLxdcuk 5dkd0s7swpJtfvLAws86FFG2UQX6Gy7AChHhYUzb5r3nWbxsuFc6J1Dvkb0mYZgKjj6x kWxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732340703; x=1732945503; 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=F/nCfdT94fyFdmLpDtTnLp3HU3nkqA/lIsXWnP4b+r8=; b=oMXs7au9ENiHBYhcXMJNPfUqSVnsoeHlfXSaQjA92Vf3+y12aJNsfoRDnMD9PewBbT xdZRgwwGF+AIK6mE+cjTwTuz3Gcr8Sx8kITS0NMbYPtaeCKCWNlwuJrJWTWdUtXd+QyA f3kcebqxNR7JpuSViKfPkUGZxrcK1fM8CnY2r0Qyibv+85imvbMfwx77OUYoyoRGz9/p REmCKz6Ko6iQl2hL5E50Z5NRhDmt4gU9zP+/bJM1R8noB4/kiQcLr/QoWMwa/y5weP+0 DwW26QlxpRracZuIE3aiswQmcYXV38mY6bV5WlqoAynXrjTYiWj2OHTJI9E0SUwAwNTL NP6Q== X-Forwarded-Encrypted: i=1; AJvYcCXX8obIpeQ/XhbbOmluch88rU1HiBuJVc9xzx8EdyzJgXsjaTpUtjHE1QvESSSrxuhS+QLou/KWGDoPkWU4@vger.kernel.org X-Gm-Message-State: AOJu0YwWQeqdisf8U1fqAfKUBFvWUs/BPnGvHhDxY4GpK/DB1bSKPgpv DJ3FsAwJHMSZUxjqxzNML7nCVlfxp+UDZ/bxcdjHG/iAJ80OmOE2GKKZF3MJKFeh1g5GkWX6LCt c X-Gm-Gg: ASbGncvTiKNSjU0tdIv1mRKFVd+MwVkpBokKVQcoIYYbJyrK/dWVI8gzaFOqhe23f8v 5VKnOZ+88JCjpcGc0BW9cb2VoQMWNX6WStk2tQciZdM7E5GtUZNTgJnHmonDpvJvUZRVgEnmudo t3d1BPyk9WjMUknsmaSMvP0YqZ7ISb1d9e+eBQeBvwsnynWsBTbjHJY3bXQhqQ5I3DbyP0bWzyT JUocxvRy+/+qs2KVFUfqcTF3/AA9FrbQeYLoXNkiKu8st8QyP5xC246sA== X-Google-Smtp-Source: AGHT+IFY49Rgn1MaIQDHpFNZUMu1vu8VWeMQfbuzyBAcqr3XvF3KCIyE4wfVVxUlCuwrgJywOYILLg== X-Received: by 2002:ac2:4f11:0:b0:539:e1c6:9d7f with SMTP id 2adb3069b0e04-53dd389d698mr2913067e87.25.1732340703363; Fri, 22 Nov 2024 21:45:03 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd24457e1sm740143e87.34.2024.11.22.21.45.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 21:45:02 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 23 Nov 2024 07:44:54 +0200 Subject: [PATCH v2 1/3] 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: <20241123-msm-mdss-ubwc-v2-1-41344bc6ef9c@linaro.org> References: <20241123-msm-mdss-ubwc-v2-0-41344bc6ef9c@linaro.org> In-Reply-To: <20241123-msm-mdss-ubwc-v2-0-41344bc6ef9c@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , Connor Abbott , 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.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5924; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=Y68Ugbn4mNiWYoL63ZWT5oQDamfsA6evrZEL1K8NhkE=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQWvax+ERF5jWnoJ2D5csc83mmx3JD2vw5Eoms uXY7FLT8QWJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0Fr2gAKCRCLPIo+Aiko 1UZBB/45xpSd2K4g1tGqC0fO7jL9S+4VJS9xjljQccCOrTeJuqqpnlre/xgbYxLWh0uVQwgR5KC 2sTB8byJ384FGqyK4mwOxKEa3UP7jsQUYECX73tQrVyPPQS7Yj3s+dkJND+bU/h8/2REK+3+PFr DoJbdGpQ9jvHySdJW6oF5FF64pOx6kP2eiC2y+2k1iRHFkdHyTGVT1vlix/Wi2Hp6l34JPpfrq3 JXxOnreX/vtQYG053n+RPGI+anQ/Sf0llf0CsIMaYTVgjuhgcCBvp9SXdLbV2bOZ5NFxFEw+u5L SVj7ibE6LGutfSSRWWyv2lKtRr5Zn3++rKnpfCYb/gvtyexG 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 | 38 +++++++++++++++----------- drivers/gpu/drm/msm/msm_mdss.h | 3 +- drivers/gpu/drm/msm/registers/display/mdss.xml | 11 +++++++- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c index b7bd899ead44bf86998e7295bccb31a334fa6811..4b57f39bec4e6232a0f5b4d49f8ae1200e74ac78 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_UBWC_AMSBC; if (data->ubwc_enc_version == UBWC_1_0) - value |= BIT(8); + value |= MDSS_UBWC_STATIC_UBWC_MIN_ACC_LEN; 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->ubwc_bank_spread) + value |= MDSS_UBWC_STATIC_UBWC_BANK_SPREAD; + + if (data->macrotile_mode) + value |= MDSS_UBWC_STATIC_MACROTILE_MODE; writel_relaxed(value, msm_mdss->mmio + REG_MDSS_UBWC_STATIC); @@ -572,7 +578,7 @@ static const struct msm_mdss_data sa8775p_data = { .ubwc_enc_version = UBWC_4_0, .ubwc_dec_version = UBWC_4_0, .ubwc_swizzle = 4, - .ubwc_static = 1, + .ubwc_bank_spread = true, .highest_bank_bit = 0, .macrotile_mode = 1, .reg_bus_bw = 74000, @@ -590,7 +596,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, + .ubwc_bank_spread = true, .highest_bank_bit = 1, .macrotile_mode = 1, .reg_bus_bw = 74000, @@ -608,7 +614,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, + .ubwc_bank_spread = true, .highest_bank_bit = 3, .macrotile_mode = 1, .reg_bus_bw = 76800, @@ -671,7 +677,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, + .ubwc_bank_spread = true, /* TODO: highest_bank_bit = 2 for LP_DDR4 */ .highest_bank_bit = 3, .macrotile_mode = 1, @@ -682,7 +688,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, + .ubwc_bank_spread = true, /* TODO: highest_bank_bit = 2 for LP_DDR4 */ .highest_bank_bit = 3, .macrotile_mode = 1, @@ -693,7 +699,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, + .ubwc_bank_spread = true, /* TODO: highest_bank_bit = 2 for LP_DDR4 */ .highest_bank_bit = 3, .macrotile_mode = 1, @@ -704,7 +710,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, + .ubwc_bank_spread = 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 3afef4b1786d28902799333ff66c8b3ad0ab77fa..715e1426093de5a4f3b7d2b66b889573c30b7b5c 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 ubwc_bank_spread; + 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 ac85caf1575c7908bcf68f0249da38dccf4f07b6..b6f93984928522a35a782cbad9de006eac225725 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 Nov 23 05:44:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13883757 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (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 CE1D917D896 for ; Sat, 23 Nov 2024 05:45:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732340709; cv=none; b=rhhfrGNvsh5bdNpse9sR4uoFU525qp+1PAwC8mnRpz9M8zVw0llsVDYojCvn0Wqh7S0ES9knsFsbe/AJiTAi+MaswTxK4VqSun7LaFR97+Zwngu/+5ze5xgC50CprdyL0yVpr3HjKtDDOv/tcuaR1ghWQKWq+wBfotSN9h4dO4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732340709; c=relaxed/simple; bh=RCQrEDg9Jf371ZVvZyxUNDcRd0dYuvhxst+HGMFH54g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Iyi2sCot5KK65cRezVtfDd/e/mxV6gghgxSkoDPmCGigaz4/RK1MXo2DDESfviPljwmIf6rUMcuHaxHtgVyknTS1l6OeTEpKfoqxLtf+faBoeX5rus+0pZ4fmGArziTHMOF5n+6150KoG0umNKCGPwRKa2JoTXP78Xrhhnuq7n4= 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=yXkFRHZP; arc=none smtp.client-ip=209.85.167.49 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="yXkFRHZP" Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-53dd59a2bc1so1614979e87.2 for ; Fri, 22 Nov 2024 21:45:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732340706; x=1732945506; 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=7DrDg8Sfy8VjRbQb9wXIsHbLpgOpk0bBFDGmPm833LU=; b=yXkFRHZPQPlL0FuRED/8VNXea9kevJTm/p2MnrA36V87TH24kyK/fSRUo7keOyKgYG LVlcHe1VQR7xr3Qcjxyo5t801U7FRqFWznGibFu5R5TzbuQLeKsgvDyUMi1bX5LEtj6E MZ6rSxOMex3SA+Tc5wcykSQpQJ9C8SJXqyS8qTFTAmY7v9f8hqZRu88BmIenu091GTAc X16jUUFn9x0T2RmUm9mFK+lmsAoNGAdm/M3/9dcxswkydQM+5qbanCuzxUpY/dX6KmUO i1QAXo8tdtnryykmRNgNceV6o1kl+md36vHOJ7W1juo1DhNbJ/UTTIsX0Te7fKt5TBix RCwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732340706; x=1732945506; 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=7DrDg8Sfy8VjRbQb9wXIsHbLpgOpk0bBFDGmPm833LU=; b=oeT93dSoKBZ5nebjROvy7tiLQ8o6v73r+z5cqKHQPYoTU1vy5HlY0Fs0JmOR0Gkf/0 8L32GcGJZUjwYVoInzAAP+EGMGFfGjqeoaKEz+THTWsOpQXPsu5b90JUg8v92UQ+TxXm z6SUZIrOwo6RNet0TMfG1gwCBCcu442+qEjM+o8Jh6l3WAkqDchDAlIRTVyj8sr7HRCM YqDd+wUFqB//v167SI2+EqwYiCXBIoSqp3VJawvZyDKwvKLRWoqmBoISdczJOywIcAAv Sb7zgJF+xpFN5EbwlnCc6kCYPeF8ERlEc2w9jMlmjE7uP++RV2lt+C7+tZ0CeR2tWdQ1 kyfg== X-Forwarded-Encrypted: i=1; AJvYcCXJVs9eiVdgNCvLIyfA+ZzfWYRBXOQ3WILoprEP28WDmKKcQPPmP9KnRZft+Ke1NijtyjDKDLIyu9x+LQPR@vger.kernel.org X-Gm-Message-State: AOJu0YzQrOLan1qTENOo0KvdCsvXBZ+WnojStlg2yaoehn2U3WoSpwgZ ku1u9e4Joaoz+4yKwWmmuezQR4Jc6cSz0fyYYhWUQY+JrEcZZISHF0kyJRxgv+0iDnMnGIOgCKA + X-Gm-Gg: ASbGnct9ftsDVG1YFCRMqC7qdb9EAQv+qC40pZ/RSreNoFcVQuALh18wkB+Fb6vmh5Y 26ZArDn7tgo35j/TVx4TCu8NLKJglJrUKUFFXLbPb8bT5MqVoygmvK1pjUh/oWqk8kZ8xpkrc58 ZlFyJ7JKoh5UBXf+nUA1Pz6nAhcxYmwtPlgi4e5SuhFmSLmdgFt+TN/14lY1vcPVSMHsBo0u3OD hKl3yNZAWT5pgux7n6GoW+mVW2jSA2kLyS5dPGpzGdE5cUQqur57e4VXQ== X-Google-Smtp-Source: AGHT+IHNt5F2db538ToS6v4lWa1hIYzGmz2N5AfeJ0J+hmybh71MXci0fQWRwaxAHDyf839+P0+6rw== X-Received: by 2002:a05:6512:3c83:b0:539:f7c1:5feb with SMTP id 2adb3069b0e04-53dd39a4b16mr2495567e87.39.1732340705843; Fri, 22 Nov 2024 21:45:05 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd24457e1sm740143e87.34.2024.11.22.21.45.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 21:45:04 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 23 Nov 2024 07:44:55 +0200 Subject: [PATCH v2 2/3] 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: <20241123-msm-mdss-ubwc-v2-2-41344bc6ef9c@linaro.org> References: <20241123-msm-mdss-ubwc-v2-0-41344bc6ef9c@linaro.org> In-Reply-To: <20241123-msm-mdss-ubwc-v2-0-41344bc6ef9c@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , Connor Abbott , 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.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2725; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=RCQrEDg9Jf371ZVvZyxUNDcRd0dYuvhxst+HGMFH54g=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQWvaJC/hfMr53Xnp+aU8MlaVVv17sAyaPbzhy 7IVBxOCTZ2JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0Fr2gAKCRCLPIo+Aiko 1dkOB/401lf+nszpksFsYEwE+4wZaylb0UuOyr6FiEosWoZPPznYOblrU4AVUIRMXw3X+cqS+cK jLxPa+zbtH+nUwqueapeeZHBZ6cjSuvYAvDUU77o/kz4/4gfdjyLSMvS2jJCRNFbvINciLFo78z soguSxPjKZ5eS+o4seBUMs6iuEGAstV1VGVfOI/tsTRWyCb6Wg1UxOpE8mIAgVz7SZhQOBtNjvQ VXCcQcK8JzupqDL9bJyAGAfGjKitrHrnzPpD2vopgG/x/WhsdtIGKevxK4aYoG5OhhG57xIe2ox AQWwwp26Gx5Tgj7y6lAtqfaiTCZLz5umIPQqiamiivqCkqLa 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 4b57f39bec4e6232a0f5b4d49f8ae1200e74ac78..2fdad0fa4bc159e9a10755da2c0402fd87734aee 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->ubwc_bank_spread) + value |= MDSS_UBWC_STATIC_UBWC_BANK_SPREAD; + + if (data->ubwc_enc_version == UBWC_1_0) + value |= MDSS_UBWC_STATIC_UBWC_MIN_ACC_LEN; + + writel_relaxed(value, msm_mdss->mmio + REG_MDSS_UBWC_STATIC); } static void msm_mdss_setup_ubwc_dec_30(struct msm_mdss *msm_mdss) @@ -587,7 +595,8 @@ static const struct msm_mdss_data sa8775p_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, + .ubwc_bank_spread = true, .highest_bank_bit = 0x1, .reg_bus_bw = 76800, }; @@ -638,7 +647,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, + .ubwc_bank_spread = true, .highest_bank_bit = 1, .reg_bus_bw = 76800, }; @@ -661,7 +670,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, + .ubwc_bank_spread = 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 715e1426093de5a4f3b7d2b66b889573c30b7b5c..14dc53704314558841ee1fe08d93309fd2233812 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 ubwc_bank_spread; bool macrotile_mode; From patchwork Sat Nov 23 05:44:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13883758 Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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 AA46417DFEC for ; Sat, 23 Nov 2024 05:45:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732340711; cv=none; b=Ctg0ZKKqmde7DIlHpFdFCpsaaQGSvfUewjA8NRwZn+HXqV0jAlF28LNkiecQfpoSNAm1Ry2aLXHS+S0NW6jyYI/v0LfciKC1TIT2Stu5iNgTWsRA5UkHHzb2VezHBX3dzAVowwPxzxDWuAIjHJbfgNEjUnvN8d4gvj8F1Oq7kZw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732340711; c=relaxed/simple; bh=gdM2PmIA7KXreNC4e0p5DKW62M8digF3+8KzLk+7N4s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DkEx3ZkZQXLd0Mazs+hpWA5rx/XqNab0GJ/9K7qqKpN3p2k5xcp+2gPpbqlo9/C8CRLvujpOtn4KCOvAXXdnNSDpQPJ69enBJ/q/o3kdZZLXwd/lYsbiO0v8feOgb4+HVxr4KCHED1DhIwqp/CvFdXLhQzlznNTjj4HLas7mca8= 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=Si3ed5fP; arc=none smtp.client-ip=209.85.208.179 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="Si3ed5fP" Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-2fb59652cb9so31455631fa.3 for ; Fri, 22 Nov 2024 21:45:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732340707; x=1732945507; 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=/hEtTqrfQSr9pI7m+IfwZIAeqdoTOG6+nBJQtRsFkFE=; b=Si3ed5fP8Jl1yKmDBEgE/N3AsJHJdM2K8JPCu4AC5mDd18vq9GFk4uhSbmWd50+ytf DCF9ixkD+4H5btZVMt6HqE3ukUvb5OCOLKSEYk5yDRJURtwjKHMNSNOdNg6vCT9WdnhQ 7F0WRgczkS2LYSDchN+rxTbiCqn6q25saBGdrbdPRYh7M9/jjhQc0SA0HQOOzsBSqIUp rosZPl8pnPAeZMxykuHIEpAw3Gb7OGZKAYDChdt6sPR5bGNoCf/kjFsd6npCcnNbuwS1 i258QwVUaspNyV0mTSMW98nRvwzrYcB5X8DKsvK14bogmM3GlBeJoGWyaw4DqVqLqwvk aC6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732340707; x=1732945507; 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=/hEtTqrfQSr9pI7m+IfwZIAeqdoTOG6+nBJQtRsFkFE=; b=MJRIcXRmzuo2i4JyCMZ9UAEEnNjhYu89Wsua2X2OYIPk6CmQaO8YlI5hxOkjOSlekF D+bqZWwEkRnTWYSqIwSV+P/Qwp0cuUIIZGvZ3wXK3dSVKJRd0E3mgGttos22SkS9O1Aj /5geBzx3egrKDHlEGqCkMMmzIhrIq33tE4bQH+W8ngnpICPwGu6VJgcSWTfm2HKBgldC NTMGf1jWdSbpP0CSyk2UVORRzpvGTx77v5sNftP0V/i6AF0SorF/m2IDLt1EAiW19Lbe 1302Jqc2bma9dxTOK7LzJ41TssqJEC3HDi/H1Q04nmWcRX5VX5FM93vQIXUneh+FcWXD 2BaQ== X-Forwarded-Encrypted: i=1; AJvYcCVUuhx8kcNoHwIeY5cBFMWXtws1bRqxe9btdavrQQIK4ukh42B9psLrEsC+rO606aHeeB8bhBqmEnwgGxph@vger.kernel.org X-Gm-Message-State: AOJu0YyqUScxB+Mu2A2FKfsrYCOZjYhKrWT0Lp9mj6AksG4irgTvu7tO yxoZpfgLM4NJ2h2mIlYMYGvPkNZpKnCVX/Ycwf7GC2ljN+q2kWVgu1rTFPNWp4dqM2yD9GFpbRv 3 X-Gm-Gg: ASbGncs+PV+RU+jXPGmcLk+iO1IBvatGJfadjB0AJ8ymlVSqZzfFkm9tzcxzqSktAwj IGM42PT2cXP/cJiblv0pn3nfaKXU1MqSjRX/XLqrB+xp5U4M6TfBGH/lYsttTeh4W3UbMtL1XoX sS6MkXigQ1ppQcDsH0JORC81xcLuPGwmxSLgGSj4+OFsKylXpx+I4ag3AjEZ8J0QAHemekZq96d 0SzjcHqHIPU60yDpIbFcXPV9t4ZFjd7YtOapezRHDtbdRLmLiolqxlQbg== X-Google-Smtp-Source: AGHT+IEJNfzSkuCdzOOYuqLdhThDbipynbQzrrmzQe+8Fcb8wjmn7htIVDE2uytHwA9HycVmGGo/ww== X-Received: by 2002:a05:6512:3a8d:b0:53d:dbec:9fca with SMTP id 2adb3069b0e04-53ddbeca289mr516396e87.0.1732340707412; Fri, 22 Nov 2024 21:45:07 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd24457e1sm740143e87.34.2024.11.22.21.45.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 21:45:07 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 23 Nov 2024 07:44:56 +0200 Subject: [PATCH v2 3/3] drm/msm/mdss: use boolean values for macrotile_mode Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241123-msm-mdss-ubwc-v2-3-41344bc6ef9c@linaro.org> References: <20241123-msm-mdss-ubwc-v2-0-41344bc6ef9c@linaro.org> In-Reply-To: <20241123-msm-mdss-ubwc-v2-0-41344bc6ef9c@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , Connor Abbott , 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.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2536; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=gdM2PmIA7KXreNC4e0p5DKW62M8digF3+8KzLk+7N4s=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQWvaGO+Y6FoVYTBQaZpzt8UIWJKd7OgPZXoQb 1CWB/ILgCCJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0Fr2gAKCRCLPIo+Aiko 1aiHCACm2sH3vJTnYnx5BmVp1ztQ3EUYnPTFk6PpxdglQX8AeznE9hDRIEelD+LPW43iHWofTU6 pkI62suQqYHajFWAEqWMO18EwqVqy8xODNIIV0GBVjgYSpuWvZlSix4uU/5q/T/Kwi9ygdrhe2z sNdynfWUQE2Ey1w1uwdNpWI2v/n4ETEGp+y50kNNaroNRRgX0nJOy4Qt4zwdij2pr6Fg/QvqHi5 6DpG0F50H4ZDjhi8BmRCgHDpijcmR2jRVWR9JaGB2LlmjHrVbRK0IiWFItjDK72fIio18UrkFxZ Ek0kVpOmVc/k+s/ED6PQDFAFrTg+2vnXABrRLWw9SGP24yXx X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A The macrotile_mode is a flag, not a bit value. Use true/false values to set it rather than 1/0. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/msm_mdss.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c index 2fdad0fa4bc159e9a10755da2c0402fd87734aee..2d9db179accb0fd8666fe80371ea44a1fcc15e1f 100644 --- a/drivers/gpu/drm/msm/msm_mdss.c +++ b/drivers/gpu/drm/msm/msm_mdss.c @@ -588,7 +588,7 @@ static const struct msm_mdss_data sa8775p_data = { .ubwc_swizzle = 4, .ubwc_bank_spread = true, .highest_bank_bit = 0, - .macrotile_mode = 1, + .macrotile_mode = true, .reg_bus_bw = 74000, }; @@ -607,7 +607,7 @@ static const struct msm_mdss_data sc7280_data = { .ubwc_swizzle = 6, .ubwc_bank_spread = true, .highest_bank_bit = 1, - .macrotile_mode = 1, + .macrotile_mode = true, .reg_bus_bw = 74000, }; @@ -615,7 +615,7 @@ static const struct msm_mdss_data sc8180x_data = { .ubwc_enc_version = UBWC_3_0, .ubwc_dec_version = UBWC_3_0, .highest_bank_bit = 3, - .macrotile_mode = 1, + .macrotile_mode = true, .reg_bus_bw = 76800, }; @@ -625,7 +625,7 @@ static const struct msm_mdss_data sc8280xp_data = { .ubwc_swizzle = 6, .ubwc_bank_spread = true, .highest_bank_bit = 3, - .macrotile_mode = 1, + .macrotile_mode = true, .reg_bus_bw = 76800, }; @@ -689,7 +689,7 @@ static const struct msm_mdss_data sm8250_data = { .ubwc_bank_spread = true, /* TODO: highest_bank_bit = 2 for LP_DDR4 */ .highest_bank_bit = 3, - .macrotile_mode = 1, + .macrotile_mode = true, .reg_bus_bw = 76800, }; @@ -700,7 +700,7 @@ static const struct msm_mdss_data sm8350_data = { .ubwc_bank_spread = true, /* TODO: highest_bank_bit = 2 for LP_DDR4 */ .highest_bank_bit = 3, - .macrotile_mode = 1, + .macrotile_mode = true, .reg_bus_bw = 74000, }; @@ -711,7 +711,7 @@ static const struct msm_mdss_data sm8550_data = { .ubwc_bank_spread = true, /* TODO: highest_bank_bit = 2 for LP_DDR4 */ .highest_bank_bit = 3, - .macrotile_mode = 1, + .macrotile_mode = true, .reg_bus_bw = 57000, }; @@ -722,7 +722,7 @@ static const struct msm_mdss_data x1e80100_data = { .ubwc_bank_spread = true, /* TODO: highest_bank_bit = 2 for LP_DDR4 */ .highest_bank_bit = 3, - .macrotile_mode = 1, + .macrotile_mode = true, /* TODO: Add reg_bus_bw with real value */ };