Francisco Jerez [Mon, 23 May 2016 21:07:23 +0000 (14:07 -0700)]
i965/fs: Mark UBO uniform pull constant loads as force_writemask_all.
This lets the rest of the backend know that the uniform pull constant
load opcodes don't respect channel enables -- Without this the
register allocator has no way to know that the return payload of a
pull constant load is not per-channel and spills of the destination
will be broken under non-uniform control flow.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Francisco Jerez [Wed, 27 Apr 2016 09:07:08 +0000 (02:07 -0700)]
i965/fs: Allow spilling of non-contiguous registers.
This should be working fine now.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94997
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Francisco Jerez [Mon, 16 May 2016 08:03:43 +0000 (01:03 -0700)]
i965/fs: Calculate the (un)spill block size correctly.
Currently the spilling code attempts to guess the scratch message
block size from the dispatch width of the shader, which is plain wrong
for SIMD-lowered instructions (frequently but not exclusively
encountered in SIMD32 shaders) or for instructions with register
region data types of size other than 32 bit.
Instead try to use the SIMD component size of the instruction which in
some cases will allow the dataport to apply the correct channel mask
to the scratch data read or written. In the spill case the block size
needs to be clamped to the number of MRF registers reserved for
spilling. In the unspill case I didn't even bother because we
currently have no 100% accurate way to determine whether a source
region is per-channel or whether it contains things like headers that
don't respect channel boundaries -- That's fine, because the unspill
is marked force_writemask_all we can just use the largest allowable
scratch message size.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Francisco Jerez [Mon, 16 May 2016 08:23:44 +0000 (01:23 -0700)]
i965/fs: Set exec_all on spills not matching the channel layout of the instruction.
This prevents the application of an incorrect channel mask by the
scratch write instruction for spilled variables that don't have an
exact one-to-one correspondence between channels of the variable and
32-bit components of the scratch write instruction.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Francisco Jerez [Mon, 16 May 2016 07:59:37 +0000 (00:59 -0700)]
i965/fs: Set exec_all on unspills.
This makes sure that unspills restore the exact contents of the
variable in scratch space into the GRF without applying channel
masking, which is incorrect under control flow for things like message
headers or vectors of heterogeneous types that don't properly respect
channel boundaries.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Francisco Jerez [Mon, 16 May 2016 05:59:04 +0000 (22:59 -0700)]
i965/fs: Move scratch block size calculation into the caller of emit_(un)spill.
This makes emit_(un)spill even more stupid by removing the logic that
decides what execution size each scratch read or write send message
should have and instead relying on the caller to specify an
appropriate execution size via the builder argument. This makes sense
because the caller will need to act differently based on the scratch
message width (e.g. emit an additional unspill before the instruction
if the execution width and channel layout of the spill doesn't match
the instruction's).
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Francisco Jerez [Mon, 16 May 2016 03:30:06 +0000 (20:30 -0700)]
i965/fs: Make emit_spill/unspill static functions taking builder as argument.
This seems cleaner than exposing an implementation detail of
brw_fs_reg_allocate.cpp to the world, and will give the caller control
over the instruction execution flags (e.g. force_writemask_all) that
are applied to the scratch read and write instructions.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Francisco Jerez [Sun, 15 May 2016 23:52:49 +0000 (16:52 -0700)]
i965/fs: Apply execution controls from the instruction to scratch messages.
Until now the execution controls (e.g. channel group,
force_writemask_all, exec_size) of the instruction had been completely
ignored by spilling, even though that can lead to a mismatch between
the channel mask applied to the contents of the (un)spilled memory and
the GRF source or destination of the instruction. In some cases we'll
actually want the (un)spill messages to be marked force_writemask_all
regardless of whether the instruction has it set, but that will have
to be handled specially by the caller.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Francisco Jerez [Thu, 12 May 2016 07:39:06 +0000 (00:39 -0700)]
i965/fs: Fix signedness of local variables and arguments of emit_(un)spill.
To avoid some some spurious warnings about comparison signedness in
the following commits.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Francisco Jerez [Wed, 27 Apr 2016 09:16:22 +0000 (02:16 -0700)]
i965/fs: Factor out calculation of the block of MRFs reserved for spilling.
And as we're at it fix the calculation to allocate a larger block of
registers for 32-wide dispatch.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Plamena Manolova [Thu, 12 May 2016 17:21:38 +0000 (18:21 +0100)]
egl: Add OpenGL_ES to API string regardless of GLES version
According to the EGL specifications eglQueryString(EGL_CLIENT_APIS)
should return a string containing a combination of "OpenGL", "OpenGL_ES"
and "OpenVG", any other values would be considered invalid. Due to this
when the API string is constructed, the version of GLES should be
disregarded and "OpenGL_ES" should be attached once instead of
"OpenGL_ES2" and "OpenGL_ES3".
Fixes:
dEQP-EGL.functional.negative_api* and
dEQP-EGL.functional.query_context.simple.query_api
Signed-off-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Rob Clark [Mon, 23 May 2016 19:53:23 +0000 (15:53 -0400)]
freedreno/ir3: disable cp for indirect src's
The variable-indexing tests always had a few random fails, which I
usually couldn't reproduce when running tests manually. Somehow
recently this got a lot worse. I ported a couple of the shaders to
GLES to see what blob does, and it also seems to be avoiding to cp
indirect srcs. So I guess indirect w/ instructions other than cat1
(mov) are not totally reliable. Let's just switch that off until
this is better understood.
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Samuel Pitoiset [Sun, 22 May 2016 18:27:23 +0000 (20:27 +0200)]
nvc0: do not invalidate compute constbufs on Kepler
Constbufs are only aliased on Fermi and this will reduce the number of
flushes when we switch between 3d and compute.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Rob Clark [Wed, 18 May 2016 15:40:34 +0000 (11:40 -0400)]
nir/validate: fix null deref coverity warning
CID 1265536 (#1 of 2): Explicit null dereferenced (FORWARD_NULL)6.
var_deref_op: Dereferencing null pointer parent.
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Nicolas Boichat [Thu, 28 Apr 2016 10:41:39 +0000 (18:41 +0800)]
mesa: dri: Add shared glapi to LIBADD on Android
/system/vendor/lib/dri/*_dri.so actually depend on libglapi: without
this, loading the so file fails with:
cannot locate symbol "__emutls_v._glapi_tls_Context"
On non-Android (non-bionic) platform, EGL uses the following
workflow, which works fine:
dlopen("libglapi.so", RTLD_LAZY | RTLD_GLOBAL);
dlopen("dri/<driver>_dri.so", RTLD_NOW | RTLD_GLOBAL);
However, bionic does not respect the RTLD_GLOBAL flag, and the dri
library cannot find symbols in libglapi.so, so we need to link
to libglapi.so explicitly. Android.mk already does this.
Signed-off-by: Nicolas Boichat <drinkcat@google.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
[Emil Velikov: s/explicitely/explicitly/]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Nicolas Boichat [Thu, 28 Apr 2016 10:41:38 +0000 (18:41 +0800)]
configure.ac: Add support for Android builds
Add support for EGL android platform.
Also, detect when --host finishes with -android. In that case, we
do not set _GNU_SOURCE, and define autoconf symbol HAVE_ANDROID, so
that Android-specific workarounds can be applied.
Signed-off-by: Nicolas Boichat <drinkcat@google.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
[Emil Velikov: Rebase on top of HAVE_EGL_PLATFORM_NULL removal]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Emil Velikov [Sun, 1 May 2016 12:48:12 +0000 (13:48 +0100)]
anv: remove define _DEFAULT_SOURCE
The build systems already add this as applicable. There's no need to
have this in the source file.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Sun, 1 May 2016 12:48:11 +0000 (13:48 +0100)]
gbm: remove define _DEFAULT_SOURCE
The build systems already add this as applicable. There's no need to
have this in the source file.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Sun, 1 May 2016 12:48:10 +0000 (13:48 +0100)]
gbm: remove define _BSD_SOURCE
The build systems already add this as applicable. There's no need to
have this in the source file.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Jiri Slaby [Tue, 17 May 2016 06:35:29 +0000 (08:35 +0200)]
glxcmds: glXGetFBConfigs, fix screen bounds
Bounds of screen are 0 (inclusive) and ScreenCount(dpy) (exclusive).
The upper bound was too ScreenCount(dpy) (inclusive).
This causes a crash invoked by java3d which passes down an invalid
screen:
6 0x00007f0e5198ba70 in <signal handler called> () at /lib64/libc.so.6
7 0x00007f0e14531e14 in glXGetFBConfigs (dpy=<optimized out>, screen=1, nelements=nelements@entry=0x7f0dab3c522c) at glxcmds.c:1660
8 0x00007f0e14532f7f in glXChooseFBConfig (dpy=<optimized out>, screen=<optimized out>, attribList=0x7f0dab3c54e0, nitems=0x7f0dab3c535c) at glxcmds.c:1611
9 0x00007f0e1478d29b in find_S_FBConfigs () at /usr/lib64/libj3dcore-ogl.so
10 0x00007f0e1478d3dc in find_S_S_FBConfigs () at /usr/lib64/libj3dcore-ogl.so
11 0x00007f0e1478d567 in find_AA_S_S_FBConfigs () at /usr/lib64/libj3dcore-ogl.so
12 0x00007f0e1478d728 in find_DB_AA_S_S_FBConfigs () at /usr/lib64/libj3dcore-ogl.so
13 0x00007f0e1478d97c in Java_javax_media_j3d_X11NativeConfigTemplate3D_chooseOglVisual () at /usr/lib64/libj3dcore-ogl.so
While ScreenCount(dpy) is actually 1:
(gdb) p dpy->nscreens
$2 = 1
screen=1 is passed to glXGetFBConfigs.
Fix this typo in glXGetFBConfigs.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95456
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Elie TOURNIER [Tue, 10 May 2016 20:04:49 +0000 (22:04 +0200)]
doxygen: Add missing modules to Windows runner
Acked-by: Rhys Kidd <rhyskidd@gmail.com>
Emil Velikov [Thu, 19 May 2016 17:43:03 +0000 (18:43 +0100)]
egl: add missing link against $(CLOCK_LIB)
Some platforms require separate library in order to resolve the
clock_gettime() symbol. Add the link or the build will fail.
Fixes:
70299474f58 ("egl: add EGL_KHR_reusable_sync to egl_dri")
Cc: Dongwon Kim <dongwon.kim@intel.com>
Reported-by: Pali Rohár <pali.rohar@gmail.com>
Tested-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Sun, 1 May 2016 11:42:55 +0000 (12:42 +0100)]
egl: android: remove explicit glFlush call
The DRI flush extension should already do the same thing.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Rob Herring <robh@kernel.org>
Emil Velikov [Sun, 1 May 2016 11:42:54 +0000 (12:42 +0100)]
egl: android: drop dri2_create_image_android_native_buffer argument
The drv is no longer used/needed as of last commit.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Emil Velikov [Sun, 1 May 2016 11:42:53 +0000 (12:42 +0100)]
egl: android: directly use dri2_create_image_dma_buf()
Make the function non static so that we can use it directly from the
android platform code.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Emil Velikov [Wed, 4 May 2016 10:47:14 +0000 (11:47 +0100)]
configure.ac: error out when building from git without python3
Bail early, as opposed to later on during the build.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Emil Velikov [Sat, 14 May 2016 15:33:12 +0000 (16:33 +0100)]
vl/drm: don't call close(-1) in vl_drm_screen_create error path
Analogous to previous commits.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Emil Velikov [Sat, 14 May 2016 15:33:11 +0000 (16:33 +0100)]
st/xa: don't call close(-1) in xa_tracker_create error path
Analogous to previous commit.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Emil Velikov [Sat, 14 May 2016 15:33:10 +0000 (16:33 +0100)]
st/dri: don't call close(-1) in dri{2, kms_}_init_screen error path
Add separate labels and jump to the correct one as needed.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Eric Engestrom [Thu, 21 Apr 2016 09:53:48 +0000 (10:53 +0100)]
vk/intel: use negative VK_NO_PROTOTYPES scheme
3d0fac7aca237bbe8ed8e2a362d3b42d0ef8c46c changed all
VK_PROTOTYPES to VK_NO_PROTOTYPES
This brings the Intel header in line with the rest of the Vulkan code.
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
Rob Herring [Wed, 4 May 2016 02:02:47 +0000 (21:02 -0500)]
gbm: Add map/unmap functions
This adds map and unmap functions to GBM utilizing the DRIimage extension
mapImage/unmapImage functions or existing internal mapping for dumb
buffers. Unlike prior attempts, this version provides a region to map and
usage flags for the mapping. The operation follows the same semantics as
the gallium transfer_map() function.
This was tested with GBM based gralloc on Android.
Signed-off-by: Rob Herring <robh@kernel.org>
[Emil Velikov: drop no longer relevant hunk from commit message.]
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Rob Herring [Wed, 4 May 2016 02:02:46 +0000 (21:02 -0500)]
configure.ac: add pthreadstubs support
Add pthreadstubs to avoid pulling in full pthreads library. GBM will be the
first user.
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Rob Herring [Tue, 17 May 2016 02:14:21 +0000 (21:14 -0500)]
gbm: rename gbm_dri_bo_{map,unmap} to gbm_dri_bo_{map,unmap}_dumb
In preparation to add public map/unmap functions, rename the existing
gbm_dri_bo_{map,unmap} functions to indicate that they are only for dumb
buffers.
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Rob Herring [Wed, 4 May 2016 02:02:44 +0000 (21:02 -0500)]
st/dri: Add support for DRIimage extension mapImage/unmapImage
Implement support for mapImage/unmapImage functions in version 12 of the
DRIimage extension.
Signed-off-by: Rob Herring <robh@kernel.org>
[Emil Velikov: align/indent the map/unmap vfuncs]
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Rob Herring [Wed, 4 May 2016 02:02:43 +0000 (21:02 -0500)]
DRI: Add DRIimage map and unmap functions
Add mapImage and unmapImage functions to DRIimage extension for mapping
and unmapping DRIimages for CPU access. The caller provides the region of
the image to map and is returned a pointer to the beginning of the region
and the stride (which could be different from the original).
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Rob Herring [Wed, 4 May 2016 02:02:42 +0000 (21:02 -0500)]
gbm: Add Android build support
In order to use libgbm for gralloc, add it to the Android build.
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Rob Herring [Wed, 4 May 2016 02:02:41 +0000 (21:02 -0500)]
gbm: add Android gallium_dri.so library loading support
GBM needs the same special gallium_dri.so loading as EGL for Android, so
copy over the same hunk from the EGL code.
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Rob Herring [Wed, 4 May 2016 02:02:40 +0000 (21:02 -0500)]
gbm: split out source file to Makefile.sources
In preparation to add Android build support, split out the source file
lists to Makefile.sources
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
[Emil Velikov: Whitespace cleanup.]
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Rob Herring [Wed, 4 May 2016 02:02:39 +0000 (21:02 -0500)]
Android: Move setting DEFAULT_DRIVER_DIR to shared location
Move the defining of DEFAULT_DRIVER_DIR path to a common location so both
EGL and GBM can use it.
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Emil Velikov [Sun, 24 Apr 2016 15:14:04 +0000 (16:14 +0100)]
c11/threads: create mutexattrs only when needed
If the mutexattrs are the default one can just pass NULL to
pthread_mutex_init. As the compiler does not know this detail it
unnecessarily creates/destroys the attrs.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Andres Gomez [Fri, 20 May 2016 13:54:35 +0000 (16:54 +0300)]
configure: added xcb to dri3 modules to pkg-conf
This fixes a recent linking error in libvulkan_common
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Juan A. Suarez Romero [Mon, 23 May 2016 08:46:42 +0000 (10:46 +0200)]
glsl/linker: dvec3/dvec4 consume twice input vertex attributes
From the GL 4.5 core spec, section 11.1.1 (Vertex Attributes):
"A program with more than the value of MAX_VERTEX_ATTRIBS
active attribute variables may fail to link, unless
device-dependent optimizations are able to make the program
fit within available hardware resources. For the purposes
of this test, attribute variables of the type dvec3, dvec4,
dmat2x3, dmat2x4, dmat3, dmat3x4, dmat4x3, and dmat4 may
count as consuming twice as many attributes as equivalent
single-precision types. While these types use the same number
of generic attributes as their single-precision equivalents,
implementations are permitted to consume two single-precision
vectors of internal storage for each three- or four-component
double-precision vector."
This commits makes dvec3, dvec4, dmat2x3, dmat2x4, dmat3, dmat3x4,
dmat4x3 and dmat4 consume twice as many attributes as equivalent
single-precision types.
v3: count doubles as consuming two attributes (Dave Airlie)
v4: make reference to spec (Michael Schellenberger Costa)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Antia Puentes <apuentes@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Francisco Jerez [Thu, 19 May 2016 10:50:01 +0000 (12:50 +0200)]
i965/fs: do not depend on std140 alignment rules for UBO loads
The previous implementation relied on the std140 alignment rules to
avoid handling misalignment in the case where we are loading more than
2 double components from a vector, which requires to emit a second load
message.
This alternative implementation deals with misalignment and is more
flexible going forward.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Iago Toral Quiroga [Fri, 20 May 2016 07:38:20 +0000 (09:38 +0200)]
nir: handle double-precision in fsign, fsat, fnot and frcp
I think these are not strictly necessary since the floats in them
should be automatically promoted to doubles when operated with
double sources, but it makes things more explicit at least.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Iago Toral Quiroga [Fri, 20 May 2016 07:12:28 +0000 (09:12 +0200)]
nir: handle double-precision in fabs, frsq and fsqrt
Reviewed-by: Matt Turner <mattst88@gmail.com>
Dave Airlie [Mon, 23 May 2016 05:55:06 +0000 (15:55 +1000)]
glsl/parser: handle multiple layout sections with AST nodes.
For geometry/compute inputs and tess control outputs, we create
an AST node to keep track of some things. However if we have
multiple layout sections, we don't ever link the node into the AST.
This is because we create the node on the rightmost layout declaration
and don't pass it back in so it gets linked at the end of the parsing
of the rightmost.
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Mon, 23 May 2016 04:29:09 +0000 (14:29 +1000)]
glsl: allow layout qualifier overrides with ARB_shading_language_420pack
GLSL 4.20 allows overriding the layout qualifiers.
This helps fix:
GL45-CTS.shading_language_420pack.qualifier_override_layout
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Tue, 17 May 2016 04:44:47 +0000 (14:44 +1000)]
subroutines: handle explicit indexes properly
The code didn't deal with explicit function indexes properly.
It also handed out the indexes at link time, when we really
need them in the lowering pass to create the correct if ladder.
So this patch moves assigning the non-explicit indexes earlier,
fixes the lowering pass and the lookups to get the correct values.
This fixes a few of:
GL45-CTS.explicit_uniform_location.subroutine-index-*
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Tue, 17 May 2016 06:25:02 +0000 (16:25 +1000)]
mesa/subroutines: fix reset on bindpipeline
Fixes:
GL45-CTS.shader_subroutine.subroutine_uniform_reset
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Tue, 17 May 2016 04:22:57 +0000 (14:22 +1000)]
mesa/subroutines: count number subroutines properly.
The code was implementing the ACTIVE_SUBROUTINE_UNIFORMS
incorrectly, using the number of types not the number of
uniforms. This is different than the locations as the
locations may be sparsly allocated.
This fixes:
GL43-CTS.shader_subroutine.four_subroutines_with_two_uniforms
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Tue, 17 May 2016 04:20:00 +0000 (14:20 +1000)]
mesa/subroutines: don't generate error in GetSubroutineIndex.
GLSL spec says this doesn't generate an error.
Fixes:
GL45-CTS.explicit_uniform_location.subroutine-loc
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Tue, 17 May 2016 03:47:59 +0000 (13:47 +1000)]
glsl/ast: for geom shaders allow stream flags in input flags.
This fixes:
GL45-CTS.shader_subroutine.subroutines_with_separate_shader_objects
Since we set the stream flags earlier on all geom shaders, we
shouldn't fall over later if we find one.
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Wed, 18 May 2016 07:06:41 +0000 (17:06 +1000)]
glsl/linker: skip inactive explicit locations.
This fixes a crash in:
GL45-CTS.explicit_uniform_location.subroutine-loc-negative-link-max-num-of-locations
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Tue, 17 May 2016 03:07:40 +0000 (13:07 +1000)]
glsl: fix subroutine uniform .length().
This fixes .length() on subroutine uniform arrays, if
we don't find the identifier normally, we look up the corresponding
subroutine identifier instead.
Fixes:
GL45-CTS.shader_subroutine.arrays_of_arrays_of_uniforms
GL45-CTS.shader_subroutine.arrayed_subroutine_uniforms
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Tue, 17 May 2016 04:52:38 +0000 (14:52 +1000)]
glsl/linker: link error on too many subroutine functions.
This fixes:
GL45-CTS.explicit_uniform_location.subroutine-index-negative-link-max-num-of-indices
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Fri, 6 May 2016 01:37:06 +0000 (11:37 +1000)]
glsl: produce a linker error for a subroutine uniform with no functions.
If a subroutine uniform is declared with no functions backing it,
that isn't legal, so we should fail to link.
Fixes:
GL43-CTS.shader_subroutine.subroutine_uniform_wo_matching_subroutines
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Fri, 6 May 2016 01:28:40 +0000 (11:28 +1000)]
glsl: validate subroutine types match function signature.
This fixes:
GL43-CTS.shader_subroutine.subroutines_incompatible_with_subroutine_type
It just makes sure the signatures match as well as the return
types.
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Tue, 28 Jul 2015 06:11:06 +0000 (07:11 +0100)]
arb_shader_subroutine: check active subroutine limit
_mesa_GetActiveSubroutineUniformiv needs to check
against the number of types here.
Noticed while playing with ogl conform.
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Ilia Mirkin [Sun, 22 May 2016 22:21:55 +0000 (18:21 -0400)]
nv30: don't assert when running out of registers
This happens with dEQP tests. The code doesn't at all protect against
this condition, so while unhandled, this is an expected situation.
Also avoid using more than the first 16 registers for nv3x vertex
programs.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Ilia Mirkin [Sun, 22 May 2016 20:35:28 +0000 (16:35 -0400)]
nouveau: allow allocating non-object-backed buffers
On nv30, for example, there is no hardware index buffer support. So all
of those will be created entirely in user memory.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Tobias Klausmann [Sun, 8 May 2016 20:44:10 +0000 (22:44 +0200)]
llvm/softpipe: Enable cull_distance as draw supports it.
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Fri, 13 May 2016 05:47:34 +0000 (15:47 +1000)]
tgsi: remove culldist semantic.
This isn't used anymore in the tree, culldist's
are part of the clipdist semantic, we could in theory
rename it, but I'm not sure there is much point, and
I'd have to be careful with virgl.
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Fri, 13 May 2016 05:42:19 +0000 (15:42 +1000)]
draw: stop using CULLDIST semantic.
The way the HW works doesn't really fit with having
two semantics for this.
The GLSL compiler emits 2 vec4s and two properties,
this makes draw use those instead of CULLDIST semantics.
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Emil Velikov [Mon, 16 May 2016 15:16:23 +0000 (16:16 +0100)]
virgl: remove unused state_tracker/graw.h include
Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Sun, 22 May 2016 21:20:50 +0000 (07:20 +1000)]
mesa/queryobject: return INVALID_VALUE if offset < 0 (v2)
This fixes:
GL45-CTS.direct_state_access.queries_errors
The ARB_direct_state_access spec agrees.
v2: move check down further (Ilia)
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Samuel Pitoiset [Sun, 22 May 2016 20:39:31 +0000 (22:39 +0200)]
nvc0/ir: fix indirect access for images
When the array doesn't start at 0 we need to account for su->tex.r.
While we are at it, make sure to avoid out of bounds access by masking
the index.
This fixes GL45-CTS.shading_language_420pack.binding_image_array.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reported-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Ilia Mirkin [Sun, 22 May 2016 18:34:28 +0000 (14:34 -0400)]
nv30: reset the stencil mask when fast-clearing
Apparently the stencil mask applies to clears on nv30/nv40. Reset it to
0xff before doing a stencil clear. This fixes gl-1.0-readpixsanity and
a number of other piglit tests.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Ilia Mirkin [Sun, 22 May 2016 18:05:36 +0000 (14:05 -0400)]
nv30,nv50: add PIPE_SHADER_CAP_PREFERRED_IR support
The mesa state tracker has recently started to query this.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Ilia Mirkin [Sat, 21 May 2016 20:16:50 +0000 (16:16 -0400)]
nvc0: fix setting of tess_mode in various situations
This fixes a lot of INVALID_VALUE errors reported by the card when
running dEQP tests.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Ilia Mirkin [Sat, 21 May 2016 20:14:50 +0000 (16:14 -0400)]
nv50/ir: fix prog info init
Left over from the pre-mainline tess support. Adapt to use the new
defines.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Ilia Mirkin [Sat, 21 May 2016 19:41:03 +0000 (15:41 -0400)]
nvc0/ir: return 0 for gl_TessCoord.z for non-triangles modes
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Matt Turner [Sun, 22 May 2016 14:00:34 +0000 (07:00 -0700)]
mesa: Unlock mutex on error path.
Caught by Coverity (CID 1362021). Caused by commit
015f2207c.
Timothy Arceri [Sat, 21 May 2016 02:06:58 +0000 (12:06 +1000)]
i965: remove redundant NULL check
We would have segfaulted in the above code if prog could be NULL.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Eduardo Lima Mitev [Sat, 21 May 2016 07:24:03 +0000 (09:24 +0200)]
anv/nir_apply_pipeline_layout: Pass the nir_src from the nir_tex_src
nir_instr_rewrite_src() expects a nir_src and it is currently being fed a
nir_tex_src. This will crash something.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Samuel Pitoiset [Tue, 26 Apr 2016 21:23:19 +0000 (23:23 +0200)]
nvc0: expose GLSL version 420 on GF100
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Samuel Pitoiset [Tue, 26 Apr 2016 21:23:12 +0000 (23:23 +0200)]
nvc0: enable ARB_shader_image_load_store on GF100
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Samuel Pitoiset [Sun, 8 May 2016 17:13:15 +0000 (19:13 +0200)]
nvc0/ir: add a lowering pass for surfaces on Fermi
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Samuel Pitoiset [Wed, 27 Apr 2016 17:14:59 +0000 (19:14 +0200)]
nvc0/ir: add emission for SULDB and SUSTx
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Samuel Pitoiset [Wed, 27 Apr 2016 17:14:35 +0000 (19:14 +0200)]
nvc0/ir: add emission for OP_SULEA
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Samuel Pitoiset [Wed, 27 Apr 2016 16:27:10 +0000 (18:27 +0200)]
nv50/ir: fix tex constraints for surface coords on Fermi
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Ilia Mirkin [Sun, 31 Jan 2016 03:08:06 +0000 (22:08 -0500)]
nv50/ir: use moveSources to condense sources
This makes sure that rIndirectSrc and other things stay updated.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Samuel Pitoiset [Wed, 27 Apr 2016 16:25:33 +0000 (18:25 +0200)]
nvc0: bind images on fragment and compute shaders for Fermi
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Samuel Pitoiset [Sat, 21 May 2016 14:28:09 +0000 (16:28 +0200)]
nvc0/ir: don't check the format for surface stores on Kepler
Initially to make sure the format doesn't mismatch and won't produce
out-of-bounds access, we checked that both formats have exactly the same
number of bytes, but this should not be checked for type stores.
This fixes serious rendering issues in the UE4 demos (tested with
realistic and reflections).
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Samuel Pitoiset [Sat, 21 May 2016 14:13:48 +0000 (16:13 +0200)]
nv50/ir: fix a comment in canDualIssue()
Trivial.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Samuel Pitoiset [Thu, 19 May 2016 22:52:26 +0000 (00:52 +0200)]
nv50/ir: fix SUSTx constraints on Kepler
To prevent out-of-bounds access and format mismatch we add a predicate
on sustp, but we have to account for it when the sources are condensed
because a predicate is a source. Using the range 3:6 will only condense
the input data and it's always the case. This also fixes constraints
when an indirect access is used.
This ensures that sources are correctly aligned.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Kenneth Graunke [Mon, 9 May 2016 05:48:02 +0000 (22:48 -0700)]
i965: Just read the existing tally on EndTransformFeedback if paused.
If the transform feedback object is paused when ending, then there are
no new snapshots to add to the tally. In fact, we haven't written a
starting snapshot, so we'd best not try and compute (end - start).
Just load the existing tally so we can convert it to the number of
vertices written and store it to the final result location.
This is the Haswell+ equivalent of the previous commit.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Kenneth Graunke [Mon, 9 May 2016 05:48:02 +0000 (22:48 -0700)]
i965: Don't write a counter snapshot on EndTransformFeedback if paused.
If the transform feedback object is paused, then we've already written
an ending counter snapshot. We don't want to write another one.
This fixes assertions in GL33-CTS.transform_feedback.api_errors_test,
which calls EndTransformfeedback after PauseTransformFeedback. On the
next BeginTransformFeedback, we tried to tally up the results, and saw
an odd number of snapshots (due to the double-end), and tripped an
assertion.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Kenneth Graunke [Mon, 9 May 2016 05:45:01 +0000 (22:45 -0700)]
mesa: Call TransformFeedback driver hooks before setting flags.
This way, the driver's EndTransformFeedback() hook can tell whether the
transform feedback operation was paused. It's also convenient to have
Paused remain false until the driver's PauseTransformFeedback hook
finishes.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Kenneth Graunke [Fri, 20 May 2016 23:29:44 +0000 (16:29 -0700)]
nir: Fix crash in nir_lower_wpos_center().
Otherwise we rewrote the fadd to use itself, causing crashes in
validation. Instead, start after the last use like we should.
A brown paper bag fix. Fixes crashes in several Vulkan tests.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Dave Airlie [Fri, 20 May 2016 20:48:05 +0000 (06:48 +1000)]
nir: remove dead glsl variables before lowering io.
For cull distance GLSL will let unsized unused arrays get
into the backend, we should nuke those straight away, to
save caring about them later.
This fixes:
arb_separate_shader_objects/linker/large-number-of-unused-varyings
as a side effect (even without culling changes).
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Kenneth Graunke [Wed, 18 May 2016 18:06:08 +0000 (11:06 -0700)]
spirv: Handle the PixelCenterInteger execution mode.
This isn't allowed by Vulkan, but might be useful someday for
SPIR-V in OpenGL (if that ever becomes a thing). It's easy enough
to hook up, and as precedent, we already do so for OriginLowerLeft.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Kenneth Graunke [Wed, 18 May 2016 17:35:54 +0000 (10:35 -0700)]
i965: Delete dead dFdy flipping code.
Rob's nir_lower_wpos_ytransform() pass flips dFdy in the opposite case
of what I expected, so we always take the negate_value case. It doesn't
really matter.
v2: Write src0 before src1 in ADD instructions (requested by Matt).
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Kenneth Graunke [Tue, 17 May 2016 10:40:11 +0000 (03:40 -0700)]
i965: Delete brw_wm_prog_key::render_to_fbo and drawable_height.
Now that we handle flipping and other gl_FragCoord transformations
via a uniform, these key fields have no users.
This patch actually eliminates the associated recompiles. The Tomb
Raider benchmark's minimum FPS increases from ~1 FPS to a reasonable
number.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Kenneth Graunke [Tue, 17 May 2016 08:52:16 +0000 (01:52 -0700)]
i965, anv: Use NIR FragCoord re-center and y-transform passes.
This handles gl_FragCoord transformations and other window system vs.
user FBO coordinate system flipping by multiplying/adding uniform
values, rather than recompiles.
This is much better because we have no decent way to guess whether
the application is going to use a shader with the window system FBO
or a user FBO, much less the drawable height. This led to a lot of
recompiles in many applications.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Kenneth Graunke [Wed, 18 May 2016 18:38:32 +0000 (11:38 -0700)]
nir: Add a simple nir_lower_wpos_center() pass for Vulkan drivers.
nir_lower_wpos_ytransform() is great for OpenGL, which allows
applications to choose whether their coordinate system's origin is
upper left/lower left, and whether the pixel center should be on
integer/half-integer boundaries.
Vulkan, however, has much simpler requirements: the pixel center
is always half-integer, and the origin is always upper left. No
coordinate transform is needed - we just need to add <0.5, 0.5>.
This means that we can avoid using (and setting up) a uniform.
I thought about adding more options to nir_lower_wpos_ytransform(),
but making a new pass that never even touched uniforms seemed simpler.
v2: Use normal iterator rather than _safe variant (noticed by Matt).
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Rob Clark <robdclark@gmail.com>
Kenneth Graunke [Wed, 18 May 2016 19:14:02 +0000 (12:14 -0700)]
nir: Don't use ffma in nir_lower_wpos_ytransform().
ffma is an explicitly fused multiply add with higher precision.
The optimizer will take care of promoting mul/add to fma when
it's beneficial to do so.
This fixes failures on Gen4-5 when using this pass, as those platforms
don't actually implement fma().
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Kenneth Graunke [Wed, 18 May 2016 17:32:33 +0000 (10:32 -0700)]
nir: Handle fddy_fine and fddy_coarse in nir_lower_wpos_ytransform.
These also need flipping!
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Kenneth Graunke [Wed, 18 May 2016 18:19:00 +0000 (11:19 -0700)]
nir: Make lower_wpos_ytransform_block a void function.
The return value was used for the old nir_foreach_block callback system,
but at this point it no longer means anything.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Kenneth Graunke [Wed, 18 May 2016 16:31:49 +0000 (09:31 -0700)]
nir: Make nir_lower_wpos_ytransform() match FragCoord by location.
gl_FragCoord is a shader input with location == VARYING_SLOT_POS.
ARB_fragment_programs have an equivalent input at VARYING_SLOT_POS,
but it isn't called gl_FragCoord. We do want to transform it.
Matching by location guarantees we catch both.
Fixes several fp tests on a branch which uses this pass on i965.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Kenneth Graunke [Tue, 17 May 2016 10:30:58 +0000 (03:30 -0700)]
nir: Add interp_var_at_offset flipping.
The Y-offset needs flipping as well, similar to ddy.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Rob Clark <robdclark@gmail.com>