libdrm: NOTE! Default branch is now main
[libdrm.git] / radeon / radeon_cs.c
blob1132d069095458271164bf79ceac8f7d96e5e27b
1 #include "libdrm_macros.h"
2 #include <stdio.h>
3 #include "radeon_cs.h"
4 #include "radeon_cs_int.h"
6 drm_public struct radeon_cs *
7 radeon_cs_create(struct radeon_cs_manager *csm, uint32_t ndw)
9 struct radeon_cs_int *csi = csm->funcs->cs_create(csm, ndw);
10 return (struct radeon_cs *)csi;
13 drm_public int
14 radeon_cs_write_reloc(struct radeon_cs *cs, struct radeon_bo *bo,
15 uint32_t read_domain, uint32_t write_domain,
16 uint32_t flags)
18 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
20 return csi->csm->funcs->cs_write_reloc(csi,
21 bo,
22 read_domain,
23 write_domain,
24 flags);
27 drm_public int
28 radeon_cs_begin(struct radeon_cs *cs, uint32_t ndw,
29 const char *file, const char *func, int line)
31 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
32 return csi->csm->funcs->cs_begin(csi, ndw, file, func, line);
35 drm_public int
36 radeon_cs_end(struct radeon_cs *cs,
37 const char *file, const char *func, int line)
39 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
40 return csi->csm->funcs->cs_end(csi, file, func, line);
43 drm_public int radeon_cs_emit(struct radeon_cs *cs)
45 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
46 return csi->csm->funcs->cs_emit(csi);
49 drm_public int radeon_cs_destroy(struct radeon_cs *cs)
51 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
52 return csi->csm->funcs->cs_destroy(csi);
55 drm_public int radeon_cs_erase(struct radeon_cs *cs)
57 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
58 return csi->csm->funcs->cs_erase(csi);
61 drm_public int radeon_cs_need_flush(struct radeon_cs *cs)
63 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
64 return csi->csm->funcs->cs_need_flush(csi);
67 drm_public void radeon_cs_print(struct radeon_cs *cs, FILE *file)
69 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
70 csi->csm->funcs->cs_print(csi, file);
73 drm_public void
74 radeon_cs_set_limit(struct radeon_cs *cs, uint32_t domain, uint32_t limit)
76 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
77 if (domain == RADEON_GEM_DOMAIN_VRAM)
78 csi->csm->vram_limit = limit;
79 else
80 csi->csm->gart_limit = limit;
83 drm_public void radeon_cs_space_set_flush(struct radeon_cs *cs,
84 void (*fn)(void *), void *data)
86 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
87 csi->space_flush_fn = fn;
88 csi->space_flush_data = data;
91 drm_public uint32_t radeon_cs_get_id(struct radeon_cs *cs)
93 struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
94 return csi->id;