radeon_cs.c revision 22944501
1 2#include <stdio.h> 3#include "radeon_cs.h" 4#include "radeon_cs_int.h" 5 6struct radeon_cs *radeon_cs_create(struct radeon_cs_manager *csm, uint32_t ndw) 7{ 8 struct radeon_cs_int *csi = csm->funcs->cs_create(csm, ndw); 9 return (struct radeon_cs *)csi; 10} 11 12int radeon_cs_write_reloc(struct radeon_cs *cs, 13 struct radeon_bo *bo, 14 uint32_t read_domain, 15 uint32_t write_domain, 16 uint32_t flags) 17{ 18 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; 19 20 return csi->csm->funcs->cs_write_reloc(csi, 21 bo, 22 read_domain, 23 write_domain, 24 flags); 25} 26 27int radeon_cs_begin(struct radeon_cs *cs, 28 uint32_t ndw, 29 const char *file, 30 const char *func, 31 int line) 32{ 33 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; 34 return csi->csm->funcs->cs_begin(csi, ndw, file, func, line); 35} 36 37int radeon_cs_end(struct radeon_cs *cs, 38 const char *file, 39 const char *func, 40 int line) 41{ 42 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; 43 return csi->csm->funcs->cs_end(csi, file, func, line); 44} 45 46int radeon_cs_emit(struct radeon_cs *cs) 47{ 48 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; 49 return csi->csm->funcs->cs_emit(csi); 50} 51 52int radeon_cs_destroy(struct radeon_cs *cs) 53{ 54 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; 55 return csi->csm->funcs->cs_destroy(csi); 56} 57 58int radeon_cs_erase(struct radeon_cs *cs) 59{ 60 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; 61 return csi->csm->funcs->cs_erase(csi); 62} 63 64int radeon_cs_need_flush(struct radeon_cs *cs) 65{ 66 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; 67 return csi->csm->funcs->cs_need_flush(csi); 68} 69 70void radeon_cs_print(struct radeon_cs *cs, FILE *file) 71{ 72 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; 73 csi->csm->funcs->cs_print(csi, file); 74} 75 76void radeon_cs_set_limit(struct radeon_cs *cs, uint32_t domain, uint32_t limit) 77{ 78 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; 79 if (domain == RADEON_GEM_DOMAIN_VRAM) 80 csi->csm->vram_limit = limit; 81 else 82 csi->csm->gart_limit = limit; 83} 84 85void radeon_cs_space_set_flush(struct radeon_cs *cs, void (*fn)(void *), void *data) 86{ 87 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; 88 csi->space_flush_fn = fn; 89 csi->space_flush_data = data; 90} 91 92uint32_t radeon_cs_get_id(struct radeon_cs *cs) 93{ 94 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; 95 return csi->id; 96} 97