[Mesa-dev] Rename mesa/src/util (Was: gallium/util: add u_bit_scan64)

Kenneth Graunke kenneth at whitecape.org
Wed Feb 4 12:18:28 PST 2015


On Wednesday, February 04, 2015 02:04:38 PM Jose Fonseca wrote:
> This change broke MinGW/MSVC builds because ffsll is not available there.
> 
> 
> There is a ffsll C fallback, but it's in src/mesa/main/imports.[ch].  So 
> rather than duplicating it in src/gallium/auxiliary/util/u_math.h I'd 
> prefer move it to src/util.
> 
> 
> And here lies the problem: what header name should be used for math helpers?
> 
> 
> I think the filenames in src/util and the directory itself is poorly 
> named for something that is meant to be included by some many other 
> components:
> - there is no unique prefix in most headers
> - util/ clashes with src/gallium/auxiliary/util/
> 
> 
> Hence I'd like to propose to:
> 
> - rename src/util to something unique (e.g, cgrt, for Common Graphics 
> RunTime
> 
> And maybe:
> 
> - prefix all header/source files in there with a cgrt_* unique prefix too
> 
> And maybe in the future
> 
> - use cgrt_* prefix for symbols too.
> 
> 
> Jose

"util" is meant to be for shared utility across the entire code base -
both Mesa and Gallium.  It's been growing slowly as people move things
there.  It might make sense to move a lot of src/gallium/auxiliary/util
there, in fact - there's always been a lot of duplication between Mesa
and Gallium's utility code.  But that's up to the Gallium developers.

I think that "util" is precisely the right name.  If a new contributor
wants to find a hash table, or a set, or some macros...they're going to
look for utility code.  src/util is obviously named and easy to find.

I think any acronym like "cgrt" is going to confuse people.  src/cgrt
sounds like "some obscure part of the system I can ignore for now" -
easily overlooked, and what does the acronym mean anyway...

We chose not to add the "u_" prefix, partly for historical reasons
(Mesa never used one), but also specifically to avoid clashing with
src/gallium/auxiliary/util.  Most people don't put src/util in their
include path, and instead use #include "util/ralloc.h" - which already
is a prefix of sorts.  What additional value does "u_" provide?

I think you should just invent a header name and put it there.  "math.h"
does sound fairly generic.  If you're just reimplementing things like
ffsll that are usually provided by your system, it might make sense to
call it something like "os_compat.h" (along the lines of c99_compat.h).

Or maybe Brian is right - we could just move Gallium's utility code to
src/util and use it everywhere.  It'd be nice to not have two sets.

--Ken
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150204/4818bd05/attachment.sig>


More information about the mesa-dev mailing list