Commit Graph

5472 Commits

Author SHA1 Message Date
Brian Paul 943784bbcd gallium/util: add debug_print_usage_enum() debug helper
Signed-off-by: Brian Paul <brianp@vmware.com>
2015-02-27 15:22:04 -07:00
Brian Paul b14cec0b8e gallium/util: fix 'statement with no effect' warning
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2015-02-27 15:20:15 -07:00
Jose Fonseca 79daa510c7 configure: Leverage gcc warn options to enable safe use of C99 features where possible.
The main objective of this change is to enable Linux developers to use
more of C99 throughout Mesa, with confidence that the portions that need
to be built with MSVC -- and only those portions --, stay portable.

This is achieved by using the appropriate -Werror= options only on the
places they need to be used.

Unfortunately we still need MSVC 2008 on a few portions of the code
(namely llvmpipe and its dependencies).  I hope to eventually eliminate
this so that we can use C99 everywhere, but there are technical/logistic
challenges (specifically, newer Windows SDKs no longer bundle MSVC,
instead require a full installation of Visual Studio, and that has
hindered adoption of newer MSVC versions on our build processes.)
Thankfully we have more directy control over our OpenGL driver, which is
why we're now able to migrate to MSVC 2013 for most of the tree.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-02-27 14:30:36 +00:00
Jose Fonseca 46110c5d56 include,auxiliary: Remove support for MSVC older then 2008.
MSVC 2008 (shipped with Windows SDK 7.0.7600) is the oldest we
need to support.  At least on llvmpipe, gallium/auxiliary, and util
modules.  For the remaining modules (particular all OpenGL specific
code) can be built with MSVC 2013.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-02-26 16:53:16 +00:00
Brian Paul e09fe38935 util: add debug_print_bind_flags() debug helper
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2015-02-26 08:38:38 -07:00
Brian Paul cbd287f094 mesa: move math-related function into new c99_math.h file
The alternative would be to include math.h in c99_compat.h but that
seems heavy-handed.

This patch also replaces INLINE with inline in the c99 math function
wrappers.

Fixes MSVC build.

Acked-by: Matt Turner <mattst88@gmail.com>
2015-02-23 14:45:14 -07:00
Matt Turner 14ded5ee61 gallium: Use util_cpu_to_le{16,32} in many more places.
... and util_le{16,32}_to_cpu. I think I've used the right ones for
describing the actual operation performed (even though they're both just
"byte-swap this if I'm on big-endian").

The Linux Kernel has typedefs __le32/__be32 and friends that static
analysis tools can use to check that byte-orderings are correct. It
might be interesting to apply that here as well.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2015-02-23 10:41:22 -08:00
Matt Turner 3492e88090 gallium/util: Use HAVE___BUILTIN_* macros.
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2015-02-23 10:41:22 -08:00
Matt Turner 5a191f49ad mesa: Move C99 MSVC compatibility code from u_math.h to c99_compat.h.
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2015-02-23 10:41:21 -08:00
Brian Paul 44375a3b13 util: move pipe_prim_names array into u_prim_name()
Also, wrapping the array in #ifdef DEBUG / #endif doesn't seem necessary.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2015-02-23 10:02:39 -07:00
Brian Paul f1c67e37e6 util: rewrite debug_print_transfer_flags() using debug_dump_flags()
Add add missing PIPE_TRANSFER_PERSISTENT, PIPE_TRANSFER_COHERENT flags.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2015-02-23 10:02:39 -07:00
Ilia Mirkin 1763494b31 tgsi: avoid returning pointer to local var, make it static
Spotted by Coverity.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2015-02-21 17:27:24 -05:00
Marek Olšák ab947d2dd8 tgsi: fix type-mismatch warning
Reviewed-by: Brian Paul <brianp@vmware.com>
2015-02-21 00:16:34 +01:00
Marek Olšák 6f273ec408 gallivm: fix uninitialized-variable warnings
Reviewed-by: Brian Paul <brianp@vmware.com>
2015-02-21 00:16:34 +01:00
Eric Anholt 5ca019358f gallium/util: Don't include unused debug functions from u_math.h
It introduces references to gallium util/ symbols which means we don't get
to include it from outside-of-gallium code.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2015-02-20 11:36:34 -08:00
Ilia Mirkin 924ee3f408 gallium: add shader cap for dldexp/dfracexp support
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-02-19 19:32:52 -05:00
Ilia Mirkin 899d779cb7 gallium: add a cap to enable double rounding opcodes
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-02-19 19:32:49 -05:00
Ilia Mirkin 12dedca523 gallium: add some more double opcodes to avoid unnecessary lowering
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-02-19 19:32:35 -05:00
Dave Airlie 0e82817247 softpipe/tgsi: expose doubles for softpipe.
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-02-20 08:52:11 +10:00
Dave Airlie fa43e0443e tgsi: add support for flt64 constants
These act like flt32 except they take up two slots, and you
can only add 2 x flt64 constants in one slot.

