[Mesa-dev] [PATCH 08/16] anv: Determine the type of mapping based on type metadata
Nanley Chery
nanleychery at gmail.com
Tue May 23 19:24:08 UTC 2017
On Thu, May 18, 2017 at 02:00:55PM -0700, Jason Ekstrand wrote:
> Before, we were just comparing the type index to 0. Now we actually
> look the type up in the table and check its properties to determine what
> kind of mapping we want to do.
> ---
> src/intel/vulkan/anv_device.c | 12 ++++++------
> src/intel/vulkan/anv_private.h | 2 +-
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
Patches 7 and 8 are
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>
> diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
> index 523d40e..4a0115e 100644
> --- a/src/intel/vulkan/anv_device.c
> +++ b/src/intel/vulkan/anv_device.c
> @@ -1466,6 +1466,7 @@ VkResult anv_AllocateMemory(
> VkDeviceMemory* pMem)
> {
> ANV_FROM_HANDLE(anv_device, device, _device);
> + struct anv_physical_device *pdevice = &device->instance->physicalDevice;
> struct anv_device_memory *mem;
> VkResult result = VK_SUCCESS;
>
> @@ -1474,10 +1475,6 @@ VkResult anv_AllocateMemory(
> /* The Vulkan 1.0.33 spec says "allocationSize must be greater than 0". */
> assert(pAllocateInfo->allocationSize > 0);
>
> - /* We support exactly one memory heap. */
> - assert(pAllocateInfo->memoryTypeIndex == 0 ||
> - (!device->info.has_llc && pAllocateInfo->memoryTypeIndex < 2));
> -
> /* The kernel relocation API has a limitation of a 32-bit delta value
> * applied to the address before it is written which, in spite of it being
> * unsigned, is treated as signed . Because of the way that this maps to
> @@ -1505,7 +1502,8 @@ VkResult anv_AllocateMemory(
> if (mem == NULL)
> return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
>
> - mem->type_index = pAllocateInfo->memoryTypeIndex;
> + assert(pAllocateInfo->memoryTypeIndex < pdevice->memory.type_count);
> + mem->type = &pdevice->memory.types[pAllocateInfo->memoryTypeIndex];
> mem->map = NULL;
> mem->map_size = 0;
>
> @@ -1630,7 +1628,9 @@ VkResult anv_MapMemory(
> * userspace. */
>
> uint32_t gem_flags = 0;
> - if (!device->info.has_llc && mem->type_index == 0)
> +
> + if (!device->info.has_llc &&
> + (mem->type->propertyFlags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT))
> gem_flags |= I915_MMAP_WC;
>
> /* GEM will fail to map if the offset isn't 4k-aligned. Round down. */
> diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
> index 5287daf..8ed8e0f 100644
> --- a/src/intel/vulkan/anv_private.h
> +++ b/src/intel/vulkan/anv_private.h
> @@ -1002,7 +1002,7 @@ _anv_combine_address(struct anv_batch *batch, void *location,
>
> struct anv_device_memory {
> struct anv_bo * bo;
> - uint32_t type_index;
> + VkMemoryType * type;
> VkDeviceSize map_size;
> void * map;
> };
> --
> 2.5.0.400.gff86faf
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list