Mesa (main): tu: Use common vk_image_view base struct

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 27 20:15:22 UTC 2022


Module: Mesa
Branch: main
Commit: b90d628a7dbf0b053f1de51d6455f2a7e294b05f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b90d628a7dbf0b053f1de51d6455f2a7e294b05f

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Mon Jul 18 13:07:57 2022 +0200

tu: Use common vk_image_view base struct

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17378>

---

 src/freedreno/vulkan/tu_image.c   | 13 ++++++-------
 src/freedreno/vulkan/tu_pass.c    |  4 ++--
 src/freedreno/vulkan/tu_private.h | 11 ++---------
 3 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/src/freedreno/vulkan/tu_image.c b/src/freedreno/vulkan/tu_image.c
index d1176736fc4..33527ad8a85 100644
--- a/src/freedreno/vulkan/tu_image.c
+++ b/src/freedreno/vulkan/tu_image.c
@@ -161,8 +161,9 @@ tu_cs_image_flag_ref(struct tu_cs *cs, const struct fdl6_view *iview, uint32_t l
    tu_cs_emit(cs, iview->FLAG_BUFFER_PITCH);
 }
 
-void
-tu_image_view_init(struct tu_image_view *iview,
+static void
+tu_image_view_init(struct tu_device *device,
+                   struct tu_image_view *iview,
                    const VkImageViewCreateInfo *pCreateInfo,
                    bool has_z24uint_s8uint)
 {
@@ -176,11 +177,9 @@ tu_image_view_init(struct tu_image_view *iview,
    const struct tu_sampler_ycbcr_conversion *conversion = ycbcr_conversion ?
       tu_sampler_ycbcr_conversion_from_handle(ycbcr_conversion->conversion) : NULL;
 
-   const struct VkImageViewMinLodCreateInfoEXT *min_lod =
-      vk_find_struct_const(pCreateInfo->pNext, IMAGE_VIEW_MIN_LOD_CREATE_INFO_EXT);
+   vk_image_view_init(&device->vk, &iview->vk, false, pCreateInfo);
 
    iview->image = image;
-   iview->format = pCreateInfo->format;
 
    const struct fdl_layout *layouts[3];
 
@@ -218,7 +217,7 @@ tu_image_view_init(struct tu_image_view *iview,
    args.base_miplevel = range->baseMipLevel;
    args.layer_count = vk_image_subresource_layer_count(&image->vk, range);
    args.level_count = vk_image_subresource_level_count(&image->vk, range);
-   args.min_lod_clamp = min_lod ? min_lod->minLod : 0.f;
+   args.min_lod_clamp = iview->vk.min_lod;
    args.format = tu_format_for_aspect(format, aspect_mask);
    vk_component_mapping_to_pipe_swizzle(pCreateInfo->components, args.swiz);
    if (conversion) {
@@ -804,7 +803,7 @@ tu_CreateImageView(VkDevice _device,
    if (view == NULL)
       return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
 
-   tu_image_view_init(view, pCreateInfo, device->use_z24uint_s8uint);
+   tu_image_view_init(device, view, pCreateInfo, device->use_z24uint_s8uint);
 
    *pView = tu_image_view_to_handle(view);
 
diff --git a/src/freedreno/vulkan/tu_pass.c b/src/freedreno/vulkan/tu_pass.c
index 97838d639af..8031b1439cd 100644
--- a/src/freedreno/vulkan/tu_pass.c
+++ b/src/freedreno/vulkan/tu_pass.c
@@ -951,7 +951,7 @@ static void
 tu_setup_dynamic_attachment(struct tu_render_pass_attachment *att,
                             struct tu_image_view *view)
 {
-   att->format = view->format;
+   att->format = view->vk.format;
    att->samples = view->image->layout->nr_samples;
 
    /* for d32s8, cpp is for the depth image, and
@@ -1006,7 +1006,7 @@ tu_setup_dynamic_render_pass(struct tu_cmd_buffer *cmd_buffer,
 
       subpass->samples = view->image->layout->nr_samples;
 
-      if (vk_format_is_srgb(view->format))
+      if (vk_format_is_srgb(view->vk.format))
          subpass->srgb_cntl |= 1 << i;
 
       if (att_info->resolveMode != VK_RESOLVE_MODE_NONE) {
diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h
index 202668b3ea8..91f63d3e676 100644
--- a/src/freedreno/vulkan/tu_private.h
+++ b/src/freedreno/vulkan/tu_private.h
@@ -2100,12 +2100,10 @@ enum pipe_format tu_format_for_aspect(enum pipe_format format,
 
 struct tu_image_view
 {
-   struct vk_object_base base;
+   struct vk_image_view vk;
 
    struct tu_image *image; /**< VkImageViewCreateInfo::image */
 
-   VkFormat format;
-
    struct fdl6_view view;
 
    /* for d32s8 separate depth */
@@ -2170,11 +2168,6 @@ tu_import_memory_from_gralloc_handle(VkDevice device_h,
                                      const VkAllocationCallbacks *alloc,
                                      VkImage image_h);
 
-void
-tu_image_view_init(struct tu_image_view *iview,
-                   const VkImageViewCreateInfo *pCreateInfo,
-                   bool limited_z24s8);
-
 bool
 tiling_possible(VkFormat format);
 
@@ -2350,7 +2343,7 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(tu_event, base, VkEvent, VK_OBJECT_TYPE_EVENT)
 VK_DEFINE_NONDISP_HANDLE_CASTS(tu_framebuffer, base, VkFramebuffer,
                                VK_OBJECT_TYPE_FRAMEBUFFER)
 VK_DEFINE_NONDISP_HANDLE_CASTS(tu_image, vk.base, VkImage, VK_OBJECT_TYPE_IMAGE)
-VK_DEFINE_NONDISP_HANDLE_CASTS(tu_image_view, base, VkImageView,
+VK_DEFINE_NONDISP_HANDLE_CASTS(tu_image_view, vk.base, VkImageView,
                                VK_OBJECT_TYPE_IMAGE_VIEW);
 VK_DEFINE_NONDISP_HANDLE_CASTS(tu_pipeline_cache, base, VkPipelineCache,
                                VK_OBJECT_TYPE_PIPELINE_CACHE)



More information about the mesa-commit mailing list