[Mesa-dev] [PATCH] mesa: Move register_allocate.c to util.

Roland Scheidegger sroland at vmware.com
Wed Sep 24 14:28:07 PDT 2014


Am 24.09.2014 21:52, schrieb Eric Anholt:
> Roland Scheidegger <sroland at vmware.com> writes:
> 
>> Oh yes and missing ALIGN + MAX2 too. I guess we could easily move these
>> to util code. That plus the things I already mentioned should be all
>> needed I think. But I strongly believe either this needs to be done or
>> we should revert it.
> 
> What's the actual problem being caused, though, other than needing to
> add an include dir?  I mean, the previous state was that drivers were
> compiling a second copy of the file themselves inside of gallium, and
> being careful to make all our link targets link it exactly once, which
> seems definitely worse than "oh, yeah, something outside of mesa/
> includes some mesa/ static inlines and #define helpers".


It also brings in lots of function declarations which obviously would
result in a link error if you'd try to use them.

> 
> If someone was really offended by this,
Yes I am. This seems to really really be against any good coding
practice. You can't just pull in random stuff from "subprojects" (even
if it's just headers) imho, the util code was explicitly moved there to
not be dependent on neither mesa core bits nor gallium. Don't forget
gallium drivers can be compiled without using the core mesa bits at all.

> you could move bitset to util/,
> and evict ffs code to the single caller in nouveau (which is probably a
> good idea, because using ffs in your loop is probably a terrible idea
> anyway).  But I think we all have more important things to be doing, and
> I don't think there's any actual harm being done.
> 

Yes, I suspect moving bitset to util would be the right solution. As
said though you'd also have to bring over align/max2 (either the gallium
or mesa version...), I guess it wouldn't hurt consolidating them, and
ffs is pretty much the same (also has mesa and gallium definitions).

Roland



More information about the mesa-dev mailing list