![]() |
|
|||
0001 /* 0002 * Internal Header for the Direct Rendering Manager 0003 * 0004 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 0005 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 0006 * Copyright (c) 2009-2010, Code Aurora Forum. 0007 * All rights reserved. 0008 * 0009 * Author: Rickard E. (Rik) Faith <faith@valinux.com> 0010 * Author: Gareth Hughes <gareth@valinux.com> 0011 * 0012 * Permission is hereby granted, free of charge, to any person obtaining a 0013 * copy of this software and associated documentation files (the "Software"), 0014 * to deal in the Software without restriction, including without limitation 0015 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 0016 * and/or sell copies of the Software, and to permit persons to whom the 0017 * Software is furnished to do so, subject to the following conditions: 0018 * 0019 * The above copyright notice and this permission notice (including the next 0020 * paragraph) shall be included in all copies or substantial portions of the 0021 * Software. 0022 * 0023 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0024 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0025 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 0026 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 0027 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 0028 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 0029 * OTHER DEALINGS IN THE SOFTWARE. 0030 */ 0031 0032 #ifndef _DRM_IOCTL_H_ 0033 #define _DRM_IOCTL_H_ 0034 0035 #include <linux/types.h> 0036 #include <linux/bitops.h> 0037 0038 #include <asm/ioctl.h> 0039 0040 struct drm_device; 0041 struct drm_file; 0042 struct file; 0043 0044 /** 0045 * drm_ioctl_t - DRM ioctl function type. 0046 * @dev: DRM device inode 0047 * @data: private pointer of the ioctl call 0048 * @file_priv: DRM file this ioctl was made on 0049 * 0050 * This is the DRM ioctl typedef. Note that drm_ioctl() has alrady copied @data 0051 * into kernel-space, and will also copy it back, depending upon the read/write 0052 * settings in the ioctl command code. 0053 */ 0054 typedef int drm_ioctl_t(struct drm_device *dev, void *data, 0055 struct drm_file *file_priv); 0056 0057 /** 0058 * drm_ioctl_compat_t - compatibility DRM ioctl function type. 0059 * @filp: file pointer 0060 * @cmd: ioctl command code 0061 * @arg: DRM file this ioctl was made on 0062 * 0063 * Just a typedef to make declaring an array of compatibility handlers easier. 0064 * New drivers shouldn't screw up the structure layout for their ioctl 0065 * structures and hence never need this. 0066 */ 0067 typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, 0068 unsigned long arg); 0069 0070 #define DRM_IOCTL_NR(n) _IOC_NR(n) 0071 #define DRM_IOCTL_TYPE(n) _IOC_TYPE(n) 0072 #define DRM_MAJOR 226 0073 0074 /** 0075 * enum drm_ioctl_flags - DRM ioctl flags 0076 * 0077 * Various flags that can be set in &drm_ioctl_desc.flags to control how 0078 * userspace can use a given ioctl. 0079 */ 0080 enum drm_ioctl_flags { 0081 /** 0082 * @DRM_AUTH: 0083 * 0084 * This is for ioctl which are used for rendering, and require that the 0085 * file descriptor is either for a render node, or if it's a 0086 * legacy/primary node, then it must be authenticated. 0087 */ 0088 DRM_AUTH = BIT(0), 0089 /** 0090 * @DRM_MASTER: 0091 * 0092 * This must be set for any ioctl which can change the modeset or 0093 * display state. Userspace must call the ioctl through a primary node, 0094 * while it is the active master. 0095 * 0096 * Note that read-only modeset ioctl can also be called by 0097 * unauthenticated clients, or when a master is not the currently active 0098 * one. 0099 */ 0100 DRM_MASTER = BIT(1), 0101 /** 0102 * @DRM_ROOT_ONLY: 0103 * 0104 * Anything that could potentially wreak a master file descriptor needs 0105 * to have this flag set. Current that's only for the SETMASTER and 0106 * DROPMASTER ioctl, which e.g. logind can call to force a non-behaving 0107 * master (display compositor) into compliance. 0108 * 0109 * This is equivalent to callers with the SYSADMIN capability. 0110 */ 0111 DRM_ROOT_ONLY = BIT(2), 0112 /** 0113 * @DRM_UNLOCKED: 0114 * 0115 * Whether &drm_ioctl_desc.func should be called with the DRM BKL held 0116 * or not. Enforced as the default for all modern drivers, hence there 0117 * should never be a need to set this flag. 0118 * 0119 * Do not use anywhere else than for the VBLANK_WAIT IOCTL, which is the 0120 * only legacy IOCTL which needs this. 0121 */ 0122 DRM_UNLOCKED = BIT(4), 0123 /** 0124 * @DRM_RENDER_ALLOW: 0125 * 0126 * This is used for all ioctl needed for rendering only, for drivers 0127 * which support render nodes. This should be all new render drivers, 0128 * and hence it should be always set for any ioctl with DRM_AUTH set. 0129 * Note though that read-only query ioctl might have this set, but have 0130 * not set DRM_AUTH because they do not require authentication. 0131 */ 0132 DRM_RENDER_ALLOW = BIT(5), 0133 }; 0134 0135 /** 0136 * struct drm_ioctl_desc - DRM driver ioctl entry 0137 * @cmd: ioctl command number, without flags 0138 * @flags: a bitmask of &enum drm_ioctl_flags 0139 * @func: handler for this ioctl 0140 * @name: user-readable name for debug output 0141 * 0142 * For convenience it's easier to create these using the DRM_IOCTL_DEF_DRV() 0143 * macro. 0144 */ 0145 struct drm_ioctl_desc { 0146 unsigned int cmd; 0147 enum drm_ioctl_flags flags; 0148 drm_ioctl_t *func; 0149 const char *name; 0150 }; 0151 0152 /** 0153 * DRM_IOCTL_DEF_DRV() - helper macro to fill out a &struct drm_ioctl_desc 0154 * @ioctl: ioctl command suffix 0155 * @_func: handler for the ioctl 0156 * @_flags: a bitmask of &enum drm_ioctl_flags 0157 * 0158 * Small helper macro to create a &struct drm_ioctl_desc entry. The ioctl 0159 * command number is constructed by prepending ``DRM_IOCTL\_`` and passing that 0160 * to DRM_IOCTL_NR(). 0161 */ 0162 #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \ 0163 [DRM_IOCTL_NR(DRM_IOCTL_##ioctl) - DRM_COMMAND_BASE] = { \ 0164 .cmd = DRM_IOCTL_##ioctl, \ 0165 .func = _func, \ 0166 .flags = _flags, \ 0167 .name = #ioctl \ 0168 } 0169 0170 long drm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); 0171 long drm_ioctl_kernel(struct file *, drm_ioctl_t, void *, u32); 0172 #ifdef CONFIG_COMPAT 0173 long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); 0174 #else 0175 /* Let drm_compat_ioctl be assigned to .compat_ioctl unconditionally */ 0176 #define drm_compat_ioctl NULL 0177 #endif 0178 bool drm_ioctl_flags(unsigned int nr, unsigned int *flags); 0179 0180 int drm_noop(struct drm_device *dev, void *data, 0181 struct drm_file *file_priv); 0182 int drm_invalid_op(struct drm_device *dev, void *data, 0183 struct drm_file *file_priv); 0184 0185 #endif /* _DRM_IOCTL_H_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |