Files
Thomas Zimmermann 5c3d323984 drm/panic: Move panic display code into helper library
Move drm_plane_helper_display_panic_screen() and the existing panic-
display code into drm_panic_helper.c. Rename symbols accordingly.
Also update the QR-related code and the bindings accordingly.

Link the rsp. object file into drm_kms_helper.ko. Eventually the code
will become a DRM drawing library, together with DRM's format and draw
helpers. This requires more preparation. until then, KMS helpers serve
as a module. All DRM drivers link it anyway.

Add a new section about drawing helpers to the documentation of the KMS
helpers. List format and panic helpers there.

v2:
- fix dependencies on other DRM modules (Randy, Sashiko)
- provide placeholders for drm_panic_helper_{init,exit}() (Sashiko)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patch.msgid.link/20260911124540.279841-14-tzimmermann@suse.de
2026-09-17 09:16:36 +02:00

89 lines
2.0 KiB
C

/* SPDX-License-Identifier: GPL-2.0 or MIT */
/*
* Copyright (c) 2024 Intel
* Copyright (c) 2024 Red Hat
*/
#ifndef __DRM_PANIC_H__
#define __DRM_PANIC_H__
#include <linux/types.h>
#include <linux/iosys-map.h>
#include <drm/drm_fourcc.h>
struct page;
enum drm_panic_type {
DRM_PANIC_TYPE_KMSG,
DRM_PANIC_TYPE_USER,
DRM_PANIC_TYPE_QR,
};
/**
* struct drm_scanout_buffer - DRM scanout buffer
*
* This structure holds the information necessary for drm_panic to draw the
* panic screen, and display it.
*/
struct drm_scanout_buffer {
/**
* @format:
*
* drm format of the scanout buffer.
*/
const struct drm_format_info *format;
/**
* @map:
*
* Virtual address of the scanout buffer, either in memory or iomem.
* The scanout buffer should be in linear format, and can be directly
* sent to the display hardware. Tearing is not an issue for the panic
* screen.
*/
struct iosys_map map[DRM_FORMAT_MAX_PLANES];
/**
* @pages: Optional, if the scanout buffer is not mapped, set this field
* to the array of pages of the scanout buffer. The panic code will use
* kmap_local_page_try_from_panic() to map one page at a time to write
* all the pixels. This array shouldn't be allocated from the
* get_scanoutbuffer() callback.
* The scanout buffer should be in linear format.
*/
struct page **pages;
/**
* @width: Width of the scanout buffer, in pixels.
*/
unsigned int width;
/**
* @height: Height of the scanout buffer, in pixels.
*/
unsigned int height;
/**
* @pitch: Length in bytes between the start of two consecutive lines.
*/
unsigned int pitch[DRM_FORMAT_MAX_PLANES];
/**
* @set_pixel: Optional function, to set a pixel color on the
* framebuffer. It allows to handle special tiling format inside the
* driver. It takes precedence over the @map and @pages fields.
*/
void (*set_pixel)(struct drm_scanout_buffer *sb, unsigned int x,
unsigned int y, u32 color);
/**
* @private: private pointer that you can use in the callbacks
* set_pixel()
*/
void *private;
};
#endif /* __DRM_PANIC_H__ */