![]() |
|
|||
0001 #ifndef _DRM_AUTH_H_ 0002 #define _DRM_AUTH_H_ 0003 0004 /* 0005 * Internal Header for the Direct Rendering Manager 0006 * 0007 * Copyright 2016 Intel Corporation 0008 * 0009 * Author: Daniel Vetter <daniel.vetter@ffwll.ch> 0010 * 0011 * Permission is hereby granted, free of charge, to any person obtaining a 0012 * copy of this software and associated documentation files (the "Software"), 0013 * to deal in the Software without restriction, including without limitation 0014 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 0015 * and/or sell copies of the Software, and to permit persons to whom the 0016 * Software is furnished to do so, subject to the following conditions: 0017 * 0018 * The above copyright notice and this permission notice (including the next 0019 * paragraph) shall be included in all copies or substantial portions of the 0020 * Software. 0021 * 0022 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0023 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0024 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 0025 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 0026 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 0027 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 0028 * OTHER DEALINGS IN THE SOFTWARE. 0029 */ 0030 0031 #include <linux/idr.h> 0032 #include <linux/kref.h> 0033 #include <linux/wait.h> 0034 0035 struct drm_file; 0036 struct drm_hw_lock; 0037 0038 /* 0039 * Legacy DRI1 locking data structure. Only here instead of in drm_legacy.h for 0040 * include ordering reasons. 0041 * 0042 * DO NOT USE. 0043 */ 0044 struct drm_lock_data { 0045 struct drm_hw_lock *hw_lock; 0046 struct drm_file *file_priv; 0047 wait_queue_head_t lock_queue; 0048 unsigned long lock_time; 0049 spinlock_t spinlock; 0050 uint32_t kernel_waiters; 0051 uint32_t user_waiters; 0052 int idle_has_lock; 0053 }; 0054 0055 /** 0056 * struct drm_master - drm master structure 0057 * 0058 * @refcount: Refcount for this master object. 0059 * @dev: Link back to the DRM device 0060 * @driver_priv: Pointer to driver-private information. 0061 * 0062 * Note that master structures are only relevant for the legacy/primary device 0063 * nodes, hence there can only be one per device, not one per drm_minor. 0064 */ 0065 struct drm_master { 0066 struct kref refcount; 0067 struct drm_device *dev; 0068 /** 0069 * @unique: Unique identifier: e.g. busid. Protected by 0070 * &drm_device.master_mutex. 0071 */ 0072 char *unique; 0073 /** 0074 * @unique_len: Length of unique field. Protected by 0075 * &drm_device.master_mutex. 0076 */ 0077 int unique_len; 0078 /** 0079 * @magic_map: Map of used authentication tokens. Protected by 0080 * &drm_device.master_mutex. 0081 */ 0082 struct idr magic_map; 0083 void *driver_priv; 0084 0085 /** 0086 * @lessor: 0087 * 0088 * Lease grantor, only set if this &struct drm_master represents a 0089 * lessee holding a lease of objects from @lessor. Full owners of the 0090 * device have this set to NULL. 0091 * 0092 * The lessor does not change once it's set in drm_lease_create(), and 0093 * each lessee holds a reference to its lessor that it releases upon 0094 * being destroyed in drm_lease_destroy(). 0095 * 0096 * See also the :ref:`section on display resource leasing 0097 * <drm_leasing>`. 0098 */ 0099 struct drm_master *lessor; 0100 0101 /** 0102 * @lessee_id: 0103 * 0104 * ID for lessees. Owners (i.e. @lessor is NULL) always have ID 0. 0105 * Protected by &drm_device.mode_config's &drm_mode_config.idr_mutex. 0106 */ 0107 int lessee_id; 0108 0109 /** 0110 * @lessee_list: 0111 * 0112 * List entry of lessees of @lessor, where they are linked to @lessees. 0113 * Not used for owners. Protected by &drm_device.mode_config's 0114 * &drm_mode_config.idr_mutex. 0115 */ 0116 struct list_head lessee_list; 0117 0118 /** 0119 * @lessees: 0120 * 0121 * List of drm_masters leasing from this one. Protected by 0122 * &drm_device.mode_config's &drm_mode_config.idr_mutex. 0123 * 0124 * This list is empty if no leases have been granted, or if all lessees 0125 * have been destroyed. Since lessors are referenced by all their 0126 * lessees, this master cannot be destroyed unless the list is empty. 0127 */ 0128 struct list_head lessees; 0129 0130 /** 0131 * @leases: 0132 * 0133 * Objects leased to this drm_master. Protected by 0134 * &drm_device.mode_config's &drm_mode_config.idr_mutex. 0135 * 0136 * Objects are leased all together in drm_lease_create(), and are 0137 * removed all together when the lease is revoked. 0138 */ 0139 struct idr leases; 0140 0141 /** 0142 * @lessee_idr: 0143 * 0144 * All lessees under this owner (only used where @lessor is NULL). 0145 * Protected by &drm_device.mode_config's &drm_mode_config.idr_mutex. 0146 */ 0147 struct idr lessee_idr; 0148 /* private: */ 0149 #if IS_ENABLED(CONFIG_DRM_LEGACY) 0150 struct drm_lock_data lock; 0151 #endif 0152 }; 0153 0154 struct drm_master *drm_master_get(struct drm_master *master); 0155 struct drm_master *drm_file_get_master(struct drm_file *file_priv); 0156 void drm_master_put(struct drm_master **master); 0157 bool drm_is_current_master(struct drm_file *fpriv); 0158 0159 struct drm_master *drm_master_create(struct drm_device *dev); 0160 0161 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |