summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2026-06-03 18:14:33 +0300
committerJani Nikula <jani.nikula@intel.com>2026-06-10 12:03:54 +0300
commitacfef63368a2c3aba05777045a6eb36ece93fcbe (patch)
tree61ea4c59ff1c300a891e391555240bcd3a17532a
parent3850e082db0fbd60962d56e56043ee955c122871 (diff)
drm/i915/color: join loops in xelpd_program_plane_post_csc_lut()
Use single for loops instead of two. Especially switching from a for-loop to a do-while-loop with the same loop index is confusing, and it's hard to figure out the end index. Define the end in terms of lut_size; there's three more entries after the first 32. Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com> Link: https://patch.msgid.link/011336e9d57bba57e15d1aa64ae53a20c461ed62.1780499355.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <jani.nikula@intel.com>
-rw-r--r--drivers/gpu/drm/i915/display/intel_color.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
index 48f09c73e513..5c09c5dd361e 100644
--- a/drivers/gpu/drm/i915/display/intel_color.c
+++ b/drivers/gpu/drm/i915/display/intel_color.c
@@ -4024,35 +4024,27 @@ xelpd_program_plane_post_csc_lut(struct intel_dsb *dsb,
intel_de_write_dsb(display, dsb, PLANE_POST_CSC_GAMC_SEG0_INDEX_ENH(pipe, plane, 0),
PLANE_PAL_PREC_AUTO_INCREMENT);
if (post_csc_lut) {
- for (i = 0; i < lut_size; i++) {
- lut_val = drm_color_lut32_extract(post_csc_lut[i].green, 24);
+ for (i = 0; i < lut_size + 3; i++) {
+ if (i < lut_size)
+ lut_val = drm_color_lut32_extract(post_csc_lut[i].green, 24);
+ /* else clamp to the last LUT value to prevent step discontinuity */
intel_de_write_dsb(display, dsb,
PLANE_POST_CSC_GAMC_DATA_ENH(pipe, plane, 0),
lut_val);
}
-
- /* Segment 2 - clamp to the last LUT value to prevent step discontinuity */
- do {
- intel_de_write_dsb(display, dsb,
- PLANE_POST_CSC_GAMC_DATA_ENH(pipe, plane, 0),
- lut_val);
- } while (i++ < 34);
} else {
/*TODO: Add for segment 0 */
- for (i = 0; i < lut_size; i++) {
- lut_val = (i * ((1 << 24) - 1)) / (lut_size - 1);
+ for (i = 0; i < lut_size + 3; i++) {
+ if (i < lut_size)
+ lut_val = (i * ((1 << 24) - 1)) / (lut_size - 1);
+ else
+ lut_val = 1 << 24;
intel_de_write_dsb(display, dsb,
PLANE_POST_CSC_GAMC_DATA_ENH(pipe, plane, 0),
lut_val);
}
-
- do {
- intel_de_write_dsb(display, dsb,
- PLANE_POST_CSC_GAMC_DATA_ENH(pipe, plane, 0),
- 1 << 24);
- } while (i++ < 34);
}
intel_de_write_dsb(display, dsb, PLANE_POST_CSC_GAMC_INDEX_ENH(pipe, plane, 0), 0);