mesa.git
9 years agogallium: add PIPE_CAP_DEVICE_RESET_STATUS_QUERY
Marek Olšák [Wed, 29 Apr 2015 13:44:55 +0000 (15:44 +0200)]
gallium: add PIPE_CAP_DEVICE_RESET_STATUS_QUERY

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agogallium: add an interface for querying a device reset status
Marek Olšák [Wed, 29 Apr 2015 13:04:34 +0000 (15:04 +0200)]
gallium: add an interface for querying a device reset status

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoclover: Implement locking of the wait_count, _chain and _status members of event.
Francisco Jerez [Sat, 9 May 2015 13:01:23 +0000 (16:01 +0300)]
clover: Implement locking of the wait_count, _chain and _status members of event.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
CC: 10.5 <mesa-stable@lists.freedesktop.org>
9 years agoclover: Wrap event::_status in a method to prevent unlocked access.
Francisco Jerez [Sat, 9 May 2015 13:22:33 +0000 (16:22 +0300)]
clover: Wrap event::_status in a method to prevent unlocked access.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
CC: 10.5 <mesa-stable@lists.freedesktop.org>
9 years agoclover: Refactor event::trigger and ::abort to prevent deadlock and reentrancy issues.
Francisco Jerez [Sat, 9 May 2015 11:47:38 +0000 (14:47 +0300)]
clover: Refactor event::trigger and ::abort to prevent deadlock and reentrancy issues.

Refactor ::trigger and ::abort to split out the operations that access
concurrently modified data members and require locking from the
recursive and possibly re-entrant part of these methods.  This will
avoid some deadlock situations when locking is implemented.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
CC: 10.5 <mesa-stable@lists.freedesktop.org>
9 years agonir: Translate memory barrier intrinsics from GLSL IR.
Francisco Jerez [Tue, 5 May 2015 20:10:56 +0000 (23:10 +0300)]
nir: Translate memory barrier intrinsics from GLSL IR.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: Translate image load, store and atomic intrinsics from GLSL IR.
Francisco Jerez [Tue, 5 May 2015 20:04:46 +0000 (23:04 +0300)]
nir: Translate image load, store and atomic intrinsics from GLSL IR.

v2: Undefine coordinate components not applicable to the target.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: Fix indexing of atomic counter arrays with a constant value.
Francisco Jerez [Tue, 5 May 2015 20:02:05 +0000 (23:02 +0300)]
nir: Fix indexing of atomic counter arrays with a constant value.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: Add memory barrier intrinsic.
Francisco Jerez [Tue, 5 May 2015 20:00:51 +0000 (23:00 +0300)]
nir: Add memory barrier intrinsic.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: Define image load, store and atomic intrinsics.
Francisco Jerez [Tue, 5 May 2015 19:58:39 +0000 (22:58 +0300)]
nir: Define image load, store and atomic intrinsics.

v2: Undefine coordinate components not applicable to the target.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs: Have component() set the register stride to zero.
Francisco Jerez [Thu, 30 Apr 2015 16:29:54 +0000 (19:29 +0300)]
i965/fs: Have component() set the register stride to zero.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs: Fix offset() for registers with zero stride.
Francisco Jerez [Wed, 22 Apr 2015 11:46:17 +0000 (14:46 +0300)]
i965/fs: Fix offset() for registers with zero stride.

stride == 0 implies that the register has one channel per vector
component.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Don't forget the force_sechalf flag in lower_load_payload().
Francisco Jerez [Thu, 7 May 2015 16:33:57 +0000 (19:33 +0300)]
i965: Don't forget the force_sechalf flag in lower_load_payload().

Regression from commit 41868bb6824c6106a55c8442006c1e2215abf567.
Fixes a bunch of ARB_shader_image_load_store tests.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
9 years agoi965: Document brw_mask_reg().
Francisco Jerez [Wed, 6 May 2015 14:37:12 +0000 (17:37 +0300)]
i965: Document brw_mask_reg().

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir: fix sampler lowering pass for arrays
Tapani Pälli [Mon, 11 May 2015 11:50:19 +0000 (14:50 +0300)]
nir: fix sampler lowering pass for arrays

This fixes bugs with special cases where we have arrays of
structures containing samplers or arrays of samplers.

I've verified that patch results in calculating same index value as
returned by _mesa_get_sampler_uniform_value for IR. Patch makes
following ES3 conformance test pass:

ES3-CTS.shaders.struct.uniform.sampler_array_fragment

v2: remove unnecessary comment (Topi)
    simplify changes and the overall code (Jason)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90114

9 years agoi965: Use predicate enable bit for conditional rendering w/o stalling
Neil Roberts [Tue, 4 Nov 2014 19:15:00 +0000 (19:15 +0000)]
i965: Use predicate enable bit for conditional rendering w/o stalling

