[Mesa-dev] [PATCH] i965: Fix undefined df bits in brw_reg comparisons.

Emil Velikov emil.l.velikov at gmail.com
Sat May 14 13:42:20 UTC 2016


Hi Ken,

On 14 May 2016 at 01:44, Kenneth Graunke <kenneth at whitecape.org> wrote:
> Commit 5310bca024f77da40ea6f4c275455f9cb0528f9e added a new "double df"
> field to the brw_reg struct, adding an extra 4 bytes of data that isn't
> usually initialized (or may contain irrelevant garbage if the struct is
> mutated).  This means that it's no longer safe to memcmp().
>
> Instead, add a brw_regs_equal() function which ignores the extra df bits
> unless they matter.  To keep the implementation cheap, we wrap the first
> set of fields in a union/struct so that we can use a single DWord
> comparison.
>
This seems to be roughly what I did a while ago [1], as part of a
series [2] to remove the memclear/memcmp in {brw,fs,src,dst}_reg.
Shame the series never got much input, even after a few pings :-(

-Emil
[1] https://patchwork.freedesktop.org/patch/63840/
[2] https://patchwork.freedesktop.org/series/483/


More information about the mesa-dev mailing list