radv: Add device argument for dcc compression check.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sun, 4 Aug 2019 23:38:42 +0000 (01:38 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Wed, 7 Aug 2019 00:13:07 +0000 (02:13 +0200)
Because it is about to be generation dependent.

Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_cmd_buffer.c
src/amd/vulkan/radv_image.c
src/amd/vulkan/radv_meta_copy.c
src/amd/vulkan/radv_meta_resolve.c
src/amd/vulkan/radv_private.h

index 51186dc3b155348b9c627ff4e4d858fbddcf6b22..55b7a0a505539ace1184425c8cf9949c80db2f33 100644 (file)
@@ -1294,7 +1294,7 @@ radv_emit_fb_color_state(struct radv_cmd_buffer *cmd_buffer,
        uint32_t cb_color_info = cb->cb_color_info;
        struct radv_image *image = iview->image;
 
-       if (!radv_layout_dcc_compressed(image, layout, in_render_loop,
+       if (!radv_layout_dcc_compressed(cmd_buffer->device, image, layout, in_render_loop,
                                        radv_image_queue_family_mask(image,
                                                                     cmd_buffer->queue_family_index,
                                                                     cmd_buffer->queue_family_index))) {
@@ -5231,7 +5231,7 @@ static void radv_init_color_image_metadata(struct radv_cmd_buffer *cmd_buffer,
                uint32_t value = 0xffffffffu; /* Fully expanded mode. */
                bool need_decompress_pass = false;
 
-               if (radv_layout_dcc_compressed(image, dst_layout,
+               if (radv_layout_dcc_compressed(cmd_buffer->device, image, dst_layout,
                                               dst_render_loop,
                                               dst_queue_mask)) {
                        value = 0x20202020u;
@@ -5277,8 +5277,8 @@ static void radv_handle_color_image_transition(struct radv_cmd_buffer *cmd_buffe
        if (radv_dcc_enabled(image, range->baseMipLevel)) {
                if (src_layout == VK_IMAGE_LAYOUT_PREINITIALIZED) {
                        radv_initialize_dcc(cmd_buffer, image, range, 0xffffffffu);
-               } else if (radv_layout_dcc_compressed(image, src_layout, src_render_loop, src_queue_mask) &&
-                          !radv_layout_dcc_compressed(image, dst_layout, dst_render_loop, dst_queue_mask)) {
+               } else if (radv_layout_dcc_compressed(cmd_buffer->device, image, src_layout, src_render_loop, src_queue_mask) &&
+                          !radv_layout_dcc_compressed(cmd_buffer->device, image, dst_layout, dst_render_loop, dst_queue_mask)) {
                        radv_decompress_dcc(cmd_buffer, image, range);
                } else if (radv_layout_can_fast_clear(image, src_layout, src_render_loop, src_queue_mask) &&
                           !radv_layout_can_fast_clear(image, dst_layout, dst_render_loop, dst_queue_mask)) {
index ed520833981799f5280ae88880d6d2fa7ccdcbfb..64b2a73bf459b946c39a324a134337fcef3f0d0c 100644 (file)
@@ -1642,7 +1642,8 @@ bool radv_layout_can_fast_clear(const struct radv_image *image,
        return layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
 }
 
-bool radv_layout_dcc_compressed(const struct radv_image *image,
+bool radv_layout_dcc_compressed(const struct radv_device *device,
+                               const struct radv_image *image,
                                VkImageLayout layout,
                                bool in_render_loop,
                                unsigned queue_mask)
index 42e40cfd0773ccc8be772e95c6364d0fb569df65..5e555a506cc7db35a5792bac47fafcabf79da6ba 100644 (file)
@@ -191,7 +191,7 @@ meta_copy_buffer_to_image(struct radv_cmd_buffer *cmd_buffer,
                        uint32_t queue_mask = radv_image_queue_family_mask(image,
                                                                           cmd_buffer->queue_family_index,
                                                                           cmd_buffer->queue_family_index);
-                       bool compressed = radv_layout_dcc_compressed(image, layout, false, queue_mask);
+                       bool compressed = radv_layout_dcc_compressed(cmd_buffer->device, image, layout, false, queue_mask);
                        if (compressed) {
                                radv_decompress_dcc(cmd_buffer, image, &(VkImageSubresourceRange) {
                                                                .aspectMask = pRegions[r].imageSubresource.aspectMask,
@@ -335,7 +335,7 @@ meta_copy_image_to_buffer(struct radv_cmd_buffer *cmd_buffer,
                        uint32_t queue_mask = radv_image_queue_family_mask(image,
                                                                           cmd_buffer->queue_family_index,
                                                                           cmd_buffer->queue_family_index);
-                       bool compressed = radv_layout_dcc_compressed(image, layout, false, queue_mask);
+                       bool compressed = radv_layout_dcc_compressed(cmd_buffer->device, image, layout, false, queue_mask);
                        if (compressed) {
                                radv_decompress_dcc(cmd_buffer, image, &(VkImageSubresourceRange) {
                                                                .aspectMask = pRegions[r].imageSubresource.aspectMask,
@@ -464,11 +464,11 @@ meta_copy_image(struct radv_cmd_buffer *cmd_buffer,
                        uint32_t dst_queue_mask = radv_image_queue_family_mask(dest_image,
                                                                               cmd_buffer->queue_family_index,
                                                                               cmd_buffer->queue_family_index);
-                       bool dst_compressed = radv_layout_dcc_compressed(dest_image, dest_image_layout, false, dst_queue_mask);
+                       bool dst_compressed = radv_layout_dcc_compressed(cmd_buffer->device, dest_image, dest_image_layout, false, dst_queue_mask);
                        uint32_t src_queue_mask = radv_image_queue_family_mask(src_image,
                                                                               cmd_buffer->queue_family_index,
                                                                               cmd_buffer->queue_family_index);
-                       bool src_compressed = radv_layout_dcc_compressed(src_image, src_image_layout, false, src_queue_mask);
+                       bool src_compressed = radv_layout_dcc_compressed(cmd_buffer->device, src_image, src_image_layout, false, src_queue_mask);
 
                        if (!src_compressed || radv_dcc_formats_compatible(b_src.format, b_dst.format)) {
                                b_src.format = b_dst.format;
index dc5c2c65ecde949e331d590a8530e35a98102a37..ea3d26c8d4c83cdabac4b3a419093eef8ada7ec5 100644 (file)
@@ -330,7 +330,8 @@ enum radv_resolve_method {
        RESOLVE_FRAGMENT,
 };
 
-static void radv_pick_resolve_method_images(struct radv_image *src_image,
+static void radv_pick_resolve_method_images(struct radv_device *device,
+                                           struct radv_image *src_image,
                                            VkFormat src_format,
                                            struct radv_image *dest_image,
                                            VkImageLayout dest_image_layout,
@@ -353,7 +354,7 @@ static void radv_pick_resolve_method_images(struct radv_image *src_image,
                         dest_image->info.array_size > 1)
                        *method = RESOLVE_COMPUTE;
        
-               if (radv_layout_dcc_compressed(dest_image, dest_image_layout,
+               if (radv_layout_dcc_compressed(device, dest_image, dest_image_layout,
                                               dest_render_loop, queue_mask)) {
                        *method = RESOLVE_FRAGMENT;
                } else if (dest_image->planes[0].surface.micro_tile_mode !=
@@ -433,9 +434,10 @@ void radv_CmdResolveImage(
        } else
                resolve_method = RESOLVE_COMPUTE;
 
-       radv_pick_resolve_method_images(src_image, src_image->vk_format,
-                                       dest_image, dest_image_layout,
-                                       false, cmd_buffer, &resolve_method);
+       radv_pick_resolve_method_images(cmd_buffer->device, src_image,
+                                       src_image->vk_format, dest_image,
+                                       dest_image_layout, false, cmd_buffer,
+                                       &resolve_method);
 
        if (resolve_method == RESOLVE_FRAGMENT) {
                radv_meta_resolve_fragment_image(cmd_buffer,
@@ -647,7 +649,8 @@ radv_cmd_buffer_resolve_subpass(struct radv_cmd_buffer *cmd_buffer)
                struct radv_image_view *dst_iview =
                        cmd_buffer->state.attachments[dst_att.attachment].iview;
 
-               radv_pick_resolve_method_images(src_iview->image,
+               radv_pick_resolve_method_images(cmd_buffer->device,
+                                               src_iview->image,
                                                src_iview->vk_format,
                                                dst_iview->image,
                                                dst_att.layout,
@@ -701,8 +704,9 @@ radv_cmd_buffer_resolve_subpass(struct radv_cmd_buffer *cmd_buffer)
                struct radv_image_view *src_iview= cmd_buffer->state.attachments[src_att.attachment].iview;
                struct radv_image *src_img = src_iview->image;
 
-               radv_pick_resolve_method_images(src_img, src_iview->vk_format,
-                                               dst_img, dest_att.layout,
+               radv_pick_resolve_method_images(cmd_buffer->device, src_img,
+                                               src_iview->vk_format, dst_img,
+                                               dest_att.layout,
                                                dest_att.in_render_loop,
                                                cmd_buffer, &resolve_method);
 
index 1d87c17032ca03374169515f682ffc9799db0c51..8f3615f2f1c68233a20bcd2c67070dc3dbb7ec23 100644 (file)
@@ -1685,7 +1685,8 @@ bool radv_layout_can_fast_clear(const struct radv_image *image,
                                bool in_render_loop,
                                unsigned queue_mask);
 
-bool radv_layout_dcc_compressed(const struct radv_image *image,
+bool radv_layout_dcc_compressed(const struct radv_device *device,
+                               const struct radv_image *image,
                                VkImageLayout layout,
                                bool in_render_loop,
                                unsigned queue_mask);