From patchwork Wed Nov 27 14:04: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: 13887067 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (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 D14941FCFE5 for ; Wed, 27 Nov 2024 14:04:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732716290; cv=none; b=MQqOyDQH4Dax64OAL4EMs5p8XM8yWOLpZWjv7dYzaE2NR8nKmZ91tA5Y5UFaPBAPKtee61PlLp/S8EzROQQ92Qx6U3Umpul/uRCEQ49h4a9CjYtGST9smVNeS8yoIsVEzOxmcPVJt5oXe8EsRin1JvTl7ysjL6wFvqpAsiE2i5M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732716290; c=relaxed/simple; bh=j/r7tlOBhSqvDAZQqbEkOH74xCu4+GFpAyrNIzQsn0w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hJn/dr3zh7Tn/TqeERfBLC07JEaVKdeWK14qSX24Nl1SZjMZ8LhhTzJoLCvb+U1H+x8ThaNUgtk2ABsPsrs09RtRqfvr7rEYdF7phwJAuyHoa9gVzeSt3/WEnFMq53CVq7rg+wDVT1/H5oc8HGGNYfpkDcwlukO4+wDIk6Z0VaA= 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=Z9cXHJaV; arc=none smtp.client-ip=209.85.167.51 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="Z9cXHJaV" Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-53dde4f0f23so4096346e87.3 for ; Wed, 27 Nov 2024 06:04:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732716287; x=1733321087; 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=cj3RdAA2oW11L1rsVwn6o6z2j90OzfOsfLaXzRjhaQ4=; b=Z9cXHJaVApO7KBIjb8VriZWSZY2VHVAyj07HMuOFJTd/X6Gc6THaKGQAy8ZSNLx5oS aW3tC4v8v3Ab6Ww2ESBmM5+ugEkNat0zI6hqtFxHku1zoYeQ7vhzd1Fh/i0/nKeybiuR dY5KfA38r3qsnegxtIZrAVXT9yYtDgozkhhJpgb6HDcyD+gnr4wf76XppHrjlER0Q62+ DyWZIeri6mGrCV+Hx+1tqHOVQj5xHEBTLGasL65YmtjAit/SxV0e/HnupIWJ48FEmNuf SLSdM5kTNsRFkMb9qcChHrnTmNWQ9acsxReALrJXJ6xilAJAoQt2UYA5141/5G0YbZII 8/JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732716287; x=1733321087; 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=cj3RdAA2oW11L1rsVwn6o6z2j90OzfOsfLaXzRjhaQ4=; b=gkP0Q5tKUb/3HNj4yG5lIv3RdhPJOOuY/+uMwCXBA9iM5SxCAUFfRU6UxI+O7WQMCh jxSPlDc1r3OKEAMMfRmUGDGJsTH9/W55jrG+a4xWZGA/042i68V5g0mQFIdC2mJm3vkd R7ddfCeAK2VTsMx49T4ZwEgOltkZuZYSv/HnZ0xbmtaW6pDEjsfpR9MRklqJXceb7O2r gyORYoxK0LhMJ7iyWd5OnMsOVjCznDzYjLiOsMBes0bWVyJ5clI+9d/PoDk8fwj4bban dSLEXvpOo1h8lz864FTymuWmN8IuEy3ffaVjfepB9+KHNil1cICG0BHLxifU7vO1IQ5x jlBQ== X-Forwarded-Encrypted: i=1; AJvYcCWFy+sWEhRKEIomBSGQCIymh3QMAoRkvAHW+bVMr5sUAd+NawbJtweci88D1i23vns3WQiKrtlq7v0fo7FU@vger.kernel.org X-Gm-Message-State: AOJu0YwWFuRVYPR4h2GqLUk+/FGzb0CLrFtrP82bvUjt04hC0uuHUgvc ZzHOsFvy3O+Zxl0EhQiGzUo3Nk1KtXggyv33q3ZIN+O+ltGv0CAYsCOSu/tVjo4= X-Gm-Gg: ASbGnctCKM/5m+xruZXh9MRcFx18EChcnjyXqBCUbvtwNkH5YTSCih7kjKjy3r/uVkI yNqTSMd4Y/7TVScQyUNBgEJ7yxIOfi23hi0//g1LUjck1svTg7n1o0HHb5IcttO3yR9D7af2rQg kxYOYhH0W2ly+hynVTnmdexGqNU++6V6MiFrgajBjT3ecq7Es/Ma5/IaF8RbPQlZ5G37lZcRedA 4pVknfiF/dCKke0Q+b/y/T2OR6Y7SlJH+Etmk5fSLB45cRgmln58VhmpQ== X-Google-Smtp-Source: AGHT+IES1062CY/G/9t7vwt21bCpj5sK+9j6rcr1i8OV4fv5+q2zxrPYrJlhKLBr8i6P7OKE9DzeEQ== X-Received: by 2002:a05:6512:3da6:b0:53d:d3f1:1400 with SMTP id 2adb3069b0e04-53df00a9fddmr1895192e87.3.1732716286716; Wed, 27 Nov 2024 06:04:46 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd44cb7c5sm2157291e87.122.2024.11.27.06.04.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2024 06:04:45 -0800 (PST) From: Dmitry Baryshkov Date: Wed, 27 Nov 2024 16:04:32 +0200 Subject: [PATCH v3 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: <20241127-msm-mdss-ubwc-v3-1-9782a7c2b023@linaro.org> References: <20241127-msm-mdss-ubwc-v3-0-9782a7c2b023@linaro.org> In-Reply-To: <20241127-msm-mdss-ubwc-v3-0-9782a7c2b023@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=5908; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=j/r7tlOBhSqvDAZQqbEkOH74xCu4+GFpAyrNIzQsn0w=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnRybyfKvbdKfXJ0DLvdoqIRAKlJ2B6OknMxNSU Dd15IjeZ02JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0cm8gAKCRCLPIo+Aiko 1WyRB/9Y8oSMZFWsyXdkiAczsjjNQjL9SZA3YaJDa297u5epzgVHL0QzWOB0ZrRC4RtgaLCb5Me 1k+xLxO90GlxceFmCfW6Say7DbW5jWUSr8JBHLqMoARVf2YztyLkk1ls39DrLRIpSmhPlzMTisb nZNwVjTykxeynNx+2X5rcC90jYZDEybh3g4HgYhS5RFIGJC95tXKiH5/0uw4D/Jr1Er4WM28fkH L3Bf7dmcAPIIHfHRt+X7CVjuIBmXLxOp630D78hAhluowfxChHedn2cM/62zXzhNmGtU87XuL7s yfZitq6WSKgHpRSDQH5CezJC01DcFeifa8YAuXiJiMU4uwY8 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 Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/msm_mdss.c | 38 +++++++++++++++----------- drivers/gpu/drm/msm/msm_mdss.h | 1 + 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 b7bd899ead44bf86998e7295bccb31a334fa6811..bb176178855cbe14386481d90bf70aa82be4d522 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(1); 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..737ea6c39271ca85ab82b72914acb9781a7a2cb3 100644 --- a/drivers/gpu/drm/msm/msm_mdss.h +++ b/drivers/gpu/drm/msm/msm_mdss.h @@ -13,6 +13,7 @@ struct msm_mdss_data { u32 ubwc_swizzle; u32 ubwc_static; u32 highest_bank_bit; + bool ubwc_bank_spread; u32 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..6e9f81cd4690433cef58f2377a27af6b0bb01a47 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 Wed Nov 27 14:04:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13887068 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (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 8013A1FDE04 for ; Wed, 27 Nov 2024 14:04:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732716294; cv=none; b=Kc0nna1BlgUWpivJOPFguMk/2hHKBRr4nZByCCzp4SOXZn+i51TetKDDtsZ2uTBCO3GiYWrxgVg1eL7If5mKupX+wZgCtH6Hm7t5dEinHIvpJhHi83KYOURcInVcoqyfTxzpx4VqW1swfJd28N0ANHdiqd6+1MWuMnix4cyKzQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732716294; c=relaxed/simple; bh=QXlCwnR73sOvgJbeSLPKA0J+vuLe1Chwk+otkmp9zJM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k7nx9xGI2wPZlIGKPqehD/kruc0fcAfHVMxz6p4GgQavXo+dkV8Zg0qVdDOQHTHSF5UNnCk6Zkvc0CqhwKiZ+7rqH6MZgfdAQUb0J8u9A6M10ys9lCIA95kiwAOwgx74UhzxaBJNQ5xUlsPXL3jrw4OuB4d7nqp2v+nq7/4wZWU= 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=ECI5gxRP; arc=none smtp.client-ip=209.85.167.53 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="ECI5gxRP" Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-53dd8b7796dso5535760e87.1 for ; Wed, 27 Nov 2024 06:04:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732716291; x=1733321091; 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=72/s2aAz5EY0mwh8LitCCx1LbBniPW9ZXzF/7Krgc0A=; b=ECI5gxRPpwXxGjLyLQweNvqZDb5m2lB2ea877nbSZ5N1euvpdKzFDbO8GAGMQd6hQu BcYGKD8pDM2NBy+H+zQDv+h1r21oV3JJ9fr8dWeQ/icocg+SGsvjv8R+PYMXwISpfTot z/A0pQ3mj9nxQYk+RBlsx5iFqUEYYq0oIOaxM2jCQgHo1IbLK849x1pISAN0s61qtgpf nz501oZ5FBjzAmt+oCWy/P+rjn4HJwvwLjiDETvj2CglfLCnPxeQ2TJ5Tu+treInUJPx moje7xs4++xYIiL8Gu9Jp+/0CC7v6MmdgoLiGt8/jVsip9fQx8hXvAh7L/HzpCyUn8Sf QzsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732716291; x=1733321091; 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=72/s2aAz5EY0mwh8LitCCx1LbBniPW9ZXzF/7Krgc0A=; b=K7Em9Pr1hsTyV5m9Og/DJOwHq9gczFgHQdxkbwvSPJAGY+YlqPKJmu2/8ZZUzofb0t A6GWCxoyVVvoIt+4zKt5H7GX1VX7E6txAm4O0fbh3nHb3YCuPrI6O9tcOZBf4HdiCWT4 ngwyRUd0jJVn16g3E9iokmzHjvIJW2YhSA6MmX7IgFCTBzIqOmo7SOgOzXW86eiU1R4s bMZDDw6wzGyDjUPe4DW8BtezaWljafwH6gvqO816HxH0FJU5c90PzvNTw5r7leNUuMO8 CtaJPzUdT+I6l7t6hGJ6L+SWKk1X5vmSLXJx/8bZHcUp2jmllrdKXofpLhGaQvuQw/Fo m/4w== X-Forwarded-Encrypted: i=1; AJvYcCV53QuV7t6UJ2+4i7hM5LRkRK0Wy8P82QilD3KzMZit50NQZSLcE79I+WRR1V9MRP/azIArS6lwTgXbifAp@vger.kernel.org X-Gm-Message-State: AOJu0Yytf85hhl2jqkmnm+CBZHSMbXjoQxD2B70ANdP6DyGWz19VgpB0 UKw4/3lYWWEzDqPl/0UbCCySkJ+izYIMAJBSSMaGib1ouWG+PacqUzlxsW2jEbc= X-Gm-Gg: ASbGncs/pCriBaABPuzrOfdNJJDKKnrUt8CCykS1P2FRgtpuMGS+OUOzbG/EyQGKKRM 6zneH8X5pRHvJ1SPl1jCtI74FWSyvc8sHHbPrenozB+fkXaSTF9o3+1Nkyc3Bbf8I1rcNs0AMjZ 00SzBeswTYtMpi6vEypWX7BtJyZhHkudQvepSiKyzP7a34j/vOb5dRL/ieG3mk/uwweczW9P7TO pwZC5wCYQgX4AV82UEJy2grRHOzO4PNy/WS8ixtT0hBUvUWvnQnpYzJAg== X-Google-Smtp-Source: AGHT+IGF/QHYDm0CT+wA1NuP7NJ4YCS3p/mH8/g7Cx82llyqYFv5ATWtb43Nzi/a5RuKJ1xyN20SLQ== X-Received: by 2002:a05:6512:32c9:b0:53d:e3a6:ae82 with SMTP id 2adb3069b0e04-53df00ccf7dmr1632023e87.14.1732716289138; Wed, 27 Nov 2024 06:04:49 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd44cb7c5sm2157291e87.122.2024.11.27.06.04.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2024 06:04:47 -0800 (PST) From: Dmitry Baryshkov Date: Wed, 27 Nov 2024 16:04:33 +0200 Subject: [PATCH v3 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: <20241127-msm-mdss-ubwc-v3-2-9782a7c2b023@linaro.org> References: <20241127-msm-mdss-ubwc-v3-0-9782a7c2b023@linaro.org> In-Reply-To: <20241127-msm-mdss-ubwc-v3-0-9782a7c2b023@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=2727; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=QXlCwnR73sOvgJbeSLPKA0J+vuLe1Chwk+otkmp9zJM=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnRybyC9Wz4xuhmvfGaHaKJ7PiP1FzhN+t5Et36 EVrWeYMjQWJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0cm8gAKCRCLPIo+Aiko 1dpZCACZ7g/CCQJyt4U5vHY+J2co9NFbwn6zfIj5RmiF/WDoZk6OzjGboFKXiHWKrNo0flIns68 cehetRi55IUJO47IYj4eO3vMc4Wwt2rcaJYGMbIUatj7YxlZRpq+lDZhOjalHsrCN/2QINiDMgJ 72IInEH1jK2eH+f6KJKmJd3fZJiaUnUMvvJh95nqQbMYlYRIRZ0EgpEaGT8WTYCQ/dUv29HhfSp ng/5PwLWdp9Yj3WLdFgB83ErB9x5Rjg38QNgFQ8g/mlQXCaLi7RIWCAzb7WrJEtu+7w1Jun45k2 rqh3PiQOnGna9wr5LalvzgOmczJWNDKjYRHhMp7qS6bElAxn 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 Reviewed-by: Abhinav Kumar --- 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 bb176178855cbe14386481d90bf70aa82be4d522..87ada64133924d712810c644a5ff660a082c2abd 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(1); + + 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 737ea6c39271ca85ab82b72914acb9781a7a2cb3..1714bb41b838c33f3da19d93c5c1f5c53cfbdbab 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; u32 macrotile_mode; From patchwork Wed Nov 27 14:04:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13887069 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 B91A11FDE06 for ; Wed, 27 Nov 2024 14:04:52 +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=1732716294; cv=none; b=bmeFTumHPuk0M0wkURCB3P8fTsS5fZyyRiWP4Tt0r5jZcPvnnoQDz4tKDlBrjPZAS1pwYnUmYbOw2HUsjwAisaZOZ5RzfsXveUTdhi4jva3vKyHbC0B64bFcT2VEWZonovn6x1W8pSjbJetHx9VRtuBj+PO/9bU6bZtFUF8Sk0c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732716294; c=relaxed/simple; bh=ErNLlV3VyQUaeuBrJa+IVJY8nm3FUxVk1dHk6f1cd6s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LKfLR2NtiXlmUW/mFZYmf5qLqREyIm4xwg9KgsBwEsuW2ZQpAp2sWjfpGLxQ9OvxMlaLpIn0idL+Ty5Im6wzZXBiKwKLkMooSoutIVvugjuaaLyn8dNgzDgdMFP/B3LBUVCCw3Cvv42hc38lxqHTiBqolpz5Nv+UZeaF5GGMiqY= 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=VOYlmv8r; 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="VOYlmv8r" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-53df1d1b726so596816e87.0 for ; Wed, 27 Nov 2024 06:04:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732716291; x=1733321091; 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=rzfmmxXcC5nfkCV4gc5yUHDuhltopU/HIPPIiYJqWlY=; b=VOYlmv8rflYPVxhVXHH9/uvm4bJ0Ak1BmmrtHrv6iWNJvzNbCEf+4RX28fy3OWAy/i osw+xWf1KcGvKFefLZ72MgR8CqI8vqa0F8rqOzviHKCGlRh4wlk6MFGqSH9p/SwiM8Cg LY00SZ8P04vE7fug6dyDuzXapC1STCQnZKGC1xP2zwKCTuzY4Ps7ZrTM9J0TDpn8Ze+l 9xar4OL3jH0wCp9owDm8Z5CHeaUaYwAICWHKoXeOhqv73FcRUfAwkXnK0N0BZ4FnK+5N daT5BT888cLJ4Ck7/ZboMNqVCVy3WfDqIp3YpOYwA+mYbP0vBvQh4HoGIlFOCGVghN4L 97ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732716291; x=1733321091; 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=rzfmmxXcC5nfkCV4gc5yUHDuhltopU/HIPPIiYJqWlY=; b=SwkppTbCydMR+8Go27ERoBSPcl1BiXWyFV+ofagy3XEE+7N/Y5Z1VGBe3bJRe90JDH Ww/FYC4uD95AYuuQh3kBCIiidH+F6cqIkAhhU1l4gbBdxTNfYifrUxTbnA1CHT/F3NP9 qT4isKjZ+q/zJSXh6jMCwt1o22xsU1o6TZFfmYqXFxuCp8pgOTt73t5701qgprZ0uXpP Sd+6N+PeP2IZKw9YDS4EQuhWZrrk90YNtkAwJ9U1qjCYuBLKPa//Org+MsuusPiFo7n1 zRQuH86Ot4SdRCqWhYV7fGnf3pJf46/KFh7fzoWjUd4RrAjavS1q/itgC/tc7l6ln+eU i+Eg== X-Forwarded-Encrypted: i=1; AJvYcCWiLOv7NM0FW56RqoilKPXDV2e5JSMf7OS1PqW2YhGCUpD4jECETb2G2jzfviMDuquqxrV63rhjNy83cShh@vger.kernel.org X-Gm-Message-State: AOJu0YzWfxwqdhkTyrrv/65PjBJxn3dpBTa5S6p1mGuv1bnCVMYN/pGR snjyYP1a4+ejBeA4Pymsu97+MPKe6wij0qlQrEALZkXuyst2Ugp1bUyuTI852Fs= X-Gm-Gg: ASbGncufjC84lcOFEfsGfgBDDR7RqmYqN6/lsA2EpnuhaI1iaJwMnFOWTd/4qSylNqb sLkGCzihYLMWK/l/64Xt55eiLvLsjIpLT/yYjBtrcWaS6N6dXvBlFE3WXD40z0nJ2oaOFy+QSnK svTF1Kb1GsVQm36yDAdUM0MmHI0hASgaPe5mKVThyWAn116PNxbLACbsh/maExML9L3uCPZ/yWi l8XoCde7ovid0miMZqVf/2RfSV6/SF7ys4lbQQdKwvFUSLfeYQK5FQzLw== X-Google-Smtp-Source: AGHT+IE2Yz6mOY37264WsE3DpCDAykgqJRgeSNe3trAvSeoBcV7ImxZGXM35npt/8X7BY4n/kF3gwA== X-Received: by 2002:a05:6512:ba6:b0:53d:e5fd:a44a with SMTP id 2adb3069b0e04-53df0112217mr1863531e87.54.1732716290684; Wed, 27 Nov 2024 06:04:50 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd44cb7c5sm2157291e87.122.2024.11.27.06.04.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2024 06:04:50 -0800 (PST) From: Dmitry Baryshkov Date: Wed, 27 Nov 2024 16:04:34 +0200 Subject: [PATCH v3 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: <20241127-msm-mdss-ubwc-v3-3-9782a7c2b023@linaro.org> References: <20241127-msm-mdss-ubwc-v3-0-9782a7c2b023@linaro.org> In-Reply-To: <20241127-msm-mdss-ubwc-v3-0-9782a7c2b023@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=3073; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=ErNLlV3VyQUaeuBrJa+IVJY8nm3FUxVk1dHk6f1cd6s=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnRybz5EfeQNFPp88Ula96PZeIRf/rzwux4YPIF 4srT6SRd8eJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0cm8wAKCRCLPIo+Aiko 1c/GB/4mwY3uWvHXGyq/FbPpZu83Lz4gH8Aux84nF/nOP7nQF3NArHkTbPL2B3q+8GXtGQj78EK qp7oH7AJiyd93pxBlsc1KdkNxOL9QGZnYxnZsk/iCYPXzGsdnqVY+Xj47Gb9NAtX/5tNRbwX+HP nQaABEz0l44nD6C8RPgzdx/Lufo9hx6tf4+x2m/LR6CaDZOpyD1mJPQA917YlqkpuhXBnE4XvZA c3zy3IfY/01wXEzbMBNBcM/gstwVu/tN/J17OHIy8qy/wKiYU+20JBK521KzalJWM1JHqQyOHFu AGuV/fzcBvSjXKwogKpufaDGitf2gu9xGh5fuhQGHoW6KiBL 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. Reviewed-by: Abhinav Kumar Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_mdss.c | 16 ++++++++-------- drivers/gpu/drm/msm/msm_mdss.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c index 87ada64133924d712810c644a5ff660a082c2abd..6dbeea860abfa1cad8e1da926c66b825938933a0 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 */ }; diff --git a/drivers/gpu/drm/msm/msm_mdss.h b/drivers/gpu/drm/msm/msm_mdss.h index 1714bb41b838c33f3da19d93c5c1f5c53cfbdbab..14dc53704314558841ee1fe08d93309fd2233812 100644 --- a/drivers/gpu/drm/msm/msm_mdss.h +++ b/drivers/gpu/drm/msm/msm_mdss.h @@ -13,7 +13,7 @@ struct msm_mdss_data { u32 ubwc_swizzle; u32 highest_bank_bit; bool ubwc_bank_spread; - u32 macrotile_mode; + bool macrotile_mode; u32 reg_bus_bw; };