diff options
author | Kenneth Graunke <[email protected]> | 2018-05-03 00:37:37 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2018-05-07 08:47:21 -0700 |
commit | 0b1cfd01ff2631465114e0707c9006987f377a8e (patch) | |
tree | 3e1a04973f99c4e2736fb56e73f57f68bc67c518 /src | |
parent | 7ee54fc33d2c38692ee13da8d40b8f49740209fe (diff) |
i965: Set initial kflags on BO creation.
This simplifies kflag initialization, by creating a bufmgr-wide setting
for initial kflags, and just applying it whenever we create a new BO.
This also properly allows 48-bit addresses for imported BOs (via prime
or flink), which I had missed in my earlier 48-bit support series.
This will be useful when adding softpin support, as we'll want to add
EXEC_OBJECT_PINNED to initial_kflags as well.
Reviewed-by: Chris Wilson <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_bufmgr.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c index 7cb1f03cf07..66f30a1637f 100644 --- a/src/mesa/drivers/dri/i965/brw_bufmgr.c +++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c @@ -119,7 +119,8 @@ struct brw_bufmgr { bool has_llc:1; bool has_mmap_wc:1; bool bo_reuse:1; - bool supports_48b_addresses:1; + + uint64_t initial_kflags; }; static int bo_set_tiling_internal(struct brw_bo *bo, uint32_t tiling_mode, @@ -407,8 +408,7 @@ retry: bo->reusable = true; bo->cache_coherent = bufmgr->has_llc; bo->index = -1; - if (bufmgr->supports_48b_addresses) - bo->kflags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS; + bo->kflags = bufmgr->initial_kflags; mtx_unlock(&bufmgr->lock); @@ -537,6 +537,7 @@ brw_bo_gem_create_from_name(struct brw_bufmgr *bufmgr, bo->global_name = handle; bo->reusable = false; bo->external = true; + bo->kflags = bufmgr->initial_kflags; _mesa_hash_table_insert(bufmgr->handle_table, &bo->gem_handle, bo); _mesa_hash_table_insert(bufmgr->name_table, &bo->global_name, bo); @@ -641,7 +642,6 @@ bo_unreference_final(struct brw_bo *bo, time_t time) bo->free_time = time; bo->name = NULL; - bo->kflags = 0; list_addtail(&bo->head, &bucket->head); } else { @@ -1157,6 +1157,7 @@ brw_bo_gem_create_from_prime_internal(struct brw_bufmgr *bufmgr, int prime_fd, bo->name = "prime"; bo->reusable = false; bo->external = true; + bo->kflags = bufmgr->initial_kflags; if (tiling_mode < 0) { struct drm_i915_gem_get_tiling get_tiling = { .handle = bo->gem_handle }; @@ -1438,8 +1439,12 @@ brw_bufmgr_init(struct gen_device_info *devinfo, int fd) bufmgr->has_llc = devinfo->has_llc; bufmgr->has_mmap_wc = gem_param(fd, I915_PARAM_MMAP_VERSION) > 0; - bufmgr->supports_48b_addresses = devinfo->gen >= 8 && - gtt_size > (4ULL << 30 /* GiB */); + + const uint64_t _4GB = 4ull << 30; + + if (devinfo->gen >= 8 && gtt_size > _4GB) { + bufmgr->initial_kflags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS; + } init_cache_buckets(bufmgr); |