Previously whenever a primitive is drawn the driver would call
_mesa_check_conditional_render which blocks waiting for the result of
the query to determine whether to render. On Gen7+ there is a bit in
the 3DPRIMITIVE command which can be used to disable the primitive
based on the value of a state bit. This state bit can be set based on
whether two registers have different values using the MI_PREDICATE
command. We can load these two registers with the pixel count values
stored in the query begin and end to implement conditional rendering
without stalling.

Unfortunately these two source registers were not in the whitelist of
available registers in the kernel driver until v3.19. This patch uses
the command parser version from intel_screen to detect whether to
attempt to set the predicate data registers.

The predicate enable bit is currently only used for drawing 3D
primitives. For blits, clears, bitmaps, copypixels and drawpixels it
still causes a stall. For most of these it would probably just work to
call the new brw_check_conditional_render function instead of
_mesa_check_conditional_render because they already work in terms of
rendering primitives. However it's a bit trickier for blits because it
can use the BLT ring or the blorp codepath. I think these operations
are less useful for conditional rendering than rendering primitives so
it might be best to leave it for a later patch.

v2: Use the command parser version to detect whether we can write to
    the predicate data registers instead of trying to execute a
    register load command.
v3: Simple rebase
v4: Changes suggested by Kenneth Graunke: Split the
    load_64bit_register function out to a separate patch so it can be
    a shared public function. Avoid calling
    _mesa_check_conditional_render if we've already determined that
    there's no query object. Some styling fixes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi956: Add a function to load a 64-bit register from a buffer
Neil Roberts [Mon, 11 May 2015 13:00:42 +0000 (14:00 +0100)]
i956: Add a function to load a 64-bit register from a buffer

Adds brw_load_register_mem64 which is similar to brw_load_register_mem
except that it queues two GEN7_MI_LOAD_REGISTER_MEM commands in order
to load both halves of a 64-bit register. The function is implemented
by splitting the 32-bit version into an internal helper function which
takes a size.

This will later be used to set the 64-bit predicate source registers.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Store the command parser version number in intel_screen
Neil Roberts [Fri, 7 Nov 2014 18:20:17 +0000 (18:20 +0000)]
i965: Store the command parser version number in intel_screen

In order to detect whether the predicate source registers can be used
in a later patch we will need to know the version number for the
command parser. This patch just adds a member to intel_screen and does
an ioctl to get the version.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agodocs/GL3: (trivial) mark some tf extensions as done for softpipe/llvmpipe
Roland Scheidegger [Tue, 12 May 2015 02:48:48 +0000 (04:48 +0200)]
docs/GL3: (trivial) mark some tf extensions as done for softpipe/llvmpipe

Those extensions were enabled for ages already.

9 years agodocs: add news item and link release notes for mesa 10.5.5
Emil Velikov [Mon, 11 May 2015 21:07:46 +0000 (22:07 +0100)]
docs: add news item and link release notes for mesa 10.5.5

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodocs: Add sha256 sums for the 10.5.5 release
Emil Velikov [Mon, 11 May 2015 21:02:03 +0000 (22:02 +0100)]
docs: Add sha256 sums for the 10.5.5 release

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 8ee1a1c08b168d7583b806a2f8a2dc2ae28be62a)

9 years agoAdd release notes for the 10.5.5 release
Emil Velikov [Mon, 11 May 2015 19:19:33 +0000 (20:19 +0100)]
Add release notes for the 10.5.5 release

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit d88fb4050561a62fa824bec59ffedf2a826c2083)

9 years agost/mesa: make sure to create a "clean" bool when doing i2b
Ilia Mirkin [Thu, 7 May 2015 03:29:33 +0000 (23:29 -0400)]
st/mesa: make sure to create a "clean" bool when doing i2b

i2b has to work for all integers, not just 1. INEG would not necessarily
result with all bits set, which is something that other operations can
rely on by e.g. using AND (or INEG for b2i).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Cc: mesa-stable@lists.freedesktop.org
9 years agoclover: Fix a bug with multi-threaded events v2
Tom Stellard [Thu, 26 Mar 2015 19:33:24 +0000 (19:33 +0000)]
clover: Fix a bug with multi-threaded events v2

It was possible for some events never to get triggered if one thread
was creating events and another threads was waiting for them.

This patch consolidates soft_event::wait() and hard_event::wait()
into event::wait() so that hard_event objects will now wait for
all their dependencies to be submitted before flushing the command
queue.

v2:
  - Rename variables
  - Use mutable varibales so we can keep event::wait() const
  - Open code signalled() call so mutex can be atted to signalled
    without deadlocking.

