Skip to contentSkip to conversation

Add panic support for all DCE/DCN

PATCH In review Alex Deucher 4 participants 10 messages Nov 12, 2024 – Dec 9, 2024

Subsystems (3)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

v4 cover Add panic support for all DCE/DCN

This builds on the patches from Lu and Jocelyn to fill in panic support for all DCE/DCN variants and code pathes.

v2: refactor to provide cleaner history and share more code to provide a more consistent experience across DC and non-DC.

v3: resend with the missing first patch

v4: move hubp and mi code into a dc helper function

Alex Deucher (5):
drm/amdgpu: add generic display panic helper code drm/amd/display: add clear_tiling hubp callbacks drm/amd/display: add clear_tiling mi callbacks drm/amd/display/dc: add helper for panic updates drm/amd/display: add non-DC drm_panic support

Jocelyn Falempe (1):
drm/amd/display: add DC drm_panic support

 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   | 80 +++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.h   |  5 ++
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        | 27 +++++++
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        | 27 +++++++
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         | 27 +++++++
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         | 26 ++++++
 .../amd/display/amdgpu_dm/amdgpu_dm_plane.c   | 30 ++++++-
 .../gpu/drm/amd/display/dc/core/dc_surface.c  | 46 +++++++++++
 drivers/gpu/drm/amd/display/dc/dc_plane.h     |  3 +
 .../drm/amd/display/dc/dce/dce_mem_input.c    | 34 ++++++--
 .../amd/display/dc/hubp/dcn10/dcn10_hubp.c    | 15 ++++
 .../amd/display/dc/hubp/dcn10/dcn10_hubp.h    |  2 +
 .../amd/display/dc/hubp/dcn20/dcn20_hubp.c    | 15 ++++
 .../amd/display/dc/hubp/dcn20/dcn20_hubp.h    |  2 +
 .../amd/display/dc/hubp/dcn201/dcn201_hubp.c  |  1 +
 .../amd/display/dc/hubp/dcn21/dcn21_hubp.c    |  1 +
 .../amd/display/dc/hubp/dcn30/dcn30_hubp.c    | 17 ++++
 .../amd/display/dc/hubp/dcn30/dcn30_hubp.h    |  2 +
 .../amd/display/dc/hubp/dcn31/dcn31_hubp.c    |  1 +
 .../amd/display/dc/hubp/dcn32/dcn32_hubp.c    |  3 +-
 .../amd/display/dc/hubp/dcn35/dcn35_hubp.c    |  1 +
 .../amd/display/dc/hubp/dcn401/dcn401_hubp.c  | 15 +++-
 .../amd/display/dc/hubp/dcn401/dcn401_hubp.h  |  2 +
 drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h  |  1 +
 .../gpu/drm/amd/display/dc/inc/hw/mem_input.h |  2 +
 25 files changed, 377 insertions(+), 8 deletions(-)
Signature · 1 line
2.47.0
author maintainer
#1 lore raw

PATCH v4 1/6 drm/amdgpu: add generic display panic helper code

Pull this out of Jocelyn's patch and make it generic.

Cc Lu Yao <[email protected]>
Cc Jocelyn Falempe <[email protected]>
Cc Harry Wentland <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 80 +++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.h |  5 ++
 2 files changed, 85 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +80 -0
index b119d27271c1..35c778426a7c 100644
@@ -33,6 +33,7 @@
 #include "soc15_common.h"
 #include "gc/gc_11_0_0_offset.h"
 #include "gc/gc_11_0_0_sh_mask.h"
+#include "bif/bif_4_1_d.h"
 #include <asm/div64.h>
 
 #include <linux/pci.h>
@@ -1788,3 +1789,82 @@ int amdgpu_display_resume_helper(struct amdgpu_device *adev)
 	return 0;
 }
 
