From: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: Uma Shankar <uma.shankar@intel.com>,
<intel-gfx@lists.freedesktop.org>,
<intel-xe@lists.freedesktop.org>,
<dri-devel@lists.freedesktop.org>, <pekka.paalanen@collabora.com>,
<contact@emersion.fr>, <harry.wentland@amd.com>,
<mwen@igalia.com>, <jadahl@redhat.com>,
<sebastian.wick@redhat.com>, <swati2.sharma@intel.com>,
<alex.hung@amd.com>, <jani.nikula@intel.com>,
<suraj.kandpal@intel.com>
Subject: Re: [v8 14/15] drm/i915/color: Add 3D LUT to color pipeline
Date: Mon, 15 Dec 2025 13:56:18 +0530 [thread overview]
Message-ID: <764fd0c7-1679-475f-82c1-98ec85220203@intel.com> (raw)
In-Reply-To: <aTxi0OvIyTXjiUZ7@intel.com>
On 12/13/2025 12:15 AM, Ville Syrjälä wrote:
> On Fri, Dec 12, 2025 at 11:16:56PM +0530, Borah, Chaitanya Kumar wrote:
>>
>>
>> On 12/12/2025 8:38 PM, Ville Syrjälä wrote:
>>> On Wed, Dec 03, 2025 at 02:22:10PM +0530, Uma Shankar wrote:
>>>> From: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
>>>>
>>>> Add helpers to program the 3D LUT registers and arm them.
>>>>
>>>> LUT_3D_READY in LUT_3D_CLT is cleared off by the HW once
>>>> the LUT buffer is loaded into it's internal working RAM.
>>>> So by the time we try to load/commit new values, we expect
>>>> it to be cleared off. If not, log an error and return
>>>> without writing new values. Do it only when writing with MMIO.
>>>> There is no way to read register within DSB execution.
>>>>
>>>> v2:
>>>> - Add information regarding LUT_3D_READY to commit message (Jani)
>>>> - Log error instead of a drm_warn and return without committing changes
>>>> if 3DLUT HW is not ready to accept new values.
>>>> - Refactor intel_color_crtc_has_3dlut()
>>>> Also remove Gen10 check (Suraj)
>>>> v3:
>>>> - Addressed review comments (Suraj)
>>>>
>>>> Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
>>>> Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
>>>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>>>> ---
>>>> drivers/gpu/drm/i915/display/intel_color.c | 78 +++++++++++++++++++
>>>> drivers/gpu/drm/i915/display/intel_color.h | 4 +
>>>> .../drm/i915/display/intel_color_pipeline.c | 29 +++++--
>>>> .../drm/i915/display/intel_color_pipeline.h | 3 +-
>>>> .../drm/i915/display/intel_display_limits.h | 1 +
>>>> .../drm/i915/display/intel_display_types.h | 2 +-
>>>> drivers/gpu/drm/i915/display/intel_plane.c | 2 +
>>>> 7 files changed, 112 insertions(+), 7 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
>>>> index 08f3b5b47b8e..e7950655434b 100644
>>>> --- a/drivers/gpu/drm/i915/display/intel_color.c
>>>> +++ b/drivers/gpu/drm/i915/display/intel_color.c
>>>> @@ -4062,6 +4062,52 @@ xelpd_plane_load_luts(struct intel_dsb *dsb, const struct intel_plane_state *pla
>>>> xelpd_program_plane_post_csc_lut(dsb, plane_state);
>>>> }
>>>>
>>>> +static u32 glk_3dlut_10(const struct drm_color_lut32 *color)
>>>> +{
>>>> + return REG_FIELD_PREP(LUT_3D_DATA_RED_MASK, drm_color_lut32_extract(color->red, 10)) |
>>>> + REG_FIELD_PREP(LUT_3D_DATA_GREEN_MASK, drm_color_lut32_extract(color->green, 10)) |
>>>> + REG_FIELD_PREP(LUT_3D_DATA_BLUE_MASK, drm_color_lut32_extract(color->blue, 10));
>>>> +}
>>>> +
>>>> +static void glk_load_lut_3d(struct intel_dsb *dsb,
>>>> + struct intel_crtc *crtc,
>>>> + const struct drm_property_blob *blob)
>>>> +{
>>>> + 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;
>>>> +
>>>> + 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",
>>>> + crtc->base.base.id, crtc->base.name);
>>>> + return;
>>>
>>> Just ran into this while perusing the code...
>>>
>>> This check could be implemented exactly like intel_vrr_check_push_sent()
>>> so that it works for both the DSB and non-DSB paths.
>>
>> We did discuss this briefly[1], but went on with this as a first step.
>>
>> My main concern was if it is a good idea to poll for a bit in the middle
>> of a commit. I understand that this is done for TRANS_PUSH_SEND but that
>> is the last thing we do for a commit.
>
> It's a single register read so not a big deal perhaps. But if that's a
> concern then the entire check could be moved to the start of the commit.
> Hmm, or perhaps we should move this check to the end of the commit as
> well... Not sure.
>
Having a dsb poll with timeout equivalent to a MMIO read might be a way
to go. I have to check if it actually can be done.
Another way would be to implement all this in the state checker at the
end of each commit.
>>
>>> The 'return' should
>>> just get nuked IMO.
>>>
>>
>> So just move ahead and program irrespective?
>
> Having dead codepaths is not a great idea since they're never tested.
> Also we should try to keep the DSB and MMIO codepaths as similar as
> possible to avoid weird heisenbugs.
>
Yes that's a good point. From that perspective it would make sense to
remove the return from the MMIO path as well.
>>
>>>> +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_crtc *crtc = to_intel_crtc(plane_state->uapi.crtc);
>>>> +
>>>> + if (crtc && intel_color_crtc_has_3dlut(display, crtc->pipe))
>>>> + glk_lut_3d_commit(dsb, crtc, !!plane_state->hw.lut_3d);
>>> ^^^^^^^^^^^^
>>>
>>> And this looks like a pretty major fail. Why is the 3D LUT stored in
>>> the *plane* state when it's a pipe level thing?
>>>
>>
>> With DISPLAY_VER(display) >= 35, 3DLUT can be attached to a plane.
>> (Bits[23:22] in 3DLUT_CTL). This is the only way we are exposing the HW
>> to the userspace right now (through the new plane color pipeline uapi).
>> Therefore, it lies in the plane state.
>
> And something makes sure it's only used by one plane at a time?
>
Unfortunately, even with the latest color pipeline UAPI, there is no
good way to represent a HW block which can be shared/attached at
different stages of the pipeline. So right now, we expose 3DLUT only
attached with the primary plane.
That way we don't confuse the userspace with opaque commit failures on
trying to enable it on multiple planes which would otherwise make the
pipeline totally unusable.
If we do find a way to expose 3DLUT on all the supported planes, then we
have to start worrying about it.
==
Chaitanya
>> However, there are (soonish)plans to adopt the color pipeline for crtcs
>> too. Once that happens, it needs to be handled a bit more carefully. A
>> potential approach is to allow userspace to program the block with a
>> first come first served semantics and fail the commit if it tries to set
>> 3DLUT both on plane and crtc in the same commit.
>>
>> [1]
>> https://lore.kernel.org/intel-gfx/b01cade8-ba63-472a-a95f-bba9af57afbb@intel.com/
>>
>> ==
>> Chaitanya
>
next prev parent reply other threads:[~2025-12-15 8:26 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-03 8:51 [v8 00/15] Plane Color Pipeline support for Intel platforms Uma Shankar
2025-12-03 8:47 ` ✗ CI.checkpatch: warning for Plane Color Pipeline support for Intel platforms (rev7) Patchwork
2025-12-03 8:48 ` ✓ CI.KUnit: success " Patchwork
2025-12-03 8:51 ` [v8 01/15] drm/i915/display: Add identifiers for driver specific blocks Uma Shankar
2025-12-03 8:51 ` [v8 02/15] drm/i915: Add intel_color_op Uma Shankar
2025-12-03 8:51 ` [v8 03/15] drm/i915/color: Add helper to create intel colorop Uma Shankar
2025-12-03 8:52 ` [v8 04/15] drm/i915/color: Create a transfer function color pipeline Uma Shankar
2025-12-03 8:52 ` [v8 05/15] drm/i915/color: Add framework to program CSC Uma Shankar
2025-12-03 8:52 ` [v8 06/15] drm/i915/color: Preserve sign bit when int_bits is Zero Uma Shankar
2025-12-03 8:52 ` [v8 07/15] drm/i915/color: Add plane CTM callback for D12 and beyond Uma Shankar
2025-12-03 8:52 ` [v8 08/15] drm/i915: Add register definitions for Plane Degamma Uma Shankar
2025-12-03 8:52 ` [v8 09/15] drm/i915: Add register definitions for Plane Post CSC Uma Shankar
2025-12-03 8:52 ` [v8 10/15] drm/i915/color: Add framework to program PRE/POST CSC LUT Uma Shankar
2025-12-03 8:52 ` [v8 11/15] drm/i915/color: Program Pre-CSC registers Uma Shankar
2025-12-03 8:52 ` [v8 12/15] drm/i915/color: Program Plane Post CSC Registers Uma Shankar
2025-12-03 8:52 ` [v8 13/15] drm/i915/color: Add registers for 3D LUT Uma Shankar
2025-12-03 8:52 ` [v8 14/15] drm/i915/color: Add 3D LUT to color pipeline Uma Shankar
2025-12-12 15:08 ` Ville Syrjälä
2025-12-12 17:46 ` Borah, Chaitanya Kumar
2025-12-12 18:25 ` Simon Ser
2025-12-15 8:43 ` Borah, Chaitanya Kumar
2025-12-18 16:15 ` Simon Ser
2025-12-19 13:24 ` Borah, Chaitanya Kumar
2025-12-12 18:45 ` Ville Syrjälä
2025-12-15 8:26 ` Borah, Chaitanya Kumar [this message]
2025-12-03 8:52 ` [v8 15/15] drm/i915/color: Enable Plane Color Pipelines Uma Shankar
2025-12-04 18:44 ` [v8 00/15] Plane Color Pipeline support for Intel platforms Jani Nikula
2025-12-11 0:08 ` Matt Roper
2025-12-11 14:01 ` Borah, Chaitanya Kumar
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=764fd0c7-1679-475f-82c1-98ec85220203@intel.com \
--to=chaitanya.kumar.borah@intel.com \
--cc=alex.hung@amd.com \
--cc=contact@emersion.fr \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jadahl@redhat.com \
--cc=jani.nikula@intel.com \
--cc=mwen@igalia.com \
--cc=pekka.paalanen@collabora.com \
--cc=sebastian.wick@redhat.com \
--cc=suraj.kandpal@intel.com \
--cc=swati2.sharma@intel.com \
--cc=uma.shankar@intel.com \
--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