summaryrefslogtreecommitdiff
path: root/src/radeon_kms.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-07-06 14:45:07 +1000
committerDave Airlie <airlied@redhat.com>2009-07-06 15:11:15 +1000
commitd78d50591851d14543f0935d051a59ef29751bbc (patch)
tree973a85b4d6df847813a50e9dcb4f2fe94e689bc7 /src/radeon_kms.c
parente1200cb89218930d01330ba0114e013438655cce (diff)
radeon: port to new space checking in libdrm interface
This uses a new libdrm interface which shares code with mesa. It also fixes the bo to flush when full instead of never flushing. It survives gtkperf -a here which the driver didn't before now
Diffstat (limited to 'src/radeon_kms.c')
-rw-r--r--src/radeon_kms.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index cd3ec9a6..7ecfe88c 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -70,6 +70,34 @@ const OptionInfoRec RADEONOptions_KMS[] = {
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
+void radeon_cs_flush_indirect(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ if (!info->cs->cdw)
+ return;
+ radeon_cs_emit(info->cs);
+ radeon_cs_erase(info->cs);
+}
+
+void radeon_ddx_cs_start(ScrnInfoPtr pScrn,
+ int n, const char *file,
+ const char *func, int line)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ int ret;
+
+ if (info->cs->cdw + n > info->cs->ndw) {
+ radeon_cs_flush_indirect(pScrn);
+ ret = radeon_cs_space_check(info->cs);
+ if (ret)
+ ErrorF("space check failed in DDX CS start %s:%s:%d\n",
+ file, func, line);
+ }
+ radeon_cs_begin(info->cs, n, file, func, line);
+}
+
+
extern _X_EXPORT int gRADEONEntityIndex;
static int getRADEONEntityIndex(void)
@@ -532,6 +560,7 @@ Bool RADEONScreenInit_KMS(int scrnIndex, ScreenPtr pScreen,
}
radeon_cs_set_limit(info->cs, RADEON_GEM_DOMAIN_GTT, info->gart_size);
+ radeon_cs_space_set_flush(info->cs, (void(*)(void *))radeon_cs_flush_indirect, pScrn);
radeon_setup_kernel_mem(pScreen);
front_ptr = info->front_bo->ptr;