+/* panic_bo is set in amdgpu_dm_plane_get_scanout_buffer() and only used in amdgpu_dm_set_pixel()
+ * they are called from the panic handler, and protected by the drm_panic spinlock.
+ */
+static struct amdgpu_bo *panic_abo;
+
+/* Use the indirect MMIO to write each pixel to the GPU VRAM,
+ * This is a simplified version of amdgpu_device_mm_access()
+ */
+static void amdgpu_display_set_pixel(struct drm_scanout_buffer *sb,
+				     unsigned int x,
+				     unsigned int y,
+				     u32 color)
+{
+	struct amdgpu_res_cursor cursor;
+	unsigned long offset;
+	struct amdgpu_bo *abo = panic_abo;
+	struct amdgpu_device *adev = amdgpu_ttm_adev(abo->tbo.bdev);
+	uint32_t tmp;
+
+	offset = x * 4 + y * sb->pitch[0];
+	amdgpu_res_first(abo->tbo.resource, offset, 4, &cursor);
+
+	tmp = cursor.start >> 31;
+	WREG32_NO_KIQ(mmMM_INDEX, ((uint32_t) cursor.start) | 0x80000000);
+	if (tmp != 0xffffffff)
+		WREG32_NO_KIQ(mmMM_INDEX_HI, tmp);
+	WREG32_NO_KIQ(mmMM_DATA, color);
+}
+
+int amdgpu_display_get_scanout_buffer(struct drm_plane *plane,
+				      struct drm_scanout_buffer *sb)
+{
+	struct amdgpu_bo *abo;
+	struct drm_framebuffer *fb = plane->state->fb;
+
+	if (!fb)
+		return -EINVAL;
+
+	DRM_DEBUG_KMS("Framebuffer %dx%d %p4cc\n", fb->width, fb->height, &fb->format->format);
+
+	abo = gem_to_amdgpu_bo(fb->obj[0]);
+	if (!abo)
+		return -EINVAL;
+
+	sb->width = fb->width;
+	sb->height = fb->height;
+	/* Use the generic linear format, because tiling will be disabled in panic_flush() */
+	sb->format = drm_format_info(fb->format->format);
+	if (!sb->format)
+		return -EINVAL;
+
+	sb->pitch[0] = fb->pitches[0];
+
+	if (abo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) {
+		if (abo->tbo.resource->mem_type != TTM_PL_VRAM) {
+			drm_warn(plane->dev, "amdgpu panic, framebuffer not in VRAM\n");
+			return -EINVAL;
+		}
+		/* Only handle 32bits format, to simplify mmio access */
+		if (fb->format->cpp[0] != 4) {
+			drm_warn(plane->dev, "amdgpu panic, pixel format is not 32bits\n");
+			return -EINVAL;
+		}
+		sb->set_pixel = amdgpu_display_set_pixel;
+		panic_abo = abo;
+		return 0;
+	}
+	if (!abo->kmap.virtual &&
+	    ttm_bo_kmap(&abo->tbo, 0, PFN_UP(abo->tbo.base.size), &abo->kmap)) {
+		drm_warn(plane->dev, "amdgpu bo map failed, panic won't be displayed\n");
+		return -ENOMEM;
+	}
+	if (abo->kmap.bo_kmap_type & TTM_BO_MAP_IOMEM_MASK)
+		iosys_map_set_vaddr_iomem(&sb->map[0], abo->kmap.virtual);
+	else
+		iosys_map_set_vaddr(&sb->map[0], abo->kmap.virtual);
+
+	return 0;
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_display.h +5 -0
index 9d19940f73c8..dfa0d642ac16 100644
@@ -23,6 +23,8 @@
 #ifndef __AMDGPU_DISPLAY_H__
 #define __AMDGPU_DISPLAY_H__
 
+#include <drm/drm_panic.h>
+
 #define amdgpu_display_vblank_get_counter(adev, crtc) (adev)->mode_info.funcs->vblank_get_counter((adev), (crtc))
 #define amdgpu_display_backlight_set_level(adev, e, l) (adev)->mode_info.funcs->backlight_set_level((e), (l))
 #define amdgpu_display_backlight_get_level(adev, e) (adev)->mode_info.funcs->backlight_get_level((e))
@@ -49,4 +51,7 @@ amdgpu_lookup_format_info(u32 format, uint64_t modifier);
 int amdgpu_display_suspend_helper(struct amdgpu_device *adev);
 int amdgpu_display_resume_helper(struct amdgpu_device *adev);
 
+int amdgpu_display_get_scanout_buffer(struct drm_plane *plane,
+				      struct drm_scanout_buffer *sb);
+
 #endif
Signature · 1 line
2.47.0
author maintainer
#2 lore raw

PATCH v4 2/6 drm/amd/display: add clear_tiling hubp callbacks

In reply to Alex Deucher

This adds clear_tiling callbacks to the hubp structure that will be used for drm panic support to clear the tiling on a display. hubp3 support from Jocelyn's original patch and the rest from me.

Cc Lu Yao <[email protected]>
Cc Jocelyn Falempe <[email protected]>
Cc Harry Wentland <[email protected]>
---
 .../drm/amd/display/dc/hubp/dcn10/dcn10_hubp.c  | 15 +++++++++++++++
 .../drm/amd/display/dc/hubp/dcn10/dcn10_hubp.h  |  2 ++
 .../drm/amd/display/dc/hubp/dcn20/dcn20_hubp.c  | 15 +++++++++++++++
 .../drm/amd/display/dc/hubp/dcn20/dcn20_hubp.h  |  2 ++
 .../amd/display/dc/hubp/dcn201/dcn201_hubp.c    |  1 +
 .../drm/amd/display/dc/hubp/dcn21/dcn21_hubp.c  |  1 +
 .../drm/amd/display/dc/hubp/dcn30/dcn30_hubp.c  | 17 +++++++++++++++++
 .../drm/amd/display/dc/hubp/dcn30/dcn30_hubp.h  |  2 ++
 .../drm/amd/display/dc/hubp/dcn31/dcn31_hubp.c  |  1 +
 .../drm/amd/display/dc/hubp/dcn32/dcn32_hubp.c  |  3 ++-
 .../drm/amd/display/dc/hubp/dcn35/dcn35_hubp.c  |  1 +
 .../amd/display/dc/hubp/dcn401/dcn401_hubp.c    | 15 ++++++++++++++-
 .../amd/display/dc/hubp/dcn401/dcn401_hubp.h    |  2 ++
 drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h    |  1 +
 14 files changed, 76 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/hubp/dcn10/dcn10_hubp.c +15 -0
index 22ac2b7e49ae..f0ba944553df 100644
@@ -518,6 +518,20 @@ bool hubp1_program_surface_flip_and_addr(
 	return true;
 }
 
+void hubp1_clear_tiling(struct hubp *hubp)
+{
+	struct dcn10_hubp *hubp1 = TO_DCN10_HUBP(hubp);
+
+	REG_UPDATE(DCHUBP_REQ_SIZE_CONFIG, SWATH_HEIGHT, 0);
+	REG_UPDATE(DCSURF_TILING_CONFIG, SW_MODE, DC_SW_LINEAR);
+
+	REG_UPDATE_4(DCSURF_SURFACE_CONTROL,
+		     PRIMARY_SURFACE_DCC_EN, 0,
+		     PRIMARY_SURFACE_DCC_IND_64B_BLK, 0,
+		     SECONDARY_SURFACE_DCC_EN, 0,
+		     SECONDARY_SURFACE_DCC_IND_64B_BLK, 0);
+}
+
 void hubp1_dcc_control(struct hubp *hubp, bool enable,
 		enum hubp_ind_block_size independent_64b_blks)
 {
@@ -1363,6 +1377,7 @@ static const struct hubp_funcs dcn10_hubp_funcs = {
 	.hubp_disable_control =  hubp1_disable_control,
 	.hubp_get_underflow_status = hubp1_get_underflow_status,
 	.hubp_init = hubp1_init,
+	.hubp_clear_tiling = hubp1_clear_tiling,
 
 	.dmdata_set_attributes = NULL,
 	.dmdata_load = NULL,
drivers/gpu/drm/amd/display/dc/hubp/dcn10/dcn10_hubp.h +2 -0
index 69119b2fdce2..631350cd4f2e 100644
@@ -794,4 +794,6 @@ void hubp1_soft_reset(struct hubp *hubp, bool reset);
 
 void hubp1_set_flip_int(struct hubp *hubp);
 
+void hubp1_clear_tiling(struct hubp *hubp);
+
 #endif
drivers/gpu/drm/amd/display/dc/hubp/dcn20/dcn20_hubp.c +15 -0
index 0637e4c552d8..200194544bf0 100644
@@ -406,6 +406,20 @@ void hubp2_program_rotation(
 				H_MIRROR_EN, mirror);
 }
 
+void hubp2_clear_tiling(struct hubp *hubp)
+{
+	struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
+
+	REG_UPDATE(DCHUBP_REQ_SIZE_CONFIG, SWATH_HEIGHT, 0);
+	REG_UPDATE(DCSURF_TILING_CONFIG, SW_MODE, DC_SW_LINEAR);
+
+	REG_UPDATE_4(DCSURF_SURFACE_CONTROL,
+		     PRIMARY_SURFACE_DCC_EN, 0,
+		     PRIMARY_SURFACE_DCC_IND_64B_BLK, 0,
+		     SECONDARY_SURFACE_DCC_EN, 0,
+		     SECONDARY_SURFACE_DCC_IND_64B_BLK, 0);
+}
+
 void hubp2_dcc_control(struct hubp *hubp, bool enable,
 		enum hubp_ind_block_size independent_64b_blks)
 {
@@ -1676,6 +1690,7 @@ static struct hubp_funcs dcn20_hubp_funcs = {
 	.hubp_in_blank = hubp1_in_blank,
 	.hubp_soft_reset = hubp1_soft_reset,
 	.hubp_set_flip_int = hubp1_set_flip_int,
+	.hubp_clear_tiling = hubp2_clear_tiling,
 };
 
 
drivers/gpu/drm/amd/display/dc/hubp/dcn20/dcn20_hubp.h +2 -0
index 18e194507e36..7fd9240868c3 100644
@@ -409,6 +409,8 @@ void hubp2_read_state_common(struct hubp *hubp);
 
 void hubp2_read_state(struct hubp *hubp);
 
+void hubp2_clear_tiling(struct hubp *hubp);
+
 #endif /* __DC_MEM_INPUT_DCN20_H__ */
 
 
drivers/gpu/drm/amd/display/dc/hubp/dcn201/dcn201_hubp.c +1 -0
index cd2bfcc51276..d910e4a54c34 100644
@@ -131,6 +131,7 @@ static struct hubp_funcs dcn201_hubp_funcs = {
 	.hubp_clear_underflow = hubp1_clear_underflow,
 	.hubp_set_flip_control_surface_gsl = hubp2_set_flip_control_surface_gsl,
 	.hubp_init = hubp1_init,
+	.hubp_clear_tiling = hubp1_clear_tiling,
 };
 
 bool dcn201_hubp_construct(
drivers/gpu/drm/amd/display/dc/hubp/dcn21/dcn21_hubp.c +1 -0
index e13d69a22c1c..edbdb8c88d5c 100644
@@ -837,6 +837,7 @@ static struct hubp_funcs dcn21_hubp_funcs = {
 	.hubp_init = hubp21_init,
 	.validate_dml_output = hubp21_validate_dml_output,
 	.hubp_set_flip_int = hubp1_set_flip_int,
+	.hubp_clear_tiling = hubp1_clear_tiling,
 };
 
 bool hubp21_construct(
drivers/gpu/drm/amd/display/dc/hubp/dcn30/dcn30_hubp.c +17 -0
index 60a64d290352..3b16c3cda2c3 100644
@@ -334,6 +334,22 @@ void hubp3_program_tiling(
 
 }
 
+void hubp3_clear_tiling(struct hubp *hubp)
+{
+	struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
+
+	REG_UPDATE(DCHUBP_REQ_SIZE_CONFIG, SWATH_HEIGHT, 0);
+	REG_UPDATE(DCSURF_TILING_CONFIG, SW_MODE, DC_SW_LINEAR);
+
+	REG_UPDATE_6(DCSURF_SURFACE_CONTROL,
+		PRIMARY_SURFACE_DCC_EN, 0,
+		PRIMARY_SURFACE_DCC_IND_BLK, 0,
+		PRIMARY_SURFACE_DCC_IND_BLK_C, 0,
+		SECONDARY_SURFACE_DCC_EN, 0,
+		SECONDARY_SURFACE_DCC_IND_BLK, 0,
+		SECONDARY_SURFACE_DCC_IND_BLK_C, 0);
+}
+
 void hubp3_dcc_control(struct hubp *hubp, bool enable,
 		enum hubp_ind_block_size blk_size)
 {
@@ -512,6 +528,7 @@ static struct hubp_funcs dcn30_hubp_funcs = {
 	.hubp_in_blank = hubp1_in_blank,
 	.hubp_soft_reset = hubp1_soft_reset,
 	.hubp_set_flip_int = hubp1_set_flip_int,
+	.hubp_clear_tiling = hubp3_clear_tiling,
 };
 
 bool hubp3_construct(
drivers/gpu/drm/amd/display/dc/hubp/dcn30/dcn30_hubp.h +2 -0
index b010531a7fe8..cfb01bf340a1 100644
@@ -297,6 +297,8 @@ void hubp3_read_state(struct hubp *hubp);
 
 void hubp3_init(struct hubp *hubp);
 
+void hubp3_clear_tiling(struct hubp *hubp);
+
 #endif /* __DC_HUBP_DCN30_H__ */
 
 
drivers/gpu/drm/amd/display/dc/hubp/dcn31/dcn31_hubp.c +1 -0
index 8394e8c06919..46b804ed05fb 100644
@@ -96,6 +96,7 @@ static struct hubp_funcs dcn31_hubp_funcs = {
 	.hubp_set_flip_int = hubp1_set_flip_int,
 	.hubp_in_blank = hubp1_in_blank,
 	.program_extended_blank = hubp31_program_extended_blank,
+	.hubp_clear_tiling = hubp3_clear_tiling,
 };
 
 bool hubp31_construct(
drivers/gpu/drm/amd/display/dc/hubp/dcn32/dcn32_hubp.c +2 -1
index ca5b4b28a664..8b5bd73b8094 100644
@@ -201,7 +201,8 @@ static struct hubp_funcs dcn32_hubp_funcs = {
 	.hubp_update_force_cursor_pstate_disallow = hubp32_update_force_cursor_pstate_disallow,
 	.phantom_hubp_post_enable = hubp32_phantom_hubp_post_enable,
 	.hubp_update_mall_sel = hubp32_update_mall_sel,
-	.hubp_prepare_subvp_buffering = hubp32_prepare_subvp_buffering
+	.hubp_prepare_subvp_buffering = hubp32_prepare_subvp_buffering,
+	.hubp_clear_tiling = hubp3_clear_tiling,
 };
 
 bool hubp32_construct(
drivers/gpu/drm/amd/display/dc/hubp/dcn35/dcn35_hubp.c +1 -0
index d1f05b82b3dd..eb62042dfafc 100644
@@ -216,6 +216,7 @@ static struct hubp_funcs dcn35_hubp_funcs = {
 	.hubp_set_flip_int = hubp1_set_flip_int,
 	.hubp_in_blank = hubp1_in_blank,
 	.program_extended_blank = hubp31_program_extended_blank_value,
+	.hubp_clear_tiling = hubp3_clear_tiling,
 };
 
 bool hubp35_construct(
drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c +14 -1
index b1ebf5053b4f..2d2ec8562e78 100644
@@ -508,6 +508,18 @@ bool hubp401_program_surface_flip_and_addr(
 	return true;
 }
 
+void hubp401_clear_tiling(struct hubp *hubp)
+{
+	struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
+
+	REG_UPDATE(DCHUBP_REQ_SIZE_CONFIG, SWATH_HEIGHT, 0);
+	REG_UPDATE(DCSURF_TILING_CONFIG, SW_MODE, DC_SW_LINEAR);
+
+	REG_UPDATE_2(DCSURF_SURFACE_CONTROL,
+		     PRIMARY_SURFACE_DCC_EN, 0,
+		     SECONDARY_SURFACE_DCC_EN, 0);
+}
+
 void hubp401_dcc_control(struct hubp *hubp,
 		struct dc_plane_dcc_param *dcc)
 {
@@ -1004,7 +1016,8 @@ static struct hubp_funcs dcn401_hubp_funcs = {
 	.hubp_program_3dlut_fl_width = hubp401_program_3dlut_fl_width,
 	.hubp_program_3dlut_fl_tmz_protected = hubp401_program_3dlut_fl_tmz_protected,
 	.hubp_program_3dlut_fl_crossbar = hubp401_program_3dlut_fl_crossbar,
-	.hubp_get_3dlut_fl_done = hubp401_get_3dlut_fl_done
+	.hubp_get_3dlut_fl_done = hubp401_get_3dlut_fl_done,
+	.hubp_clear_tiling = hubp2_clear_tiling,
 };
 
 bool hubp401_construct(
drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.h +2 -0
index e52fdb5b0cd0..92041d7e0569 100644
@@ -340,4 +340,6 @@ int hubp401_get_3dlut_fl_done(struct hubp *hubp);
 
 void hubp401_set_unbounded_requesting(struct hubp *hubp, bool enable);
 
+void hubp401_clear_tiling(struct hubp *hubp);
+
 #endif /* __DC_HUBP_DCN401_H__ */
drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h +1 -0
index 16580d624278..d0878fc0cc94 100644
@@ -275,6 +275,7 @@ struct hubp_funcs {
 			enum hubp_3dlut_fl_crossbar_bit_slice bit_slice_cb_b,
 			enum hubp_3dlut_fl_crossbar_bit_slice bit_slice_cr_r);
 	int (*hubp_get_3dlut_fl_done)(struct hubp *hubp);
+	void (*hubp_clear_tiling)(struct hubp *hubp);
 };
 
 #endif
Signature · 1 line
2.47.0
author maintainer
#3 lore raw

PATCH v4 3/6 drm/amd/display: add clear_tiling mi callbacks

In reply to Alex Deucher

This adds clear_tiling callbacks to the mi structure that will be used for drm panic support to clear the tiling on a display. Mem input (mi) is used on DCE based display IPs.

Cc Lu Yao <[email protected]>
Cc Jocelyn Falempe <[email protected]>
Cc Harry Wentland <[email protected]>
---
 .../drm/amd/display/dc/dce/dce_mem_input.c    | 34 ++++++++++++++++---
 .../gpu/drm/amd/display/dc/inc/hw/mem_input.h |  2 ++
 2 files changed, 31 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c +29 -5
index f5e1d9caee4c..ebd174be5786 100644
@@ -481,7 +481,6 @@ static void program_tiling(
 	}
 }
 
-
 static void program_size_and_rotation(
 	struct dce_mem_input *dce_mi,
 	enum dc_rotation_angle rotation,
@@ -627,6 +626,27 @@ static void program_grph_pixel_format(
 			GRPH_PRESCALE_B_SIGN, sign);
 }
 
+static void dce_mi_clear_tiling(
+	struct mem_input *mi)
+{
+	struct dce_mem_input *dce_mi = TO_DCE_MEM_INPUT(mi);
+
+	if (dce_mi->masks->GRPH_SW_MODE) { /* GFX9 */
+		REG_UPDATE(GRPH_CONTROL,
+			   GRPH_SW_MODE, DC_SW_LINEAR);
+	}
+
+	if (dce_mi->masks->GRPH_MICRO_TILE_MODE) { /* GFX8 */
+		REG_UPDATE(GRPH_CONTROL,
+			   GRPH_ARRAY_MODE, DC_SW_LINEAR);
+	}
+
+	if (dce_mi->masks->GRPH_ARRAY_MODE) { /* GFX6 but reuses gfx8 struct */
+		REG_UPDATE(GRPH_CONTROL,
+			   GRPH_ARRAY_MODE, DC_SW_LINEAR);
+	}
+}
+
 static void dce_mi_program_surface_config(
 	struct mem_input *mi,
 	enum surface_pixel_format format,
@@ -884,7 +904,8 @@ static const struct mem_input_funcs dce_mi_funcs = {
 	.mem_input_program_pte_vm = dce_mi_program_pte_vm,
 	.mem_input_program_surface_config =
 			dce_mi_program_surface_config,
-	.mem_input_is_flip_pending = dce_mi_is_flip_pending
+	.mem_input_is_flip_pending = dce_mi_is_flip_pending,
+	.mem_input_clear_tiling = dce_mi_clear_tiling,
 };
 
 #if defined(CONFIG_DRM_AMD_DC_SI)
@@ -897,7 +918,8 @@ static const struct mem_input_funcs dce60_mi_funcs = {
 	.mem_input_program_pte_vm = dce_mi_program_pte_vm,
 	.mem_input_program_surface_config =
 			dce60_mi_program_surface_config,
-	.mem_input_is_flip_pending = dce_mi_is_flip_pending
+	.mem_input_is_flip_pending = dce_mi_is_flip_pending,
+	.mem_input_clear_tiling = dce_mi_clear_tiling,
 };
 #endif
 
@@ -910,7 +932,8 @@ static const struct mem_input_funcs dce112_mi_funcs = {
 	.mem_input_program_pte_vm = dce_mi_program_pte_vm,
 	.mem_input_program_surface_config =
 			dce_mi_program_surface_config,
-	.mem_input_is_flip_pending = dce_mi_is_flip_pending
+	.mem_input_is_flip_pending = dce_mi_is_flip_pending,
+	.mem_input_clear_tiling = dce_mi_clear_tiling,
 };
 
 static const struct mem_input_funcs dce120_mi_funcs = {
@@ -922,7 +945,8 @@ static const struct mem_input_funcs dce120_mi_funcs = {
 	.mem_input_program_pte_vm = dce_mi_program_pte_vm,
 	.mem_input_program_surface_config =
 			dce_mi_program_surface_config,
-	.mem_input_is_flip_pending = dce_mi_is_flip_pending
+	.mem_input_is_flip_pending = dce_mi_is_flip_pending,
+	.mem_input_clear_tiling = dce_mi_clear_tiling,
 };
 
 void dce_mem_input_construct(
drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h +2 -0
index a8b44f398ce6..4f5d102455ca 100644
@@ -187,6 +187,8 @@ struct mem_input_funcs {
 			const struct dc_cursor_position *pos,
 			const struct dc_cursor_mi_param *param);
 
+	void (*mem_input_clear_tiling)(
+		struct mem_input *mem_input);
 };
 
 #endif
Signature · 1 line
2.47.0
author maintainer
#4 lore raw

PATCH v4 4/6 drm/amd/display/dc: add helper for panic updates

In reply to Alex Deucher

Add a DC helper for panic updates.

Cc Lu Yao <[email protected]>
Cc Jocelyn Falempe <[email protected]>
Cc Harry Wentland <[email protected]>
---
 .../gpu/drm/amd/display/dc/core/dc_surface.c  | 46 +++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/dc_plane.h     |  3 ++
 2 files changed, 49 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_surface.c +46 -0
index ccbb15f1638c..50faeba498c6 100644
@@ -277,4 +277,50 @@ void dc_3dlut_func_retain(struct dc_3dlut *lut)
 	kref_get(&lut->refcount);
 }
 
+void dc_plane_force_update_for_panic(struct dc_plane_state *plane_state,
+				     bool clear_tiling)
+{
+	struct dc *dc;
+	int i;
+
+	if (!plane_state)
+		return;
+
+	dc = plane_state->ctx->dc;
+
+	if (!dc || !dc->current_state)
+		return;
 
+	for (i = 0; i < dc->res_pool->pipe_count; i++) {
+		struct pipe_ctx *pipe_ctx = &dc->current_state->res_ctx.pipe_ctx[i];
+
+		if (!pipe_ctx)
+			continue;
+
+		if (dc->ctx->dce_version >= DCE_VERSION_MAX) {
+			struct hubp *hubp = pipe_ctx->plane_res.hubp;
+			if (!hubp)
+				continue;
+			/* if framebuffer is tiled, disable tiling */
+			if (clear_tiling && hubp->funcs->hubp_clear_tiling)
+				hubp->funcs->hubp_clear_tiling(hubp);
+
+			/* force page flip to see the new content of the framebuffer */
+			hubp->funcs->hubp_program_surface_flip_and_addr(hubp,
+									&plane_state->address,
+									true);
+		} else {
+			struct mem_input *mi = pipe_ctx->plane_res.mi;
+			if (!mi)
+				continue;
+			/* if framebuffer is tiled, disable tiling */
+			if (clear_tiling && mi->funcs->mem_input_clear_tiling)
+				mi->funcs->mem_input_clear_tiling(mi);
+
+			/* force page flip to see the new content of the framebuffer */
+			mi->funcs->mem_input_program_surface_flip_and_addr(mi,
+									   &plane_state->address,
+									   true);
+		}
+	}
+}
drivers/gpu/drm/amd/display/dc/dc_plane.h +3 -0
index bd37ec82b42d..fabcefeda288 100644
@@ -34,4 +34,7 @@ const struct dc_plane_status *dc_plane_get_status(
 void dc_plane_state_retain(struct dc_plane_state *plane_state);
 void dc_plane_state_release(struct dc_plane_state *plane_state);
 
+void dc_plane_force_update_for_panic(struct dc_plane_state *plane_state,
+				     bool clear_tiling);
+
 #endif /* _DC_PLANE_H_ */
Signature · 1 line
2.47.0
author maintainer
#5 lore raw

PATCH v4 5/6 drm/amd/display: add DC drm_panic support

In reply to Alex Deucher

From: Jocelyn Falempe <[email protected]>

Add support for the drm_panic module, which displays a pretty user friendly message on the screen when a Linux kernel panic occurs.

It doesn't work yet on laptop panels, maybe due to PSR.

Adapted from Jocelyn's original patch to add DC drm_panic support.

---
 .../amd/display/amdgpu_dm/amdgpu_dm_plane.c   | 30 ++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +29 -1
index 495e3cd70426..c10cabb8b42b 100644
@@ -26,6 +26,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_blend.h>
+#include "drm/drm_framebuffer.h"
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_plane_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
@@ -1421,6 +1422,20 @@ static void amdgpu_dm_plane_atomic_async_update(struct drm_plane *plane,
 	amdgpu_dm_plane_handle_cursor_update(plane, old_state);
 }
 
+static void amdgpu_dm_plane_panic_flush(struct drm_plane *plane)
+{
+	struct dm_plane_state *dm_plane_state = to_dm_plane_state(plane->state);
+	struct drm_framebuffer *fb = plane->state->fb;
+	struct dc_plane_state *dc_plane_state;
+
+	if (!dm_plane_state || !dm_plane_state->dc_state)
+		return;
+
+	dc_plane_state = dm_plane_state->dc_state;
+
+	dc_plane_force_update_for_panic(dc_plane_state, fb->modifier ? true : false);
+}
+
 static const struct drm_plane_helper_funcs dm_plane_helper_funcs = {
 	.prepare_fb = amdgpu_dm_plane_helper_prepare_fb,
 	.cleanup_fb = amdgpu_dm_plane_helper_cleanup_fb,
@@ -1429,6 +1444,16 @@ static const struct drm_plane_helper_funcs dm_plane_helper_funcs = {
 	.atomic_async_update = amdgpu_dm_plane_atomic_async_update
 };
 
+static const struct drm_plane_helper_funcs dm_primary_plane_helper_funcs = {
+	.prepare_fb = amdgpu_dm_plane_helper_prepare_fb,
+	.cleanup_fb = amdgpu_dm_plane_helper_cleanup_fb,
+	.atomic_check = amdgpu_dm_plane_atomic_check,
+	.atomic_async_check = amdgpu_dm_plane_atomic_async_check,
+	.atomic_async_update = amdgpu_dm_plane_atomic_async_update,
+	.get_scanout_buffer = amdgpu_display_get_scanout_buffer,
+	.panic_flush = amdgpu_dm_plane_panic_flush,
+};
+
 static void amdgpu_dm_plane_drm_plane_reset(struct drm_plane *plane)
 {
 	struct dm_plane_state *amdgpu_state = NULL;
@@ -1855,7 +1880,10 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
 	    plane->type != DRM_PLANE_TYPE_CURSOR)
 		drm_plane_enable_fb_damage_clips(plane);
 
-	drm_plane_helper_add(plane, &dm_plane_helper_funcs);
+	if (plane->type == DRM_PLANE_TYPE_PRIMARY)
+		drm_plane_helper_add(plane, &dm_primary_plane_helper_funcs);
+	else
+		drm_plane_helper_add(plane, &dm_plane_helper_funcs);
 
 #ifdef AMD_PRIVATE_COLOR
 	dm_atomic_plane_attach_color_mgmt_properties(dm, plane);
Signature · 1 line
2.47.0
author maintainer
#6 lore raw

PATCH v4 6/6 drm/amd/display: add non-DC drm_panic support

In reply to Alex Deucher

Add support for the drm_panic module, which displays a pretty user friendly message on the screen when a Linux kernel panic occurs.

Adapt Lu Yao's code to use common helpers derived from Jocelyn's patch. This extends the non-DC code to enable access to non-CPU accessible VRAM and adds support for other DCE versions.

Cc Lu Yao <[email protected]>
Cc Jocelyn Falempe <[email protected]>
Cc Harry Wentland <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 27 ++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 27 ++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c  | 27 ++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c  | 26 +++++++++++++++++++++++++
 4 files changed, 107 insertions(+)
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +27 -0
index 8bc997b66424..c5e3d2251b18 100644
@@ -2687,6 +2687,32 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
 	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
+static void dce_v10_0_panic_flush(struct drm_plane *plane)
+{
+	struct drm_framebuffer *fb;
+	struct amdgpu_crtc *amdgpu_crtc;
+	struct amdgpu_device *adev;
+	uint32_t fb_format;
+
+	if (!plane->fb)
+		return;
+
+	fb = plane->fb;
+	amdgpu_crtc = to_amdgpu_crtc(plane->crtc);
+	adev = drm_to_adev(fb->dev);
+
+	/* Disable DC tiling */
+	fb_format = RREG32(mmGRPH_CONTROL + amdgpu_crtc->crtc_offset);
+	fb_format &= ~GRPH_CONTROL__GRPH_ARRAY_MODE_MASK;
+	WREG32(mmGRPH_CONTROL + amdgpu_crtc->crtc_offset, fb_format);
+
+}
+
+static const struct drm_plane_helper_funcs dce_v10_0_drm_primary_plane_helper_funcs = {
+	.get_scanout_buffer = amdgpu_display_get_scanout_buffer,
+	.panic_flush = dce_v10_0_panic_flush,
+};
+
 static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
 {
 	struct amdgpu_crtc *amdgpu_crtc;
@@ -2734,6 +2760,7 @@ static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
 	amdgpu_crtc->encoder = NULL;
 	amdgpu_crtc->connector = NULL;
 	drm_crtc_helper_add(&amdgpu_crtc->base, &dce_v10_0_crtc_helper_funcs);
+	drm_plane_helper_add(amdgpu_crtc->base.primary, &dce_v10_0_drm_primary_plane_helper_funcs);
 
 	return 0;
 }
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +27 -0
index 504939e3c0c3..ea42a4472bf6 100644
@@ -2800,6 +2800,32 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
 	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
+static void dce_v11_0_panic_flush(struct drm_plane *plane)
+{
+	struct drm_framebuffer *fb;
+	struct amdgpu_crtc *amdgpu_crtc;
+	struct amdgpu_device *adev;
+	uint32_t fb_format;
+
+	if (!plane->fb)
+		return;
+
+	fb = plane->fb;
+	amdgpu_crtc = to_amdgpu_crtc(plane->crtc);
+	adev = drm_to_adev(fb->dev);
+
+	/* Disable DC tiling */
+	fb_format = RREG32(mmGRPH_CONTROL + amdgpu_crtc->crtc_offset);
+	fb_format &= ~GRPH_CONTROL__GRPH_ARRAY_MODE_MASK;
+	WREG32(mmGRPH_CONTROL + amdgpu_crtc->crtc_offset, fb_format);
+
+}
+
+static const struct drm_plane_helper_funcs dce_v11_0_drm_primary_plane_helper_funcs = {
+	.get_scanout_buffer = amdgpu_display_get_scanout_buffer,
+	.panic_flush = dce_v11_0_panic_flush,
+};
+
 static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
 {
 	struct amdgpu_crtc *amdgpu_crtc;
@@ -2847,6 +2873,7 @@ static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
 	amdgpu_crtc->encoder = NULL;
 	amdgpu_crtc->connector = NULL;
 	drm_crtc_helper_add(&amdgpu_crtc->base, &dce_v11_0_crtc_helper_funcs);
+	drm_plane_helper_add(amdgpu_crtc->base.primary, &dce_v11_0_drm_primary_plane_helper_funcs);
 
 	return 0;
 }
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +27 -0
index a33e33743a93..915804a6a1d7 100644
@@ -2602,6 +2602,32 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
 	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
+static void dce_v6_0_panic_flush(struct drm_plane *plane)
+{
+	struct drm_framebuffer *fb;
+	struct amdgpu_crtc *amdgpu_crtc;
+	struct amdgpu_device *adev;
+	uint32_t fb_format;
+
+	if (!plane->fb)
+		return;
+
+	fb = plane->fb;
+	amdgpu_crtc = to_amdgpu_crtc(plane->crtc);
+	adev = drm_to_adev(fb->dev);
+
+	/* Disable DC tiling */
+	fb_format = RREG32(mmGRPH_CONTROL + amdgpu_crtc->crtc_offset);
+	fb_format &= ~GRPH_ARRAY_MODE(0x7);
+	WREG32(mmGRPH_CONTROL + amdgpu_crtc->crtc_offset, fb_format);
+
+}
+
+static const struct drm_plane_helper_funcs dce_v6_0_drm_primary_plane_helper_funcs = {
+	.get_scanout_buffer = amdgpu_display_get_scanout_buffer,
+	.panic_flush = dce_v6_0_panic_flush,
+};
+
 static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
 {
 	struct amdgpu_crtc *amdgpu_crtc;
@@ -2629,6 +2655,7 @@ static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
 	amdgpu_crtc->encoder = NULL;
 	amdgpu_crtc->connector = NULL;
 	drm_crtc_helper_add(&amdgpu_crtc->base, &dce_v6_0_crtc_helper_funcs);
+	drm_plane_helper_add(amdgpu_crtc->base.primary, &dce_v6_0_drm_primary_plane_helper_funcs);
 
 	return 0;
 }
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +26 -0
index aff58d56864a..f2edc0fece5b 100644
@@ -2613,6 +2613,31 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
 	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
+static void dce_v8_0_panic_flush(struct drm_plane *plane)
+{
+	struct drm_framebuffer *fb;
+	struct amdgpu_crtc *amdgpu_crtc;
+	struct amdgpu_device *adev;
+	uint32_t fb_format;
+
+	if (!plane->fb)
+		return;
+
+	fb = plane->fb;
+	amdgpu_crtc = to_amdgpu_crtc(plane->crtc);
+	adev = drm_to_adev(fb->dev);
+
+	/* Disable DC tiling */
+	fb_format = RREG32(mmGRPH_CONTROL + amdgpu_crtc->crtc_offset);
+	fb_format &= ~GRPH_CONTROL__GRPH_ARRAY_MODE_MASK;
+	WREG32(mmGRPH_CONTROL + amdgpu_crtc->crtc_offset, fb_format);
+}
+
+static const struct drm_plane_helper_funcs dce_v8_0_drm_primary_plane_helper_funcs = {
+	.get_scanout_buffer = amdgpu_display_get_scanout_buffer,
+	.panic_flush = dce_v8_0_panic_flush,
+};
+
 static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
 {
 	struct amdgpu_crtc *amdgpu_crtc;
@@ -2640,6 +2665,7 @@ static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
 	amdgpu_crtc->encoder = NULL;
 	amdgpu_crtc->connector = NULL;
 	drm_crtc_helper_add(&amdgpu_crtc->base, &dce_v8_0_crtc_helper_funcs);
+	drm_plane_helper_add(amdgpu_crtc->base.primary, &dce_v8_0_drm_primary_plane_helper_funcs);
 
 	return 0;
 }
Signature · 1 line
2.47.0
#7 lore raw
In reply to Alex Deucher

+ Harry

Ping on this series.

Quoted 52 lines · Alex Deucher

This builds on the patches from Lu and Jocelyn to fill in panic support for all DCE/DCN variants and code pathes.

v2: refactor to provide cleaner history and share more code to provide a more consistent experience across DC and non-DC.

v3: resend with the missing first patch

v4: move hubp and mi code into a dc helper function

Alex Deucher (5):
drm/amdgpu: add generic display panic helper code drm/amd/display: add clear_tiling hubp callbacks drm/amd/display: add clear_tiling mi callbacks drm/amd/display/dc: add helper for panic updates drm/amd/display: add non-DC drm_panic support

Jocelyn Falempe (1):
drm/amd/display: add DC drm_panic support

 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   | 80 +++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.h   |  5 ++
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        | 27 +++++++
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        | 27 +++++++
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         | 27 +++++++
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         | 26 ++++++
 .../amd/display/amdgpu_dm/amdgpu_dm_plane.c   | 30 ++++++-
 .../gpu/drm/amd/display/dc/core/dc_surface.c  | 46 +++++++++++
 drivers/gpu/drm/amd/display/dc/dc_plane.h     |  3 +
 .../drm/amd/display/dc/dce/dce_mem_input.c    | 34 ++++++--
 .../amd/display/dc/hubp/dcn10/dcn10_hubp.c    | 15 ++++
 .../amd/display/dc/hubp/dcn10/dcn10_hubp.h    |  2 +
 .../amd/display/dc/hubp/dcn20/dcn20_hubp.c    | 15 ++++
 .../amd/display/dc/hubp/dcn20/dcn20_hubp.h    |  2 +
 .../amd/display/dc/hubp/dcn201/dcn201_hubp.c  |  1 +
 .../amd/display/dc/hubp/dcn21/dcn21_hubp.c    |  1 +
 .../amd/display/dc/hubp/dcn30/dcn30_hubp.c    | 17 ++++
 .../amd/display/dc/hubp/dcn30/dcn30_hubp.h    |  2 +
 .../amd/display/dc/hubp/dcn31/dcn31_hubp.c    |  1 +
 .../amd/display/dc/hubp/dcn32/dcn32_hubp.c    |  3 +-
 .../amd/display/dc/hubp/dcn35/dcn35_hubp.c    |  1 +
 .../amd/display/dc/hubp/dcn401/dcn401_hubp.c  | 15 +++-
 .../amd/display/dc/hubp/dcn401/dcn401_hubp.h  |  2 +
 drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h  |  1 +
 .../gpu/drm/amd/display/dc/inc/hw/mem_input.h |  2 +
 25 files changed, 377 insertions(+), 8 deletions(-)

--
2.47.0

maintainer Reviewed-by
#8 lore raw

Looks good now.

Series is

Haven't followed the whole panic support closely. Is there a way to trigger a panic for testing, or is there any other recommended way to test this?

Harry

Quoted 57 lines · Alex Deucher

+ Harry

Ping on this series.

Quoted 52 lines · Alex Deucher

This builds on the patches from Lu and Jocelyn to fill in panic support for all DCE/DCN variants and code pathes.

v2: refactor to provide cleaner history and share more code to provide a more consistent experience across DC and non-DC.

v3: resend with the missing first patch

v4: move hubp and mi code into a dc helper function

Alex Deucher (5):
drm/amdgpu: add generic display panic helper code drm/amd/display: add clear_tiling hubp callbacks drm/amd/display: add clear_tiling mi callbacks drm/amd/display/dc: add helper for panic updates drm/amd/display: add non-DC drm_panic support

Jocelyn Falempe (1):
drm/amd/display: add DC drm_panic support

 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   | 80 +++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.h   |  5 ++
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        | 27 +++++++
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        | 27 +++++++
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         | 27 +++++++
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         | 26 ++++++
 .../amd/display/amdgpu_dm/amdgpu_dm_plane.c   | 30 ++++++-
 .../gpu/drm/amd/display/dc/core/dc_surface.c  | 46 +++++++++++
 drivers/gpu/drm/amd/display/dc/dc_plane.h     |  3 +
 .../drm/amd/display/dc/dce/dce_mem_input.c    | 34 ++++++--
 .../amd/display/dc/hubp/dcn10/dcn10_hubp.c    | 15 ++++
 .../amd/display/dc/hubp/dcn10/dcn10_hubp.h    |  2 +
 .../amd/display/dc/hubp/dcn20/dcn20_hubp.c    | 15 ++++
 .../amd/display/dc/hubp/dcn20/dcn20_hubp.h    |  2 +
 .../amd/display/dc/hubp/dcn201/dcn201_hubp.c  |  1 +
 .../amd/display/dc/hubp/dcn21/dcn21_hubp.c    |  1 +
 .../amd/display/dc/hubp/dcn30/dcn30_hubp.c    | 17 ++++
 .../amd/display/dc/hubp/dcn30/dcn30_hubp.h    |  2 +
 .../amd/display/dc/hubp/dcn31/dcn31_hubp.c    |  1 +
 .../amd/display/dc/hubp/dcn32/dcn32_hubp.c    |  3 +-
 .../amd/display/dc/hubp/dcn35/dcn35_hubp.c    |  1 +
 .../amd/display/dc/hubp/dcn401/dcn401_hubp.c  | 15 +++-
 .../amd/display/dc/hubp/dcn401/dcn401_hubp.h  |  2 +
 drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h  |  1 +
 .../gpu/drm/amd/display/dc/inc/hw/mem_input.h |  2 +
 25 files changed, 377 insertions(+), 8 deletions(-)

--
2.47.0

#9 lore raw
Quoted 8 lines · Harry Wentland

Looks good now.

Series is

Haven't followed the whole panic support closely. Is there a way to trigger a panic for testing, or is there any other recommended way to test this?

The easiest way is to trigger a kernel panic with:
echo c > /proc/sysrq-trigger

You can also enable CONFIG_DRM_PANIC_DEBUG and echo 1 > /sys/kernel/debug/dri/0/drm_panic_plane_0

But as it overwrite ones of the two framebuffer, it causes flickers, and a few graphic artefacts, but make it somewhat easier to test, as it doesn't crash the machine.

Best regards,

Signature · 1 line
Jocelyn
Quoted 62 lines

Harry

Quoted 57 lines · Alex Deucher

+ Harry

Ping on this series.

Quoted 52 lines · Alex Deucher

This builds on the patches from Lu and Jocelyn to fill in panic support for all DCE/DCN variants and code pathes.

v2: refactor to provide cleaner history and share more code to provide a more consistent experience across DC and non-DC.

v3: resend with the missing first patch

v4: move hubp and mi code into a dc helper function

Alex Deucher (5):
drm/amdgpu: add generic display panic helper code drm/amd/display: add clear_tiling hubp callbacks drm/amd/display: add clear_tiling mi callbacks drm/amd/display/dc: add helper for panic updates drm/amd/display: add non-DC drm_panic support

Jocelyn Falempe (1):
drm/amd/display: add DC drm_panic support

  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   | 80 +++++++++++++++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_display.h   |  5 ++
  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        | 27 +++++++
  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        | 27 +++++++
  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         | 27 +++++++
  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         | 26 ++++++
  .../amd/display/amdgpu_dm/amdgpu_dm_plane.c   | 30 ++++++-
  .../gpu/drm/amd/display/dc/core/dc_surface.c  | 46 +++++++++++
  drivers/gpu/drm/amd/display/dc/dc_plane.h     |  3 +
  .../drm/amd/display/dc/dce/dce_mem_input.c    | 34 ++++++--
  .../amd/display/dc/hubp/dcn10/dcn10_hubp.c    | 15 ++++
  .../amd/display/dc/hubp/dcn10/dcn10_hubp.h    |  2 +
  .../amd/display/dc/hubp/dcn20/dcn20_hubp.c    | 15 ++++
  .../amd/display/dc/hubp/dcn20/dcn20_hubp.h    |  2 +
  .../amd/display/dc/hubp/dcn201/dcn201_hubp.c  |  1 +
  .../amd/display/dc/hubp/dcn21/dcn21_hubp.c    |  1 +
  .../amd/display/dc/hubp/dcn30/dcn30_hubp.c    | 17 ++++
  .../amd/display/dc/hubp/dcn30/dcn30_hubp.h    |  2 +
  .../amd/display/dc/hubp/dcn31/dcn31_hubp.c    |  1 +
  .../amd/display/dc/hubp/dcn32/dcn32_hubp.c    |  3 +-
  .../amd/display/dc/hubp/dcn35/dcn35_hubp.c    |  1 +
  .../amd/display/dc/hubp/dcn401/dcn401_hubp.c  | 15 +++-
  .../amd/display/dc/hubp/dcn401/dcn401_hubp.h  |  2 +
  drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h  |  1 +
  .../gpu/drm/amd/display/dc/inc/hw/mem_input.h |  2 +
  25 files changed, 377 insertions(+), 8 deletions(-)

--
2.47.0