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