Restrict panic handling to primary displays. Overlays and cursors
should not display panic output. If there are exceptions, they can
be registered by the driver itself.

v3:
- also update drm_panic_is_enabled() (Sashiko)
- still do some testing when unregistering (Sashiko)

Signed-off-by: Thomas Zimmermann <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
---
 drivers/gpu/drm/drm_panic.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c
index 624042c42a7f..381f8aab3661 100644
--- a/drivers/gpu/drm/drm_panic.c
+++ b/drivers/gpu/drm/drm_panic.c
@@ -1059,9 +1059,13 @@ bool drm_panic_is_enabled(struct drm_device *dev)
        if (!dev->mode_config.num_total_plane)
                return false;
 
-       drm_for_each_plane(plane, dev)
-               if (plane->helper_private && 
plane->helper_private->get_scanout_buffer)
-                       return true;
+       drm_for_each_plane(plane, dev) {
+               if (plane->type != DRM_PLANE_TYPE_PRIMARY)
+                       continue;
+               if (!plane->helper_private || 
!plane->helper_private->get_scanout_buffer)
+                       continue;
+               return true;
+       }
        return false;
 }
 EXPORT_SYMBOL(drm_panic_is_enabled);
@@ -1079,6 +1083,8 @@ void drm_panic_register(struct drm_device *dev)
                return;
 
        drm_for_each_plane(plane, dev) {
+               if (plane->type != DRM_PLANE_TYPE_PRIMARY)
+                       continue;
                if (!plane->helper_private || 
!plane->helper_private->get_scanout_buffer)
                        continue;
                plane->kmsg_panic.dump = drm_panic;
@@ -1106,6 +1112,8 @@ void drm_panic_unregister(struct drm_device *dev)
                return;
 
        drm_for_each_plane(plane, dev) {
+               if (plane->type != DRM_PLANE_TYPE_PRIMARY)
+                       continue;
                if (!plane->helper_private || 
!plane->helper_private->get_scanout_buffer)
                        continue;
                kmsg_dump_unregister(&plane->kmsg_panic);
-- 
2.55.0

Reply via email to