From efb67f52fb36186935a56bc2ceda6567dfd97c47 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Fri, 11 Sep 2026 14:44:07 +0200 Subject: drm/panic: Compile KUnit tests as module Fix dependency of the panic-helper KUnit tests on CONFIG_DRM_KUNIT_TEST=y and make them build as a module. Export the necessary interfaces from the panic helpers iff the KUnit framework has been enabled. Select DRM_PANIC_HELPER from DRM_KUNIT_TEST to meet the dependencies of the panic-helper tests. It is now possible to run the tests by modprobe-ing drm_panic_helper_test at runtime. v5: - clear test description with drm_panic_helper_clear_description() (Sashiko) v3: - clean up after each test case (Sashiko) v2: - fix parameter order in decl of drm_panic_helper_draw_screen_qr() (Sashiko) Signed-off-by: Thomas Zimmermann Reviewed-by: Jocelyn Falempe Link: https://patch.msgid.link/20260911124540.279841-15-tzimmermann@suse.de --- include/drm/drm_panic_helper.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/drm/drm_panic_helper.h b/include/drm/drm_panic_helper.h index 6cc9a0eba077..fbfe51161aef 100644 --- a/include/drm/drm_panic_helper.h +++ b/include/drm/drm_panic_helper.h @@ -8,6 +8,7 @@ enum drm_panic_type; struct drm_plane; +struct drm_scanout_buffer; /* drm_panic_helper.c */ int drm_plane_helper_display_panic_screen(struct drm_plane *plane, @@ -15,6 +16,14 @@ int drm_plane_helper_display_panic_screen(struct drm_plane *plane, enum drm_panic_type panic_type, u32 fg_color, u32 bg_color, unsigned int qr_version); +#if IS_ENABLED(CONFIG_KUNIT) +int drm_panic_helper_draw_screen_user(struct drm_scanout_buffer *sb, u32 fg_color, u32 bg_color); +int drm_panic_helper_draw_screen_kmsg(struct drm_scanout_buffer *sb, u32 fg_color, u32 bg_color); +int drm_panic_helper_draw_screen_qr_code(struct drm_scanout_buffer *sb, + u32 fg_color, u32 bg_color, unsigned int qr_version); +void drm_panic_helper_set_description(const char *description); +void drm_panic_helper_clear_description(void); +#endif /* drm_panic_helper_qr.rs */ size_t drm_panic_helper_qr_max_data_size(u8 version, size_t url_len); -- cgit v1.2.3