From b1f0b2d960a8f488332652677073ab95ce72cd3f Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@linux.ie>
Date: Sun, 1 Apr 2007 18:24:23 +1000
Subject: radeon: de-static irq function, fixup fence/buffer

---
 linux-core/radeon_buffer.c | 23 ++++++++++-------------
 linux-core/radeon_fence.c  |  9 +++------
 2 files changed, 13 insertions(+), 19 deletions(-)

(limited to 'linux-core')

diff --git a/linux-core/radeon_buffer.c b/linux-core/radeon_buffer.c
index 796191c1..b525ddfa 100644
--- a/linux-core/radeon_buffer.c
+++ b/linux-core/radeon_buffer.c
@@ -51,20 +51,13 @@ int radeon_fence_types(drm_buffer_object_t *bo, uint32_t * class, uint32_t * typ
 
 int radeon_invalidate_caches(drm_device_t * dev, uint32_t flags)
 {
-	/*
-	 * FIXME: Only emit once per batchbuffer submission.
-	 */
-#if 0
-	uint32_t flush_cmd = MI_NO_WRITE_FLUSH;
+	drm_radeon_private_t *dev_priv = dev->dev_private;
+	RING_LOCALS;
 
-	if (flags & DRM_BO_FLAG_READ)
-		flush_cmd |= MI_READ_FLUSH;
-	if (flags & DRM_BO_FLAG_EXE)
-		flush_cmd |= MI_EXE_FLUSH;
-
-	return 0;
-//	return radeon_emit_mi_flush(dev, flush_cmd);
-#endif
+	BEGIN_RING(4);
+	RADEON_FLUSH_CACHE();
+	RADEON_FLUSH_ZCACHE();
+	ADVANCE_RING();
 	return 0;
 }
 
@@ -111,7 +104,11 @@ int radeon_init_mem_type(drm_device_t * dev, uint32_t type,
 int radeon_move(drm_buffer_object_t * bo,
 		int evict, int no_wait, drm_bo_mem_reg_t * new_mem)
 {
+	drm_bo_mem_reg_t *old_mem = &bo->mem;
 
+	if (old_mem->mem_type == DRM_BO_MEM_LOCAL) {
+		return drm_bo_move_memcpy(bo, evict, no_wait, new_mem);
+	}
 	return 0;
 }
 
diff --git a/linux-core/radeon_fence.c b/linux-core/radeon_fence.c
index 57b318af..7de3650d 100644
--- a/linux-core/radeon_fence.c
+++ b/linux-core/radeon_fence.c
@@ -45,10 +45,6 @@ static void radeon_perform_flush(drm_device_t * dev)
 	drm_fence_class_manager_t *fc = &dev->fm.class[0];
 	drm_fence_driver_t *driver = dev->driver->fence_driver;
 	uint32_t pending_flush_types = 0;
-	uint32_t flush_flags = 0;
-	uint32_t flush_sequence = 0;
-	uint32_t i_status;
-	uint32_t diff;
 	uint32_t sequence;
 
 	if (!dev_priv)
@@ -58,8 +54,9 @@ static void radeon_perform_flush(drm_device_t * dev)
 		((fc->pending_exe_flush) ? DRM_FENCE_TYPE_EXE : 0);
 
 	if (pending_flush_types) {
-		drm_fence_handler(dev, 0, 0,0);
-
+		sequence = READ_BREADCRUMB(dev_priv);
+					     
+		drm_fence_handler(dev, 0, sequence, pending_flush_types);
 	}
 
 	return;
-- 
cgit v1.2.3