Debian Codegraph @

src/gallium/drivers/freedreno/a2xx/fd2_util.h

raw
1 /*
2 * Copyright © 2012-2013 Rob Clark <[email protected]>
3 * SPDX-License-Identifier: MIT
4 *
5 * Authors:
6 * Rob Clark <[email protected]>
7 */
8
9 #ifndef FD2_UTIL_H_
10 #define FD2_UTIL_H_
11
12 #include "freedreno_util.h"
13
14 #include "fd2_hw.h"
15
16 struct surface_format {
17 /* If enum is a signed type, 0x7f is out of range. Cast it to avoid warnings. */
18 #define FMT_INVALID ((enum a2xx_sq_surfaceformat)0x7f)
19 enum a2xx_sq_surfaceformat format : 7;
20 enum sq_tex_sign sign : 2;
21 enum sq_tex_num_format num_format : 1;
22 int exp_adjust : 6;
23 };
24
25 struct surface_format fd2_pipe2surface(enum pipe_format format);
26 enum a2xx_colorformatx fd2_pipe2color(enum pipe_format format);
27 uint32_t fd2_tex_swiz(enum pipe_format format, unsigned swizzle_r,
28 unsigned swizzle_g, unsigned swizzle_b,
29 unsigned swizzle_a);
30 uint32_t fd2_vtx_swiz(enum pipe_format format, unsigned swizzle);
31
32 /* convert x,y to dword */
33 static inline uint32_t
34 xy2d(uint16_t x, uint16_t y)
35 {
36 return ((y & 0x3fff) << 16) | (x & 0x3fff);
37 }
38
39 #endif /* FD2_UTIL_H_ */