CC: 10.5 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoclover: Add a mutex to guard queue::queued_events
Tom Stellard [Thu, 7 May 2015 13:57:14 +0000 (13:57 +0000)]
clover: Add a mutex to guard queue::queued_events

This fixes a potential crash where on a sequence like this:

Thread 0: Check if queue is not empty.
Thread 1: Remove item from queue, making it empty.
Thread 0: Do something assuming queue is not empty.

CC: 10.5 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoi965/fs: Add missing initializer in fs_visitor().
Matt Turner [Mon, 11 May 2015 17:46:59 +0000 (10:46 -0700)]
i965/fs: Add missing initializer in fs_visitor().

9 years agoegl: Remove skeleton implementation of EGL_MESA_screen_surface
Adam Jackson [Wed, 1 Apr 2015 14:39:45 +0000 (10:39 -0400)]
egl: Remove skeleton implementation of EGL_MESA_screen_surface

No backend wires this up to anything, and the extension spec has been
marked obsolete for 4+ years.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
9 years agoegl/swrast: Enable config extension for swrast
Axel Davy [Fri, 1 May 2015 17:08:37 +0000 (19:08 +0200)]
egl/swrast: Enable config extension for swrast

Enables to use dri config for swrast, like vblank_mode.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
9 years agoegl/wayland: Implement swrast support
Axel Davy [Fri, 1 May 2015 09:11:20 +0000 (11:11 +0200)]
egl/wayland: Implement swrast support

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>.
Signed-off-by: Axel Davy <axel.davy@ens.fr>
9 years agoegl/wayland: Simplify dri2_wl_create_surface
Axel Davy [Fri, 1 May 2015 09:16:41 +0000 (11:16 +0200)]
egl/wayland: Simplify dri2_wl_create_surface

This function is always used with EGL_WINDOW_BIT. Pixmaps are forbidden
for Wayland, and PBuffers are unimplemented.

Reviewed-by: Daniel Stone <daniels@collabora.com>.
Signed-off-by: Axel Davy <axel.davy@ens.fr>
9 years agoegl/x11: move dri2_x11_swrast_create_image_khr to egl_dri2_fallback.h
Axel Davy [Fri, 1 May 2015 09:12:46 +0000 (11:12 +0200)]
egl/x11: move dri2_x11_swrast_create_image_khr to egl_dri2_fallback.h

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
9 years agoegl/wayland: Implement DRI_PRIME support
Axel Davy [Thu, 30 Apr 2015 23:16:24 +0000 (01:16 +0200)]
egl/wayland: Implement DRI_PRIME support

When the server gpu and requested gpu are different:
. They likely don't support the same tiling modes
. They likely do not have fast access to the same locations

Thus we do:
. render to a tiled buffer we do not share with the server
. Copy the content at every swap to a buffer with no tiling
that we share with the server.

This is similar to the glx dri3 DRI_PRIME implementation.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
9 years agoegl/wayland: Add support for render-nodes
Axel Davy [Thu, 30 Apr 2015 23:30:10 +0000 (01:30 +0200)]
egl/wayland: Add support for render-nodes

It is possible the server advertises a render-node.
In that case no authentication is needed,
and Gem names are forbidden.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
v2: do not check for __DRI_IMAGE_DRIVER, but instead
do not advertise __DRI_DRI2_LOADER when on a render-node.

9 years agoglx/dri3: Add additional check for gpu offloading case
Axel Davy [Thu, 30 Apr 2015 22:20:34 +0000 (00:20 +0200)]
glx/dri3: Add additional check for gpu offloading case

Checks blitImage is implemented.
Initially having the __DRIimageExtension extension
at version 9 at least meant blitImage was supported.
However some implementation do advertise version >= 9
without implementing it.

CC: 10.5 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
9 years agodoc/egl: Remove depreciated EGL_SOFTWARE
Axel Davy [Thu, 30 Apr 2015 22:06:31 +0000 (00:06 +0200)]
doc/egl: Remove depreciated EGL_SOFTWARE

EGL_SOFTWARE is not supported anywhere in the code,
whereas LIBGL_ALWAYS_SOFTWARE is.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
9 years agoegl/wayland: properly destroy wayland objects
Axel Davy [Thu, 30 Apr 2015 22:03:32 +0000 (00:03 +0200)]
egl/wayland: properly destroy wayland objects

the wl_registry and the wl_queue allocated weren't destroyed.

CC: 10.5 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
9 years agoi965/fs: Disable opt_sampler_eot for textureGather
Neil Roberts [Fri, 8 May 2015 16:35:18 +0000 (17:35 +0100)]
i965/fs: Disable opt_sampler_eot for textureGather

The opt_sampler_eot optimisation seems to break when the last
instruction is SHADER_OPCODE_TG4. A bunch of Piglit tests end up doing
this so it causes a lot of regressions. I can't find any documentation
or known workarounds to indicate that this is expected behaviour, but
considering that this is probably a pretty unlikely situation in a
real use case we might as well disable it in order to avoid the
regressions. In total this fixes 451 tests.

Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agomesa: use _mesa_has_compute_shaders instead of extension check
Tapani Pälli [Thu, 7 May 2015 05:07:30 +0000 (08:07 +0300)]
mesa: use _mesa_has_compute_shaders instead of extension check

This was really the original purpose, for enabling the path for
ES3.1 tests without the extension being set. Set also fallthrough
comment for Coverity (caught by Matt).

v2: .. and test the right way, not wrong one (Ilia Mirkin)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agomain: glGetIntegeri_v fails for GL_VERTEX_BINDING_STRIDE
Marta Lofstedt [Thu, 7 May 2015 15:13:47 +0000 (17:13 +0200)]
main: glGetIntegeri_v fails for GL_VERTEX_BINDING_STRIDE

The return type for GL_VERTEX_BINDING_STRIDE is missing,
this cause glGetIntegeri_v to fail.

Signed-off-by: Marta Lofstedt <marta.lofstedt@linux.intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
9 years agor600: use pipe->hw prim convert from radeonsi
Dave Airlie [Sun, 10 May 2015 20:24:03 +0000 (06:24 +1000)]
r600: use pipe->hw prim convert from radeonsi

This avoids future addition to PIPE_PRIM_ from causing regressions
on r600g.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agofreedreno/ir3/nir: fix build break after f752effa
Rob Clark [Sun, 10 May 2015 10:03:49 +0000 (06:03 -0400)]
freedreno/ir3/nir: fix build break after f752effa

Our lower if/else pass was missed when converting NIR to use linked
lists rather than hashsets to track use/def sets.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agonv50/ir: only enable mul saturate on G200+
Ilia Mirkin [Sat, 9 May 2015 07:26:07 +0000 (03:26 -0400)]
nv50/ir: only enable mul saturate on G200+

Commit 44673512a84 enabled support for saturating fmul. However
experimentally this does not seem to work on the older chips. Restrict
the feature to G200 (NVA0) and later.

Reported-by: Pierre Moreau <pierre.morrow@free.fr>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90350
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Tested-by: Pierre Moreau <pierre.morrow@free.fr>
Reviewed-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Cc: mesa-stable@lists.freedesktop.org
9 years agonvc0: reset the instanced elements state when doing blit using 3d engine
Ilia Mirkin [Sat, 9 May 2015 17:25:51 +0000 (13:25 -0400)]
nvc0: reset the instanced elements state when doing blit using 3d engine

Since we update num_vtxelts here, we could otherwise end up with stale
instancing information in the upper bits which wouldn't otherwise get
reset. (Also we run the risk of the previous draw having set the first
element as instanced.)

This appears as one of the causes for the test pointed out in fdo#90363
to fail on nvc0.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90363
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
9 years agonvc0: keep track of PGRAPH state in nvc0_screen
Ilia Mirkin [Fri, 8 May 2015 04:26:24 +0000 (00:26 -0400)]
nvc0: keep track of PGRAPH state in nvc0_screen

See identical commit for nv50. Destroying the current context and then
creating a new one or switching to another existing context would cause
the "current" state to not be properly initialized, so we save it off in
the screen.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
9 years agonv50: keep track of PGRAPH state in nv50_screen
Ilia Mirkin [Fri, 8 May 2015 04:15:22 +0000 (00:15 -0400)]
nv50: keep track of PGRAPH state in nv50_screen

Normally this is kept in nv50_context, and on switching the active
context, the state is copied from the previous context. However when the
last context is destroyed, this is lost, and a new context might later
be created. When the currently-active context is destroyed, save its
state in the screen, and restore it when setting the current context.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90363
Reported-by: Matteo Bruni <matteo.mystral@gmail.com>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Tested-by: Matteo Bruni <matteo.mystral@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
9 years agonir: Fix aggressive typos in nir_from_ssa.c.
Kenneth Graunke [Sat, 9 May 2015 02:36:19 +0000 (19:36 -0700)]
nir: Fix aggressive typos in nir_from_ssa.c.

s/agressive/aggressive/g

Trivial.

9 years agonir/search: Save/restore the variables_seen bitmask when matching
Jason Ekstrand [Fri, 8 May 2015 16:48:33 +0000 (09:48 -0700)]
nir/search: Save/restore the variables_seen bitmask when matching

Shader-db results on Broadwell:

   total instructions in shared programs: 7152330 -> 7137006 (-0.21%)
   instructions in affected programs:     1330548 -> 1315224 (-1.15%)
   helped:                                5797
   HURT:                                  76
   GAINED:                                0
   LOST:                                  8

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir/search: Assert that variable id's are in range
Jason Ekstrand [Fri, 8 May 2015 16:42:05 +0000 (09:42 -0700)]
nir/search: Assert that variable id's are in range

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir/search: handle explicitly sized sources in match_value
Jason Ekstrand [Fri, 8 May 2015 15:33:01 +0000 (08:33 -0700)]
nir/search: handle explicitly sized sources in match_value

Previously, this case was being handled in match_expression prior to
calling match_value.  However, there is really no good reason for this
given that match_value has all of the information it needs.  Also, they
weren't being handled properly in the commutative case and putting it in
match_value gives us that for free.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir/nir: Use a linked list instead of a hash set for use/def sets
Jason Ekstrand [Fri, 24 Apr 2015 17:16:27 +0000 (10:16 -0700)]
nir/nir: Use a linked list instead of a hash set for use/def sets

This commit switches us from the current setup of using hash sets for
use/def sets to using linked lists.  Doing so should save us quite a bit of
memory because we aren't carrying around 3 hash sets per register and 2 per
SSA value.  It should also save us CPU time because adding/removing things
from use/def sets is 4 pointer manipulations instead of a hash lookup.

Running shader-db 50 times with USE_NIR=0, NIR, and NIR + use/def lists:

   GLSL IR Only:        586.4 +/- 1.653833
   NIR with hash sets:  675.4 +/- 2.502108
   NIR + use/def lists: 641.2 +/- 1.557043

I also ran a memory usage experiment with Ken's patch to delete GLSL IR and
keep NIR.  This patch cuts an aditional 42.9 MiB of ralloc'd memory over
and above what we gained by deleting the GLSL IR on the same dota trace.

On the code complexity side of things, some things are now much easier and
others are a bit harder.  One of the operations we perform constantly in
optimization passes is to replace one source with another.  Due to the fact
that an instruction can use the same SSA value multiple times, we had to
iterate through the sources of the instruction and determine if the use we
were replacing was the only one before removing it from the set of uses.
With this patch, uses are per-source not per-instruction so we can just
remove it safely.  On the other hand, trying to iterate over all of the
instructions that use a given value is more difficult.  Fortunately, the
two places we do that are the ffma peephole where it doesn't matter and GCM
where we already gracefully handle duplicates visits to an instruction.

Another aspect here is that using linked lists in this way can be tricky to
get right.  With sets, things were quite forgiving and the worst that
happened if you didn't properly remove a use was that it would get caught
in the validator.  With linked lists, it can lead to linked list corruption
which can be harder to track.  However, we do just as much validation of
the linked lists as we did of the sets so the validator should still catch
these problems.  While working on this series, the vast majority of the
bugs I had to fix were caught by assertions.  I don't think the lists are
going to be that much worse than the sets.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agoutil/list: Add a list validation function
Jason Ekstrand [Tue, 28 Apr 2015 03:40:11 +0000 (20:40 -0700)]
util/list: Add a list validation function

Acked-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
9 years agoutil/list: Add list_empty and list_length functions
Jason Ekstrand [Tue, 28 Apr 2015 03:39:37 +0000 (20:39 -0700)]
util/list: Add list_empty and list_length functions

v2: Don't use C99 when iterating over the list

Acked-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
9 years agoutil/list: Add C99-based iterator macros
Jason Ekstrand [Tue, 28 Apr 2015 01:56:02 +0000 (18:56 -0700)]
util/list: Add C99-based iterator macros

v2: Use LIST_ENTRY instead of container_of in iterators

Acked-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
9 years agoutil: Move gallium's linked list to util
Jason Ekstrand [Tue, 28 Apr 2015 00:41:27 +0000 (17:41 -0700)]
util: Move gallium's linked list to util

The linked list in gallium is pretty much the kernel list and we would like
to have a C-based linked list for all of mesa.  Let's not duplicate and
just steal the gallium one.

Acked-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
9 years agogallium/double_list: s/INLINE/inline and remove the p_compiler include
Jason Ekstrand [Mon, 27 Apr 2015 23:58:29 +0000 (16:58 -0700)]
gallium/double_list: s/INLINE/inline and remove the p_compiler include

Acked-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
9 years agonir: Use nir_instr_rewrite_src in copy propagation
Jason Ekstrand [Tue, 21 Apr 2015 19:12:26 +0000 (12:12 -0700)]
nir: Use nir_instr_rewrite_src in copy propagation

