include/drm/drm_panic.h

Source file repositories/reference/linux-study-clean/include/drm/drm_panic.h

File Facts

System
Linux kernel
Corpus path
include/drm/drm_panic.h
Extension
.h
Size
6258 bytes
Lines
190
Domain
Repository Root And Misc
Bucket
include
Inferred role
Repository Root And Misc: implementation source
Status
source implementation candidate

Why This File Exists

Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.

Dependency Surface

Detected Declarations

Annotated Snippet

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;

};

#ifdef CONFIG_DRM_PANIC

/**
 * drm_panic_trylock - try to enter the panic printing critical section
 * @dev: struct drm_device
 * @flags: unsigned long irq flags you need to pass to the unlock() counterpart
 *
 * This function must be called by any panic printing code. The panic printing
 * attempt must be aborted if the trylock fails.
 *
 * Panic printing code can make the following assumptions while holding the
 * panic lock:
 *
 * - Anything protected by drm_panic_lock() and drm_panic_unlock() pairs is safe
 *   to access.
 *
 * - Furthermore the panic printing code only registers in drm_dev_unregister()
 *   and gets removed in drm_dev_unregister(). This allows the panic code to
 *   safely access any state which is invariant in between these two function
 *   calls, like the list of planes &drm_mode_config.plane_list or most of the
 *   struct drm_plane structure.
 *
 * Specifically thanks to the protection around plane updates in
 * drm_atomic_helper_swap_state() the following additional guarantees hold:
 *
 * - It is safe to deference the drm_plane.state pointer.
 *
 * - Anything in struct drm_plane_state or the driver's subclass thereof which
 *   stays invariant after the atomic check code has finished is safe to access.
 *   Specifically this includes the reference counted pointers to framebuffer
 *   and buffer objects.

Annotation

Implementation Notes