public inbox for intel-xe@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915/joiner: Make joiner "nomodeset" state copy independent of pipe order
Date: Mon, 13 Apr 2026 10:27:47 +0300	[thread overview]
Message-ID: <ebd35293306f951d2ea2f6632f97016069205111@intel.com> (raw)
In-Reply-To: <64fcf34f83f7d3011ec204d7e260de399b265c6a@intel.com>

On Wed, 08 Apr 2026, Jani Nikula <jani.nikula@intel.com> wrote:
> On Wed, 08 Apr 2026, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
>> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>
>> Currently the joiner primary->secondary hw state copy still happens from
>> the main compute_config loop alongside the primary uapi->hw state copy.
>> The primary uapi->hw state copy must therefore happen first, or else
>> we'll end up copying stale junk into the secondary.
>>
>> We have a WARN in intel_atomic_check_joiner() to make sure the CRTCs
>> will be walked in the correct order. The plan is to reoder the CRTCs,
>> which would mess up the order, unless we also adjust the iterators
>> to keep the pipe order. The actual plan is to do both, so technically
>> we should be able to just remove the WARN and call it a day.
>>
>> But relying on the iteration order like this is fragile and confusing,
>> so let's move the "nomodeset" joiner state copy into the later loop
>> where the "modeset" state copy is also done. The first loop having
>> completely finished, we are guaranteed to have up to date hw state
>> on the primary when we do the copy to the secondary.
>
> I find the number of loops in the forest of intel_atomic_check*
> functions confusing too. But this looks like progress.
>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>
> I'm wondering about merging this, along with the pipe reordering, to a
> topic branch that could be merged to drm-next at Dave's discretion,
> instead of cherry-picks which might be a bit cumbersome for patches this
> size. So please hold off on merging while I figure this out.

Thanks, I've pushed the set to topic/pipe-reorder, and will be resending
the pipe reordering patch again shortly.

BR,
Jani.

>
>
>>
>> Cc: Jani Nikula <jani.nikula@intel.com>
>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> ---
>>  drivers/gpu/drm/i915/display/intel_display.c | 20 +++++---------------
>>  1 file changed, 5 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
>> index 58a654ca0d20..674a4ece6d0f 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display.c
>> @@ -5914,17 +5914,6 @@ static int intel_atomic_check_joiner(struct intel_atomic_state *state,
>>  			return -EINVAL;
>>  		}
>>  
>> -		/*
>> -		 * The state copy logic assumes the primary crtc gets processed
>> -		 * before the secondary crtc during the main compute_config loop.
>> -		 * This works because the crtcs are created in pipe order,
>> -		 * and the hardware requires primary pipe < secondary pipe as well.
>> -		 * Should that change we need to rethink the logic.
>> -		 */
>> -		if (WARN_ON(drm_crtc_index(&primary_crtc->base) >
>> -			    drm_crtc_index(&secondary_crtc->base)))
>> -			return -EINVAL;
>> -
>>  		drm_dbg_kms(display->drm,
>>  			    "[CRTC:%d:%s] Used as secondary for joiner primary [CRTC:%d:%s]\n",
>>  			    secondary_crtc->base.base.id, secondary_crtc->base.name,
>> @@ -6302,9 +6291,7 @@ static int intel_atomic_check_config(struct intel_atomic_state *state,
>>  
>>  	for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
>>  		if (!intel_crtc_needs_modeset(new_crtc_state)) {
>> -			if (intel_crtc_is_joiner_secondary(new_crtc_state))
>> -				copy_joiner_crtc_state_nomodeset(state, crtc);
>> -			else
>> +			if (!intel_crtc_is_joiner_secondary(new_crtc_state))
>>  				intel_crtc_copy_uapi_to_hw_state_nomodeset(state, crtc);
>>  			continue;
>>  		}
>> @@ -6439,8 +6426,11 @@ int intel_atomic_check(struct drm_device *dev,
>>  		goto fail;
>>  
>>  	for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
>> -		if (!intel_crtc_needs_modeset(new_crtc_state))
>> +		if (!intel_crtc_needs_modeset(new_crtc_state)) {
>> +			if (intel_crtc_is_joiner_secondary(new_crtc_state))
>> +				copy_joiner_crtc_state_nomodeset(state, crtc);
>>  			continue;
>> +		}
>>  
>>  		if (intel_crtc_is_joiner_secondary(new_crtc_state)) {
>>  			drm_WARN_ON(display->drm, new_crtc_state->uapi.enable);

-- 
Jani Nikula, Intel

  reply	other threads:[~2026-04-13  7:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-08 15:57 [PATCH 0/2] drm/i915: Make sure CRTC vs. pipe reordering is safe Ville Syrjala
2026-04-08 15:57 ` [PATCH 1/2] drm/i915/joiner: Make joiner "nomodeset" state copy independent of pipe order Ville Syrjala
2026-04-08 16:46   ` Jani Nikula
2026-04-13  7:27     ` Jani Nikula [this message]
2026-04-13  7:56       ` Saarinen, Jani
2026-04-08 15:57 ` [PATCH 2/2] drm/i915: Walk crtcs in " Ville Syrjala
2026-04-08 16:04 ` ✗ CI.checkpatch: warning for drm/i915: Make sure CRTC vs. pipe reordering is safe Patchwork
2026-04-08 16:05 ` ✗ CI.KUnit: failure " Patchwork
2026-04-10  8:37 ` ✗ CI.checkpatch: warning for drm/i915: Make sure CRTC vs. pipe reordering is safe (rev2) Patchwork
2026-04-10  8:39 ` ✓ CI.KUnit: success " Patchwork
2026-04-10  9:18 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-10 15:55 ` ✗ Xe.CI.FULL: failure " Patchwork

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=ebd35293306f951d2ea2f6632f97016069205111@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --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