platform/upstream/mesa.git
8 years agoconfigure: Add support for the Intel Vulkan driver
Jason Ekstrand [Thu, 14 Apr 2016 20:04:22 +0000 (13:04 -0700)]
configure: Add support for the Intel Vulkan driver

This adds a --with-vulkan-drivers option with one driver, "intel".  In the
future, we may add more drivers to this list.

v2: Don't enable any drivers by default.  This should prevent this patch
    from breaking anyone's build.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/surface_formats: Update some formats for more recent gens
Jason Ekstrand [Thu, 14 Apr 2016 17:45:24 +0000 (10:45 -0700)]
i965/surface_formats: Update some formats for more recent gens

The surface format table hasn't entirely been kept up-to-date.  This commit
marks a couple more compressed formats as sampleable on gen8+ and adds the
A4B4G4R4 format as renderable on gen9.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoutil/list: Add list splicing functions
Jason Ekstrand [Thu, 30 Jul 2015 18:28:22 +0000 (11:28 -0700)]
util/list: Add list splicing functions

This adds functions for splicing one list into another.  These have
more-or-less the same API as the kernel list splicing functions.  The
implementation, however, was stolen from the Wayland list implementation.

Reviewed-by: Mark Janes <mark.a.janes@intel.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
8 years agogallium/swr: confine c++11 flag to swr driver
Tim Rowley [Thu, 14 Apr 2016 23:23:33 +0000 (18:23 -0500)]
gallium/swr: confine c++11 flag to swr driver

On the philosophy that a driver shouldn't change the compile flags
for the entire tree, take the clove approach of moving the c++11 flag
to the swr driver directory.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agogallium/swr: allow swr use as a swrast dri driver
Tim Rowley [Fri, 15 Apr 2016 17:38:25 +0000 (12:38 -0500)]
gallium/swr: allow swr use as a swrast dri driver

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agovc4: Fix subimage accesses to LT textures.
Eric Anholt [Fri, 15 Apr 2016 18:43:00 +0000 (11:43 -0700)]
vc4: Fix subimage accesses to LT textures.

This code started out like the T case, iterating over utile offsets, but I
had partially switched it to iterating over pixel offsets.  I hadn't
caught this before because it's unusual to do piecemeal uploads to small
textures.

Fixes bad text rendering in QT5 apps, which use a 256x16 glyph cache.
Also fixes 6 piglit tests related to glTexSubImage() and
glGetTexSubImage().

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
8 years agoutil: Fix race condition on libgcrypt initialization
Mark Janes [Tue, 12 Apr 2016 18:52:53 +0000 (11:52 -0700)]
util: Fix race condition on libgcrypt initialization

Fixes intermittent Vulkan CTS failures within the test groups:
dEQP-VK.api.object_management.multithreaded_per_thread_device
dEQP-VK.api.object_management.multithreaded_per_thread_resources
dEQP-VK.api.object_management.multithreaded_shared_resources

Signed-off-by: Mark Janes <mark.a.janes@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94904

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoconfigure: Add support for detecting valgrind headers
Jason Ekstrand [Thu, 14 Apr 2016 20:02:48 +0000 (13:02 -0700)]
configure: Add support for detecting valgrind headers

We have several places where the Vulkan driver explicitly hooks into
valgrind when it's available.  We need to be able to detect it.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agonir/print: Fix printing variable mode
Eduardo Lima Mitev [Fri, 15 Apr 2016 08:00:05 +0000 (10:00 +0200)]
nir/print: Fix printing variable mode

nir_variable_mode is currently a bitflag enum, while
nir_print::print_var_decl() assumes is still a numbered list.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoxlib: remove MESA_GLX_VISUAL_HACK
John Sheu [Fri, 1 Apr 2016 23:52:22 +0000 (16:52 -0700)]
xlib: remove MESA_GLX_VISUAL_HACK

This removes a hack introduced in 1999 in the first version of
fakeglx.c, with the comment:

  /* XXX revisit this after 3.0 is finished. */

Mesa 4.0 was released in 2001.  It is now 2016, and Mesa 11.0 was
released last year.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
8 years agoxlib: fix leaks of returned values from XGetVisualInfo
John Sheu [Fri, 1 Apr 2016 23:52:21 +0000 (16:52 -0700)]
xlib: fix leaks of returned values from XGetVisualInfo

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
8 years agoxlib: fix memory leak of and remove vishandle from XMesaVisualInfo
John Sheu [Fri, 1 Apr 2016 23:52:20 +0000 (16:52 -0700)]
xlib: fix memory leak of and remove vishandle from XMesaVisualInfo

The vishandle member of XMesaVisualInfo is used to support the
comparison of XVisualInfo instances by pointer value, in
find_glx_visual().  The comparison however will always be false, as in
every case the comparison is made, the VisualInfo instance being
compared to is a new allocation passed in through a GLX API call.

In addition, the XVisualInfo instance pointed to by vishandle is itself
never freed, causing a memory leak.  Since vishandle is essentially
useless, we just remove it and thereby also fix the leak.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
8 years agoxlib: do not cache return value of glXChooseVisual/glXGetVisualFromFBConfig
John Sheu [Wed, 13 Apr 2016 20:57:42 +0000 (13:57 -0700)]
xlib: do not cache return value of glXChooseVisual/glXGetVisualFromFBConfig