The main reason they are different is we don't want to match half a flt64
constants against a flt32 constant in the matching code, we need to make
sure we treat both parts of the flt64 as an single structure.

Cleaned up printing/parsing by Ilia Mirkin <imirkin@alum.mit.edu>

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-02-20 08:51:49 +10:00
Dave Airlie 3cd1338534 gallium: add double opcodes and TGSI execution (v4.2)
This patch adds support for a set of double opcodes
to TGSI. It is an update of work done originally
by Michal Krol on the gallium-double-opcodes branch.

The opcodes have a hint where they came from in the
header file.

v2: add unsigned/int <-> double
v2.1:  update docs.

v3: add DRSQ (Glenn), fix review comments (Glenn).

v4: drop DDIV
v4.1: cleanups, fix some docs bugs, (Ilia)
      rework store_dest and fetch_source fns. (Ilia)
4.2: fixup float comparisons (Ilia)

This is based on code by Michael Krol <michal@vmware.com>

Roland and Glenn also reviewed earlier versions.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-02-20 08:49:12 +10:00
Brian Paul 14b9bf630c gallium/util: indentation fix 2015-02-19 15:36:59 -07:00
Ilia Mirkin 0821efcb33 gallium: add ETC2 format support
No actual decoding is added, similar faking mechanism to bptc.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2015-02-18 22:32:25 -05:00
Emil Velikov 8a71fd8d49 auxiliary/vl: honour the DRI2PROTO_CFLAGS
Otherwise for non-default installations the build will fail to find the
headers and error out.

Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-02-18 11:02:50 +00:00
Emil Velikov dd7b6670a2 auxiliary/vl: Build vl_winsys_dri.c only when needed.
With commit c39dbfdd0f7(auxiliary/vl: bring back the VL code for the dri
targets) we did not fully consider users of dri-swrast alone. Thus we
ended up trying to compile the dri2 specific code on platform which lack
it - Cygwin for example.

Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Reported-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-02-18 11:02:50 +00:00
Jose Fonseca c944b91190 os,llvmpipe: Set rasterizer thread names on Linux.
To help identify llvmpipe rasterizer threads -- especially when there
can be so many.

We can eventually generalize this to other OSes, but for that we must
restrict the function to be called from the current thread.  See also
http://stackoverflow.com/a/7989973

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2015-02-13 19:42:21 +00:00
Emil Velikov c39dbfdd0f auxiliary/vl: bring back the VL code for the dri targets
With commit c642e87d9f4(auxiliary/vl: rework the build of the VL code)
we split out the VL code into a separate static library that was meant
to be used by the VL targets alone - va, vdpau, xvmc.

The commit failed to consider the way we handle vdpau-gl interop and
broke it. Bring back the functionality by keeping the vl <> vl_stub
separation as requrested by Christian.

v2: Update the omx target as well. Update mesa-stable email address.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86837
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Andy Furniss <adf.lists@gmail.com>
2015-02-12 13:19:26 +00:00
Brian Paul d1e21325cf gallium/hud: also try R8_UNORM format for font texture
Convert the code to try formats from an array rather than a bunch
of if/else cases.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2015-02-07 11:03:37 -07:00
Brian Paul 6447e9dbfa gallium/hud: flush stdout in print_help(), for Windows
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2015-02-07 11:03:37 -07:00
Park, Jeongmin 2e6ba6afdb postprocess: Check for depth buffer in pp_jimenezmlaa
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88962
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2015-02-07 12:12:00 +01:00
Eric Anholt 9e35af08af tgsi/ureg: Add missing some missing opcodes opcode_tmp.h
I wanted all of these for NIR-to-TGSI.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2015-02-06 15:50:07 -08:00
Eric Anholt f3dbf3689a tgsi/ureg: Move ureg_dst_register() to the header.
I wanted to use it for nir-to-tgsi.  The equivalent ureg_src_register() is
also located here.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2015-02-06 15:50:07 -08:00
Marek Olšák 40fa7d44ab gallium/u_tests: test a NULL buffer sampler view
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
2015-02-06 22:27:07 +01:00
Marek Olšák 56e709bffb gallium/u_tests: test a NULL constant buffer
This expects (0,0,0,0), though it can be changed to something else or allow
more than one set of values to be considered correct.

