summaryrefslogtreecommitdiff
path: root/usr/src/common/libdrm/patches/incl-drm-drm-h.patch
blob: 152523a4b6a2401f14b683c76e5762660292e736 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, and/or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, provided that the above
# copyright notice(s) and this permission notice appear in all copies of
# the Software and that both the above copyright notice(s) and this
# permission notice appear in supporting documentation.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# 
# Except as contained in this notice, the name of a copyright holder
# shall not be used in advertising or otherwise to promote the sale, use
# or other dealings in this Software without prior written authorization
# of the copyright holder.

diff --git a/include/drm/drm.h b/include/drm/drm.h
index 8adb9d5..f9bedd0 100644
--- a/include/drm/drm.h	2016-04-28 03:44:16.000000000 +0300
+++ b/include/drm/drm.h	2016-05-24 10:27:22.341573589 +0300
@@ -55,10 +55,36 @@
 typedef int64_t  __s64;
 typedef uint64_t __u64;
 typedef size_t   __kernel_size_t;
+#if defined(__SOLARIS__) || defined(__sun)
+#include <sys/types32.h>
+typedef unsigned long long drm_handle_t;
+#else
 typedef unsigned long drm_handle_t;
+#endif
 
 #endif
 
+/* Solaris-specific. */
+#if defined(__SOLARIS__) || defined(__sun)
+
+#define        _IOC_NRBITS     8
+#define        _IOC_TYPEBITS   8
+#define        _IOC_SIZEBITS   14
+#define        _IOC_DIRBITS    2
+
+#define        _IOC_NRSHIFT    0
+#define        _IOC_TYPESHIFT  (_IOC_NRSHIFT + _IOC_NRBITS)
+#define        _IOC_SIZESHIFT  (_IOC_TYPESHIFT + _IOC_TYPEBITS)
+#define        _IOC_DIRSHIFT   (_IOC_SIZESHIFT + _IOC_SIZEBITS)
+
+#define        _IOC(dir, type, nr, size) \
+       (((dir) /* already shifted */) | \
+       ((type) << _IOC_TYPESHIFT) | \
+       ((nr)   << _IOC_NRSHIFT) | \
+       ((size) << _IOC_SIZESHIFT))
+
+#endif /* __Solaris__ or __sun */
+
 #define DRM_NAME	"drm"	  /**< Name in kernel, /dev, and /proc */
 #define DRM_MIN_ORDER	5	  /**< At least 2^5 bytes = 32 bytes */
 #define DRM_MAX_ORDER	22	  /**< Up to 2^22 bytes = 4MB */
@@ -181,7 +207,8 @@
 	_DRM_SHM = 2,		  /**< shared, cached */
 	_DRM_AGP = 3,		  /**< AGP/GART */
 	_DRM_SCATTER_GATHER = 4,  /**< Scatter/gather memory for PCI DMA */
-	_DRM_CONSISTENT = 5	  /**< Consistent memory for PCI DMA */
+	_DRM_CONSISTENT = 5,	  /**< Consistent memory for PCI DMA */
+	_DRM_GEM = 6		  /**< GEM object (XXX: Not libdrm?) */
 };
 
 /**
@@ -210,12 +237,13 @@
  * \sa drmAddMap().
  */
 struct drm_map {
-	unsigned long offset;	 /**< Requested physical address (0 for SAREA)*/
+	unsigned long long offset;	 /**< Requested physical address (0 for SAREA)*/
+	unsigned long long handle;	 
+				 /**< User-space: "Handle" to pass to mmap() */
+				 /**< Kernel-space: kernel-virtual address */
 	unsigned long size;	 /**< Requested physical size (bytes) */
 	enum drm_map_type type;	 /**< Type of memory to map */
 	enum drm_map_flags flags;	 /**< Flags */
-	void *handle;		 /**< User-space: "Handle" to pass to mmap() */
-				 /**< Kernel-space: kernel-virtual address */
 	int mtrr;		 /**< MTRR slot used */
 	/*   Private data */
 };
@@ -322,18 +350,22 @@
  *
  * \sa drmAddBufs().
  */
+
+typedef enum {
+       _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */
+       _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */
+       _DRM_SG_BUFFER  = 0x04, /**< Scatter/gather memory buffer */
+       _DRM_FB_BUFFER  = 0x08, /**< Buffer is in frame buffer */
+       _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */
+} drm_buf_flag;
+
+
 struct drm_buf_desc {
 	int count;		 /**< Number of buffers of this size */
 	int size;		 /**< Size in bytes */
 	int low_mark;		 /**< Low water mark */
 	int high_mark;		 /**< High water mark */
-	enum {
-		_DRM_PAGE_ALIGN = 0x01,	/**< Align on page boundaries for DMA */
-		_DRM_AGP_BUFFER = 0x02,	/**< Buffer is in AGP space */
-		_DRM_SG_BUFFER = 0x04,	/**< Scatter/gather memory buffer */
-		_DRM_FB_BUFFER = 0x08,	/**< Buffer is in frame buffer */
-		_DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */
-	} flags;
+	drm_buf_flag flags;
 	unsigned long agp_start; /**<
 				  * Start address of where the AGP buffers are
 				  * in the AGP aperture
@@ -379,6 +411,7 @@
 	void *virtual;		/**< Mmap'd area in user-virtual */
 #endif
 	struct drm_buf_pub *list;	/**< Buffer information */
+	int fd;
 };
 
 /**