Skip to content

Commit cf29a86

Browse files
author
Maarten Lankhorst
committed
drm/xe/display: Add intel_plane_initial_vblank_wait
We're changing the driver to have no interrupts during early init for Xe, so we poll the PIPE_FRMSTMSMP counter instead. Interrupts cannot be enabled during FB readout because memirq's requires an allocation. This would overwrite the FB we want to read out. While it might be possible to also run do the same in i915 and run it without interrupts, the platforms i915 supports had a less clear distinction between display and graphics. For this reason I choose only to touch Xe for now. Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250121142850.4960-1-dev@lankhorst.se Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
1 parent 220ed69 commit cf29a86

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ void intel_plane_disable_noatomic(struct intel_crtc *crtc,
796796
if ((crtc_state->active_planes & ~BIT(PLANE_CURSOR)) == 0 &&
797797
hsw_ips_disable(crtc_state)) {
798798
crtc_state->ips_enabled = false;
799-
intel_crtc_wait_for_next_vblank(crtc);
799+
intel_plane_initial_vblank_wait(crtc);
800800
}
801801

802802
/*
@@ -810,7 +810,7 @@ void intel_plane_disable_noatomic(struct intel_crtc *crtc,
810810
*/
811811
if (HAS_GMCH(dev_priv) &&
812812
intel_set_memory_cxsr(dev_priv, false))
813-
intel_crtc_wait_for_next_vblank(crtc);
813+
intel_plane_initial_vblank_wait(crtc);
814814

815815
/*
816816
* Gen2 reports pipe underruns whenever all planes are disabled.
@@ -820,7 +820,7 @@ void intel_plane_disable_noatomic(struct intel_crtc *crtc,
820820
intel_set_cpu_fifo_underrun_reporting(dev_priv, crtc->pipe, false);
821821

822822
intel_plane_disable_arm(NULL, plane, crtc_state);
823-
intel_crtc_wait_for_next_vblank(crtc);
823+
intel_plane_initial_vblank_wait(crtc);
824824
}
825825

826826
unsigned int

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
#include "intel_frontbuffer.h"
1515
#include "intel_plane_initial.h"
1616

17+
void intel_plane_initial_vblank_wait(struct intel_crtc *crtc)
18+
{
19+
intel_crtc_wait_for_next_vblank(crtc);
20+
}
21+
1722
static bool
1823
intel_reuse_initial_plane_obj(struct intel_crtc *this,
1924
const struct intel_initial_plane_config plane_configs[],
@@ -442,7 +447,7 @@ void intel_initial_plane_config(struct intel_display *display)
442447
intel_find_initial_plane_obj(crtc, plane_configs);
443448

444449
if (display->funcs.display->fixup_initial_plane_config(crtc, plane_config))
445-
intel_crtc_wait_for_next_vblank(crtc);
450+
intel_plane_initial_vblank_wait(crtc);
446451

447452
plane_config_fini(plane_config);
448453
}

drivers/gpu/drm/i915/display/intel_plane_initial.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
#ifndef __INTEL_PLANE_INITIAL_H__
77
#define __INTEL_PLANE_INITIAL_H__
88

9+
struct intel_crtc;
910
struct intel_display;
1011

1112
void intel_initial_plane_config(struct intel_display *display);
13+
void intel_plane_initial_vblank_wait(struct intel_crtc *crtc);
1214

1315
#endif

drivers/gpu/drm/xe/display/xe_plane_initial.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
#include "regs/xe_gtt_defs.h"
1010
#include "xe_ggtt.h"
11+
#include "xe_mmio.h"
1112

13+
#include "i915_reg.h"
1214
#include "intel_atomic_plane.h"
1315
#include "intel_crtc.h"
1416
#include "intel_display.h"
@@ -22,6 +24,21 @@
2224

2325
#include <generated/xe_wa_oob.h>
2426

27+
void intel_plane_initial_vblank_wait(struct intel_crtc *crtc)
28+
{
29+
/* Early xe has no irq */
30+
struct xe_device *xe = to_xe_device(crtc->base.dev);
31+
struct xe_reg pipe_frmtmstmp = XE_REG(i915_mmio_reg_offset(PIPE_FRMTMSTMP(crtc->pipe)));
32+
u32 timestamp;
33+
int ret;
34+
35+
timestamp = xe_mmio_read32(xe_root_tile_mmio(xe), pipe_frmtmstmp);
36+
37+
ret = xe_mmio_wait32_not(xe_root_tile_mmio(xe), pipe_frmtmstmp, ~0U, timestamp, 40000U, &timestamp, false);
38+
if (ret < 0)
39+
drm_warn(&xe->drm, "waiting for early vblank failed with %i\n", ret);
40+
}
41+
2542
static bool
2643
intel_reuse_initial_plane_obj(struct intel_crtc *this,
2744
const struct intel_initial_plane_config plane_configs[],
@@ -303,7 +320,7 @@ void intel_initial_plane_config(struct intel_display *display)
303320
intel_find_initial_plane_obj(crtc, plane_configs);
304321

305322
if (display->funcs.display->fixup_initial_plane_config(crtc, plane_config))
306-
intel_crtc_wait_for_next_vblank(crtc);
323+
intel_plane_initial_vblank_wait(crtc);
307324

308325
plane_config_fini(plane_config);
309326
}

0 commit comments

Comments
 (0)