iris: use driconf for 'bo_reuse' parameter

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Tapani Pälli 2019-08-28 14:46:16 +03:00
parent b65de51dcf
commit 6dc4ddc5f8
4 changed files with 20 additions and 6 deletions

View File

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

View File

@ -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);

View File

@ -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)

View File

@ -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;