From: Chad Versace Date: Mon, 7 Dec 2015 16:50:28 +0000 (-0800) Subject: anv: Use isl_tiling_flags in anv_image_create_info X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=64e8af69b168ae3e4db0fde7cae4afbb0721b3e5;p=mesa.git anv: Use isl_tiling_flags in anv_image_create_info Replace anv_image_create_info::force_tiling anv_image_create_info::tiling with the bitmask anv_image_create_info::isl_tiling_flags This allows us to drop the function anv_image.c:choose_isl_tiling_flags(). --- diff --git a/src/vulkan/anv_image.c b/src/vulkan/anv_image.c index 00a2c14f141..b5c9a86ff18 100644 --- a/src/vulkan/anv_image.c +++ b/src/vulkan/anv_image.c @@ -71,23 +71,6 @@ anv_image_view_info_for_vk_image_view_type(VkImageViewType type) return anv_image_view_info_table[type]; } -static isl_tiling_flags_t -choose_isl_tiling_flags(const struct anv_image_create_info *anv_info) -{ - const VkImageCreateInfo *vk_info = anv_info->vk_info; - - if (anv_info->force_tiling) { - return 1u << anv_info->tiling; - } else if (vk_info->tiling == VK_IMAGE_TILING_LINEAR) { - return ISL_TILING_LINEAR_BIT; - } else if (vk_info->tiling == VK_IMAGE_TILING_OPTIMAL) { - return ISL_TILING_ANY_MASK; - } else { - unreachable("bad anv_image_create_info"); - return 0; - } -} - /** * The \a format argument is required and overrides any format found in struct * anv_image_create_info. Exactly one bit must be set in \a aspect. @@ -160,6 +143,11 @@ anv_image_make_surface(const struct anv_device *dev, [VK_IMAGE_TYPE_3D] = ISL_SURF_DIM_3D, }; + + isl_tiling_flags_t tiling_flags = anv_info->isl_tiling_flags; + if (vk_info->tiling == VK_IMAGE_TILING_LINEAR) + tiling_flags &= ISL_TILING_LINEAR_BIT; + isl_surf_init(&dev->isl_dev, &out_anv_surf->isl, .dim = vk_to_isl_surf_dim[vk_info->imageType], .format = anv_get_isl_format(vk_info->format, aspect), @@ -172,7 +160,7 @@ anv_image_make_surface(const struct anv_device *dev, .min_alignment = 0, .min_pitch = 0, .usage = choose_isl_surf_usage(anv_info, aspect), - .tiling_flags = choose_isl_tiling_flags(anv_info)); + .tiling_flags = tiling_flags); out_anv_surf->offset = align_u32(*inout_image_size, out_anv_surf->isl.alignment); @@ -298,6 +286,7 @@ anv_CreateImage(VkDevice device, return anv_image_create(device, &(struct anv_image_create_info) { .vk_info = pCreateInfo, + .isl_tiling_flags = ISL_TILING_ANY_MASK, }, pAllocator, pImage); diff --git a/src/vulkan/anv_intel.c b/src/vulkan/anv_intel.c index 95665b5aa41..d95d9afe8cf 100644 --- a/src/vulkan/anv_intel.c +++ b/src/vulkan/anv_intel.c @@ -62,8 +62,7 @@ VkResult anv_CreateDmaBufImageINTEL( anv_image_create(_device, &(struct anv_image_create_info) { - .force_tiling = true, - .tiling = ISL_TILING_X, + .isl_tiling_flags = ISL_TILING_X_BIT, .stride = pCreateInfo->strideInBytes, .vk_info = &(VkImageCreateInfo) { diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index 5e611242481..cb3f9a7b367 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -1472,8 +1472,7 @@ struct anv_image_view { struct anv_image_create_info { const VkImageCreateInfo *vk_info; - bool force_tiling; - enum isl_tiling tiling; + isl_tiling_flags_t isl_tiling_flags; uint32_t stride; }; diff --git a/src/vulkan/anv_wsi_wayland.c b/src/vulkan/anv_wsi_wayland.c index dd5baa452a0..79453b594d8 100644 --- a/src/vulkan/anv_wsi_wayland.c +++ b/src/vulkan/anv_wsi_wayland.c @@ -624,8 +624,7 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain, struct wsi_wl_image *image, VkImage vk_image; result = anv_image_create(vk_device, &(struct anv_image_create_info) { - .force_tiling = true, - .tiling = ISL_TILING_X, + .isl_tiling_flags = ISL_TILING_X_BIT, .stride = 0, .vk_info = &(VkImageCreateInfo) { diff --git a/src/vulkan/anv_wsi_x11.c b/src/vulkan/anv_wsi_x11.c index 15ad98c3f8b..f340de476ca 100644 --- a/src/vulkan/anv_wsi_x11.c +++ b/src/vulkan/anv_wsi_x11.c @@ -344,8 +344,7 @@ x11_surface_create_swapchain(struct anv_wsi_surface *wsi_surface, anv_image_create(anv_device_to_handle(device), &(struct anv_image_create_info) { - .force_tiling = true, - .tiling = ISL_TILING_X, + .isl_tiling_flags = ISL_TILING_X_BIT, .stride = 0, .vk_info = &(VkImageCreateInfo) {