The returned XVisualInfo from glXChooseVisual/glXGetVisualFromFBConfig
is being cached in XMesaVisual.vishandle (and unconditionally
overwritten on subsequent calls).  However, these entry points are
specified to return XVisualInfo instances to be owned by the caller and
freed with XFree(), so the return values should not be retained.

With this change, XMesaVisual.vishandle is essentially unused and will
be removed in a subsequent change.

v2: update commit message

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
8 years agoi965: Expose the surface format table
Jason Ekstrand [Thu, 14 Apr 2016 17:42:29 +0000 (10:42 -0700)]
i965: Expose the surface format table

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonir/lower_io: Add UBOs and SSBOs to get_io_offset_src
Jason Ekstrand [Thu, 14 Apr 2016 17:31:27 +0000 (10:31 -0700)]
nir/lower_io: Add UBOs and SSBOs to get_io_offset_src

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonir/intrinsics: Add a vulkan_resource_index intrinsic
Jason Ekstrand [Fri, 25 Mar 2016 17:17:28 +0000 (10:17 -0700)]
nir/intrinsics: Add a vulkan_resource_index intrinsic

This is used to facilitate the Vulkan binding model where each resource is
described by a (descriptor set, binding, array index) tuple.

Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agonir: Add a descriptor_set field to nir_variable
Jason Ekstrand [Fri, 25 Mar 2016 17:16:23 +0000 (10:16 -0700)]
nir: Add a descriptor_set field to nir_variable

This is needed for supporting the Vulkan binding model

Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agodri: Fix robust context creation via EGL attribute
Chad Versace [Mon, 11 Apr 2016 22:12:15 +0000 (15:12 -0700)]
dri: Fix robust context creation via EGL attribute

driCreateContextAttribs() emits an error if bit
__DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS is set for an ES context.  But,
EGL_EXT_create_context_robustness and EGL 1.5 both allow creation of
robust ES contexts. One requests a robust ES context by setting the
EGL_CONTEXT_OPENGL_ROBUST_ACCESS *attribute*, which Mesa's EGL layer
translates into the __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS *bit*.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeon/uvd: fix tonga feedback buffer size
Leo Liu [Tue, 12 Apr 2016 19:19:31 +0000 (15:19 -0400)]
radeon/uvd: fix tonga feedback buffer size

This only applies to tonga

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
8 years agoi965: Push everything if pull_param == NULL
Jason Ekstrand [Tue, 5 Apr 2016 23:22:26 +0000 (16:22 -0700)]
i965: Push everything if pull_param == NULL

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: Push small uniform arrays
Jason Ekstrand [Wed, 9 Dec 2015 01:34:38 +0000 (17:34 -0800)]
i965/fs: Push small uniform arrays

Unfortunately, this also means that we need to use a slightly different
algorithm for assign_constant_locations.  The old algorithm worked based on
the assumption that each read of a uniform value read exactly one float.
If it encountered a MOV_INDIRECT, it would immediately bail and push the
whole thing.  Since we can now read ranges using MOV_INDIRECT, we need to
be able to push a series of floats without breaking them up.  To do this,
we use an algorithm similar to the on in split_virtual_grfs.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: Rename demote_pull_constants to lower_constant_loads
Jason Ekstrand [Wed, 9 Dec 2015 01:14:49 +0000 (17:14 -0800)]
i965/fs: Rename demote_pull_constants to lower_constant_loads

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/vec4: Get rid of the uniform_size array
Jason Ekstrand [Wed, 9 Dec 2015 01:02:16 +0000 (17:02 -0800)]
i965/vec4: Get rid of the uniform_size array

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/vec4: Use MOV_INDIRECT instead of reladdr for indirect push constants
Jason Ekstrand [Wed, 25 Nov 2015 17:36:34 +0000 (09:36 -0800)]
i965/vec4: Use MOV_INDIRECT instead of reladdr for indirect push constants

This commit moves us to an instruction based model rather than a
register-based model for indirects.  This is more accurate anyway as we
have to emit instructions to resolve the reladdr.  It's also a lot simpler
because it gets rid of the recursive reladdr problem by design.

One side-effect of this is that we need a whole new algorithm in
move_uniform_array_access_to_pull_constants.  This new algorithm is much
more straightforward than the old one and is fairly similar to what we're
already doing in the FS backend.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: Get rid of the param_size array
Jason Ekstrand [Wed, 25 Nov 2015 01:02:01 +0000 (17:02 -0800)]
i965/fs: Get rid of the param_size array

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: Stop relying on param_size in assign_constant_locations
Jason Ekstrand [Tue, 24 Nov 2015 23:16:14 +0000 (15:16 -0800)]
i965/fs: Stop relying on param_size in assign_constant_locations

