aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <[email protected]>2017-06-19 11:55:00 +0100
committerKenneth Graunke <[email protected]>2017-07-10 15:55:30 -0700
commitb532e3b4a2ce503224f2bf0e511812860a6c609f (patch)
treed4dfd7401d1b16acd4b173c9bed295bd314b3776
parentc2c37f5185ef80a770a9614f0317ad91b7672450 (diff)
i965: Track when a bo is shared with an external client
If the buffer is being shared with an external client, our own state tracking may be stale and in some cases we may wish to double check with the kernel/hw state. At the moment, this is synonymous with not being reusable, but the semantics between reusable and external are quite different and we will have more examples of non-reusable buffers in the near future. Signed-off-by: Chris Wilson <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_bufmgr.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_bufmgr.h5
2 files changed, 9 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c
index ee4a5cfa2c8..ec6ab51c12e 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
@@ -483,6 +483,7 @@ brw_bo_gem_create_from_name(struct brw_bufmgr *bufmgr,
bo->name = name;
bo->global_name = handle;
bo->reusable = false;
+ bo->external = true;
_mesa_hash_table_insert(bufmgr->handle_table, &bo->gem_handle, bo);
_mesa_hash_table_insert(bufmgr->name_table, &bo->global_name, bo);
@@ -997,6 +998,7 @@ brw_bo_gem_create_from_prime(struct brw_bufmgr *bufmgr, int prime_fd)
bo->name = "prime";
bo->reusable = false;
+ bo->external = true;
memclear(get_tiling);
get_tiling.handle = bo->gem_handle;
@@ -1027,6 +1029,7 @@ brw_bo_gem_export_to_prime(struct brw_bo *bo, int *prime_fd)
return -errno;
bo->reusable = false;
+ bo->external = true;
return 0;
}
@@ -1048,6 +1051,7 @@ brw_bo_flink(struct brw_bo *bo, uint32_t *name)
if (!bo->global_name) {
bo->global_name = flink.name;
bo->reusable = false;
+ bo->external = true;
_mesa_hash_table_insert(bufmgr->name_table, &bo->global_name, bo);
}
diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.h b/src/mesa/drivers/dri/i965/brw_bufmgr.h
index 80c71825e80..d388e5ad150 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.h
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.h
@@ -124,6 +124,11 @@ struct brw_bo {
bool reusable;
/**
+ * Boolean of whether this buffer has been shared with an external client.
+ */
+ bool external;
+
+ /**
* Boolean of whether this buffer is cache coherent
*/
bool cache_coherent;