mesa.git
8 years agoprogram: Remove condition-code and precision support.
Matt Turner [Sat, 27 Feb 2016 19:06:25 +0000 (11:06 -0800)]
program: Remove condition-code and precision support.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Brian Paul <brianp@vmware.com>
8 years agoprogram: Remove OPCODE_KIL_NV.
Matt Turner [Sat, 27 Feb 2016 21:19:50 +0000 (13:19 -0800)]
program: Remove OPCODE_KIL_NV.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Brian Paul <brianp@vmware.com>
8 years agoprogram: Remove RelAddr2 support.
Matt Turner [Sat, 27 Feb 2016 21:44:50 +0000 (13:44 -0800)]
program: Remove RelAddr2 support.

Looks like more never-used crap from the first geometry shader attempt.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Brian Paul <brianp@vmware.com>
8 years agoprogram: Mark table const.
Matt Turner [Sat, 27 Feb 2016 22:15:26 +0000 (14:15 -0800)]
program: Mark table const.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Remove EmitCondCodes.
Matt Turner [Sat, 27 Feb 2016 19:23:32 +0000 (11:23 -0800)]
mesa: Remove EmitCondCodes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Brian Paul <brianp@vmware.com>
8 years agodocs: Remove descriptions of long dead Emit* fields.
Matt Turner [Sat, 27 Feb 2016 19:19:41 +0000 (11:19 -0800)]
docs: Remove descriptions of long dead Emit* fields.

Dead since commit d8a366200 in 2010.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Brian Paul <brianp@vmware.com>
8 years agoglsl: Initialize gl_shader_program::EmptyUniformLocations.
Matt Turner [Sun, 28 Feb 2016 00:38:26 +0000 (16:38 -0800)]
glsl: Initialize gl_shader_program::EmptyUniformLocations.

Commit 65dfb30 added exec_list EmptyUniformLocations, but only
initialized the list if ARB_explicit_uniform_location was enabled,
leading to crashes if the extension was not available.

Cc: "11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoi965/meta: Don't pollute the framebuffer namespace
Ian Romanick [Sat, 14 Nov 2015 01:57:18 +0000 (17:57 -0800)]
i965/meta: Don't pollute the framebuffer namespace

tl;dr: For many types of GL object, we can *NEVER* use the Gen function.

In OpenGL ES (all versions!) and OpenGL compatibility profile,
applications don't have to call Gen functions.  The GL spec is very
clear about how you can mix-and-match generated names and non-generated
names: you can use any name you want for a particular object type until
you call the Gen function for that object type.

Here's the problem scenario:

 - Application calls a meta function that generates a name.  The first
   Gen will probably return 1.

 - Application decides to use the same name for an object of the same
   type without calling Gen.  Many demo programs use names 1, 2, 3,
   etc. without calling Gen.

 - Application calls the meta function again, and the meta function
   replaces the data.  The application's data is lost, and the app
   fails.  Have fun debugging that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agoi965/meta: Use _mesa_bind_framebuffers instead of _mesa_BindFramebuffer
Ian Romanick [Sat, 14 Nov 2015 01:35:30 +0000 (17:35 -0800)]
i965/meta: Use _mesa_bind_framebuffers instead of _mesa_BindFramebuffer

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agometa: Don't pollute the framebuffer namespace
Ian Romanick [Sat, 14 Nov 2015 00:51:27 +0000 (16:51 -0800)]
meta: Don't pollute the framebuffer namespace

tl;dr: For many types of GL object, we can *NEVER* use the Gen function.

In OpenGL ES (all versions!) and OpenGL compatibility profile,
applications don't have to call Gen functions.  The GL spec is very
clear about how you can mix-and-match generated names and non-generated
names: you can use any name you want for a particular object type until
you call the Gen function for that object type.

Here's the problem scenario:

 - Application calls a meta function that generates a name.  The first
   Gen will probably return 1.

 - Application decides to use the same name for an object of the same
   type without calling Gen.  Many demo programs use names 1, 2, 3,
   etc. without calling Gen.

 - Application calls the meta function again, and the meta function
   replaces the data.  The application's data is lost, and the app
   fails.  Have fun debugging that.

Fixes piglit tests:
    - object-namespace-pollution glGetTexImage-compressed framebuffer
    - object-namespace-pollution glGenerateMipmap framebuffer

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agometa/decompress: Track framebuffer using gl_framebuffer instead of GL API object...
Ian Romanick [Sat, 14 Nov 2015 01:21:38 +0000 (17:21 -0800)]
meta/decompress: Track framebuffer using gl_framebuffer instead of GL API object handle

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agometa/generate_mipmap: Track framebuffer using gl_framebuffer instead of GL API object...
Ian Romanick [Sat, 14 Nov 2015 01:14:00 +0000 (17:14 -0800)]
meta/generate_mipmap: Track framebuffer using gl_framebuffer instead of GL API object handle

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agometa: Use _mesa_bind_framebuffers instead of _mesa_BindFramebuffer
Ian Romanick [Fri, 13 Nov 2015 19:12:57 +0000 (11:12 -0800)]
meta: Use _mesa_bind_framebuffers instead of _mesa_BindFramebuffer

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agometa: Use _mesa_CreateFramebuffers instead of _mesa_GenFramebuffers
Ian Romanick [Fri, 13 Nov 2015 19:06:51 +0000 (11:06 -0800)]
meta: Use _mesa_CreateFramebuffers instead of _mesa_GenFramebuffers

