1125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie 2125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie#ifndef _RADEON_CS_INT_H_ 3125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie#define _RADEON_CS_INT_H_ 4125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie 5125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airliestruct radeon_cs_space_check { 6125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie struct radeon_bo_int *bo; 7125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie uint32_t read_domains; 8125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie uint32_t write_domain; 9125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie uint32_t new_accounted; 10125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie}; 11125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie 12125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airliestruct radeon_cs_int { 13125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie /* keep first two in same place */ 14125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie uint32_t *packets; 15125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie unsigned cdw; 16125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie unsigned ndw; 17125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie unsigned section_ndw; 18125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie unsigned section_cdw; 19125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie /* private members */ 20125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie struct radeon_cs_manager *csm; 21125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie void *relocs; 22125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie unsigned crelocs; 23125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie unsigned relocs_total_size; 24125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie const char *section_file; 25125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie const char *section_func; 26125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie int section_line; 27125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie struct radeon_cs_space_check bos[MAX_SPACE_BOS]; 28125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie int bo_count; 29125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie void (*space_flush_fn)(void *); 30125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie void *space_flush_data; 31966c9907c040b4fe4b288b4a9d82598797aee743Pauli Nieminen uint32_t id; 32125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie}; 33125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie 34125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie/* cs functions */ 35125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airliestruct radeon_cs_funcs { 36125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie struct radeon_cs_int *(*cs_create)(struct radeon_cs_manager *csm, 37125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie uint32_t ndw); 38125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie int (*cs_write_reloc)(struct radeon_cs_int *cs, 39125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie struct radeon_bo *bo, 40125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie uint32_t read_domain, 41125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie uint32_t write_domain, 42125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie uint32_t flags); 43125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie int (*cs_begin)(struct radeon_cs_int *cs, 44125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie uint32_t ndw, 45125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie const char *file, 46125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie const char *func, 47125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie int line); 48125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie int (*cs_end)(struct radeon_cs_int *cs, 49125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie const char *file, const char *func, 50125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie int line); 51125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie 52125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie 53125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie int (*cs_emit)(struct radeon_cs_int *cs); 54125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie int (*cs_destroy)(struct radeon_cs_int *cs); 55125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie int (*cs_erase)(struct radeon_cs_int *cs); 56125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie int (*cs_need_flush)(struct radeon_cs_int *cs); 57125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie void (*cs_print)(struct radeon_cs_int *cs, FILE *file); 58125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie}; 59125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie 60125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airliestruct radeon_cs_manager { 61125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie struct radeon_cs_funcs *funcs; 62125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie int fd; 63125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie int32_t vram_limit, gart_limit; 64125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie int32_t vram_write_used, gart_write_used; 65125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie int32_t read_used; 66125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie}; 67125994ab30d4f0f126c62fa741ec62a52d69d7a8Dave Airlie#endif 68