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