* [PATCH v2] drm/i915: clear CRTC color blob pointers after dropping refs
@ 2026-06-10 3:54 Guangshuo Li
2026-06-10 14:54 ` Imre Deak
0 siblings, 1 reply; 3+ messages in thread
From: Guangshuo Li @ 2026-06-10 3:54 UTC (permalink / raw)
To: Jani Nikula, Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin,
David Airlie, Simona Vetter, Uma Shankar, Imre Deak,
Michał Grzelak, intel-gfx, intel-xe, dri-devel, linux-kernel
Cc: Guangshuo Li
intel_crtc_free_hw_state() drops the CRTC color blob references, but
leaves the corresponding pointers unchanged.
This can matter in intel_crtc_prepare_cleared_state(), which frees the
old CRTC hw state before calling intel_dp_tunnel_atomic_clear_stream_bw().
The latter can fail while looking up the DP tunnel group state, for
example with -EDEADLK.
If that happens, the function returns without completing the cleared
state preparation. The failed atomic state will then be cleared by the
atomic core and intel_crtc_free_hw_state() can be called again for the
same state, dropping the same blob references again.
Clear the blob pointers after dropping the references so repeated cleanup
of the same CRTC hw state is safe.
Fixes: fb69d0076e68 ("drm/i915/dp_tunnel: Fix error handling when clearing stream BW in atomic state")
Suggested-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
v2:
- Keep the original ordering in intel_crtc_prepare_cleared_state().
- Clear the blob reference pointers in intel_crtc_free_hw_state(), as
suggested by Imre.
drivers/gpu/drm/i915/display/intel_atomic.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/intel_atomic.c b/drivers/gpu/drm/i915/display/intel_atomic.c
index 71b7325917b6..0cdae87e4bfc 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic.c
@@ -294,6 +294,12 @@ static void intel_crtc_put_color_blobs(struct intel_crtc_state *crtc_state)
void intel_crtc_free_hw_state(struct intel_crtc_state *crtc_state)
{
intel_crtc_put_color_blobs(crtc_state);
+
+ crtc_state->hw.degamma_lut = NULL;
+ crtc_state->hw.gamma_lut = NULL;
+ crtc_state->hw.ctm = NULL;
+ crtc_state->pre_csc_lut = NULL;
+ crtc_state->post_csc_lut = NULL;
}
/**
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] drm/i915: clear CRTC color blob pointers after dropping refs
2026-06-10 3:54 [PATCH v2] drm/i915: clear CRTC color blob pointers after dropping refs Guangshuo Li
@ 2026-06-10 14:54 ` Imre Deak
2026-06-12 3:42 ` Guangshuo Li
0 siblings, 1 reply; 3+ messages in thread
From: Imre Deak @ 2026-06-10 14:54 UTC (permalink / raw)
To: Guangshuo Li
Cc: Jani Nikula, Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin,
David Airlie, Simona Vetter, Uma Shankar, Michał Grzelak,
intel-gfx, intel-xe, dri-devel, linux-kernel
On Wed, Jun 10, 2026 at 11:54:19AM +0800, Guangshuo Li wrote:
> intel_crtc_free_hw_state() drops the CRTC color blob references, but
> leaves the corresponding pointers unchanged.
>
> This can matter in intel_crtc_prepare_cleared_state(), which frees the
> old CRTC hw state before calling intel_dp_tunnel_atomic_clear_stream_bw().
> The latter can fail while looking up the DP tunnel group state, for
> example with -EDEADLK.
>
> If that happens, the function returns without completing the cleared
> state preparation. The failed atomic state will then be cleared by the
> atomic core and intel_crtc_free_hw_state() can be called again for the
> same state, dropping the same blob references again.
>
> Clear the blob pointers after dropping the references so repeated cleanup
> of the same CRTC hw state is safe.
>
> Fixes: fb69d0076e68 ("drm/i915/dp_tunnel: Fix error handling when clearing stream BW in atomic state")
> Suggested-by: Imre Deak <imre.deak@intel.com>
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
> v2:
> - Keep the original ordering in intel_crtc_prepare_cleared_state().
> - Clear the blob reference pointers in intel_crtc_free_hw_state(), as
> suggested by Imre.
>
> drivers/gpu/drm/i915/display/intel_atomic.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic.c b/drivers/gpu/drm/i915/display/intel_atomic.c
> index 71b7325917b6..0cdae87e4bfc 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic.c
> +++ b/drivers/gpu/drm/i915/display/intel_atomic.c
> @@ -294,6 +294,12 @@ static void intel_crtc_put_color_blobs(struct intel_crtc_state *crtc_state)
> void intel_crtc_free_hw_state(struct intel_crtc_state *crtc_state)
> {
> intel_crtc_put_color_blobs(crtc_state);
> +
> + crtc_state->hw.degamma_lut = NULL;
> + crtc_state->hw.gamma_lut = NULL;
> + crtc_state->hw.ctm = NULL;
> + crtc_state->pre_csc_lut = NULL;
> + crtc_state->post_csc_lut = NULL;
> }
Could you still move the clearing closer where the refs are dropped, to
the end of intel_crtc_put_color_blobs()? Otherwise this looks ok to me.
>
> /**
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] drm/i915: clear CRTC color blob pointers after dropping refs
2026-06-10 14:54 ` Imre Deak
@ 2026-06-12 3:42 ` Guangshuo Li
0 siblings, 0 replies; 3+ messages in thread
From: Guangshuo Li @ 2026-06-12 3:42 UTC (permalink / raw)
To: imre.deak
Cc: Jani Nikula, Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin,
David Airlie, Simona Vetter, Uma Shankar, Michał Grzelak,
intel-gfx, intel-xe, dri-devel, linux-kernel
Hi Imre,
Thanks for the review.
On Wed, 10 Jun 2026 at 22:54, Imre Deak <imre.deak@intel.com> wrote:
>
> On Wed, Jun 10, 2026 at 11:54:19AM +0800, Guangshuo Li wrote:
> > intel_crtc_free_hw_state() drops the CRTC color blob references, but
> > leaves the corresponding pointers unchanged.
> >
> > This can matter in intel_crtc_prepare_cleared_state(), which frees the
> > old CRTC hw state before calling intel_dp_tunnel_atomic_clear_stream_bw().
> > The latter can fail while looking up the DP tunnel group state, for
> > example with -EDEADLK.
> >
> > If that happens, the function returns without completing the cleared
> > state preparation. The failed atomic state will then be cleared by the
> > atomic core and intel_crtc_free_hw_state() can be called again for the
> > same state, dropping the same blob references again.
> >
> > Clear the blob pointers after dropping the references so repeated cleanup
> > of the same CRTC hw state is safe.
> >
> > Fixes: fb69d0076e68 ("drm/i915/dp_tunnel: Fix error handling when clearing stream BW in atomic state")
> > Suggested-by: Imre Deak <imre.deak@intel.com>
> > Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> > ---
> > v2:
> > - Keep the original ordering in intel_crtc_prepare_cleared_state().
> > - Clear the blob reference pointers in intel_crtc_free_hw_state(), as
> > suggested by Imre.
> >
> > drivers/gpu/drm/i915/display/intel_atomic.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_atomic.c b/drivers/gpu/drm/i915/display/intel_atomic.c
> > index 71b7325917b6..0cdae87e4bfc 100644
> > --- a/drivers/gpu/drm/i915/display/intel_atomic.c
> > +++ b/drivers/gpu/drm/i915/display/intel_atomic.c
> > @@ -294,6 +294,12 @@ static void intel_crtc_put_color_blobs(struct intel_crtc_state *crtc_state)
> > void intel_crtc_free_hw_state(struct intel_crtc_state *crtc_state)
> > {
> > intel_crtc_put_color_blobs(crtc_state);
> > +
> > + crtc_state->hw.degamma_lut = NULL;
> > + crtc_state->hw.gamma_lut = NULL;
> > + crtc_state->hw.ctm = NULL;
> > + crtc_state->pre_csc_lut = NULL;
> > + crtc_state->post_csc_lut = NULL;
> > }
>
> Could you still move the clearing closer where the refs are dropped, to
> the end of intel_crtc_put_color_blobs()? Otherwise this looks ok to me.
>
> >
> > /**
> > --
> > 2.43.0
> >
Sure, I'll move the pointer clearing to the end of
intel_crtc_put_color_blobs() and send a v3.
Best regards,
Guangshuo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-12 3:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-10 3:54 [PATCH v2] drm/i915: clear CRTC color blob pointers after dropping refs Guangshuo Li
2026-06-10 14:54 ` Imre Deak
2026-06-12 3:42 ` Guangshuo Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox