| @@ -1,40 +1,42 @@ | | | @@ -1,40 +1,42 @@ |
1 | /* $NetBSD: drm_modeset_lock.c,v 1.2 2018/08/27 04:58:19 riastradh Exp $ */ | | 1 | /* $NetBSD: drm_modeset_lock.c,v 1.3 2018/08/27 06:56:12 riastradh Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (C) 2014 Red Hat | | 4 | * Copyright (C) 2014 Red Hat |
5 | * Author: Rob Clark <robdclark@gmail.com> | | 5 | * Author: Rob Clark <robdclark@gmail.com> |
6 | * | | 6 | * |
7 | * Permission is hereby granted, free of charge, to any person obtaining a | | 7 | * Permission is hereby granted, free of charge, to any person obtaining a |
8 | * copy of this software and associated documentation files (the "Software"), | | 8 | * copy of this software and associated documentation files (the "Software"), |
9 | * to deal in the Software without restriction, including without limitation | | 9 | * to deal in the Software without restriction, including without limitation |
10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | | 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
11 | * and/or sell copies of the Software, and to permit persons to whom the | | 11 | * and/or sell copies of the Software, and to permit persons to whom the |
12 | * Software is furnished to do so, subject to the following conditions: | | 12 | * Software is furnished to do so, subject to the following conditions: |
13 | * | | 13 | * |
14 | * The above copyright notice and this permission notice shall be included in | | 14 | * The above copyright notice and this permission notice shall be included in |
15 | * all copies or substantial portions of the Software. | | 15 | * all copies or substantial portions of the Software. |
16 | * | | 16 | * |
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | | 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | | 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | | 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
20 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | | 20 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
21 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | | 21 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
22 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | | 22 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
23 | * OTHER DEALINGS IN THE SOFTWARE. | | 23 | * OTHER DEALINGS IN THE SOFTWARE. |
24 | */ | | 24 | */ |
25 | | | 25 | |
26 | #include <sys/cdefs.h> | | 26 | #include <sys/cdefs.h> |
27 | __KERNEL_RCSID(0, "$NetBSD: drm_modeset_lock.c,v 1.2 2018/08/27 04:58:19 riastradh Exp $"); | | 27 | __KERNEL_RCSID(0, "$NetBSD: drm_modeset_lock.c,v 1.3 2018/08/27 06:56:12 riastradh Exp $"); |
| | | 28 | |
| | | 29 | #include <linux/export.h> |
28 | | | 30 | |
29 | #include <drm/drmP.h> | | 31 | #include <drm/drmP.h> |
30 | #include <drm/drm_crtc.h> | | 32 | #include <drm/drm_crtc.h> |
31 | #include <drm/drm_modeset_lock.h> | | 33 | #include <drm/drm_modeset_lock.h> |
32 | | | 34 | |
33 | /** | | 35 | /** |
34 | * DOC: kms locking | | 36 | * DOC: kms locking |
35 | * | | 37 | * |
36 | * As KMS moves toward more fine grained locking, and atomic ioctl where | | 38 | * As KMS moves toward more fine grained locking, and atomic ioctl where |
37 | * userspace can indirectly control locking order, it becomes necessary | | 39 | * userspace can indirectly control locking order, it becomes necessary |
38 | * to use ww_mutex and acquire-contexts to avoid deadlocks. But because | | 40 | * to use ww_mutex and acquire-contexts to avoid deadlocks. But because |
39 | * the locking is more distributed around the driver code, we want a bit | | 41 | * the locking is more distributed around the driver code, we want a bit |
40 | * of extra utility/tracking out of our acquire-ctx. This is provided | | 42 | * of extra utility/tracking out of our acquire-ctx. This is provided |