v3dv: make v3dv_image derive from vk_image

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12668>
This commit is contained in:
Iago Toral Quiroga
2021-07-26 12:06:17 +02:00
committed by Marge Bot
parent 77f2e2a75f
commit f1c6f05c35
11 changed files with 258 additions and 325 deletions
+1 -1
View File
@@ -1027,7 +1027,7 @@ cmd_buffer_subpass_handle_pending_resolves(struct v3dv_cmd_buffer *cmd_buffer)
dst_iview->last_layer - dst_iview->first_layer + 1,
},
.dstOffset = { 0, 0, 0 },
.extent = src_iview->image->extent,
.extent = src_iview->image->vk.extent,
};
VkResolveImageInfo2KHR resolve_info = {
+2 -2
View File
@@ -2240,8 +2240,8 @@ v3dv_GetImageMemoryRequirements2(VkDevice device,
case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS: {
VkMemoryDedicatedRequirements *req =
(VkMemoryDedicatedRequirements *) ext;
req->requiresDedicatedAllocation = image->external;
req->prefersDedicatedAllocation = image->external;
req->requiresDedicatedAllocation = image->vk.external_handle_types != 0;
req->prefersDedicatedAllocation = image->vk.external_handle_types != 0;
break;
}
default:
+69 -110
View File
@@ -76,9 +76,9 @@ v3d_setup_slices(struct v3dv_image *image)
{
assert(image->cpp > 0);
uint32_t width = image->extent.width;
uint32_t height = image->extent.height;
uint32_t depth = image->extent.depth;
uint32_t width = image->vk.extent.width;
uint32_t height = image->vk.extent.height;
uint32_t depth = image->vk.extent.depth;
/* Note that power-of-two padding is based on level 1. These are not
* equivalent to just util_next_power_of_two(dimension), because at a
@@ -94,21 +94,21 @@ v3d_setup_slices(struct v3dv_image *image)
uint32_t uif_block_w = utile_w * 2;
uint32_t uif_block_h = utile_h * 2;
uint32_t block_width = vk_format_get_blockwidth(image->vk_format);
uint32_t block_height = vk_format_get_blockheight(image->vk_format);
uint32_t block_width = vk_format_get_blockwidth(image->vk.format);
uint32_t block_height = vk_format_get_blockheight(image->vk.format);
assert(image->samples == VK_SAMPLE_COUNT_1_BIT ||
image->samples == VK_SAMPLE_COUNT_4_BIT);
bool msaa = image->samples != VK_SAMPLE_COUNT_1_BIT;
assert(image->vk.samples == VK_SAMPLE_COUNT_1_BIT ||
image->vk.samples == VK_SAMPLE_COUNT_4_BIT);
bool msaa = image->vk.samples != VK_SAMPLE_COUNT_1_BIT;
bool uif_top = msaa;
assert(image->array_size > 0);
assert(image->vk.array_layers > 0);
assert(depth > 0);
assert(image->levels >= 1);
assert(image->vk.mip_levels >= 1);
uint32_t offset = 0;
for (int32_t i = image->levels - 1; i >= 0; i--) {
for (int32_t i = image->vk.mip_levels - 1; i >= 0; i--) {
struct v3d_resource_slice *slice = &image->slices[i];
uint32_t level_width, level_height, level_depth;
@@ -135,7 +135,7 @@ v3d_setup_slices(struct v3dv_image *image)
if (!image->tiled) {
slice->tiling = V3D_TILING_RASTER;
if (image->type == VK_IMAGE_TYPE_1D)
if (image->vk.image_type == VK_IMAGE_TYPE_1D)
level_width = align(level_width, 64 / image->cpp);
} else {
if ((i != 0 || !uif_top) &&
@@ -210,13 +210,12 @@ v3d_setup_slices(struct v3dv_image *image)
*
* We additionally align to 4k, which improves UIF XOR performance.
*/
image->alignment =
image->tiling == VK_IMAGE_TILING_LINEAR ? image->cpp : 4096;
image->alignment = image->tiled ? 4096 : image->cpp;
uint32_t align_offset =
align(image->slices[0].offset, image->alignment) - image->slices[0].offset;
if (align_offset) {
image->size += align_offset;
for (int i = 0; i < image->levels; i++)
for (int i = 0; i < image->vk.mip_levels; i++)
image->slices[i].offset += align_offset;
}
@@ -224,10 +223,10 @@ v3d_setup_slices(struct v3dv_image *image)
* one full mipmap tree to the next (64b aligned). For 3D textures,
* we need to program the stride between slices of miplevel 0.
*/
if (image->type != VK_IMAGE_TYPE_3D) {
if (image->vk.image_type != VK_IMAGE_TYPE_3D) {
image->cube_map_stride =
align(image->slices[0].offset + image->slices[0].size, 64);
image->size += image->cube_map_stride * (image->array_size - 1);
image->size += image->cube_map_stride * (image->vk.array_layers - 1);
} else {
image->cube_map_stride = image->slices[0].size;
}
@@ -238,7 +237,7 @@ v3dv_layer_offset(const struct v3dv_image *image, uint32_t level, uint32_t layer
{
const struct v3d_resource_slice *slice = &image->slices[level];
if (image->type == VK_IMAGE_TYPE_3D)
if (image->vk.image_type == VK_IMAGE_TYPE_3D)
return image->mem_offset + slice->offset + layer * slice->size;
else
return image->mem_offset + slice->offset + layer * image->cube_map_stride;
@@ -252,14 +251,9 @@ create_image(struct v3dv_device *device,
{
struct v3dv_image *image = NULL;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO);
v3dv_assert(pCreateInfo->mipLevels > 0);
v3dv_assert(pCreateInfo->arrayLayers > 0);
v3dv_assert(pCreateInfo->samples > 0);
v3dv_assert(pCreateInfo->extent.width > 0);
v3dv_assert(pCreateInfo->extent.height > 0);
v3dv_assert(pCreateInfo->extent.depth > 0);
image = vk_image_create(&device->vk, pCreateInfo, pAllocator, sizeof(*image));
if (image == NULL)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
/* When using the simulator the WSI common code will see that our
* driver wsi device doesn't match the display device and because of that
@@ -270,8 +264,9 @@ create_image(struct v3dv_device *device,
* As a result, on that path, swapchain images do not have any special
* requirements and are not created with the pNext structs below.
*/
VkImageTiling tiling = pCreateInfo->tiling;
uint64_t modifier = DRM_FORMAT_MOD_INVALID;
if (pCreateInfo->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) {
if (tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) {
const VkImageDrmFormatModifierListCreateInfoEXT *mod_info =
vk_find_struct_const(pCreateInfo->pNext,
IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT);
@@ -297,55 +292,32 @@ create_image(struct v3dv_device *device,
}
assert(modifier == DRM_FORMAT_MOD_LINEAR ||
modifier == DRM_FORMAT_MOD_BROADCOM_UIF);
} else {
const struct wsi_image_create_info *wsi_info =
vk_find_struct_const(pCreateInfo->pNext, WSI_IMAGE_CREATE_INFO_MESA);
if (wsi_info && wsi_info->scanout)
modifier = DRM_FORMAT_MOD_LINEAR;
} else if (pCreateInfo->imageType == VK_IMAGE_TYPE_1D ||
image->vk.wsi_legacy_scanout) {
tiling = VK_IMAGE_TILING_LINEAR;
}
const VkExternalMemoryImageCreateInfo *external_info =
vk_find_struct_const(pCreateInfo->pNext, EXTERNAL_MEMORY_IMAGE_CREATE_INFO);
/* 1D and 1D_ARRAY textures are always raster-order */
VkImageTiling tiling;
if (pCreateInfo->imageType == VK_IMAGE_TYPE_1D)
tiling = VK_IMAGE_TILING_LINEAR;
else if (modifier == DRM_FORMAT_MOD_INVALID)
tiling = pCreateInfo->tiling;
else if (modifier == DRM_FORMAT_MOD_BROADCOM_UIF)
tiling = VK_IMAGE_TILING_OPTIMAL;
else
tiling = VK_IMAGE_TILING_LINEAR;
const struct v3dv_format *format = v3dv_X(device, get_format)(pCreateInfo->format);
const struct v3dv_format *format =
v3dv_X(device, get_format)(pCreateInfo->format);
v3dv_assert(format != NULL && format->supported);
image = vk_object_zalloc(&device->vk, pAllocator, sizeof(*image),
VK_OBJECT_TYPE_IMAGE);
if (!image)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
assert(pCreateInfo->samples == VK_SAMPLE_COUNT_1_BIT ||
pCreateInfo->samples == VK_SAMPLE_COUNT_4_BIT);
image->type = pCreateInfo->imageType;
image->extent = pCreateInfo->extent;
image->vk_format = pCreateInfo->format;
image->format = format;
image->aspects = vk_format_aspects(image->vk_format);
image->levels = pCreateInfo->mipLevels;
image->array_size = pCreateInfo->arrayLayers;
image->samples = pCreateInfo->samples;
image->usage = pCreateInfo->usage;
image->flags = pCreateInfo->flags;
image->cpp = vk_format_get_blocksize(image->vk.format);
image->tiled = tiling == VK_IMAGE_TILING_OPTIMAL ||
(tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT &&
modifier != DRM_FORMAT_MOD_LINEAR);
image->drm_format_mod = modifier;
image->tiling = tiling;
image->tiled = tiling == VK_IMAGE_TILING_OPTIMAL;
image->external = external_info != NULL;
image->vk.tiling = tiling;
image->vk.drm_format_mod = modifier;
image->cpp = vk_format_get_blocksize(image->vk_format);
/* Our meta paths can create image views with compatible formats for any
* image, so always set this flag to keep the common Vulkan image code
* happy.
*/
image->vk.create_flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
v3d_setup_slices(image);
@@ -376,26 +348,26 @@ create_image_from_swapchain(struct v3dv_device *device,
* #swapchain-wsi-image-create-info .
*/
assert(local_create_info.tiling == VK_IMAGE_TILING_OPTIMAL);
local_create_info.tiling = swapchain_image->tiling;
local_create_info.tiling = swapchain_image->vk.tiling;
VkImageDrmFormatModifierListCreateInfoEXT local_modifier_info = {
.sType = VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT,
.drmFormatModifierCount = 1,
.pDrmFormatModifiers = &swapchain_image->drm_format_mod,
.pDrmFormatModifiers = &swapchain_image->vk.drm_format_mod,
};
if (swapchain_image->drm_format_mod != DRM_FORMAT_MOD_INVALID)
if (swapchain_image->vk.drm_format_mod != DRM_FORMAT_MOD_INVALID)
__vk_append_struct(&local_create_info, &local_modifier_info);
assert(swapchain_image->type == local_create_info.imageType);
assert(swapchain_image->vk_format == local_create_info.format);
assert(swapchain_image->extent.width == local_create_info.extent.width);
assert(swapchain_image->extent.height == local_create_info.extent.height);
assert(swapchain_image->extent.depth == local_create_info.extent.depth);
assert(swapchain_image->array_size == local_create_info.arrayLayers);
assert(swapchain_image->samples == local_create_info.samples);
assert(swapchain_image->tiling == local_create_info.tiling);
assert((swapchain_image->usage & local_create_info.usage) ==
assert(swapchain_image->vk.image_type == local_create_info.imageType);
assert(swapchain_image->vk.format == local_create_info.format);
assert(swapchain_image->vk.extent.width == local_create_info.extent.width);
assert(swapchain_image->vk.extent.height == local_create_info.extent.height);
assert(swapchain_image->vk.extent.depth == local_create_info.extent.depth);
assert(swapchain_image->vk.array_layers == local_create_info.arrayLayers);
assert(swapchain_image->vk.samples == local_create_info.samples);
assert(swapchain_image->vk.tiling == local_create_info.tiling);
assert((swapchain_image->vk.usage & local_create_info.usage) ==
local_create_info.usage);
return create_image(device, &local_create_info, pAllocator, pImage);
@@ -434,7 +406,7 @@ v3dv_GetImageSubresourceLayout(VkDevice device,
layout->depthPitch = image->cube_map_stride;
layout->arrayPitch = image->cube_map_stride;
if (image->type != VK_IMAGE_TYPE_3D) {
if (image->vk.image_type != VK_IMAGE_TYPE_3D) {
layout->size = slice->size;
} else {
/* For 3D images, the size of the slice represents the size of a 2D slice
@@ -444,7 +416,7 @@ v3dv_GetImageSubresourceLayout(VkDevice device,
* arranged in memory from last to first).
*/
if (subresource->mipLevel == 0) {
layout->size = slice->size * image->extent.depth;
layout->size = slice->size * image->vk.extent.depth;
} else {
const struct v3d_resource_slice *prev_slice =
&image->slices[subresource->mipLevel - 1];
@@ -453,22 +425,6 @@ v3dv_GetImageSubresourceLayout(VkDevice device,
}
}
VKAPI_ATTR VkResult VKAPI_CALL
v3dv_GetImageDrmFormatModifierPropertiesEXT(
VkDevice device,
VkImage _image,
VkImageDrmFormatModifierPropertiesEXT *pProperties)
{
V3DV_FROM_HANDLE(v3dv_image, image, _image);
assert(pProperties->sType ==
VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT);
pProperties->drmFormatModifier = image->drm_format_mod;
return VK_SUCCESS;
}
VKAPI_ATTR void VKAPI_CALL
v3dv_DestroyImage(VkDevice _device,
VkImage _image,
@@ -480,7 +436,7 @@ v3dv_DestroyImage(VkDevice _device,
if (image == NULL)
return;
vk_object_free(&device->vk, pAllocator, image);
vk_image_destroy(&device->vk, pAllocator, &image->vk);
}
VkImageViewType
@@ -538,24 +494,26 @@ v3dv_CreateImageView(VkDevice _device,
const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
assert(range->layerCount > 0);
assert(range->baseMipLevel < image->levels);
assert(range->baseMipLevel < image->vk.mip_levels);
#ifdef DEBUG
switch (image->type) {
switch (image->vk.image_type) {
case VK_IMAGE_TYPE_1D:
case VK_IMAGE_TYPE_2D:
assert(range->baseArrayLayer + v3dv_layer_count(image, range) - 1 <=
image->array_size);
assert(range->baseArrayLayer +
vk_image_subresource_layer_count(&image->vk, range) - 1 <=
image->vk.array_layers);
break;
case VK_IMAGE_TYPE_3D:
assert(range->baseArrayLayer + v3dv_layer_count(image, range) - 1
<= u_minify(image->extent.depth, range->baseMipLevel));
assert(range->baseArrayLayer +
vk_image_subresource_layer_count(&image->vk, range) - 1
<= u_minify(image->vk.extent.depth, range->baseMipLevel));
/* VK_KHR_maintenance1 */
assert(pCreateInfo->viewType != VK_IMAGE_VIEW_TYPE_2D ||
((image->flags & VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT) &&
((image->vk.create_flags & VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT) &&
range->levelCount == 1 && range->layerCount == 1));
assert(pCreateInfo->viewType != VK_IMAGE_VIEW_TYPE_2D_ARRAY ||
((image->flags & VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT) &&
((image->vk.create_flags & VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT) &&
range->levelCount == 1));
break;
default:
@@ -568,16 +526,17 @@ v3dv_CreateImageView(VkDevice _device,
iview->type = pCreateInfo->viewType;
iview->base_level = range->baseMipLevel;
iview->max_level = iview->base_level + v3dv_level_count(image, range) - 1;
iview->max_level = iview->base_level +
vk_image_subresource_level_count(&image->vk, range) - 1;
iview->extent = (VkExtent3D) {
.width = u_minify(image->extent.width , iview->base_level),
.height = u_minify(image->extent.height, iview->base_level),
.depth = u_minify(image->extent.depth , iview->base_level),
.width = u_minify(image->vk.extent.width , iview->base_level),
.height = u_minify(image->vk.extent.height, iview->base_level),
.depth = u_minify(image->vk.extent.depth , iview->base_level),
};
iview->first_layer = range->baseArrayLayer;
iview->last_layer = range->baseArrayLayer +
v3dv_layer_count(image, range) - 1;
vk_image_subresource_layer_count(&image->vk, range) - 1;
iview->offset =
v3dv_layer_offset(image, iview->base_level, iview->first_layer);
+10 -10
View File
@@ -79,7 +79,7 @@ clear_image_tlb(struct v3dv_cmd_buffer *cmd_buffer,
union v3dv_clear_value hw_clear_value = { 0 };
if (range->aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) {
get_hw_clear_color(cmd_buffer->device, &clear_value->color, fb_format,
image->vk_format, internal_type, internal_bpp,
image->vk.format, internal_type, internal_bpp,
&hw_clear_value.color[0]);
} else {
assert((range->aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) ||
@@ -89,7 +89,7 @@ clear_image_tlb(struct v3dv_cmd_buffer *cmd_buffer,
}
uint32_t level_count = range->levelCount == VK_REMAINING_MIP_LEVELS ?
image->levels - range->baseMipLevel :
image->vk.mip_levels - range->baseMipLevel :
range->levelCount;
uint32_t min_level = range->baseMipLevel;
uint32_t max_level = range->baseMipLevel + level_count;
@@ -100,9 +100,9 @@ clear_image_tlb(struct v3dv_cmd_buffer *cmd_buffer,
*/
uint32_t min_layer;
uint32_t max_layer;
if (image->type != VK_IMAGE_TYPE_3D) {
if (image->vk.image_type != VK_IMAGE_TYPE_3D) {
uint32_t layer_count = range->layerCount == VK_REMAINING_ARRAY_LAYERS ?
image->array_size - range->baseArrayLayer :
image->vk.array_layers - range->baseArrayLayer :
range->layerCount;
min_layer = range->baseArrayLayer;
max_layer = range->baseArrayLayer + layer_count;
@@ -112,11 +112,11 @@ clear_image_tlb(struct v3dv_cmd_buffer *cmd_buffer,
}
for (uint32_t level = min_level; level < max_level; level++) {
if (image->type == VK_IMAGE_TYPE_3D)
max_layer = u_minify(image->extent.depth, level);
if (image->vk.image_type == VK_IMAGE_TYPE_3D)
max_layer = u_minify(image->vk.extent.depth, level);
uint32_t width = u_minify(image->extent.width, level);
uint32_t height = u_minify(image->extent.height, level);
uint32_t width = u_minify(image->vk.extent.width, level);
uint32_t height = u_minify(image->vk.extent.height, level);
struct v3dv_job *job =
v3dv_cmd_buffer_start_job(cmd_buffer, -1, V3DV_JOB_TYPE_GPU_CL);
@@ -126,7 +126,7 @@ clear_image_tlb(struct v3dv_cmd_buffer *cmd_buffer,
v3dv_job_start_frame(job, width, height, max_layer, false,
1, internal_bpp,
image->samples > VK_SAMPLE_COUNT_1_BIT);
image->vk.samples > VK_SAMPLE_COUNT_1_BIT);
struct v3dv_meta_framebuffer framebuffer;
v3dv_X(job->device, meta_framebuffer_init)(&framebuffer, fb_format,
@@ -138,7 +138,7 @@ clear_image_tlb(struct v3dv_cmd_buffer *cmd_buffer,
/* If this triggers it is an application bug: the spec requires
* that any aspects to clear are present in the image.
*/
assert(range->aspectMask & image->aspects);
assert(range->aspectMask & image->vk.aspects);
v3dv_X(job->device, meta_emit_clear_image_rcl)
(job, image, &framebuffer, &hw_clear_value,
+132 -132
View File
@@ -349,7 +349,7 @@ v3dv_meta_can_use_tlb(struct v3dv_image *image,
if (image->format->rt_type != V3D_OUTPUT_IMAGE_FORMAT_NO) {
if (compat_format)
*compat_format = image->vk_format;
*compat_format = image->vk.format;
return true;
}
@@ -357,7 +357,7 @@ v3dv_meta_can_use_tlb(struct v3dv_image *image,
* a compatible format instead.
*/
if (compat_format) {
*compat_format = get_compatible_tlb_format(image->vk_format);
*compat_format = get_compatible_tlb_format(image->vk.format);
if (*compat_format != VK_FORMAT_UNDEFINED)
return true;
}
@@ -391,7 +391,7 @@ copy_image_to_buffer_tlb(struct v3dv_cmd_buffer *cmd_buffer,
&internal_type, &internal_bpp);
uint32_t num_layers;
if (image->type != VK_IMAGE_TYPE_3D)
if (image->vk.image_type != VK_IMAGE_TYPE_3D)
num_layers = region->imageSubresource.layerCount;
else
num_layers = region->imageExtent.depth;
@@ -403,8 +403,8 @@ copy_image_to_buffer_tlb(struct v3dv_cmd_buffer *cmd_buffer,
return true;
/* Handle copy from compressed format using a compatible format */
const uint32_t block_w = vk_format_get_blockwidth(image->vk_format);
const uint32_t block_h = vk_format_get_blockheight(image->vk_format);
const uint32_t block_w = vk_format_get_blockwidth(image->vk.format);
const uint32_t block_h = vk_format_get_blockheight(image->vk.format);
const uint32_t width = DIV_ROUND_UP(region->imageExtent.width, block_w);
const uint32_t height = DIV_ROUND_UP(region->imageExtent.height, block_h);
@@ -493,10 +493,10 @@ copy_image_to_buffer_blit(struct v3dv_cmd_buffer *cmd_buffer,
dst_format = VK_FORMAT_R8G8B8A8_UINT;
break;
case VK_IMAGE_ASPECT_DEPTH_BIT:
assert(image->vk_format == VK_FORMAT_D32_SFLOAT ||
image->vk_format == VK_FORMAT_D24_UNORM_S8_UINT ||
image->vk_format == VK_FORMAT_X8_D24_UNORM_PACK32);
if (image->vk_format == VK_FORMAT_D32_SFLOAT) {
assert(image->vk.format == VK_FORMAT_D32_SFLOAT ||
image->vk.format == VK_FORMAT_D24_UNORM_S8_UINT ||
image->vk.format == VK_FORMAT_X8_D24_UNORM_PACK32);
if (image->vk.format == VK_FORMAT_D32_SFLOAT) {
src_format = VK_FORMAT_R32_UINT;
dst_format = VK_FORMAT_R32_UINT;
} else {
@@ -518,7 +518,7 @@ copy_image_to_buffer_blit(struct v3dv_cmd_buffer *cmd_buffer,
break;
case VK_IMAGE_ASPECT_STENCIL_BIT:
assert(copy_aspect == VK_IMAGE_ASPECT_STENCIL_BIT);
assert(image->vk_format == VK_FORMAT_D24_UNORM_S8_UINT);
assert(image->vk.format == VK_FORMAT_D24_UNORM_S8_UINT);
/* Copying from S8D24. We want to write 8-bit stencil values only,
* so adjust the buffer bpp for that. Since the hardware stores stencil
* in the LSB, we can just do a RGBA8UI to R8UI blit.
@@ -572,14 +572,14 @@ copy_image_to_buffer_blit(struct v3dv_cmd_buffer *cmd_buffer,
buf_height = region->bufferImageHeight;
/* If the image is compressed, the bpp refers to blocks, not pixels */
uint32_t block_width = vk_format_get_blockwidth(image->vk_format);
uint32_t block_height = vk_format_get_blockheight(image->vk_format);
uint32_t block_width = vk_format_get_blockwidth(image->vk.format);
uint32_t block_height = vk_format_get_blockheight(image->vk.format);
buf_width = buf_width / block_width;
buf_height = buf_height / block_height;
/* Compute layers to copy */
uint32_t num_layers;
if (image->type != VK_IMAGE_TYPE_3D)
if (image->vk.image_type != VK_IMAGE_TYPE_3D)
num_layers = region->imageSubresource.layerCount;
else
num_layers = region->imageExtent.depth;
@@ -596,17 +596,17 @@ copy_image_to_buffer_blit(struct v3dv_cmd_buffer *cmd_buffer,
VkResult result;
struct v3dv_device *device = cmd_buffer->device;
VkDevice _device = v3dv_device_to_handle(device);
if (vk_format_is_compressed(image->vk_format)) {
if (vk_format_is_compressed(image->vk.format)) {
VkImage uiview;
VkImageCreateInfo uiview_info = {
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
.imageType = VK_IMAGE_TYPE_3D,
.format = dst_format,
.extent = { buf_width, buf_height, image->extent.depth },
.mipLevels = image->levels,
.arrayLayers = image->array_size,
.samples = image->samples,
.tiling = image->tiling,
.extent = { buf_width, buf_height, image->vk.extent.depth },
.mipLevels = image->vk.mip_levels,
.arrayLayers = image->vk.array_layers,
.samples = image->vk.samples,
.tiling = image->vk.tiling,
.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE,
.queueFamilyIndexCount = 0,
@@ -739,7 +739,7 @@ v3dv_CmdCopyImageToBuffer2KHR(VkCommandBuffer commandBuffer,
V3DV_FROM_HANDLE(v3dv_image, image, info->srcImage);
V3DV_FROM_HANDLE(v3dv_buffer, buffer, info->dstBuffer);
assert(image->samples == VK_SAMPLE_COUNT_1_BIT);
assert(image->vk.samples == VK_SAMPLE_COUNT_1_BIT);
for (uint32_t i = 0; i < info->regionCount; i++) {
if (copy_image_to_buffer_tlb(cmd_buffer, buffer, image, &info->pRegions[i]))
@@ -761,14 +761,14 @@ copy_image_tfu(struct v3dv_cmd_buffer *cmd_buffer,
const VkImageCopy2KHR *region)
{
/* Destination can't be raster format */
if (dst->tiling == VK_IMAGE_TILING_LINEAR)
if (dst->vk.tiling == VK_IMAGE_TILING_LINEAR)
return false;
/* We can only do full copies, so if the format is D24S8 both aspects need
* to be copied. We only need to check the dst format because the spec
* states that depth/stencil formats must match exactly.
*/
if (dst->vk_format == VK_FORMAT_D24_UNORM_S8_UINT) {
if (dst->vk.format == VK_FORMAT_D24_UNORM_S8_UINT) {
const VkImageAspectFlags ds_aspects = VK_IMAGE_ASPECT_DEPTH_BIT |
VK_IMAGE_ASPECT_STENCIL_BIT;
if (region->dstSubresource.aspectMask != ds_aspects)
@@ -784,8 +784,8 @@ copy_image_tfu(struct v3dv_cmd_buffer *cmd_buffer,
* checking against the region dimensions, which are in units of the source
* image format.
*/
if (vk_format_is_compressed(dst->vk_format) !=
vk_format_is_compressed(src->vk_format)) {
if (vk_format_is_compressed(dst->vk.format) !=
vk_format_is_compressed(src->vk.format)) {
return false;
}
@@ -798,8 +798,8 @@ copy_image_tfu(struct v3dv_cmd_buffer *cmd_buffer,
return false;
const uint32_t dst_mip_level = region->dstSubresource.mipLevel;
uint32_t dst_width = u_minify(dst->extent.width, dst_mip_level);
uint32_t dst_height = u_minify(dst->extent.height, dst_mip_level);
uint32_t dst_width = u_minify(dst->vk.extent.width, dst_mip_level);
uint32_t dst_height = u_minify(dst->vk.extent.height, dst_mip_level);
if (region->extent.width != dst_width || region->extent.height != dst_height)
return false;
@@ -809,15 +809,15 @@ copy_image_tfu(struct v3dv_cmd_buffer *cmd_buffer,
* members represent the texel dimensions of the source image and not
* the destination."
*/
const uint32_t block_w = vk_format_get_blockwidth(src->vk_format);
const uint32_t block_h = vk_format_get_blockheight(src->vk_format);
const uint32_t block_w = vk_format_get_blockwidth(src->vk.format);
const uint32_t block_h = vk_format_get_blockheight(src->vk.format);
uint32_t width = DIV_ROUND_UP(region->extent.width, block_w);
uint32_t height = DIV_ROUND_UP(region->extent.height, block_h);
/* Account for sample count */
assert(dst->samples == src->samples);
if (dst->samples > VK_SAMPLE_COUNT_1_BIT) {
assert(dst->samples == VK_SAMPLE_COUNT_4_BIT);
assert(dst->vk.samples == src->vk.samples);
if (dst->vk.samples > VK_SAMPLE_COUNT_1_BIT) {
assert(dst->vk.samples == VK_SAMPLE_COUNT_4_BIT);
width *= 2;
height *= 2;
}
@@ -840,14 +840,14 @@ copy_image_tfu(struct v3dv_cmd_buffer *cmd_buffer,
dst->cpp, NULL);
/* Emit a TFU job for each layer to blit */
const uint32_t layer_count = dst->type != VK_IMAGE_TYPE_3D ?
const uint32_t layer_count = dst->vk.image_type != VK_IMAGE_TYPE_3D ?
region->dstSubresource.layerCount :
region->extent.depth;
const uint32_t src_mip_level = region->srcSubresource.mipLevel;
const uint32_t base_src_layer = src->type != VK_IMAGE_TYPE_3D ?
const uint32_t base_src_layer = src->vk.image_type != VK_IMAGE_TYPE_3D ?
region->srcSubresource.baseArrayLayer : region->srcOffset.z;
const uint32_t base_dst_layer = dst->type != VK_IMAGE_TYPE_3D ?
const uint32_t base_dst_layer = dst->vk.image_type != VK_IMAGE_TYPE_3D ?
region->dstSubresource.baseArrayLayer : region->dstOffset.z;
for (uint32_t i = 0; i < layer_count; i++) {
v3dv_X(cmd_buffer->device, meta_emit_tfu_job)
@@ -894,12 +894,12 @@ copy_image_tlb(struct v3dv_cmd_buffer *cmd_buffer,
* srcSubresource (for non-3D) must match the number of slices of the
* extent (for 3D) or layers of the dstSubresource (for non-3D)."
*/
assert((src->type != VK_IMAGE_TYPE_3D ?
assert((src->vk.image_type != VK_IMAGE_TYPE_3D ?
region->srcSubresource.layerCount : region->extent.depth) ==
(dst->type != VK_IMAGE_TYPE_3D ?
(dst->vk.image_type != VK_IMAGE_TYPE_3D ?
region->dstSubresource.layerCount : region->extent.depth));
uint32_t num_layers;
if (dst->type != VK_IMAGE_TYPE_3D)
if (dst->vk.image_type != VK_IMAGE_TYPE_3D)
num_layers = region->dstSubresource.layerCount;
else
num_layers = region->extent.depth;
@@ -911,13 +911,13 @@ copy_image_tlb(struct v3dv_cmd_buffer *cmd_buffer,
return true;
/* Handle copy to compressed image using compatible format */
const uint32_t block_w = vk_format_get_blockwidth(dst->vk_format);
const uint32_t block_h = vk_format_get_blockheight(dst->vk_format);
const uint32_t block_w = vk_format_get_blockwidth(dst->vk.format);
const uint32_t block_h = vk_format_get_blockheight(dst->vk.format);
const uint32_t width = DIV_ROUND_UP(region->extent.width, block_w);
const uint32_t height = DIV_ROUND_UP(region->extent.height, block_h);
v3dv_job_start_frame(job, width, height, num_layers, false, 1, internal_bpp,
src->samples > VK_SAMPLE_COUNT_1_BIT);
src->vk.samples > VK_SAMPLE_COUNT_1_BIT);
struct v3dv_meta_framebuffer framebuffer;
v3dv_X(job->device, meta_framebuffer_init)(&framebuffer, fb_format,
@@ -956,18 +956,18 @@ create_image_alias(struct v3dv_cmd_buffer *cmd_buffer,
VkImageCreateInfo info = {
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
.imageType = src->type,
.imageType = src->vk.image_type,
.format = format,
.extent = {
.width = src->extent.width * width_scale,
.height = src->extent.height * height_scale,
.depth = src->extent.depth,
.width = src->vk.extent.width * width_scale,
.height = src->vk.extent.height * height_scale,
.depth = src->vk.extent.depth,
},
.mipLevels = src->levels,
.arrayLayers = src->array_size,
.samples = src->samples,
.tiling = src->tiling,
.usage = src->usage,
.mipLevels = src->vk.mip_levels,
.arrayLayers = src->vk.array_layers,
.samples = src->vk.samples,
.tiling = src->vk.tiling,
.usage = src->vk.usage,
};
VkImage _image;
@@ -994,10 +994,10 @@ copy_image_blit(struct v3dv_cmd_buffer *cmd_buffer,
struct v3dv_image *src,
const VkImageCopy2KHR *region)
{
const uint32_t src_block_w = vk_format_get_blockwidth(src->vk_format);
const uint32_t src_block_h = vk_format_get_blockheight(src->vk_format);
const uint32_t dst_block_w = vk_format_get_blockwidth(dst->vk_format);
const uint32_t dst_block_h = vk_format_get_blockheight(dst->vk_format);
const uint32_t src_block_w = vk_format_get_blockwidth(src->vk.format);
const uint32_t src_block_h = vk_format_get_blockheight(src->vk.format);
const uint32_t dst_block_w = vk_format_get_blockwidth(dst->vk.format);
const uint32_t dst_block_h = vk_format_get_blockheight(dst->vk.format);
const float block_scale_w = (float)src_block_w / (float)dst_block_w;
const float block_scale_h = (float)src_block_h / (float)dst_block_h;
@@ -1011,7 +1011,7 @@ copy_image_blit(struct v3dv_cmd_buffer *cmd_buffer,
float src_scale_h = 1.0f;
float dst_scale_w = block_scale_w;
float dst_scale_h = block_scale_h;
if (vk_format_is_compressed(src->vk_format)) {
if (vk_format_is_compressed(src->vk.format)) {
/* If we are copying from a compressed format we should be aware that we
* are going to texture from the source image, and the texture setup
* knows the actual size of the image, so we need to choose a format
@@ -1062,7 +1062,7 @@ copy_image_blit(struct v3dv_cmd_buffer *cmd_buffer,
dst_scale_w, dst_scale_h, format);
} else {
format = src->format->rt_type != V3D_OUTPUT_IMAGE_FORMAT_NO ?
src->vk_format : get_compatible_tlb_format(src->vk_format);
src->vk.format : get_compatible_tlb_format(src->vk.format);
if (format == VK_FORMAT_UNDEFINED)
return false;
@@ -1139,7 +1139,7 @@ v3dv_CmdCopyImage2KHR(VkCommandBuffer commandBuffer,
V3DV_FROM_HANDLE(v3dv_image, src, info->srcImage);
V3DV_FROM_HANDLE(v3dv_image, dst, info->dstImage);
assert(src->samples == dst->samples);
assert(src->vk.samples == dst->vk.samples);
for (uint32_t i = 0; i < info->regionCount; i++) {
if (copy_image_tfu(cmd_buffer, dst, src, &info->pRegions[i]))
@@ -1260,10 +1260,10 @@ copy_buffer_to_image_tfu(struct v3dv_cmd_buffer *cmd_buffer,
struct v3dv_buffer *buffer,
const VkBufferImageCopy2KHR *region)
{
assert(image->samples == VK_SAMPLE_COUNT_1_BIT);
assert(image->vk.samples == VK_SAMPLE_COUNT_1_BIT);
/* Destination can't be raster format */
if (image->tiling == VK_IMAGE_TILING_LINEAR)
if (image->vk.tiling == VK_IMAGE_TILING_LINEAR)
return false;
/* We can't copy D24S8 because buffer to image copies only copy one aspect
@@ -1273,8 +1273,8 @@ copy_buffer_to_image_tfu(struct v3dv_cmd_buffer *cmd_buffer,
* is not a straight copy, we would havew to swizzle the channels, which the
* TFU can't do.
*/
if (image->vk_format == VK_FORMAT_D24_UNORM_S8_UINT ||
image->vk_format == VK_FORMAT_X8_D24_UNORM_PACK32) {
if (image->vk.format == VK_FORMAT_D24_UNORM_S8_UINT ||
image->vk.format == VK_FORMAT_X8_D24_UNORM_PACK32) {
return false;
}
@@ -1295,12 +1295,12 @@ copy_buffer_to_image_tfu(struct v3dv_cmd_buffer *cmd_buffer,
else
height = region->bufferImageHeight;
if (width != image->extent.width || height != image->extent.height)
if (width != image->vk.extent.width || height != image->vk.extent.height)
return false;
/* Handle region semantics for compressed images */
const uint32_t block_w = vk_format_get_blockwidth(image->vk_format);
const uint32_t block_h = vk_format_get_blockheight(image->vk_format);
const uint32_t block_w = vk_format_get_blockwidth(image->vk.format);
const uint32_t block_h = vk_format_get_blockheight(image->vk.format);
width = DIV_ROUND_UP(width, block_w);
height = DIV_ROUND_UP(height, block_h);
@@ -1317,7 +1317,7 @@ copy_buffer_to_image_tfu(struct v3dv_cmd_buffer *cmd_buffer,
const struct v3d_resource_slice *slice = &image->slices[mip_level];
uint32_t num_layers;
if (image->type != VK_IMAGE_TYPE_3D)
if (image->vk.image_type != VK_IMAGE_TYPE_3D)
num_layers = region->imageSubresource.layerCount;
else
num_layers = region->imageExtent.depth;
@@ -1333,7 +1333,7 @@ copy_buffer_to_image_tfu(struct v3dv_cmd_buffer *cmd_buffer,
const uint32_t buffer_stride = width * image->cpp;
for (int i = 0; i < num_layers; i++) {
uint32_t layer;
if (image->type != VK_IMAGE_TYPE_3D)
if (image->vk.image_type != VK_IMAGE_TYPE_3D)
layer = region->imageSubresource.baseArrayLayer + i;
else
layer = region->imageOffset.z + i;
@@ -1403,7 +1403,7 @@ copy_buffer_to_image_tlb(struct v3dv_cmd_buffer *cmd_buffer,
&internal_type, &internal_bpp);
uint32_t num_layers;
if (image->type != VK_IMAGE_TYPE_3D)
if (image->vk.image_type != VK_IMAGE_TYPE_3D)
num_layers = region->imageSubresource.layerCount;
else
num_layers = region->imageExtent.depth;
@@ -1415,8 +1415,8 @@ copy_buffer_to_image_tlb(struct v3dv_cmd_buffer *cmd_buffer,
return true;
/* Handle copy to compressed format using a compatible format */
const uint32_t block_w = vk_format_get_blockwidth(image->vk_format);
const uint32_t block_h = vk_format_get_blockheight(image->vk_format);
const uint32_t block_w = vk_format_get_blockwidth(image->vk.format);
const uint32_t block_h = vk_format_get_blockheight(image->vk.format);
const uint32_t width = DIV_ROUND_UP(region->imageExtent.width, block_w);
const uint32_t height = DIV_ROUND_UP(region->imageExtent.height, block_h);
@@ -1961,7 +1961,7 @@ texel_buffer_shader_copy(struct v3dv_cmd_buffer *cmd_buffer,
return handled;
/* FIXME: we only handle uncompressed images for now. */
if (vk_format_is_compressed(image->vk_format))
if (vk_format_is_compressed(image->vk.format))
return handled;
const VkColorComponentFlags full_cmask = VK_COLOR_COMPONENT_R_BIT |
@@ -1999,7 +1999,7 @@ texel_buffer_shader_copy(struct v3dv_cmd_buffer *cmd_buffer,
*/
const VkImageSubresourceLayers *resource = &regions[0].imageSubresource;
uint32_t num_layers;
if (image->type != VK_IMAGE_TYPE_3D) {
if (image->vk.image_type != VK_IMAGE_TYPE_3D) {
num_layers = resource->layerCount;
} else {
assert(region_count == 1);
@@ -2011,7 +2011,7 @@ texel_buffer_shader_copy(struct v3dv_cmd_buffer *cmd_buffer,
struct v3dv_meta_texel_buffer_copy_pipeline *pipeline = NULL;
bool ok = get_copy_texel_buffer_pipeline(cmd_buffer->device,
dst_format, cmask, cswizzle,
image->type, num_layers > 1,
image->vk.image_type, num_layers > 1,
&pipeline);
if (!ok)
return handled;
@@ -2087,12 +2087,12 @@ texel_buffer_shader_copy(struct v3dv_cmd_buffer *cmd_buffer,
* For 3D images, this creates a layered framebuffer with a number of
* layers matching the depth extent of the 3D image.
*/
uint32_t fb_width = u_minify(image->extent.width, resource->mipLevel);
uint32_t fb_height = u_minify(image->extent.height, resource->mipLevel);
uint32_t fb_width = u_minify(image->vk.extent.width, resource->mipLevel);
uint32_t fb_height = u_minify(image->vk.extent.height, resource->mipLevel);
VkImageViewCreateInfo image_view_info = {
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = v3dv_image_to_handle(image),
.viewType = v3dv_image_type_to_view_type(image->type),
.viewType = v3dv_image_type_to_view_type(image->vk.image_type),
.format = dst_format,
.subresourceRange = {
.aspectMask = aspect,
@@ -2287,7 +2287,7 @@ copy_buffer_to_image_blit(struct v3dv_cmd_buffer *cmd_buffer,
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
.imageType = VK_IMAGE_TYPE_2D,
.format = src_format,
.extent = { image->extent.width, image->extent.height, 1 },
.extent = { image->vk.extent.width, image->vk.extent.height, 1 },
.mipLevels = 1,
.arrayLayers = 1,
.samples = VK_SAMPLE_COUNT_1_BIT,
@@ -2327,7 +2327,7 @@ copy_buffer_to_image_blit(struct v3dv_cmd_buffer *cmd_buffer,
* image subresource so we can take this from the first region.
*/
uint32_t num_layers;
if (image->type != VK_IMAGE_TYPE_3D)
if (image->vk.image_type != VK_IMAGE_TYPE_3D)
num_layers = regions[0].imageSubresource.layerCount;
else
num_layers = regions[0].imageExtent.depth;
@@ -2338,8 +2338,8 @@ copy_buffer_to_image_blit(struct v3dv_cmd_buffer *cmd_buffer,
*/
assert(num_layers == 1 || region_count == 1);
const uint32_t block_width = vk_format_get_blockwidth(image->vk_format);
const uint32_t block_height = vk_format_get_blockheight(image->vk_format);
const uint32_t block_width = vk_format_get_blockwidth(image->vk.format);
const uint32_t block_height = vk_format_get_blockheight(image->vk.format);
/* Copy regions by uploading each region to a temporary tiled image using
* the memory we have just allocated as storage.
@@ -2543,9 +2543,9 @@ copy_buffer_to_image_shader(struct v3dv_cmd_buffer *cmd_buffer,
dst_format = src_format;
break;
case VK_IMAGE_ASPECT_DEPTH_BIT:
assert(image->vk_format == VK_FORMAT_D32_SFLOAT ||
image->vk_format == VK_FORMAT_D24_UNORM_S8_UINT ||
image->vk_format == VK_FORMAT_X8_D24_UNORM_PACK32);
assert(image->vk.format == VK_FORMAT_D32_SFLOAT ||
image->vk.format == VK_FORMAT_D24_UNORM_S8_UINT ||
image->vk.format == VK_FORMAT_X8_D24_UNORM_PACK32);
src_format = VK_FORMAT_R8G8B8A8_UINT;
dst_format = src_format;
aspect = VK_IMAGE_ASPECT_COLOR_BIT;
@@ -2554,8 +2554,8 @@ copy_buffer_to_image_shader(struct v3dv_cmd_buffer *cmd_buffer,
* in the buffer is stored in the 24-LSB, but V3D wants it in the
* 24-MSB.
*/
if (image->vk_format == VK_FORMAT_D24_UNORM_S8_UINT ||
image->vk_format == VK_FORMAT_X8_D24_UNORM_PACK32) {
if (image->vk.format == VK_FORMAT_D24_UNORM_S8_UINT ||
image->vk.format == VK_FORMAT_X8_D24_UNORM_PACK32) {
cmask = VK_COLOR_COMPONENT_G_BIT |
VK_COLOR_COMPONENT_B_BIT |
VK_COLOR_COMPONENT_A_BIT;
@@ -2573,7 +2573,7 @@ copy_buffer_to_image_shader(struct v3dv_cmd_buffer *cmd_buffer,
* blit to an RGBA8UI destination masking out writes to components
* GBA (which map to the D24 component of a S8D24 image).
*/
assert(image->vk_format == VK_FORMAT_D24_UNORM_S8_UINT);
assert(image->vk.format == VK_FORMAT_D24_UNORM_S8_UINT);
buf_bpp = 1;
src_format = VK_FORMAT_R8_UINT;
dst_format = VK_FORMAT_R8G8B8A8_UINT;
@@ -2626,13 +2626,13 @@ copy_buffer_to_image_cpu(struct v3dv_cmd_buffer *cmd_buffer,
const VkBufferImageCopy2KHR *region)
{
/* FIXME */
if (vk_format_is_depth_or_stencil(image->vk_format))
if (vk_format_is_depth_or_stencil(image->vk.format))
return false;
if (vk_format_is_compressed(image->vk_format))
if (vk_format_is_compressed(image->vk.format))
return false;
if (image->tiling == VK_IMAGE_TILING_LINEAR)
if (image->vk.tiling == VK_IMAGE_TILING_LINEAR)
return false;
uint32_t buffer_width, buffer_height;
@@ -2650,7 +2650,7 @@ copy_buffer_to_image_cpu(struct v3dv_cmd_buffer *cmd_buffer,
uint32_t buffer_layer_stride = buffer_stride * buffer_height;
uint32_t num_layers;
if (image->type != VK_IMAGE_TYPE_3D)
if (image->vk.image_type != VK_IMAGE_TYPE_3D)
num_layers = region->imageSubresource.layerCount;
else
num_layers = region->imageExtent.depth;
@@ -2689,7 +2689,7 @@ v3dv_CmdCopyBufferToImage2KHR(VkCommandBuffer commandBuffer,
V3DV_FROM_HANDLE(v3dv_buffer, buffer, info->srcBuffer);
V3DV_FROM_HANDLE(v3dv_image, image, info->dstImage);
assert(image->samples == VK_SAMPLE_COUNT_1_BIT);
assert(image->vk.samples == VK_SAMPLE_COUNT_1_BIT);
uint32_t r = 0;
while (r < info->regionCount) {
@@ -2719,7 +2719,7 @@ v3dv_CmdCopyBufferToImage2KHR(VkCommandBuffer commandBuffer,
break;
/* For 3D images we also need to check the depth extent */
if (image->type == VK_IMAGE_TYPE_3D &&
if (image->vk.image_type == VK_IMAGE_TYPE_3D &&
info->pRegions[s].imageExtent.depth !=
info->pRegions[r].imageExtent.depth) {
break;
@@ -2775,15 +2775,15 @@ blit_tfu(struct v3dv_cmd_buffer *cmd_buffer,
struct v3dv_image *src,
const VkImageBlit2KHR *region)
{
assert(dst->samples == VK_SAMPLE_COUNT_1_BIT);
assert(src->samples == VK_SAMPLE_COUNT_1_BIT);
assert(dst->vk.samples == VK_SAMPLE_COUNT_1_BIT);
assert(src->vk.samples == VK_SAMPLE_COUNT_1_BIT);
/* Format must match */
if (src->vk_format != dst->vk_format)
if (src->vk.format != dst->vk.format)
return false;
/* Destination can't be raster format */
if (dst->tiling == VK_IMAGE_TILING_LINEAR)
if (dst->vk.tiling == VK_IMAGE_TILING_LINEAR)
return false;
/* Source region must start at (0,0) */
@@ -2795,8 +2795,8 @@ blit_tfu(struct v3dv_cmd_buffer *cmd_buffer,
return false;
const uint32_t dst_mip_level = region->dstSubresource.mipLevel;
const uint32_t dst_width = u_minify(dst->extent.width, dst_mip_level);
const uint32_t dst_height = u_minify(dst->extent.height, dst_mip_level);
const uint32_t dst_width = u_minify(dst->vk.extent.width, dst_mip_level);
const uint32_t dst_height = u_minify(dst->vk.extent.height, dst_mip_level);
if (region->dstOffsets[1].x < dst_width - 1||
region->dstOffsets[1].y < dst_height - 1) {
return false;
@@ -2811,7 +2811,7 @@ blit_tfu(struct v3dv_cmd_buffer *cmd_buffer,
/* If the format is D24S8 both aspects need to be copied, since the TFU
* can't be programmed to copy only one aspect of the image.
*/
if (dst->vk_format == VK_FORMAT_D24_UNORM_S8_UINT) {
if (dst->vk.format == VK_FORMAT_D24_UNORM_S8_UINT) {
const VkImageAspectFlags ds_aspects = VK_IMAGE_ASPECT_DEPTH_BIT |
VK_IMAGE_ASPECT_STENCIL_BIT;
if (region->dstSubresource.aspectMask != ds_aspects)
@@ -2834,7 +2834,7 @@ blit_tfu(struct v3dv_cmd_buffer *cmd_buffer,
uint32_t min_dst_layer;
uint32_t max_dst_layer;
bool dst_mirror_z = false;
if (dst->type == VK_IMAGE_TYPE_3D) {
if (dst->vk.image_type == VK_IMAGE_TYPE_3D) {
compute_blit_3d_layers(region->dstOffsets,
&min_dst_layer, &max_dst_layer,
&dst_mirror_z);
@@ -2846,7 +2846,7 @@ blit_tfu(struct v3dv_cmd_buffer *cmd_buffer,
uint32_t min_src_layer;
uint32_t max_src_layer;
bool src_mirror_z = false;
if (src->type == VK_IMAGE_TYPE_3D) {
if (src->vk.image_type == VK_IMAGE_TYPE_3D) {
compute_blit_3d_layers(region->srcOffsets,
&min_src_layer, &max_src_layer,
&src_mirror_z);
@@ -3782,11 +3782,11 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer,
/* We don't support rendering to linear depth/stencil, this should have
* been rewritten to a compatible color blit by the caller.
*/
assert(dst->tiling != VK_IMAGE_TILING_LINEAR ||
assert(dst->vk.tiling != VK_IMAGE_TILING_LINEAR ||
!vk_format_is_depth_or_stencil(dst_format));
/* Can't sample from linear images */
if (src->tiling == VK_IMAGE_TILING_LINEAR && src->type != VK_IMAGE_TYPE_1D)
if (src->vk.tiling == VK_IMAGE_TILING_LINEAR && src->vk.image_type != VK_IMAGE_TYPE_1D)
return false;
VkImageBlit2KHR region = *_region;
@@ -3844,23 +3844,23 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer,
* need to apply those same semantics here when we compute the size of the
* destination image level.
*/
const uint32_t dst_block_w = vk_format_get_blockwidth(dst->vk_format);
const uint32_t dst_block_h = vk_format_get_blockheight(dst->vk_format);
const uint32_t src_block_w = vk_format_get_blockwidth(src->vk_format);
const uint32_t src_block_h = vk_format_get_blockheight(src->vk_format);
const uint32_t dst_block_w = vk_format_get_blockwidth(dst->vk.format);
const uint32_t dst_block_h = vk_format_get_blockheight(dst->vk.format);
const uint32_t src_block_w = vk_format_get_blockwidth(src->vk.format);
const uint32_t src_block_h = vk_format_get_blockheight(src->vk.format);
const uint32_t dst_level_w =
u_minify(DIV_ROUND_UP(dst->extent.width * src_block_w, dst_block_w),
u_minify(DIV_ROUND_UP(dst->vk.extent.width * src_block_w, dst_block_w),
region.dstSubresource.mipLevel);
const uint32_t dst_level_h =
u_minify(DIV_ROUND_UP(dst->extent.height * src_block_h, dst_block_h),
u_minify(DIV_ROUND_UP(dst->vk.extent.height * src_block_h, dst_block_h),
region.dstSubresource.mipLevel);
const uint32_t src_level_w =
u_minify(src->extent.width, region.srcSubresource.mipLevel);
u_minify(src->vk.extent.width, region.srcSubresource.mipLevel);
const uint32_t src_level_h =
u_minify(src->extent.height, region.srcSubresource.mipLevel);
u_minify(src->vk.extent.height, region.srcSubresource.mipLevel);
const uint32_t src_level_d =
u_minify(src->extent.depth, region.srcSubresource.mipLevel);
u_minify(src->vk.extent.depth, region.srcSubresource.mipLevel);
uint32_t dst_x, dst_y, dst_w, dst_h;
bool dst_mirror_x, dst_mirror_y;
@@ -3879,7 +3879,7 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer,
uint32_t min_dst_layer;
uint32_t max_dst_layer;
bool dst_mirror_z = false;
if (dst->type != VK_IMAGE_TYPE_3D) {
if (dst->vk.image_type != VK_IMAGE_TYPE_3D) {
min_dst_layer = region.dstSubresource.baseArrayLayer;
max_dst_layer = min_dst_layer + region.dstSubresource.layerCount;
} else {
@@ -3891,7 +3891,7 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer,
uint32_t min_src_layer;
uint32_t max_src_layer;
bool src_mirror_z = false;
if (src->type != VK_IMAGE_TYPE_3D) {
if (src->vk.image_type != VK_IMAGE_TYPE_3D) {
min_src_layer = region.srcSubresource.baseArrayLayer;
max_src_layer = min_src_layer + region.srcSubresource.layerCount;
} else {
@@ -3913,7 +3913,7 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer,
(float)(src_y + src_h),
};
if (src->samples == VK_SAMPLE_COUNT_1_BIT) {
if (src->vk.samples == VK_SAMPLE_COUNT_1_BIT) {
coords[0] /= (float)src_level_w;
coords[1] /= (float)src_level_h;
coords[2] /= (float)src_level_w;
@@ -3945,8 +3945,8 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer,
/* Get the blit pipeline */
struct v3dv_meta_blit_pipeline *pipeline = NULL;
bool ok = get_blit_pipeline(cmd_buffer->device,
dst_format, src_format, cmask, src->type,
dst->samples, src->samples,
dst_format, src_format, cmask, src->vk.image_type,
dst->vk.samples, src->vk.samples,
&pipeline);
if (!ok)
return handled;
@@ -4016,7 +4016,7 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer,
VkImageViewCreateInfo dst_image_view_info = {
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = v3dv_image_to_handle(dst),
.viewType = v3dv_image_type_to_view_type(dst->type),
.viewType = v3dv_image_type_to_view_type(dst->vk.image_type),
.format = dst_format,
.subresourceRange = {
.aspectMask = aspects,
@@ -4074,7 +4074,7 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer,
VkImageViewCreateInfo src_image_view_info = {
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = v3dv_image_to_handle(src),
.viewType = v3dv_image_type_to_view_type(src->type),
.viewType = v3dv_image_type_to_view_type(src->vk.image_type),
.format = src_format,
.components = *cswizzle,
.subresourceRange = {
@@ -4082,7 +4082,7 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer,
.baseMipLevel = region.srcSubresource.mipLevel,
.levelCount = 1,
.baseArrayLayer =
src->type == VK_IMAGE_TYPE_3D ? 0 : min_src_layer + i,
src->vk.image_type == VK_IMAGE_TYPE_3D ? 0 : min_src_layer + i,
.layerCount = 1
},
};
@@ -4156,7 +4156,7 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer,
* based on the ratio of the depth of the source and the destination
* images, picking the coordinate in the middle of each step.
*/
if (src->type == VK_IMAGE_TYPE_3D) {
if (src->vk.image_type == VK_IMAGE_TYPE_3D) {
tex_coords[4] =
!mirror_z ?
(min_src_layer + (i + 0.5f) * src_z_step) / (float)src_level_d :
@@ -4193,18 +4193,18 @@ v3dv_CmdBlitImage2KHR(VkCommandBuffer commandBuffer,
assert(cmd_buffer->state.job == NULL);
/* From the Vulkan 1.0 spec, vkCmdBlitImage valid usage */
assert(dst->samples == VK_SAMPLE_COUNT_1_BIT &&
src->samples == VK_SAMPLE_COUNT_1_BIT);
assert(dst->vk.samples == VK_SAMPLE_COUNT_1_BIT &&
src->vk.samples == VK_SAMPLE_COUNT_1_BIT);
/* We don't export VK_FORMAT_FEATURE_BLIT_DST_BIT on compressed formats */
assert(!vk_format_is_compressed(dst->vk_format));
assert(!vk_format_is_compressed(dst->vk.format));
for (uint32_t i = 0; i < pBlitImageInfo->regionCount; i++) {
if (blit_tfu(cmd_buffer, dst, src, &pBlitImageInfo->pRegions[i]))
continue;
if (blit_shader(cmd_buffer,
dst, dst->vk_format,
src, src->vk_format,
dst, dst->vk.format,
src, src->vk.format,
0, NULL,
&pBlitImageInfo->pRegions[i],
pBlitImageInfo->filter, true)) {
@@ -4228,10 +4228,10 @@ resolve_image_tlb(struct v3dv_cmd_buffer *cmd_buffer,
if (!v3dv_X(cmd_buffer->device, format_supports_tlb_resolve)(src->format))
return false;
const VkFormat fb_format = src->vk_format;
const VkFormat fb_format = src->vk.format;
uint32_t num_layers;
if (dst->type != VK_IMAGE_TYPE_3D)
if (dst->vk.image_type != VK_IMAGE_TYPE_3D)
num_layers = region->dstSubresource.layerCount;
else
num_layers = region->extent.depth;
@@ -4242,8 +4242,8 @@ resolve_image_tlb(struct v3dv_cmd_buffer *cmd_buffer,
if (!job)
return true;
const uint32_t block_w = vk_format_get_blockwidth(dst->vk_format);
const uint32_t block_h = vk_format_get_blockheight(dst->vk_format);
const uint32_t block_w = vk_format_get_blockwidth(dst->vk.format);
const uint32_t block_h = vk_format_get_blockheight(dst->vk.format);
const uint32_t width = DIV_ROUND_UP(region->extent.width, block_w);
const uint32_t height = DIV_ROUND_UP(region->extent.height, block_h);
@@ -4293,8 +4293,8 @@ resolve_image_blit(struct v3dv_cmd_buffer *cmd_buffer,
},
};
return blit_shader(cmd_buffer,
dst, dst->vk_format,
src, src->vk_format,
dst, dst->vk.format,
src, src->vk.format,
0, NULL,
&blit_region, VK_FILTER_NEAREST, true);
}
@@ -4312,8 +4312,8 @@ v3dv_CmdResolveImage2KHR(VkCommandBuffer commandBuffer,
assert(cmd_buffer->state.pass == NULL);
assert(cmd_buffer->state.job == NULL);
assert(src->samples == VK_SAMPLE_COUNT_4_BIT);
assert(dst->samples == VK_SAMPLE_COUNT_1_BIT);
assert(src->vk.samples == VK_SAMPLE_COUNT_4_BIT);
assert(dst->vk.samples == VK_SAMPLE_COUNT_1_BIT);
for (uint32_t i = 0; i < info->regionCount; i++) {
if (resolve_image_tlb(cmd_buffer, dst, src, &info->pRegions[i]))
+3 -29
View File
@@ -38,6 +38,7 @@
#include "vk_device.h"
#include "vk_instance.h"
#include "vk_image.h"
#include "vk_physical_device.h"
#include "vk_shader_module.h"
#include "vk_util.h"
@@ -518,35 +519,19 @@ struct v3d_resource_slice {
};
struct v3dv_image {
struct vk_object_base base;
struct vk_image vk;
VkImageType type;
VkImageAspectFlags aspects;
VkExtent3D extent;
uint32_t levels;
uint32_t array_size;
uint32_t samples;
VkImageUsageFlags usage;
VkImageCreateFlags flags;
VkImageTiling tiling;
VkFormat vk_format;
const struct v3dv_format *format;
uint32_t cpp;
uint64_t drm_format_mod;
bool tiled;
bool external;
struct v3d_resource_slice slices[V3D_MAX_MIP_LEVELS];
uint64_t size; /* Total size in bytes */
uint32_t cube_map_stride;
uint32_t alignment;
struct v3dv_device_memory *mem;
VkDeviceSize mem_offset;
uint32_t alignment;
};
VkImageViewType v3dv_image_type_to_view_type(VkImageType type);
@@ -2112,17 +2097,6 @@ V3DV_DEFINE_NONDISP_HANDLE_CASTS(v3dv_render_pass, VkRenderPass)
V3DV_DEFINE_NONDISP_HANDLE_CASTS(v3dv_sampler, VkSampler)
V3DV_DEFINE_NONDISP_HANDLE_CASTS(v3dv_semaphore, VkSemaphore)
/* This is defined as a macro so that it works for both
* VkImageSubresourceRange and VkImageSubresourceLayers
*/
#define v3dv_layer_count(_image, _range) \
((_range)->layerCount == VK_REMAINING_ARRAY_LAYERS ? \
(_image)->array_size - (_range)->baseArrayLayer : (_range)->layerCount)
#define v3dv_level_count(_image, _range) \
((_range)->levelCount == VK_REMAINING_MIP_LEVELS ? \
(_image)->levels - (_range)->baseMipLevel : (_range)->levelCount)
static inline int
v3dv_ioctl(int fd, unsigned long request, void *arg)
{
+1 -1
View File
@@ -331,7 +331,7 @@ get_texture_size_from_image_view(struct v3dv_image_view *image_view,
return image_view->max_level - image_view->base_level + 1;
case QUNIFORM_TEXTURE_SAMPLES:
assert(image_view->image);
return image_view->image->samples;
return image_view->image->vk.samples;
default:
unreachable("Bad texture size field");
}
+5 -5
View File
@@ -127,7 +127,7 @@ cmd_buffer_render_pass_emit_load(struct v3dv_cmd_buffer *cmd_buffer,
load.height_in_ub_or_stride = slice->stride;
}
if (image->samples > VK_SAMPLE_COUNT_1_BIT)
if (image->vk.samples > VK_SAMPLE_COUNT_1_BIT)
load.decimate_mode = V3D_DECIMATE_MODE_ALL_SAMPLES;
else
load.decimate_mode = V3D_DECIMATE_MODE_SAMPLE_0;
@@ -140,7 +140,7 @@ check_needs_load(const struct v3dv_cmd_buffer_state *state,
uint32_t first_subpass_idx,
VkAttachmentLoadOp load_op)
{
/* We call this with image->aspects & aspect, so 0 means the aspect we are
/* We call this with image->vk.aspects & aspect, so 0 means the aspect we are
* testing does not exist in the image.
*/
if (!aspect)
@@ -313,7 +313,7 @@ cmd_buffer_render_pass_emit_store(struct v3dv_cmd_buffer *cmd_buffer,
store.height_in_ub_or_stride = slice->stride;
}
if (image->samples > VK_SAMPLE_COUNT_1_BIT)
if (image->vk.samples > VK_SAMPLE_COUNT_1_BIT)
store.decimate_mode = V3D_DECIMATE_MODE_ALL_SAMPLES;
else if (is_multisample_resolve)
store.decimate_mode = V3D_DECIMATE_MODE_4X;
@@ -329,7 +329,7 @@ check_needs_clear(const struct v3dv_cmd_buffer_state *state,
VkAttachmentLoadOp load_op,
bool do_clear_with_draw)
{
/* We call this with image->aspects & aspect, so 0 means the aspect we are
/* We call this with image->vk.aspects & aspect, so 0 means the aspect we are
* testing does not exist in the image.
*/
if (!aspect)
@@ -370,7 +370,7 @@ check_needs_store(const struct v3dv_cmd_buffer_state *state,
uint32_t last_subpass_idx,
VkAttachmentStoreOp store_op)
{
/* We call this with image->aspects & aspect, so 0 means the aspect we are
/* We call this with image->vk.aspects & aspect, so 0 means the aspect we are
* testing does not exist in the image.
*/
if (!aspect)
+3 -3
View File
@@ -258,7 +258,7 @@ v3dX(framebuffer_compute_internal_bpp_msaa)(
if (att->aspects & VK_IMAGE_ASPECT_COLOR_BIT)
*max_bpp = MAX2(*max_bpp, att->internal_bpp);
if (att->image->samples > VK_SAMPLE_COUNT_1_BIT)
if (att->image->vk.samples > VK_SAMPLE_COUNT_1_BIT)
*msaa = true;
}
@@ -267,7 +267,7 @@ v3dX(framebuffer_compute_internal_bpp_msaa)(
framebuffer->attachments[subpass->ds_attachment.attachment];
assert(att);
if (att->image->samples > VK_SAMPLE_COUNT_1_BIT)
if (att->image->vk.samples > VK_SAMPLE_COUNT_1_BIT)
*msaa = true;
}
@@ -282,7 +282,7 @@ v3dX(framebuffer_compute_internal_bpp_msaa)(
if (att->aspects & VK_IMAGE_ASPECT_COLOR_BIT)
*max_bpp = MAX2(*max_bpp, att->internal_bpp);
if (att->image->samples > VK_SAMPLE_COUNT_1_BIT)
if (att->image->vk.samples > VK_SAMPLE_COUNT_1_BIT)
*msaa = true;
}
+8 -8
View File
@@ -67,9 +67,9 @@ pack_texture_shader_state_helper(struct v3dv_device *device,
assert(image_view->image);
const struct v3dv_image *image = image_view->image;
assert(image->samples == VK_SAMPLE_COUNT_1_BIT ||
image->samples == VK_SAMPLE_COUNT_4_BIT);
const uint32_t msaa_scale = image->samples == VK_SAMPLE_COUNT_1_BIT ? 1 : 2;
assert(image->vk.samples == VK_SAMPLE_COUNT_1_BIT ||
image->vk.samples == VK_SAMPLE_COUNT_4_BIT);
const uint32_t msaa_scale = image->vk.samples == VK_SAMPLE_COUNT_1_BIT ? 1 : 2;
v3dvx_pack(image_view->texture_shader_state[index], TEXTURE_SHADER_STATE, tex) {
@@ -101,8 +101,8 @@ pack_texture_shader_state_helper(struct v3dv_device *device,
tex.texture_type = image_view->format->tex_type;
if (image->type == VK_IMAGE_TYPE_3D) {
tex.image_depth = image->extent.depth;
if (image->vk.image_type == VK_IMAGE_TYPE_3D) {
tex.image_depth = image->vk.extent.depth;
} else {
tex.image_depth = (image_view->last_layer - image_view->first_layer) + 1;
}
@@ -117,13 +117,13 @@ pack_texture_shader_state_helper(struct v3dv_device *device,
tex.image_depth /= 6;
}
tex.image_height = image->extent.height * msaa_scale;
tex.image_width = image->extent.width * msaa_scale;
tex.image_height = image->vk.extent.height * msaa_scale;
tex.image_width = image->vk.extent.width * msaa_scale;
/* On 4.x, the height of a 1D texture is redefined to be the
* upper 14 bits of the width (which is only usable with txf).
*/
if (image->type == VK_IMAGE_TYPE_1D) {
if (image->vk.image_type == VK_IMAGE_TYPE_1D) {
tex.image_height = tex.image_width >> 14;
}
tex.image_width &= (1 << 14) - 1;
+24 -24
View File
@@ -387,7 +387,7 @@ emit_image_load(struct v3dv_device *device,
load.height_in_ub_or_stride = slice->stride;
}
if (image->samples > VK_SAMPLE_COUNT_1_BIT)
if (image->vk.samples > VK_SAMPLE_COUNT_1_BIT)
load.decimate_mode = V3D_DECIMATE_MODE_ALL_SAMPLES;
else
load.decimate_mode = V3D_DECIMATE_MODE_SAMPLE_0;
@@ -448,7 +448,7 @@ emit_image_store(struct v3dv_device *device,
store.height_in_ub_or_stride = slice->stride;
}
if (image->samples > VK_SAMPLE_COUNT_1_BIT)
if (image->vk.samples > VK_SAMPLE_COUNT_1_BIT)
store.decimate_mode = V3D_DECIMATE_MODE_ALL_SAMPLES;
else if (is_multisample_resolve)
store.decimate_mode = V3D_DECIMATE_MODE_4X;
@@ -474,11 +474,11 @@ emit_copy_layer_to_buffer_per_tile_list(struct v3dv_job *job,
cl_emit(cl, TILE_COORDINATES_IMPLICIT, coords);
/* Load image to TLB */
assert((image->type != VK_IMAGE_TYPE_3D &&
assert((image->vk.image_type != VK_IMAGE_TYPE_3D &&
layer_offset < region->imageSubresource.layerCount) ||
layer_offset < image->extent.depth);
layer_offset < image->vk.extent.depth);
const uint32_t image_layer = image->type != VK_IMAGE_TYPE_3D ?
const uint32_t image_layer = image->vk.image_type != VK_IMAGE_TYPE_3D ?
region->imageSubresource.baseArrayLayer + layer_offset :
region->imageOffset.z + layer_offset;
@@ -505,8 +505,8 @@ emit_copy_layer_to_buffer_per_tile_list(struct v3dv_job *job,
height = region->bufferImageHeight;
/* Handle copy from compressed format */
width = DIV_ROUND_UP(width, vk_format_get_blockwidth(image->vk_format));
height = DIV_ROUND_UP(height, vk_format_get_blockheight(image->vk_format));
width = DIV_ROUND_UP(width, vk_format_get_blockwidth(image->vk.format));
height = DIV_ROUND_UP(height, vk_format_get_blockheight(image->vk.format));
/* If we are storing stencil from a combined depth/stencil format the
* Vulkan spec states that the output buffer must have packed stencil
@@ -522,7 +522,7 @@ emit_copy_layer_to_buffer_per_tile_list(struct v3dv_job *job,
uint32_t format = choose_tlb_format(framebuffer,
region->imageSubresource.aspectMask,
true, true, false);
bool msaa = image->samples > VK_SAMPLE_COUNT_1_BIT;
bool msaa = image->vk.samples > VK_SAMPLE_COUNT_1_BIT;
emit_linear_store(cl, RENDER_TARGET_0, buffer->mem->bo,
buffer_offset, buffer_stride, msaa, format);
@@ -582,11 +582,11 @@ emit_resolve_image_layer_per_tile_list(struct v3dv_job *job,
cl_emit(cl, TILE_COORDINATES_IMPLICIT, coords);
assert((src->type != VK_IMAGE_TYPE_3D &&
assert((src->vk.image_type != VK_IMAGE_TYPE_3D &&
layer_offset < region->srcSubresource.layerCount) ||
layer_offset < src->extent.depth);
layer_offset < src->vk.extent.depth);
const uint32_t src_layer = src->type != VK_IMAGE_TYPE_3D ?
const uint32_t src_layer = src->vk.image_type != VK_IMAGE_TYPE_3D ?
region->srcSubresource.baseArrayLayer + layer_offset :
region->srcOffset.z + layer_offset;
@@ -600,11 +600,11 @@ emit_resolve_image_layer_per_tile_list(struct v3dv_job *job,
cl_emit(cl, BRANCH_TO_IMPLICIT_TILE_LIST, branch);
assert((dst->type != VK_IMAGE_TYPE_3D &&
assert((dst->vk.image_type != VK_IMAGE_TYPE_3D &&
layer_offset < region->dstSubresource.layerCount) ||
layer_offset < dst->extent.depth);
layer_offset < dst->vk.extent.depth);
const uint32_t dst_layer = dst->type != VK_IMAGE_TYPE_3D ?
const uint32_t dst_layer = dst->vk.image_type != VK_IMAGE_TYPE_3D ?
region->dstSubresource.baseArrayLayer + layer_offset :
region->dstOffset.z + layer_offset;
@@ -743,11 +743,11 @@ emit_copy_image_layer_per_tile_list(struct v3dv_job *job,
cl_emit(cl, TILE_COORDINATES_IMPLICIT, coords);
assert((src->type != VK_IMAGE_TYPE_3D &&
assert((src->vk.image_type != VK_IMAGE_TYPE_3D &&
layer_offset < region->srcSubresource.layerCount) ||
layer_offset < src->extent.depth);
layer_offset < src->vk.extent.depth);
const uint32_t src_layer = src->type != VK_IMAGE_TYPE_3D ?
const uint32_t src_layer = src->vk.image_type != VK_IMAGE_TYPE_3D ?
region->srcSubresource.baseArrayLayer + layer_offset :
region->srcOffset.z + layer_offset;
@@ -761,11 +761,11 @@ emit_copy_image_layer_per_tile_list(struct v3dv_job *job,
cl_emit(cl, BRANCH_TO_IMPLICIT_TILE_LIST, branch);
assert((dst->type != VK_IMAGE_TYPE_3D &&
assert((dst->vk.image_type != VK_IMAGE_TYPE_3D &&
layer_offset < region->dstSubresource.layerCount) ||
layer_offset < dst->extent.depth);
layer_offset < dst->vk.extent.depth);
const uint32_t dst_layer = dst->type != VK_IMAGE_TYPE_3D ?
const uint32_t dst_layer = dst->vk.image_type != VK_IMAGE_TYPE_3D ?
region->dstSubresource.baseArrayLayer + layer_offset :
region->dstOffset.z + layer_offset;
@@ -1053,8 +1053,8 @@ emit_copy_buffer_to_layer_per_tile_list(struct v3dv_job *job,
cl_emit(cl, TILE_COORDINATES_IMPLICIT, coords);
const VkImageSubresourceLayers *imgrsc = &region->imageSubresource;
assert((image->type != VK_IMAGE_TYPE_3D && layer < imgrsc->layerCount) ||
layer < image->extent.depth);
assert((image->vk.image_type != VK_IMAGE_TYPE_3D && layer < imgrsc->layerCount) ||
layer < image->vk.extent.depth);
/* Load TLB from buffer */
uint32_t width, height;
@@ -1069,8 +1069,8 @@ emit_copy_buffer_to_layer_per_tile_list(struct v3dv_job *job,
height = region->bufferImageHeight;
/* Handle copy to compressed format using a compatible format */
width = DIV_ROUND_UP(width, vk_format_get_blockwidth(image->vk_format));
height = DIV_ROUND_UP(height, vk_format_get_blockheight(image->vk_format));
width = DIV_ROUND_UP(width, vk_format_get_blockwidth(image->vk.format));
height = DIV_ROUND_UP(height, vk_format_get_blockheight(image->vk.format));
uint32_t cpp = imgrsc->aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT ?
1 : image->cpp;