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