Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 3/7] drm/i915/dsb: Carve up intel_dsb_prev_ins_is_indexed_write()
Date: Tue, 17 Nov 2026 17:47:20 +0200	[thread overview]
Message-ID: <de9948c3347d9370e83f26e98c0f133b90dc0cca@intel.com> (raw)
In-Reply-To: <20261116081041.6519-4-ville.syrjala@linux.intel.com>

On Mon, 16 Nov 2026, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Currently intel_dsb_prev_ins_is_indexed_write() checks both the
> opcode and the register offset. I'll be needing the opcode
> only part for a second use, so carve the function up into
> two parts:
> - intel_dsb_prev_ins_is_indexed_write() which just checks
>   the opcode
> - intel_dsb_prev_ins_is_indexed_write_to_reg() which checks
>   both the opcode and the register offset
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dsb.c | 29 ++++++++++++++++--------
>  1 file changed, 20 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c b/drivers/gpu/drm/i915/display/intel_dsb.c
> index 8357c712a20e..fa4964c17163 100644
> --- a/drivers/gpu/drm/i915/display/intel_dsb.c
> +++ b/drivers/gpu/drm/i915/display/intel_dsb.c
> @@ -310,6 +310,20 @@ static unsigned int intel_dsb_tail(struct intel_dsb *dsb)
>  	return dsb_buffer_ggtt_offset(dsb) + intel_dsb_size(dsb);
>  }
>  
> +static bool intel_dsb_prev_ins_is_indexed_write(struct intel_dsb *dsb)
> +{
> +	u32 opcode = DSB_OPCODE_INDEXED_WRITE << DSB_OPCODE_SHIFT;
> +	u32 prev_opcode;
> +
> +	/* Nothing emitted yet? */
> +	if (dsb->free_pos == 0)
> +		return false;
> +
> +	prev_opcode = dsb->ins[1] & ~DSB_REG_VALUE_MASK;
> +
> +	return prev_opcode == opcode;
> +}
> +

Surprising location far away from the "to_reg" counterpart, but okay.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


>  static void intel_dsb_ins_align(struct intel_dsb *dsb)
>  {
>  	/*
> @@ -338,20 +352,17 @@ static void intel_dsb_emit(struct intel_dsb *dsb, u32 ldw, u32 udw)
>  	dsb_buffer_write(dsb, dsb->free_pos++, dsb->ins[1]);
>  }
>  
> -static bool intel_dsb_prev_ins_is_indexed_write(struct intel_dsb *dsb,
> -						intel_reg_t reg)
> +static bool intel_dsb_prev_ins_is_indexed_write_to_reg(struct intel_dsb *dsb,
> +						       intel_reg_t reg)
>  {
> -	u32 opcode = DSB_OPCODE_INDEXED_WRITE << DSB_OPCODE_SHIFT;
> -	u32 prev_opcode, prev_reg;
> +	u32 prev_reg;
>  
> -	/* Nothing emitted yet? */
> -	if (dsb->free_pos == 0)
> +	if (!intel_dsb_prev_ins_is_indexed_write(dsb))
>  		return false;
>  
> -	prev_opcode = dsb->ins[1] & ~DSB_REG_VALUE_MASK;
>  	prev_reg =  dsb->ins[1] & DSB_REG_VALUE_MASK;
>  
> -	return prev_opcode == opcode && prev_reg == intel_reg_offset(reg);
> +	return prev_reg == intel_reg_offset(reg);
>  }
>  
>  /**
> @@ -386,7 +397,7 @@ void intel_dsb_reg_write_indexed(struct intel_dsb *dsb,
>  	 * we are writing odd no of dwords, Zeros will be added in the end for
>  	 * padding.
>  	 */
> -	if (!intel_dsb_prev_ins_is_indexed_write(dsb, reg))
> +	if (!intel_dsb_prev_ins_is_indexed_write_to_reg(dsb, reg))
>  		intel_dsb_emit(dsb, 0, /* count */
>  			       (DSB_OPCODE_INDEXED_WRITE << DSB_OPCODE_SHIFT) |
>  			       intel_reg_offset(reg));

-- 
Jani Nikula, Intel

  reply	other threads:[~2026-11-17 15:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  8:10 [PATCH 0/7] drm/i915/dsb: Optimize indexed register writes Ville Syrjala
2026-11-16  8:10 ` [PATCH 1/7] drm/i915/dsb: Remove old comment about stale contents of the DSB buffer Ville Syrjala
2026-11-17 15:43   ` Jani Nikula
2026-11-16  8:10 ` [PATCH 2/7] drm/i915/dsb: Eliminate intel_dsb_prev_ins_is_write() Ville Syrjala
2026-11-17 15:44   ` Jani Nikula
2026-11-16  8:10 ` [PATCH 3/7] drm/i915/dsb: Carve up intel_dsb_prev_ins_is_indexed_write() Ville Syrjala
2026-11-17 15:47   ` Jani Nikula [this message]
2026-11-16  8:10 ` [PATCH 4/7] drm/i915/dsb: Extract intel_dsb_set_ins() Ville Syrjala
2026-11-17 15:48   ` Jani Nikula
2026-11-16  8:10 ` [PATCH 5/7] drm/i915/dsb: Update previous instruction tracking in intel_dsb_align_tail() & co Ville Syrjala
2026-11-17 16:07   ` Jani Nikula
2026-11-17 18:41     ` Ville Syrjälä
2026-11-17 18:55       ` Ville Syrjälä
2026-11-16  8:10 ` [PATCH 6/7] drm/i915/dsb: Skip redundant zeroing of every second indexed write DW Ville Syrjala
2026-11-17 15:57   ` Jani Nikula
2026-11-16  8:10 ` [PATCH 7/7] drm/i915/dsb: Avoid redundant writes to the DSB buffer for indexed register writes Ville Syrjala
2026-11-17 16:05   ` Jani Nikula
2026-11-17 18:46     ` Ville Syrjälä
2026-11-16  8:47 ` ✓ CI.KUnit: success for drm/i915/dsb: Optimize " Patchwork
2026-11-16  9:19 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-16 12:32 ` ✓ Xe.CI.FULL: " Patchwork

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=de9948c3347d9370e83f26e98c0f133b90dc0cca@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --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