summaryrefslogtreecommitdiff
path: root/radeon/radeon_cs_int.h
blob: 8ba76bf951752e9902509bdf2a650d6ca460602d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

#ifndef _RADEON_CS_INT_H_
#define _RADEON_CS_INT_H_

struct radeon_cs_space_check {
    struct radeon_bo_int *bo;
    uint32_t read_domains;
    uint32_t write_domain;
    uint32_t new_accounted;
};

struct radeon_cs_int {
    /* keep first two in same place */
    uint32_t                    *packets;    
    unsigned                    cdw;
    unsigned                    ndw;
    unsigned                    section_ndw;
    unsigned                    section_cdw;
    /* private members */
    struct radeon_cs_manager    *csm;
    void                        *relocs;
    unsigned                    crelocs;
    unsigned                    relocs_total_size;
    const char                  *section_file;
    const char                  *section_func;
    int                         section_line;
    struct radeon_cs_space_check bos[MAX_SPACE_BOS];
    int                         bo_count;
    void                        (*space_flush_fn)(void *);
    void                        *space_flush_data;
};

/* cs functions */
struct radeon_cs_funcs {
    struct radeon_cs_int *(*cs_create)(struct radeon_cs_manager *csm,
                                   uint32_t ndw);
    int (*cs_write_reloc)(struct radeon_cs_int *cs,
                          struct radeon_bo *bo,
                          uint32_t read_domain,
                          uint32_t write_domain,
                          uint32_t flags);
    int (*cs_begin)(struct radeon_cs_int *cs,
                    uint32_t ndw,
		    const char *file,
		    const char *func,
		    int line);
    int (*cs_end)(struct radeon_cs_int *cs,
		  const char *file, const char *func,
		  int line);


    int (*cs_emit)(struct radeon_cs_int *cs);
    int (*cs_destroy)(struct radeon_cs_int *cs);
    int (*cs_erase)(struct radeon_cs_int *cs);
    int (*cs_need_flush)(struct radeon_cs_int *cs);
    void (*cs_print)(struct radeon_cs_int *cs, FILE *file);
};

struct radeon_cs_manager {
    struct radeon_cs_funcs  *funcs;
    int                     fd;
    int32_t vram_limit, gart_limit;
    int32_t vram_write_used, gart_write_used;
    int32_t read_used;
};
#endif