aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorConnor Abbott <[email protected]>2020-05-18 19:11:30 +0200
committerMarge Bot <[email protected]>2020-05-19 19:55:11 +0000
commit3d5cc5ff22164ab8effd5d1cc5ef3a16fb2e0984 (patch)
tree5b15ec322dd3f472fe0d4a373b1bdce3b77ef6c0 /src
parentcc4a02d0ed0755c5cf7b75757b402ea81ce54c24 (diff)
tu: Always initialize image_view fields for blit sources
Previously we only supported BLIT_SRC_BIT and BLIT_DEST_BIT together, so we didn't have to worry about initializing blit-related fields for texture-only formats, but it turns out that 2d blits work out just fine with these formats and we'll need to enable BLIT_SRC_BIT for texture-only formats due to a Vulkan requirement on compressed formats. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5098>
Diffstat (limited to 'src')
-rw-r--r--src/freedreno/vulkan/tu_image.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/src/freedreno/vulkan/tu_image.c b/src/freedreno/vulkan/tu_image.c
index 52585a85c8d..f21d6da01e6 100644
--- a/src/freedreno/vulkan/tu_image.c
+++ b/src/freedreno/vulkan/tu_image.c
@@ -351,7 +351,34 @@ tu_image_view_init(struct tu_image_view *iview,
A6XX_TEX_CONST_3_MIN_LAYERSZ(image->layout.slices[image->level_count - 1].size0);
}
- /* only texture descriptor is valid for TEXTURE-only formats */
+ iview->SP_PS_2D_SRC_INFO = A6XX_SP_PS_2D_SRC_INFO(
+ .color_format = fmt.fmt,
+ .tile_mode = fmt.tile_mode,
+ .color_swap = fmt.swap,
+ .flags = ubwc_enabled,
+ .srgb = vk_format_is_srgb(format),
+ .samples = tu_msaa_samples(image->samples),
+ .samples_average = image->samples > 1 &&
+ !vk_format_is_int(format) &&
+ !vk_format_is_depth_or_stencil(format),
+ .unk20 = 1,
+ .unk22 = 1).value;
+ iview->SP_PS_2D_SRC_SIZE =
+ A6XX_SP_PS_2D_SRC_SIZE(.width = width, .height = height).value;
+
+ /* note: these have same encoding for MRT and 2D (except 2D PITCH src) */
+ iview->PITCH = A6XX_RB_DEPTH_BUFFER_PITCH(pitch).value;
+ iview->FLAG_BUFFER_PITCH = A6XX_RB_DEPTH_FLAG_BUFFER_PITCH(
+ .pitch = ubwc_pitch, .array_pitch = layout->ubwc_layer_size >> 2).value;
+
+ iview->base_addr = base_addr;
+ iview->ubwc_addr = ubwc_addr;
+ iview->layer_size = layer_size;
+ iview->ubwc_layer_size = layout->ubwc_layer_size;
+
+ /* Don't set fields that are only used for attachments/blit dest if COLOR
+ * is unsupported.
+ */
if (!(fmt.supported & FMT_COLOR))
return;
@@ -385,11 +412,6 @@ tu_image_view_init(struct tu_image_view *iview,
}
}
- iview->base_addr = base_addr;
- iview->ubwc_addr = ubwc_addr;
- iview->layer_size = layer_size;
- iview->ubwc_layer_size = layout->ubwc_layer_size;
-
iview->extent.width = width;
iview->extent.height = height;
iview->need_y2_align =
@@ -397,11 +419,6 @@ tu_image_view_init(struct tu_image_view *iview,
iview->ubwc_enabled = ubwc_enabled;
- /* note: these have same encoding for MRT and 2D (except 2D PITCH src) */
- iview->PITCH = A6XX_RB_DEPTH_BUFFER_PITCH(pitch).value;
- iview->FLAG_BUFFER_PITCH = A6XX_RB_DEPTH_FLAG_BUFFER_PITCH(
- .pitch = ubwc_pitch, .array_pitch = layout->ubwc_layer_size >> 2).value;
-
iview->RB_MRT_BUF_INFO = A6XX_RB_MRT_BUF_INFO(0,
.color_tile_mode = cfmt.tile_mode,
.color_format = cfmt.fmt,
@@ -411,21 +428,6 @@ tu_image_view_init(struct tu_image_view *iview,
.color_sint = vk_format_is_sint(format),
.color_uint = vk_format_is_uint(format)).value;
- iview->SP_PS_2D_SRC_INFO = A6XX_SP_PS_2D_SRC_INFO(
- .color_format = fmt.fmt,
- .tile_mode = fmt.tile_mode,
- .color_swap = fmt.swap,
- .flags = ubwc_enabled,
- .srgb = vk_format_is_srgb(format),
- .samples = tu_msaa_samples(image->samples),
- .samples_average = image->samples > 1 &&
- !vk_format_is_int(format) &&
- !vk_format_is_depth_or_stencil(format),
- .unk20 = 1,
- .unk22 = 1).value;
- iview->SP_PS_2D_SRC_SIZE =
- A6XX_SP_PS_2D_SRC_SIZE(.width = width, .height = height).value;
-
iview->RB_2D_DST_INFO = A6XX_RB_2D_DST_INFO(
.color_format = cfmt.fmt,
.tile_mode = cfmt.tile_mode,