This enables later patches that will stop calling _mesa_GenFramebuffers
or _mesa_CreateFramebuffers which pollute the framebuffer namespace.

For framebuffers, the Bind call is still necessary.

sed -i -e 's/_mesa_GenFramebuffers/_mesa_CreateFramebuffers/' \
    src/mesa/drivers/common/*.c

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agoi965/meta: Use _mesa_CreateFramebuffers instead of _mesa_GenFramebuffers
Ian Romanick [Fri, 13 Nov 2015 19:04:25 +0000 (11:04 -0800)]
i965/meta: Use _mesa_CreateFramebuffers instead of _mesa_GenFramebuffers

This enables later patches that will stop calling _mesa_GenFramebuffers
or _mesa_CreateFramebuffers which pollute the framebuffer namespace.

For framebuffers, the Bind call is still necessary.

sed -i -e 's/_mesa_GenFramebuffers/_mesa_CreateFramebuffers/' \
    src/mesa/drivers/dri/i965/*.c

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agometa: Save and restore the framebuffer using gl_framebuffer instead of GL API object...
Ian Romanick [Fri, 13 Nov 2015 18:51:01 +0000 (10:51 -0800)]
meta: Save and restore the framebuffer using gl_framebuffer instead of GL API object handle

Some meta operations can be called recursively.  Future changes (the
"Don't pollute the ... namespace" changes) will cause objects with
invalid names to be used.  If a nested meta operation tries to restore
an object named 0xDEADBEEF, it will fail.

This also fixes another latent bug in meta.  In a multithreaded,
multicontext application, one thread can delete an object that is bound
in another thread.  That object continues to exist until it is unbound
(i.e., its refcount drops to zero).  Meta unbinds objects all over the
place.  As a result, the rebind in _mesa_meta_end could fail because the
object vanished!

See https://bugs.freedesktop.org/show_bug.cgi?id=92363#c8.

Using _mesa_reference_<object type> to save and restore the objects
prevents the refcount from going to zero.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agomesa: Refactor bind_framebuffer to make _mesa_bind_framebuffers
Ian Romanick [Fri, 13 Nov 2015 18:46:40 +0000 (10:46 -0800)]
mesa: Refactor bind_framebuffer to make _mesa_bind_framebuffers

Fixing dd_function_table::BindFramebuffer will come later because that
change is probably not suitable for stable.

v2: Fix whitespace issue noticed by Topi.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agometa: Use _mesa_check_framebuffer_status instead of _mesa_CheckFramebufferStatus
Ian Romanick [Fri, 13 Nov 2015 01:18:53 +0000 (17:18 -0800)]
meta: Use _mesa_check_framebuffer_status instead of _mesa_CheckFramebufferStatus

sed -i -e 's/_mesa_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER/_mesa_check_framebuffer_status(ctx, ctx->DrawBuffer/' \
    -e 's/_mesa_CheckFramebufferStatus(GL_FRAMEBUFFER[^)]*/_mesa_check_framebuffer_status(ctx, ctx->DrawBuffer/' \
    -e 's/_mesa_CheckFramebufferStatus(GL_READ_FRAMEBUFFER/_mesa_check_framebuffer_status(ctx, ctx->ReadBuffer/' \
    $(grep -rl _mesa_CheckFramebufferStatus src/mesa/drivers)

The second expression catches both GL_FRAMEBUFFER and GL_FRAMEBUFFER_EXT.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agometa: Obvious refactor of _mesa_meta_framebuffer_texture_image
Ian Romanick [Fri, 13 Nov 2015 01:11:30 +0000 (17:11 -0800)]
meta: Obvious refactor of _mesa_meta_framebuffer_texture_image

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agometa: Convert _mesa_meta_bind_fbo_image to take a gl_framebuffer instead of a GL...
Ian Romanick [Fri, 13 Nov 2015 01:05:27 +0000 (17:05 -0800)]
meta: Convert _mesa_meta_bind_fbo_image to take a gl_framebuffer instead of a GL API handle

Also change the name of the function to
_mesa_meta_framebuffer_texture_image.  The function is basically a
wrapper around _mesa_framebuffer_texture (which is used to implement
glFramebufferTexture1D and friends), so it makes sense for it's name to
be similar to that.

The next patch will clean _mesa_meta_framebuffer_texture_image up
considerably.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agovirgl: add support for passing render condition flags to host.
Dave Airlie [Tue, 1 Mar 2016 05:48:44 +0000 (15:48 +1000)]
virgl: add support for passing render condition flags to host.

This just passes the extra blit info to fix the render condition
tests.

Cc: "11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoi965: Push most TES inputs in vec4 mode.
Kenneth Graunke [Wed, 17 Feb 2016 08:37:04 +0000 (00:37 -0800)]
i965: Push most TES inputs in vec4 mode.

(This is commit 4a1c8a3037cd29938b2a6e2c680c341e9903cfbe for vec4 mode.)

Using the push model for inputs is much more efficient than pulling
inputs - the hardware can simply copy a large chunk into URB registers
at thread creation time, rather than having the thread send messages to
request data from the L3 cache.  Unfortunately, it's possible to have
more TES inputs than fit in registers, so we have to fall back to the
pull model in some cases.

However, it turns out that most tessellation evaluation shaders are
fairly simple, and don't use many inputs.  An arbitrary cut-off of
24 vec4 slots (12 registers) should suffice.  (I chose this instead of
the 32 vec4 slots used in the scalar backend to avoid regressing a few
Piglit tests due to the vec4 register allocator being too stupid to
figure out what to do.  We probably ought to fix that, but it's a
separate issue.)

Improves performance in GPUTest's tessmark_x64 microbenchmark by
41.5394% +/- 0.288519% (n = 115) at 1024x768 on my Clevo W740SU
(with Iris Pro 5200).

Improves performance in Synmark's Gl40TerrainFlyTess microbenchmark by
38.3576% +/- 0.759748% (n = 42).

v2: Simplify abs/negate handling, as requested by Matt.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agor600g: remove support for DRM < 2.12.0
Marek Olšák [Tue, 23 Feb 2016 22:32:44 +0000 (23:32 +0100)]
r600g: remove support for DRM < 2.12.0

8 years agor300g: remove support for DRM < 2.12.0
Marek Olšák [Tue, 23 Feb 2016 22:32:44 +0000 (23:32 +0100)]
r300g: remove support for DRM < 2.12.0

8 years agowinsys/radeon: drop support for DRM 2.12.0 (kernel < 3.2)
Marek Olšák [Tue, 23 Feb 2016 22:24:12 +0000 (23:24 +0100)]
winsys/radeon: drop support for DRM 2.12.0 (kernel < 3.2)

in order to make some winsys interface changes easier

This distros should use new DRM if they want to use new Mesa:
  Distro    kernel  mesa    eol
  SLES 10   2.6.16  6.4.2   2016-07
  SLED 11   3.0     9.0.3   2022-03
  RHEL 5    2.6.18  6.5.1   2017-03
  RHEL 6    2.6.32  10.4.3  2020-11
  Debian 6  2.6.32  7.7.1   2016-02

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: also dump shaders on a VM fault
Marek Olšák [Thu, 25 Feb 2016 16:54:01 +0000 (17:54 +0100)]
radeonsi: also dump shaders on a VM fault

Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoradeonsi: dump full shader disassemblies into ddebug logs
Marek Olšák [Thu, 25 Feb 2016 16:12:15 +0000 (17:12 +0100)]
radeonsi: dump full shader disassemblies into ddebug logs

including prolog and epilog disassemblies

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: allow dumping shader disassemblies to a file
Marek Olšák [Thu, 25 Feb 2016 16:11:20 +0000 (17:11 +0100)]
radeonsi: allow dumping shader disassemblies to a file

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: use re-Z
Marek Olšák [Sun, 21 Feb 2016 23:40:04 +0000 (00:40 +0100)]
radeonsi: use re-Z

This can increase perf for shaders that kill pixels (kill, alpha-test,
alpha-to-coverage).

v2: add comments

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agotgsi/scan: count memory instructions
Marek Olšák [Sun, 21 Feb 2016 23:23:10 +0000 (00:23 +0100)]
tgsi/scan: count memory instructions

for radeonsi

Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa/fbobject: propogate Layered when reusing attachments.
Dave Airlie [Mon, 29 Feb 2016 07:16:10 +0000 (17:16 +1000)]
mesa/fbobject: propogate Layered when reusing attachments.

When reusing a depth attachment as a stencil, we need to propogate
the layered bit, otherwise we fail to complete the framebuffer.

discovered running ./bin/fbo-depth-array depth-layered-clear
on virgl on haswell.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agost/nine: Fix second Multithreading issue with MANAGED buffers
Axel Davy [Sat, 27 Feb 2016 10:02:21 +0000 (11:02 +0100)]
st/nine: Fix second Multithreading issue with MANAGED buffers

Here is another threading issue with MANAGED buffers:

Thread 1: buffer creation
Thread 1: buffer lock
Thread 2: Draw call
Thread 1: writes data
Thread 1: Unlock

Without this patch, the buffer is initially dirty
and in the list of things to upload after its creation.
The draw call will then upload the data and unset the dirty flag,
and the Unlock won't trigger a second upload.

Fixes regression introduced by cc0114f30b587a10766ec212afb3ad356099ef23:
"st/nine: Implement Managed vertex/index buffers"

Cc: "11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix Multithreading issue with MANAGED buffers
Axel Davy [Thu, 25 Feb 2016 18:07:37 +0000 (19:07 +0100)]
st/nine: Fix Multithreading issue with MANAGED buffers

d3d calls are protected by mutexes, however if app is doing in
two threads:

Thread 1: buffer Lock
Thread 2: Draw call
Thread 1: writes data
Thread 1: Unlock

Then before this patch, the Draw call would begin to upload
the buffer.

Solves this by moving the moment we add the buffer to the queue
of things to upload (We move it from Lock time to Unlock time).

Cc: "11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Handle READONLY for buffer MANAGED pool
Axel Davy [Wed, 24 Feb 2016 22:44:40 +0000 (23:44 +0100)]
st/nine: Handle READONLY for buffer MANAGED pool

READONLY won't trigger an upload.

Cc: "11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Use Position input helper for ps3 declared inputs
Axel Davy [Sun, 21 Feb 2016 15:35:31 +0000 (16:35 +0100)]
st/nine: Use Position input helper for ps3 declared inputs

When the semantic is Position (which can happen with index 0 only),
use the helper to get Position input.

Cc: "11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Introduce helper for Position shader input
Axel Davy [Sun, 21 Feb 2016 15:30:15 +0000 (16:30 +0100)]
st/nine: Introduce helper for Position shader input

Cc: "11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agovirtio_gpu: Add virtio 1.0 PCI ID to driver map
Marc-André Lureau [Fri, 12 Feb 2016 21:11:05 +0000 (22:11 +0100)]
virtio_gpu: Add virtio 1.0 PCI ID to driver map

Add the virtio-gpu PCI ID for virtio 1.0 (according to the
specification, "the PCI Device ID is calculated by adding 0x1040 to the
Virtio Device ID")

Support for virtio 1.0 was added in qemu 2.4 (same time virtio-gpu
landed).

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agost/clover: Add libelf cflags to the build
Koop Mast [Mon, 28 Dec 2015 19:26:48 +0000 (20:26 +0100)]
st/clover: Add libelf cflags to the build

Otherwise the build will fail, when the library is in a non default
location.

v2 [Emil Velikov]
 - drop the unneeded cflags from targets/opencl.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Fixes: 7f585a6a98d "configure.ac: use pkg-config for libelf"
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93524
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agomesa; add get-extra-pick-list.sh script into bin/
Emil Velikov [Wed, 2 Sep 2015 16:36:22 +0000 (17:36 +0100)]
mesa; add get-extra-pick-list.sh script into bin/

This is a very rudimentary script that checks if any of the applied
cherry-picks have been referenced (fixed?) by another patch. With the
latter either missing the stable tag or hasn't yet been picked.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agoautomake: explicitly set distcheck configure flags
Emil Velikov [Thu, 25 Feb 2016 15:48:41 +0000 (15:48 +0000)]
automake: explicitly set distcheck configure flags

Pretty much all of these are enabled by default. Considering the recent
updates (see previous commits) one might as well list most/all of these
here.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoautomake: add more missing options for make distcheck
Emil Velikov [Thu, 25 Feb 2016 15:20:04 +0000 (15:20 +0000)]
automake: add more missing options for make distcheck

Namely - opencl, osmesa (only the gallium flavour as it conflicts with
the classic one), surfaceless egl platform and a couple gallium drivers
(virgl and vc4).

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoinstall-gallium-links: port changes from install-lib-links
Emil Velikov [Thu, 25 Feb 2016 16:53:06 +0000 (16:53 +0000)]
install-gallium-links: port changes from install-lib-links

Namely:
b662d5282f7 mesa: Add clean-local rule to remove .lib links.
5c1aac17adf install-lib-links: don't depend on .libs directory
fece147be53 install-lib-links: remove the .install-lib-links file

With these in place, make distcheck now passes and a race condition has
been avoided.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agor600: Make enum alu_op_flags unsigned
Rob Herring [Wed, 24 Feb 2016 18:56:31 +0000 (12:56 -0600)]
r600: Make enum alu_op_flags unsigned

In builds with clang, there are several errors related to the enum
alu_op_flags like this:

src/gallium/drivers/r600/sb/sb_expr.cpp:887:8:
error: case value evaluates to -1610612736, which cannot be narrowed to
type 'unsigned int' [-Wc++11-narrowing]

These are due to the MSB being set in the enum. Fix these errors by
making the enum values unsigned as needed. The flags field that stores
this enum also needs to be unsigned.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Cc: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agogallium/radeon: Add space between string literal and identifier
Rob Herring [Wed, 24 Feb 2016 18:56:30 +0000 (12:56 -0600)]
gallium/radeon: Add space between string literal and identifier

Fix compiles with clang that have this C++11 error:

src/gallium/drivers/radeon/r600_pipe_common.h:662:34:
error: invalid suffix on literal; C++11 requires a space between literal
and identifier [-Wreserved-user-defined-literal]

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Cc: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agofreedreno: drop unnecessary -Wno-packed-bitfield-compat
Rob Herring [Wed, 24 Feb 2016 18:56:29 +0000 (12:56 -0600)]
freedreno: drop unnecessary -Wno-packed-bitfield-compat

Enabling this warning doesn't generate any warnings with gcc, but is an
unknown option for clang, so drop it.

Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Rob Clark <robdclark@gmail.com> (v1)
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
v2: keep the warning around, commented out
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoAndroid: clean-up and fix DRI module path handling
Rob Herring [Wed, 24 Feb 2016 18:56:28 +0000 (12:56 -0600)]
Android: clean-up and fix DRI module path handling

MESA_DRI_MODULE_PATH is only getting set for classic DRI drivers and may or
may not be set correctly for gallium_dri.so depending on the makefile
include ordering. For Android 6 and earlier it is fine, but with build
system changes in AOSP master, it is not.

Move the path variables to a single place at the top level and introduce
MESA_DRI_MODULE_REL_PATH for Android 5 and later which require relative
paths. With this, there is a single variable to change.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoAndroid: remove headers from LOCAL_SRC_FILES
Rob Herring [Wed, 24 Feb 2016 18:56:27 +0000 (12:56 -0600)]
Android: remove headers from LOCAL_SRC_FILES

The Android build system now spits out warnings for header files listed in
LOCAL_SRC_FILES, so strip them out.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoAndroid: add -Wno-date-time flag for clang
Rob Herring [Wed, 24 Feb 2016 18:56:26 +0000 (12:56 -0600)]
Android: add -Wno-date-time flag for clang

clang complains about date/time macros:

src/mesa/main/context.c:403:25: error: expansion of date or time macro is not reproducible [-Werror,-Wdate-time]

Disable this warning.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoAndroid: glsl: fix dependence on YACC_HEADER_SUFFIX from build system
Rob Herring [Wed, 24 Feb 2016 18:56:25 +0000 (12:56 -0600)]
Android: glsl: fix dependence on YACC_HEADER_SUFFIX from build system

The makefile was implicitly picking up YACC_HEADER_SUFFIX from the Android
build system, but this variable is now gone. Add it locally to fix the
build with AOSP master.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoAndroid: remove dependence on .SECONDEXPANSION
Rob Herring [Wed, 24 Feb 2016 18:56:24 +0000 (12:56 -0600)]
Android: remove dependence on .SECONDEXPANSION

With the Android build system changes to ninja/kati, the use of
.SECONDEXPANSION is no longer supported. Fix this by avoiding rule specific
variables and using $(transform-generated-source).

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoAndroid: fix build break from nir/glsl move to compiler/
Rob Herring [Wed, 10 Feb 2016 22:02:11 +0000 (16:02 -0600)]
Android: fix build break from nir/glsl move to compiler/

Commits a39a8fbbaa12 ("nir: move to compiler/") and eb63640c1d38
("glsl: move to compiler/") broke Android builds. Fix them.

There is also a missing dependency between generated NIR headers and
several libraries. This isn't a new issue, but seems to have been
exposed by the NIR move.

Built with i915, i965, freedreno, r300g, r600g, vc4, and virgl enabled.

Cc: "11.2" <mesa-stable@lists.freedesktop.org>
Cc: Mauro Rossi <issor.oruam@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agogallium/radeon: disable evergreen_do_fast_color_clear for BE
Oded Gabbay [Thu, 25 Feb 2016 20:36:38 +0000 (22:36 +0200)]
gallium/radeon: disable evergreen_do_fast_color_clear for BE

This function is currently broken for BE. I assume it's because of
util_pack_color(). Until I fix this path, I prefer to disable it so users
would be able to see correct colors on their desktop and applications.

Together with the two following patches:
- gallium/r600: Don't let h/w do endian swap for colorformat
- gallium/radeon: remove separate BE path in r600_translate_colorswap

it fixes BZ#72877 and BZ#92039

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/r600: Don't let h/w do endian swap for colorformat
Oded Gabbay [Thu, 25 Feb 2016 21:09:18 +0000 (23:09 +0200)]
gallium/r600: Don't let h/w do endian swap for colorformat

Since the rework on gallium pipe formats, there is no more need to do
endian swap of the colorformat in the h/w, because the conversion between
mesa format and gallium (pipe) format takes endianess into account (see
the big #if in p_format.h).

v2: return ENDIAN_NONE only for four 8-bits components
(V_0280A0_COLOR_8_8_8_8)

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: remove separate BE path in r600_translate_colorswap
Oded Gabbay [Thu, 25 Feb 2016 20:35:00 +0000 (22:35 +0200)]
gallium/radeon: remove separate BE path in r600_translate_colorswap

After further testing, it appears there is no need for
separate BE path in r600_translate_colorswap()

The only fix remaining is the change of the last if statement, in the 4
channels case. Originally, it contained an invalid swizzle configuration
that never got hit, in LE or BE. So the fix is relevant for both systems.

This patch adds an additional 120 available visuals for LE and BE,
as seen in glxinfo

v2:
Tested for regressions by running piglit gpu.py with CAICOS (r600g) on
x86-64 machine. No regressions found.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agonv50/ir: emit VOTE instruction
Samuel Pitoiset [Sun, 28 Feb 2016 19:44:47 +0000 (20:44 +0100)]
nv50/ir: emit VOTE instruction

Changes from v2:
 - add missing NOT modifier for GK110/GM107

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agogk110/ir: add ld lock/st unlock emission
Samuel Pitoiset [Sun, 28 Feb 2016 17:22:13 +0000 (18:22 +0100)]
gk110/ir: add ld lock/st unlock emission

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonv50,nvc0: bump minimum texture buffer offset alignment
Ilia Mirkin [Sat, 27 Feb 2016 20:30:34 +0000 (15:30 -0500)]
nv50,nvc0: bump minimum texture buffer offset alignment

It appears that it actually needs to be aligned to the datum size, so it
was 1 when testing with R8, but it can be as high as 16 with RGBA32.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
8 years agomesa: add GL_OES_gpu_shader5 and GL_EXT_gpu_shader5 support
Ilia Mirkin [Sat, 20 Feb 2016 00:08:35 +0000 (19:08 -0500)]
mesa: add GL_OES_gpu_shader5 and GL_EXT_gpu_shader5 support

The two extensions are identical, and are largely taking bits of already
existing desktop functionality. We continue to do a poor job of
supporting the 'precise' keyword, just like we do on desktop.

This passes the relevant dEQP tests that I could find.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
8 years agomesa: expose GL_EXT_texture_sRGB_decode on GLES 3.0+
Ilia Mirkin [Sat, 20 Feb 2016 20:58:19 +0000 (15:58 -0500)]
mesa: expose GL_EXT_texture_sRGB_decode on GLES 3.0+

Could be exposed on earlier GLES versions if we supported EXT_sRGB, but
we don't, for now.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
8 years agoi965/cfg: Fix comment list punctuation
Ian Romanick [Fri, 26 Feb 2016 19:16:33 +0000 (11:16 -0800)]
i965/cfg: Fix comment list punctuation

Trivial

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965/cfg: Split out dead control flow paths to simplify both paths
Ian Romanick [Thu, 25 Feb 2016 03:39:49 +0000 (19:39 -0800)]
i965/cfg: Split out dead control flow paths to simplify both paths

v2: Fix some bad indentation.  Suggested by Curro.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965/cfg: Don't handle fully empty if/else/endif
Ian Romanick [Thu, 25 Feb 2016 03:29:57 +0000 (19:29 -0800)]
i965/cfg: Don't handle fully empty if/else/endif

This will now never occur.  The empty if-else part would have already
been removed leaving an empty if-endif part.

No shader-db changes.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965/cfg: Eliminate an empty then-branch of an if/else/endif
Ian Romanick [Thu, 25 Feb 2016 03:11:39 +0000 (19:11 -0800)]
i965/cfg: Eliminate an empty then-branch of an if/else/endif

On BDW,

total instructions in shared programs: 8448571 -> 8448367 (-0.00%)
instructions in affected programs: 21000 -> 20796 (-0.97%)
helped: 116
HURT: 0

v2: Remove spurious attempt to combine the if_block with the (removed!)
else_block.  Suggested by Matt and Curro.  Correct the comment
describing what the new pass does.  Suggested by Matt.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965/cfg: Track prev_block and prev_inst explicitly in the whole function
Ian Romanick [Thu, 25 Feb 2016 03:26:13 +0000 (19:26 -0800)]
i965/cfg: Track prev_block and prev_inst explicitly in the whole function

This provides a trivial simplification now, and it makes some future
changes more straight forward.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965/cfg: Slightly rearrange dead_control_flow_eliminate
Ian Romanick [Thu, 25 Feb 2016 02:52:05 +0000 (18:52 -0800)]
i965/cfg: Slightly rearrange dead_control_flow_eliminate

'git diff -w' is a bit more illustrative.  A couple declarations were
moved, the continue was removed, and the code was reindented.  This will
simplify future changes.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965: Simplify brw_nir_lower_vue_inputs() slightly.
Kenneth Graunke [Thu, 25 Feb 2016 07:44:46 +0000 (23:44 -0800)]
i965: Simplify brw_nir_lower_vue_inputs() slightly.

The same code appeared in both branches; pull it above the if statement.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965: Avoid recalculating the normal VUE map for IO lowering.
Kenneth Graunke [Thu, 25 Feb 2016 07:43:17 +0000 (23:43 -0800)]
i965: Avoid recalculating the normal VUE map for IO lowering.

The caller already computes it.  Now that we have stage specific
functions, it's really easy to pass this in.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965: Avoid recalculating the tessellation VUE map for IO lowering.
Kenneth Graunke [Thu, 25 Feb 2016 06:34:51 +0000 (22:34 -0800)]
i965: Avoid recalculating the tessellation VUE map for IO lowering.

The caller already computes it.  Now that we have stage specific
functions, it's really easy to pass this in.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965: Eliminate brw_nir_lower_{inputs,outputs,io} functions.
Kenneth Graunke [Thu, 25 Feb 2016 06:11:35 +0000 (22:11 -0800)]
i965: Eliminate brw_nir_lower_{inputs,outputs,io} functions.

Now that each stage is directly calling brw_nir_lower_io(), and we have
per-stage helper functions, it makes sense to just call the relevant one
directly, rather than going through multiple switch statements.

This also eliminates stupid function parameters, such as the two that
only apply to vertex attributes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965: Split brw_nir_lower_inputs/outputs into per-stage functions.
Kenneth Graunke [Thu, 25 Feb 2016 06:02:28 +0000 (22:02 -0800)]
i965: Split brw_nir_lower_inputs/outputs into per-stage functions.

These functions are both giant switch statements where most cases don't
overlap at all.  Let's put the bulk of the work in per-stage helpers.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965: Remove catch-all nir_lower_io call with specific cases.
Kenneth Graunke [Thu, 25 Feb 2016 05:50:42 +0000 (21:50 -0800)]
i965: Remove catch-all nir_lower_io call with specific cases.

Most cases already call nir_lower_io explicitly for input and output
lowering.  This catch all isn't very useful anymore - we can just add it
to the remaining cases.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965: Move optimizations from brw_nir_lower_io to brw_postprocess_nir.
Kenneth Graunke [Thu, 25 Feb 2016 05:40:37 +0000 (21:40 -0800)]
i965: Move optimizations from brw_nir_lower_io to brw_postprocess_nir.

This simplifies things.  Every caller of brw_nir_lower_io() immediately
calls brw_postprocess_nir().  The only real change this will have is
that we get an extra brw_nir_optimize() call when compiling compute
shaders, but that seems fine.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965: Always do NIR IO lowering at specialization time.
Kenneth Graunke [Thu, 25 Feb 2016 05:36:15 +0000 (21:36 -0800)]
i965: Always do NIR IO lowering at specialization time.

We've now hit literally every case other than geometry shaders (and
compute shaders, but those are a no-op).  So, let's just move geometry
shaders over too and be done with it.

The only advantage to doing this at link time was to save the expense
of running the pass on recompiles.  But we're already running a lot of
passes, and the extra code complexity isn't worth it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965: Make an is_scalar boolean in brw_compile_gs().
Kenneth Graunke [Wed, 13 Jan 2016 23:23:48 +0000 (15:23 -0800)]
i965: Make an is_scalar boolean in brw_compile_gs().

Shorter than compiler->scalar_stage[MESA_SHADER_GEOMETRY], which can
help with line-wrapping.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965/nir: Do lower_io late for fragment shaders
Jason Ekstrand [Wed, 17 Feb 2016 21:23:45 +0000 (13:23 -0800)]
i965/nir: Do lower_io late for fragment shaders

The Vulkan driver wants to be able to delete fragment outputs that are
beyond key.nr_color_regions; this is a lot easier if we lower outputs at
specialization time rather than link time.

(Rationale added to commit message by Ken)

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965: Set dest type to UW for several send messages
Jordan Justen [Mon, 1 Feb 2016 02:28:42 +0000 (18:28 -0800)]
i965: Set dest type to UW for several send messages

Without this, on SIMD 16 the send instruction destination will appear
to write more than one destination register, causing the simulator to
report an error.

Of course, the send instruction can actually write more than one
destination register regardless of the type set for the destination,
so this is a bit strange.

Suggested-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agonvc0: rework nvc0_compute_validate_program()
Samuel Pitoiset [Wed, 24 Feb 2016 17:44:56 +0000 (18:44 +0100)]
nvc0: rework nvc0_compute_validate_program()

Reduce the amount of duplicated code by re-using
nvc0_program_validate(). While we are at it, change the prototype
to return void and remove nvc0_compute.h which is now useless.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Pierre Moreau <pierre.morrow@free.fr>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: make sure to validate compute global buffers on Fermi
Samuel Pitoiset [Wed, 24 Feb 2016 17:44:55 +0000 (18:44 +0100)]
nvc0: make sure to validate compute global buffers on Fermi

No reason to not validate those global buffers and this might avoid
fails if someone try to use the global memory from compute programs.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Pierre Moreau <pierre.morrow@free.fr>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: move nvc0_validate_global_residents() to nvc0_compute.c
Samuel Pitoiset [Wed, 24 Feb 2016 17:44:54 +0000 (18:44 +0100)]
nvc0: move nvc0_validate_global_residents() to nvc0_compute.c

While we are at it, rename it to nvc0_compute_validate_globals() and
update its prototype.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Pierre Moreau <pierre.morrow@free.fr>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoegl/wayland: Try to use wl_surface.damage_buffer for SwapBuffersWithDamage
Derek Foreman [Tue, 16 Feb 2016 16:34:39 +0000 (10:34 -0600)]
egl/wayland: Try to use wl_surface.damage_buffer for SwapBuffersWithDamage

Since commit d1314de293e9e4a63c35f094c3893aaaed8580b4 we ignore
damage passed to SwapBuffersWithDamage.

Wayland 1.10 now has functionality that allows us to properly
process those damage rectangles, and a way to query if it's
available.

Now we can use wl_surface.damage_buffer and interpret the incoming
damage as being in buffer co-ordinates.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
8 years agovirgl: add missing CAP turned off.
Dave Airlie [Fri, 26 Feb 2016 04:02:56 +0000 (04:02 +0000)]
virgl: add missing CAP turned off.

8 years agoprogram: Remove extra reference_program()
Miklós Máté [Tue, 15 Dec 2015 23:05:44 +0000 (00:05 +0100)]
program: Remove extra reference_program()

It was already done in get_mesa_program()

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agoautomake: add nine to make distcheck
Emil Velikov [Thu, 25 Feb 2016 15:12:49 +0000 (15:12 +0000)]
automake: add nine to make distcheck

Will allow us to catch/prevent issues, like the one in mesa 11.2.0-rc1.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agost/nine: don't forget to bundle the nine_limits.h file
Emil Velikov [Thu, 25 Feb 2016 16:07:45 +0000 (16:07 +0000)]
st/nine: don't forget to bundle the nine_limits.h file

Without this mesa 11.2.0-rc1 ended up busted :-(

Cc: "11.2" <mesa-stable@lists.freedesktop.org>
Repored-by: Ondřej Súkup <mimi.vx@gmail.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoi965/fs: Allow saturate propagation to propagate negations into MADs.
Matt Turner [Wed, 11 Feb 2015 01:45:28 +0000 (17:45 -0800)]
i965/fs: Allow saturate propagation to propagate negations into MADs.

Allows us to transform

   mad      res  src0   src1   src2
   mov.sat  dst  -res

into

   mad.sat  dst  -src0 -src1   src2

instructions in affected programs: 3712 -> 3688 (-0.65%)
helped: 24

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965/fs: Allow saturate propagation to propagate negations into ADDs.
Matt Turner [Thu, 29 Jan 2015 22:17:20 +0000 (14:17 -0800)]
i965/fs: Allow saturate propagation to propagate negations into ADDs.

Allows us to transform

   add      res  src0   src1
   mov.sat  dst  -res

into

   add.sat  dst  -src0 -src1

No shader-db changes.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965/fs: Allow saturate propagation to propagate negations into MULs.
Matt Turner [Wed, 28 Jan 2015 06:46:22 +0000 (22:46 -0800)]
i965/fs: Allow saturate propagation to propagate negations into MULs.

Allows us to transform

   mul      res  src0   src1
   mov.sat  dst  -res

into

   mul.sat  dst  src0  -src1

instructions in affected programs: 45246 -> 45054 (-0.42%)
helped: 162

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965/fs: Don't CSE negated multiplies with saturation.
Matt Turner [Mon, 22 Feb 2016 18:25:38 +0000 (10:25 -0800)]
i965/fs: Don't CSE negated multiplies with saturation.

It's not correct to CSE these multiplies

   mul.sat dst1, -a, b
   mul.sat dst2,  a, b

by emitting a negated MOV from dst1 to dst2:

   mul.sat dst1, -a, b
   mov     dst2, -dst1

Take 2.0*2.0 for example. The first multiply would produce 0.0 and the
second would produce 1.0.

Fixes bad generated code in 18 to 22 shaders:

instructions in affected programs: 432 -> 464 (7.41%)
helped: 4
HURT: 18

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: Consider ubo_load to be a horizontal operation.
Matt Turner [Mon, 22 Feb 2016 17:36:48 +0000 (09:36 -0800)]
glsl: Consider ubo_load to be a horizontal operation.

Unclear to me whether it actually is a horizontal operation that cannot
be vectorized, but the fact that i965 generates the same code in either
case makes me less interested in finding out.

Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94199
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl/ast: Implicit conversion from double to float is not allowed
Andres Gomez [Thu, 25 Feb 2016 10:49:24 +0000 (12:49 +0200)]
glsl/ast: Implicit conversion from double to float is not allowed

Also, renamed get_conversion_operation to avoid
future misunderstandings.

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agogallium/radeon: return correct values for BE in r600_translate_colorswap
Oded Gabbay [Wed, 24 Feb 2016 12:43:28 +0000 (14:43 +0200)]
gallium/radeon: return correct values for BE in r600_translate_colorswap

Because I changed the swizzle check, I also need to adapt the return
values for each check.

It's basically almost the same as before, we just cross between STD and
STD_REV, and cross between ALT and ALT_REV

This fixes the rgba test in gl-1.0-readpixsanity (piglit) and also
fixes tri-flat (mesa demos).

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium: remove duplicate define from enum pipe_format
Oded Gabbay [Wed, 24 Feb 2016 09:49:53 +0000 (11:49 +0200)]
gallium: remove duplicate define from enum pipe_format

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agoglsl: Detect do-while-false loops and unroll them
Ian Romanick [Fri, 19 Feb 2016 02:08:58 +0000 (18:08 -0800)]
glsl: Detect do-while-false loops and unroll them

Previously loops like

   do {
      // ...
   } while (false);

that did not have any other loop-branch instructions would not be
unrolled.  This is commonly used to wrap multiline preprocessor macros.

This produces IR like

    (loop (
       ...
       break
    ))

Since limiting_terminator was NULL, the loop unroller would
throw up its hands and say, "I don't know how many iterations.  How
can I unroll this?"

We can detect this another way.  If there is no limiting_terminator
and the only loop-branch is a break as the last IR, there's only one
iteration.

On my very old checkout of shader-db, this removes a loop from Orbital
Explorer, but it does not otherwise affect the shader.  The loop removed
is the one the compiler inserts surrounding the switch statement.

This change does prevent some seriously bad code generation in some
patches to meta shaders that I recently sent out for review.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoi965: Enable tiled mem_copy with sRGB-formatted resources
Nanley Chery [Thu, 11 Feb 2016 00:53:57 +0000 (16:53 -0800)]
i965: Enable tiled mem_copy with sRGB-formatted resources

RGBA8 and BGRA8 unorm formats are compatible with the various
mem_copy functions. Their sRGB counterparts are also compatible
because they're also color-renderable (of importance when the
specified resource is a readbuffer) and they share the same
physical layout.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agomesa: replace for loop with bitshifting in supported_buffer_bitmask()
Brian Paul [Tue, 23 Feb 2016 20:46:28 +0000 (13:46 -0700)]
mesa: replace for loop with bitshifting in supported_buffer_bitmask()

Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agomesa: updates some comments in buffers.c
Brian Paul [Tue, 23 Feb 2016 20:41:27 +0000 (13:41 -0700)]
mesa: updates some comments in buffers.c

Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agomesa: make _mesa_draw_buffers() static
Brian Paul [Tue, 23 Feb 2016 20:35:32 +0000 (13:35 -0700)]
mesa: make _mesa_draw_buffers() static

Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agomesa: make _mesa_draw_buffer() static
Brian Paul [Tue, 23 Feb 2016 20:34:46 +0000 (13:34 -0700)]
mesa: make _mesa_draw_buffer() static

Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agomesa: make _mesa_read_buffer() static
Brian Paul [Tue, 23 Feb 2016 20:32:21 +0000 (13:32 -0700)]
mesa: make _mesa_read_buffer() static

Not called from any other file.  Remove _mesa_ prefix and update comments.

Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agomesa: move declaration of buffer var in handle_first_current()
Brian Paul [Tue, 23 Feb 2016 20:25:43 +0000 (13:25 -0700)]
mesa: move declaration of buffer var in handle_first_current()

Declare the var in the scopes where it's used.

Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>