From: Matt Turner Date: Wed, 3 May 2017 21:19:11 +0000 (-0700) Subject: i965: Remove unused brw_bo_map__* functions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d7024a6b3cd16836597902593e25cb43989c0130;p=mesa.git i965: Remove unused brw_bo_map__* functions Reviewed-by: Kenneth Graunke --- diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c index 2f179347009..6ea69787d20 100644 --- a/src/mesa/drivers/dri/i965/brw_bufmgr.c +++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c @@ -1221,111 +1221,6 @@ brw_reg_read(struct brw_bufmgr *bufmgr, uint32_t offset, uint64_t *result) return ret; } -void * -brw_bo_map__gtt(struct brw_bo *bo) -{ - struct brw_bufmgr *bufmgr = bo->bufmgr; - - if (bo->gtt_virtual) - return bo->gtt_virtual; - - pthread_mutex_lock(&bufmgr->lock); - if (bo->gtt_virtual == NULL) { - struct drm_i915_gem_mmap_gtt mmap_arg; - void *ptr; - - DBG("bo_map_gtt: mmap %d (%s), map_count=%d\n", - bo->gem_handle, bo->name, bo->map_count); - - memclear(mmap_arg); - mmap_arg.handle = bo->gem_handle; - - /* Get the fake offset back... */ - ptr = MAP_FAILED; - if (drmIoctl(bufmgr->fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg) == 0) { - /* and mmap it */ - ptr = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE, - MAP_SHARED, bufmgr->fd, mmap_arg.offset); - } - if (ptr == MAP_FAILED) { - --bo->map_count; - ptr = NULL; - } - - bo->gtt_virtual = ptr; - } - pthread_mutex_unlock(&bufmgr->lock); - - return bo->gtt_virtual; -} - -void * -brw_bo_map__cpu(struct brw_bo *bo) -{ - struct brw_bufmgr *bufmgr = bo->bufmgr; - - if (bo->mem_virtual) - return bo->mem_virtual; - - pthread_mutex_lock(&bufmgr->lock); - if (!bo->mem_virtual) { - struct drm_i915_gem_mmap mmap_arg; - - DBG("bo_map: %d (%s), map_count=%d\n", - bo->gem_handle, bo->name, bo->map_count); - - memclear(mmap_arg); - mmap_arg.handle = bo->gem_handle; - mmap_arg.size = bo->size; - if (drmIoctl(bufmgr->fd, DRM_IOCTL_I915_GEM_MMAP, &mmap_arg)) { - DBG("%s:%d: Error mapping buffer %d (%s): %s .\n", - __FILE__, __LINE__, bo->gem_handle, bo->name, strerror(errno)); - } else { - bo->map_count++; - VG(VALGRIND_MALLOCLIKE_BLOCK - (mmap_arg.addr_ptr, mmap_arg.size, 0, 1)); - bo->mem_virtual = (void *) (uintptr_t) mmap_arg.addr_ptr; - } - } - pthread_mutex_unlock(&bufmgr->lock); - - return bo->mem_virtual; -} - -void * -brw_bo_map__wc(struct brw_bo *bo) -{ - struct brw_bufmgr *bufmgr = bo->bufmgr; - - if (bo->wc_virtual) - return bo->wc_virtual; - - pthread_mutex_lock(&bufmgr->lock); - if (!bo->wc_virtual) { - struct drm_i915_gem_mmap mmap_arg; - - DBG("bo_map: %d (%s), map_count=%d\n", - bo->gem_handle, bo->name, bo->map_count); - - memclear(mmap_arg); - mmap_arg.handle = bo->gem_handle; - mmap_arg.size = bo->size; - mmap_arg.flags = I915_MMAP_WC; - if (drmIoctl(bufmgr->fd, DRM_IOCTL_I915_GEM_MMAP, &mmap_arg)) { - DBG("%s:%d: Error mapping buffer %d (%s): %s .\n", - __FILE__, __LINE__, bo->gem_handle, bo->name, strerror(errno)); - } else { - bo->map_count++; - VG(VALGRIND_MALLOCLIKE_BLOCK - (mmap_arg.addr_ptr, mmap_arg.size, 0, 1)); - bo->wc_virtual = (void *) (uintptr_t) mmap_arg.addr_ptr; - } - } - pthread_mutex_unlock(&bufmgr->lock); - - return bo->wc_virtual; -} - /** * Initializes the GEM buffer manager, which uses the kernel to allocate, map, * and manage map buffer objections. diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.h b/src/mesa/drivers/dri/i965/brw_bufmgr.h index 56ec206d303..d0b88fbcfda 100644 --- a/src/mesa/drivers/dri/i965/brw_bufmgr.h +++ b/src/mesa/drivers/dri/i965/brw_bufmgr.h @@ -261,10 +261,6 @@ void brw_bufmgr_enable_reuse(struct brw_bufmgr *bufmgr); int brw_bo_map_unsynchronized(struct brw_context *brw, struct brw_bo *bo); int brw_bo_map_gtt(struct brw_context *brw, struct brw_bo *bo); -void *brw_bo_map__cpu(struct brw_bo *bo); -void *brw_bo_map__gtt(struct brw_bo *bo); -void *brw_bo_map__wc(struct brw_bo *bo); - int brw_bo_wait(struct brw_bo *bo, int64_t timeout_ns); uint32_t brw_create_hw_context(struct brw_bufmgr *bufmgr);