* [RFC PATCH 1/2] drm/i915/color: only let the owning plane program the 3D LUT
2026-11-18 19:15 [RFC PATCH 0/2] drm/i915/color: 3D LUT fixes Matthew Schwartz
@ 2026-11-18 19:15 ` Matthew Schwartz
2026-11-18 19:15 ` [RFC PATCH 2/2] drm/i915/color: load the 3D LUT in the order the hardware indexes it Matthew Schwartz
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Matthew Schwartz @ 2026-11-18 19:15 UTC (permalink / raw)
To: intel-gfx, intel-xe
Cc: uma.shankar, chaitanya.kumar.borah, Matthew Schwartz, Jani Nikula,
Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin, David Airlie,
Simona Vetter, Suraj Kandpal, dri-devel, linux-kernel
intel_color_plane_commit_arm() runs for every universal plane on pipes A
and B and rewrites LUT_3D_CTL from that plane's own 3D LUT state. Only
the primary plane on Xe3p_LPD can carry a 3D LUT colorop, so any other
plane update on those pipes disables the LUT the primary plane enabled,
and on older platforms every plane update writes a register no plane
owns.
Give the "Xe3p_LPD primary plane owns the 3D LUT" rule a single helper
and use it both to build the plane color pipeline and to decide who may
write LUT_3D_CTL.
Fixes: 65db7a1f9cf7 ("drm/i915/color: Add 3D LUT to color pipeline")
Signed-off-by: Matthew Schwartz <matthew.schwartz@linux.dev>
---
drivers/gpu/drm/i915/display/intel_color.c | 10 +++++++++-
drivers/gpu/drm/i915/display/intel_color.h | 3 +++
drivers/gpu/drm/i915/display/intel_color_pipeline.c | 10 +---------
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
index 4070dc8d97d9..742ae471540d 100644
--- a/drivers/gpu/drm/i915/display/intel_color.c
+++ b/drivers/gpu/drm/i915/display/intel_color.c
@@ -4278,9 +4278,10 @@ void intel_color_plane_commit_arm(struct intel_dsb *dsb,
const struct intel_plane_state *plane_state)
{
struct intel_display *display = to_intel_display(plane_state);
+ struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct intel_crtc *crtc = to_intel_crtc(plane_state->uapi.crtc);
- if (crtc && intel_color_crtc_has_3dlut(display, crtc->pipe))
+ if (crtc && intel_color_plane_has_3dlut(display, plane->pipe, plane->id))
glk_lut_3d_commit(dsb, crtc, !!plane_state->hw.lut_3d);
}
@@ -4313,6 +4314,13 @@ intel_color_crtc_has_3dlut(struct intel_display *display, enum pipe pipe)
return false;
}
+bool intel_color_plane_has_3dlut(struct intel_display *display,
+ enum pipe pipe, enum plane_id plane_id)
+{
+ return DISPLAY_VER(display) >= 35 && plane_id == PLANE_PRIMARY &&
+ intel_color_crtc_has_3dlut(display, pipe);
+}
+
static void
intel_color_load_3dlut(struct intel_dsb *dsb,
const struct intel_plane_state *plane_state)
diff --git a/drivers/gpu/drm/i915/display/intel_color.h b/drivers/gpu/drm/i915/display/intel_color.h
index f3963a8d1239..9d11741423ef 100644
--- a/drivers/gpu/drm/i915/display/intel_color.h
+++ b/drivers/gpu/drm/i915/display/intel_color.h
@@ -16,6 +16,7 @@ struct intel_dsb;
struct intel_plane_state;
struct drm_property_blob;
enum pipe;
+enum plane_id;
void intel_color_init_hooks(struct intel_display *display);
int intel_color_init(struct intel_display *display);
@@ -47,6 +48,8 @@ void intel_color_plane_program_pipeline(struct intel_dsb *dsb,
void intel_color_plane_commit_arm(struct intel_dsb *dsb,
const struct intel_plane_state *plane_state);
bool intel_color_crtc_has_3dlut(struct intel_display *display, enum pipe pipe);
+bool intel_color_plane_has_3dlut(struct intel_display *display,
+ enum pipe pipe, enum plane_id plane_id);
u32 intel_color_background_color_drm_to_hw(u64 drm_background_color);
u64 intel_color_background_color_hw_to_drm(u32 hw_background_color);
diff --git a/drivers/gpu/drm/i915/display/intel_color_pipeline.c b/drivers/gpu/drm/i915/display/intel_color_pipeline.c
index 7fc31fe891a8..77f65182e3e3 100644
--- a/drivers/gpu/drm/i915/display/intel_color_pipeline.c
+++ b/drivers/gpu/drm/i915/display/intel_color_pipeline.c
@@ -58,14 +58,6 @@ static const u64 intel_plane_supported_csc_ff =
BIT(DRM_COLOROP_FM_YCBCR2020_NC_FULL_RGB) |
BIT(DRM_COLOROP_FM_YCBCR2020_NC_LIMITED_RGB);
-static bool plane_has_3dlut(struct intel_display *display, enum pipe pipe,
- struct drm_plane *plane)
-{
- return (DISPLAY_VER(display) >= 35 &&
- intel_color_crtc_has_3dlut(display, pipe) &&
- plane->type == DRM_PLANE_TYPE_PRIMARY);
-}
-
static
struct intel_colorop *intel_color_pipeline_plane_add_colorop(struct drm_plane *plane,
struct intel_colorop *prev,
@@ -144,7 +136,7 @@ int _intel_color_pipeline_plane_init(struct drm_plane *plane, struct drm_prop_en
int ret = 0;
int i;
- if (plane_has_3dlut(display, pipe, plane)) {
+ if (intel_color_plane_has_3dlut(display, pipe, to_intel_plane(plane)->id)) {
pipeline = xe3plpd_primary_plane_pipeline;
pipeline_len = ARRAY_SIZE(xe3plpd_primary_plane_pipeline);
} else if (icl_is_hdr_plane(display, to_intel_plane(plane)->id)) {
--
2.56.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [RFC PATCH 2/2] drm/i915/color: load the 3D LUT in the order the hardware indexes it
2026-11-18 19:15 [RFC PATCH 0/2] drm/i915/color: 3D LUT fixes Matthew Schwartz
2026-11-18 19:15 ` [RFC PATCH 1/2] drm/i915/color: only let the owning plane program the 3D LUT Matthew Schwartz
@ 2026-11-18 19:15 ` Matthew Schwartz
2026-11-19 17:53 ` [RFC PATCH 0/2] drm/i915/color: 3D LUT fixes Borah, Chaitanya Kumar
2026-11-19 22:50 ` ✓ i915.CI.BAT: success for " Patchwork
3 siblings, 0 replies; 5+ messages in thread
From: Matthew Schwartz @ 2026-11-18 19:15 UTC (permalink / raw)
To: intel-gfx, intel-xe
Cc: uma.shankar, chaitanya.kumar.borah, Matthew Schwartz, Jani Nikula,
Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin, David Airlie,
Simona Vetter, Suraj Kandpal, dri-devel, linux-kernel
The 3D LUT colorop blob is laid out with red as the fastest axis,
index = R + n * (G + n * B). glk_load_lut_3d() writes the blob to
LUT_3D_DATA front to back, but the hardware walks its table with blue as
the fastest axis and red as the slowest. Every entry whose red and blue
coordinates differ lands at the node with the two exchanged.
Measured on Lunar Lake by programming the pipe-bound LUT through
LUT_3D_INDEX and LUT_3D_DATA directly and decoding the pipe CRC of solid
color frames. A table holding each node's own stream position reads back
position B + 17 * G + 289 * R, and an identity table written in that
order reproduces all of 70 sampled colors exactly.
Write the table in hardware order.
Fixes: 65db7a1f9cf7 ("drm/i915/color: Add 3D LUT to color pipeline")
Signed-off-by: Matthew Schwartz <matthew.schwartz@linux.dev>
---
drivers/gpu/drm/i915/display/intel_color.c | 18 +++++++++++++++---
drivers/gpu/drm/i915/display/intel_color.h | 2 ++
.../drm/i915/display/intel_color_pipeline.c | 2 +-
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
index 742ae471540d..ea4e6c9f0309 100644
--- a/drivers/gpu/drm/i915/display/intel_color.c
+++ b/drivers/gpu/drm/i915/display/intel_color.c
@@ -4112,8 +4112,8 @@ static void glk_load_lut_3d(struct intel_dsb *dsb,
{
struct intel_display *display = to_intel_display(crtc->base.dev);
const struct drm_color_lut32 *lut = blob->data;
- int i, lut_size = drm_color_lut32_size(blob);
enum pipe pipe = crtc->pipe;
+ int r, g, b;
if (!dsb && intel_de_read(display, LUT_3D_CTL(pipe)) & LUT_3D_READY) {
drm_err(display->drm, "[CRTC:%d:%s] 3D LUT not ready, not loading LUTs\n",
@@ -4121,9 +4121,21 @@ static void glk_load_lut_3d(struct intel_dsb *dsb,
return;
}
+ /*
+ * The hardware walks the table with blue as the fastest axis, the
+ * colorop blob with red.
+ */
intel_de_write_dsb(display, dsb, LUT_3D_INDEX(pipe), LUT_3D_AUTO_INCREMENT);
- for (i = 0; i < lut_size; i++)
- intel_de_write_dsb(display, dsb, LUT_3D_DATA(pipe), glk_3dlut_10(&lut[i]));
+ for (r = 0; r < LUT_3D_SIZE; r++) {
+ for (g = 0; g < LUT_3D_SIZE; g++) {
+ for (b = 0; b < LUT_3D_SIZE; b++) {
+ int i = r + LUT_3D_SIZE * (g + LUT_3D_SIZE * b);
+
+ intel_de_write_dsb(display, dsb, LUT_3D_DATA(pipe),
+ glk_3dlut_10(&lut[i]));
+ }
+ }
+ }
intel_de_write_dsb(display, dsb, LUT_3D_INDEX(pipe), 0);
}
diff --git a/drivers/gpu/drm/i915/display/intel_color.h b/drivers/gpu/drm/i915/display/intel_color.h
index 9d11741423ef..02ef30390558 100644
--- a/drivers/gpu/drm/i915/display/intel_color.h
+++ b/drivers/gpu/drm/i915/display/intel_color.h
@@ -18,6 +18,8 @@ struct drm_property_blob;
enum pipe;
enum plane_id;
+#define LUT_3D_SIZE 17
+
void intel_color_init_hooks(struct intel_display *display);
int intel_color_init(struct intel_display *display);
void intel_color_crtc_init(struct intel_crtc *crtc);
diff --git a/drivers/gpu/drm/i915/display/intel_color_pipeline.c b/drivers/gpu/drm/i915/display/intel_color_pipeline.c
index 77f65182e3e3..0c73072819fb 100644
--- a/drivers/gpu/drm/i915/display/intel_color_pipeline.c
+++ b/drivers/gpu/drm/i915/display/intel_color_pipeline.c
@@ -88,7 +88,7 @@ struct intel_colorop *intel_color_pipeline_plane_add_colorop(struct drm_plane *p
break;
case INTEL_PLANE_CB_3DLUT:
ret = drm_plane_colorop_3dlut_init(dev, &colorop->base, plane,
- &intel_colorop_funcs, 17,
+ &intel_colorop_funcs, LUT_3D_SIZE,
DRM_COLOROP_LUT3D_INTERPOLATION_TETRAHEDRAL,
true);
break;
--
2.56.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [RFC PATCH 0/2] drm/i915/color: 3D LUT fixes
2026-11-18 19:15 [RFC PATCH 0/2] drm/i915/color: 3D LUT fixes Matthew Schwartz
2026-11-18 19:15 ` [RFC PATCH 1/2] drm/i915/color: only let the owning plane program the 3D LUT Matthew Schwartz
2026-11-18 19:15 ` [RFC PATCH 2/2] drm/i915/color: load the 3D LUT in the order the hardware indexes it Matthew Schwartz
@ 2026-11-19 17:53 ` Borah, Chaitanya Kumar
2026-11-19 22:50 ` ✓ i915.CI.BAT: success for " Patchwork
3 siblings, 0 replies; 5+ messages in thread
From: Borah, Chaitanya Kumar @ 2026-11-19 17:53 UTC (permalink / raw)
To: Matthew Schwartz, intel-gfx, intel-xe; +Cc: uma.shankar
Hello Matthew,
Thanks for the fixes! Not great that the entry order slipped past us,
so thanks for digging into it.
On 11/19/2026 12:45 AM, Matthew Schwartz wrote:
> Two fixes for the 3D LUT support that came with the plane color
> pipeline. I ran into both while bringing up the pipe-bound 3D LUT on
> Lunar Lake for gamescope, using out-of-tree patches that expose it
> through the CRTC color pipeline proposed in [1].
>
> Patch 1 stops planes that do not own the 3D LUT from rewriting
> LUT_3D_CTL. On Lunar Lake an enable bit set by hand is cleared by the
> next plane update. Reading the code, the same write from any
> non-primary plane on Xe3p_LPD disables the LUT the primary plane
> enabled.
>
While testing this I found another bug in the same path. With joiner,
the secondary pipe's plane has no uapi.crtc (only its hw state is copied
from the primary pipe's plane), so intel_color_load_3dlut() and
intel_color_plane_commit_arm() skip it and the secondary pipe's 3D LUT
is never programmed. The part of the screen driven by the secondary
pipe ends up without the 3D LUT. I've sent a fix that switches both to
plane_state->hw.crtc:
https://lore.kernel.org/intel-xe/20261119165925.683691-1-chaitanya.kumar.borah@intel.com/T/#u
You could perhaps rebase on top of it.
> Patch 2 writes the table in the order the hardware reads it. The colorop
> blob has red as the fastest axis and the hardware has blue. I measured
> this on Lunar Lake only, with the LUT bound to the pipe, by writing
> LUT_3D_INDEX and LUT_3D_DATA from userspace and decoding the pipe CRC of
> solid color frames. I have no Nova Lake hardware, so the plane-bound
> case is unchecked. If the plane binding indexes the table differently
> this patch is wrong for it, and I would appreciate a pointer to what
> Bspec says about the entry order.
>
Bspec 68894 documents the entry order (red as the outer loop, blue as
the inner one), which matches what you measured. Please add a reference
to it in the commit message, e.g. a "Bspec: 68894" tag.
I tested the series on Nova Lake with the plane-bound 3D LUT. Without
patch 2 a solid red band comes out blue and vice versa; with it the
output is correct. The existing 3D LUT test uses a constant table and
can't detect an ordering issue, so I wrote an IGT subtest that does:
https://github.com/ckborah/igt-sandbox/commit/04f17a3d3afbcb82967d7cc79405b187251254ae
I'll send it out as well.
With the Bspec reference added:
Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
==
Chaitanya
> [1] https://lore.kernel.org/all/20260716160556.227556-1-mwen@igalia.com/
>
> Matthew Schwartz (2):
> drm/i915/color: only let the owning plane program the 3D LUT
> drm/i915/color: load the 3D LUT in the order the hardware indexes it
>
> drivers/gpu/drm/i915/display/intel_color.c | 28 ++++++++++++++++---
> drivers/gpu/drm/i915/display/intel_color.h | 5 ++++
> .../drm/i915/display/intel_color_pipeline.c | 12 ++------
> 3 files changed, 31 insertions(+), 14 deletions(-)
>
>
> base-commit: fb078d17b966f7a24720b6e3a5de06d43c2e184a
^ permalink raw reply [flat|nested] 5+ messages in thread
* ✓ i915.CI.BAT: success for drm/i915/color: 3D LUT fixes
2026-11-18 19:15 [RFC PATCH 0/2] drm/i915/color: 3D LUT fixes Matthew Schwartz
` (2 preceding siblings ...)
2026-11-19 17:53 ` [RFC PATCH 0/2] drm/i915/color: 3D LUT fixes Borah, Chaitanya Kumar
@ 2026-11-19 22:50 ` Patchwork
3 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2026-11-19 22:50 UTC (permalink / raw)
To: Matthew Schwartz; +Cc: intel-gfx
[-- Attachment #1: Type: text/plain, Size: 4933 bytes --]
== Series Details ==
Series: drm/i915/color: 3D LUT fixes
URL : https://patchwork.freedesktop.org/series/179091/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_19567 -> Patchwork_179091v1
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179091v1/index.html
Participating hosts (39 -> 39)
------------------------------
Additional (1): bat-adls-6
Missing (1): bat-dg2-13
Known issues
------------
Here are the changes found in Patchwork_179091v1 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_lmem_swapping@parallel-random-engines:
- bat-adls-6: NOTRUN -> [SKIP][1] ([i915#4613]) +3 other tests skip
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179091v1/bat-adls-6/igt@gem_lmem_swapping@parallel-random-engines.html
* igt@gem_tiled_pread_basic@basic:
- bat-adls-6: NOTRUN -> [SKIP][2] ([i915#15656])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179091v1/bat-adls-6/igt@gem_tiled_pread_basic@basic.html
* igt@intel_hwmon@hwmon-read:
- bat-adls-6: NOTRUN -> [SKIP][3] ([i915#7707]) +1 other test skip
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179091v1/bat-adls-6/igt@intel_hwmon@hwmon-read.html
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- bat-adls-6: NOTRUN -> [SKIP][4] ([i915#4103]) +1 other test skip
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179091v1/bat-adls-6/igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy.html
* igt@kms_dsc@dsc-basic:
- bat-adls-6: NOTRUN -> [SKIP][5] ([i915#16361])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179091v1/bat-adls-6/igt@kms_dsc@dsc-basic.html
* igt@kms_force_connector_basic@force-load-detect:
- bat-adls-6: NOTRUN -> [SKIP][6] ([i915#17452])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179091v1/bat-adls-6/igt@kms_force_connector_basic@force-load-detect.html
* igt@kms_pm_backlight@basic-brightness:
- bat-adls-6: NOTRUN -> [SKIP][7] ([i915#5354])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179091v1/bat-adls-6/igt@kms_pm_backlight@basic-brightness.html
* igt@kms_psr@psr-primary-mmap-gtt:
- bat-adls-6: NOTRUN -> [SKIP][8] ([i915#1072] / [i915#9732]) +3 other tests skip
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179091v1/bat-adls-6/igt@kms_psr@psr-primary-mmap-gtt.html
* igt@kms_setmode@basic-clone-single-crtc:
- bat-adls-6: NOTRUN -> [SKIP][9] ([i915#3555])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179091v1/bat-adls-6/igt@kms_setmode@basic-clone-single-crtc.html
* igt@prime_vgem@basic-fence-read:
- bat-adls-6: NOTRUN -> [SKIP][10] ([i915#17448] / [i915#3291]) +2 other tests skip
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179091v1/bat-adls-6/igt@prime_vgem@basic-fence-read.html
#### Possible fixes ####
* igt@vgem_basic@unload:
- bat-rpls-4: [DMESG-WARN][11] ([i915#13400]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19567/bat-rpls-4/igt@vgem_basic@unload.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179091v1/bat-rpls-4/igt@vgem_basic@unload.html
[i915#1072]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/1072
[i915#13400]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13400
[i915#15656]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15656
[i915#16361]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/16361
[i915#17448]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/17448
[i915#17452]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/17452
[i915#3291]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3291
[i915#3555]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3555
[i915#4103]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4103
[i915#4613]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4613
[i915#5354]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/5354
[i915#7707]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/7707
[i915#9732]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9732
Build changes
-------------
* Linux: CI_DRM_19567 -> Patchwork_179091v1
CI-20190529: 20190529
CI_DRM_19567: 859a3f2c44944276c49ab8d35f0ffd31b02b19c5 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_9199: f28241ac1ad57574315e7bd31b174294cca2f29c @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_179091v1: 859a3f2c44944276c49ab8d35f0ffd31b02b19c5 @ git://anongit.freedesktop.org/gfx-ci/linux
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179091v1/index.html
[-- Attachment #2: Type: text/html, Size: 5794 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread