summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2007-02-16 20:22:24 +0100
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2007-02-16 20:22:24 +0100
commite0f53e59be4b96ed6eb28bd2df9f6a9d789d1734 (patch)
tree3989201a990ef5ab87b31da3655109c6c30cfbea /linux-core
parent7766378d97323de375687285f2e125008b79045d (diff)
Simple fence object sample driver for via, based on idling the GPU.
Buffer object driver for via. Some changes to buffer object driver callbacks. Improve fence flushing.
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/Makefile.kernel4
-rw-r--r--linux-core/drm_bo.c11
-rw-r--r--linux-core/drm_fence.c15
-rw-r--r--linux-core/drm_objects.h4
-rw-r--r--linux-core/i915_buffer.c8
-rw-r--r--linux-core/i915_drv.c2
6 files changed, 25 insertions, 19 deletions
diff --git a/linux-core/Makefile.kernel b/linux-core/Makefile.kernel
index c2bfb671..08c0fb2a 100644
--- a/linux-core/Makefile.kernel
+++ b/linux-core/Makefile.kernel
@@ -29,8 +29,8 @@ sis-objs := sis_drv.o sis_mm.o
ffb-objs := ffb_drv.o ffb_context.o
savage-objs := savage_drv.o savage_bci.o savage_state.o
via-objs := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o \
- via_video.o via_dmablit.o
-mach64-objs := mach64_drv.o mach64_dma.o mach64_irq.o mach64_state.o
+ via_video.o via_dmablit.o via_fence.o via_buffer.o
+mach64-objs := mach64_drv.o mach64_dma.o mach64_irq.o mach64_state.o
nv-objs := nv_drv.o
ifeq ($(CONFIG_COMPAT),y)
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index 8fc2a30e..548ce14f 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -641,7 +641,7 @@ static int drm_bo_evict(drm_buffer_object_t * bo, unsigned mem_type,
}
evict_mem = bo->mem;
- evict_mem.mask = dev->driver->bo_driver->evict_flags(dev, mem_type);
+ evict_mem.mask = dev->driver->bo_driver->evict_mask(bo);
ret = drm_bo_mem_space(bo, &evict_mem, no_wait);
if (ret) {
@@ -1351,7 +1351,7 @@ static int drm_buffer_object_validate(drm_buffer_object_t * bo,
DRM_DEBUG("New flags 0x%08x, Old flags 0x%08x\n", bo->mem.mask,
bo->mem.flags);
ret =
- driver->fence_type(bo->mem.mask, &bo->fence_class, &bo->fence_type);
+ driver->fence_type(bo, &bo->fence_class, &bo->fence_type);
if (ret) {
DRM_ERROR("Driver did not support given buffer permissions\n");
return ret;
@@ -2001,9 +2001,9 @@ static int drm_bo_lock_mm(drm_device_t * dev, unsigned mem_type)
return ret;
}
-static int drm_bo_init_mm(drm_device_t * dev,
- unsigned type,
- unsigned long p_offset, unsigned long p_size)
+int drm_bo_init_mm(drm_device_t * dev,
+ unsigned type,
+ unsigned long p_offset, unsigned long p_size)
{
drm_buffer_manager_t *bm = &dev->bm;
int ret = -EINVAL;
@@ -2043,6 +2043,7 @@ static int drm_bo_init_mm(drm_device_t * dev,
return 0;
}
+EXPORT_SYMBOL(drm_bo_init_mm);
/*
* This is called from lastclose, so we don't need to bother about
diff --git a/linux-core/drm_fence.c b/linux-core/drm_fence.c
index 634cf4f7..3e17a16d 100644
--- a/linux-core/drm_fence.c
+++ b/linux-core/drm_fence.c
@@ -91,6 +91,11 @@ void drm_fence_handler(drm_device_t * dev, uint32_t class,
}
+ fc->pending_flush &= ~type;
+ if (fc->pending_exe_flush && (type & DRM_FENCE_TYPE_EXE) &&
+ ((sequence - fc->exe_flush_sequence) < driver->wrap_diff))
+ fc->pending_exe_flush = 0;
+
if (wake) {
DRM_WAKEUP(&fc->fence_queue);
}
@@ -180,7 +185,7 @@ static void drm_fence_flush_exe(drm_fence_class_manager_t * fc,
*/
list = &fc->ring;
- if (list->next == &fc->ring) {
+ if (list_empty(list)) {
return;
} else {
drm_fence_object_t *fence =
@@ -279,7 +284,8 @@ EXPORT_SYMBOL(drm_fence_flush_old);
static int drm_fence_lazy_wait(drm_device_t *dev,
drm_fence_object_t *fence,
- int ignore_signals, uint32_t mask)
+ int ignore_signals,
+ uint32_t mask)
{
drm_fence_manager_t *fm = &dev->fm;
drm_fence_class_manager_t *fc = &fm->class[fence->class];
@@ -289,7 +295,7 @@ static int drm_fence_lazy_wait(drm_device_t *dev,
do {
DRM_WAIT_ON(ret, fc->fence_queue, 3 * DRM_HZ,
- fence_signaled(dev, fence, mask, 1));
+ fence_signaled(dev, fence, mask, 0));
if (time_after_eq(jiffies, _end))
break;
} while (ret == -EINTR && ignore_signals);
@@ -352,10 +358,9 @@ int drm_fence_object_wait(drm_device_t * dev,
return ret;
}
}
- if (fence_signaled(dev, fence, mask, 0))
+ if (drm_fence_object_signaled(fence, mask))
return 0;
- DRM_ERROR("Busy wait\n");
/*
* Avoid kernel-space busy-waits.
*/
diff --git a/linux-core/drm_objects.h b/linux-core/drm_objects.h
index 547de6b4..98228ada 100644
--- a/linux-core/drm_objects.h
+++ b/linux-core/drm_objects.h
@@ -411,11 +411,11 @@ typedef struct drm_bo_driver {
uint32_t num_mem_busy_prio;
drm_ttm_backend_t *(*create_ttm_backend_entry)
(struct drm_device * dev);
- int (*fence_type) (uint32_t flags, uint32_t * class, uint32_t * type);
+ int (*fence_type) (struct drm_buffer_object *bo, uint32_t * class, uint32_t * type);
int (*invalidate_caches) (struct drm_device * dev, uint32_t flags);
int (*init_mem_type) (struct drm_device * dev, uint32_t type,
drm_mem_type_manager_t * man);
- uint32_t(*evict_flags) (struct drm_device * dev, uint32_t type);
+ uint32_t(*evict_mask) (struct drm_buffer_object *bo);
int (*move) (struct drm_buffer_object * bo,
int evict, int no_wait, struct drm_bo_mem_reg * new_mem);
} drm_bo_driver_t;
diff --git a/linux-core/i915_buffer.c b/linux-core/i915_buffer.c
index 2cb0dc5f..8797de89 100644
--- a/linux-core/i915_buffer.c
+++ b/linux-core/i915_buffer.c
@@ -38,10 +38,10 @@ drm_ttm_backend_t *i915_create_ttm_backend_entry(drm_device_t * dev)
return drm_agp_init_ttm(dev, NULL);
}
-int i915_fence_types(uint32_t buffer_flags, uint32_t * class, uint32_t * type)
+int i915_fence_types(drm_buffer_object_t *bo, uint32_t * class, uint32_t * type)
{
*class = 0;
- if (buffer_flags & (DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE))
+ if (bo->mem.flags & (DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE))
*type = 3;
else
*type = 1;
@@ -106,9 +106,9 @@ int i915_init_mem_type(drm_device_t * dev, uint32_t type,
return 0;
}
-uint32_t i915_evict_flags(drm_device_t * dev, uint32_t type)
+uint32_t i915_evict_mask(drm_buffer_object_t *bo)
{
- switch (type) {
+ switch (bo->mem.mem_type) {
case DRM_BO_MEM_LOCAL:
case DRM_BO_MEM_TT:
return DRM_BO_FLAG_MEM_LOCAL;
diff --git a/linux-core/i915_drv.c b/linux-core/i915_drv.c
index 33daf480..56e5998f 100644
--- a/linux-core/i915_drv.c
+++ b/linux-core/i915_drv.c
@@ -64,7 +64,7 @@ static drm_bo_driver_t i915_bo_driver = {
.fence_type = i915_fence_types,
.invalidate_caches = i915_invalidate_caches,
.init_mem_type = i915_init_mem_type,
- .evict_flags = i915_evict_flags,
+ .evict_mask = i915_evict_mask,
.move = i915_move,
};
#endif