Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: <intel-gfx@lists.freedesktop.org>,
	<intel-xe@lists.freedesktop.org>, <jani.nikula@linux.intel.com>,
	<suraj.kandpal@intel.com>
Subject: Re: [PATCH 02/19] drm/i915/dss_regs: Use REG_* macros for the DSS ctl bits
Date: Mon, 2 Sep 2024 10:06:58 +0530	[thread overview]
Message-ID: <6eb3cb54-a8b8-4035-8070-c2e4a507c0dd@intel.com> (raw)
In-Reply-To: <ZtGqzFZzkn-HoVC4@intel.com>

Thanks Ville for the comments.

Please my response inline:

On 8/30/2024 4:49 PM, Ville Syrjälä wrote:
> On Fri, Aug 30, 2024 at 10:39:32AM +0530, Ankit Nautiyal wrote:
>> Cleanup register definitions for DSS CLT reg bits.
> DSS_CTL

Will fix this in next version.


>
>> Replace the hand rolled (1<<n) with the modern REG_BIT().
>> Use REG_GENMASK and REG_FIELD_PREP for the bit fields.
>>
>> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
>> ---
>>   drivers/gpu/drm/i915/display/intel_dss_regs.h | 34 ++++++++++---------
>>   1 file changed, 18 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_dss_regs.h b/drivers/gpu/drm/i915/display/intel_dss_regs.h
>> index b1e24ea027c3..cfc8ef451917 100644
>> --- a/drivers/gpu/drm/i915/display/intel_dss_regs.h
>> +++ b/drivers/gpu/drm/i915/display/intel_dss_regs.h
>> @@ -10,35 +10,37 @@
>>   
>>   /* Display Stream Splitter Control */
>>   #define DSS_CTL1				_MMIO(0x67400)
>> -#define  SPLITTER_ENABLE			(1 << 31)
>> -#define  JOINER_ENABLE				(1 << 30)
>> -#define  DUAL_LINK_MODE_INTERLEAVE		(1 << 24)
>> +#define  SPLITTER_ENABLE			REG_BIT(31)
>> +#define  JOINER_ENABLE				REG_BIT(30)
>> +#define  DUAL_LINK_MODE_INTERLEAVE		REG_BIT(24)
>>   #define  DUAL_LINK_MODE_FRONTBACK		(0 << 24)
> If we want to keep this then we should define the bit as
> DUAL_LINK_MODE_MASK, and then both values should be defined
> via REG_FIELD_PREP().

Makes sense. I will add DUAL_LINK_MODE_MASK and prepare value for 
Interleave and frontback.

>
>> -#define  OVERLAP_PIXELS_MASK			(0xf << 16)
>> -#define  OVERLAP_PIXELS(pixels)			((pixels) << 16)
>> -#define  LEFT_DL_BUF_TARGET_DEPTH_MASK		(0xfff << 0)
>> -#define  LEFT_DL_BUF_TARGET_DEPTH(pixels)	((pixels) << 0)
>> +#define  OVERLAP_PIXELS_MASK			REG_GENMASK(19, 16)
>> +#define  OVERLAP_PIXELS(pixels)			REG_FIELD_PREP(OVERLAP_PIXELS_MASK, pixels)
>> +#define  LEFT_DL_BUF_TARGET_DEPTH_MASK		REG_GENMASK(11, 0)
>> +#define  LEFT_DL_BUF_TARGET_DEPTH(pixels)	REG_FIELD_PREP(LEFT_DL_BUF_TARGET_DEPTH_MASK, \
>> +							       pixels)
> Protect with '(pixels)'
Will take care of this.
>
> The extra line wrap seems pointless.

This was just to make checkpatch happy to avoid long line, but if it 
hampers readability I will do away with this.


>
>>   #define  MAX_DL_BUFFER_TARGET_DEPTH		0x5a0
>>   
>>   #define DSS_CTL2				_MMIO(0x67404)
>> -#define  LEFT_BRANCH_VDSC_ENABLE		(1 << 31)
>> -#define  RIGHT_BRANCH_VDSC_ENABLE		(1 << 15)
>> -#define  RIGHT_DL_BUF_TARGET_DEPTH_MASK		(0xfff << 0)
>> -#define  RIGHT_DL_BUF_TARGET_DEPTH(pixels)	((pixels) << 0)
>> +#define  LEFT_BRANCH_VDSC_ENABLE		REG_BIT(31)
>> +#define  RIGHT_BRANCH_VDSC_ENABLE		REG_BIT(15)
>> +#define  RIGHT_DL_BUF_TARGET_DEPTH_MASK		REG_GENMASK(11, 0)
>> +#define  RIGHT_DL_BUF_TARGET_DEPTH(pixels)	REG_FIELD_PREP(RIGHT_DL_BUF_TARGET_DEPTH_MASK,\
>> +							       pixels)
> Another unprotected macro argument.

Will fix this in the next version.

Thanks again for the suggestions/comments. I will take care of these in 
the next version.

Regards,

Ankit

