Mesa (staging/21.2): crocus: align staging resource pitch on gen4/5 to allow BLT usage.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 11 23:26:01 UTC 2021


Module: Mesa
Branch: staging/21.2
Commit: c24604acb85bb3153b4f5a66cea17f78db711b79
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c24604acb85bb3153b4f5a66cea17f78db711b79

Author: Dave Airlie <airlied at gmail.com>
Date:   Wed Aug 11 13:34:26 2021 -0400

crocus: align staging resource pitch on gen4/5 to allow BLT usage.

Aligning the pitch to 4 bytes allows the BLT engine to be used for
transfers to/from these surfaces.

Fixes: f3630548f1da ("crocus: initial gallium driver for Intel gfx 4-7")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12330>

---

 src/gallium/drivers/crocus/crocus_resource.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/gallium/drivers/crocus/crocus_resource.c b/src/gallium/drivers/crocus/crocus_resource.c
index 5adca55233f..db497aa16e7 100644
--- a/src/gallium/drivers/crocus/crocus_resource.c
+++ b/src/gallium/drivers/crocus/crocus_resource.c
@@ -228,6 +228,14 @@ crocus_resource_configure_main(const struct crocus_screen *screen,
    const enum isl_format format =
       crocus_format_for_usage(&screen->devinfo, templ->format, usage).fmt;
 
+   if (row_pitch_B == 0 && templ->usage == PIPE_USAGE_STAGING &&
+       templ->target == PIPE_TEXTURE_2D &&
+       devinfo->ver < 6) {
+      /* align row pitch to 4 so we can keep using BLT engine */
+      row_pitch_B = util_format_get_stride(templ->format, templ->width0);
+      row_pitch_B = ALIGN(row_pitch_B, 4);
+   }
+
    const struct isl_surf_init_info init_info = {
       .dim = crocus_target_to_isl_surf_dim(templ->target),
       .format = format,



More information about the mesa-commit mailing list