<div dir="ltr">No, I do not believe this commit has made it.<div><br></div><div>Courtney</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 26, 2014 at 11:44 AM, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 02/17/2014 09:43 AM, Courtney Goeltzenleuchter wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks for the feedback.<br>
<br>
I've updated the patch to integrate Ian's comments.<br>
</blockquote>
<br></div>
Did the updated patch ever land?<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
Courtney<br>
<br>
<br>
On Fri, Feb 14, 2014 at 2:00 PM, Ian Romanick <<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a><br></div><div class="">
<mailto:<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>>> wrote:<br>
<br>
    On 02/14/2014 07:52 AM, Courtney Goeltzenleuchter wrote:<br>
     > Decompressing ETC2 textures was causing intermitent segfault<br>
     > by copying resulting 4x4 texel block to the destination texture<br>
     > regardless of the size of the destination texture. Issue found<br>
     > via application crash in GLBenchmark 3.0's Manhattan test.<br>
<br>
    So... the problem is that every ETC texture is (physically) a multiple<br>
    of 4 width, but we may have allocated a decompression buffer that was<br>
    the logical width of the texture.  I think the code needs more of a<br>
    comment explaining that.  Otherwise, when someone comes back to it in a<br>
    year (or uses it as a model for some other texture compression code),<br>
    they won't understand why the code is the way it is.<br>
<br>
    With that, this patch is<br>
<br>
    Reviewed-by: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com" target="_blank">ian.d.romanick@intel.com</a><br></div>
    <mailto:<a href="mailto:ian.d.romanick@intel.com" target="_blank">ian.d.romanick@intel.<u></u>com</a>>><div class=""><br>
<br>
    One additional suggestion below that you can take or leave.<br>
<br>
     > Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com><br>
<br>
    Also add:<br>
<br>
    Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=74988" target="_blank">https://bugs.freedesktop.org/<u></u>show_bug.cgi?id=74988</a><br>
    Cc: "9.2 10.0 10.1" <<a href="mailto:mesa-stable@lists.freedesktop.org" target="_blank">mesa-stable@lists.<u></u>freedesktop.org</a><br></div>
    <mailto:<a href="mailto:mesa-stable@lists.freedesktop.org" target="_blank">mesa-stable@lists.<u></u>freedesktop.org</a>>><div><div class="h5"><br>