Now that we have MOV_INDIRECT opcodes, we have all of the size information
we need directly in the opcode.  With a little restructuring of the
algorithm used in assign_constant_locations we don't need param_size
anymore.  The big thing to watch out for now, however, is that you can have
two ranges overlap where neither contains the other.  In order to deal with
this, we make the first pass just flag what needs pulling and handle
assigning pull constant locations until later.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: Get rid of reladdr
Jason Ekstrand [Wed, 25 Nov 2015 00:54:41 +0000 (16:54 -0800)]
i965/fs: Get rid of reladdr

We aren't using it anymore.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: Use MOV_INDIRECT for all indirect uniform loads
Jason Ekstrand [Tue, 24 Nov 2015 23:12:20 +0000 (15:12 -0800)]
i965/fs: Use MOV_INDIRECT for all indirect uniform loads

Instead of using reladdr, this commit changes the FS backend to emit a
MOV_INDIRECT whenever we need an indirect uniform load.  We also have to
rework some of the other bits of the backend to handle this new form of
uniform load.  The obvious change is that demote_pull_constants now acts
more like a lowering pass when it hits a MOV_INDIRECT.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonir: Add another index to load_uniform to specify the range read
Jason Ekstrand [Tue, 24 Nov 2015 21:52:49 +0000 (13:52 -0800)]
nir: Add another index to load_uniform to specify the range read

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: Add support for MOV_INDIRECT on pre-Broadwell hardware
Jason Ekstrand [Tue, 24 Nov 2015 17:01:11 +0000 (09:01 -0800)]
i965/fs: Add support for MOV_INDIRECT on pre-Broadwell hardware

While we're at it, we also add support for the possibility that the
indirect is, in fact, a constant.  This shouldn't happen in the common case
(if it does, that means NIR failed to constant-fold something), but it's
possible so we should handle it.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: Fix regs_read() for MOV_INDIRECT with a non-zero subnr
Jason Ekstrand [Tue, 24 Nov 2015 19:24:57 +0000 (11:24 -0800)]
i965/fs: Fix regs_read() for MOV_INDIRECT with a non-zero subnr

The subnr field is in bytes so we don't need to multiply by type_sz.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: Don't force MASK_DISABLE on INDIRECT_MOV instructions
Jason Ekstrand [Tue, 24 Nov 2015 17:03:29 +0000 (09:03 -0800)]
i965/fs: Don't force MASK_DISABLE on INDIRECT_MOV instructions

It should work fine without it and the visitor can set it if it wants.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: Add support for doing MOV_INDIRECT on uniforms
Jason Ekstrand [Tue, 24 Nov 2015 02:32:38 +0000 (18:32 -0800)]
i965/fs: Add support for doing MOV_INDIRECT on uniforms

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Make intel_get_param return an int
Ben Widawsky [Mon, 11 Apr 2016 16:49:41 +0000 (09:49 -0700)]
i965: Make intel_get_param return an int

This will fix the spurious error message: "Failed to query GPU properties."
that was unintentionally added in cc01b63d730.

This patch changes the function to return an int so that the caller is able to
do stuff based on the return value.

The equivalent of this patch was in the original series that fixed up the
warning, but I dropped it at the last moment. It is required to make the desired
behavior of not warning when trying to query GPU properties from the kernel
unless there is something the user can do about it.

v2: Use strerror (Jason)
Make EINVAL check similar in all places (Ian)

NOTE: Broadwell appears to actually have some issue where the kernel returns
ENODEV when it shouldn't be. I will investigate this separately.

Reported-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
8 years agost/mesa: fix sampler view leak in st_DrawAtlasBitmaps()
Brian Paul [Thu, 14 Apr 2016 21:07:53 +0000 (15:07 -0600)]
st/mesa: fix sampler view leak in st_DrawAtlasBitmaps()

I neglected to free the sampler view which was created earlier in the
function.  So for each glCallLists() command that used the bitmap atlas
to draw text, we'd leak a sampler view object.

Also, check for st_create_texture_sampler_view() failure and record
GL_OUT_OF_MEMORY.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agogallium/radeon: handle failure when mapping staging buffer
Nicolai Hähnle [Wed, 13 Apr 2016 15:55:29 +0000 (10:55 -0500)]
gallium/radeon: handle failure when mapping staging buffer

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: mark ssbo and images descriptor pointers dirty at beginning of CS
Nicolai Hähnle [Wed, 13 Apr 2016 17:17:28 +0000 (12:17 -0500)]
radeonsi: mark ssbo and images descriptor pointers dirty at beginning of CS

Without this, we were getting non-deterministic VM faults under high pressure.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoi965/vec4: Use UD rather than D for uniform indirects
Jason Ekstrand [Fri, 8 Apr 2016 17:49:02 +0000 (10:49 -0700)]
i965/vec4: Use UD rather than D for uniform indirects

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: Use UD type for offsets in VARYING_PULL_CONSTANT_LOAD
Jason Ekstrand [Wed, 25 Nov 2015 17:59:03 +0000 (09:59 -0800)]
i965/fs: Use UD type for offsets in VARYING_PULL_CONSTANT_LOAD

Reveiewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonvc0: do not break the universe on GK110+
Samuel Pitoiset [Thu, 14 Apr 2016 19:47:15 +0000 (21:47 +0200)]
nvc0: do not break the universe on GK110+

I removed that return 0 by mistake. Ooops.

