aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs2015-10-29 18:27:13 -0500
committerBen Skeggs2015-12-21 21:21:05 -0600
commitd1ec093e4c5b08c3825fe07e287aa3d023e9c9ae (patch)
tree95a925dd6c1876fd9b0ba942ed83be31904badc1 /nouveau/nvif/unpack.h
parent0cfb6a39864c3ebc7802107a8e4ddac67195d4cd (diff)
downloadexternal-libgbm-d1ec093e4c5b08c3825fe07e287aa3d023e9c9ae.tar.gz
external-libgbm-d1ec093e4c5b08c3825fe07e287aa3d023e9c9ae.tar.xz
external-libgbm-d1ec093e4c5b08c3825fe07e287aa3d023e9c9ae.zip
nouveau: import and install a selection of nvif headers from the kernel
This commit also modifies the install path of the main libdrm_nouveau header to be under a nouveau/ subdirectory. Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Diffstat (limited to 'nouveau/nvif/unpack.h')
-rw-r--r--nouveau/nvif/unpack.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/nouveau/nvif/unpack.h b/nouveau/nvif/unpack.h
new file mode 100644
index 00000000..751bcf49
--- /dev/null
+++ b/nouveau/nvif/unpack.h
@@ -0,0 +1,28 @@
1#ifndef __NVIF_UNPACK_H__
2#define __NVIF_UNPACK_H__
3
4#define nvif_unvers(r,d,s,m) ({ \
5 void **_data = (d); __u32 *_size = (s); int _ret = (r); \
6 if (_ret == -ENOSYS && *_size == sizeof(m)) { \
7 *_data = NULL; \
8 *_size = _ret = 0; \
9 } \
10 _ret; \
11})
12
13#define nvif_unpack(r,d,s,m,vl,vh,x) ({ \
14 void **_data = (d); __u32 *_size = (s); \
15 int _ret = (r), _vl = (vl), _vh = (vh); \
16 if (_ret == -ENOSYS && *_size >= sizeof(m) && \
17 (m).version >= _vl && (m).version <= _vh) { \
18 *_data = (__u8 *)*_data + sizeof(m); \
19 *_size = *_size - sizeof(m); \
20 if (_ret = 0, !(x)) { \
21 _ret = *_size ? -E2BIG : 0; \
22 *_data = NULL; \
23 *_size = 0; \
24 } \
25 } \
26 _ret; \
27})
28#endif