anv: Use isl_tiling_flags in anv_image_create_info
authorChad Versace <chad.versace@intel.com>
Mon, 7 Dec 2015 16:50:28 +0000 (08:50 -0800)
committerChad Versace <chad.versace@intel.com>
Mon, 7 Dec 2015 16:50:28 +0000 (08:50 -0800)
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().

src/vulkan/anv_image.c
src/vulkan/anv_intel.c
src/vulkan/anv_private.h
src/vulkan/anv_wsi_wayland.c
src/vulkan/anv_wsi_x11.c

index 00a2c14f1410288b4a091d721bf14c4e2c8a71da..b5c9a86ff181f43cecc8e2347ba76feafdd9f5c9 100644 (file)
@@ -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);
index 95665b5aa413890e7d4d8926c062f272d4ece9b3..d95d9afe8cfa19daf9e8a508d8a2625d4292fa53 100644 (file)
@@ -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) {
index 5e611242481ac2632217b11f97732cefcd21ec82..cb3f9a7b367576641e284d833d03c61bb7ac0b12 100644 (file)
@@ -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;
 };
 
index dd5baa452a00fb87678725927ba23e358b2159ad..79453b594d8a506dd2ecdd6cfc0fd13040b7b62a 100644 (file)
@@ -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) {
index 15ad98c3f8b6bb779ebbdf518eaff7cf8a8ab365..f340de476cac0ca2ed80f7badba3589c92b25e35 100644 (file)
@@ -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) {