>
>>   
>>   #define _ICL_PIPE_DSS_CTL1_PB			0x78200
>>   #define _ICL_PIPE_DSS_CTL1_PC			0x78400
>>   #define ICL_PIPE_DSS_CTL1(pipe)			_MMIO_PIPE((pipe) - PIPE_B, \
>>   							   _ICL_PIPE_DSS_CTL1_PB, \
>>   							   _ICL_PIPE_DSS_CTL1_PC)
>> -#define  BIG_JOINER_ENABLE			(1 << 29)
>> -#define  PRIMARY_BIG_JOINER_ENABLE		(1 << 28)
>> -#define  VGA_CENTERING_ENABLE			(1 << 27)
>> +#define  BIG_JOINER_ENABLE			REG_BIT(29)
>> +#define  PRIMARY_BIG_JOINER_ENABLE		REG_BIT(28)
>> +#define  VGA_CENTERING_ENABLE			REG_BIT(27)
>>   #define  SPLITTER_CONFIGURATION_MASK		REG_GENMASK(26, 25)
>>   #define  SPLITTER_CONFIGURATION_2_SEGMENT	REG_FIELD_PREP(SPLITTER_CONFIGURATION_MASK, 0)
>>   #define  SPLITTER_CONFIGURATION_4_SEGMENT	REG_FIELD_PREP(SPLITTER_CONFIGURATION_MASK, 1)
>> -#define  UNCOMPRESSED_JOINER_PRIMARY		(1 << 21)
>> -#define  UNCOMPRESSED_JOINER_SECONDARY		(1 << 20)
>> +#define  UNCOMPRESSED_JOINER_PRIMARY		REG_BIT(21)
>> +#define  UNCOMPRESSED_JOINER_SECONDARY		REG_BIT(20)
>>   
>>   #define _ICL_PIPE_DSS_CTL2_PB			0x78204
>>   #define _ICL_PIPE_DSS_CTL2_PC			0x78404
>> -- 
>> 2.45.2

  reply	other threads:[~2024-09-02  4:37 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-30  5:09 [PATCH 00/19] Consolidation of DSS Control in Separate Files Ankit Nautiyal
2024-08-30  5:09 ` [PATCH 01/19] drm/i915/display: Move all DSS control registers to a new file Ankit Nautiyal
2024-08-30  5:09 ` [PATCH 02/19] drm/i915/dss_regs: Use REG_* macros for the DSS ctl bits Ankit Nautiyal
2024-08-30 11:19   ` Ville Syrjälä
2024-09-02  4:36     ` Nautiyal, Ankit K [this message]
2024-08-30  5:09 ` [PATCH 03/19] drm/i915/ddi: Move all mso related helpers to a new file Ankit Nautiyal
2024-08-30  5:09 ` [PATCH 04/19] drm/i915/dss: Move to struct intel_display Ankit Nautiyal
2024-08-30  5:09 ` [PATCH 05/19] drm/i915/icl_dsi: Avoid using intel_dsi in configure_dual_link_mode Ankit Nautiyal
2024-08-30  5:09 ` [PATCH 06/19] drm/i915/icl_dsi: Use intel_display " Ankit Nautiyal
2024-08-30  5:09 ` [PATCH 07/19] drm/i915/icl_dsi: Move helpers to configure dsi dual link to intel_dss Ankit Nautiyal
2024-08-30 11:25   ` Ville Syrjälä
2024-09-02  4:51     ` Nautiyal, Ankit K
2024-08-30  5:09 ` [PATCH 08/19] drm/i915/vdsc: Rename helper to check if the pipe supports dsc Ankit Nautiyal
2024-08-30  5:09 ` [PATCH 09/19] drm/i915/vdsc: Move all dss stuff in dss files Ankit Nautiyal
2024-08-30  5:09 ` [PATCH 10/19] drm/i915/dss: Use struct intel_display in dss dsc helpers Ankit Nautiyal
2024-08-30  5:09 ` [PATCH 11/19] drm/i915/display: Move dss stuff in intel_dss files Ankit Nautiyal
2024-08-30  5:09 ` [PATCH 12/19] drm/i915/display: Rename static functions that use joiner Ankit Nautiyal
2024-08-30  5:09 ` [PATCH 13/19] drm/i915/display: Separate out joiner stuff in a new file Ankit Nautiyal
2024-08-30  5:09 ` [PATCH 14/19] drm/i915/display: Move intel_crtc_joined_pipe_mask to intel_joiner Ankit Nautiyal
2024-08-30  5:09 ` [PATCH 15/19] drm/i915/display: Move helpers for primary joiner " Ankit Nautiyal
2024-08-30  5:09 ` [PATCH 16/19] drm/i915/display: Move intel_crtc_is_joiner_secondary " Ankit Nautiyal
2024-08-30  5:09 ` [PATCH 17/19] drm/i915/display: Move intel_crtc_joiner_secondary_pipes " Ankit Nautiyal
2024-08-30  5:09 ` [PATCH 18/19] drm/i915/joiner: Use struct intel_display in intel_joiner_enabled_pipes Ankit Nautiyal
2024-08-30  5:09 ` [PATCH 19/19] drm/i915/joiner: Use struct intel_display in intel_joiner_supported_pipes Ankit Nautiyal
2024-08-30  5:53 ` ✗ Fi.CI.CHECKPATCH: warning for Consolidation of DSS Control in Separate Files (rev3) Patchwork
2024-08-30  5:53 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-08-30  6:14 ` ✓ Fi.CI.BAT: success " Patchwork
2024-09-01  0:37 ` ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2024-08-29 13:18 [PATCH 00/19] Consolidation of DSS Control in Separate Files Ankit Nautiyal
2024-08-29 13:18 ` [PATCH 02/19] drm/i915/dss_regs: Use REG_* macros for the DSS ctl bits Ankit Nautiyal

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=6eb3cb54-a8b8-4035-8070-c2e4a507c0dd@intel.com \
    --to=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=suraj.kandpal@intel.com \
    --cc=ville.syrjala@linux.intel.com \
    /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