N
     ˆÆÅƒ}Ö^ÄÃÇ &
    #ifndef _DRM_DEVICE_H_
#define _DRM_DEVICE_H_

#include <linux/list.h>
#include <linux/kref.h>
#include <linux/mutex.h>
#include <linux/idr.h>
#include <linux/sched.h>

#include <drm/drm_mode_config.h>

struct drm_driver;
struct drm_minor;
struct drm_master;
struct drm_vblank_crtc;
struct drm_vma_offset_manager;
struct drm_vram_mm;
struct drm_fb_helper;

struct inode;

struct pci_dev;
struct pci_controller;

/*
 * Recovery methods for wedged device in order of less to more side-effects.
 * To be used with drm_dev_wedged_event() as recovery @method. Callers can
 * use any one, multiple (or'd) or none depending on their needs.
 *
 * Refer to "Device Wedging" chapter in Documentation/gpu/drm-uapi.rst for more
 * details.
 */
#define DRM_WEDGE_RECOVERY_NONE		BIT(0)	/* optional telemetry collection */
#define DRM_WEDGE_RECOVERY_REBIND	BIT(1)	/* unbind + bind driver */
#define DRM_WEDGE_RECOVERY_BUS_RESET	BIT(2)	/* unbind + reset bus device + bind */
#define DRM_WEDGE_RECOVERY_VENDOR	BIT(3)	/* vendor specific recovery method */

/**
 * struct drm_wedge_task_info - information about the guilty task of a wedge dev
 */
struct drm_wedge_task_info {
	/** @pid: pid of the task */
	pid_t pid;
	/** @comm: command name of the task */
	char comm[TASK_COMM_LEN];
};

/**
 * enum switch_power_state - power state of drm device
 */

enum switch_power_state {
	/** @DRM_SWITCH_POWER_ON: Power state is ON */
	DRM_SWITCH_POWER_ON = 0,

	/** @DRM_SWITCH_POWER_OFF: Power state is OFF */
	DRM_SWITCH_POWER_OFF = 1,

	/** @DRM_SWITCH_POWER_CHANGING: Power state is changing */
	DRM_SWITCH_POWER_CHANGING = 2,

	/** @DRM_SWITCH_POWER_DYNAMIC_OFF: Suspended */
	DRM_SWITCH_POWER_DYNAMIC_OFF = 3,
};

/**
 * struct drm_device - DRM device structure
 *
 * This structure represent a complete card that
 * may contain multiple heads.
 */
struct drm_device {
	/** @if_version: Highest interface version set */
	int if_version;

	/** @ref: Object ref-count */
	struct kref ref;

	/** @dev: Device structure of bus-device */
	struct device *dev;

	/**
	 * @dma_dev:
	 *
	 * Device for DMA operations. Only required if the device @dev
	 * cannot perform DMA by itself. Should be NULL otherwise. Call
	 * drm_dev_dma_dev() to get the DMA device instead of using this
	 * field directly. Call drm_dev_set_dma_dev() to set this field.
	 *
	 * DRM devices are sometimes bound to virtual devices that cannot
	 * perform DMA by themselves. Drivers should set this field to the
	 * respective DMA controller.
	 *
	 * Devices on USB and other peripheral busses also cannot perform
	 * DMA by themselves. The @dma_dev field should point the bus
	 * controller that does DMA on behalve of such a device. Required
	 * for importing buffers via dma-buf.
	 *
	 * If set, the DRM core automatically releases the reference on the
	 * device.
	 */
	struct device *dma_dev;

	/**
	 * @managed:
	 *
	 * Managed resources linked to the lifetime of this &drm_device as
	 * tracked by @ref.
	 */
	struct {
		/** @managed.resources: managed resources list */
		struct list_head resources;
		/** @managed.final_kfree: pointer for final kfree() call */
		void *final_kfree;
		/** @managed.lock: protects @managed.resources */
		spinlock_t lock;
	} managed;

	/** @driver: DRM driver managing the device */
	const struct drm_driver *driver;

	/**
	 * @dev_private:
	 *
	 * DRM driver private data. This is deprecated and should be left set to
	 * NULL.
	 *
	 * Instead of using this pointer it is recommended that drivers use
	 * devm_drm_dev_alloc() and embed struct &drm_device in their larger
	 * per-device structure.
	 */
	void *dev_private;

	/**
	 * @primary:
	 *
	 * Primary node. Drivers should not interact with this
	 * directly. debugfs interfaces can be registered with
	 * drm_debugfs_add_file(), and sysfs should be directly added on the
	 * hardware (and not character device node) struct device @dev.
	 */
	struct drm_minor *primary;

	/**
	 * @render:
	 *
	 * Render node. Drivers should not interact with this directly ever.
	 * Drivers should not expose any additional interfaces in