diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_bufmgr.c | 16 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_bufmgr.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_screen.c | 12 |
4 files changed, 15 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c index c19e87fd82e..eefa548552a 100644 --- a/src/mesa/drivers/dri/i965/brw_bufmgr.c +++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c @@ -1528,19 +1528,6 @@ brw_bo_flink(struct brw_bo *bo, uint32_t *name) return 0; } -/** - * Enables unlimited caching of buffer objects for reuse. - * - * This is potentially very memory expensive, as the cache at each bucket - * size is only bounded by how many buffers of that size we've managed to have - * in flight at once. - */ -void -brw_bufmgr_enable_reuse(struct brw_bufmgr *bufmgr) -{ - bufmgr->bo_reuse = true; -} - static void add_bucket(struct brw_bufmgr *bufmgr, int size) { @@ -1683,7 +1670,7 @@ brw_using_softpin(struct brw_bufmgr *bufmgr) * \param fd File descriptor of the opened DRM device. */ struct brw_bufmgr * -brw_bufmgr_init(struct gen_device_info *devinfo, int fd) +brw_bufmgr_init(struct gen_device_info *devinfo, int fd, bool bo_reuse) { struct brw_bufmgr *bufmgr; @@ -1713,6 +1700,7 @@ 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->bo_reuse = bo_reuse; const uint64_t _4GB = 4ull << 30; diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.h b/src/mesa/drivers/dri/i965/brw_bufmgr.h index 32fc7a553c9..a85c8f37bef 100644 --- a/src/mesa/drivers/dri/i965/brw_bufmgr.h +++ b/src/mesa/drivers/dri/i965/brw_bufmgr.h @@ -343,11 +343,11 @@ int brw_bo_busy(struct brw_bo *bo); int brw_bo_madvise(struct brw_bo *bo, int madv); /* drm_bacon_bufmgr_gem.c */ -struct brw_bufmgr *brw_bufmgr_init(struct gen_device_info *devinfo, int fd); +struct brw_bufmgr *brw_bufmgr_init(struct gen_device_info *devinfo, int fd, + bool bo_reuse); struct brw_bo *brw_bo_gem_create_from_name(struct brw_bufmgr *bufmgr, const char *name, unsigned int handle); -void brw_bufmgr_enable_reuse(struct brw_bufmgr *bufmgr); int brw_bo_wait(struct brw_bo *bo, int64_t timeout_ns); diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 571618a9cab..cc53f403bf2 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -846,15 +846,6 @@ brw_process_driconf_options(struct brw_context *brw) brw->driContext->driScreenPriv->myNum, "i965", NULL); - int bo_reuse_mode = driQueryOptioni(options, "bo_reuse"); - switch (bo_reuse_mode) { - case DRI_CONF_BO_REUSE_DISABLED: - break; - case DRI_CONF_BO_REUSE_ALL: - brw_bufmgr_enable_reuse(brw->bufmgr); - break; - } - if (INTEL_DEBUG & DEBUG_NO_HIZ) { brw->has_hiz = false; /* On gen6, you can only do separate stencil with HIZ. */ diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 42601132b6d..ad9aef0f482 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -1906,7 +1906,17 @@ intel_init_bufmgr(struct intel_screen *screen) if (getenv("INTEL_NO_HW") != NULL) screen->no_hw = true; - screen->bufmgr = brw_bufmgr_init(&screen->devinfo, dri_screen->fd); + bool bo_reuse = false; + int bo_reuse_mode = driQueryOptioni(&screen->optionCache, "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 = brw_bufmgr_init(&screen->devinfo, dri_screen->fd, bo_reuse); if (screen->bufmgr == NULL) { fprintf(stderr, "[%s:%u] Error initializing buffer manager.\n", __func__, __LINE__); |