From 6dc4ddc5f81f7a3041eb61370dbb7edf90a92a6a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tapani=20P=C3=A4lli?= Date: Wed, 28 Aug 2019 14:46:16 +0300 Subject: [PATCH] iris: use driconf for 'bo_reuse' parameter MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Tapani Pälli Reviewed-by: Lionel Landwerlin Reviewed-by: Kenneth Graunke --- src/gallium/drivers/iris/iris_bufmgr.c | 6 ++---- src/gallium/drivers/iris/iris_bufmgr.h | 3 ++- src/gallium/drivers/iris/iris_context.h | 5 +++++ src/gallium/drivers/iris/iris_screen.c | 12 +++++++++++- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c index e34c8f34912..2dc7e3eec4c 100644 --- a/src/gallium/drivers/iris/iris_bufmgr.c +++ b/src/gallium/drivers/iris/iris_bufmgr.c @@ -1570,7 +1570,7 @@ iris_gtt_size(int fd) * \param fd File descriptor of the opened DRM device. */ struct iris_bufmgr * -iris_bufmgr_init(struct gen_device_info *devinfo, int fd) +iris_bufmgr_init(struct gen_device_info *devinfo, int fd, bool bo_reuse) { uint64_t gtt_size = iris_gtt_size(fd); if (gtt_size <= IRIS_MEMZONE_OTHER_START) @@ -1599,6 +1599,7 @@ iris_bufmgr_init(struct gen_device_info *devinfo, int fd) list_inithead(&bufmgr->zombie_list); bufmgr->has_llc = devinfo->has_llc; + bufmgr->bo_reuse = bo_reuse; STATIC_ASSERT(IRIS_MEMZONE_SHADER_START == 0ull); const uint64_t _4GB = 1ull << 32; @@ -1622,9 +1623,6 @@ iris_bufmgr_init(struct gen_device_info *devinfo, int fd) IRIS_MEMZONE_OTHER_START, (gtt_size - _4GB) - IRIS_MEMZONE_OTHER_START); - // XXX: driconf - bufmgr->bo_reuse = env_var_as_boolean("bo_reuse", true); - init_cache_buckets(bufmgr); bufmgr->name_table = diff --git a/src/gallium/drivers/iris/iris_bufmgr.h b/src/gallium/drivers/iris/iris_bufmgr.h index 779f055ceae..d5ae9b42ab1 100644 --- a/src/gallium/drivers/iris/iris_bufmgr.h +++ b/src/gallium/drivers/iris/iris_bufmgr.h @@ -323,7 +323,8 @@ int iris_bo_busy(struct iris_bo *bo); int iris_bo_madvise(struct iris_bo *bo, int madv); /* drm_bacon_bufmgr_gem.c */ -struct iris_bufmgr *iris_bufmgr_init(struct gen_device_info *devinfo, int fd); +struct iris_bufmgr *iris_bufmgr_init(struct gen_device_info *devinfo, int fd, + bool bo_reuse); struct iris_bo *iris_bo_gem_create_from_name(struct iris_bufmgr *bufmgr, const char *name, unsigned handle); diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 1fd6eb57cfe..e3dc00fbf84 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -53,6 +53,11 @@ enum iris_param_domain { BRW_PARAM_DOMAIN_IMAGE, }; +enum { + DRI_CONF_BO_REUSE_DISABLED, + DRI_CONF_BO_REUSE_ALL +}; + #define BRW_PARAM(domain, val) (BRW_PARAM_DOMAIN_##domain << 24 | (val)) #define BRW_PARAM_DOMAIN(param) ((uint32_t)(param) >> 24) #define BRW_PARAM_VALUE(param) ((uint32_t)(param) & 0x00ffffff) diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c index fa528a0d67a..5fbc214da65 100644 --- a/src/gallium/drivers/iris/iris_screen.c +++ b/src/gallium/drivers/iris/iris_screen.c @@ -630,7 +630,17 @@ iris_screen_create(int fd, const struct pipe_screen_config *config) if (getenv("INTEL_NO_HW") != NULL) screen->no_hw = true; - screen->bufmgr = iris_bufmgr_init(&screen->devinfo, fd); + bool bo_reuse = false; + int bo_reuse_mode = driQueryOptioni(config->options, "bo_reuse"); + switch (bo_reuse_mode) { + case DRI_CONF_BO_REUSE_DISABLED: + break; + case DRI_CONF_BO_REUSE_ALL: + bo_reuse = true; + break; + } + + screen->bufmgr = iris_bufmgr_init(&screen->devinfo, fd, bo_reuse); if (!screen->bufmgr) return NULL; -- 2.30.2