[Mesa-dev] [PATCH] i965: Tell intel_get_memcpy() which direction the memcpy() is going.

Matt Turner mattst88 at gmail.com
Wed Mar 4 17:28:21 PST 2015


On Wed, Mar 4, 2015 at 5:07 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> On Wed, Mar 4, 2015 at 4:56 PM, Matt Turner <mattst88 at gmail.com> wrote:
>> @@ -357,16 +394,22 @@ linear_to_xtiled_faster(uint32_t x0, uint32_t x1,
>> uint32_t x2, uint32_t x3,
>>        if (mem_copy == memcpy)
>>           return linear_to_xtiled(0, 0, xtile_width, xtile_width, 0,
>> xtile_height,
>>                                   dst, src, src_pitch, swizzle_bit,
>> memcpy);
>> -      else if (mem_copy == rgba8_copy)
>> +      else if (mem_copy == rgba8_copy_aligned_dst)
>>           return linear_to_xtiled(0, 0, xtile_width, xtile_width, 0,
>> xtile_height,
>> -                                 dst, src, src_pitch, swizzle_bit,
>> rgba8_copy);
>> +                                 dst, src, src_pitch, swizzle_bit,
>> +                                 rgba8_copy_aligned_dst);
>> +      else
>> +         unreachable("not reached");
>
>
> I'm not sure what I think about the unreachable here.  The original versions
> of the *_faster functions would work regardless of what memcpy you passed
> in.

Well, yeah, but there were only two. :)

> The *_faster was only to force the compiler to inline the universe in
> the case where we knew some parameters.  Adding unreachable changes that.

Oh, I didn't know what you meant, until I realized that the if-elseif
is supposed to fall through to another function call in the case that
mem_copy wasn't matched.

At the very least I should split that out into a separate patch. Using
unreachable(), if it's safe, cuts more than 1k of text:

   text   data    bss    dec    hex filename
   9663      0      0   9663   25bf .libs/intel_tiled_memcpy.o
   8215      0      0   8215   2017 .libs/intel_tiled_memcpy.o

I'll drop the unreachable()s from this patch.

> That said, we never call them with anything other than memcpy or
> rgba8_copy_aligned_* so it's probably ok.  I think I'm ok with it with or
> without the unreachable()'s.


More information about the mesa-dev mailing list