Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	Konrad Dybcio <konradybcio@kernel.org>
Cc: Bjorn Andersson <andersson@kernel.org>,
	Rob Clark <robdclark@gmail.com>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	Akhil P Oommen <quic_akhilpo@quicinc.com>,
	Sean Paul <sean@poorly.run>, David Airlie <airlied@gmail.com>,
	Simona Vetter <simona@ffwll.ch>,
	Marijn Suijten <marijn.suijten@somainline.org>,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Subject: Re: [PATCH RFT v2 11/15] drm/msm/adreno: Switch to the common UBWC config struct
Date: Thu, 15 May 2025 17:51:31 +0200	[thread overview]
Message-ID: <503932a8-3124-4448-b18a-e25554745488@oss.qualcomm.com> (raw)
In-Reply-To: <qhmayxvlyz2txum5rs5vaf3iqzniz6nktr4zatru6bhgp6tdah@uq24obw2ro5f>

On 5/14/25 9:22 PM, Dmitry Baryshkov wrote:
> On Wed, May 14, 2025 at 05:10:31PM +0200, Konrad Dybcio wrote:
>> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>
>> Now that Adreno specifics are out of the way, use the common config
>> (but leave the HBB hardcoding in place until that is wired up on the
>> other side).
>>
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>> ---
>>  drivers/gpu/drm/msm/adreno/a5xx_gpu.c   | 20 +++++------
>>  drivers/gpu/drm/msm/adreno/a6xx_gpu.c   | 64 ++++++++++++++++-----------------
>>  drivers/gpu/drm/msm/adreno/adreno_gpu.c |  6 ++--
>>  drivers/gpu/drm/msm/adreno/adreno_gpu.h | 45 ++++-------------------
>>  4 files changed, 50 insertions(+), 85 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
>> index 650e5bac225f372e819130b891f1d020b464f17f..611e0eb26d0e19d431673d08e042162375fd400f 100644
>> --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
>> +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
>> @@ -833,8 +833,8 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
>>  
>>  	gpu_write(gpu, REG_A5XX_RBBM_AHB_CNTL2, 0x0000003F);
>>  
>> -	BUG_ON(adreno_gpu->ubwc_config.highest_bank_bit < 13);
>> -	hbb = adreno_gpu->ubwc_config.highest_bank_bit - 13;
>> +	BUG_ON(adreno_gpu->ubwc_config->highest_bank_bit < 13);
>> +	hbb = adreno_gpu->ubwc_config->highest_bank_bit - 13;
>>  
>>  	gpu_write(gpu, REG_A5XX_TPL1_MODE_CNTL, hbb << 7);
>>  	gpu_write(gpu, REG_A5XX_RB_MODE_CNTL, hbb << 1);
>> @@ -1754,6 +1754,7 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
>>  	struct msm_drm_private *priv = dev->dev_private;
>>  	struct platform_device *pdev = priv->gpu_pdev;
>>  	struct adreno_platform_config *config = pdev->dev.platform_data;
>> +	const struct qcom_ubwc_cfg_data *common_cfg;
>>  	struct a5xx_gpu *a5xx_gpu = NULL;
>>  	struct adreno_gpu *adreno_gpu;
>>  	struct msm_gpu *gpu;
>> @@ -1790,15 +1791,14 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
>>  	/* Set up the preemption specific bits and pieces for each ringbuffer */
>>  	a5xx_preempt_init(gpu);
>>  
>> -	/* Set the highest bank bit */
>> -	if (adreno_is_a540(adreno_gpu) || adreno_is_a530(adreno_gpu))
>> -		adreno_gpu->ubwc_config.highest_bank_bit = 15;
>> -	else
>> -		adreno_gpu->ubwc_config.highest_bank_bit = 14;
>> +	/* Inherit the common config and make some necessary fixups */
>> +	common_cfg = qcom_ubwc_config_get_data();
>> +	if (IS_ERR(common_cfg))
>> +		return ERR_PTR(-EINVAL);
>>  
>> -	/* a5xx only supports UBWC 1.0, these are not configurable */
>> -	adreno_gpu->ubwc_config.macrotile_mode = 0;
>> -	adreno_gpu->ubwc_config.ubwc_swizzle = 0x7;
>> +	/* Copy the data into the internal struct to drop the const qualifier (temporarily) */
>> +	adreno_gpu->_ubwc_config = *common_cfg;
>> +	adreno_gpu->ubwc_config = &adreno_gpu->_ubwc_config;
> 
> Ugh. I'd rather keep the ubwc config r/o.
> 
>>  
>>  	adreno_gpu->uche_trap_base = 0x0001ffffffff0000ull;
>>  
>> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>> index fdc843c47c075a92ec8305217c355e4ccee876dc..ae0bb7934e7ed203aa3b81e28767de204f0a4d60 100644
>> --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>> @@ -587,64 +587,62 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
>>  
>>  static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
>>  {
>> +	const struct qcom_ubwc_cfg_data *common_cfg;
>> +	struct qcom_ubwc_cfg_data *cfg = &gpu->_ubwc_config;
>> +
>>  	/* Inherit the common config and make some necessary fixups */
>> -	gpu->common_ubwc_cfg = qcom_ubwc_config_get_data();
>> -	if (IS_ERR(gpu->common_ubwc_cfg))
>> +	common_cfg = qcom_ubwc_config_get_data();
>> +	if (IS_ERR(common_cfg))
>>  		return -EINVAL;
>>  
>> -	gpu->ubwc_config.ubwc_swizzle = 0x6;
>> -	gpu->ubwc_config.macrotile_mode = 0;
>> -	gpu->ubwc_config.highest_bank_bit = 15;
>> +	/* Copy the data into the internal struct to drop the const qualifier (temporarily) */
>> +	*cfg = *common_cfg;
>> +
>> +	cfg->ubwc_swizzle = 0x6;
>> +	cfg->highest_bank_bit = 15;
>>  
> 
> This begs for WARN_ON(cfg->ubwc_swizzle !=
> gpu->common_ubwc_cfg->ubwc_swizzle) and similar change for HBB. Then
> after testing we should be able to drop r/w part of the config.

I'd rather put the warn in ubwc_config.c

Konrad

  reply	other threads:[~2025-05-15 15:51 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-14 15:10 [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data Konrad Dybcio
2025-05-14 15:10 ` [PATCH RFT v2 01/15] soc: qcom: Add UBWC config provider Konrad Dybcio
2025-05-14 15:29   ` Konrad Dybcio
2025-05-14 19:03   ` Dmitry Baryshkov
2025-05-15 15:50     ` Konrad Dybcio
2025-05-14 15:10 ` [PATCH RFT v2 02/15] drm/msm: Offset MDSS HBB value by 13 Konrad Dybcio
2025-05-14 19:04   ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 03/15] drm/msm: Use the central UBWC config database Konrad Dybcio
2025-05-14 19:05   ` Dmitry Baryshkov
2025-05-15 10:32   ` kernel test robot
2025-05-14 15:10 ` [PATCH RFT v2 04/15] drm/msm/a6xx: Get a handle to the common UBWC config Konrad Dybcio
2025-05-14 15:10 ` [PATCH RFT v2 05/15] drm/msm/a6xx: Resolve the meaning of AMSBC Konrad Dybcio
2025-05-14 19:16   ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 06/15] drm/msm/a6xx: Simplify uavflagprd_inv detection Konrad Dybcio
2025-05-14 19:14   ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 07/15] drm/msm/a6xx: Resolve the meaning of UBWC_MODE Konrad Dybcio
2025-05-14 19:14   ` Dmitry Baryshkov
2025-05-14 20:02     ` Rob Clark
2025-05-14 15:10 ` [PATCH RFT v2 08/15] drm/msm/a6xx: Replace '2' with BIT(1) in level2_swizzling_dis calc Konrad Dybcio
2025-05-14 19:15   ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 09/15] drm/msm/a6xx: Resolve the meaning of rgb565_predicator Konrad Dybcio
2025-05-14 19:15   ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 10/15] drm/msm/a6xx: Simplify min_acc_len calculation Konrad Dybcio
2025-05-14 19:19   ` Dmitry Baryshkov
2025-05-15 15:51     ` Konrad Dybcio
2025-05-14 15:10 ` [PATCH RFT v2 11/15] drm/msm/adreno: Switch to the common UBWC config struct Konrad Dybcio
2025-05-14 19:22   ` Dmitry Baryshkov
2025-05-15 15:51     ` Konrad Dybcio [this message]
2025-05-14 15:10 ` [PATCH RFT v2 12/15] drm/msm/a6xx: Drop cfg->ubwc_swizzle override Konrad Dybcio
2025-05-14 20:32   ` Dmitry Baryshkov
2025-05-15 15:52     ` Konrad Dybcio
2025-05-14 15:10 ` [PATCH RFT v2 13/15] soc: qcom: ubwc: Fix SM6125's ubwc_swizzle value Konrad Dybcio
2025-05-14 19:23   ` Dmitry Baryshkov
2025-05-14 20:05     ` Konrad Dybcio
2025-05-14 20:33       ` Dmitry Baryshkov
2025-05-15 16:18         ` Konrad Dybcio
2025-05-15 16:21           ` Dmitry Baryshkov
2025-05-15 16:35             ` Konrad Dybcio
2025-05-15 17:15               ` Dmitry Baryshkov
2025-05-15 17:56                 ` Konrad Dybcio
2025-05-15 17:58                   ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 14/15] soc: qcom: ubwc: Add #defines for UBWC swizzle bits Konrad Dybcio
2025-05-14 19:24   ` Dmitry Baryshkov
2025-05-14 20:09     ` Konrad Dybcio
2025-05-14 20:33       ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFC RFT v2 15/15] drm/msm/a6xx: Warn if the highest_bank_bit value is overwritten Konrad Dybcio
2025-05-14 19:25   ` Dmitry Baryshkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=503932a8-3124-4448-b18a-e25554745488@oss.qualcomm.com \
    --to=konrad.dybcio@oss.qualcomm.com \
    --cc=airlied@gmail.com \
    --cc=andersson@kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_akhilpo@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=simona@ffwll.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox