<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Mar 6, 2017 at 10:12 AM, Chad Versace <span dir="ltr"><<a href="mailto:chadversary@chromium.org" target="_blank">chadversary@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The caller does so by setting the new field<br>
isl_surf_init_info::row_pitch, which overrides isl's row pitch<br>
calculation.<br>
---<br>
 src/intel/isl/isl.c | 11 ++++++++++-<br>
 src/intel/isl/isl.h |  9 +++++++++<br>
 2 files changed, 19 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c<br>
index a91c3f92bcf..b3ac305b81b 100644<br>
--- a/src/intel/isl/isl.c<br>
+++ b/src/intel/isl/isl.c<br>
@@ -1005,6 +1005,9 @@ isl_calc_linear_row_pitch(<wbr>const struct isl_device *dev,<br>
 {<br>
    const struct isl_format_layout *fmtl = isl_format_get_layout(info-><wbr>format);<br>
<br>
+   /* Any override of row_pitch should happen earlier. */<br>
+   assert(info->row_pitch == 0);<br>
+<br>
    uint32_t row_pitch = info->min_row_pitch;<br>
<br>
    /* First, align the surface to a cache line boundary, as the PRM explains<br>
@@ -1088,6 +1091,9 @@ isl_calc_tiled_row_pitch(const struct isl_device *dev,<br>
 {<br>
    const struct isl_format_layout *fmtl = isl_format_get_layout(info-><wbr>format);<br>
<br>
+   /* Any override of row_pitch should happen earlier. */<br>
+   assert(info->row_pitch == 0);<br>
+<br>
    assert(fmtl->bpb % tile_info->format_bpb == 0);<br>
    assert(phys_slice0_sa->w % fmtl->bw == 0);<br>
<br>
@@ -1112,7 +1118,10 @@ isl_calc_row_pitch(const struct isl_device *dev,<br>
                    const struct isl_tile_info *tile_info,<br>
                    const struct isl_extent2d *phys_slice0_sa)<br>
 {<br>
-   if (tile_info->tiling == ISL_TILING_LINEAR) {<br>
+   if (info->row_pitch != 0) {<br>
+      /* Override the usual calculation and validation. */<br>
+      return info->row_pitch;<br>
+   } else if (tile_info->tiling == ISL_TILING_LINEAR) {<br>
       return isl_calc_linear_row_pitch(dev, info, phys_slice0_sa);<br>
    } else {<br>
       return isl_calc_tiled_row_pitch(dev, info, tile_info, phys_slice0_sa);<br>
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h<br>
index e517f11cf5e..5f73639fb48 100644<br>
--- a/src/intel/isl/isl.h<br>
+++ b/src/intel/isl/isl.h<br>
@@ -813,6 +813,15 @@ struct isl_surf_init_info {<br>
    /** Lower bound for isl_surf::row_pitch, in bytes. */<br>
    uint32_t min_row_pitch;<br>
<br>
+   /**<br>
+    * Exact value for isl_surf::row_pitch. Ignored if zero.<br>
+    *<br>
+    * WARNING: If set, then isl_surf_init() skips many calculations and<br>
+    * validations. If the given row pitch is incompatible with the requested<br>
+    * surface, then behavior is undefined.<br></blockquote><div><br></div><div>I'm not a fan.  I would much rather supplying a row_pitch mean "please validate and use this" rather than "trust me".  I don't want isl_surf_init to succeed and still give you a bad surface.  Sorry if that means real work. :-/<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+    */<br>
+   uint32_t row_pitch;<br>
+<br>
    isl_surf_usage_flags_t usage;<br>
<br>
    /** Flags that alter how ISL selects isl_surf::tiling.  */<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.12.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>