2014-07-31 07:39:15 -06:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
#include "libdrm.h"
|
2009-12-16 21:11:55 -07:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "radeon_cs.h"
|
|
|
|
#include "radeon_cs_int.h"
|
|
|
|
|
2014-07-31 07:39:15 -06:00
|
|
|
drm_public struct radeon_cs *
|
|
|
|
radeon_cs_create(struct radeon_cs_manager *csm, uint32_t ndw)
|
2009-12-16 21:11:55 -07:00
|
|
|
{
|
|
|
|
struct radeon_cs_int *csi = csm->funcs->cs_create(csm, ndw);
|
|
|
|
return (struct radeon_cs *)csi;
|
|
|
|
}
|
|
|
|
|
2014-07-31 07:39:15 -06:00
|
|
|
drm_public int
|
|
|
|
radeon_cs_write_reloc(struct radeon_cs *cs, struct radeon_bo *bo,
|
|
|
|
uint32_t read_domain, uint32_t write_domain,
|
|
|
|
uint32_t flags)
|
2009-12-16 21:11:55 -07:00
|
|
|
{
|
|
|
|
struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
|
|
|
|
|
|
|
|
return csi->csm->funcs->cs_write_reloc(csi,
|
2010-01-14 03:28:25 -07:00
|
|
|
bo,
|
|
|
|
read_domain,
|
|
|
|
write_domain,
|
|
|
|
flags);
|
2009-12-16 21:11:55 -07:00
|
|
|
}
|
|
|
|
|
2014-07-31 07:39:15 -06:00
|
|
|
drm_public int
|
|
|
|
radeon_cs_begin(struct radeon_cs *cs, uint32_t ndw,
|
|
|
|
const char *file, const char *func, int line)
|
2009-12-16 21:11:55 -07:00
|
|
|
{
|
|
|
|
struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
|
|
|
|
return csi->csm->funcs->cs_begin(csi, ndw, file, func, line);
|
|
|
|
}
|
|
|
|
|
2014-07-31 07:39:15 -06:00
|
|
|
drm_public int
|
|
|
|
radeon_cs_end(struct radeon_cs *cs,
|
|
|
|
const char *file, const char *func, int line)
|
2009-12-16 21:11:55 -07:00
|
|
|
{
|
|
|
|
struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
|
|
|
|
return csi->csm->funcs->cs_end(csi, file, func, line);
|
|
|
|
}
|
|
|
|
|
2014-07-31 07:39:15 -06:00
|
|
|
drm_public int radeon_cs_emit(struct radeon_cs *cs)
|
2009-12-16 21:11:55 -07:00
|
|
|
{
|
|
|
|
struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
|
|
|
|
return csi->csm->funcs->cs_emit(csi);
|
|
|
|
}
|
|
|
|
|
2014-07-31 07:39:15 -06:00
|
|
|
drm_public int radeon_cs_destroy(struct radeon_cs *cs)
|
2009-12-16 21:11:55 -07:00
|
|
|
{
|
|
|
|
struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
|
|
|
|
return csi->csm->funcs->cs_destroy(csi);
|
|
|
|
}
|
|
|
|
|
2014-07-31 07:39:15 -06:00
|
|
|
drm_public int radeon_cs_erase(struct radeon_cs *cs)
|
2009-12-16 21:11:55 -07:00
|
|
|
{
|
|
|
|
struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
|
|
|
|
return csi->csm->funcs->cs_erase(csi);
|
|
|
|
}
|
|
|
|
|
2014-07-31 07:39:15 -06:00
|
|
|
drm_public int radeon_cs_need_flush(struct radeon_cs *cs)
|
2009-12-16 21:11:55 -07:00
|
|
|
{
|
|
|
|
struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
|
|
|
|
return csi->csm->funcs->cs_need_flush(csi);
|
|
|
|
}
|
|
|
|
|
2014-07-31 07:39:15 -06:00
|
|
|
drm_public void radeon_cs_print(struct radeon_cs *cs, FILE *file)
|
2009-12-16 21:11:55 -07:00
|
|
|
{
|
|
|
|
struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
|
|
|
|
csi->csm->funcs->cs_print(csi, file);
|
|
|
|
}
|
|
|
|
|
2014-07-31 07:39:15 -06:00
|
|
|
drm_public void
|
|
|
|
radeon_cs_set_limit(struct radeon_cs *cs, uint32_t domain, uint32_t limit)
|
2009-12-16 21:11:55 -07:00
|
|
|
{
|
|
|
|
struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
|
|
|
|
if (domain == RADEON_GEM_DOMAIN_VRAM)
|
2010-01-14 03:28:25 -07:00
|
|
|
csi->csm->vram_limit = limit;
|
2009-12-16 21:11:55 -07:00
|
|
|
else
|
2010-01-14 03:28:25 -07:00
|
|
|
csi->csm->gart_limit = limit;
|
2009-12-16 21:11:55 -07:00
|
|
|
}
|
|
|
|
|
2014-07-31 07:39:15 -06:00
|
|
|
drm_public void radeon_cs_space_set_flush(struct radeon_cs *cs,
|
|
|
|
void (*fn)(void *), void *data)
|
2009-12-16 21:11:55 -07:00
|
|
|
{
|
|
|
|
struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
|
|
|
|
csi->space_flush_fn = fn;
|
|
|
|
csi->space_flush_data = data;
|
|
|
|
}
|
2009-08-29 03:08:57 -06:00
|
|
|
|
2014-07-31 07:39:15 -06:00
|
|
|
drm_public uint32_t radeon_cs_get_id(struct radeon_cs *cs)
|
2009-08-29 03:08:57 -06:00
|
|
|
{
|
|
|
|
struct radeon_cs_int *csi = (struct radeon_cs_int *)cs;
|
|
|
|
return csi->id;
|
|
|
|
}
|