xref: /aosp_15_r20/external/libdrm/radeon/radeon_cs_int.h (revision 7688df22e49036ff52a766b7101da3a49edadb8c)
1*7688df22SAndroid Build Coastguard Worker 
2*7688df22SAndroid Build Coastguard Worker #ifndef _RADEON_CS_INT_H_
3*7688df22SAndroid Build Coastguard Worker #define _RADEON_CS_INT_H_
4*7688df22SAndroid Build Coastguard Worker 
5*7688df22SAndroid Build Coastguard Worker struct radeon_cs_space_check {
6*7688df22SAndroid Build Coastguard Worker     struct radeon_bo_int *bo;
7*7688df22SAndroid Build Coastguard Worker     uint32_t read_domains;
8*7688df22SAndroid Build Coastguard Worker     uint32_t write_domain;
9*7688df22SAndroid Build Coastguard Worker     uint32_t new_accounted;
10*7688df22SAndroid Build Coastguard Worker };
11*7688df22SAndroid Build Coastguard Worker 
12*7688df22SAndroid Build Coastguard Worker struct radeon_cs_int {
13*7688df22SAndroid Build Coastguard Worker     /* keep first two in same place */
14*7688df22SAndroid Build Coastguard Worker     uint32_t                    *packets;
15*7688df22SAndroid Build Coastguard Worker     unsigned                    cdw;
16*7688df22SAndroid Build Coastguard Worker     unsigned                    ndw;
17*7688df22SAndroid Build Coastguard Worker     unsigned                    section_ndw;
18*7688df22SAndroid Build Coastguard Worker     unsigned                    section_cdw;
19*7688df22SAndroid Build Coastguard Worker     /* private members */
20*7688df22SAndroid Build Coastguard Worker     struct radeon_cs_manager    *csm;
21*7688df22SAndroid Build Coastguard Worker     void                        *relocs;
22*7688df22SAndroid Build Coastguard Worker     unsigned                    crelocs;
23*7688df22SAndroid Build Coastguard Worker     unsigned                    relocs_total_size;
24*7688df22SAndroid Build Coastguard Worker     const char                  *section_file;
25*7688df22SAndroid Build Coastguard Worker     const char                  *section_func;
26*7688df22SAndroid Build Coastguard Worker     int                         section_line;
27*7688df22SAndroid Build Coastguard Worker     struct radeon_cs_space_check bos[MAX_SPACE_BOS];
28*7688df22SAndroid Build Coastguard Worker     int                         bo_count;
29*7688df22SAndroid Build Coastguard Worker     void                        (*space_flush_fn)(void *);
30*7688df22SAndroid Build Coastguard Worker     void                        *space_flush_data;
31*7688df22SAndroid Build Coastguard Worker     uint32_t                    id;
32*7688df22SAndroid Build Coastguard Worker };
33*7688df22SAndroid Build Coastguard Worker 
34*7688df22SAndroid Build Coastguard Worker /* cs functions */
35*7688df22SAndroid Build Coastguard Worker struct radeon_cs_funcs {
36*7688df22SAndroid Build Coastguard Worker     struct radeon_cs_int *(*cs_create)(struct radeon_cs_manager *csm,
37*7688df22SAndroid Build Coastguard Worker                                    uint32_t ndw);
38*7688df22SAndroid Build Coastguard Worker     int (*cs_write_reloc)(struct radeon_cs_int *cs,
39*7688df22SAndroid Build Coastguard Worker                           struct radeon_bo *bo,
40*7688df22SAndroid Build Coastguard Worker                           uint32_t read_domain,
41*7688df22SAndroid Build Coastguard Worker                           uint32_t write_domain,
42*7688df22SAndroid Build Coastguard Worker                           uint32_t flags);
43*7688df22SAndroid Build Coastguard Worker     int (*cs_begin)(struct radeon_cs_int *cs,
44*7688df22SAndroid Build Coastguard Worker                     uint32_t ndw,
45*7688df22SAndroid Build Coastguard Worker 		    const char *file,
46*7688df22SAndroid Build Coastguard Worker 		    const char *func,
47*7688df22SAndroid Build Coastguard Worker 		    int line);
48*7688df22SAndroid Build Coastguard Worker     int (*cs_end)(struct radeon_cs_int *cs,
49*7688df22SAndroid Build Coastguard Worker 		  const char *file, const char *func,
50*7688df22SAndroid Build Coastguard Worker 		  int line);
51*7688df22SAndroid Build Coastguard Worker 
52*7688df22SAndroid Build Coastguard Worker 
53*7688df22SAndroid Build Coastguard Worker     int (*cs_emit)(struct radeon_cs_int *cs);
54*7688df22SAndroid Build Coastguard Worker     int (*cs_destroy)(struct radeon_cs_int *cs);
55*7688df22SAndroid Build Coastguard Worker     int (*cs_erase)(struct radeon_cs_int *cs);
56*7688df22SAndroid Build Coastguard Worker     int (*cs_need_flush)(struct radeon_cs_int *cs);
57*7688df22SAndroid Build Coastguard Worker     void (*cs_print)(struct radeon_cs_int *cs, FILE *file);
58*7688df22SAndroid Build Coastguard Worker };
59*7688df22SAndroid Build Coastguard Worker 
60*7688df22SAndroid Build Coastguard Worker struct radeon_cs_manager {
61*7688df22SAndroid Build Coastguard Worker     const struct radeon_cs_funcs  *funcs;
62*7688df22SAndroid Build Coastguard Worker     int                     fd;
63*7688df22SAndroid Build Coastguard Worker     int32_t vram_limit, gart_limit;
64*7688df22SAndroid Build Coastguard Worker     int32_t vram_write_used, gart_write_used;
65*7688df22SAndroid Build Coastguard Worker     int32_t read_used;
66*7688df22SAndroid Build Coastguard Worker };
67*7688df22SAndroid Build Coastguard Worker #endif
68