We were rolling our own rewrite_src variant in copy-propagation.  Let's
stop doing that and use the ones in core NIR.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir: Add a function for rewriting the condition of an if statement
Jason Ekstrand [Fri, 24 Apr 2015 17:34:30 +0000 (10:34 -0700)]
nir: Add a function for rewriting the condition of an if statement

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir: Add and use initializer #defines for nir_src and nir_dest
Jason Ekstrand [Wed, 22 Apr 2015 01:00:21 +0000 (18:00 -0700)]
nir: Add and use initializer #defines for nir_src and nir_dest

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir: Modernize the out-of-SSA pass
Jason Ekstrand [Tue, 21 Apr 2015 18:16:04 +0000 (11:16 -0700)]
nir: Modernize the out-of-SSA pass

The out-of-SSA pass was one of the first passes written when getting SSA
up-and-going (for obvious reasons).  As such, it came before a lot of the
nifty SSA-based helpers were introduced.  This commit modernizes it so that
we're no longer doing nearly as much manual banging on use/def sets.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir/validate: Validate SSA def parent instructions
Jason Ekstrand [Fri, 24 Apr 2015 00:10:42 +0000 (17:10 -0700)]
nir/validate: Validate SSA def parent instructions

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonv50/ir: only propagate saturate up if some actual folding took place
Ilia Mirkin [Fri, 8 May 2015 22:54:08 +0000 (18:54 -0400)]
nv50/ir: only propagate saturate up if some actual folding took place

The former logic would copy the saturate up to any mul with an immediate
if there was a subsequent mul with a saturate. However we only want to
do that if we collapsed 2 muls by multiplying their immediates (or were
able to put the immediate in as a post-multiplier).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
9 years agonir: Delete all traces of nir_op_flog
Ian Romanick [Thu, 7 May 2015 00:04:15 +0000 (17:04 -0700)]
nir: Delete all traces of nir_op_flog

Nothing produces it, and nothing can consume it.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Don't produce nir_op_flog from GLSL IR
Ian Romanick [Thu, 7 May 2015 00:01:37 +0000 (17:01 -0700)]
nir: Don't produce nir_op_flog from GLSL IR

All paths that produce GLSL IR for NIR lower ir_unop_log.  All paths
that consume NIR will explode if they geta nir_op_flog.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Delete all traces of nir_op_fexp
Ian Romanick [Thu, 7 May 2015 00:00:18 +0000 (17:00 -0700)]
nir: Delete all traces of nir_op_fexp

Nothing produces it, and nothing can consume it.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Don't produce nir_op_fexp from GLSL IR
Ian Romanick [Wed, 6 May 2015 23:57:22 +0000 (16:57 -0700)]
nir: Don't produce nir_op_fexp from GLSL IR

All paths that produce GLSL IR for NIR lower ir_unop_exp.  All paths
that consume NIR will explode if they geta nir_op_fexp.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoprog_to_nir: OPCODE_EXP is not nir_op_fexp
Ian Romanick [Wed, 6 May 2015 23:54:06 +0000 (16:54 -0700)]
prog_to_nir: OPCODE_EXP is not nir_op_fexp

It's a weird thing that provides some values related to 2**x.  It's also
already handled by a case in the switch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoi965/fs: Improve a comment about stripping trailing zeroes
Neil Roberts [Fri, 8 May 2015 15:13:52 +0000 (16:13 +0100)]
i965/fs: Improve a comment about stripping trailing zeroes

Originally I wrote that removing the first parameter doesn't work but
I didn't know why. I now found a mention of this in the PRM so it's
probably worthing adding it to the comment.

9 years agodocs: Update the ARB_direct_state_access status
Fredrik Höglund [Wed, 18 Mar 2015 19:50:06 +0000 (20:50 +0100)]
docs: Update the ARB_direct_state_access status

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement GetVertexArrayIndexed[64]iv
Fredrik Höglund [Mon, 2 Mar 2015 18:07:52 +0000 (19:07 +0100)]
mesa: Implement GetVertexArrayIndexed[64]iv

v2: Fix the name of the entry point in the error messages.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Add support for querying GL_VERTEX_ATTRIB_ARRAY_LONG
Fredrik Höglund [Mon, 2 Mar 2015 18:04:16 +0000 (19:04 +0100)]
mesa: Add support for querying GL_VERTEX_ATTRIB_ARRAY_LONG

This parameter was added in OpenGL 4.3 and GL_ARB_direct_state_access.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Add a vao parameter to get_vertex_array_attrib
Fredrik Höglund [Mon, 2 Mar 2015 17:58:36 +0000 (18:58 +0100)]
mesa: Add a vao parameter to get_vertex_array_attrib

