[Mesa-dev] [PATCH v2 31/32] anv: Enable support for Yf and Ys tiled images
Jason Ekstrand
jason at jlekstrand.net
Fri Oct 12 18:47:01 UTC 2018
---
src/intel/vulkan/anv_device.c | 6 ++++--
src/intel/vulkan/anv_image.c | 12 ++++++++----
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 6a24d1086d8..7f7778fd81d 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -2126,11 +2126,13 @@ anv_vma_alloc(struct anv_device *device, struct anv_bo *bo)
pthread_mutex_lock(&device->vma_mutex);
+ uint32_t align = bo->size >= (64 << 10) ? (64 << 10) : (4 << 10);
+
bo->offset = 0;
if (bo->flags & EXEC_OBJECT_SUPPORTS_48B_ADDRESS &&
device->vma_hi_available >= bo->size) {
- uint64_t addr = util_vma_heap_alloc(&device->vma_hi, bo->size, 4096);
+ uint64_t addr = util_vma_heap_alloc(&device->vma_hi, bo->size, align);
if (addr) {
bo->offset = gen_canonical_address(addr);
assert(addr == gen_48b_address(bo->offset));
@@ -2139,7 +2141,7 @@ anv_vma_alloc(struct anv_device *device, struct anv_bo *bo)
}
if (bo->offset == 0 && device->vma_lo_available >= bo->size) {
- uint64_t addr = util_vma_heap_alloc(&device->vma_lo, bo->size, 4096);
+ uint64_t addr = util_vma_heap_alloc(&device->vma_lo, bo->size, align);
if (addr) {
bo->offset = gen_canonical_address(addr);
assert(addr == gen_48b_address(bo->offset));
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index 82ce43ef2b9..93f42dc98f9 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -93,7 +93,8 @@ choose_isl_surf_usage(VkImageCreateFlags vk_create_flags,
}
static isl_tiling_flags_t
-choose_isl_tiling_flags(const struct anv_image_create_info *anv_info,
+choose_isl_tiling_flags(struct anv_device *device,
+ const struct anv_image_create_info *anv_info,
const struct isl_drm_modifier_info *isl_mod_info,
bool legacy_scanout)
{
@@ -120,8 +121,11 @@ choose_isl_tiling_flags(const struct anv_image_create_info *anv_info,
if (isl_mod_info)
flags &= 1 << isl_mod_info->tiling;
- /* We don't support Yf or Ys tiling yet */
- flags &= ISL_TILING_STD_Y_MASK;
+ /* Ys tiling requires softpin so that we can ensure Ys-tiled images are
+ * aligned to 64K rather than 4K.
+ */
+ if (!device->instance->physicalDevice.use_softpin)
+ flags &= ~(ISL_TILING_GEN9_Ys_BIT | ISL_TILING_GEN10_Ys_BIT);
assert(flags);
@@ -604,7 +608,7 @@ anv_image_create(VkDevice _device,
assert(format != NULL);
const isl_tiling_flags_t isl_tiling_flags =
- choose_isl_tiling_flags(create_info, isl_mod_info,
+ choose_isl_tiling_flags(device, create_info, isl_mod_info,
image->needs_set_tiling);
image->n_planes = format->n_planes;
--
2.19.1
More information about the mesa-dev
mailing list