Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/freedreno/common/freedreno_dev_info.h
4565 views
1
/*
2
* Copyright © 2020 Valve Corporation
3
*
4
* Permission is hereby granted, free of charge, to any person obtaining a
5
* copy of this software and associated documentation files (the "Software"),
6
* to deal in the Software without restriction, including without limitation
7
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
* and/or sell copies of the Software, and to permit persons to whom the
9
* Software is furnished to do so, subject to the following conditions:
10
*
11
* The above copyright notice and this permission notice (including the next
12
* paragraph) shall be included in all copies or substantial portions of the
13
* Software.
14
*
15
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21
* IN THE SOFTWARE.
22
*
23
*/
24
25
#ifndef FREEDRENO_DEVICE_INFO_H
26
#define FREEDRENO_DEVICE_INFO_H
27
28
#include <stdbool.h>
29
#include <stdint.h>
30
31
#ifdef __cplusplus
32
extern "C" {
33
#endif
34
35
/**
36
* Freedreno hardware description and quirks
37
*/
38
39
struct fd_dev_info {
40
/* alignment for size of tiles */
41
uint32_t tile_align_w, tile_align_h;
42
/* gmem load/store granularity */
43
uint32_t gmem_align_w, gmem_align_h;
44
/* max tile size */
45
uint32_t tile_max_w, tile_max_h;
46
47
uint32_t num_vsc_pipes;
48
49
/* number of CCU is always equal to the number of SP */
50
union {
51
uint32_t num_sp_cores;
52
uint32_t num_ccu;
53
};
54
55
union {
56
struct {
57
/* Information for private memory calculations */
58
uint32_t fibers_per_sp;
59
60
uint32_t reg_size_vec4;
61
62
/* Whether the PC_MULTIVIEW_MASK register exists. */
63
bool supports_multiview_mask;
64
65
/* info for setting RB_CCU_CNTL */
66
bool ccu_cntl_gmem_unk2;
67
bool has_z24uint_s8uint;
68
69
bool tess_use_shared;
70
71
/* newer a6xx allows using 16-bit descriptor for both 16-bit
72
* and 32-bit access
73
*/
74
bool storage_16bit;
75
76
/* The latest known a630_sqe.fw fails to wait for WFI before
77
* reading the indirect buffer when using CP_DRAW_INDIRECT_MULTI,
78
* so we have to fall back to CP_WAIT_FOR_ME except for a650
79
* which has a fixed firmware.
80
*
81
* TODO: There may be newer a630_sqe.fw released in the future
82
* which fixes this, if so we should detect it and avoid this
83
* workaround. Once we have uapi to query fw version, we can
84
* replace this with minimum fw version.
85
*/
86
bool indirect_draw_wfm_quirk;
87
88
bool has_tex_filter_cubic;
89
90
bool has_sample_locations;
91
92
/* The firmware on newer a6xx drops CP_REG_WRITE support as we
93
* can now use direct register writes for these regs.
94
*/
95
bool has_cp_reg_write;
96
97
bool has_8bpp_ubwc;
98
99
struct {
100
uint32_t RB_UNKNOWN_8E04_blit;
101
uint32_t PC_UNKNOWN_9805;
102
uint32_t SP_UNKNOWN_A0F8;
103
} magic;
104
} a6xx;
105
};
106
};
107
108
struct fd_dev_id {
109
uint32_t gpu_id;
110
const char *name;
111
const struct fd_dev_info *info;
112
};
113
114
/* per CCU GMEM amount reserved for depth cache for direct rendering */
115
#define A6XX_CCU_DEPTH_SIZE (64 * 1024)
116
/* per CCU GMEM amount reserved for color cache used by GMEM resolves
117
* which require color cache (non-BLIT event case).
118
* this is smaller than what is normally used by direct rendering
119
* (RB_CCU_CNTL.GMEM bit enables this smaller size)
120
* if a GMEM resolve requires color cache, the driver needs to make sure
121
* it will not overwrite pixel data in GMEM that is still needed
122
*/
123
#define A6XX_CCU_GMEM_COLOR_SIZE (16 * 1024)
124
125
const struct fd_dev_info * fd_dev_info(uint32_t gpu_id);
126
const char * fd_dev_name(uint32_t gpu_id);
127
128
#ifdef __cplusplus
129
} /* end of extern "C" */
130
#endif
131
132
#endif /* FREEDRENO_DEVICE_INFO_H */
133
134