Fixes: 6e23fd4 ("nvc0: allow to use compute support on GM200")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: allow to use compute support on GM200
Samuel Pitoiset [Wed, 13 Apr 2016 22:46:50 +0000 (00:46 +0200)]
nvc0: allow to use compute support on GM200

This works like a charm but please not that NVF0_COMPUTE have to be set
because compute support is still not enabled by default on GK110+. This
will require more testing to make sure it won't break the 3D state.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoscons: Build NIR.
Jose Fonseca [Wed, 13 Apr 2016 17:19:52 +0000 (18:19 +0100)]
scons: Build NIR.

Emil Velikov:
 - Attribute the src/{glsl,compiler}/nir move
 - Flesh out to separate SConscript

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agonir: Use _snprintf on Windows.
Jose Fonseca [Wed, 13 Apr 2016 17:19:51 +0000 (18:19 +0100)]
nir: Use _snprintf on Windows.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agonir: Avoid structure initalization expressions.
Jose Fonseca [Wed, 13 Apr 2016 17:19:50 +0000 (18:19 +0100)]
nir: Avoid structure initalization expressions.

Not supported by MSVC, and completely unnecessary -- inline functions
work just as well.

NIR_SRC_INIT/NIR_DEST_INIT could and probably should be replaced by the
inline functions.

Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agonir: Remove unistd.h include.
Jose Fonseca [Wed, 13 Apr 2016 17:19:49 +0000 (18:19 +0100)]
nir: Remove unistd.h include.

It doesn't seem needed, and is not available on MSVC.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agonir: Avoid empty {} struct initializer.
Jose Fonseca [Wed, 13 Apr 2016 17:19:48 +0000 (18:19 +0100)]
nir: Avoid empty {} struct initializer.

Not supported by MSVC and consistent through NIR.

[Emil Velikov: rebase]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agogallium/swr: fold the almost identical Makefiles
Emil Velikov [Wed, 13 Apr 2016 14:38:48 +0000 (15:38 +0100)]
gallium/swr: fold the almost identical Makefiles

Rather than having two almost identical Makefiles, with various VPATH
hacks just fold them, using COMMON_* variables and actually getting
things buildable/shipable.

v2: whitespace fixes, remove Makefile.sources-arch

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoinstall-gallium-links.mk: handle multiple libraries
Tim Rowley [Wed, 13 Apr 2016 20:06:45 +0000 (15:06 -0500)]
install-gallium-links.mk: handle multiple libraries

Need to prevent bash from interpreting whitespace between libraries
as a command line.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoradeonsi: don't overwrite the scratch offset in shader prologs
Marek Olšák [Wed, 13 Apr 2016 15:46:23 +0000 (17:46 +0200)]
radeonsi: don't overwrite the scratch offset in shader prologs

Prologs only look at num_input_sgprs.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
8 years agoradeonsi: fold num_user_sgprs where it is possible
Marek Olšák [Wed, 13 Apr 2016 12:15:16 +0000 (14:15 +0200)]
radeonsi: fold num_user_sgprs where it is possible

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
8 years agoradeonsi: fix SGPRS calculation once more
Marek Olšák [Wed, 13 Apr 2016 11:50:04 +0000 (13:50 +0200)]
radeonsi: fix SGPRS calculation once more

This fixes GS piglit failures after adding SI_PARAM_SHADER_BUFFERS,
which bumped NUM_USER_SGPRS and uncovered this bug on SI.

If this was fixed in LLVM, these workarounds wouldn't be needed.

LLVM would have to look at the calling convention to know how many SGPR
inputs are declared, and add VCC and the scratch wave offset (which is
enabled even if we spill SGPRs but not VGPRs, oh well).

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
8 years agoradeonsi: disable hw ETC2 on Polaris
Marek Olšák [Wed, 13 Apr 2016 14:31:35 +0000 (16:31 +0200)]
radeonsi: disable hw ETC2 on Polaris

not supported by hw directly, but it's still fully supported by the driver

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agodoxygen: remove git rebase fallouts
Emil Velikov [Thu, 14 Apr 2016 08:47:50 +0000 (09:47 +0100)]
doxygen: remove git rebase fallouts

Should never have been (git) added in the first place.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoappveyor: Run unit tests.
Jose Fonseca [Wed, 13 Apr 2016 12:58:57 +0000 (13:58 +0100)]
appveyor: Run unit tests.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agoscons: Add a "check" target to run all unit tests.
Jose Fonseca [Wed, 13 Apr 2016 12:31:04 +0000 (13:31 +0100)]
scons: Add a "check" target to run all unit tests.

