Skip to contentSkip to conversation

drm/tidss: Add drm_panic support

PATCH In review Javier Martinez Canillas 3 participants 4 messages Jun 15, 2024 – Jun 18, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/tidss: Add drm_panic support

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

---
Tested on an AM625 BeaglePlay board by triggering a panic using the echo c > /proc/sysrq-trigger command.

 drivers/gpu/drm/tidss/tidss_plane.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/tidss/tidss_plane.c +13 -1
index 68fed531f6a7..a5d86822c9e3 100644
@@ -8,6 +8,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_blend.h>
 #include <drm/drm_crtc.h>
+#include <drm/drm_fb_dma_helper.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
@@ -166,6 +167,14 @@ static const struct drm_plane_helper_funcs tidss_plane_helper_funcs = {
 	.atomic_disable = tidss_plane_atomic_disable,
 };
 
+static const struct drm_plane_helper_funcs tidss_primary_plane_helper_funcs = {
+	.atomic_check = tidss_plane_atomic_check,
+	.atomic_update = tidss_plane_atomic_update,
+	.atomic_enable = tidss_plane_atomic_enable,
+	.atomic_disable = tidss_plane_atomic_disable,
+	.get_scanout_buffer = drm_fb_dma_get_scanout_buffer,
+};
+
 static const struct drm_plane_funcs tidss_plane_funcs = {
 	.update_plane = drm_atomic_helper_update_plane,
 	.disable_plane = drm_atomic_helper_disable_plane,
@@ -211,7 +220,10 @@ struct tidss_plane *tidss_plane_create(struct tidss_device *tidss,
 	if (ret < 0)
 		goto err;
 
-	drm_plane_helper_add(&tplane->plane, &tidss_plane_helper_funcs);
+	if (type == DRM_PLANE_TYPE_PRIMARY)
+		drm_plane_helper_add(&tplane->plane, &tidss_primary_plane_helper_funcs);
+	else
+		drm_plane_helper_add(&tplane->plane, &tidss_plane_helper_funcs);
 
 	drm_plane_create_zpos_property(&tplane->plane, tidss->num_planes, 0,
 				       num_planes - 1);
Signature · 1 line
2.45.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Javier Martinez Canillas

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

Thanks for enabling drm panic on another hardware. It looks good to me.

Quoted 48 lines

---
Tested on an AM625 BeaglePlay board by triggering a panic using the echo c > /proc/sysrq-trigger command.

  drivers/gpu/drm/tidss/tidss_plane.c | 14 +++++++++++++-
  1 file changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/tidss/tidss_plane.c +13 -1
index 68fed531f6a7..a5d86822c9e3 100644
@@ -8,6 +8,7 @@
  #include <drm/drm_atomic_helper.h>
  #include <drm/drm_blend.h>
  #include <drm/drm_crtc.h>
+#include <drm/drm_fb_dma_helper.h>
  #include <drm/drm_fourcc.h>
  #include <drm/drm_framebuffer.h>
  #include <drm/drm_gem_atomic_helper.h>
@@ -166,6 +167,14 @@ static const struct drm_plane_helper_funcs tidss_plane_helper_funcs = {
  	.atomic_disable = tidss_plane_atomic_disable,
  };
 
+static const struct drm_plane_helper_funcs tidss_primary_plane_helper_funcs = {
+	.atomic_check = tidss_plane_atomic_check,
+	.atomic_update = tidss_plane_atomic_update,
+	.atomic_enable = tidss_plane_atomic_enable,
+	.atomic_disable = tidss_plane_atomic_disable,
+	.get_scanout_buffer = drm_fb_dma_get_scanout_buffer,
+};
+
  static const struct drm_plane_funcs tidss_plane_funcs = {
  	.update_plane = drm_atomic_helper_update_plane,
  	.disable_plane = drm_atomic_helper_disable_plane,
@@ -211,7 +220,10 @@ struct tidss_plane *tidss_plane_create(struct tidss_device *tidss,
  	if (ret < 0)
  		goto err;
 
-	drm_plane_helper_add(&tplane->plane, &tidss_plane_helper_funcs);
+	if (type == DRM_PLANE_TYPE_PRIMARY)
+		drm_plane_helper_add(&tplane->plane, &tidss_primary_plane_helper_funcs);
+	else
+		drm_plane_helper_add(&tplane->plane, &tidss_plane_helper_funcs);
 
  	drm_plane_create_zpos_property(&tplane->plane, tidss->num_planes, 0,
  				       num_planes - 1);
Reviewed-by on v1 1/1
#2 lore raw
In reply to Javier Martinez Canillas

Hi Javier,

I tested the patch, and it was good to see the panic screen on SK-AM62. Thanks for adding this feature in tidss. =)

Quoted 4 lines · Javier Martinez Canillas

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

Quoted 7 lines

---
Tested on an AM625 BeaglePlay board by triggering a panic using the echo c > /proc/sysrq-trigger command.

 drivers/gpu/drm/tidss/tidss_plane.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

[...]

--
Regards
Aradhya

#3 lore raw
Quoted 5 lines · Aradhya Bhatia

Hi Javier,

I tested the patch, and it was good to see the panic screen on SK-AM62. Thanks for adding this feature in tidss. =)

Quoted 8 lines
Quoted 4 lines · Javier Martinez Canillas

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

Thanks Jocelyn and Aradhya for the review and test! I've pushed this patch to drm-misc (drm-misc-next).

Signature · 5 lines
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat