Mesa (main): iris: Make an iris_bo_is_external() helper and use it in a few places
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 2 21:37:21 UTC 2021
Module: Mesa
Branch: main
Commit: 1a395e1058f53d79c183d36704bbd3ca8a04ec06
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a395e1058f53d79c183d36704bbd3ca8a04ec06
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Thu May 20 10:53:39 2021 -0700
iris: Make an iris_bo_is_external() helper and use it in a few places
I'd like to start tracking "imported" vs. "exported" for objects,
rather than a blanket "external" flag. Instead of directly checking
bo->external, use a new helper that will eventually be "imported or
exported".
Acked-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10941>
---
src/gallium/drivers/iris/iris_bufmgr.c | 6 +++---
src/gallium/drivers/iris/iris_bufmgr.h | 9 +++++++++
src/gallium/drivers/iris/iris_resource.h | 2 +-
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c
index 1c731a44989..c1e0a3dc7b8 100644
--- a/src/gallium/drivers/iris/iris_bufmgr.c
+++ b/src/gallium/drivers/iris/iris_bufmgr.c
@@ -211,7 +211,7 @@ find_and_ref_external_bo(struct hash_table *ht, unsigned int key)
struct iris_bo *bo = entry ? entry->data : NULL;
if (bo) {
- assert(bo->external);
+ assert(iris_bo_is_external(bo));
assert(!bo->reusable);
/* Being non-reusable, the BO cannot be in the cache lists, but it
@@ -762,7 +762,7 @@ bo_close(struct iris_bo *bo)
{
struct iris_bufmgr *bufmgr = bo->bufmgr;
- if (bo->external) {
+ if (iris_bo_is_external(bo)) {
struct hash_entry *entry;
if (bo->global_name) {
@@ -1297,7 +1297,7 @@ iris_bo_wait(struct iris_bo *bo, int64_t timeout_ns)
struct iris_bufmgr *bufmgr = bo->bufmgr;
/* If we know it's idle, don't bother with the kernel round trip */
- if (bo->idle && !bo->external)
+ if (bo->idle && !iris_bo_is_external(bo))
return 0;
struct drm_i915_gem_wait wait = {
diff --git a/src/gallium/drivers/iris/iris_bufmgr.h b/src/gallium/drivers/iris/iris_bufmgr.h
index 0b098b76110..057ba888501 100644
--- a/src/gallium/drivers/iris/iris_bufmgr.h
+++ b/src/gallium/drivers/iris/iris_bufmgr.h
@@ -342,6 +342,15 @@ void iris_bufmgr_unref(struct iris_bufmgr *bufmgr);
*/
int iris_bo_flink(struct iris_bo *bo, uint32_t *name);
+/**
+ * Is this buffer shared with external clients (imported or exported)?
+ */
+static inline bool
+iris_bo_is_external(const struct iris_bo *bo)
+{
+ return bo->external;
+}
+
/**
* Make a BO externally accessible.
*
diff --git a/src/gallium/drivers/iris/iris_resource.h b/src/gallium/drivers/iris/iris_resource.h
index c8ec0b9aa6d..967ec036fd5 100644
--- a/src/gallium/drivers/iris/iris_resource.h
+++ b/src/gallium/drivers/iris/iris_resource.h
@@ -307,7 +307,7 @@ iris_mocs(const struct iris_bo *bo,
const struct isl_device *dev,
isl_surf_usage_flags_t usage)
{
- return isl_mocs(dev, usage, bo && bo->external);
+ return isl_mocs(dev, usage, bo && iris_bo_is_external(bo));
}
struct iris_format_info iris_format_for_usage(const struct intel_device_info *,
More information about the mesa-commit
mailing list