<br>
     > ---<br>
     >  src/mesa/main/texcompress_etc.<u></u>c | 49<br>
    +++++++++++++++++++++---------<u></u>-----------<br>
     >  1 file changed, 25 insertions(+), 24 deletions(-)<br>
     ><br>
     > diff --git a/src/mesa/main/texcompress_<u></u>etc.c<br>
    b/src/mesa/main/texcompress_<u></u>etc.c<br>
     > index e3862be..f9234b0 100644<br>
     > --- a/src/mesa/main/texcompress_<u></u>etc.c<br>
     > +++ b/src/mesa/main/texcompress_<u></u>etc.c<br>
     > @@ -684,9 +684,10 @@ etc2_unpack_rgb8(uint8_t *dst_row,<br>
     >           etc2_rgb8_parse_block(&block, src,<br>
     >                                 false /* punchthrough_alpha */);<br>
     ><br>
<br>
    Alternately, the code below could be:<br>
<br>
         const unsigned h = MIN2(bh, height - y);<br>
         const unsigned w = MIN2(bw, width - x);<br>
<br>
         ...<br>
<br>
         for (j = 0; j < h; j++) {<br>
<br>
         ...<br>
<br>
            for (i = 0; i < w; i++) {<br>
<br>
<br>
     > -         for (j = 0; j < bh; j++) {<br>
     > +         /* be sure to stay within the bounds of the texture */<br>
     > +         for (j = 0; j < bh && (j+y) < height; j++) {<br>
     >              uint8_t *dst = dst_row + (y + j) * dst_stride + x *<br>
    comps;<br>
     > -            for (i = 0; i < bw; i++) {<br>
     > +            for (i = 0; i < bw && (i+x) < width; i++) {<br>
     >                 etc2_rgb8_fetch_texel(&block, i, j, dst,<br>
     >                                       false /* punchthrough_alpha<br>
    */);<br>
     >                 dst[3] = 255;<br>
     > @@ -721,9 +722,9 @@ etc2_unpack_srgb8(uint8_t *dst_row,<br>
     >           etc2_rgb8_parse_block(&block, src,<br>
     >                                 false /* punchthrough_alpha */);<br>
     ><br>
     > -         for (j = 0; j < bh; j++) {<br>
     > +         for (j = 0; j < bh && (j+y) < height; j++) {<br>
     >              uint8_t *dst = dst_row + (y + j) * dst_stride + x *<br>
    comps;<br>
     > -            for (i = 0; i < bw; i++) {<br>
     > +            for (i = 0; i < bw && (i+x) < width; i++) {<br>
     >                 etc2_rgb8_fetch_texel(&block, i, j, dst,<br>
     >                                       false /* punchthrough_alpha<br>
    */);<br>
     >                 /* Convert to MESA_FORMAT_B8G8R8A8_SRGB */<br>
     > @@ -764,9 +765,9 @@ etc2_unpack_rgba8(uint8_t *dst_row,<br>
     >        for (x = 0; x < width; x+= bw) {<br>
     >           etc2_rgba8_parse_block(&block, src);<br>
     ><br>
     > -         for (j = 0; j < bh; j++) {<br>
     > +         for (j = 0; j < bh && (j+y) < height; j++) {<br>
     >              uint8_t *dst = dst_row + (y + j) * dst_stride + x *<br>
    comps;<br>
     > -            for (i = 0; i < bw; i++) {<br>
     > +            for (i = 0; i < bw && (i+x) < width; i++) {<br>
     >                 etc2_rgba8_fetch_texel(&block, i, j, dst);<br>
     >                 dst += comps;<br>
     >              }<br>
     > @@ -801,9 +802,9 @@ etc2_unpack_srgb8_alpha8(<u></u>uint8_t *dst_row,<br>
     >        for (x = 0; x < width; x+= bw) {<br>
     >           etc2_rgba8_parse_block(&block, src);<br>
     ><br>
     > -         for (j = 0; j < bh; j++) {<br>
     > +         for (j = 0; j < bh && (j+y) < height; j++) {<br>
     >              uint8_t *dst = dst_row + (y + j) * dst_stride + x *<br>
    comps;<br>
     > -            for (i = 0; i < bw; i++) {<br>
     > +            for (i = 0; i < bw && (i+x) < width; i++) {<br>
     >                 etc2_rgba8_fetch_texel(&block, i, j, dst);<br>
     ><br>
     >                 /* Convert to MESA_FORMAT_B8G8R8A8_SRGB */<br>
     > @@ -843,9 +844,9 @@ etc2_unpack_r11(uint8_t *dst_row,<br>
     >        for (x = 0; x < width; x+= bw) {<br>
     >           etc2_r11_parse_block(&block, src);<br>
     ><br>
     > -         for (j = 0; j < bh; j++) {<br>
     > +         for (j = 0; j < bh && (j+y) < height; j++) {<br>
     >              uint8_t *dst = dst_row + (y + j) * dst_stride + x *<br>
    comps * comp_size;<br>
     > -            for (i = 0; i < bw; i++) {<br>
     > +            for (i = 0; i < bw && (i+x) < width; i++) {<br>
     >                 etc2_r11_fetch_texel(&block, i, j, dst);<br>
     >                 dst += comps * comp_size;<br>
     >              }<br>
     > @@ -879,10 +880,10 @@ etc2_unpack_rg11(uint8_t *dst_row,<br>
     >           /* red component */<br>
     >           etc2_r11_parse_block(&block, src);<br>
     ><br>
     > -         for (j = 0; j < bh; j++) {<br>
     > +         for (j = 0; j < bh && (j+y) < height; j++) {<br>
     >              uint8_t *dst = dst_row + (y + j) * dst_stride +<br>
     >                             x * comps * comp_size;<br>
     > -            for (i = 0; i < bw; i++) {<br>
     > +            for (i = 0; i < bw && (i+x) < width; i++) {<br>
     >                 etc2_r11_fetch_texel(&block, i, j, dst);<br>
     >                 dst += comps * comp_size;<br>
     >              }<br>
     > @@ -890,10 +891,10 @@ etc2_unpack_rg11(uint8_t *dst_row,<br>
     >           /* green component */<br>
     >           etc2_r11_parse_block(&block, src + 8);<br>
     ><br>
     > -         for (j = 0; j < bh; j++) {<br>
     > +         for (j = 0; j < bh && (j+y) < height; j++) {<br>
     >              uint8_t *dst = dst_row + (y + j) * dst_stride +<br>
     >                             x * comps * comp_size;<br>
     > -            for (i = 0; i < bw; i++) {<br>
     > +            for (i = 0; i < bw && (i+x) < width; i++) {<br>
     >                 etc2_r11_fetch_texel(&block, i, j, dst + comp_size);<br>
     >                 dst += comps * comp_size;<br>
     >              }<br>
     > @@ -926,10 +927,10 @@ etc2_unpack_signed_r11(uint8_t *dst_row,<br>
     >        for (x = 0; x < width; x+= bw) {<br>
     >           etc2_r11_parse_block(&block, src);<br>
     ><br>
     > -         for (j = 0; j < bh; j++) {<br>
     > +         for (j = 0; j < bh && (j+y) < height; j++) {<br>
     >              uint8_t *dst = dst_row + (y + j) * dst_stride +<br>
     >                             x * comps * comp_size;<br>
     > -            for (i = 0; i < bw; i++) {<br>
     > +            for (i = 0; i < bw && (i+x) < width; i++) {<br>
     >                 etc2_signed_r11_fetch_texel(&<u></u>block, i, j, dst);<br>
     >                 dst += comps * comp_size;<br>
     >              }<br>
     > @@ -963,10 +964,10 @@ etc2_unpack_signed_rg11(uint8_<u></u>t *dst_row,<br>
     >           /* red component */<br>
     >           etc2_r11_parse_block(&block, src);<br>
     ><br>
     > -         for (j = 0; j < bh; j++) {<br>
     > +         for (j = 0; j < bh && (j+y) < height; j++) {<br>
     >              uint8_t *dst = dst_row + (y + j) * dst_stride +<br>
     >                            x * comps * comp_size;<br>
     > -            for (i = 0; i < bw; i++) {<br>
     > +            for (i = 0; i < bw && (i+x) < width; i++) {<br>
     >                 etc2_signed_r11_fetch_texel(&<u></u>block, i, j, dst);<br>
     >                 dst += comps * comp_size;<br>
     >              }<br>
     > @@ -974,10 +975,10 @@ etc2_unpack_signed_rg11(uint8_<u></u>t *dst_row,<br>
     >           /* green component */<br>
     >           etc2_r11_parse_block(&block, src + 8);<br>
     ><br>
     > -         for (j = 0; j < bh; j++) {<br>
     > +         for (j = 0; j < bh && (j+y) < height; j++) {<br>
     >              uint8_t *dst = dst_row + (y + j) * dst_stride +<br>
     >                             x * comps * comp_size;<br>
     > -            for (i = 0; i < bw; i++) {<br>
     > +            for (i = 0; i < bw && (i+x) < width; i++) {<br>
     >                 etc2_signed_r11_fetch_texel(&<u></u>block, i, j, dst +<br>
    comp_size);<br>
     >                 dst += comps * comp_size;<br>
     >              }<br>
     > @@ -1007,9 +1008,9 @@<br>
    etc2_unpack_rgb8_punchthrough_<u></u>alpha1(uint8_t *dst_row,<br>
     >        for (x = 0; x < width; x+= bw) {<br>
     >           etc2_rgb8_parse_block(&block, src,<br>
     >                                 true /* punchthrough_alpha */);<br>
     > -         for (j = 0; j < bh; j++) {<br>
     > +         for (j = 0; j < bh && (j+y) < height; j++) {<br>
     >              uint8_t *dst = dst_row + (y + j) * dst_stride + x *<br>
    comps;<br>
     > -            for (i = 0; i < bw; i++) {<br>
     > +            for (i = 0; i < bw && (i+x) < width; i++) {<br>
     >                 etc2_rgb8_fetch_texel(&block, i, j, dst,<br>
     >                                       true /* punchthrough_alpha */);<br>
     >                 dst += comps;<br>
     > @@ -1042,9 +1043,9 @@<br>
    etc2_unpack_srgb8_<u></u>punchthrough_alpha1(uint8_t *dst_row,<br>
     >        for (x = 0; x < width; x+= bw) {<br>
     >           etc2_rgb8_parse_block(&block, src,<br>
     >                                 true /* punchthrough_alpha */);<br>
     > -         for (j = 0; j < bh; j++) {<br>
     > +         for (j = 0; j < bh && (j+y) < height; j++) {<br>
     >              uint8_t *dst = dst_row + (y + j) * dst_stride + x *<br>
    comps;<br>
     > -            for (i = 0; i < bw; i++) {<br>
     > +            for (i = 0; i < bw && (i+x) < width; i++) {<br>
     >                 etc2_rgb8_fetch_texel(&block, i, j, dst,<br>
     >                                       true /* punchthrough_alpha */);<br>
     >                 /* Convert to MESA_FORMAT_B8G8R8A8_SRGB */<br>
     ><br>
<br>
<br>
<br>
<br>
--<br>
Courtney Goeltzenleuchter<br>
LunarG<br>
<br>
</div></div></blockquote>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Courtney Goeltzenleuchter<br><div>LunarG</div><div><img src="http://media.lunarg.com/wp-content/themes/LunarG/images/logo.png" width="96" height="65"><br>
</div></div>
</div>