Except:
- u_cache_test -- too long
- translate_test -- unreliable (it's probably testing corner cases that
  translate module doesn't care about.)

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agotest/unit: Make translate_test invoke translate_create by default.
Jose Fonseca [Wed, 13 Apr 2016 12:29:12 +0000 (13:29 +0100)]
test/unit: Make translate_test invoke translate_create by default.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agotest/unit: Make pipe_barrier_test actually check correct bahavior.
Jose Fonseca [Wed, 13 Apr 2016 12:28:36 +0000 (13:28 +0100)]
test/unit: Make pipe_barrier_test actually check correct bahavior.

So it can run unattended.

Also make it silent by default.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agoclover: Fix build against LLVM SVN >= r266163
Michel Dänzer [Wed, 13 Apr 2016 06:57:50 +0000 (15:57 +0900)]
clover: Fix build against LLVM SVN >= r266163

createInternalizePass now takes a callback instead of a StringSet.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agonir/dead_variables: Configurably work with any variable mode
Jason Ekstrand [Fri, 25 Mar 2016 21:26:11 +0000 (14:26 -0700)]
nir/dead_variables: Configurably work with any variable mode

The old version of the pass only worked on globals and locals and always
left inputs, outputs, uniforms, etc. alone.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Switch to NIR for ldexp lowering.
Kenneth Graunke [Tue, 12 Apr 2016 09:30:25 +0000 (02:30 -0700)]
i965: Switch to NIR for ldexp lowering.

The old GLSL IR based lowering doesn't quite work right in all cases,
and fails several dEQP-GLES31 and Vulkan CTS tests.  Jason's new
approach in NIR passes all the tests.  There's not likely to be a ton
of advantage to lowering early in GLSL IR anyway, so...switch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agonir/algebraic: Add lowering for ldexp
Jason Ekstrand [Fri, 25 Mar 2016 19:12:38 +0000 (12:12 -0700)]
nir/algebraic: Add lowering for ldexp

The algorithm used is different from both the naive suggestion from the
GLSL spec and the one used in GLSL IR today.  Unfortunately, the GLSL IR
implementation that we have today doesn't handle denormals (for those that
care) or the case where the float source is +-inf.

Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965: Implement the new imod and irem opcodes
Jason Ekstrand [Fri, 25 Mar 2016 18:17:53 +0000 (11:17 -0700)]
i965: Implement the new imod and irem opcodes

Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agonir: Add more modulus opcodes
Jason Ekstrand [Fri, 25 Mar 2016 18:13:40 +0000 (11:13 -0700)]
nir: Add more modulus opcodes

These are all needed for SPIR-V

Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965/vec4: Inline get_pull_constant_offset
Jason Ekstrand [Wed, 25 Nov 2015 17:12:37 +0000 (09:12 -0800)]
i965/vec4: Inline get_pull_constant_offset

It's not really doing enough anymore to justify a helper function.

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reveiewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agonir/lower_io: Allow for a full bitmask of modes
Jason Ekstrand [Mon, 11 Apr 2016 20:43:27 +0000 (13:43 -0700)]
nir/lower_io: Allow for a full bitmask of modes

Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agonir/lower_indirect: nir_variable_mode is now a bitfield
Jason Ekstrand [Mon, 11 Apr 2016 20:38:02 +0000 (13:38 -0700)]
nir/lower_indirect: nir_variable_mode is now a bitfield

Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agonir: Convert nir_variable_mode to a bitfield
Jason Ekstrand [Mon, 11 Apr 2016 20:32:59 +0000 (13:32 -0700)]
nir: Convert nir_variable_mode to a bitfield

There are several passes where we need to specify some set of variable
modes that the pass needs top operate on.  This lets us easily do that.

Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agogallium/swr: Make flat shading tris work.
George Kyriazis [Wed, 13 Apr 2016 15:48:55 +0000 (10:48 -0500)]
gallium/swr: Make flat shading tris work.

- Incorporate flatshade flag into the shader generation
- Use provoking vertex (vc) in shader when flat shading.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agoRevert "freedreno/a4xx: better occlusion/sample counting"
Rob Clark [Tue, 12 Apr 2016 20:06:17 +0000 (16:06 -0400)]
Revert "freedreno/a4xx: better occlusion/sample counting"

This reverts commit 62fa868728c729152af0d7cecd1d3e47e831cb7d.

dEQP-GLES3.functional.occlusion_query.* was unhappy about that change.
Still not really sure *what* the other slots in the sample results
buffer are.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/a4xx: rasterizer_discard support
Rob Clark [Tue, 12 Apr 2016 18:51:33 +0000 (14:51 -0400)]
freedreno/a4xx: rasterizer_discard support

This one is slightly annoying, since trying to write RBRC from draw
would clobber values set in the tiling/gmem code.  We could do command-
stream patching for RBRC, as is done on a3xx.  Although since it seems
to be a rarely used feature, it is easier just to do RMW to set/clear
the bit.

Fixes dEQP-GLES3.functional.rasterizer_discard.basic.write_depth_triangles
and related tests.

a3xx still needs the same feature, although there it probably makes more
sense to take advantage of the existing cmdstream patching which is
required for RBRC for other reasons.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: fix array textures on a4xx
Rob Clark [Tue, 12 Apr 2016 17:56:41 +0000 (13:56 -0400)]
freedreno/ir3: fix array textures on a4xx

Seems like a4xx needs offset added to array index for all arrays,
whereas a3xx only for cubemap arrays.  Fixes a whole swath of dEQP fails
(roughly *sampler2darray*).

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno: fix stream-out offset handling for lines/tris
Rob Clark [Tue, 12 Apr 2016 16:11:07 +0000 (12:11 -0400)]
freedreno: fix stream-out offset handling for lines/tris

