Skip to content

Commit 2c683e9

Browse files
committed
drm/i915/display: change pipe allocation order for discrete platforms
When big joiner is enabled, it reserves the adjacent pipe as the secondary pipe. This happens without the user space knowing, and subsequent attempts at using the CRTC with that pipe will fail. If the user space does not have a coping mechanism, i.e. trying another CRTC, this leads to a black screen. Try to reduce the impact of the problem on discrete platforms by mapping the CRTCs to pipes in order A, C, B, and D. If the user space reserves CRTCs in order, this should trick it to using pipes that are more likely to be available for and after joining. Limit this to discrete platforms, which have four pipes, and no eDP, a combination that should benefit the most with least drawbacks. Cc: Ville Syrjala <ville.syrjala@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260413081609.969342-1-jani.nikula@intel.com Signed-off-by: Jani Nikula <jani.nikula@intel.com>
1 parent f49499e commit 2c683e9

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

drivers/gpu/drm/i915/display/intel_crtc.c

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,6 @@ static int __intel_crtc_init(struct intel_display *display, enum pipe pipe)
411411

412412
cpu_latency_qos_add_request(&crtc->vblank_pm_qos, PM_QOS_DEFAULT_VALUE);
413413

414-
drm_WARN_ON(display->drm, drm_crtc_index(&crtc->base) != crtc->pipe);
415-
416414
if (HAS_CASF(display) && crtc->num_scalers >= 2)
417415
drm_crtc_create_sharpness_strength_property(&crtc->base);
418416

@@ -426,6 +424,31 @@ static int __intel_crtc_init(struct intel_display *display, enum pipe pipe)
426424
return ret;
427425
}
428426

427+
#define HAS_PIPE(display, pipe) (DISPLAY_RUNTIME_INFO(display)->pipe_mask & BIT(pipe))
428+
429+
/*
430+
* Expose the pipes in order A, C, B, D on discrete platforms to trick user
431+
* space into using pipes that are more likely to be available for both a) user
432+
* space if pipe B has been reserved for the joiner, and b) the joiner if pipe A
433+
* doesn't need the joiner.
434+
*
435+
* Swap pipes B and C only if both are available i.e. not fused off.
436+
*/
437+
static enum pipe reorder_pipe(struct intel_display *display, enum pipe pipe)
438+
{
439+
if (!display->platform.dgfx || !HAS_PIPE(display, PIPE_B) || !HAS_PIPE(display, PIPE_C))
440+
return pipe;
441+
442+
switch (pipe) {
443+
case PIPE_B:
444+
return PIPE_C;
445+
case PIPE_C:
446+
return PIPE_B;
447+
default:
448+
return pipe;
449+
}
450+
}
451+
429452
int intel_crtc_init(struct intel_display *display)
430453
{
431454
enum pipe pipe;
@@ -435,7 +458,7 @@ int intel_crtc_init(struct intel_display *display)
435458
INTEL_NUM_PIPES(display), str_plural(INTEL_NUM_PIPES(display)));
436459

437460
for_each_pipe(display, pipe) {
438-
ret = __intel_crtc_init(display, pipe);
461+
ret = __intel_crtc_init(display, reorder_pipe(display, pipe));
439462
if (ret)
440463
return ret;
441464
}

0 commit comments

Comments
 (0)