drm/i915/dsb: Don't use indexed register writes needlessly
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 20 Nov 2024 16:41:20 +0000 (18:41 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 28 Nov 2024 15:41:55 +0000 (17:41 +0200)
commitecba559a88ab8399a41893d7828caf4dccbeab6c
treee0ad30014fb9c259b2ba9ffc90e564ea6a9f6056
parent24387a21dc8d3d7be9ce7a99dba4d4477456caab
drm/i915/dsb: Don't use indexed register writes needlessly

Turns out the DSB indexed register write command has
rather significant initial overhead compared to the normal
MMIO write command. Based on some quick experiments on TGL
you have to write the register at least ~5 times for the
indexed write command to come out ahead. If you write the
register less times than that the MMIO write is faster.

So it seems my automagic indexed write logic was a bit
misguided. Go back to the original approach only use
indexed writes for the cases we know will benefit from
it (indexed LUT register updates).

Currently we shouldn't have any cases where this truly
matters (just some rare double writes to the precision
LUT index registers), but we will need to switch the
legacy LUT updates to write each LUT register twice (to
avoid some palette anti-collision logic troubles).
This would be close to the worst case for using indexed
writes (two writes per register, and 256 separate registers).
Using the MMIO write command should shave off around 30%
of the execution time compared to using the indexed write
command.

Cc: stable@vger.kernel.org
Fixes: 34d8311f4a1c ("drm/i915/dsb: Re-instate DSB for LUT updates")
Fixes: 25ea3411bd23 ("drm/i915/dsb: Use non-posted register writes for legacy LUT")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241120164123.12706-2-ville.syrjala@linux.intel.com
Reviewed-by: Uma Shankar <uma.shankar@intel.com>
drivers/gpu/drm/i915/display/intel_color.c
drivers/gpu/drm/i915/display/intel_dsb.c
drivers/gpu/drm/i915/display/intel_dsb.h