We need to increment offset by # of vertices, not by # of prims.  Fixes
a bunch of dEQP fails involving prims other than points.  For example,
dEQP-GLES3.functional.transform_feedback.position.lines_separate

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno: fix handling for stream-out offsets
Rob Clark [Tue, 12 Apr 2016 15:30:31 +0000 (11:30 -0400)]
freedreno: fix handling for stream-out offsets

If changed && append, we shouldn't be resetting the internal offset back
to zero.  This fixes issues w/ sequences like:

   glBeginTransformFeedback()
   glDraw()
   glPauseTransformFeedback()
   glDraw()
   glResumeTransformFeedback()
   glDraw()
   glEndTransformFeedback()

Fixes dEQP-GLES3.functional.transform_feedback.array.separate.points.lowp_vec3
and related tests.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno: fix prims-emitted query
Rob Clark [Tue, 12 Apr 2016 00:53:13 +0000 (20:53 -0400)]
freedreno: fix prims-emitted query

This should only count when TF is not paused.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno: fix max-line-width
Rob Clark [Mon, 11 Apr 2016 21:46:08 +0000 (17:46 -0400)]
freedreno: fix max-line-width

dEQP noticed that we were advertising completely bogus values.  The
actual maximum is 127.0f.

*But* we have to use an artifically low maximum to work around a bug
in the dEQP test, which gets confused when the max line width is too
large and lines start going off-screen.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno: add flag to enable dEQP hacks
Rob Clark [Mon, 11 Apr 2016 21:55:37 +0000 (17:55 -0400)]
freedreno: add flag to enable dEQP hacks

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: hack to avoid getting stuck in a loop
Rob Clark [Mon, 11 Apr 2016 17:03:51 +0000 (13:03 -0400)]
freedreno/ir3: hack to avoid getting stuck in a loop

There are still some edge cases which result in a neighbor-loop.  Which
needs to be fixed, but this hack at least makes deqp tests finish.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: use (ss) instead of (sy) for ldlv
Rob Clark [Mon, 11 Apr 2016 16:57:31 +0000 (12:57 -0400)]
freedreno/ir3: use (ss) instead of (sy) for ldlv

Fixes a bunch of flat-varying fail on a4xx (where we need to use ldlv to
read the un-interpolated varying).

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: cleanup double cmps.s from frontend
Rob Clark [Thu, 7 Apr 2016 16:53:07 +0000 (12:53 -0400)]
freedreno/ir3: cleanup double cmps.s from frontend

Since we cannot mov into a predicate register, the frontend uses a
'cmps.s p0.x, cond, 0' as a stand-in for mov to p0.x.  It does this
since it has no way to know that the source cond instruction (ie.
for a kill, br, etc) will only be used to write the predicate reg.
Detect this, and re-write the instruction writing p0.x to skip the
original cmps.[sfu].  (It is done like this, rather than re-writing
the dest of the first cmps.[sfu] in case the first cmps.[sfu]
actually has other users.)

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agoglsl: Rename "vertex_input_slots" -> "is_vertex_input"
Matt Turner [Tue, 12 Apr 2016 22:26:06 +0000 (15:26 -0700)]
glsl: Rename "vertex_input_slots" -> "is_vertex_input"

vertex_input_slots would be an appropriate name for an integer, but not
a bool.

Also remove a cond ? true : false from a count_attribute_slots() call
site, noticed during the rename.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agogallivm: Workaround LLVM PR 27332.
Jose Fonseca [Wed, 13 Apr 2016 14:41:55 +0000 (15:41 +0100)]
gallivm: Workaround LLVM PR 27332.

The credit for finding and isolating this bug goes to Vinson and Roland.

The buggy LLVM versions were found by doing

  opt -instcombine llvm-pr27332.ll > /dev/null

where llvm-pr27332.ll is the IR from
https://llvm.org/bugs/show_bug.cgi?id=27332#c3

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agogallium/radeon: move a comment to the correct place
Marek Olšák [Wed, 13 Apr 2016 15:27:02 +0000 (17:27 +0200)]
gallium/radeon: move a comment to the correct place

trivial

8 years agoradeonsi: gate PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT by LLVM version
Nicolai Hähnle [Wed, 13 Apr 2016 14:11:44 +0000 (09:11 -0500)]
radeonsi: gate PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT by LLVM version

Otherwise we incorrectly claim ARB_ssbo support even with older LLVM versions.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94917
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agodoxygen: Generate Doxygen for NIR
Elie TOURNIER [Sat, 9 Apr 2016 13:48:13 +0000 (15:48 +0200)]
doxygen: Generate Doxygen for NIR

Now, one can do the following to generate and read the nir Doxygen:
cd $MESA_TOP/doxygen
make
firefox nir/index.html

Update v2:
Correct TAGFILES in nir.doxy

Signed-off-by: Elie TOURNIER <tournier.elie@gmail.com>
Reviewed-by: Rhys Kidd <rhyskidd@gmail.com>
[Emil Velikov] v3: Rebase.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agodoxygen: update glsl link
Elie TOURNIER [Thu, 7 Apr 2016 21:21:21 +0000 (23:21 +0200)]
doxygen: update glsl link

