summaryrefslogtreecommitdiff
path: root/include/drm/drm_panic_helper.h
blob: fbfe51161aef4b2d10411aa11e93f8d4c9e3d04e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* SPDX-License-Identifier: GPL-2.0 or MIT */

#ifndef __DRM_DRM_PANIC_HELPER_H_
#define __DRM_DRM_PANIC_HELPER_H_

#include <linux/types.h>

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,
					  const char *description,
					  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);
u8 drm_panic_helper_qr_generate(const char *url, u8 *data, size_t data_len, size_t data_size,
				u8 *tmp, size_t tmp_size);

#if IS_ENABLED(CONFIG_DRM_PANIC)
#define DRM_PANIC_PLANE_FUNCS \
	.display_panic_screen = drm_plane_helper_display_panic_screen
#else
#define DRM_PANIC_PLANE_FUNCS \
	.display_panic_screen = NULL
#endif

#endif