vk: Map uncached, coherent memory as write-combine
This gives us the required characteristics for the memory type.
This commit is contained in:
@@ -825,7 +825,7 @@ anv_bo_pool_alloc(struct anv_bo_pool *pool, struct anv_bo *bo)
|
||||
|
||||
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);
|
||||
|
||||
+12
-2
@@ -121,6 +121,12 @@ anv_physical_device_init(struct anv_physical_device *device,
|
||||
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();
|
||||
@@ -1059,7 +1065,11 @@ VkResult anv_MapMemory(
|
||||
* 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;
|
||||
@@ -1254,7 +1264,7 @@ VkResult anv_CreateFence(
|
||||
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);
|
||||
|
||||
@@ -84,7 +84,7 @@ anv_gem_close(struct anv_device *device, int gem_handle)
|
||||
*/
|
||||
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;
|
||||
@@ -94,10 +94,7 @@ anv_gem_mmap(struct anv_device *device, uint32_t gem_handle,
|
||||
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) {
|
||||
|
||||
@@ -597,7 +597,7 @@ struct anv_device {
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
@@ -69,7 +69,7 @@ VkResult anv_CreateQueryPool(
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user