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