Commit Graph

1726 Commits

Author SHA1 Message Date
Matt Turner ccad3829e3 util: Move u_atomic.h to src/util.
To be shared outside of Gallium.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-12-01 11:28:44 -08:00
Timothy Arceri b3721cd230 util: update hash type comments
Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-11-26 20:04:13 +11:00
Matt Turner 99cebffda9 util: Implement assume() for clang.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2014-11-24 14:09:23 -08:00
Ian Romanick 6f3b8bb747 util: Implement unreachable for MSVC using __assume
Based on the description of __assume at:

http://msdn.microsoft.com/en-us/library/1b3fsfxw.aspx

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-11-05 09:36:04 -08:00
Chia-I Wu 61c3d49388 util: initialize locale_t with a static object
_mesa_strtod and _mesa_strtof may be called from multiple threads.  They need
to be thread-safe.

v2: platform checks are now done in configure.ac

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-10-30 02:26:19 -07:00
Chia-I Wu b039dbfffd configure: check for xlocale.h and strtof
With the assumptions that xlocale.h implies newlocale and strtof_l.  SCons is
updated to define HAVE_XLOCALE_H on linux and darwin.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-10-30 02:26:19 -07:00
Chia-I Wu e3f2029479 util: add _mesa_strtod and _mesa_strtof
Both core mesa and glsl have their own wrappers for strtof_l.  Merge
and move them to util/.  They are compiled with a C++ compiler so that
we can make them thread-safe in a following commit.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Kenneth Graunke <kenneth@whiteacpe.org>
2014-10-30 02:26:19 -07:00
Jason Ekstrand f84adb8481 util: Use reg_belongs_to_class instead of BITSET_TEST
This shouldn't be a functional change since reg_belongs_to_class is just a
wrapper around BITSET_TEST.  It just makes the code a little easier to
read.

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-10-24 16:23:08 -07:00
Matt Turner 2695891088 util: Add assume() macro.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-10-23 16:20:07 -07:00
Tomasz Figa d703abf735 util: Include in Android builds
This patch fixes Android build failures by including src/util directory
in compilation. Files inside of this directory are compiled into
libmesa_util static library and linked with resulting libGLES_mesa.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-10-03 01:25:28 +01:00
Matt Turner e4be17fd04 ralloc: Mark ralloc functions with gcc's malloc attribute.
Cuts a few hundred bytes from the DRI drivers, so it must give gcc some
extra information.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-09-25 13:52:55 -07:00
Matt Turner 976464c210 mesa: Replace a priori knowledge of gcc attributes with configure tests.
Note that I had to add support for testing the packed attribute to
m4/ax_gcc_func_attribute.m4.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> [C bits]
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-09-25 13:52:55 -07:00
Matt Turner 4a96df73e7 mesa: Replace a priori knowledge of gcc builtins with configure tests.
Presumbly this will let clang and other compilers use the built-ins as
well.

Notice two changes specifically:
   - in _mesa_next_pow_two_64(), always use __builtin_clzll and add a
     static assertion that this is safe.
   - in macros.h, remove the clang-specific definition since it should
     be able to detect __builtin_unreachable in configure.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> [C bits]
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-09-25 13:52:55 -07:00
Brian Paul e8ea783d79 util: fix SCons build
after register_allocate.c was moved to util/ directory.
2014-09-23 16:33:17 -06:00
Eric Anholt 517e01b5c3 mesa: Move register_allocate.c to util.
The r300 gallium driver is using it outside of the Mesa tree, and I wanted
to do so for vc4 as well.  Rather than make the multiple-definitions
problem even more complicated, just move it to more-shared code.

v2: Don't forget to delete the symlink in r300 (review by Matt).
    Delete more r300-helper references (review by Emil)
    Don't prefix util/ header inclusion with "util/" (review by Emil)

Reviewed-by: Matt Turner <mattst88@gmail.com> (v1)
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> (v1)
2014-09-23 13:40:10 -07:00
Dave Airlie ebcb2ee989 util: move shared rgtc code to util (v2)
This was being shared using a ../../ get out of gallium into
mesa, and I swore when I did it I'd fix things when we got a util
dir, we did, so I have.

v2: move RGTC_DEBUG define

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-09-17 11:27:25 +10:00
Emil Velikov 16826a36ef util: remove ralloc_test
The tests in an empty stub, which we're currently building twice.
If anyone is interested in expanding it (adding actual tests) they
can always bring it back.

Suggested-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-08-08 19:23:25 +01:00
Juha-Pekka Heikkila d64be94294 util: add src/util/format_srgb.c to .gitignore
format_srgb.c is generated by format_srgb.py python script, having
format_srgb.c in git ignore list will silence git complaints about
untracked file.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-08-08 09:49:52 +03:00
Jason Ekstrand 1d47f67455 util/tests/hash_table: Link against libmesautil instead of libmesa
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82159

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-08-05 10:52:48 -07:00
Brian Paul 9b10bc5589 util: include c99_compat.h in format_srgb.h to get 'inline' definition
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2014-08-04 14:06:13 -06:00
Brian Paul 04764f3bd9 util: include c99_compat.h in hash_table.h to get 'inline' definition
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2014-08-04 14:06:13 -06:00
Jason Ekstrand e97498ef81 mesa/main: Use the RGB <-> sRGB conversion functions in libmesautil
Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-08-04 11:07:20 -07:00
Jason Ekstrand 992e1ea8e4 gallium: Move sRGB <-> RGB handling to libmesautil
Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-08-04 11:07:15 -07:00
Jason Ekstrand efa0aa8ffc util: Gather some common macros
This gathers macros that have been included across components into util so
that the include chain can be more vertical.  In particular, this makes
util stand on its own without any dependence whatsoever on the rest of
mesa.

Signed-off-by: "Jason Ekstrand" <jason.ekstrand@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-08-04 11:07:10 -07:00
Kenneth Graunke 72e55bb688 util: Move the open-addressing linear-probing hash_table to src/util.
This hash table is used in core Mesa, the GLSL compiler, and the i965
driver, which makes it a good candidate for the new src/util module.

It's much faster than program/hash_table.[ch] (see commit 6991c2922f
for data), and José's u_hash_table.c has a comment saying Gallium should
probably consider switching to a linear probing hash table at some point.
So this seems like the best candidate for a shared data structure.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>

v2 (Jason Ekstrand): Pick up another hash_table use and patch up scons

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-08-04 11:07:05 -07:00
Kenneth Graunke 1e0da6233b util: Move ralloc to a new src/util directory.
For a long time, we've wanted a place to put utility code which isn't
directly tied to Mesa or Gallium internals.  This patch creates a new
src/util directory for exactly that purpose, and builds the contents as
libmesautil.la.

ralloc seemed like a good first candidate.  These days, it's directly
used by mesa/main, i965, i915, and r300g, so keeping it in src/glsl
didn't make much sense.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>

v2 (Jason Ekstrand): More realloc uses and some scons fixes

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-08-04 11:06:58 -07:00