File indexing completed on 2025-01-18 10:01:51
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #ifndef RADEON_SURFACE_H
0030 #define RADEON_SURFACE_H
0031
0032
0033
0034
0035
0036
0037
0038 #define RADEON_SURF_MAX_LEVEL 32
0039
0040 #define RADEON_SURF_TYPE_MASK 0xFF
0041 #define RADEON_SURF_TYPE_SHIFT 0
0042 #define RADEON_SURF_TYPE_1D 0
0043 #define RADEON_SURF_TYPE_2D 1
0044 #define RADEON_SURF_TYPE_3D 2
0045 #define RADEON_SURF_TYPE_CUBEMAP 3
0046 #define RADEON_SURF_TYPE_1D_ARRAY 4
0047 #define RADEON_SURF_TYPE_2D_ARRAY 5
0048 #define RADEON_SURF_MODE_MASK 0xFF
0049 #define RADEON_SURF_MODE_SHIFT 8
0050 #define RADEON_SURF_MODE_LINEAR 0
0051 #define RADEON_SURF_MODE_LINEAR_ALIGNED 1
0052 #define RADEON_SURF_MODE_1D 2
0053 #define RADEON_SURF_MODE_2D 3
0054 #define RADEON_SURF_SCANOUT (1 << 16)
0055 #define RADEON_SURF_ZBUFFER (1 << 17)
0056 #define RADEON_SURF_SBUFFER (1 << 18)
0057 #define RADEON_SURF_Z_OR_SBUFFER (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)
0058 #define RADEON_SURF_HAS_SBUFFER_MIPTREE (1 << 19)
0059 #define RADEON_SURF_HAS_TILE_MODE_INDEX (1 << 20)
0060 #define RADEON_SURF_FMASK (1 << 21)
0061
0062 #define RADEON_SURF_GET(v, field) (((v) >> RADEON_SURF_ ## field ## _SHIFT) & RADEON_SURF_ ## field ## _MASK)
0063 #define RADEON_SURF_SET(v, field) (((v) & RADEON_SURF_ ## field ## _MASK) << RADEON_SURF_ ## field ## _SHIFT)
0064 #define RADEON_SURF_CLR(v, field) ((v) & ~(RADEON_SURF_ ## field ## _MASK << RADEON_SURF_ ## field ## _SHIFT))
0065
0066
0067
0068
0069 struct radeon_surface_level {
0070 uint64_t offset;
0071 uint64_t slice_size;
0072 uint32_t npix_x;
0073 uint32_t npix_y;
0074 uint32_t npix_z;
0075 uint32_t nblk_x;
0076 uint32_t nblk_y;
0077 uint32_t nblk_z;
0078 uint32_t pitch_bytes;
0079 uint32_t mode;
0080 };
0081
0082 enum si_tiling_mode {
0083 SI_TILING_AUTO = 0,
0084
0085 SI_TILING_COLOR_1D,
0086 SI_TILING_COLOR_1D_SCANOUT,
0087 SI_TILING_COLOR_2D_8BPP,
0088 SI_TILING_COLOR_2D_16BPP,
0089 SI_TILING_COLOR_2D_32BPP,
0090 SI_TILING_COLOR_2D_64BPP,
0091 SI_TILING_COLOR_2D_SCANOUT_16BPP,
0092 SI_TILING_COLOR_2D_SCANOUT_32BPP,
0093 SI_TILING_COLOR_LINEAR,
0094
0095 SI_TILING_STENCIL_1D,
0096 SI_TILING_STENCIL_2D,
0097 SI_TILING_STENCIL_2D_2AA,
0098 SI_TILING_STENCIL_2D_4AA,
0099 SI_TILING_STENCIL_2D_8AA,
0100
0101 SI_TILING_DEPTH_1D,
0102 SI_TILING_DEPTH_2D,
0103 SI_TILING_DEPTH_2D_2AA,
0104 SI_TILING_DEPTH_2D_4AA,
0105 SI_TILING_DEPTH_2D_8AA,
0106
0107 SI_TILING_LAST_MODE,
0108 };
0109
0110 struct radeon_surface {
0111 uint32_t npix_x;
0112 uint32_t npix_y;
0113 uint32_t npix_z;
0114 uint32_t blk_w;
0115 uint32_t blk_h;
0116 uint32_t blk_d;
0117 uint32_t array_size;
0118 uint32_t last_level;
0119 uint32_t bpe;
0120 uint32_t nsamples;
0121 uint32_t flags;
0122
0123
0124
0125
0126
0127 uint64_t bo_size;
0128 uint64_t bo_alignment;
0129
0130 uint32_t bankw;
0131 uint32_t bankh;
0132 uint32_t mtilea;
0133 uint32_t tile_split;
0134 uint32_t stencil_tile_split;
0135 uint64_t stencil_offset;
0136 struct radeon_surface_level level[RADEON_SURF_MAX_LEVEL];
0137 struct radeon_surface_level stencil_level[RADEON_SURF_MAX_LEVEL];
0138 uint32_t tiling_index[RADEON_SURF_MAX_LEVEL];
0139 uint32_t stencil_tiling_index[RADEON_SURF_MAX_LEVEL];
0140 };
0141
0142 struct radeon_surface_manager *radeon_surface_manager_new(int fd);
0143 void radeon_surface_manager_free(struct radeon_surface_manager *surf_man);
0144 int radeon_surface_init(struct radeon_surface_manager *surf_man,
0145 struct radeon_surface *surf);
0146 int radeon_surface_best(struct radeon_surface_manager *surf_man,
0147 struct radeon_surface *surf);
0148
0149 #endif