This is currently the radeonsi behavior.

Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
2015-02-06 22:27:07 +01:00
Marek Olšák 9e8a6d8486 gallium/u_tests: test a NULL texture sampler view
v2: allow one of the two values
2015-02-06 22:27:06 +01:00
Marek Olšák 63e51baedc gallium/u_tests: restructure the only test, refactor out reusable code
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
2015-02-06 22:27:06 +01:00
Marek Olšák dcf996c31e gallium: run gallium tests if GALLIUM_TESTS=1 is set
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
2015-02-06 22:27:06 +01:00
Jose Fonseca 661c8bb220 gallium/util: Don't implement u_bit_scan64 on MSVC.
As ffsll doesn't exist in MSVC yet, and u_bit_scan64 is only used by
radeonsi which is never built with MSVC.

This is just a stop-gap fix to unbreak MSVC build until we refactor these
mathematical portability wrappers into src/util.

Trivial.
2015-02-04 15:22:59 +00:00
Jose Fonseca 46f1033067 gallium/util: Define ffsll on MinGW.
Trivial.

(Fixing MSVC will be far less so, as _BitScanForward64 is only supported on x64.)
2015-02-04 14:58:20 +00:00
Marek Olšák 8fc542aa89 gallium/u_pstipple: add ability to specify a fixed texture unit
E.g. r600g can use slot 17, which is outside of the API range.

Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2015-02-04 14:34:13 +01:00
Marek Olšák 50433ea526 gallium/util: add u_bit_scan64
Same as u_bit_scan, but for uint64_t.

Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2015-02-04 14:34:13 +01:00
Marek Olšák f2328ffdc8 tgsi: add tgsi_get_processor_type helper from radeon
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2015-02-04 14:34:13 +01:00
Matt Turner 32e98e8ef0 gallium/util: Don't use __builtin_clrsb in util_last_bit().
Unclear circumstances lead to undefined symbols on x86.

Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=536916
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2015-02-03 12:25:14 -08:00
Eric Anholt d70eb38517 gallium: Replace u_simple_list.h with util/simple_list.h
The code was exactly the same, except util/ has c++ guards and a struct
simple_node declaration.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2015-01-28 16:33:34 -08:00
Rob Clark 18899d1b80 tgsi: track max array per file
NOTE IN[] and OUT[] don't need (have?) ArrayID's.. and TEMP[] can
optionally have them.  So we implicitly assume that ArrayID==0 always
exists for each file.  This is why array_max[file] is never less than
zero.

You can tell from indirect_files(_read/written) if the legacy array-
id zero was actually used.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-01-07 19:37:28 -05:00
Rob Clark 49b4a6331f tgsi: keep track of read vs written indirects
At least temporarily, I need to fallback to old compiler still for
relative dest (for freedreno), but I can do relative src temp.  Only
a temporary situation, but seems easy/reasonable for tgsi-scan to
track this.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2015-01-07 19:37:28 -05:00
Marek Olšák 1b82eb677d tgsi: add uses_centroid into tgsi_shader_info 2015-01-07 12:06:43 +01:00
Brian Paul d294365d06 draw: silence uninitialized variable warning
v2: move initialization of llvm_gs to declaration.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2015-01-05 13:50:54 -07:00
Brian Paul 04e35cc4aa gallivm: silence a couple compiler warnings
Silence warnings about possibly uninitialized variables when making a
release build.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2015-01-05 13:50:54 -07:00
Leonid Shatz 5fea39ace3 gallium/util: make sure cache line size is not zero
The "normal" detection (querying clflush size) already made sure it is
non-zero, however another method did not. This lead to crashes if this
value happened to be zero (apparently can happen in virtualized environments
at least).
This fixes https://bugs.freedesktop.org/show_bug.cgi?id=87913

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
2015-01-05 17:58:39 +01:00