This is needed to implement glGetVertexArrayIndexediv and
glGetVertexArrayIndexed64iv.

v2: Make the vao parameter const.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement GetVertexArrayiv
Fredrik Höglund [Mon, 2 Mar 2015 17:56:31 +0000 (18:56 +0100)]
mesa: Implement GetVertexArrayiv

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement VertexArrayBindingDivisor
Fredrik Höglund [Mon, 2 Mar 2015 17:52:36 +0000 (18:52 +0100)]
mesa: Implement VertexArrayBindingDivisor

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Add a vao parameter to vertex_binding_divisor
Fredrik Höglund [Mon, 2 Mar 2015 17:50:49 +0000 (18:50 +0100)]
mesa: Add a vao parameter to vertex_binding_divisor

This is needed to implement VertexArrayBindingDivisor.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement VertexArrayAttribBinding
Fredrik Höglund [Mon, 2 Mar 2015 17:49:06 +0000 (18:49 +0100)]
mesa: Implement VertexArrayAttribBinding

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Add a vao parameter to vertex_attrib_binding
Fredrik Höglund [Mon, 2 Mar 2015 17:46:42 +0000 (18:46 +0100)]
mesa: Add a vao parameter to vertex_attrib_binding

This is needed to implement VertexArrayAttribBinding.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement VertexArrayAttrib[I|L]Format
Fredrik Höglund [Mon, 2 Mar 2015 17:44:00 +0000 (18:44 +0100)]
mesa: Implement VertexArrayAttrib[I|L]Format

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Add a vao parameter to update_array_format
Fredrik Höglund [Mon, 2 Mar 2015 17:41:09 +0000 (18:41 +0100)]
mesa: Add a vao parameter to update_array_format

This is needed to implement VertexArrayAttrib*Format.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Refactor VertexAttrib[I|L]Format
Fredrik Höglund [Mon, 2 Mar 2015 17:39:50 +0000 (18:39 +0100)]
mesa: Refactor VertexAttrib[I|L]Format

The only difference between these functions is the legal types and
sizes, so consolidate the code into a single vertex_attrib_format()
function and call it from all three entry points.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement VertexArrayVertexBuffers
Fredrik Höglund [Mon, 2 Mar 2015 17:37:27 +0000 (18:37 +0100)]
mesa: Implement VertexArrayVertexBuffers

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement VertexArrayVertexBuffer
Fredrik Höglund [Mon, 2 Mar 2015 17:35:10 +0000 (18:35 +0100)]
mesa: Implement VertexArrayVertexBuffer

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Add a vao parameter to bind_vertex_buffer
Fredrik Höglund [Mon, 2 Mar 2015 17:33:14 +0000 (18:33 +0100)]
mesa: Add a vao parameter to bind_vertex_buffer

This is needed to implement VertexArrayVertexBuffer and
VertexArrayVertexBuffers.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement VertexArrayElementBuffer
Fredrik Höglund [Mon, 2 Mar 2015 17:30:12 +0000 (18:30 +0100)]
mesa: Implement VertexArrayElementBuffer

v2: Add a doxygen comment.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement EnableVertexArrayAttrib
Fredrik Höglund [Mon, 2 Mar 2015 17:27:58 +0000 (18:27 +0100)]
mesa: Implement EnableVertexArrayAttrib

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement DisableVertexArrayAttrib
Fredrik Höglund [Mon, 2 Mar 2015 17:27:18 +0000 (18:27 +0100)]
mesa: Implement DisableVertexArrayAttrib

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Keep track of the last looked-up VAO
Fredrik Höglund [Mon, 2 Mar 2015 17:25:45 +0000 (18:25 +0100)]
mesa: Keep track of the last looked-up VAO

This saves the cost of repeated hash table lookups when the same
vertex array object is referenced in a sequence of calls such as:

    glVertexArrayAttribFormat(vao, ...);
    glVertexArrayAttribBinding(vao, ...);
    glEnableVertexArrayAttrib(vao, ...);
    ...

Note that VAO's are container objects that are not shared between
contexts.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Add _mesa_lookup_vao_err
Fredrik Höglund [Mon, 2 Mar 2015 17:24:36 +0000 (18:24 +0100)]
mesa: Add _mesa_lookup_vao_err

This is a convenience function that generates GL_INVALID_OPERATION
when the array object doesn't exist.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement CreateVertexArrays
Fredrik Höglund [Mon, 2 Mar 2015 17:22:50 +0000 (18:22 +0100)]
mesa: Implement CreateVertexArrays

v2: Update the documentation for gen_vertex_arrays().

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agoi965/skl: In opt_sampler_eot always set destination register to null
Neil Roberts [Thu, 7 May 2015 13:20:17 +0000 (14:20 +0100)]
i965/skl: In opt_sampler_eot always set destination register to null

