[Mesa-dev] [PATCH] i965: Replace structs with bit-shifting for Gen7 SURFACE_STATE entries.

Kenneth Graunke kenneth at whitecape.org
Sat Dec 29 13:21:02 PST 2012

On 12/29/2012 11:58 AM, Ben Widawsky wrote:
> On Fri, 28 Dec 2012 21:21:51 -0800
> Kenneth Graunke <kenneth at whitecape.org> wrote:
>> Every generation except Gen7 creates SURFACE_STATE entries via a
>> uint32_t array.  Only Gen7 uses the older bitfield structure, which we
>> moved away from because it was less efficient.  Convert it for
>> consistency.
>> This reduces the compiled size of gen7_wm_surface_state.o by 2.86% in
>> a release build.
> Just pointing out that this sucks wrt to intel-gen4asm not being able
> to directly copy the headers anymore.
> Hopefully someone can update it at some point, or else we'll have a
> mess on our hands in the not too distant future.

Huh?  intel-gen4asm is for shaders...these are indirect state objects.

I haven't looked at the intel-gen4asm code in ages, but it could copy 
over brw_defines.h, which is the core of the new approach.  It's what 
defines the <FIELD>_SHIFT and <FIELD>_MASK macros, which can be used 
with the GET_FIELD/SET_FIELD macros.  Or directly.  INTEL_MASK is also 

Also, it's already a giant mess: Mesa has a bunch of code, 
intel-gpu-tools contains some of it, the standalone intel-gen4asm/disasm 
utilities have some other bits, and the DDX has a giant pile of shader 
code.  I'm afraid it's only going to get worse with Gen8, if people 
really are writing their own representation for shader instructions 
rather than using the one I wrote for Mesa...


More information about the mesa-dev mailing list