Sun Dec 19 01:56:50 2021 UTC ()
Move drm_file ifdef goo to the one defined in drm_file.h.

drm_lock_data is defined in drm_auth.h and already has the
ifdef goo.

Author: Maya Rashish <maya@NetBSD.org>


(riastradh)
diff -r1.54 -r1.55 src/sys/external/bsd/drm2/dist/include/drm/drmP.h
diff -r1.4 -r1.5 src/sys/external/bsd/drm2/dist/include/drm/drm_file.h

cvs diff -r1.54 -r1.55 src/sys/external/bsd/drm2/dist/include/drm/Attic/drmP.h (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/include/drm/Attic/drmP.h 2021/12/19 01:56:42 1.54
+++ src/sys/external/bsd/drm2/dist/include/drm/Attic/drmP.h 2021/12/19 01:56:50 1.55
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: drmP.h,v 1.54 2021/12/19 01:56:42 riastradh Exp $ */ 1/* $NetBSD: drmP.h,v 1.55 2021/12/19 01:56:50 riastradh Exp $ */
2 2
3/* 3/*
4 * Internal Header for the Direct Rendering Manager 4 * Internal Header for the Direct Rendering Manager
5 * 5 *
6 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 6 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
7 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 7 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
8 * Copyright (c) 2009-2010, Code Aurora Forum. 8 * Copyright (c) 2009-2010, Code Aurora Forum.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Author: Rickard E. (Rik) Faith <faith@valinux.com> 11 * Author: Rickard E. (Rik) Faith <faith@valinux.com>
12 * Author: Gareth Hughes <gareth@valinux.com> 12 * Author: Gareth Hughes <gareth@valinux.com>
13 * 13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a 14 * Permission is hereby granted, free of charge, to any person obtaining a
@@ -149,109 +149,26 @@ struct drm_pending_event { @@ -149,109 +149,26 @@ struct drm_pending_event {
149 struct list_head link; 149 struct list_head link;
150 struct drm_file *file_priv; 150 struct drm_file *file_priv;
151 pid_t pid; /* pid of requester, no guarantee it's valid by the time 151 pid_t pid; /* pid of requester, no guarantee it's valid by the time
152 we deliver the event, for tracing only */ 152 we deliver the event, for tracing only */
153 void (*destroy)(struct drm_pending_event *event); 153 void (*destroy)(struct drm_pending_event *event);
154}; 154};
155 155
156/* initial implementaton using a linked list - todo hashtab */ 156/* initial implementaton using a linked list - todo hashtab */
157struct drm_prime_file_private { 157struct drm_prime_file_private {
158 struct list_head head; 158 struct list_head head;
159 struct mutex lock; 159 struct mutex lock;
160}; 160};
161 161
162/** File private data */ 
163struct drm_file { 
164 unsigned authenticated :1; 
165 /* Whether we're master for a minor. Protected by master_mutex */ 
166 unsigned is_master :1; 
167 /* true when the client has asked us to expose stereo 3D mode flags */ 
168 unsigned stereo_allowed :1; 
169 /* 
170 * true if client understands CRTC primary planes and cursor planes 
171 * in the plane list 
172 */ 
173 unsigned universal_planes:1; 
174 /* true if client understands atomic properties */ 
175 unsigned atomic:1; 
176 /* 
177 * This client is allowed to gain master privileges for @master. 
178 * Protected by struct drm_device::master_mutex. 
179 */ 
180 unsigned allowed_master:1; 
181 
182#ifndef __NetBSD__ 
183 struct pid *pid; 
184 kuid_t uid; 
185#endif 
186 drm_magic_t magic; 
187 struct list_head lhead; 
188 struct drm_minor *minor; 
189 unsigned long lock_count; 
190 
191 /** Mapping of mm object handles to object pointers. */ 
192 struct idr object_idr; 
193 /** Lock for synchronization of access to object_idr. */ 
194 spinlock_t table_lock; 
195 
196 struct file *filp; 
197 void *driver_priv; 
198 
199 struct drm_master *master; /* master this node is currently associated with 
200 N.B. not always minor->master */ 
201 /** 
202 * fbs - List of framebuffers associated with this file. 
203 * 
204 * Protected by fbs_lock. Note that the fbs list holds a reference on 
205 * the fb object to prevent it from untimely disappearing. 
206 */ 
207 struct list_head fbs; 
208 struct mutex fbs_lock; 
209 
210 /** User-created blob properties; this retains a reference on the 
211 * property. */ 
212 struct list_head blobs; 
213 
214#ifdef __NetBSD__ 
215 drm_waitqueue_t event_wait; 
216 struct selinfo event_selq; 
217#else 
218 wait_queue_head_t event_wait; 
219#endif 
220 struct list_head event_list; 
221 int event_space; 
222 
223 struct drm_prime_file_private prime; 
224}; 
225 
226/** 
227 * Lock data. 
228 */ 
229struct drm_lock_data { 
230 struct drm_hw_lock *hw_lock; /**< Hardware lock */ 
231 /** Private of lock holder's file (NULL=kernel) */ 
232 struct drm_file *file_priv; 
233#ifdef __NetBSD__ 
234 drm_waitqueue_t lock_queue; /**< Queue of blocked processes */ 
235#else 
236 wait_queue_head_t lock_queue; /**< Queue of blocked processes */ 
237#endif 
238 unsigned long lock_time; /**< Time of last lock in jiffies */ 
239 spinlock_t spinlock; 
240 uint32_t kernel_waiters; 
241 uint32_t user_waiters; 
242 int idle_has_lock; 
243}; 
244 
245/** 162/**
246 * struct drm_master - drm master structure 163 * struct drm_master - drm master structure
247 * 164 *
248 * @refcount: Refcount for this master object. 165 * @refcount: Refcount for this master object.
249 * @minor: Link back to minor char device we are master for. Immutable. 166 * @minor: Link back to minor char device we are master for. Immutable.
250 * @unique: Unique identifier: e.g. busid. Protected by drm_global_mutex. 167 * @unique: Unique identifier: e.g. busid. Protected by drm_global_mutex.
251 * @unique_len: Length of unique field. Protected by drm_global_mutex. 168 * @unique_len: Length of unique field. Protected by drm_global_mutex.
252 * @magic_map: Map of used authentication tokens. Protected by struct_mutex. 169 * @magic_map: Map of used authentication tokens. Protected by struct_mutex.
253 * @lock: DRI lock information. 170 * @lock: DRI lock information.
254 * @driver_priv: Pointer to driver-private information. 171 * @driver_priv: Pointer to driver-private information.
255 */ 172 */
256struct drm_master { 173struct drm_master {
257 struct kref refcount; 174 struct kref refcount;

cvs diff -r1.4 -r1.5 src/sys/external/bsd/drm2/dist/include/drm/drm_file.h (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/include/drm/drm_file.h 2021/12/19 00:58:04 1.4
+++ src/sys/external/bsd/drm2/dist/include/drm/drm_file.h 2021/12/19 01:56:50 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: drm_file.h,v 1.4 2021/12/19 00:58:04 riastradh Exp $ */ 1/* $NetBSD: drm_file.h,v 1.5 2021/12/19 01:56:50 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 4 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
6 * Copyright (c) 2009-2010, Code Aurora Forum. 6 * Copyright (c) 2009-2010, Code Aurora Forum.
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * Author: Rickard E. (Rik) Faith <faith@valinux.com> 9 * Author: Rickard E. (Rik) Faith <faith@valinux.com>
10 * Author: Gareth Hughes <gareth@valinux.com> 10 * Author: Gareth Hughes <gareth@valinux.com>
11 * 11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a 12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"), 13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation 14 * to deal in the Software without restriction, including without limitation
@@ -220,28 +220,30 @@ struct drm_file { @@ -220,28 +220,30 @@ struct drm_file {
220 220
221 /** 221 /**
222 * @master: 222 * @master:
223 * 223 *
224 * Master this node is currently associated with. Only relevant if 224 * Master this node is currently associated with. Only relevant if
225 * drm_is_primary_client() returns true. Note that this only 225 * drm_is_primary_client() returns true. Note that this only
226 * matches &drm_device.master if the master is the currently active one. 226 * matches &drm_device.master if the master is the currently active one.
227 * 227 *
228 * See also @authentication and @is_master and the :ref:`section on 228 * See also @authentication and @is_master and the :ref:`section on
229 * primary nodes and authentication <drm_primary_node>`. 229 * primary nodes and authentication <drm_primary_node>`.
230 */ 230 */
231 struct drm_master *master; 231 struct drm_master *master;
232 232
 233#ifndef __NetBSD__
233 /** @pid: Process that opened this file. */ 234 /** @pid: Process that opened this file. */
234 struct pid *pid; 235 struct pid *pid;
 236#endif
235 237
236 /** @magic: Authentication magic, see @authenticated. */ 238 /** @magic: Authentication magic, see @authenticated. */
237 drm_magic_t magic; 239 drm_magic_t magic;
238 240
239 /** 241 /**
240 * @lhead: 242 * @lhead:
241 * 243 *
242 * List of all open files of a DRM device, linked into 244 * List of all open files of a DRM device, linked into
243 * &drm_device.filelist. Protected by &drm_device.filelist_mutex. 245 * &drm_device.filelist. Protected by &drm_device.filelist_mutex.
244 */ 246 */
245 struct list_head lhead; 247 struct list_head lhead;
246 248
247 /** @minor: &struct drm_minor for this file. */ 249 /** @minor: &struct drm_minor for this file. */
@@ -289,27 +291,32 @@ struct drm_file { @@ -289,27 +291,32 @@ struct drm_file {
289 struct mutex fbs_lock; 291 struct mutex fbs_lock;
290 292
291 /** 293 /**
292 * @blobs: 294 * @blobs:
293 * 295 *
294 * User-created blob properties; this retains a reference on the 296 * User-created blob properties; this retains a reference on the
295 * property. 297 * property.
296 * 298 *
297 * Protected by @drm_mode_config.blob_lock; 299 * Protected by @drm_mode_config.blob_lock;
298 */ 300 */
299 struct list_head blobs; 301 struct list_head blobs;
300 302
301 /** @event_wait: Waitqueue for new events added to @event_list. */ 303 /** @event_wait: Waitqueue for new events added to @event_list. */
 304#ifdef __NetBSD__
 305 drm_waitqueue_t event_wait;
 306 struct selinfo event_selq;
 307#else
302 wait_queue_head_t event_wait; 308 wait_queue_head_t event_wait;
 309#endif
303 310
304 /** 311 /**
305 * @pending_event_list: 312 * @pending_event_list:
306 * 313 *
307 * List of pending &struct drm_pending_event, used to clean up pending 314 * List of pending &struct drm_pending_event, used to clean up pending
308 * events in case this file gets closed before the event is signalled. 315 * events in case this file gets closed before the event is signalled.
309 * Uses the &drm_pending_event.pending_link entry. 316 * Uses the &drm_pending_event.pending_link entry.
310 * 317 *
311 * Protect by &drm_device.event_lock. 318 * Protect by &drm_device.event_lock.
312 */ 319 */
313 struct list_head pending_event_list; 320 struct list_head pending_event_list;
314 321
315 /** 322 /**