Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/doc: Document drm_file.[hc]

Well, mostly drm_file.h, and clean up all related things:

- I didnt' figure out the difference between preclose and postclose.
The existing explanation in drm-internals.rst didn't convince me,
since it's also really outdated - we clean up pending DRM events in
the core nowadays. I put a FIXME in for the future.

- Another FIXME is to have a macro for default fops.

- Lots of links all around, main areas are to tie the overview in
drm_file.c more into the callbacks in struct drm_device, and the
other is to link render/primary node code to the right sections in
drm-uapi.rst.

- Also moved the open/close stuff to drm_drv.h from drm-internals.rst,
seems like the better place for that information. Since that section
was rather outdated this amounted to full-on rewrite.

A big missing piece here is some overview graph, but I think better to
wait with that one until drm_device and drm_driver are also fully
documented.

v2: Nits from Sean.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170308141257.12119-12-daniel.vetter@ffwll.ch

+359 -119
+3 -49
Documentation/gpu/drm-internals.rst
··· 243 243 Open/Close, File Operations and IOCTLs 244 244 ====================================== 245 245 246 - Open and Close 247 - -------------- 248 - 249 - Open and close handlers. None of those methods are mandatory:: 250 - 251 - int (*firstopen) (struct drm_device *); 252 - void (*lastclose) (struct drm_device *); 253 - int (*open) (struct drm_device *, struct drm_file *); 254 - void (*preclose) (struct drm_device *, struct drm_file *); 255 - void (*postclose) (struct drm_device *, struct drm_file *); 256 - 257 - The firstopen method is called by the DRM core for legacy UMS (User Mode 258 - Setting) drivers only when an application opens a device that has no 259 - other opened file handle. UMS drivers can implement it to acquire device 260 - resources. KMS drivers can't use the method and must acquire resources 261 - in the load method instead. 262 - 263 - Similarly the lastclose method is called when the last application 264 - holding a file handle opened on the device closes it, for both UMS and 265 - KMS drivers. Additionally, the method is also called at module unload 266 - time or, for hot-pluggable devices, when the device is unplugged. The 267 - firstopen and lastclose calls can thus be unbalanced. 268 - 269 - The open method is called every time the device is opened by an 270 - application. Drivers can allocate per-file private data in this method 271 - and store them in the struct :c:type:`struct drm_file 272 - <drm_file>` driver_priv field. Note that the open method is 273 - called before firstopen. 274 - 275 - The close operation is split into preclose and postclose methods. 276 - Drivers must stop and cleanup all per-file operations in the preclose 277 - method. For instance pending vertical blanking and page flip events must 278 - be cancelled. No per-file operation is allowed on the file handle after 279 - returning from the preclose method. 280 - 281 - Finally the postclose method is called as the last step of the close 282 - operation, right before calling the lastclose method if no other open 283 - file handle exists for the device. Drivers that have allocated per-file 284 - private data in the open method should free it here. 285 - 286 - The lastclose method should restore CRTC and plane properties to default 287 - value, so that a subsequent open of the device will not inherit state 288 - from the previous user. It can also be used to execute delayed power 289 - switching state changes, e.g. in conjunction with the :ref:`vga_switcheroo` 290 - infrastructure. Beyond that KMS drivers should not do any 291 - further cleanup. Only legacy UMS drivers might need to clean up device 292 - state so that the vga console or an independent fbdev driver could take 293 - over. 294 - 295 246 File Operations 296 247 --------------- 297 248 298 249 .. kernel-doc:: drivers/gpu/drm/drm_file.c 299 250 :doc: file operations 251 + 252 + .. kernel-doc:: include/drm/drm_file.h 253 + :internal: 300 254 301 255 .. kernel-doc:: drivers/gpu/drm/drm_file.c 302 256 :export:
+4
Documentation/gpu/drm-uapi.rst
··· 21 21 :doc: getunique and setversion story 22 22 23 23 24 + .. _drm_primary_node: 25 + 24 26 Primary Nodes, DRM Master and Authentication 25 27 ============================================ 26 28 ··· 104 102 is already rather painful for the DRM subsystem, with multiple different uAPIs 105 103 for the same thing co-existing. If we add a few more complete mistakes into the 106 104 mix every year it would be entirely unmanageable. 105 + 106 + .. _drm_render_node: 107 107 108 108 Render nodes 109 109 ============
+32 -34
drivers/gpu/drm/drm_file.c
··· 50 50 * 51 51 * Drivers must define the file operations structure that forms the DRM 52 52 * userspace API entry point, even though most of those operations are 53 - * implemented in the DRM core. The mandatory functions are drm_open(), 53 + * implemented in the DRM core. The resulting &struct file_operations must be 54 + * stored in the &drm_driver.fops field. The mandatory functions are drm_open(), 54 55 * drm_read(), drm_ioctl() and drm_compat_ioctl() if CONFIG_COMPAT is enabled 55 - * (note that drm_compat_ioctl will be NULL if CONFIG_COMPAT=n). Drivers which 56 - * implement private ioctls that require 32/64 bit compatibility support must 57 - * provide their own .compat_ioctl() handler that processes private ioctls and 58 - * calls drm_compat_ioctl() for core ioctls. 56 + * Note that drm_compat_ioctl will be NULL if CONFIG_COMPAT=n, so there's no 57 + * need to sprinkle #ifdef into the code. Drivers which implement private ioctls 58 + * that require 32/64 bit compatibility support must provide their own 59 + * &file_operations.compat_ioctl handler that processes private ioctls and calls 60 + * drm_compat_ioctl() for core ioctls. 59 61 * 60 62 * In addition drm_read() and drm_poll() provide support for DRM events. DRM 61 63 * events are a generic and extensible means to send asynchronous events to ··· 65 63 * page flip completions by the KMS API. But drivers can also use it for their 66 64 * own needs, e.g. to signal completion of rendering. 67 65 * 66 + * For the driver-side event interface see drm_event_reserve_init() and 67 + * drm_send_event() as the main starting points. 68 + * 68 69 * The memory mapping implementation will vary depending on how the driver 69 70 * manages memory. Legacy drivers will use the deprecated drm_legacy_mmap() 70 71 * function, modern drivers should use one of the provided memory-manager 71 - * specific implementations. For GEM-based drivers this is drm_gem_mmap(). 72 + * specific implementations. For GEM-based drivers this is drm_gem_mmap(), and 73 + * for drivers which use the CMA GEM helpers it's drm_gem_cma_mmap(). 72 74 * 73 75 * No other file operations are supported by the DRM userspace API. Overall the 74 76 * following is an example #file_operations structure:: ··· 88 82 * .llseek = no_llseek, 89 83 * .mmap = drm_gem_mmap, 90 84 * }; 85 + * 86 + * FIXME: We should have a macro for this (and the CMA version) so that drivers 87 + * don't have to repeat it all the time. 91 88 */ 92 89 93 90 static int drm_open_helper(struct file *filp, struct drm_minor *minor); ··· 120 111 * @inode: device inode 121 112 * @filp: file pointer. 122 113 * 123 - * This function must be used by drivers as their .open() #file_operations 124 - * method. It looks up the correct DRM device and instantiates all the per-file 125 - * resources for it. 114 + * This function must be used by drivers as their &file_operations.open method. 115 + * It looks up the correct DRM device and instantiates all the per-file 116 + * resources for it. It also calls the &drm_driver.open driver callback. 126 117 * 127 118 * RETURNS: 128 119 * ··· 307 298 spin_unlock_irqrestore(&dev->event_lock, flags); 308 299 } 309 300 310 - /* 311 - * drm_legacy_dev_reinit 312 - * 313 - * Reinitializes a legacy/ums drm device in it's lastclose function. 314 - */ 315 301 static void drm_legacy_dev_reinit(struct drm_device *dev) 316 302 { 317 303 if (dev->irq_enabled) ··· 331 327 DRM_DEBUG("lastclose completed\n"); 332 328 } 333 329 334 - /* 335 - * Take down the DRM device. 336 - * 337 - * \param dev DRM device structure. 338 - * 339 - * Frees every resource in \p dev. 340 - * 341 - * \sa drm_device 342 - */ 343 330 void drm_lastclose(struct drm_device * dev) 344 331 { 345 332 DRM_DEBUG("\n"); ··· 348 353 * @inode: device inode 349 354 * @filp: file pointer. 350 355 * 351 - * This function must be used by drivers as their .release() #file_operations 352 - * method. It frees any resources associated with the open file, and if this is 353 - * the last open file for the DRM device also proceeds to call drm_lastclose(). 356 + * This function must be used by drivers as their &file_operations.release 357 + * method. It frees any resources associated with the open file, and calls the 358 + * &drm_driver.preclose and &drm_driver.lastclose driver callbacks. If this is 359 + * the last open file for the DRM device also proceeds to call the 360 + * &drm_driver.lastclose driver callback. 354 361 * 355 362 * RETURNS: 356 363 * ··· 440 443 * @count: count in bytes to read 441 444 * @offset: offset to read 442 445 * 443 - * This function must be used by drivers as their .read() #file_operations 446 + * This function must be used by drivers as their &file_operations.read 444 447 * method iff they use DRM events for asynchronous signalling to userspace. 445 448 * Since events are used by the KMS API for vblank and page flip completion this 446 449 * means all modern display drivers must use it. 447 450 * 448 - * @offset is ignore, DRM events are read like a pipe. Therefore drivers also 449 - * must set the .llseek() #file_operation to no_llseek(). Polling support is 451 + * @offset is ignored, DRM events are read like a pipe. Therefore drivers also 452 + * must set the &file_operation.llseek to no_llseek(). Polling support is 450 453 * provided by drm_poll(). 451 454 * 452 455 * This function will only ever read a full event. Therefore userspace must ··· 534 537 * @filp: file pointer 535 538 * @wait: poll waiter table 536 539 * 537 - * This function must be used by drivers as their .read() #file_operations 538 - * method iff they use DRM events for asynchronous signalling to userspace. 539 - * Since events are used by the KMS API for vblank and page flip completion this 540 - * means all modern display drivers must use it. 540 + * This function must be used by drivers as their &file_operations.read method 541 + * iff they use DRM events for asynchronous signalling to userspace. Since 542 + * events are used by the KMS API for vblank and page flip completion this means 543 + * all modern display drivers must use it. 541 544 * 542 545 * See also drm_read(). 543 546 * ··· 647 650 * @p: tracking structure for the pending event 648 651 * 649 652 * This function frees the event @p initialized with drm_event_reserve_init() 650 - * and releases any allocated space. 653 + * and releases any allocated space. It is used to cancel an event when the 654 + * nonblocking operation could not be submitted and needed to be aborted. 651 655 */ 652 656 void drm_event_cancel_free(struct drm_device *dev, 653 657 struct drm_pending_event *p)
+80 -1
include/drm/drm_drv.h
··· 64 64 * structure for GEM drivers. 65 65 */ 66 66 struct drm_driver { 67 - 68 67 /** 69 68 * @load: 70 69 * ··· 75 76 * See drm_dev_init() and drm_dev_register() for proper and 76 77 * race-free way to set up a &struct drm_device. 77 78 * 79 + * This is deprecated, do not use! 80 + * 78 81 * Returns: 79 82 * 80 83 * Zero on success, non-zero value on failure. 81 84 */ 82 85 int (*load) (struct drm_device *, unsigned long flags); 86 + 87 + /** 88 + * @open: 89 + * 90 + * Driver callback when a new &struct drm_file is opened. Useful for 91 + * setting up driver-private data structures like buffer allocators, 92 + * execution contexts or similar things. Such driver-private resources 93 + * must be released again in @postclose. 94 + * 95 + * Since the display/modeset side of DRM can only be owned by exactly 96 + * one &struct drm_file (see &drm_file.is_master and &drm_device.master) 97 + * there should never be a need to set up any modeset related resources 98 + * in this callback. Doing so would be a driver design bug. 99 + * 100 + * Returns: 101 + * 102 + * 0 on success, a negative error code on failure, which will be 103 + * promoted to userspace as the result of the open() system call. 104 + */ 83 105 int (*open) (struct drm_device *, struct drm_file *); 106 + 107 + /** 108 + * @preclose: 109 + * 110 + * One of the driver callbacks when a new &struct drm_file is closed. 111 + * Useful for tearing down driver-private data structures allocated in 112 + * @open like buffer allocators, execution contexts or similar things. 113 + * 114 + * Since the display/modeset side of DRM can only be owned by exactly 115 + * one &struct drm_file (see &drm_file.is_master and &drm_device.master) 116 + * there should never be a need to tear down any modeset related 117 + * resources in this callback. Doing so would be a driver design bug. 118 + * 119 + * FIXME: It is not really clear why there's both @preclose and 120 + * @postclose. Without a really good reason, use @postclose only. 121 + */ 84 122 void (*preclose) (struct drm_device *, struct drm_file *file_priv); 123 + 124 + /** 125 + * @postclose: 126 + * 127 + * One of the driver callbacks when a new &struct drm_file is closed. 128 + * Useful for tearing down driver-private data structures allocated in 129 + * @open like buffer allocators, execution contexts or similar things. 130 + * 131 + * Since the display/modeset side of DRM can only be owned by exactly 132 + * one &struct drm_file (see &drm_file.is_master and &drm_device.master) 133 + * there should never be a need to tear down any modeset related 134 + * resources in this callback. Doing so would be a driver design bug. 135 + * 136 + * FIXME: It is not really clear why there's both @preclose and 137 + * @postclose. Without a really good reason, use @postclose only. 138 + */ 85 139 void (*postclose) (struct drm_device *, struct drm_file *); 140 + 141 + /** 142 + * @lastclose: 143 + * 144 + * Called when the last &struct drm_file has been closed and there's 145 + * currently no userspace client for the &struct drm_device. 146 + * 147 + * Modern drivers should only use this to force-restore the fbdev 148 + * framebuffer using drm_fb_helper_restore_fbdev_mode_unlocked(). 149 + * Anything else would indicate there's something seriously wrong. 150 + * Modern drivers can also use this to execute delayed power switching 151 + * state changes, e.g. in conjunction with the :ref:`vga_switcheroo` 152 + * infrastructure. 153 + * 154 + * This is called after @preclose and @postclose have been called. 155 + * 156 + * NOTE: 157 + * 158 + * All legacy drivers use this callback to de-initialize the hardware. 159 + * This is purely because of the shadow-attach model, where the DRM 160 + * kernel driver does not really own the hardware. Instead ownershipe is 161 + * handled with the help of userspace through an inheritedly racy dance 162 + * to set/unset the VT into raw mode. 163 + * 164 + * Legacy drivers initialize the hardware in the @firstopen callback, 165 + * which isn't even called for modern drivers. 166 + */ 86 167 void (*lastclose) (struct drm_device *); 87 168 88 169 /**
+240 -35
include/drm/drm_file.h
··· 45 45 * FIXME: Not sure we want to have drm_minor here in the end, but to avoid 46 46 * header include loops we need it here for now. 47 47 */ 48 + 48 49 enum drm_minor_type { 49 50 DRM_MINOR_PRIMARY, 50 51 DRM_MINOR_CONTROL, ··· 53 52 }; 54 53 55 54 /** 56 - * DRM minor structure. This structure represents a drm minor number. 55 + * struct drm_minor - DRM device minor structure 56 + * 57 + * This structure represents a DRM minor number for device nodes in /dev. 58 + * Entirely opaque to drivers and should never be inspected directly by drivers. 59 + * Drivers instead should only interact with &struct drm_file and of course 60 + * &struct drm_device, which is also where driver-private data and resources can 61 + * be attached to. 57 62 */ 58 63 struct drm_minor { 59 - int index; /**< Minor device number */ 60 - int type; /**< Control or render */ 61 - struct device *kdev; /**< Linux device */ 64 + /* private: */ 65 + int index; /* Minor device number */ 66 + int type; /* Control or render */ 67 + struct device *kdev; /* Linux device */ 62 68 struct drm_device *dev; 63 69 64 70 struct dentry *debugfs_root; ··· 74 66 struct mutex debugfs_lock; /* Protects debugfs_list. */ 75 67 }; 76 68 77 - /* Event queued up for userspace to read */ 69 + /** 70 + * struct drm_pending_event - Event queued up for userspace to read 71 + * 72 + * This represents a DRM event. Drivers can use this as a generic completion 73 + * mechanism, which supports kernel-internal &struct completion, &struct dma_fence 74 + * and also the DRM-specific &struct drm_event delivery mechanism. 75 + */ 78 76 struct drm_pending_event { 77 + /** 78 + * @completion: 79 + * 80 + * Optional pointer to a kernel internal completion signalled when 81 + * drm_send_event() is called, useful to internally synchronize with 82 + * nonblocking operations. 83 + */ 79 84 struct completion *completion; 85 + 86 + /** 87 + * @completion_release: 88 + * 89 + * Optional callback currently only used by the atomic modeset helpers 90 + * to clean up the reference count for the structure @completion is 91 + * stored in. 92 + */ 80 93 void (*completion_release)(struct completion *completion); 94 + 95 + /** 96 + * @event: 97 + * 98 + * Pointer to the actual event that should be sent to userspace to be 99 + * read using drm_read(). Can be optional, since nowadays events are 100 + * also used to signal kernel internal threads with @completion or DMA 101 + * transactions using @fence. 102 + */ 81 103 struct drm_event *event; 104 + 105 + /** 106 + * @fence: 107 + * 108 + * Optional DMA fence to unblock other hardware transactions which 109 + * depend upon the nonblocking DRM operation this event represents. 110 + */ 82 111 struct dma_fence *fence; 83 - struct list_head link; 84 - struct list_head pending_link; 112 + 113 + /** 114 + * @file_priv: 115 + * 116 + * &struct drm_file where @event should be delivered to. Only set when 117 + * @event is set. 118 + */ 85 119 struct drm_file *file_priv; 120 + 121 + /** 122 + * @link: 123 + * 124 + * Double-linked list to keep track of this event. Can be used by the 125 + * driver up to the point when it calls drm_send_event(), after that 126 + * this list entry is owned by the core for its own book-keeping. 127 + */ 128 + struct list_head link; 129 + 130 + /** 131 + * @pending_link: 132 + * 133 + * Entry on &drm_file.pending_event_list, to keep track of all pending 134 + * events for @file_priv, to allow correct unwinding of them when 135 + * userspace closes the file before the event is delivered. 136 + */ 137 + struct list_head pending_link; 86 138 }; 87 139 88 - /** File private data */ 140 + /** 141 + * struct drm_file - DRM file private data 142 + * 143 + * This structure tracks DRM state per open file descriptor. 144 + */ 89 145 struct drm_file { 146 + /** 147 + * @authenticated: 148 + * 149 + * Whether the client is allowed to submit rendering, which for legacy 150 + * nodes means it must be authenticated. 151 + * 152 + * See also the :ref:`section on primary nodes and authentication 153 + * <drm_primary_node>`. 154 + */ 90 155 unsigned authenticated :1; 91 - /* true when the client has asked us to expose stereo 3D mode flags */ 156 + 157 + /** 158 + * @stereo_allowed: 159 + * 160 + * True when the client has asked us to expose stereo 3D mode flags. 161 + */ 92 162 unsigned stereo_allowed :1; 93 - /* 94 - * true if client understands CRTC primary planes and cursor planes 95 - * in the plane list 163 + 164 + /** 165 + * @universal_planes: 166 + * 167 + * True if client understands CRTC primary planes and cursor planes 168 + * in the plane list. Automatically set when @atomic is set. 96 169 */ 97 170 unsigned universal_planes:1; 98 - /* true if client understands atomic properties */ 171 + 172 + /** @atomic: True if client understands atomic properties. */ 99 173 unsigned atomic:1; 100 - /* 101 - * This client is the creator of @master. 102 - * Protected by struct drm_device::master_mutex. 174 + 175 + /** 176 + * @is_master: 177 + * 178 + * This client is the creator of @master. Protected by struct 179 + * &drm_device.master_mutex. 180 + * 181 + * See also the :ref:`section on primary nodes and authentication 182 + * <drm_primary_node>`. 103 183 */ 104 184 unsigned is_master:1; 105 185 106 - struct pid *pid; 107 - drm_magic_t magic; 108 - struct list_head lhead; 109 - struct drm_minor *minor; 110 - unsigned long lock_count; 186 + /** 187 + * @master: 188 + * 189 + * Master this node is currently associated with. Only relevant if 190 + * drm_is_primary_client() returns true. Note that this only 191 + * matches &drm_device.master if the master is the currently active one. 192 + * 193 + * See also @authentication and @is_master and the :ref:`section on 194 + * primary nodes and authentication <drm_primary_node>`. 195 + */ 196 + struct drm_master *master; 111 197 112 - /** Mapping of mm object handles to object pointers. */ 198 + /** @pid: Process that opened this file. */ 199 + struct pid *pid; 200 + 201 + /** @magic: Authentication magic, see @authenticated. */ 202 + drm_magic_t magic; 203 + 204 + /** 205 + * @lhead: 206 + * 207 + * List of all open files of a DRM device, linked into 208 + * &drm_device.filelist. Protected by &drm_device.filelist_mutex. 209 + */ 210 + struct list_head lhead; 211 + 212 + /** @minor: &struct drm_minor for this file. */ 213 + struct drm_minor *minor; 214 + 215 + /** 216 + * @object_idr: 217 + * 218 + * Mapping of mm object handles to object pointers. Used by the GEM 219 + * subsystem. Protected by @table_lock. 220 + */ 113 221 struct idr object_idr; 114 - /** Lock for synchronization of access to object_idr. */ 222 + 223 + /** @table_lock: Protects @object_idr. */ 115 224 spinlock_t table_lock; 116 225 226 + /** @filp: Pointer to the core file structure. */ 117 227 struct file *filp; 228 + 229 + /** 230 + * @driver_priv: 231 + * 232 + * Optional pointer for driver private data. Can be allocated in 233 + * &drm_driver.open and should be freed in &drm_driver.postclose. 234 + */ 118 235 void *driver_priv; 119 236 120 - struct drm_master *master; /* master this node is currently associated with 121 - N.B. not always dev->master */ 122 237 /** 123 - * fbs - List of framebuffers associated with this file. 238 + * @fbs: 124 239 * 125 - * Protected by fbs_lock. Note that the fbs list holds a reference on 126 - * the fb object to prevent it from untimely disappearing. 240 + * List of &struct drm_framebuffer associated with this file, using the 241 + * &drm_framebuffer.filp_head entry. 242 + * 243 + * Protected by @fbs_lock. Note that the @fbs list holds a reference on 244 + * the framebuffer object to prevent it from untimely disappearing. 127 245 */ 128 246 struct list_head fbs; 247 + 248 + /** @fbs_lock: Protects @fbs. */ 129 249 struct mutex fbs_lock; 130 250 131 - /** User-created blob properties; this retains a reference on the 132 - * property. */ 251 + /** 252 + * @blobs: 253 + * 254 + * User-created blob properties; this retains a reference on the 255 + * property. 256 + * 257 + * Protected by @drm_mode_config.blob_lock; 258 + */ 133 259 struct list_head blobs; 134 260 261 + /** @event_wait: Waitqueue for new events added to @event_list. */ 135 262 wait_queue_head_t event_wait; 263 + 264 + /** 265 + * @pending_event_list: 266 + * 267 + * List of pending &struct drm_pending_event, used to clean up pending 268 + * events in case this file gets closed before the event is signalled. 269 + * Uses the &drm_pending_event.pending_link entry. 270 + * 271 + * Protect by &drm_device.event_lock. 272 + */ 136 273 struct list_head pending_event_list; 274 + 275 + /** 276 + * @event_list: 277 + * 278 + * List of &struct drm_pending_event, ready for delivery to userspace 279 + * through drm_read(). Uses the &drm_pending_event.link entry. 280 + * 281 + * Protect by &drm_device.event_lock. 282 + */ 137 283 struct list_head event_list; 284 + 285 + /** 286 + * @event_space: 287 + * 288 + * Available event space to prevent userspace from 289 + * exhausting kernel memory. Currently limited to the fairly arbitrary 290 + * value of 4KB. 291 + */ 138 292 int event_space; 139 293 294 + /** @event_read_lock: Serializes drm_read(). */ 140 295 struct mutex event_read_lock; 141 296 297 + /** 298 + * @prime: 299 + * 300 + * Per-file buffer caches used by the PRIME buffer sharing code. 301 + */ 142 302 struct drm_prime_file_private prime; 303 + 304 + /* private: */ 305 + unsigned long lock_count; /* DRI1 legacy lock count */ 143 306 }; 144 307 308 + /** 309 + * drm_is_primary_client - is this an open file of the primary node 310 + * @file_priv: DRM file 311 + * 312 + * Returns true if this is an open file of the primary node, i.e. 313 + * &drm_file.minor of @file_priv is a primary minor. 314 + * 315 + * See also the :ref:`section on primary nodes and authentication 316 + * <drm_primary_node>`. 317 + */ 318 + static inline bool drm_is_primary_client(const struct drm_file *file_priv) 319 + { 320 + return file_priv->minor->type == DRM_MINOR_PRIMARY; 321 + } 322 + 323 + /** 324 + * drm_is_render_client - is this an open file of the render node 325 + * @file_priv: DRM file 326 + * 327 + * Returns true if this is an open file of the render node, i.e. 328 + * &drm_file.minor of @file_priv is a render minor. 329 + * 330 + * See also the :ref:`section on render nodes <drm_render_node>`. 331 + */ 145 332 static inline bool drm_is_render_client(const struct drm_file *file_priv) 146 333 { 147 334 return file_priv->minor->type == DRM_MINOR_RENDER; 148 335 } 149 336 337 + /** 338 + * drm_is_control_client - is this an open file of the control node 339 + * @file_priv: DRM file 340 + * 341 + * Control nodes are deprecated and in the process of getting removed from the 342 + * DRM userspace API. Do not ever use! 343 + */ 150 344 static inline bool drm_is_control_client(const struct drm_file *file_priv) 151 345 { 152 346 return file_priv->minor->type == DRM_MINOR_CONTROL; 153 - } 154 - 155 - static inline bool drm_is_primary_client(const struct drm_file *file_priv) 156 - { 157 - return file_priv->minor->type == DRM_MINOR_PRIMARY; 158 347 } 159 348 160 349 int drm_open(struct inode *inode, struct file *filp);