This gives us the required characteristics for the memory type.
assert(new_bo.size == pool->bo_size);
- new_bo.map = anv_gem_mmap(pool->device, new_bo.gem_handle, 0, pool->bo_size);
+ new_bo.map = anv_gem_mmap(pool->device, new_bo.gem_handle, 0, pool->bo_size, 0);
if (new_bo.map == NULL) {
anv_gem_close(pool->device, new_bo.gem_handle);
return vk_error(VK_ERROR_MEMORY_MAP_FAILED);
goto fail;
}
+ if (anv_gem_get_param(fd, I915_PARAM_MMAP_VERSION < 1)) {
+ result = vk_errorf(VK_ERROR_INITIALIZATION_FAILED,
+ "kernel missing wc mmap");
+ goto fail;
+ }
+
close(fd);
brw_process_intel_debug_variable();
* pointer here, but that may exhaust virtual memory on 32 bit
* userspace. */
- mem->map = anv_gem_mmap(device, mem->bo.gem_handle, offset, size);
+ uint32_t gem_flags = 0;
+ if (!device->info.has_llc && mem->type_index == 0)
+ gem_flags |= I915_MMAP_WC;
+
+ mem->map = anv_gem_mmap(device, mem->bo.gem_handle, offset, size, gem_flags);
mem->map_size = size;
*ppData = mem->map;
goto fail;
fence->bo.map =
- anv_gem_mmap(device, fence->bo.gem_handle, 0, fence->bo.size);
+ anv_gem_mmap(device, fence->bo.gem_handle, 0, fence->bo.size, 0);
batch.next = batch.start = fence->bo.map;
batch.end = fence->bo.map + fence->bo.size;
anv_batch_emit(&batch, GEN7_MI_BATCH_BUFFER_END);
*/
void*
anv_gem_mmap(struct anv_device *device, uint32_t gem_handle,
- uint64_t offset, uint64_t size)
+ uint64_t offset, uint64_t size, uint32_t flags)
{
struct drm_i915_gem_mmap gem_mmap;
int ret;
gem_mmap.offset = offset;
gem_mmap.size = size;
VG_CLEAR(gem_mmap.addr_ptr);
-
-#ifdef I915_MMAP_WC
- gem_mmap.flags = 0;
-#endif
+ gem_mmap.flags = flags;
ret = anv_ioctl(device->fd, DRM_IOCTL_I915_GEM_MMAP, &gem_mmap);
if (ret != 0) {
};
void* anv_gem_mmap(struct anv_device *device,
- uint32_t gem_handle, uint64_t offset, uint64_t size);
+ uint32_t gem_handle, uint64_t offset, uint64_t size, uint32_t flags);
void anv_gem_munmap(void *p, uint64_t size);
uint32_t anv_gem_create(struct anv_device *device, size_t size);
void anv_gem_close(struct anv_device *device, int gem_handle);
if (result != VK_SUCCESS)
goto fail;
- pool->bo.map = anv_gem_mmap(device, pool->bo.gem_handle, 0, size);
+ pool->bo.map = anv_gem_mmap(device, pool->bo.gem_handle, 0, size, 0);
*pQueryPool = anv_query_pool_to_handle(pool);