summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2014-09-21 11:25:26 +0800
committerChia-I Wu <[email protected]>2014-09-21 23:30:51 +0800
commit26fefae9a715b5498b5ffcd835556b02e4f0c68b (patch)
treea42b26c7d9d4089e3bf5f1ac131dc9e21a84e75d /src/gallium/drivers
parent4eb2bbefd2bf0359aff7ebbb8e931a1c7833606f (diff)
ilo: clarify cp owning/releasing
Make it own()'s responsibility to make room for release() and itself. To be able to do that, allow ilo_cp_submit() in own(). Signed-off-by: Chia-I Wu <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/ilo/ilo_3d.c8
-rw-r--r--src/gallium/drivers/ilo/ilo_cp.c21
-rw-r--r--src/gallium/drivers/ilo/ilo_cp.h4
3 files changed, 20 insertions, 13 deletions
diff --git a/src/gallium/drivers/ilo/ilo_3d.c b/src/gallium/drivers/ilo/ilo_3d.c
index f0aee2f480b..30686d6075f 100644
--- a/src/gallium/drivers/ilo/ilo_3d.c
+++ b/src/gallium/drivers/ilo/ilo_3d.c
@@ -399,7 +399,15 @@ ilo_3d_own_cp(struct ilo_cp *cp, void *data)
{
struct ilo_3d *hw3d = data;
+ /* multiply by 2 for both resuming and pausing */
+ if (ilo_cp_space(hw3d->cp) < hw3d->owner.reserve * 2) {
+ ilo_cp_submit(hw3d->cp, "out of space");
+ assert(ilo_cp_space(hw3d->cp) >= hw3d->owner.reserve * 2);
+ }
+
ilo_3d_resume_queries(hw3d);
+
+ assert(ilo_cp_space(hw3d->cp) >= hw3d->owner.reserve);
}
static void
diff --git a/src/gallium/drivers/ilo/ilo_cp.c b/src/gallium/drivers/ilo/ilo_cp.c
index 37e9b2ae2bf..67de95b98c9 100644
--- a/src/gallium/drivers/ilo/ilo_cp.c
+++ b/src/gallium/drivers/ilo/ilo_cp.c
@@ -48,10 +48,15 @@ ilo_cp_release_owner(struct ilo_cp *cp)
/**
* Set the parser owner. If this is a new owner or a new ring, the old owner
- * is released and the new owner's own() is called.
+ * is released and the new owner's own() is called. The parser may implicitly
+ * submit if there is a ring change.
*
- * The parser may implicitly submit if there is a ring change or there is not
- * enough space for the new owner.
+ * own() is called before \p owner owns the parser. It must make sure there
+ * is more space than \p owner->reserve when it returns. Calling
+ * ilo_cp_submit() is allowed.
+ *
+ * release() will be called after \p owner loses the parser. That may happen
+ * just before the parser submits and ilo_cp_submit() is not allowed.
*/
void
ilo_cp_set_owner(struct ilo_cp *cp, enum intel_ring_type ring,
@@ -68,16 +73,10 @@ ilo_cp_set_owner(struct ilo_cp *cp, enum intel_ring_type ring,
if (cp->owner != owner) {
ilo_cp_release_owner(cp);
- /* multiply by 2 because there are own() and release() */
- if (ilo_cp_space(cp) < owner->reserve * 2) {
- ilo_cp_submit(cp, "new owner");
- assert(ilo_cp_space(cp) >= owner->reserve * 2);
- }
-
- cp->owner = owner;
+ owner->own(cp, owner->data);
assert(ilo_cp_space(cp) >= owner->reserve);
- cp->owner->own(cp, cp->owner->data);
+ cp->owner = owner;
}
}
diff --git a/src/gallium/drivers/ilo/ilo_cp.h b/src/gallium/drivers/ilo/ilo_cp.h
index 12d1a98c836..04b3ad5f836 100644
--- a/src/gallium/drivers/ilo/ilo_cp.h
+++ b/src/gallium/drivers/ilo/ilo_cp.h
@@ -48,8 +48,8 @@ struct ilo_cp_owner {
void *data;
/*
- * Space reserved for own() and release(). This can be modified at any
- * time, as long as it is never increased by more than ilo_cp_space().
+ * Space reserved for release(). This can be modified at any time, as long
+ * as it is never increased by more than ilo_cp_space().
*/
int reserve;
};