opt_sampler_eot enables a direct write to framebuffer from a sample.
In order to do this the sample message needs to have a message header
so if there wasn't one already then the function adds one. In addition
the function sets the destination register to null because it's no
longer used. However it was only doing this in cases where it was
adding a message header. This patch just moves setting the destination
so that it happens even if there's a messge header. In practice this
doesn't seem to make any difference but it's a bit cleaner.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agoi965/fs: Set the header_size on LOAD_PAYLOAD in opt_sampler_eot
Neil Roberts [Thu, 7 May 2015 17:55:55 +0000 (18:55 +0100)]
i965/fs: Set the header_size on LOAD_PAYLOAD in opt_sampler_eot

Commit 94ee908448 added a header size parameter to the function to
create the LOAD_PAYLOAD instruction. However this broke
opt_sampler_eot which manually constructs the instruction and so
wasn't setting the header_size. This ends up making the parameters for
the send message all have the wrong location and it all falls apart.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agodocs: document the LIBGL_DRI3_DISABLE environment variable
Martin Peres [Thu, 7 May 2015 13:57:48 +0000 (16:57 +0300)]
docs: document the LIBGL_DRI3_DISABLE environment variable

Suggested-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agodocs: update ARB_vertex_attrib_64bit status
Dave Airlie [Fri, 24 Apr 2015 02:50:21 +0000 (12:50 +1000)]
docs: update ARB_vertex_attrib_64bit status

Add to GL3.txt and release notes.

Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agost/mesa: add double input support including lowering (v3.1)
Dave Airlie [Fri, 20 Feb 2015 01:42:19 +0000 (11:42 +1000)]
st/mesa:  add double input support including lowering (v3.1)

This takes a different approach to previously, we cannot index into the
inputMapping with anything but the mesa attribute index, so we can't use
the just add one to index trick, we need more info to add one to it
after we've mapped the input.

(Fixed copy propgation and cleaned up a little)

v2: drop float64 format check, just attr->Doubles.
merge enable patch.
v3: cleanup code a bit.
v3.1: minor review fixups (comment, newline) (Ilia)

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agomesa/vbo: add support for 64-bit vertex attributes. (v1)
Dave Airlie [Fri, 20 Feb 2015 01:41:01 +0000 (11:41 +1000)]
mesa/vbo: add support for 64-bit vertex attributes. (v1)

This adds support in the vbo and array code to handle
double vertex attributes.

v0.2: merge code to handle doubles in vbo layer.
v1: don't use v0, merge api_array elt code.

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: check total count of multi-slot double vertex attribs
Dave Airlie [Thu, 30 Apr 2015 00:42:06 +0000 (10:42 +1000)]
glsl: check total count of multi-slot double vertex attribs

The spec is vague all over the place about this, but this seems
to be the intent, we can probably make this optional later if
someone makes hw that cares and writes a driver.

Basically we need to double count some of the d types but
only for totalling not for slot number assignment.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: track which program inputs are doubles
Dave Airlie [Wed, 8 Apr 2015 04:38:19 +0000 (14:38 +1000)]
glsl: track which program inputs are doubles

instead of doing the attempts at dual slot handling here,
let the backend do it.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: add ARB_vertex_attrib_64bit support. (v2)
Dave Airlie [Fri, 20 Feb 2015 01:38:12 +0000 (11:38 +1000)]
glsl: add ARB_vertex_attrib_64bit support. (v2)

Just more boilerplate stuff.

v2:
bad fallthrough on versioning,
this is my ugly but self contained solution (Ian)

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agomesa: add ARB_vertex_attrib_64bit to extensions. (v2)
Dave Airlie [Fri, 20 Feb 2015 01:32:55 +0000 (11:32 +1000)]
mesa: add ARB_vertex_attrib_64bit to extensions. (v2)

Just add the boilerplate bits.

v2: add to version.c

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agomapi: add GL_ARB_vertex_attrib_64bit support
Dave Airlie [Fri, 20 Feb 2015 01:26:33 +0000 (11:26 +1000)]
mapi: add GL_ARB_vertex_attrib_64bit support

This just adds the glapi bits.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agost/glsl_to_tgsi: fix ir_assignment hack doing bad things for doubles
Dave Airlie [Fri, 20 Feb 2015 03:58:18 +0000 (13:58 +1000)]
st/glsl_to_tgsi: fix ir_assignment hack doing bad things for doubles

This hack for fixing gl_FragDepth apparantly caused a GLSL shader
outputting a single double to try and output a dvec4, but we hadn't
assigned outputs for the secondary bit.

This avoids going into the hack code for scalar doubles.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>