Signed-off-by: Elie TOURNIER <tournier.elie@gmail.com>
Reviewed-by: Rhys Kidd <rhyskidd@gmail.com>
Tested-by: Rhys Kidd <rhyskidd@gmail.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
8 years agodoxygen: Remove deprecated settings in common.doxy
Rhys Kidd [Sat, 9 Apr 2016 20:43:26 +0000 (16:43 -0400)]
doxygen: Remove deprecated settings in common.doxy

These Doxygen features are deprecated, as reported by Doxygen 1.8.9.1

Warning: Tag `USE_WINDOWS_ENCODING' at line 66 of file `common.doxy' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `DETAILS_AT_TOP' at line 157 of file `common.doxy' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `HTML_ALIGN_MEMBERS' at line 616 of file `common.doxy' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `XML_SCHEMA' at line 848 of file `common.doxy' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `XML_DTD' at line 854 of file `common.doxy' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `MAX_DOT_GRAPH_WIDTH' at line 1115 of file `common.doxy' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `MAX_DOT_GRAPH_HEIGHT' at line 1123 of file `common.doxy' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
8 years agodoxygen: Fix typo in doxygen/tnl.doxy
Rhys Kidd [Sat, 9 Apr 2016 20:43:25 +0000 (16:43 -0400)]
doxygen: Fix typo in doxygen/tnl.doxy

TAGFILE relative folder should match .tag file

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
8 years agodoxygen: Correct TAGFILE linkage of main
Rhys Kidd [Sat, 9 Apr 2016 20:43:24 +0000 (16:43 -0400)]
doxygen: Correct TAGFILE linkage of main

core.doxy was renamed to main.doxy, along with output folder in
the below 2004 commit.

Correct the other modules' TAGFILE linkage to find the main folder.

  commit 3ef972f538e1ff207f5919a8068bf14af18fb270
  Author: Brian Paul <brian.paul@tungstengraphics.com>
  Date:   Sun May 16 22:07:02 2004 +0000

      Replaced 'core' with 'main'.
      Other minor updates.

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
8 years agodoxygen: Update .gitignore
Rhys Kidd [Sat, 9 Apr 2016 20:43:23 +0000 (16:43 -0400)]
doxygen: Update .gitignore

The last of these output directories was removed in 2007.

  commit c2e0570831ae130fce1fa374bebe25bb9c561e29
  Author: Jerome Glisse <glisse@freedesktop.org>
  Date:   Fri Feb 16 23:18:56 2007 +0100

      Update doxygen doc to reflet vbo changes.

      Update doxygen doc, array_cache no longuer exist,
      new shiny vbo modules is there. Tested on unix,
      but i think i didn't broke that bat :).

  commit 3ef972f538e1ff207f5919a8068bf14af18fb270
  Author: Brian Paul <brian.paul@tungstengraphics.com>
  Date:   Sun May 16 22:07:02 2004 +0000

      Replaced 'core' with 'main'.
      Other minor updates.

  commit 69db632a9df035cdc852cc64fb14038919929a70
  Author: Jose Fonseca <j_r_fonseca@yahoo.co.uk>
  Date:   Thu May 1 23:32:54 2003 +0000

      Move the Doxygen configuration files into the usual places and integrate with the build system.

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
8 years agodoxygen: Remove references to miniglx
Rhys Kidd [Sat, 9 Apr 2016 20:43:22 +0000 (16:43 -0400)]
doxygen: Remove references to miniglx

miniglx was removed in February 2010. Clean up remaining
unnecessary doxygen references.

  commit a9e36696837b2c31ecee4017a0adffbd987c1eff
  Author: Kristian Høgsberg <krh@bitplanet.net>
  Date:   Thu Feb 25 16:17:04 2010 -0500

      Remove remaining miniglx references

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
8 years agodoxygen: Fix doxygen/gbm.doxy TAGFILES
Rhys Kidd [Sat, 9 Apr 2016 20:43:21 +0000 (16:43 -0400)]
doxygen: Fix doxygen/gbm.doxy TAGFILES

There has never been a doxygen/gbm_setup output folder.

Appears to have been a copy-paste error from original commit
in 245341f406bbdf23fec3d8ea8ad95c147c11ad1c.

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
8 years agodoxygen: Correct TAGFILE relative paths
Rhys Kidd [Sat, 9 Apr 2016 20:43:20 +0000 (16:43 -0400)]
doxygen: Correct TAGFILE relative paths

Per Doxygen documentation, to combine external documentation (stored in
a *.tag file) with a project the TAGFILES option should be set in the
configuration file.

  A tag file typically only contains a relative location of the
  documentation from the point where doxygen was run. So when
  you include a tag file in other project you have to specify
  where the external documentation is located in relation this
  project.

  You can do this in the configuration file by assigning the
  (relative) location to the tag files specified after the
  TAGFILES configuration option.

  If you use a relative path it should be relative with respect
  to the directory where the HTML output of your project is
  generated; so a relative path from the HTML output directory
  of a project to the HTML output of the other project that is
  linked to.

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
8 years agodoxygen: Fix doxygen/glapi.doxy
Rhys Kidd [Sat, 9 Apr 2016 20:43:19 +0000 (16:43 -0400)]
doxygen: Fix doxygen/glapi.doxy

