1e6188e58Smrg#include "libdrm_macros.h"
222944501Smrg#include <stdio.h>
322944501Smrg#include "radeon_cs.h"
422944501Smrg#include "radeon_cs_int.h"
522944501Smrg
67cdc0497Smrgdrm_public struct radeon_cs *
7baaff307Smrgradeon_cs_create(struct radeon_cs_manager *csm, uint32_t ndw)
822944501Smrg{
922944501Smrg    struct radeon_cs_int *csi = csm->funcs->cs_create(csm, ndw);
1022944501Smrg    return (struct radeon_cs *)csi;
1122944501Smrg}
1222944501Smrg
137cdc0497Smrgdrm_public int
14baaff307Smrgradeon_cs_write_reloc(struct radeon_cs *cs, struct radeon_bo *bo,
15baaff307Smrg                      uint32_t read_domain, uint32_t write_domain,
16baaff307Smrg                      uint32_t flags)
1722944501Smrg{
1822944501Smrg    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
1922944501Smrg
2022944501Smrg    return csi->csm->funcs->cs_write_reloc(csi,
2122944501Smrg                                           bo,
2222944501Smrg                                           read_domain,
2322944501Smrg                                           write_domain,
2422944501Smrg                                           flags);
2522944501Smrg}
2622944501Smrg
277cdc0497Smrgdrm_public int
28baaff307Smrgradeon_cs_begin(struct radeon_cs *cs, uint32_t ndw,
29baaff307Smrg                const char *file, const char *func, int line)
3022944501Smrg{
3122944501Smrg    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
3222944501Smrg    return csi->csm->funcs->cs_begin(csi, ndw, file, func, line);
3322944501Smrg}
3422944501Smrg
357cdc0497Smrgdrm_public int
36baaff307Smrgradeon_cs_end(struct radeon_cs *cs,
37baaff307Smrg              const char *file, const char *func, int line)
3822944501Smrg{
3922944501Smrg    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
4022944501Smrg    return csi->csm->funcs->cs_end(csi, file, func, line);
4122944501Smrg}
4222944501Smrg
437cdc0497Smrgdrm_public int radeon_cs_emit(struct radeon_cs *cs)
4422944501Smrg{
4522944501Smrg    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
4622944501Smrg    return csi->csm->funcs->cs_emit(csi);
4722944501Smrg}
4822944501Smrg
497cdc0497Smrgdrm_public int radeon_cs_destroy(struct radeon_cs *cs)
5022944501Smrg{
5122944501Smrg    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
5222944501Smrg    return csi->csm->funcs->cs_destroy(csi);
5322944501Smrg}
5422944501Smrg
557cdc0497Smrgdrm_public int radeon_cs_erase(struct radeon_cs *cs)
5622944501Smrg{
5722944501Smrg    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
5822944501Smrg    return csi->csm->funcs->cs_erase(csi);
5922944501Smrg}
6022944501Smrg
617cdc0497Smrgdrm_public int radeon_cs_need_flush(struct radeon_cs *cs)
6222944501Smrg{
6322944501Smrg    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
6422944501Smrg    return csi->csm->funcs->cs_need_flush(csi);
6522944501Smrg}
6622944501Smrg
677cdc0497Smrgdrm_public void radeon_cs_print(struct radeon_cs *cs, FILE *file)
6822944501Smrg{
6922944501Smrg    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
7022944501Smrg    csi->csm->funcs->cs_print(csi, file);
7122944501Smrg}
7222944501Smrg
737cdc0497Smrgdrm_public void
74baaff307Smrgradeon_cs_set_limit(struct radeon_cs *cs, uint32_t domain, uint32_t limit)
7522944501Smrg{
7622944501Smrg    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
7722944501Smrg    if (domain == RADEON_GEM_DOMAIN_VRAM)
7822944501Smrg        csi->csm->vram_limit = limit;
7922944501Smrg    else
8022944501Smrg        csi->csm->gart_limit = limit;
8122944501Smrg}
8222944501Smrg
837cdc0497Smrgdrm_public void radeon_cs_space_set_flush(struct radeon_cs *cs,
84baaff307Smrg                                          void (*fn)(void *), void *data)
8522944501Smrg{
8622944501Smrg    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
8722944501Smrg    csi->space_flush_fn = fn;
8822944501Smrg    csi->space_flush_data = data;
8922944501Smrg}
9022944501Smrg
917cdc0497Smrgdrm_public uint32_t radeon_cs_get_id(struct radeon_cs *cs)
9222944501Smrg{
9322944501Smrg    struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
9422944501Smrg    return csi->id;
9522944501Smrg}
96