XenevaOS
Loading...
Searching...
No Matches
drm_file.h
Go to the documentation of this file.
1/*
2 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
3 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
4 * Copyright (c) 2009-2010, Code Aurora Forum.
5 * All rights reserved.
6 *
7 * Author: Rickard E. (Rik) Faith <faith@valinux.com>
8 * Author: Gareth Hughes <gareth@valinux.com>
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining a
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
16 *
17 * The above copyright notice and this permission notice (including the next
18 * paragraph) shall be included in all copies or substantial portions of the
19 * Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 * OTHER DEALINGS IN THE SOFTWARE.
28 */
29
30#ifndef _DRM_FILE_H_
31#define _DRM_FILE_H_
32
33#include <linux/types.h>
34#include <linux/completion.h>
35#include <linux/idr.h>
36#include <linux/xarray.h>
37
38#include <uapi/drm/drm.h>
39
40#include <drm/drm_prime.h>
41
42struct dma_fence;
43struct drm_file;
44struct drm_device;
45struct drm_printer;
46struct device;
47struct file;
48
49extern struct xarray drm_minors_xa;
50
51/*
52 * FIXME: Not sure we want to have drm_minor here in the end, but to avoid
53 * header include loops we need it here for now.
54 */
55
56/* Note that the values of this enum are ABI (it determines
57 * /dev/dri/renderD* numbers).
58 *
59 * Setting DRM_MINOR_ACCEL to 32 gives enough space for more drm minors to
60 * be implemented before we hit any future
61 */
68
78struct drm_minor {
79 /* private: */
80 int index; /* Minor device number */
81 int type; /* Control or render or accel */
82 struct device *kdev; /* Linux device */
83 struct drm_device *dev;
84
85 struct dentry *debugfs_symlink;
86 struct dentry *debugfs_root;
87};
88
105
114
124
132
140
149
158};
159
420
431static inline bool drm_is_primary_client(const struct drm_file *file_priv)
432{
433 return file_priv->minor->type == DRM_MINOR_PRIMARY;
434}
435
445static inline bool drm_is_render_client(const struct drm_file *file_priv)
446{
447 return file_priv->minor->type == DRM_MINOR_RENDER;
448}
449
460static inline bool drm_is_accel_client(const struct drm_file *file_priv)
461{
462 return file_priv->minor->type == DRM_MINOR_ACCEL;
463}
464
466void drm_file_err(struct drm_file *file_priv, const char *fmt, ...);
467
469
470struct drm_minor *drm_minor_acquire(struct xarray *minors_xa, unsigned int minor_id);
471void drm_minor_release(struct drm_minor *minor);
472
473int drm_open(struct inode *inode, struct file *filp);
474int drm_open_helper(struct file *filp, struct drm_minor *minor);
475ssize_t drm_read(struct file *filp, char __user *buffer,
476 size_t count, loff_t *offset);
477int drm_release(struct inode *inode, struct file *filp);
478int drm_release_noglobal(struct inode *inode, struct file *filp);
479__poll_t drm_poll(struct file *filp, struct poll_table_struct *wait);
481 struct drm_file *file_priv,
482 struct drm_pending_event *p,
483 struct drm_event *e);
485 struct drm_file *file_priv,
486 struct drm_pending_event *p,
487 struct drm_event *e);
489 struct drm_pending_event *p);
493 struct drm_pending_event *e,
494 ktime_t timestamp);
495
506struct drm_memory_stats {
507 u64 shared;
508 u64 private;
509 u64 resident;
510 u64 purgeable;
511 u64 active;
512};
513
515
516int drm_memory_stats_is_zero(const struct drm_memory_stats *stats);
518 const char *prefix,
519 const char *stat,
520 const char *region,
521 u64 sz);
523 const struct drm_memory_stats *stats,
524 enum drm_gem_object_status supported_status,
525 const char *region);
526
528void drm_show_fdinfo(struct seq_file *m, struct file *f);
529
530struct file *mock_drm_getfile(struct drm_minor *minor, unsigned int flags);
531
532#endif /* _DRM_FILE_H_ */
int64_t ssize_t
Definition stddef.h:38
uint8_t flags
Definition virtio.h:0
#define __printf(fmt_idx, arg_idx)
Definition compiler.h:144
#define __user
Definition compiler.h:63
#define __rcu
Definition compiler_types.h:72
unsigned int drm_magic_t
Definition drm.h:67
size_t size_t offset
Definition drm_bridge.h:1299
ssize_t drm_read(struct file *filp, char __user *buffer, size_t count, loff_t *offset)
void drm_send_event_locked(struct drm_device *dev, struct drm_pending_event *e)
int drm_release_noglobal(struct inode *inode, struct file *filp)
void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file)
void drm_fdinfo_print_size(struct drm_printer *p, const char *prefix, const char *stat, const char *region, u64 sz)
void drm_print_memory_stats(struct drm_printer *p, const struct drm_memory_stats *stats, enum drm_gem_object_status supported_status, const char *region)
void drm_event_cancel_free(struct drm_device *dev, struct drm_pending_event *p)
void drm_send_event_timestamp_locked(struct drm_device *dev, struct drm_pending_event *e, ktime_t timestamp)
const char * fmt
Definition drm_file.h:466
struct drm_minor * drm_minor_acquire(struct xarray *minors_xa, unsigned int minor_id)
int drm_event_reserve_init_locked(struct drm_device *dev, struct drm_file *file_priv, struct drm_pending_event *p, struct drm_event *e)
void drm_minor_release(struct drm_minor *minor)
int drm_open(struct inode *inode, struct file *filp)
int drm_open_helper(struct file *filp, struct drm_minor *minor)
__poll_t drm_poll(struct file *filp, struct poll_table_struct *wait)
drm_minor_type
Definition drm_file.h:62
@ DRM_MINOR_CONTROL
Definition drm_file.h:64
@ DRM_MINOR_PRIMARY
Definition drm_file.h:63
@ DRM_MINOR_ACCEL
Definition drm_file.h:66
@ DRM_MINOR_RENDER
Definition drm_file.h:65
int drm_event_reserve_init(struct drm_device *dev, struct drm_file *file_priv, struct drm_pending_event *p, struct drm_event *e)
struct xarray drm_minors_xa
int drm_release(struct inode *inode, struct file *filp)
const char void drm_file_update_pid(struct drm_file *)
void drm_send_event(struct drm_device *dev, struct drm_pending_event *e)
int drm_memory_stats_is_zero(const struct drm_memory_stats *stats)
void drm_show_fdinfo(struct seq_file *m, struct file *f)
struct file * mock_drm_getfile(struct drm_minor *minor, unsigned int flags)
drm_gem_object_status
Definition drm_gem.h:66
const struct device * dev
Definition drm_print.h:519
const char * f
Definition drm_print.h:205
unsigned int __poll_t
Definition fs.h:50
uint64_t u64
Definition kernel.h:17
int64_t ktime_t
Definition kernel.h:404
uint64_t loff_t
Definition kernel.h:49
int spinlock_t
Definition kernel.h:44
Definition completion.h:55
Definition fs.h:255
Definition dma-fence.h:70
Definition drm_device.h:75
Definition drm.h:1380
Definition drm_file.h:165
int event_space
Definition drm_file.h:389
spinlock_t table_lock
Definition drm_file.h:318
struct file * filp
Definition drm_file.h:324
struct mutex fbs_lock
Definition drm_file.h:346
bool supports_virtualized_cursor_plane
Definition drm_file.h:249
struct idr object_idr
Definition drm_file.h:315
drm_magic_t magic
Definition drm_file.h:293
struct list_head blobs
Definition drm_file.h:356
struct drm_minor * minor
Definition drm_file.h:304
wait_queue_head_t event_wait
Definition drm_file.h:359
bool was_master
Definition drm_file.h:226
bool aspect_ratio_allowed
Definition drm_file.h:201
struct mutex client_name_lock
Definition drm_file.h:411
bool is_master
Definition drm_file.h:237
struct drm_prime_file_private prime
Definition drm_file.h:399
bool stereo_allowed
Definition drm_file.h:182
struct list_head fbs
Definition drm_file.h:343
bool authenticated
Definition drm_file.h:175
bool plane_color_pipeline
Definition drm_file.h:215
struct list_head event_list
Definition drm_file.h:380
bool universal_planes
Definition drm_file.h:190
void * driver_priv
Definition drm_file.h:332
struct xarray syncobj_xa
Definition drm_file.h:321
u64 client_id
Definition drm_file.h:290
bool atomic
Definition drm_file.h:193
struct list_head lhead
Definition drm_file.h:301
bool writeback_connectors
Definition drm_file.h:208
struct pid __rcu * pid
Definition drm_file.h:287
struct list_head pending_event_list
Definition drm_file.h:370
struct drm_master * master
Definition drm_file.h:274
spinlock_t master_lookup_lock
Definition drm_file.h:277
const char * client_name
Definition drm_file.h:406
struct mutex event_read_lock
Definition drm_file.h:392
struct dentry * debugfs_client
Definition drm_file.h:418
Definition drm_auth.h:47
Definition drm_file.h:78
int type
Definition drm_file.h:81
int index
Definition drm_file.h:80
struct device * kdev
Definition drm_file.h:82
struct dentry * debugfs_symlink
Definition drm_file.h:85
struct drm_device * dev
Definition drm_file.h:83
struct dentry * debugfs_root
Definition drm_file.h:86
Definition drm_file.h:96
struct list_head pending_link
Definition drm_file.h:157
struct dma_fence * fence
Definition drm_file.h:131
struct completion * completion
Definition drm_file.h:104
struct drm_file * file_priv
Definition drm_file.h:139
struct drm_event * event
Definition drm_file.h:123
struct list_head link
Definition drm_file.h:148
void(* completion_release)(struct completion *completion)
Definition drm_file.h:113
Definition drm_prime.h:45
Definition drm_print.h:181
Definition fs.h:142
Definition idr.h:80
Definition fs.h:183
Definition list.h:11
Definition mutex.h:59
Definition fs.h:52
Definition seq_file.h:47
Definition stat.h:65
Definition wait.h:75
Definition xarray.h:319