[Mesa-dev] [PATCH 0/5] i965: die structs die!

Kenneth Graunke kenneth at whitecape.org
Thu Jul 7 01:50:25 PDT 2011


On 07/07/2011 01:12 AM, Zou, Nanhai wrote:
> Hi,
> 	What is the intention of switching struct-style command to OUT_BATCH style?
>
> Thanks
> Zou Nanhai

Several reasons:

1) Better code generation.

Eric has told me that GCC generates pretty sub-optimal code for 
packed-bit structs, and using OUT_BATCH makes it generate more efficient 
code.  From what I understand, converting the larger/hotter state 
packets caused a small but measurable performance difference.  Though, I 
doubt it matters much for these since they're rarely emitted.

2) Consistency.

Most of our newer code uses the OUT_BATCH style.  I'm in favor of 
picking one style and using it, not both.

3) Easy recognition of GPU commands:

Since most GPU commands are emitted via OUT_BATCH, I often used to look 
for OUT_BATCH when trying and find the code that emits a particular 
state packet.  For the few cases that used structs, I had trouble.

4) Hardware-specific structs vs. abitrary data structures:

I also found it confusing that some structs in our driver were 
descriptions of GPU commands with a specific, hardware-mandated layout, 
while other structs (like brw_wm_prog_key) were just useful data 
structures we invented and can change however we want.  (Admittedly, we 
still have some HW-specific structs, but a lot less of them.)

...

I'm not sure any of these are particularly compelling, but I figure we 
may as well go for consistency/simplicity and drop 500 lines of unused 
stuff.


More information about the mesa-dev mailing list