The src/mesa/glapi folder was relocated in the below commit.
Amend the doxygen/glapi.doxy INPUT setting accordingly.

Whilst here, in addition this change also avoids a bug in the
consolidated Doxygen output caused by doxygen/glapi.doxy inadvertently
overwriting doxygen/swrast.tag via its GENERATE_TAGFILE setting.

This bug depended upon the specific order each *.tag was built.

   commit 296adbd545b8efd38c9ed508166b2de2764a444b
   Author: Chia-I Wu <olv@lunarg.com>
   Date:   Mon Apr 26 12:56:44 2010 +0800

       glapi: Move to src/mapi/.

       Move glapi to src/mapi/{glapi,es1api,es2api}.

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
8 years agodoxygen: Remove src/mesa/shader/ references
Rhys Kidd [Sat, 9 Apr 2016 20:43:18 +0000 (16:43 -0400)]
doxygen: Remove src/mesa/shader/ references

Mesa has not had a src/mesa/shader/ folder since Mesa 7.9 removed it
in October 2010, as part of a revised GLSL compiler written by Intel.

Remove doxygen/shader.doxy and consequential changes made throughout.

In addition to removing an unnecessary Doxygen doxyfile, this change also
avoids a bug in the consolidated Doxygen output caused by
doxygen/shader.doxy inadvertently overwriting doxygen/swrast.tag via its
GENERATE_TAGFILE setting.

This bug depended upon the specific order each *.tag was built.

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
8 years agogallium/radeon: add an env variable to force a level of aniso filtering
Marek Olšák [Mon, 11 Apr 2016 15:54:51 +0000 (17:54 +0200)]
gallium/radeon: add an env variable to force a level of aniso filtering

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agollvmpipe: Test rounding of x.5.
Jose Fonseca [Wed, 13 Apr 2016 10:07:45 +0000 (11:07 +0100)]
llvmpipe: Test rounding of x.5.

Leverage nearbyintif function, which should be available on all C99
implementations.

Trivial.

8 years agogallivm: use llvm.nearbyint instead of llvm.round.
Roland Scheidegger [Wed, 13 Apr 2016 03:00:03 +0000 (05:00 +0200)]
gallivm: use llvm.nearbyint instead of llvm.round.

We used to use sse roundps intrinsic directly, but switched to use the llvm
intrinsics for rounding with e4f01da15d8c6ce3e8c77ff3ff3d2ce2574a3f7b.
However, llvm semantics follows standard math lib round function which is
specced to do roundNearestAwayFromZero but we really want roundNearestEven
(moreoever, using round generates atrocious code since the cpu can't do it
directly and it results in scalar calls to libm __roundf).
So, use llvm.nearbyint instead, which does exactly the right thing, and even
has the advantage of being available with llvm 3.3 too. (I've verified it
actually generates a roundps instruction with llvm 3.3.)

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=94909

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agonv50/ra: `isinf()` is in namespace `std` since C++11.
Pierre Moreau [Fri, 18 Mar 2016 00:17:31 +0000 (01:17 +0100)]
nv50/ra: `isinf()` is in namespace `std` since C++11.

This fixes a compile error while building Nouveau with C++11 enabled (and
glibc >= 2.23). This happens if SWR is enabled, as it forces C++11.

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Signed-off-by: Jose Fonseca <jfonseca@vmware.com>
https://bugs.freedesktop.org/show_bug.cgi?id=94907

8 years agoscons: Allow building with Address Sanitizer.
Jose Fonseca [Sat, 9 Apr 2016 19:26:42 +0000 (20:26 +0100)]
scons: Allow building with Address Sanitizer.

libasan is never linked to shared objects (which doesn't go well with
-z,defs).  It must either be linked to the main executable, or (more
practically for OpenGL drivers) be pre-loaded via LD_PRELOAD.

Otherwise works.

I didn't find anything with llvmpipe.  I suspect the fact that the
JIT compiled code isn't instrumented means there are lots of errors it
can't catch.

But for non-JIT drivers, the Address/Leak Sanitizers seem like a faster
alternative to Valgrind.

Usage (Ubuntu 15.10):

   scons asan=1 libgl-xlib
   export LD_LIBRARY_PATH=$PWD/build/linux-x86_64-debug/gallium/targets/libgl-xlib
   LD_PRELOAD=libasan.so.2 any-opengl-application

Acked-by: Roland Scheidegger <sroland@vmware.com>
8 years agomesa: Change an error code in glSamplerParameterI[iu]v().
Kenneth Graunke [Tue, 12 Apr 2016 22:23:47 +0000 (15:23 -0700)]
mesa: Change an error code in glSamplerParameterI[iu]v().

This is supposed to be INVALID_OPERATION in ES.  We already did this
for the fv/iv variants, but not Iiv/Iuv, which are new in ES 3.2 (or
extensions).

Fixes:
ES31-CTS.texture_border_clamp.samplerparameteri_non_gen_sampler_error

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>