xref: /openbmc/linux/include/drm/drm_file.h (revision afc9a42b)
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>
35a8f8b1d9SDaniel Vetter 
36a8f8b1d9SDaniel Vetter #include <uapi/drm/drm.h>
37a8f8b1d9SDaniel Vetter 
38a8f8b1d9SDaniel Vetter #include <drm/drm_prime.h>
39a8f8b1d9SDaniel Vetter 
40a8f8b1d9SDaniel Vetter struct dma_fence;
41a8f8b1d9SDaniel Vetter struct drm_file;
42a8f8b1d9SDaniel Vetter struct drm_device;
433ed4351aSDaniel Vetter struct device;
44a8f8b1d9SDaniel Vetter 
45a8f8b1d9SDaniel Vetter /*
46a8f8b1d9SDaniel Vetter  * FIXME: Not sure we want to have drm_minor here in the end, but to avoid
47a8f8b1d9SDaniel Vetter  * header include loops we need it here for now.
48a8f8b1d9SDaniel Vetter  */
49b93658f8SDaniel Vetter 
50a8f8b1d9SDaniel Vetter enum drm_minor_type {
51a8f8b1d9SDaniel Vetter 	DRM_MINOR_PRIMARY,
52a8f8b1d9SDaniel Vetter 	DRM_MINOR_CONTROL,
53a8f8b1d9SDaniel Vetter 	DRM_MINOR_RENDER,
54a8f8b1d9SDaniel Vetter };
55a8f8b1d9SDaniel Vetter 
56a8f8b1d9SDaniel Vetter /**
57b93658f8SDaniel Vetter  * struct drm_minor - DRM device minor structure
58b93658f8SDaniel Vetter  *
59b93658f8SDaniel Vetter  * This structure represents a DRM minor number for device nodes in /dev.
60b93658f8SDaniel Vetter  * Entirely opaque to drivers and should never be inspected directly by drivers.
61b93658f8SDaniel Vetter  * Drivers instead should only interact with &struct drm_file and of course
62b93658f8SDaniel Vetter  * &struct drm_device, which is also where driver-private data and resources can
63b93658f8SDaniel Vetter  * be attached to.
64a8f8b1d9SDaniel Vetter  */
65a8f8b1d9SDaniel Vetter struct drm_minor {
66b93658f8SDaniel Vetter 	/* private: */
67b93658f8SDaniel Vetter 	int index;			/* Minor device number */
68b93658f8SDaniel Vetter 	int type;                       /* Control or render */
69b93658f8SDaniel Vetter 	struct device *kdev;		/* Linux device */
70a8f8b1d9SDaniel Vetter 	struct drm_device *dev;
71a8f8b1d9SDaniel Vetter 
72a8f8b1d9SDaniel Vetter 	struct dentry *debugfs_root;
73a8f8b1d9SDaniel Vetter 
74a8f8b1d9SDaniel Vetter 	struct list_head debugfs_list;
75a8f8b1d9SDaniel Vetter 	struct mutex debugfs_lock; /* Protects debugfs_list. */
76a8f8b1d9SDaniel Vetter };
77a8f8b1d9SDaniel Vetter 
78b93658f8SDaniel Vetter /**
79b93658f8SDaniel Vetter  * struct drm_pending_event - Event queued up for userspace to read
80b93658f8SDaniel Vetter  *
81b93658f8SDaniel Vetter  * This represents a DRM event. Drivers can use this as a generic completion
82b93658f8SDaniel Vetter  * mechanism, which supports kernel-internal &struct completion, &struct dma_fence
83b93658f8SDaniel Vetter  * and also the DRM-specific &struct drm_event delivery mechanism.
84b93658f8SDaniel Vetter  */
85a8f8b1d9SDaniel Vetter struct drm_pending_event {
86b93658f8SDaniel Vetter 	/**
87b93658f8SDaniel Vetter 	 * @completion:
88b93658f8SDaniel Vetter 	 *
89b93658f8SDaniel Vetter 	 * Optional pointer to a kernel internal completion signalled when
90b93658f8SDaniel Vetter 	 * drm_send_event() is called, useful to internally synchronize with
91b93658f8SDaniel Vetter 	 * nonblocking operations.
92b93658f8SDaniel Vetter 	 */
93a8f8b1d9SDaniel Vetter 	struct completion *completion;
94b93658f8SDaniel Vetter 
95b93658f8SDaniel Vetter 	/**
96b93658f8SDaniel Vetter 	 * @completion_release:
97b93658f8SDaniel Vetter 	 *
98b93658f8SDaniel Vetter 	 * Optional callback currently only used by the atomic modeset helpers
99b93658f8SDaniel Vetter 	 * to clean up the reference count for the structure @completion is
100b93658f8SDaniel Vetter 	 * stored in.
101b93658f8SDaniel Vetter 	 */
102a8f8b1d9SDaniel Vetter 	void (*completion_release)(struct completion *completion);
103b93658f8SDaniel Vetter 
104b93658f8SDaniel Vetter 	/**
105b93658f8SDaniel Vetter 	 * @event:
106b93658f8SDaniel Vetter 	 *
107b93658f8SDaniel Vetter 	 * Pointer to the actual event that should be sent to userspace to be
108b93658f8SDaniel Vetter 	 * read using drm_read(). Can be optional, since nowadays events are
109b93658f8SDaniel Vetter 	 * also used to signal kernel internal threads with @completion or DMA
110b93658f8SDaniel Vetter 	 * transactions using @fence.
111b93658f8SDaniel Vetter 	 */
112a8f8b1d9SDaniel Vetter 	struct drm_event *event;
113b93658f8SDaniel Vetter 
114b93658f8SDaniel Vetter 	/**
115b93658f8SDaniel Vetter 	 * @fence:
116b93658f8SDaniel Vetter 	 *
117b93658f8SDaniel Vetter 	 * Optional DMA fence to unblock other hardware transactions which
118b93658f8SDaniel Vetter 	 * depend upon the nonblocking DRM operation this event represents.
119b93658f8SDaniel Vetter 	 */
120a8f8b1d9SDaniel Vetter 	struct dma_fence *fence;
121b93658f8SDaniel Vetter 
122b93658f8SDaniel Vetter 	/**
123b93658f8SDaniel Vetter 	 * @file_priv:
124b93658f8SDaniel Vetter 	 *
125b93658f8SDaniel Vetter 	 * &struct drm_file where @event should be delivered to. Only set when
126b93658f8SDaniel Vetter 	 * @event is set.
127b93658f8SDaniel Vetter 	 */
128a8f8b1d9SDaniel Vetter 	struct drm_file *file_priv;
129b93658f8SDaniel Vetter 
130b93658f8SDaniel Vetter 	/**
131b93658f8SDaniel Vetter 	 * @link:
132b93658f8SDaniel Vetter 	 *
133b93658f8SDaniel Vetter 	 * Double-linked list to keep track of this event. Can be used by the
134b93658f8SDaniel Vetter 	 * driver up to the point when it calls drm_send_event(), after that
135b93658f8SDaniel Vetter 	 * this list entry is owned by the core for its own book-keeping.
136b93658f8SDaniel Vetter 	 */
137b93658f8SDaniel Vetter 	struct list_head link;
138b93658f8SDaniel Vetter 
139b93658f8SDaniel Vetter 	/**
140b93658f8SDaniel Vetter 	 * @pending_link:
141b93658f8SDaniel Vetter 	 *
142b93658f8SDaniel Vetter 	 * Entry on &drm_file.pending_event_list, to keep track of all pending
143b93658f8SDaniel Vetter 	 * events for @file_priv, to allow correct unwinding of them when
144b93658f8SDaniel Vetter 	 * userspace closes the file before the event is delivered.
145b93658f8SDaniel Vetter 	 */
146b93658f8SDaniel Vetter 	struct list_head pending_link;
147a8f8b1d9SDaniel Vetter };
148a8f8b1d9SDaniel Vetter 
149b93658f8SDaniel Vetter /**
150b93658f8SDaniel Vetter  * struct drm_file - DRM file private data
151b93658f8SDaniel Vetter  *
152b93658f8SDaniel Vetter  * This structure tracks DRM state per open file descriptor.
153b93658f8SDaniel Vetter  */
154a8f8b1d9SDaniel Vetter struct drm_file {
155b93658f8SDaniel Vetter 	/**
156b93658f8SDaniel Vetter 	 * @authenticated:
157b93658f8SDaniel Vetter 	 *
158b93658f8SDaniel Vetter 	 * Whether the client is allowed to submit rendering, which for legacy
159b93658f8SDaniel Vetter 	 * nodes means it must be authenticated.
160b93658f8SDaniel Vetter 	 *
161b93658f8SDaniel Vetter 	 * See also the :ref:`section on primary nodes and authentication
162b93658f8SDaniel Vetter 	 * <drm_primary_node>`.
163b93658f8SDaniel Vetter 	 */
164a8f8b1d9SDaniel Vetter 	unsigned authenticated :1;
165b93658f8SDaniel Vetter 
166b93658f8SDaniel Vetter 	/**
167b93658f8SDaniel Vetter 	 * @stereo_allowed:
168b93658f8SDaniel Vetter 	 *
169b93658f8SDaniel Vetter 	 * True when the client has asked us to expose stereo 3D mode flags.
170b93658f8SDaniel Vetter 	 */
171a8f8b1d9SDaniel Vetter 	unsigned stereo_allowed :1;
172b93658f8SDaniel Vetter 
173b93658f8SDaniel Vetter 	/**
174b93658f8SDaniel Vetter 	 * @universal_planes:
175b93658f8SDaniel Vetter 	 *
176b93658f8SDaniel Vetter 	 * True if client understands CRTC primary planes and cursor planes
177b93658f8SDaniel Vetter 	 * in the plane list. Automatically set when @atomic is set.
178a8f8b1d9SDaniel Vetter 	 */
179a8f8b1d9SDaniel Vetter 	unsigned universal_planes:1;
180b93658f8SDaniel Vetter 
181b93658f8SDaniel Vetter 	/** @atomic: True if client understands atomic properties. */
182a8f8b1d9SDaniel Vetter 	unsigned atomic:1;
183b93658f8SDaniel Vetter 
184b93658f8SDaniel Vetter 	/**
185b93658f8SDaniel Vetter 	 * @is_master:
186b93658f8SDaniel Vetter 	 *
187b93658f8SDaniel Vetter 	 * This client is the creator of @master. Protected by struct
188b93658f8SDaniel Vetter 	 * &drm_device.master_mutex.
189b93658f8SDaniel Vetter 	 *
190b93658f8SDaniel Vetter 	 * See also the :ref:`section on primary nodes and authentication
191b93658f8SDaniel Vetter 	 * <drm_primary_node>`.
192a8f8b1d9SDaniel Vetter 	 */
193a8f8b1d9SDaniel Vetter 	unsigned is_master:1;
194a8f8b1d9SDaniel Vetter 
195b93658f8SDaniel Vetter 	/**
196b93658f8SDaniel Vetter 	 * @master:
197b93658f8SDaniel Vetter 	 *
198b93658f8SDaniel Vetter 	 * Master this node is currently associated with. Only relevant if
199b93658f8SDaniel Vetter 	 * drm_is_primary_client() returns true. Note that this only
200b93658f8SDaniel Vetter 	 * matches &drm_device.master if the master is the currently active one.
201b93658f8SDaniel Vetter 	 *
202b93658f8SDaniel Vetter 	 * See also @authentication and @is_master and the :ref:`section on
203b93658f8SDaniel Vetter 	 * primary nodes and authentication <drm_primary_node>`.
204b93658f8SDaniel Vetter 	 */
205b93658f8SDaniel Vetter 	struct drm_master *master;
206a8f8b1d9SDaniel Vetter 
207b93658f8SDaniel Vetter 	/** @pid: Process that opened this file. */
208b93658f8SDaniel Vetter 	struct pid *pid;
209b93658f8SDaniel Vetter 
210b93658f8SDaniel Vetter 	/** @magic: Authentication magic, see @authenticated. */
211b93658f8SDaniel Vetter 	drm_magic_t magic;
212b93658f8SDaniel Vetter 
213b93658f8SDaniel Vetter 	/**
214b93658f8SDaniel Vetter 	 * @lhead:
215b93658f8SDaniel Vetter 	 *
216b93658f8SDaniel Vetter 	 * List of all open files of a DRM device, linked into
217b93658f8SDaniel Vetter 	 * &drm_device.filelist. Protected by &drm_device.filelist_mutex.
218b93658f8SDaniel Vetter 	 */
219b93658f8SDaniel Vetter 	struct list_head lhead;
220b93658f8SDaniel Vetter 
221b93658f8SDaniel Vetter 	/** @minor: &struct drm_minor for this file. */
222b93658f8SDaniel Vetter 	struct drm_minor *minor;
223b93658f8SDaniel Vetter 
224b93658f8SDaniel Vetter 	/**
225b93658f8SDaniel Vetter 	 * @object_idr:
226b93658f8SDaniel Vetter 	 *
227b93658f8SDaniel Vetter 	 * Mapping of mm object handles to object pointers. Used by the GEM
228b93658f8SDaniel Vetter 	 * subsystem. Protected by @table_lock.
229b93658f8SDaniel Vetter 	 */
230a8f8b1d9SDaniel Vetter 	struct idr object_idr;
231b93658f8SDaniel Vetter 
232b93658f8SDaniel Vetter 	/** @table_lock: Protects @object_idr. */
233a8f8b1d9SDaniel Vetter 	spinlock_t table_lock;
234a8f8b1d9SDaniel Vetter 
235e9083420SDave Airlie 	/** @syncobj_idr: Mapping of sync object handles to object pointers. */
236e9083420SDave Airlie 	struct idr syncobj_idr;
237e9083420SDave Airlie 	/** @syncobj_table_lock: Protects @syncobj_idr. */
238e9083420SDave Airlie 	spinlock_t syncobj_table_lock;
239e9083420SDave Airlie 
240b93658f8SDaniel Vetter 	/** @filp: Pointer to the core file structure. */
241a8f8b1d9SDaniel Vetter 	struct file *filp;
242b93658f8SDaniel Vetter 
243b93658f8SDaniel Vetter 	/**
244b93658f8SDaniel Vetter 	 * @driver_priv:
245b93658f8SDaniel Vetter 	 *
246b93658f8SDaniel Vetter 	 * Optional pointer for driver private data. Can be allocated in
247b93658f8SDaniel Vetter 	 * &drm_driver.open and should be freed in &drm_driver.postclose.
248b93658f8SDaniel Vetter 	 */
249a8f8b1d9SDaniel Vetter 	void *driver_priv;
250a8f8b1d9SDaniel Vetter 
251a8f8b1d9SDaniel Vetter 	/**
252b93658f8SDaniel Vetter 	 * @fbs:
253a8f8b1d9SDaniel Vetter 	 *
254b93658f8SDaniel Vetter 	 * List of &struct drm_framebuffer associated with this file, using the
255b93658f8SDaniel Vetter 	 * &drm_framebuffer.filp_head entry.
256b93658f8SDaniel Vetter 	 *
257b93658f8SDaniel Vetter 	 * Protected by @fbs_lock. Note that the @fbs list holds a reference on
258b93658f8SDaniel Vetter 	 * the framebuffer object to prevent it from untimely disappearing.
259a8f8b1d9SDaniel Vetter 	 */
260a8f8b1d9SDaniel Vetter 	struct list_head fbs;
261b93658f8SDaniel Vetter 
262b93658f8SDaniel Vetter 	/** @fbs_lock: Protects @fbs. */
263a8f8b1d9SDaniel Vetter 	struct mutex fbs_lock;
264a8f8b1d9SDaniel Vetter 
265b93658f8SDaniel Vetter 	/**
266b93658f8SDaniel Vetter 	 * @blobs:
267b93658f8SDaniel Vetter 	 *
268b93658f8SDaniel Vetter 	 * User-created blob properties; this retains a reference on the
269b93658f8SDaniel Vetter 	 * property.
270b93658f8SDaniel Vetter 	 *
271b93658f8SDaniel Vetter 	 * Protected by @drm_mode_config.blob_lock;
272b93658f8SDaniel Vetter 	 */
273a8f8b1d9SDaniel Vetter 	struct list_head blobs;
274a8f8b1d9SDaniel Vetter 
275b93658f8SDaniel Vetter 	/** @event_wait: Waitqueue for new events added to @event_list. */
276a8f8b1d9SDaniel Vetter 	wait_queue_head_t event_wait;
277b93658f8SDaniel Vetter 
278b93658f8SDaniel Vetter 	/**
279b93658f8SDaniel Vetter 	 * @pending_event_list:
280b93658f8SDaniel Vetter 	 *
281b93658f8SDaniel Vetter 	 * List of pending &struct drm_pending_event, used to clean up pending
282b93658f8SDaniel Vetter 	 * events in case this file gets closed before the event is signalled.
283b93658f8SDaniel Vetter 	 * Uses the &drm_pending_event.pending_link entry.
284b93658f8SDaniel Vetter 	 *
285b93658f8SDaniel Vetter 	 * Protect by &drm_device.event_lock.
286b93658f8SDaniel Vetter 	 */
287a8f8b1d9SDaniel Vetter 	struct list_head pending_event_list;
288b93658f8SDaniel Vetter 
289b93658f8SDaniel Vetter 	/**
290b93658f8SDaniel Vetter 	 * @event_list:
291b93658f8SDaniel Vetter 	 *
292b93658f8SDaniel Vetter 	 * List of &struct drm_pending_event, ready for delivery to userspace
293b93658f8SDaniel Vetter 	 * through drm_read(). Uses the &drm_pending_event.link entry.
294b93658f8SDaniel Vetter 	 *
295b93658f8SDaniel Vetter 	 * Protect by &drm_device.event_lock.
296b93658f8SDaniel Vetter 	 */
297a8f8b1d9SDaniel Vetter 	struct list_head event_list;
298b93658f8SDaniel Vetter 
299b93658f8SDaniel Vetter 	/**
300b93658f8SDaniel Vetter 	 * @event_space:
301b93658f8SDaniel Vetter 	 *
302b93658f8SDaniel Vetter 	 * Available event space to prevent userspace from
303b93658f8SDaniel Vetter 	 * exhausting kernel memory. Currently limited to the fairly arbitrary
304b93658f8SDaniel Vetter 	 * value of 4KB.
305b93658f8SDaniel Vetter 	 */
306a8f8b1d9SDaniel Vetter 	int event_space;
307a8f8b1d9SDaniel Vetter 
308b93658f8SDaniel Vetter 	/** @event_read_lock: Serializes drm_read(). */
309a8f8b1d9SDaniel Vetter 	struct mutex event_read_lock;
310a8f8b1d9SDaniel Vetter 
311b93658f8SDaniel Vetter 	/**
312b93658f8SDaniel Vetter 	 * @prime:
313b93658f8SDaniel Vetter 	 *
314b93658f8SDaniel Vetter 	 * Per-file buffer caches used by the PRIME buffer sharing code.
315b93658f8SDaniel Vetter 	 */
316a8f8b1d9SDaniel Vetter 	struct drm_prime_file_private prime;
317b93658f8SDaniel Vetter 
318b93658f8SDaniel Vetter 	/* private: */
319b93658f8SDaniel Vetter 	unsigned long lock_count; /* DRI1 legacy lock count */
320a8f8b1d9SDaniel Vetter };
321a8f8b1d9SDaniel Vetter 
322b93658f8SDaniel Vetter /**
323b93658f8SDaniel Vetter  * drm_is_primary_client - is this an open file of the primary node
324b93658f8SDaniel Vetter  * @file_priv: DRM file
325b93658f8SDaniel Vetter  *
326b93658f8SDaniel Vetter  * Returns true if this is an open file of the primary node, i.e.
327b93658f8SDaniel Vetter  * &drm_file.minor of @file_priv is a primary minor.
328b93658f8SDaniel Vetter  *
329b93658f8SDaniel Vetter  * See also the :ref:`section on primary nodes and authentication
330b93658f8SDaniel Vetter  * <drm_primary_node>`.
331b93658f8SDaniel Vetter  */
332b93658f8SDaniel Vetter static inline bool drm_is_primary_client(const struct drm_file *file_priv)
333b93658f8SDaniel Vetter {
334b93658f8SDaniel Vetter 	return file_priv->minor->type == DRM_MINOR_PRIMARY;
335b93658f8SDaniel Vetter }
336b93658f8SDaniel Vetter 
337b93658f8SDaniel Vetter /**
338b93658f8SDaniel Vetter  * drm_is_render_client - is this an open file of the render node
339b93658f8SDaniel Vetter  * @file_priv: DRM file
340b93658f8SDaniel Vetter  *
341b93658f8SDaniel Vetter  * Returns true if this is an open file of the render node, i.e.
342b93658f8SDaniel Vetter  * &drm_file.minor of @file_priv is a render minor.
343b93658f8SDaniel Vetter  *
344b93658f8SDaniel Vetter  * See also the :ref:`section on render nodes <drm_render_node>`.
345b93658f8SDaniel Vetter  */
346a8f8b1d9SDaniel Vetter static inline bool drm_is_render_client(const struct drm_file *file_priv)
347a8f8b1d9SDaniel Vetter {
348a8f8b1d9SDaniel Vetter 	return file_priv->minor->type == DRM_MINOR_RENDER;
349a8f8b1d9SDaniel Vetter }
350a8f8b1d9SDaniel Vetter 
351b93658f8SDaniel Vetter /**
352b93658f8SDaniel Vetter  * drm_is_control_client - is this an open file of the control node
353b93658f8SDaniel Vetter  * @file_priv: DRM file
354b93658f8SDaniel Vetter  *
355b93658f8SDaniel Vetter  * Control nodes are deprecated and in the process of getting removed from the
356b93658f8SDaniel Vetter  * DRM userspace API. Do not ever use!
357b93658f8SDaniel Vetter  */
358a8f8b1d9SDaniel Vetter static inline bool drm_is_control_client(const struct drm_file *file_priv)
359a8f8b1d9SDaniel Vetter {
360a8f8b1d9SDaniel Vetter 	return file_priv->minor->type == DRM_MINOR_CONTROL;
361a8f8b1d9SDaniel Vetter }
362a8f8b1d9SDaniel Vetter 
363a8f8b1d9SDaniel Vetter int drm_open(struct inode *inode, struct file *filp);
364a8f8b1d9SDaniel Vetter ssize_t drm_read(struct file *filp, char __user *buffer,
365a8f8b1d9SDaniel Vetter 		 size_t count, loff_t *offset);
366a8f8b1d9SDaniel Vetter int drm_release(struct inode *inode, struct file *filp);
367*afc9a42bSAl Viro __poll_t drm_poll(struct file *filp, struct poll_table_struct *wait);
368a8f8b1d9SDaniel Vetter int drm_event_reserve_init_locked(struct drm_device *dev,
369a8f8b1d9SDaniel Vetter 				  struct drm_file *file_priv,
370a8f8b1d9SDaniel Vetter 				  struct drm_pending_event *p,
371a8f8b1d9SDaniel Vetter 				  struct drm_event *e);
372a8f8b1d9SDaniel Vetter int drm_event_reserve_init(struct drm_device *dev,
373a8f8b1d9SDaniel Vetter 			   struct drm_file *file_priv,
374a8f8b1d9SDaniel Vetter 			   struct drm_pending_event *p,
375a8f8b1d9SDaniel Vetter 			   struct drm_event *e);
376a8f8b1d9SDaniel Vetter void drm_event_cancel_free(struct drm_device *dev,
377a8f8b1d9SDaniel Vetter 			   struct drm_pending_event *p);
378a8f8b1d9SDaniel Vetter void drm_send_event_locked(struct drm_device *dev, struct drm_pending_event *e);
379a8f8b1d9SDaniel Vetter void drm_send_event(struct drm_device *dev, struct drm_pending_event *e);
380a8f8b1d9SDaniel Vetter 
381a8f8b1d9SDaniel Vetter #endif /* _DRM_FILE_H_ */
382