[Mesa-dev] [PATCH 7/8] intel: Fix requests for exact surface row pitch (v2)
Chad Versace
chadversary at chromium.org
Tue Mar 21 23:02:39 UTC 2017
All callers of isl_surf_init() that set 'min_row_pitch' wanted to
request an *exact* row pitch, as evidenced by nearby asserts, but isl
lacked API for doing so. Now that isl has an API for that, update the
code to use it.
v2: Assert that isl_surf_init() succeeds because the callers assume
it. [for jekstrand]
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com> (v1)
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com> (v1)
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net> (v2)
---
src/intel/blorp/blorp_blit.c | 8 +++++---
src/intel/vulkan/anv_blorp.c | 29 +++++++++++++++--------------
src/intel/vulkan/anv_image.c | 2 +-
3 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
index 280b76ab70c..691564c8788 100644
--- a/src/intel/blorp/blorp_blit.c
+++ b/src/intel/blorp/blorp_blit.c
@@ -1375,6 +1375,8 @@ static void
surf_convert_to_single_slice(const struct isl_device *isl_dev,
struct brw_blorp_surface_info *info)
{
+ bool ok UNUSED;
+
/* Just bail if we have nothing to do. */
if (info->surf.dim == ISL_SURF_DIM_2D &&
info->view.base_level == 0 && info->view.base_array_layer == 0 &&
@@ -1421,13 +1423,13 @@ surf_convert_to_single_slice(const struct isl_device *isl_dev,
.levels = 1,
.array_len = 1,
.samples = info->surf.samples,
- .min_pitch = info->surf.row_pitch,
+ .row_pitch = info->surf.row_pitch,
.usage = info->surf.usage,
.tiling_flags = 1 << info->surf.tiling,
};
- isl_surf_init_s(isl_dev, &info->surf, &init_info);
- assert(info->surf.row_pitch == init_info.min_pitch);
+ ok = isl_surf_init_s(isl_dev, &info->surf, &init_info);
+ assert(ok);
/* The view is also different now. */
info->view.base_level = 0;
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index 1f4fec5f35b..80ab4339ffe 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -133,6 +133,7 @@ get_blorp_surf_for_anv_buffer(struct anv_device *device,
{
const struct isl_format_layout *fmtl =
isl_format_get_layout(format);
+ bool ok UNUSED;
/* ASTC is the only format which doesn't support linear layouts.
* Create an equivalently sized surface with ISL to get around this.
@@ -155,20 +156,20 @@ get_blorp_surf_for_anv_buffer(struct anv_device *device,
},
};
- isl_surf_init(&device->isl_dev, isl_surf,
- .dim = ISL_SURF_DIM_2D,
- .format = format,
- .width = width,
- .height = height,
- .depth = 1,
- .levels = 1,
- .array_len = 1,
- .samples = 1,
- .min_pitch = row_pitch,
- .usage = ISL_SURF_USAGE_TEXTURE_BIT |
- ISL_SURF_USAGE_RENDER_TARGET_BIT,
- .tiling_flags = ISL_TILING_LINEAR_BIT);
- assert(isl_surf->row_pitch == row_pitch);
+ ok = isl_surf_init(&device->isl_dev, isl_surf,
+ .dim = ISL_SURF_DIM_2D,
+ .format = format,
+ .width = width,
+ .height = height,
+ .depth = 1,
+ .levels = 1,
+ .array_len = 1,
+ .samples = 1,
+ .row_pitch = row_pitch,
+ .usage = ISL_SURF_USAGE_TEXTURE_BIT |
+ ISL_SURF_USAGE_RENDER_TARGET_BIT,
+ .tiling_flags = ISL_TILING_LINEAR_BIT);
+ assert(ok);
}
static void
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index 7be988ab814..47f6b8687c0 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -166,7 +166,7 @@ make_surface(const struct anv_device *dev,
.array_len = vk_info->arrayLayers,
.samples = vk_info->samples,
.min_alignment = 0,
- .min_pitch = anv_info->stride,
+ .row_pitch = anv_info->stride,
.usage = choose_isl_surf_usage(image->usage, aspect),
.tiling_flags = tiling_flags);
--
2.12.0
More information about the mesa-dev
mailing list