<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jun 7, 2018 at 3:45 PM, Mark Janes <span dir="ltr"><<a href="mailto:mark.a.janes@intel.com" target="_blank">mark.a.janes@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is cc'd to stable, but causes compile errors when to stable<br>
branches:<br>
<br>
src/intel/isl/isl_format.c:<wbr>372:20: error: ‘ISL_NUM_FORMATS’ undeclared<br>
(first use in this function); did you mean ‘ISL_UFLOAT’?<br>
<br>
Is it dependent on another patch?<br><div><div class="h5"></div></div></blockquote><div><br></div><div>It's dependent on patch 1 which was also CCd to stable.</div><div><br></div><div>--Jason</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> writes:<br>
<br>
> We follow the same convention as isl_format_get_layout in having two<br>
> assertions to ensure that only valid formats are passed in. We also<br>
> check against the array size of the table because some valid formats<br>
> such as CCS formats will may be past the end of the table. This fixes<br>
> some potential out-of-bounds array access even in valid cases.<br>
><br>
> Cc: <a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.freedesktop.<wbr>org</a><br>
> ---<br>
> src/intel/isl/isl_format.c | 24 ++++++++++++++++--------<br>
> 1 file changed, 16 insertions(+), 8 deletions(-)<br>
><br>
> diff --git a/src/intel/isl/isl_format.c b/src/intel/isl/isl_format.c<br>
> index 52997cf2ebb..968f981cdee 100644<br>
> --- a/src/intel/isl/isl_format.c<br>
> +++ b/src/intel/isl/isl_format.c<br>
> @@ -374,11 +374,19 @@ format_gen(const struct gen_device_info *devinfo)<br>
> return devinfo->gen * 10 + (devinfo->is_g4x || devinfo->is_haswell) * 5;<br>
> }<br>
> <br>
> +static bool<br>
> +format_info_exists(enum isl_format format)<br>
> +{<br>
> + assert(format != ISL_FORMAT_UNSUPPORTED);<br>
> + assert(format < ISL_NUM_FORMATS);<br>
> + return format < ARRAY_SIZE(format_info) && format_info[format].exists;<br>
> +}<br>
> +<br>
> bool<br>
> isl_format_supports_rendering(<wbr>const struct gen_device_info *devinfo,<br>
> enum isl_format format)<br>
> {<br>
> - if (!format_info[format].exists)<br>
> + if (!format_info_exists(format))<br>
> return false;<br>
> <br>
> return format_gen(devinfo) >= format_info[format].render_<wbr>target;<br>
> @@ -388,7 +396,7 @@ bool<br>
> isl_format_supports_alpha_<wbr>blending(const struct gen_device_info *devinfo,<br>
> enum isl_format format)<br>
> {<br>
> - if (!format_info[format].exists)<br>
> + if (!format_info_exists(format))<br>
> return false;<br>
> <br>
> return format_gen(devinfo) >= format_info[format].alpha_<wbr>blend;<br>
> @@ -398,7 +406,7 @@ bool<br>
> isl_format_supports_sampling(<wbr>const struct gen_device_info *devinfo,<br>
> enum isl_format format)<br>
> {<br>
> - if (!format_info[format].exists)<br>
> + if (!format_info_exists(format))<br>
> return false;<br>
> <br>
> if (devinfo->is_baytrail) {<br>
> @@ -431,7 +439,7 @@ bool<br>
> isl_format_supports_filtering(<wbr>const struct gen_device_info *devinfo,<br>
> enum isl_format format)<br>
> {<br>
> - if (!format_info[format].exists)<br>
> + if (!format_info_exists(format))<br>
> return false;<br>
> <br>
> if (devinfo->is_baytrail) {<br>
> @@ -464,7 +472,7 @@ bool<br>
> isl_format_supports_vertex_<wbr>fetch(const struct gen_device_info *devinfo,<br>
> enum isl_format format)<br>
> {<br>
> - if (!format_info[format].exists)<br>
> + if (!format_info_exists(format))<br>
> return false;<br>
> <br>
> /* For vertex fetch, Bay Trail supports the same set of formats as Haswell<br>
> @@ -483,7 +491,7 @@ bool<br>
> isl_format_supports_typed_<wbr>writes(const struct gen_device_info *devinfo,<br>
> enum isl_format format)<br>
> {<br>
> - if (!format_info[format].exists)<br>
> + if (!format_info_exists(format))<br>
> return false;<br>
> <br>
> return format_gen(devinfo) >= format_info[format].typed_<wbr>write;<br>
> @@ -504,7 +512,7 @@ bool<br>
> isl_format_supports_typed_<wbr>reads(const struct gen_device_info *devinfo,<br>
> enum isl_format format)<br>
> {<br>
> - if (!format_info[format].exists)<br>
> + if (!format_info_exists(format))<br>
> return false;<br>
> <br>
> return format_gen(devinfo) >= format_info[format].typed_<wbr>read;<br>
> @@ -542,7 +550,7 @@ bool<br>
> isl_format_supports_ccs_e(<wbr>const struct gen_device_info *devinfo,<br>
> enum isl_format format)<br>
> {<br>
> - if (!format_info[format].exists)<br>
> + if (!format_info_exists(format))<br>
> return false;<br>
> <br>
> /* For simplicity, only report that a format supports CCS_E if blorp can<br>
> -- <br>
> 2.17.1<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> mesa-stable mailing list<br>
> <a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.freedesktop.<wbr>org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-stable" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-stable</a><br>
</blockquote></div><br></div></div>