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@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10941>
This commit is contained in:
Kenneth Graunke 2021-05-20 10:53:39 -07:00 committed by Marge Bot
parent 1c73445d22
commit 1a395e1058
3 changed files with 13 additions and 4 deletions

View file

@ -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 = {

View file

@ -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.
*

View file

@ -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 *,