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 6/7] drm/i915/dsb: Skip redundant zeroing of every second indexed write DW
Date: Tue, 17 Nov 2026 17:57:52 +0200	[thread overview]
Message-ID: <5db805a0f604db14d219c0fb43bd46d9f492590d@intel.com> (raw)
In-Reply-To: <20261116081041.6519-7-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_reg_write_indexed() assumes that it may be
> the last register write into the same register, and proceeds
> to zero out the last misaligned DW. But if another indexed write
> to the same register follows (as it usually does) that zeroed DW
> will again be overwritten with the new register value.
>
> So every second indexed register write in a sequence will
> perform a completely redundant DW write. Considering that the
> DSB buffer will be in device memory on discrete GPUs we
> probably don't want to do these redundant writes.
>
> Defer the extra DW write to intel_dsb_ins_align() which gets
> called ahead of every new DSB instruction emitted. There we'll
> just have to write a single DW, if the previous indexed write
> left us with an odd number of DWs.
>
> Eliminating these and other redundant writes speeds up the
> DSB buffer writes for a 1024 entry LUT update from ~75 usec
> to ~45 usec on my DG2.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

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

> ---
>  drivers/gpu/drm/i915/display/intel_dsb.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c b/drivers/gpu/drm/i915/display/intel_dsb.c
> index f8ca64a3c076..f7a54dc44894 100644
> --- a/drivers/gpu/drm/i915/display/intel_dsb.c
> +++ b/drivers/gpu/drm/i915/display/intel_dsb.c
> @@ -336,14 +336,11 @@ static bool intel_dsb_prev_ins_is_indexed_write(struct intel_dsb *dsb)
>  static void intel_dsb_ins_align(struct intel_dsb *dsb)
>  {
>  	/*
> -	 * Every instruction should be 8 byte aligned.
> -	 *
> -	 * The only way to get unaligned free_pos is via
> -	 * intel_dsb_reg_write_indexed() which already
> -	 * makes sure the next dword is zeroed, so no need
> -	 * to clear it here.
> +	 * Every instruction must be 8 byte aligned.
> +	 * Indexed register writes may leave free_pos misaligned.
>  	 */
> -	dsb->free_pos = ALIGN(dsb->free_pos, 2);
> +	if (dsb->free_pos & 1)
> +		dsb_buffer_write(dsb, dsb->free_pos++, 0);
>  }
>  
>  static void intel_dsb_emit(struct intel_dsb *dsb, u32 ldw, u32 udw)
> @@ -417,9 +414,6 @@ void intel_dsb_reg_write_indexed(struct intel_dsb *dsb,
>  	dsb_buffer_write(dsb, dsb->ins_start_offset + 0, dsb->ins[0]);
>  
>  	dsb_buffer_write(dsb, dsb->free_pos++, val);
> -	/* if number of data words is odd, then the last dword should be 0.*/
> -	if (dsb->free_pos & 0x1)
> -		dsb_buffer_write(dsb, dsb->free_pos, 0);
>  }
>  
>  void intel_dsb_reg_write(struct intel_dsb *dsb,

-- 
Jani Nikula, Intel

  reply	other threads:[~2026-11-17 15:58 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
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 [this message]
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=5db805a0f604db14d219c0fb43bd46d9f492590d@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