Skip to content

Commit 32ed466

Browse files
committed
drm/i915: Introduce a minimal plane error state
I want to capture a little bit more information about the state of the plane upon faults. To that end introduce a small plane error state struct and provide per-plane vfuncs to read it out. For now we just stick the CTL, SURF, and SURFLIVE (if available) registers contents in there. v2: Use struct intel_display instead of dev_priv Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250217070047.953-3-ville.syrjala@linux.intel.com
1 parent 63f39ad commit 32ed466

File tree

5 files changed

+122
-0
lines changed

5 files changed

+122
-0
lines changed

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,40 @@ static void i9xx_plane_disable_arm(struct intel_dsb *dsb,
557557
intel_de_write_fw(display, DSPADDR(display, i9xx_plane), 0);
558558
}
559559

560+
static void g4x_primary_capture_error(struct intel_crtc *crtc,
561+
struct intel_plane *plane,
562+
struct intel_plane_error *error)
563+
{
564+
struct intel_display *display = to_intel_display(plane);
565+
enum i9xx_plane_id i9xx_plane = plane->i9xx_plane;
566+
567+
error->ctl = intel_de_read(display, DSPCNTR(display, i9xx_plane));
568+
error->surf = intel_de_read(display, DSPSURF(display, i9xx_plane));
569+
error->surflive = intel_de_read(display, DSPSURFLIVE(display, i9xx_plane));
570+
}
571+
572+
static void i965_plane_capture_error(struct intel_crtc *crtc,
573+
struct intel_plane *plane,
574+
struct intel_plane_error *error)
575+
{
576+
struct intel_display *display = to_intel_display(plane);
577+
enum i9xx_plane_id i9xx_plane = plane->i9xx_plane;
578+
579+
error->ctl = intel_de_read(display, DSPCNTR(display, i9xx_plane));
580+
error->surf = intel_de_read(display, DSPSURF(display, i9xx_plane));
581+
}
582+
583+
static void i8xx_plane_capture_error(struct intel_crtc *crtc,
584+
struct intel_plane *plane,
585+
struct intel_plane_error *error)
586+
{
587+
struct intel_display *display = to_intel_display(plane);
588+
enum i9xx_plane_id i9xx_plane = plane->i9xx_plane;
589+
590+
error->ctl = intel_de_read(display, DSPCNTR(display, i9xx_plane));
591+
error->surf = intel_de_read(display, DSPADDR(display, i9xx_plane));
592+
}
593+
560594
static void
561595
g4x_primary_async_flip(struct intel_dsb *dsb,
562596
struct intel_plane *plane,
@@ -976,6 +1010,13 @@ intel_primary_plane_create(struct intel_display *display, enum pipe pipe)
9761010
plane->get_hw_state = i9xx_plane_get_hw_state;
9771011
plane->check_plane = i9xx_plane_check;
9781012

1013+
if (DISPLAY_VER(display) >= 5 || display->platform.g4x)
1014+
plane->capture_error = g4x_primary_capture_error;
1015+
else if (DISPLAY_VER(display) >= 4)
1016+
plane->capture_error = i965_plane_capture_error;
1017+
else
1018+
plane->capture_error = i8xx_plane_capture_error;
1019+
9791020
if (HAS_ASYNC_FLIPS(display)) {
9801021
if (display->platform.valleyview || display->platform.cherryview) {
9811022
plane->async_flip = vlv_primary_async_flip;

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,27 @@ static bool i9xx_cursor_get_hw_state(struct intel_plane *plane,
765765
return ret;
766766
}
767767

768+
static void g4x_cursor_capture_error(struct intel_crtc *crtc,
769+
struct intel_plane *plane,
770+
struct intel_plane_error *error)
771+
{
772+
struct intel_display *display = to_intel_display(plane);
773+
774+
error->ctl = intel_de_read(display, CURCNTR(display, crtc->pipe));
775+
error->surf = intel_de_read(display, CURBASE(display, crtc->pipe));
776+
error->surflive = intel_de_read(display, CURSURFLIVE(display, crtc->pipe));
777+
}
778+
779+
static void i9xx_cursor_capture_error(struct intel_crtc *crtc,
780+
struct intel_plane *plane,
781+
struct intel_plane_error *error)
782+
{
783+
struct intel_display *display = to_intel_display(plane);
784+
785+
error->ctl = intel_de_read(display, CURCNTR(display, crtc->pipe));
786+
error->surf = intel_de_read(display, CURBASE(display, crtc->pipe));
787+
}
788+
768789
static bool intel_cursor_format_mod_supported(struct drm_plane *_plane,
769790
u32 format, u64 modifier)
770791
{
@@ -1030,6 +1051,11 @@ intel_cursor_plane_create(struct intel_display *display,
10301051
cursor->check_plane = i9xx_check_cursor;
10311052
}
10321053

1054+
if (DISPLAY_VER(display) >= 5 || display->platform.g4x)
1055+
cursor->capture_error = g4x_cursor_capture_error;
1056+
else
1057+
cursor->capture_error = i9xx_cursor_capture_error;
1058+
10331059
cursor->cursor.base = ~0;
10341060
cursor->cursor.cntl = ~0;
10351061

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,10 @@ struct intel_crtc {
14371437
bool block_dc_for_vblank;
14381438
};
14391439

1440+
struct intel_plane_error {
1441+
u32 ctl, surf, surflive;
1442+
};
1443+
14401444
struct intel_plane {
14411445
struct drm_plane base;
14421446
enum i9xx_plane_id i9xx_plane;
@@ -1488,6 +1492,9 @@ struct intel_plane {
14881492
void (*disable_arm)(struct intel_dsb *dsb,
14891493
struct intel_plane *plane,
14901494
const struct intel_crtc_state *crtc_state);
1495+
void (*capture_error)(struct intel_crtc *crtc,
1496+
struct intel_plane *plane,
1497+
struct intel_plane_error *error);
14911498
bool (*get_hw_state)(struct intel_plane *plane, enum pipe *pipe);
14921499
int (*check_plane)(struct intel_crtc_state *crtc_state,
14931500
struct intel_plane_state *plane_state);

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,17 @@ vlv_sprite_disable_arm(struct intel_dsb *dsb,
447447
intel_de_write_fw(display, SPSURF(pipe, plane_id), 0);
448448
}
449449

450+
static void vlv_sprite_capture_error(struct intel_crtc *crtc,
451+
struct intel_plane *plane,
452+
struct intel_plane_error *error)
453+
{
454+
struct intel_display *display = to_intel_display(plane);
455+
456+
error->ctl = intel_de_read(display, SPCNTR(crtc->pipe, plane->id));
457+
error->surf = intel_de_read(display, SPSURF(crtc->pipe, plane->id));
458+
error->surflive = intel_de_read(display, SPSURFLIVE(crtc->pipe, plane->id));
459+
}
460+
450461
static bool
451462
vlv_sprite_get_hw_state(struct intel_plane *plane,
452463
enum pipe *pipe)
@@ -872,6 +883,17 @@ ivb_sprite_disable_arm(struct intel_dsb *dsb,
872883
intel_de_write_fw(display, SPRSURF(pipe), 0);
873884
}
874885

886+
static void ivb_sprite_capture_error(struct intel_crtc *crtc,
887+
struct intel_plane *plane,
888+
struct intel_plane_error *error)
889+
{
890+
struct intel_display *display = to_intel_display(plane);
891+
892+
error->ctl = intel_de_read(display, SPRCTL(crtc->pipe));
893+
error->surf = intel_de_read(display, SPRSURF(crtc->pipe));
894+
error->surflive = intel_de_read(display, SPRSURFLIVE(crtc->pipe));
895+
}
896+
875897
static bool
876898
ivb_sprite_get_hw_state(struct intel_plane *plane,
877899
enum pipe *pipe)
@@ -1207,6 +1229,17 @@ g4x_sprite_disable_arm(struct intel_dsb *dsb,
12071229
intel_de_write_fw(display, DVSSURF(pipe), 0);
12081230
}
12091231

1232+
static void g4x_sprite_capture_error(struct intel_crtc *crtc,
1233+
struct intel_plane *plane,
1234+
struct intel_plane_error *error)
1235+
{
1236+
struct intel_display *display = to_intel_display(plane);
1237+
1238+
error->ctl = intel_de_read(display, DVSCNTR(crtc->pipe));
1239+
error->surf = intel_de_read(display, DVSSURF(crtc->pipe));
1240+
error->surflive = intel_de_read(display, DVSSURFLIVE(crtc->pipe));
1241+
}
1242+
12101243
static bool
12111244
g4x_sprite_get_hw_state(struct intel_plane *plane,
12121245
enum pipe *pipe)
@@ -1587,6 +1620,7 @@ intel_sprite_plane_create(struct intel_display *display,
15871620
plane->update_noarm = vlv_sprite_update_noarm;
15881621
plane->update_arm = vlv_sprite_update_arm;
15891622
plane->disable_arm = vlv_sprite_disable_arm;
1623+
plane->capture_error = vlv_sprite_capture_error;
15901624
plane->get_hw_state = vlv_sprite_get_hw_state;
15911625
plane->check_plane = vlv_sprite_check;
15921626
plane->max_stride = i965_plane_max_stride;
@@ -1610,6 +1644,7 @@ intel_sprite_plane_create(struct intel_display *display,
16101644
plane->update_noarm = ivb_sprite_update_noarm;
16111645
plane->update_arm = ivb_sprite_update_arm;
16121646
plane->disable_arm = ivb_sprite_disable_arm;
1647+
plane->capture_error = ivb_sprite_capture_error;
16131648
plane->get_hw_state = ivb_sprite_get_hw_state;
16141649
plane->check_plane = g4x_sprite_check;
16151650

@@ -1634,6 +1669,7 @@ intel_sprite_plane_create(struct intel_display *display,
16341669
plane->update_noarm = g4x_sprite_update_noarm;
16351670
plane->update_arm = g4x_sprite_update_arm;
16361671
plane->disable_arm = g4x_sprite_disable_arm;
1672+
plane->capture_error = g4x_sprite_capture_error;
16371673
plane->get_hw_state = g4x_sprite_get_hw_state;
16381674
plane->check_plane = g4x_sprite_check;
16391675
plane->max_stride = g4x_sprite_max_stride;

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,6 +1661,17 @@ icl_plane_update_arm(struct intel_dsb *dsb,
16611661
skl_plane_surf(plane_state, color_plane));
16621662
}
16631663

1664+
static void skl_plane_capture_error(struct intel_crtc *crtc,
1665+
struct intel_plane *plane,
1666+
struct intel_plane_error *error)
1667+
{
1668+
struct intel_display *display = to_intel_display(plane);
1669+
1670+
error->ctl = intel_de_read(display, PLANE_CTL(crtc->pipe, plane->id));
1671+
error->surf = intel_de_read(display, PLANE_SURF(crtc->pipe, plane->id));
1672+
error->surflive = intel_de_read(display, PLANE_SURFLIVE(crtc->pipe, plane->id));
1673+
}
1674+
16641675
static void
16651676
skl_plane_async_flip(struct intel_dsb *dsb,
16661677
struct intel_plane *plane,
@@ -2803,6 +2814,7 @@ skl_universal_plane_create(struct intel_display *display,
28032814
plane->update_arm = skl_plane_update_arm;
28042815
plane->disable_arm = skl_plane_disable_arm;
28052816
}
2817+
plane->capture_error = skl_plane_capture_error;
28062818
plane->get_hw_state = skl_plane_get_hw_state;
28072819
plane->check_plane = skl_plane_check;
28082820

0 commit comments

Comments
 (0)