summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-12-09 09:26:03 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-12-09 10:33:32 +0000
commitc8f622726a4463b419d032b379576cfb3bc492df (patch)
tree1386e03570c1b4dc7b3ce1a2c676e709d4ed4192
parent4e4e10935d2815fb62aeaedbfffe10aad115ec0b (diff)
sna: Replace remaining kgem_is_idle() with kgem_ring_is_idle()
Further experimentation... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/gen2_render.c2
-rw-r--r--src/sna/gen5_render.c2
-rw-r--r--src/sna/kgem.c56
-rw-r--r--src/sna/kgem.h12
-rw-r--r--src/sna/sna_accel.c4
-rw-r--r--src/sna/sna_render.c2
6 files changed, 12 insertions, 66 deletions
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c
index 2123cb9e..eeb0af40 100644
--- a/src/sna/gen2_render.c
+++ b/src/sna/gen2_render.c
@@ -3191,7 +3191,7 @@ gen2_render_context_switch(struct kgem *kgem,
/* Reload BLT registers following a lost context */
sna->blt_state.fill_bo = 0;
- if (kgem_is_idle(kgem)) {
+ if (kgem_ring_is_idle(kgem, kgem->ring)) {
DBG(("%s: GPU idle, flushing\n", __FUNCTION__));
_kgem_submit(kgem);
}
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index d0e570e0..f8cea616 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -3585,7 +3585,7 @@ gen5_render_context_switch(struct kgem *kgem,
sna->render_state.gen5.drawrect_limit = -1;
}
- if (kgem_is_idle(kgem)) {
+ if (kgem_ring_is_idle(kgem, kgem->ring)) {
DBG(("%s: GPU idle, flushing\n", __FUNCTION__));
_kgem_submit(kgem);
}
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 47dd7d5d..921fdf8e 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1733,6 +1733,8 @@ static bool kgem_retire__flushing(struct kgem *kgem)
}
#endif
+ kgem->need_retire |= !list_is_empty(&kgem->flushing);
+
return retired;
}
@@ -1824,7 +1826,6 @@ static bool kgem_retire__requests_ring(struct kgem *kgem, int ring)
}
__kgem_request_free(rq);
- kgem->num_requests--;
}
#if HAS_DEBUG_FULL
@@ -1854,20 +1855,10 @@ static bool kgem_retire__requests(struct kgem *kgem)
bool retired = false;
int n;
- for (n = 0; n < ARRAY_SIZE(kgem->requests); n++)
+ for (n = 0; n < ARRAY_SIZE(kgem->requests); n++) {
retired |= kgem_retire__requests_ring(kgem, n);
-
-#if HAS_DEBUG_FULL
- {
- int count = 0;
-
- for (n = 0; n < ARRAY_SIZE(kgem->requests); n++)
- list_for_each_entry(bo, &kgem->requests[n], request)
- count++;
-
- assert(count == kgem->num_requests);
+ kgem->need_retire |= !list_is_empty(&kgem->requests[n]);
}
-#endif
return retired;
}
@@ -1878,14 +1869,12 @@ bool kgem_retire(struct kgem *kgem)
DBG(("%s\n", __FUNCTION__));
+ kgem->need_retire = false;
+
retired |= kgem_retire__flushing(kgem);
- if (kgem->num_requests)
- retired |= kgem_retire__requests(kgem);
+ retired |= kgem_retire__requests(kgem);
retired |= kgem_retire__buffers(kgem);
- kgem->need_retire =
- kgem->num_requests ||
- !list_is_empty(&kgem->flushing);
DBG(("%s -- retired=%d, need_retire=%d\n",
__FUNCTION__, retired, kgem->need_retire));
@@ -1894,39 +1883,10 @@ bool kgem_retire(struct kgem *kgem)
return retired;
}
-bool __kgem_is_idle(struct kgem *kgem)
-{
- int n;
-
- assert(kgem->num_requests);
-
- for (n = 0; n < ARRAY_SIZE(kgem->requests); n++) {
- struct kgem_request *rq;
-
- if (list_is_empty(&kgem->requests[n]))
- continue;
-
- rq = list_last_entry(&kgem->requests[n],
- struct kgem_request, list);
- if (kgem_busy(kgem, rq->bo->handle)) {
- DBG(("%s: last requests handle=%d still busy\n",
- __FUNCTION__, rq->bo->handle));
- return false;
- }
-
- DBG(("%s: ring=%d idle (handle=%d)\n",
- __FUNCTION__, n, rq->bo->handle));
- }
- kgem_retire__requests(kgem);
- assert(kgem->num_requests == 0);
- return true;
-}
-
bool __kgem_ring_is_idle(struct kgem *kgem, int ring)
{
struct kgem_request *rq;
- assert(kgem->num_requests);
assert(!list_is_empty(&kgem->requests[ring]));
rq = list_last_entry(&kgem->requests[ring],
@@ -2005,7 +1965,6 @@ static void kgem_commit(struct kgem *kgem)
} else {
list_add_tail(&rq->list, &kgem->requests[rq->ring]);
kgem->need_throttle = kgem->need_retire = 1;
- kgem->num_requests++;
}
kgem->next_request = NULL;
@@ -2180,7 +2139,6 @@ static void kgem_cleanup(struct kgem *kgem)
}
}
- kgem->num_requests = 0;
kgem_close_inactive(kgem);
}
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 5cd22ccf..21398bf1 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -132,7 +132,6 @@ struct kgem {
struct list requests[2];
struct kgem_request *next_request;
- uint32_t num_requests;
struct {
struct list inactive[NUM_CACHE_BUCKETS];
@@ -275,17 +274,6 @@ int kgem_bo_get_swizzling(struct kgem *kgem, struct kgem_bo *bo);
void kgem_bo_retire(struct kgem *kgem, struct kgem_bo *bo);
bool kgem_retire(struct kgem *kgem);
-bool __kgem_is_idle(struct kgem *kgem);
-static inline bool kgem_is_idle(struct kgem *kgem)
-{
- if (kgem->num_requests == 0) {
- DBG(("%s: no outstanding requests\n", __FUNCTION__));
- return true;
- }
-
- return __kgem_is_idle(kgem);
-}
-
bool __kgem_ring_is_idle(struct kgem *kgem, int ring);
static inline bool kgem_ring_is_idle(struct kgem *kgem, int ring)
{
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 886bff84..c7edad63 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -14376,7 +14376,7 @@ void sna_accel_block_handler(struct sna *sna, struct timeval **tv)
if (sna->timer_active)
UpdateCurrentTimeIf();
- if (sna->kgem.nbatch && kgem_is_idle(&sna->kgem)) {
+ if (sna->kgem.nbatch && kgem_ring_is_idle(&sna->kgem, sna->kgem.ring)) {
DBG(("%s: GPU idle, flushing\n", __FUNCTION__));
_kgem_submit(&sna->kgem);
}
@@ -14436,7 +14436,7 @@ void sna_accel_wakeup_handler(struct sna *sna)
if (sna->kgem.need_retire)
kgem_retire(&sna->kgem);
- if (sna->kgem.nbatch && kgem_is_idle(&sna->kgem)) {
+ if (sna->kgem.nbatch && !sna->kgem.need_retire) {
DBG(("%s: GPU idle, flushing\n", __FUNCTION__));
_kgem_submit(&sna->kgem);
}
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 27168ac6..994f0a63 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -249,7 +249,7 @@ no_render_context_switch(struct kgem *kgem,
if (!kgem->mode)
return;
- if (kgem_is_idle(kgem)) {
+ if (kgem_ring_is_idle(kgem, kgem->ring)) {
DBG(("%s: GPU idle, flushing\n", __FUNCTION__));
_kgem_submit(kgem);
}