[Intel-gfx] [PATCH 05/15] drm/i915: move flushing list processing to i915_retire_commands
Daniel Vetter
daniel.vetter at ffwll.ch
Thu Mar 11 16:58:50 CET 2010
... instead of threading flush_domains through the execbuf code to
i915_add_requst.
With this change 2 small cleanups are possible (linewise the majority
of the patch):
- The flush_domains parameter of i915_add_request is always 0. Drop it
and the corresponding logic.
- Dito for the seqno param of i915_gem_process_flushing_list.
Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
drivers/gpu/drm/i915/i915_drv.h | 3 +-
drivers/gpu/drm/i915/i915_gem.c | 41 +++++++++++++--------------------
drivers/gpu/drm/i915/intel_overlay.c | 14 +++++-----
3 files changed, 24 insertions(+), 34 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 9c147ab..db44e61 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -914,8 +914,7 @@ void i915_gem_cleanup_ringbuffer(struct drm_device *dev);
int i915_gem_do_init(struct drm_device *dev, unsigned long start,
unsigned long end);
int i915_gem_idle(struct drm_device *dev);
-uint32_t i915_add_request(struct drm_device *dev, struct drm_file *file_priv,
- uint32_t flush_domains);
+uint32_t i915_add_request(struct drm_device *dev, struct drm_file *file_priv);
int i915_do_wait_request(struct drm_device *dev, uint32_t seqno, int interruptible);
int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj,
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index f46f1df..734a023 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1576,8 +1576,7 @@ i915_gem_object_move_to_inactive(struct drm_gem_object *obj)
}
static void
-i915_gem_process_flushing_list(struct drm_device *dev,
- uint32_t flush_domains, uint32_t seqno)
+i915_gem_process_flushing_list(struct drm_device *dev, uint32_t flush_domains)
{
drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv, *next;
@@ -1593,7 +1592,7 @@ i915_gem_process_flushing_list(struct drm_device *dev,
obj->write_domain = 0;
list_del_init(&obj_priv->gpu_write_list);
- i915_gem_object_move_to_active(obj, seqno);
+ i915_gem_object_move_to_active(obj, 0);
/* update the fence lru list */
if (obj_priv->fence_reg != I915_FENCE_REG_NONE) {
@@ -1619,8 +1618,7 @@ i915_gem_process_flushing_list(struct drm_device *dev,
* Returned sequence numbers are nonzero on success.
*/
uint32_t
-i915_add_request(struct drm_device *dev, struct drm_file *file_priv,
- uint32_t flush_domains)
+i915_add_request(struct drm_device *dev, struct drm_file *file_priv)
{
drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_file_private *i915_file_priv = NULL;
@@ -1665,12 +1663,6 @@ i915_add_request(struct drm_device *dev, struct drm_file *file_priv,
INIT_LIST_HEAD(&request->client_list);
}
- /* Associate any objects on the flushing list matching the write
- * domain we're flushing with our request.
- */
- if (flush_domains != 0)
- i915_gem_process_flushing_list(dev, flush_domains, seqno);
-
if (!dev_priv->mm.suspended) {
mod_timer(&dev_priv->hangcheck_timer, jiffies + DRM_I915_HANGCHECK_PERIOD);
if (was_empty)
@@ -1685,22 +1677,21 @@ i915_add_request(struct drm_device *dev, struct drm_file *file_priv,
* Ensures that all commands in the ring are finished
* before signalling the CPU
*/
-static uint32_t
+static void
i915_retire_commands(struct drm_device *dev)
{
drm_i915_private_t *dev_priv = dev->dev_private;
uint32_t cmd = MI_FLUSH | MI_NO_WRITE_FLUSH;
- uint32_t flush_domains = 0;
RING_LOCALS;
- /* The sampler always gets flushed on i965 (sigh) */
- if (IS_I965G(dev))
- flush_domains |= I915_GEM_DOMAIN_SAMPLER;
BEGIN_LP_RING(2);
OUT_RING(cmd);
OUT_RING(0); /* noop */
ADVANCE_LP_RING();
- return flush_domains;
+
+ /* The sampler always gets flushed on i965 (sigh) */
+ if (IS_I965G(dev))
+ i915_gem_process_flushing_list(dev, I915_GEM_DOMAIN_SAMPLER);
}
/**
@@ -1846,7 +1837,7 @@ i915_do_wait_request(struct drm_device *dev, uint32_t seqno, int interruptible)
BUG_ON(seqno == 0);
if (seqno == dev_priv->mm.next_gem_seqno) {
- seqno = i915_add_request(dev, NULL, 0);
+ seqno = i915_add_request(dev, NULL);
if (seqno == 0)
return -ENOMEM;
}
@@ -1989,7 +1980,7 @@ i915_gem_flush(struct drm_device *dev,
* domain we're flushing with the next request.
*/
if (flush_domains != 0)
- i915_gem_process_flushing_list(dev, flush_domains, 0);
+ i915_gem_process_flushing_list(dev, flush_domains);
}
@@ -2145,7 +2136,7 @@ i915_gpu_idle(struct drm_device *dev)
/* Flush everything onto the inactive list. */
i915_gem_flush(dev, I915_GEM_GPU_DOMAINS, I915_GEM_GPU_DOMAINS);
- seqno = i915_add_request(dev, NULL, 0);
+ seqno = i915_add_request(dev, NULL);
if (seqno == 0)
return -ENOMEM;
@@ -2258,7 +2249,7 @@ i915_gem_evict_something(struct drm_device *dev, int min_size)
i915_gem_flush(dev,
obj->write_domain,
obj->write_domain);
- seqno = i915_add_request(dev, NULL, 0);
+ seqno = i915_add_request(dev, NULL);
if (seqno == 0)
return -ENOMEM;
@@ -2794,7 +2785,7 @@ i915_gem_object_flush_gpu_write_domain(struct drm_gem_object *obj)
/* Queue the GPU write cache flushing we need. */
old_write_domain = obj->write_domain;
i915_gem_flush(dev, 0, obj->write_domain);
- (void) i915_add_request(dev, NULL, 0);
+ (void) i915_add_request(dev, NULL);
BUG_ON(obj->write_domain);
trace_i915_gem_object_change_domain(obj,
@@ -3755,7 +3746,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
struct drm_i915_gem_relocation_entry *relocs = NULL;
int ret = 0, ret2, i, pinned = 0;
uint64_t exec_offset;
- uint32_t seqno, flush_domains, reloc_index;
+ uint32_t seqno, reloc_index;
int pin_tries, flips;
#if WATCH_EXEC
@@ -4000,7 +3991,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
* Ensure that the commands in the batch buffer are
* finished before the interrupt fires
*/
- flush_domains = i915_retire_commands(dev);
+ i915_retire_commands(dev);
i915_verify_inactive(dev, __FILE__, __LINE__);
@@ -4011,7 +4002,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
* *some* interrupts representing completion of buffers that we can
* wait on when trying to clear up gtt space).
*/
- seqno = i915_add_request(dev, file_priv, flush_domains);
+ seqno = i915_add_request(dev, file_priv);
BUG_ON(seqno == 0);
for (i = 0; i < args->buffer_count; i++) {
struct drm_gem_object *obj = object_list[i];
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
index d355d1d..00a6ec9 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -227,7 +227,7 @@ static int intel_overlay_on(struct intel_overlay *overlay)
OUT_RING(MI_NOOP);
ADVANCE_LP_RING();
- overlay->last_flip_req = i915_add_request(dev, NULL, 0);
+ overlay->last_flip_req = i915_add_request(dev, NULL);
if (overlay->last_flip_req == 0)
return -ENOMEM;
@@ -265,7 +265,7 @@ static void intel_overlay_continue(struct intel_overlay *overlay,
OUT_RING(flip_addr);
ADVANCE_LP_RING();
- overlay->last_flip_req = i915_add_request(dev, NULL, 0);
+ overlay->last_flip_req = i915_add_request(dev, NULL);
}
static int intel_overlay_wait_flip(struct intel_overlay *overlay)
@@ -296,7 +296,7 @@ static int intel_overlay_wait_flip(struct intel_overlay *overlay)
OUT_RING(MI_NOOP);
ADVANCE_LP_RING();
- overlay->last_flip_req = i915_add_request(dev, NULL, 0);
+ overlay->last_flip_req = i915_add_request(dev, NULL);
if (overlay->last_flip_req == 0)
return -ENOMEM;
@@ -336,7 +336,7 @@ static int intel_overlay_off(struct intel_overlay *overlay)
OUT_RING(MI_NOOP);
ADVANCE_LP_RING();
- overlay->last_flip_req = i915_add_request(dev, NULL, 0);
+ overlay->last_flip_req = i915_add_request(dev, NULL);
if (overlay->last_flip_req == 0)
return -ENOMEM;
@@ -354,7 +354,7 @@ static int intel_overlay_off(struct intel_overlay *overlay)
OUT_RING(MI_NOOP);
ADVANCE_LP_RING();
- overlay->last_flip_req = i915_add_request(dev, NULL, 0);
+ overlay->last_flip_req = i915_add_request(dev, NULL);
if (overlay->last_flip_req == 0)
return -ENOMEM;
@@ -400,7 +400,7 @@ int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay,
return -EIO;
if (overlay->last_flip_req == 0) {
- overlay->last_flip_req = i915_add_request(dev, NULL, 0);
+ overlay->last_flip_req = i915_add_request(dev, NULL);
if (overlay->last_flip_req == 0)
return -ENOMEM;
}
@@ -429,7 +429,7 @@ int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay,
OUT_RING(MI_NOOP);
ADVANCE_LP_RING();
- overlay->last_flip_req = i915_add_request(dev, NULL, 0);
+ overlay->last_flip_req = i915_add_request(dev, NULL);
if (overlay->last_flip_req == 0)
return -ENOMEM;
--
1.6.6.1
More information about the Intel-gfx
mailing list