Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (c) 2009-2010, Code Aurora Forum.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Author: Rickard E. (Rik) Faith <faith@valinux.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * Author: Gareth Hughes <gareth@valinux.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * Permission is hereby granted, free of charge, to any person obtaining a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * copy of this software and associated documentation files (the "Software"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * to deal in the Software without restriction, including without limitation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * and/or sell copies of the Software, and to permit persons to whom the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * Software is furnished to do so, subject to the following conditions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * The above copyright notice and this permission notice (including the next
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * paragraph) shall be included in all copies or substantial portions of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * Software.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * OTHER DEALINGS IN THE SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #ifndef _DRM_FILE_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #define _DRM_FILE_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include <linux/completion.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #include <linux/idr.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #include <uapi/drm/drm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #include <drm/drm_prime.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) struct dma_fence;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) struct drm_file;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) struct drm_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) struct device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) struct file;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * FIXME: Not sure we want to have drm_minor here in the end, but to avoid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  * header include loops we need it here for now.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) /* Note that the order of this enum is ABI (it determines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)  * /dev/dri/renderD* numbers).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) enum drm_minor_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	DRM_MINOR_PRIMARY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	DRM_MINOR_CONTROL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	DRM_MINOR_RENDER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  * struct drm_minor - DRM device minor structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  * This structure represents a DRM minor number for device nodes in /dev.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  * Entirely opaque to drivers and should never be inspected directly by drivers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  * Drivers instead should only interact with &struct drm_file and of course
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)  * &struct drm_device, which is also where driver-private data and resources can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)  * be attached to.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) struct drm_minor {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	/* private: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	int index;			/* Minor device number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	int type;                       /* Control or render */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	struct device *kdev;		/* Linux device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	struct drm_device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	struct dentry *debugfs_root;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	struct list_head debugfs_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	struct mutex debugfs_lock; /* Protects debugfs_list. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)  * struct drm_pending_event - Event queued up for userspace to read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  * This represents a DRM event. Drivers can use this as a generic completion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  * mechanism, which supports kernel-internal &struct completion, &struct dma_fence
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  * and also the DRM-specific &struct drm_event delivery mechanism.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) struct drm_pending_event {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	 * @completion:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	 * Optional pointer to a kernel internal completion signalled when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	 * drm_send_event() is called, useful to internally synchronize with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	 * nonblocking operations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	struct completion *completion;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	 * @completion_release:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	 * Optional callback currently only used by the atomic modeset helpers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	 * to clean up the reference count for the structure @completion is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	 * stored in.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	void (*completion_release)(struct completion *completion);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	 * @event:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	 * Pointer to the actual event that should be sent to userspace to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	 * read using drm_read(). Can be optional, since nowadays events are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	 * also used to signal kernel internal threads with @completion or DMA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	 * transactions using @fence.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	struct drm_event *event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	 * @fence:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	 * Optional DMA fence to unblock other hardware transactions which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	 * depend upon the nonblocking DRM operation this event represents.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	struct dma_fence *fence;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	 * @file_priv:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	 * &struct drm_file where @event should be delivered to. Only set when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	 * @event is set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	struct drm_file *file_priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	 * @link:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	 * Double-linked list to keep track of this event. Can be used by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	 * driver up to the point when it calls drm_send_event(), after that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	 * this list entry is owned by the core for its own book-keeping.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	struct list_head link;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	 * @pending_link:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	 * Entry on &drm_file.pending_event_list, to keep track of all pending
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	 * events for @file_priv, to allow correct unwinding of them when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	 * userspace closes the file before the event is delivered.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	struct list_head pending_link;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)  * struct drm_file - DRM file private data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)  * This structure tracks DRM state per open file descriptor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) struct drm_file {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	 * @authenticated:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	 * Whether the client is allowed to submit rendering, which for legacy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	 * nodes means it must be authenticated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	 * See also the :ref:`section on primary nodes and authentication
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	 * <drm_primary_node>`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	bool authenticated;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	 * @stereo_allowed:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	 * True when the client has asked us to expose stereo 3D mode flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	bool stereo_allowed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	 * @universal_planes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	 * True if client understands CRTC primary planes and cursor planes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	 * in the plane list. Automatically set when @atomic is set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	bool universal_planes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	/** @atomic: True if client understands atomic properties. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	bool atomic;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	 * @aspect_ratio_allowed:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	 * True, if client can handle picture aspect ratios, and has requested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	 * to pass this information along with the mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	bool aspect_ratio_allowed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	 * @writeback_connectors:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	 * True if client understands writeback connectors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	bool writeback_connectors;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	 * @was_master:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	 * This client has or had, master capability. Protected by struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	 * &drm_device.master_mutex.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	 * This is used to ensure that CAP_SYS_ADMIN is not enforced, if the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	 * client is or was master in the past.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	bool was_master;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	 * @is_master:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	 * This client is the creator of @master. Protected by struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	 * &drm_device.master_mutex.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	 * See also the :ref:`section on primary nodes and authentication
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	 * <drm_primary_node>`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	bool is_master;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	 * @master:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	 * Master this node is currently associated with. Only relevant if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	 * drm_is_primary_client() returns true. Note that this only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	 * matches &drm_device.master if the master is the currently active one.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	 * See also @authentication and @is_master and the :ref:`section on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	 * primary nodes and authentication <drm_primary_node>`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	struct drm_master *master;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	/** @pid: Process that opened this file. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	struct pid *pid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	/** @magic: Authentication magic, see @authenticated. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	drm_magic_t magic;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	 * @lhead:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	 * List of all open files of a DRM device, linked into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	 * &drm_device.filelist. Protected by &drm_device.filelist_mutex.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	struct list_head lhead;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	/** @minor: &struct drm_minor for this file. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	struct drm_minor *minor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	 * @object_idr:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	 * Mapping of mm object handles to object pointers. Used by the GEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	 * subsystem. Protected by @table_lock.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	struct idr object_idr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	/** @table_lock: Protects @object_idr. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	spinlock_t table_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	/** @syncobj_idr: Mapping of sync object handles to object pointers. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	struct idr syncobj_idr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	/** @syncobj_table_lock: Protects @syncobj_idr. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	spinlock_t syncobj_table_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	/** @filp: Pointer to the core file structure. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	struct file *filp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	 * @driver_priv:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	 * Optional pointer for driver private data. Can be allocated in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	 * &drm_driver.open and should be freed in &drm_driver.postclose.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	void *driver_priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	 * @fbs:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	 * List of &struct drm_framebuffer associated with this file, using the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 	 * &drm_framebuffer.filp_head entry.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	 * Protected by @fbs_lock. Note that the @fbs list holds a reference on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	 * the framebuffer object to prevent it from untimely disappearing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	struct list_head fbs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	/** @fbs_lock: Protects @fbs. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	struct mutex fbs_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	 * @blobs:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 	 * User-created blob properties; this retains a reference on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	 * property.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	 * Protected by @drm_mode_config.blob_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 	struct list_head blobs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	/** @event_wait: Waitqueue for new events added to @event_list. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 	wait_queue_head_t event_wait;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 	 * @pending_event_list:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	 * List of pending &struct drm_pending_event, used to clean up pending
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 	 * events in case this file gets closed before the event is signalled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 	 * Uses the &drm_pending_event.pending_link entry.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	 * Protect by &drm_device.event_lock.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 	struct list_head pending_event_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 	 * @event_list:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 	 * List of &struct drm_pending_event, ready for delivery to userspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	 * through drm_read(). Uses the &drm_pending_event.link entry.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 	 * Protect by &drm_device.event_lock.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	struct list_head event_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 	 * @event_space:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	 * Available event space to prevent userspace from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 	 * exhausting kernel memory. Currently limited to the fairly arbitrary
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 	 * value of 4KB.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	int event_space;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	/** @event_read_lock: Serializes drm_read(). */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 	struct mutex event_read_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	 * @prime:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 	 * Per-file buffer caches used by the PRIME buffer sharing code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 	struct drm_prime_file_private prime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	/* private: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) #if IS_ENABLED(CONFIG_DRM_LEGACY)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	unsigned long lock_count; /* DRI1 legacy lock count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)  * drm_is_primary_client - is this an open file of the primary node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357)  * @file_priv: DRM file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)  * Returns true if this is an open file of the primary node, i.e.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)  * &drm_file.minor of @file_priv is a primary minor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)  * See also the :ref:`section on primary nodes and authentication
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)  * <drm_primary_node>`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) static inline bool drm_is_primary_client(const struct drm_file *file_priv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 	return file_priv->minor->type == DRM_MINOR_PRIMARY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)  * drm_is_render_client - is this an open file of the render node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)  * @file_priv: DRM file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)  * Returns true if this is an open file of the render node, i.e.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375)  * &drm_file.minor of @file_priv is a render minor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)  * See also the :ref:`section on render nodes <drm_render_node>`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) static inline bool drm_is_render_client(const struct drm_file *file_priv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 	return file_priv->minor->type == DRM_MINOR_RENDER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) int drm_open(struct inode *inode, struct file *filp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) ssize_t drm_read(struct file *filp, char __user *buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 		 size_t count, loff_t *offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) int drm_release(struct inode *inode, struct file *filp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) int drm_release_noglobal(struct inode *inode, struct file *filp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) __poll_t drm_poll(struct file *filp, struct poll_table_struct *wait);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) int drm_event_reserve_init_locked(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 				  struct drm_file *file_priv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 				  struct drm_pending_event *p,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 				  struct drm_event *e);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) int drm_event_reserve_init(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 			   struct drm_file *file_priv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 			   struct drm_pending_event *p,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 			   struct drm_event *e);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) void drm_event_cancel_free(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 			   struct drm_pending_event *p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) void drm_send_event_locked(struct drm_device *dev, struct drm_pending_event *e);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) void drm_send_event(struct drm_device *dev, struct drm_pending_event *e);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) void drm_send_event_timestamp_locked(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 				     struct drm_pending_event *e,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 				     ktime_t timestamp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) struct file *mock_drm_getfile(struct drm_minor *minor, unsigned int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) #ifdef CONFIG_MMU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) struct drm_vma_offset_manager;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) unsigned long drm_get_unmapped_area(struct file *file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 				    unsigned long uaddr, unsigned long len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 				    unsigned long pgoff, unsigned long flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 				    struct drm_vma_offset_manager *mgr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) #endif /* CONFIG_MMU */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) #endif /* _DRM_FILE_H_ */