st/dri: Fix driver loading if swrast isn't built

If building hardware drivers only, then kms_swrast_create_screen
won't be defined in inline_drm_helper.h and hardware drivers will
fail to dlopen as a result.

Copy the #if guards from inline_drm_helper.h to dri_kms_init_screen
to make the definition/use of the function match.

Fixes radeonsi_dri.so dlopen with the following configure:

./configure --with-dri-drivers= --with-dri-driverdir=/usr/local/lib/dri/ \
--enable-gbm --enable-gallium-gbm --enable-debug --enable-opencl \
--enable-opencl-icd --with-gallium-drivers=radeonsi \
--with-egl-platforms=drm --enable-glx-tls --enable-texture-float \
--enable-omx

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
glsl: fix switch statement default case regressions

This patch fixes regressions caused by commit 48deb4d. Regressions
happened because 'run_default' var did not get initialized when default
case was the last one.

Now all the switch tests in es3conform suite are passing.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81857
gallium: Fix compiler warning.

warning: type qualifiers ignored on function return type

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
mesa/st: Fix compiler warnings

both array and index are unsigned types

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
targets/dri: resolve the scons build

With earlier commit we've conditionally enabled/added the kms_dri target
for automake builds. Unfortunately the we forgot to add the appropriate
define in the scons build, resulting in a broken library due to the
undefined symbol 'kms_swrast_create_screen'.

Reported-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Roland Scheidegger <sroland@vmware.com>
mesa/SConscript: Use Makefile.sources instead of duplicating the file lists

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
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>
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 6991c2922f5
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>
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>
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>
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>
gallium: Add libmesautil dependency to gdm and xa targets

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
svga: SVGA_3D_CMD_BIND_GB_SHADER needs to reserve two relocations.

With this patch, the SVGA_3D_CMD_BIND_GB_SHADER functionality will reserve
two relocations, one for the shader ID and the second for the MOB ID.

Verified with the WDDM winsys path that the number of relocations and patch
locations required is two.

Fixes Bug 1277406

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
xlib: fix missing mesautil build breakage

Fixes the non-DRI build.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
targets/vdpau: link with libmesautil.la to fix build breakage

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
util: include c99_compat.h in hash_table.h to get 'inline' definition

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
util: include c99_compat.h in format_srgb.h to get 'inline' definition

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/Makefile.am: Move gtest before util

Since the ralloc test in util/tests needs gtest, we need to make sure that
the gtest subdir is loaded first.  This fixes bug #82148.

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
mesa/x86: put code in braces to silence declarations after code warning

Reviewed-by: Matt Turner <mattst88@gmail.com>
targets/egl-static: link with libmesautil.la

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>