xref: /third_party/libdrm/nouveau/nvif/unpack.h
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/libdrm/nouveau/nvif/
1d722e3fbSopenharmony_ci#ifndef __NVIF_UNPACK_H__
2d722e3fbSopenharmony_ci#define __NVIF_UNPACK_H__
3d722e3fbSopenharmony_ci
4d722e3fbSopenharmony_ci#define nvif_unvers(r,d,s,m) ({                                                \
5d722e3fbSopenharmony_ci	void **_data = (d); __u32 *_size = (s); int _ret = (r);                \
6d722e3fbSopenharmony_ci	if (_ret == -ENOSYS && *_size == sizeof(m)) {                          \
7d722e3fbSopenharmony_ci		*_data = NULL;                                                 \
8d722e3fbSopenharmony_ci		*_size = _ret = 0;                                             \
9d722e3fbSopenharmony_ci	}                                                                      \
10d722e3fbSopenharmony_ci	_ret;                                                                  \
11d722e3fbSopenharmony_ci})
12d722e3fbSopenharmony_ci
13d722e3fbSopenharmony_ci#define nvif_unpack(r,d,s,m,vl,vh,x) ({                                        \
14d722e3fbSopenharmony_ci	void **_data = (d); __u32 *_size = (s);                                \
15d722e3fbSopenharmony_ci	int _ret = (r), _vl = (vl), _vh = (vh);                                \
16d722e3fbSopenharmony_ci	if (_ret == -ENOSYS && *_size >= sizeof(m) &&                          \
17d722e3fbSopenharmony_ci	    (m).version >= _vl && (m).version <= _vh) {                        \
18d722e3fbSopenharmony_ci		*_data = (__u8 *)*_data + sizeof(m);                           \
19d722e3fbSopenharmony_ci		*_size = *_size - sizeof(m);                                   \
20d722e3fbSopenharmony_ci		if (_ret = 0, !(x)) {                                          \
21d722e3fbSopenharmony_ci			_ret = *_size ? -E2BIG : 0;                            \
22d722e3fbSopenharmony_ci			*_data = NULL;                                         \
23d722e3fbSopenharmony_ci			*_size = 0;                                            \
24d722e3fbSopenharmony_ci		}                                                              \
25d722e3fbSopenharmony_ci	}                                                                      \
26d722e3fbSopenharmony_ci	_ret;                                                                  \
27d722e3fbSopenharmony_ci})
28d722e3fbSopenharmony_ci#endif
29

Indexes created Thu Nov 07 10:32:03 CST 2024