mesa.git
7 years agoradeonsi: remove 8 bytes from si_shader_key
Marek Olšák [Thu, 1 Jun 2017 20:37:25 +0000 (22:37 +0200)]
radeonsi: remove 8 bytes from si_shader_key

We can use a union in si_shader_key::mono.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: move PSIZE and CLIPDIST unique IO indices after GENERIC
Marek Olšák [Sun, 28 May 2017 22:40:39 +0000 (00:40 +0200)]
radeonsi: move PSIZE and CLIPDIST unique IO indices after GENERIC

Heaven LDS usage for LS+HS is below. The masks are "outputs_written"
for LS and HS. Note that 32K is the maximum size.

Before:
  heaven_x64: ls=1f1 tcs=1f1, lds=32K
  heaven_x64: ls=31 tcs=31, lds=24K
  heaven_x64: ls=71 tcs=71, lds=28K

After:
  heaven_x64: ls=3f tcs=3f, lds=24K
  heaven_x64: ls=7 tcs=7, lds=13K
  heaven_x64: ls=f tcs=f, lds=17K

All other apps have a similar decrease in LDS usage, because
the "outputs_written" masks are similar. Also, most apps don't write
POSITION in these shader stages, so there is room for improvement.
(tight per-component input/output packing might help even more)

It's unknown whether this improves performance.

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agosvga: Always set the alpha value to 1 when sampling using an XRGB view
Thomas Hellstrom [Tue, 30 May 2017 13:54:38 +0000 (15:54 +0200)]
svga: Always set the alpha value to 1 when sampling using an XRGB view

If the XRGB view is sampling from an ARGB svga format, change
PIPE_SWIZZLE_W to PIPE_SWIZZLE_1 for all channels.
Previously we unconditionally set PIPE_SWIZZLE_1 on the alpha channel which
could be both insufficient and incorrect.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: Fix imported surface view creation
Thomas Hellstrom [Tue, 30 May 2017 13:51:06 +0000 (15:51 +0200)]
svga: Fix imported surface view creation

When deciding to create a view with or without an alpha channel we need to
look at the SVGA3D format and not the PIPE format.

This fixes the glx-tfp piglit test for dri3/xa.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: Set alpha to 1 for non-alpha views
Thomas Hellstrom [Wed, 26 Apr 2017 13:00:38 +0000 (06:00 -0700)]
svga: Set alpha to 1 for non-alpha views

Gallium RGB textures may be backed by imported ARGB svga3d surfaces. In those
and similar cases we need to set the alpha value to 1 when sampling.

Fixes piglit glx::glx-tfp

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: Allow format differences in 16-bit RGBA surface sharing
Thomas Hellstrom [Tue, 30 May 2017 13:02:19 +0000 (15:02 +0200)]
svga: Allow format differences in 16-bit RGBA surface sharing

For the purpose of surface sharing, treat SVGA3D_R5G6B5 and
SVGA3D_B5G6R5_UNORM as identical formats.
This fixes the following piglit tests with dri3/xa:

glx@glx-visuals-depth -pixmap
glx@glx-visuals-stencil -pixmap

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Deepak Singh Rawat <drawat@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agodri/vmwgfx: Disable a couple of glx extensions also for Ubuntu unity / compiz
Thomas Hellstrom [Tue, 16 May 2017 14:25:12 +0000 (07:25 -0700)]
dri/vmwgfx: Disable a couple of glx extensions also for Ubuntu unity / compiz

It appears like the GLX_EXT_buffer_age extension also prevents Compiz /
Ubuntu Unity from performing partial buffer swaps when it otherwise
feels like doing so. So try to get them back again. We also disable
GLX_OML_sync_control since it appears it had a favourable impact on
gnome-shell.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
7 years agodri: Turn of a couple of glx extensions for gnome-shell on vmwgfx.
Thomas Hellstrom [Fri, 5 May 2017 13:26:03 +0000 (06:26 -0700)]
dri: Turn of a couple of glx extensions for gnome-shell on vmwgfx.

Increases performance on vmwgfx since we're avoiding full buffer damage and
since we can't sync to vertical retrace anyway.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/dri: Allow gallium drivers to turn off two GLX extensions
Thomas Hellstrom [Fri, 5 May 2017 13:06:07 +0000 (06:06 -0700)]
st/dri: Allow gallium drivers to turn off two GLX extensions

Allow gallium drivers to turn off GLX_EXT_buffer_age and
GLX_OML_sync_control if needed, using driconf.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agodri: Optionally turn off a couple of GLX extensions based on driconf options
Thomas Hellstrom [Fri, 5 May 2017 12:57:27 +0000 (05:57 -0700)]
dri: Optionally turn off a couple of GLX extensions based on driconf options

With GLX_EXT_buffer_age turned on, gnome-shell will use full-screen damage
with GLX, which severely hurts performance with architectures that emulate
page-flips with copies. Like vmware. We would like to be able to turn off that
extension. Similarly, typically the GLX_OML_sync_control doesn't make much
sense on a virtual architecture since we don't really sync to the host's
vertical retrace. We'd like to be able to turn it off as well.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/dri: Allow dri users to query also driver options
Thomas Hellstrom [Fri, 5 May 2017 12:49:50 +0000 (05:49 -0700)]
st/dri: Allow dri users to query also driver options

There will be situations where we want to control, for example, the
GLX behaviour based on applications and drivers. So allow DRI users access
to the driver options.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: clean up decompress blend state names
Marek Olšák [Tue, 6 Jun 2017 14:28:59 +0000 (16:28 +0200)]
radeonsi: clean up decompress blend state names

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: clean up a misleading statement from the old days
Marek Olšák [Tue, 6 Jun 2017 14:26:49 +0000 (16:26 +0200)]
gallium/radeon: clean up a misleading statement from the old days

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: don't use 1D tiling for Z/S on VI to get TC-compatible HTILE
Marek Olšák [Mon, 5 Jun 2017 17:59:06 +0000 (19:59 +0200)]
radeonsi: don't use 1D tiling for Z/S on VI to get TC-compatible HTILE

It's always good to have fewer decompress blits.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: enable TC-compatible stencil compression on VI
Marek Olšák [Mon, 5 Jun 2017 17:51:38 +0000 (19:51 +0200)]
radeonsi: enable TC-compatible stencil compression on VI

Most things are in place. Ideally we won't see decompress blits for stencil
anymore.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't keep framebuffer state in st_context
Marek Olšák [Sun, 4 Jun 2017 23:22:45 +0000 (01:22 +0200)]
st/mesa: don't keep framebuffer state in st_context

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: cache pipe_surface for GL_FRAMEBUFFER_SRGB changes
Marek Olšák [Sun, 4 Jun 2017 23:08:41 +0000 (01:08 +0200)]
st/mesa: cache pipe_surface for GL_FRAMEBUFFER_SRGB changes

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: use gl_driver_flags::NewFramebufferSRGB
Marek Olšák [Sun, 4 Jun 2017 21:09:44 +0000 (23:09 +0200)]
st/mesa: use gl_driver_flags::NewFramebufferSRGB

also call st_init_driver_flags when st_context is initialized.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: add gl_driver_flags::NewFramebufferSRGB
Marek Olšák [Sun, 4 Jun 2017 21:08:07 +0000 (23:08 +0200)]
mesa: add gl_driver_flags::NewFramebufferSRGB

_NEW_BUFFERS updates too much stuff.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: prevent a race when the previous shader's main part is missing
Marek Olšák [Thu, 1 Jun 2017 17:02:16 +0000 (19:02 +0200)]
radeonsi/gfx9: prevent a race when the previous shader's main part is missing

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: wait for main part compilation of 1st shaders of merged shaders
Marek Olšák [Thu, 1 Jun 2017 16:57:37 +0000 (18:57 +0200)]
radeonsi/gfx9: wait for main part compilation of 1st shaders of merged shaders

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: fix LS scratch buffer support without TCS for GFX9
Marek Olšák [Sat, 27 May 2017 16:49:11 +0000 (18:49 +0200)]
radeonsi/gfx9: fix LS scratch buffer support without TCS for GFX9

LS is merged into TCS. If there is no TCS, LS is merged into fixed-func
TCS. The problem is the fixed-func TCS was ignored by scratch update
functions, so LS didn't have the scratch buffer set up.

Note that Mesa 17.1 doesn't have merged shaders.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: move streamout state update out of si_update_shaders
Marek Olšák [Sat, 27 May 2017 15:52:31 +0000 (17:52 +0200)]
radeonsi: move streamout state update out of si_update_shaders

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: remove dead code in declare_input_fs
Marek Olšák [Wed, 31 May 2017 21:09:33 +0000 (23:09 +0200)]
radeonsi: remove dead code in declare_input_fs

Colors are interpolated in the PS prolog. This was never used.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: move handling of DBG_NO_OPT_VARIANT into si_shader_selector_key
Marek Olšák [Fri, 26 May 2017 23:22:25 +0000 (01:22 +0200)]
radeonsi: move handling of DBG_NO_OPT_VARIANT into si_shader_selector_key

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: use a compiler queue with a low priority for optimized shaders
Marek Olšák [Wed, 31 May 2017 11:18:53 +0000 (13:18 +0200)]
radeonsi: use a compiler queue with a low priority for optimized shaders

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoutil/u_queue: add an option to set the minimum thread priority
Marek Olšák [Wed, 31 May 2017 20:04:29 +0000 (22:04 +0200)]
util/u_queue: add an option to set the minimum thread priority

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: decrease the number of compiler threads to num CPUs - 1
Marek Olšák [Sat, 27 May 2017 10:13:34 +0000 (12:13 +0200)]
radeonsi: decrease the number of compiler threads to num CPUs - 1

Reserve one core for other things (like draw calls).

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: drop unfinished shader compilations when destroying shaders
Marek Olšák [Wed, 31 May 2017 16:02:54 +0000 (18:02 +0200)]
radeonsi: drop unfinished shader compilations when destroying shaders

If we enqueue too many jobs and destroy the GL context, it may take
several seconds before the jobs finish. Just drop them instead.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoutil/u_queue: add a way to remove a job when we just want to destroy it
Marek Olšák [Wed, 31 May 2017 14:44:12 +0000 (16:44 +0200)]
util/u_queue: add a way to remove a job when we just want to destroy it

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agofreedreno/a5xx: set SP_BLEND_CONTROL properly
Rob Clark [Tue, 6 Jun 2017 17:15:02 +0000 (13:15 -0400)]
freedreno/a5xx: set SP_BLEND_CONTROL properly

Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agofreedreno/a5xx: LRZ support
Rob Clark [Sat, 3 Jun 2017 17:36:25 +0000 (13:36 -0400)]
freedreno/a5xx: LRZ support

Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agofreedreno: drop timestamp field
Rob Clark [Sat, 3 Jun 2017 16:53:15 +0000 (12:53 -0400)]
freedreno: drop timestamp field

unused.

Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agofreedreno/a5xx: refactor out helper for LRZ flush
Rob Clark [Sat, 3 Jun 2017 16:42:35 +0000 (12:42 -0400)]
freedreno/a5xx: refactor out helper for LRZ flush

Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agofreedreno: reshuffle FD_MESA_DEBUG bitmask
Rob Clark [Sat, 3 Jun 2017 16:34:28 +0000 (12:34 -0400)]
freedreno: reshuffle FD_MESA_DEBUG bitmask

Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agofreedreno: update generated headers
Rob Clark [Sat, 3 Jun 2017 16:30:36 +0000 (12:30 -0400)]
freedreno: update generated headers

Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agogallium/u_blitter: use 2D_ARRAY for cubemap blits if possible
Marek Olšák [Tue, 30 May 2017 21:52:07 +0000 (23:52 +0200)]
gallium/u_blitter: use 2D_ARRAY for cubemap blits if possible

so that we can use TXF.

The cubemap blit pixel shader code size: 148 -> 92 bytes

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/u_blitter: use TXF if possible
Marek Olšák [Tue, 30 May 2017 20:18:40 +0000 (22:18 +0200)]
gallium/u_blitter: use TXF if possible

This fixes piglit:
    arb_texture_view-rendering-r32ui

TEX (image_sample) flushes denorms to 0 with FP32 textures on GCN, but such
a texture can contain integer data written using an integer render view.
If we do a transfer blit with TEX, denorms are flushed to 0. Luckily,
TXF (image_load) doesn't do that.

TXF also doesn't need to load the sampler state, so blit shaders don't have
to do s_load_dwordx4.

TXF doesn't do CLAMP_TO_EDGE, so it can only be used if the src box is
in bounds, or if we clamp manually (this commit doesn't).

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/u_blitter: use TEX_LZ if it's supported
Marek Olšák [Tue, 30 May 2017 15:07:47 +0000 (17:07 +0200)]
gallium/u_blitter: use TEX_LZ if it's supported

The sampler views always have first_level == last_level.
Now radeonsi doesn't have to use the WQM. (a few SALU removed)

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/util: add _LZ and TXF options to simple shaders
Marek Olšák [Tue, 30 May 2017 17:24:17 +0000 (19:24 +0200)]
gallium/util: add _LZ and TXF options to simple shaders

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/ureg: add TEX/TXF_LZ opcodes to ureg
Marek Olšák [Tue, 30 May 2017 14:48:47 +0000 (16:48 +0200)]
gallium/ureg: add TEX/TXF_LZ opcodes to ureg

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoi965: Use BLORP for all HiZ ops
Jason Ekstrand [Tue, 6 Jun 2017 00:10:24 +0000 (17:10 -0700)]
i965: Use BLORP for all HiZ ops

BLORP has been capable of doing gen8-style HiZ ops for a while now.  We
might as well start using it.  The one downside is that this may cause a
bit more state emission since we still re-emit most things for BLORP.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoblorp: Use FullSurfaceDepthandStencilClear for blorp_hiz_op
Jason Ekstrand [Tue, 6 Jun 2017 00:18:48 +0000 (17:18 -0700)]
blorp: Use FullSurfaceDepthandStencilClear for blorp_hiz_op

The blorp_hiz_op entrypoint always acts on a full subresource of a HiZ
buffer so we can just set the flag unconditionally.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Move the post-HiZ-clear flush/stall to intel_hiz_exec
Jason Ekstrand [Tue, 6 Jun 2017 00:05:02 +0000 (17:05 -0700)]
i965: Move the post-HiZ-clear flush/stall to intel_hiz_exec

This also changes it to be predicated so we only do the flush/stall on
clears and HiZ resolves.  The docs only say it's needed for clears but
empirical evidence says it's also needed for HiZ resolves.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/blorp: Plumb through access to the workaround BO
Jason Ekstrand [Mon, 5 Jun 2017 21:19:28 +0000 (14:19 -0700)]
intel/blorp: Plumb through access to the workaround BO

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101283
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/blorp: Move the depth cache flush outside of BLORP
Nanley Chery [Thu, 27 Apr 2017 23:22:03 +0000 (16:22 -0700)]
anv/blorp: Move the depth cache flush outside of BLORP

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agointel/blorp: Refactor the HiZ op interface
Jason Ekstrand [Mon, 5 Jun 2017 18:32:19 +0000 (11:32 -0700)]
intel/blorp: Refactor the HiZ op interface

This commit does a few things:

 1) Now that BLORP can do HiZ ops on gen8+, drop the gen6 prefix.
 2) Switch parameters to uint32_t to match the rest of blorp.
 3) Take a range of layers and loop internally.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Inline gen6_blorp_exec
Jason Ekstrand [Mon, 5 Jun 2017 18:30:14 +0000 (11:30 -0700)]
i965/blorp: Inline gen6_blorp_exec

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Perform HiZ flush/stall prior to HiZ resolves
Jason Ekstrand [Mon, 5 Jun 2017 18:52:32 +0000 (11:52 -0700)]
i965: Perform HiZ flush/stall prior to HiZ resolves

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Move the pre-depth-clear flush/stalls to intel_hiz_exec
Jason Ekstrand [Mon, 5 Jun 2017 18:49:24 +0000 (11:49 -0700)]
i965: Move the pre-depth-clear flush/stalls to intel_hiz_exec

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Take a layer range in intel_hiz_exec
Jason Ekstrand [Mon, 5 Jun 2017 18:46:22 +0000 (11:46 -0700)]
i965/blorp: Take a layer range in intel_hiz_exec

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/miptree: Store fast clear colors in an isl_color_value
Jason Ekstrand [Sat, 20 May 2017 22:00:42 +0000 (15:00 -0700)]
i965/miptree: Store fast clear colors in an isl_color_value

This commit, out of necessity, makes a number of changes at once:

 1) Changes intel_mipmap_tree to store the clear color for both color
    and depth as an isl_color_value.

 2) Changes the depth/stencil emit code to do the format conversion of
    the depth clear value on Haswell and earlier instead of pulling a
    uint32_t directly from the miptree.

 3) Changes ISL's depth/stencil emit code to perform the format
    conversion of the depth clear value on Haswell and earlier instead
    of assuming that the depth value in the float is pre-converted.

 4) Changes blorp to pass the depth value through as a float.

 5) Changes the Vulkan driver to pass the depth value to blorp as a
    float rather than a uint.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agodri3/GLX: Fix drawable invalidation v2
Thomas Hellstrom [Thu, 1 Jun 2017 10:04:05 +0000 (12:04 +0200)]
dri3/GLX: Fix drawable invalidation v2

A number of internal VMware apitrace traces image comparisons fail with
dri3 because the viewport transformation becomes incorrect after an X
drawable resize. The incorrect viewport transformation sometimes persist
until the second draw-call after a swapBuffer.

Comparing with the dri2 glx code there are a couple of places where dri2
invalidates the drawable in the absence of server-triggered invalidation,
where dri3 doesn't do that. When these invalidation points are added to
dri3, the image comparisons become correct.

v2:
Addressed review comment by Michel Dänzer.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-and-tested-by: Michel Dänzer <michel.daenzer@amd.com>
7 years agoi965: Fix alpha to one with dual color blending.
Kenneth Graunke [Tue, 30 May 2017 05:07:07 +0000 (22:07 -0700)]
i965: Fix alpha to one with dual color blending.

The BLEND_STATE documentation says that alpha to one must be disabled
when dual color blending is enabled.  However, it appears that it simply
fails to override src1 alpha to one.

We can work around this by leaving alpha to one enabled, but overriding
SRC1_ALPHA to ONE and ONE_MINUS_SRC1_ALPHA to ZERO.  This appears to be
what the other driver does, and it looks like it works despite the
documentation saying not to do it.

Fixes spec/ext_framebuffer_multisample/alpha-to-one-dual-src-blend *
Piglit tests.

v2: Add UNUSED to shut up warning on generations which don't use this.

Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agomesa: add KHR_no_error support for glTexSubImage*D()
Samuel Pitoiset [Thu, 1 Jun 2017 10:43:24 +0000 (12:43 +0200)]
mesa: add KHR_no_error support for glTexSubImage*D()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add texsubimage() helper
Samuel Pitoiset [Thu, 1 Jun 2017 10:36:06 +0000 (12:36 +0200)]
mesa: add texsubimage() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: make _mesa_texture_sub_image() static
Samuel Pitoiset [Mon, 5 Jun 2017 12:02:14 +0000 (14:02 +0200)]
mesa: make _mesa_texture_sub_image() static

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: rename texsubimage() to texsubimage_err()
Samuel Pitoiset [Thu, 1 Jun 2017 10:35:34 +0000 (12:35 +0200)]
mesa: rename texsubimage() to texsubimage_err()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glCopyImageSubData()
Samuel Pitoiset [Thu, 1 Jun 2017 09:46:24 +0000 (11:46 +0200)]
mesa: add KHR_no_error support for glCopyImageSubData()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add copy_image_subdata() helper
Samuel Pitoiset [Thu, 1 Jun 2017 09:42:39 +0000 (11:42 +0200)]
mesa: add copy_image_subdata() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add prepare_target() helper
Samuel Pitoiset [Thu, 1 Jun 2017 09:36:13 +0000 (11:36 +0200)]
mesa: add prepare_target() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: rename prepare_target() to prepare_target_err()
Samuel Pitoiset [Thu, 1 Jun 2017 09:35:25 +0000 (11:35 +0200)]
mesa: rename prepare_target() to prepare_target_err()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glBlitNamedFramebuffer()
Samuel Pitoiset [Wed, 31 May 2017 13:57:45 +0000 (15:57 +0200)]
mesa: add KHR_no_error support for glBlitNamedFramebuffer()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add blit_named_framebuffer() helper
Samuel Pitoiset [Mon, 5 Jun 2017 12:18:41 +0000 (14:18 +0200)]
mesa: add blit_named_framebuffer() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glBlitFramebuffer()
Samuel Pitoiset [Wed, 31 May 2017 13:52:57 +0000 (15:52 +0200)]
mesa: add KHR_no_error support for glBlitFramebuffer()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add validate_depth_buffer() helper
Samuel Pitoiset [Mon, 5 Jun 2017 13:32:08 +0000 (15:32 +0200)]
mesa: add validate_depth_buffer() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add validate_stencil_buffer() helper
Samuel Pitoiset [Mon, 5 Jun 2017 13:29:37 +0000 (15:29 +0200)]
mesa: add validate_stencil_buffer() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add validate_color_buffer() helper
Samuel Pitoiset [Mon, 5 Jun 2017 13:12:36 +0000 (15:12 +0200)]
mesa: add validate_color_buffer() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: wrap blit_framebuffer() into blit_framebuffer_err()
Samuel Pitoiset [Tue, 6 Jun 2017 12:32:08 +0000 (14:32 +0200)]
mesa: wrap blit_framebuffer() into blit_framebuffer_err()

Also add ALWAYS_INLINE to blit_framebuffer().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add 'no_error' parameter to blit_framebuffer()
Samuel Pitoiset [Mon, 5 Jun 2017 13:03:30 +0000 (15:03 +0200)]
mesa: add 'no_error' parameter to blit_framebuffer()

The whole GLES3 block has been moved before the buffer validation
checks.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: make _mesa_blit_framebuffer() static
Samuel Pitoiset [Wed, 31 May 2017 13:41:30 +0000 (15:41 +0200)]
mesa: make _mesa_blit_framebuffer() static

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glBindBuffer()
Samuel Pitoiset [Wed, 31 May 2017 12:26:20 +0000 (14:26 +0200)]
mesa: add KHR_no_error support for glBindBuffer()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glInvalidateBufferData()
Samuel Pitoiset [Wed, 31 May 2017 12:18:00 +0000 (14:18 +0200)]
mesa: add KHR_no_error support for glInvalidateBufferData()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glInvalidateBufferSubData()
Samuel Pitoiset [Wed, 31 May 2017 12:15:37 +0000 (14:15 +0200)]
mesa: add KHR_no_error support for glInvalidateBufferSubData()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add invalidate_buffer_subdata() helper
Samuel Pitoiset [Wed, 31 May 2017 12:14:55 +0000 (14:14 +0200)]
mesa: add invalidate_buffer_subdata() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glBindVertexBuffers()
Samuel Pitoiset [Wed, 31 May 2017 10:42:39 +0000 (12:42 +0200)]
mesa: add KHR_no_error support for glBindVertexBuffers()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glVertexArrayVertexBuffers()
Samuel Pitoiset [Wed, 31 May 2017 10:39:44 +0000 (12:39 +0200)]
mesa: add KHR_no_error support for glVertexArrayVertexBuffers()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add vertex_array_vertex_buffers_err() helper
Samuel Pitoiset [Wed, 31 May 2017 10:35:25 +0000 (12:35 +0200)]
mesa: add vertex_array_vertex_buffers_err() helper

This also adds a 'no_error' parameter to vertex_array_vertex_buffer()
to be used in a following patch.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glScissor*()
Samuel Pitoiset [Tue, 6 Jun 2017 19:58:29 +0000 (21:58 +0200)]
mesa: add KHR_no_error support for glScissor*()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add scissor() and scissor_array() helpers
Samuel Pitoiset [Tue, 6 Jun 2017 19:58:28 +0000 (21:58 +0200)]
mesa: add scissor() and scissor_array() helpers

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: rename ScissorIndexed() to scissor_indexed_err()
Samuel Pitoiset [Tue, 6 Jun 2017 19:58:27 +0000 (21:58 +0200)]
mesa: rename ScissorIndexed() to scissor_indexed_err()

And move GET_CURRENT_CONTEXT() into the APIENTRY calls
for consistency.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: use _mesa_set_scissor() in ScissorIndexed()
Samuel Pitoiset [Tue, 6 Jun 2017 19:58:26 +0000 (21:58 +0200)]
mesa: use _mesa_set_scissor() in ScissorIndexed()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: make _mesa_scissor_bounding_box() static
Samuel Pitoiset [Tue, 6 Jun 2017 19:58:25 +0000 (21:58 +0200)]
mesa: make _mesa_scissor_bounding_box() static

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: inline update_image_transfer_state() into _mesa_update_pixel()
Samuel Pitoiset [Tue, 6 Jun 2017 20:58:13 +0000 (22:58 +0200)]
mesa: inline update_image_transfer_state() into _mesa_update_pixel()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: remove useless check in _mesa_update_pixel()
Samuel Pitoiset [Tue, 6 Jun 2017 20:58:12 +0000 (22:58 +0200)]
mesa: remove useless check in _mesa_update_pixel()

The only caller is _mesa_update_state_locked() which already
checks if _NEW_PIXEL is set before calling _mesa_update_pixel().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglcpp: fix #undef to match latest spec update and GLSLang implementation
Iago Toral Quiroga [Tue, 30 May 2017 11:25:35 +0000 (13:25 +0200)]
glcpp: fix #undef to match latest spec update and GLSLang implementation

GLSL ES spec includes the following:

   "It is an error to undefine or to redefine a built-in
    (pre-defined) macro name."

But desktop GLSL doesn't. This has sparked some discussion
in Khronos, and the final conclusion was to update the
GLSL 4.50 spec to include the following:

   "By convention, all macro names containing two consecutive
    underscores ( __ ) are reserved for use by underlying
    software layers.  Defining or undefining such a name in a
    shader does not itself result in an error, but may result
    in unintended behaviors that stem from having multiple
    definitions of the same name.  All macro names prefixed
    with “GL_” (“GL” followed by a single underscore) are also
    reserved, and defining or undefining such a name results in
    a compile-time error."

In other words, undefining GL_* names should be an error, but
undefining other names with a double underscore in them is
not strictly prohibited in desktop GLSL.

This patch fixes the preprocessor to apply these rules,
following exactly the implementation already present
in GLSLang. This fixes some tests in CTS.

Khronos bug:
https://cvs.khronos.org/bugzilla/show_bug.cgi?id=16003

Fixes:
KHR-GL45.shaders.preprocessor.definitions.undefine_core_profile_vertex
KHR-GL45.shaders.preprocessor.definitions.undefine_core_profile_fragment

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agoac/nir: move gpr counting inside argument handling.
Dave Airlie [Mon, 5 Jun 2017 20:20:33 +0000 (21:20 +0100)]
ac/nir: move gpr counting inside argument handling.

This just moves this code in here to it's cleaner.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoac/nir: assign argument param pointers in one place.
Dave Airlie [Mon, 5 Jun 2017 20:11:05 +0000 (21:11 +0100)]
ac/nir: assign argument param pointers in one place.

Instead of having the fragile code to do a second pass, just
give the pointers you want params in to the initial code,
then call a later pass to assign them.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoac/nir: consolidate setting userdata location
Dave Airlie [Mon, 5 Jun 2017 06:51:07 +0000 (07:51 +0100)]
ac/nir: consolidate setting userdata location

Just pass a pointer and increment inside the function,
makes the code less error prone.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoglthread: remove extra _mesa_glthread_finish() from generated code
Timothy Arceri [Tue, 6 Jun 2017 05:08:16 +0000 (15:08 +1000)]
glthread: remove extra _mesa_glthread_finish() from generated code

The other user of print_sync_dispatch() was ending up with code that
looked like:

      _mesa_glthread_finish(ctx);
      _mesa_glthread_restore_dispatch(ctx);
      _mesa_glthread_finish(ctx);

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agointel: Fix broxton 2x6 way size computation
Anuj Phogat [Tue, 6 Jun 2017 23:14:19 +0000 (16:14 -0700)]
intel: Fix broxton 2x6 way size computation

This patch is undoing the changes to way size computation
in broxton 2x6, made by below commit:

Commit: 0d576fbfbe912cf3fb9ab594bb31eb58bccf2138
Author:     Anuj Phogat <anuj.phogat@gmail.com>
i965: Simplify l3 way size computations

By making use of l3_banks field in gen_device_info struct
l3_way_size for gen7+ = 2 * l3_banks.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101306
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Tested-by: Mark Janes <mark.a.janes@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoradv: move chip_class extraction down further.
Dave Airlie [Tue, 6 Jun 2017 23:34:28 +0000 (09:34 +1000)]
radv: move chip_class extraction down further.

This seems to matter here in a profile, without this we spend a lot
more time exiting this function with no flush bits.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: move lots of index related things into the bind.
Dave Airlie [Tue, 6 Jun 2017 23:14:54 +0000 (09:14 +1000)]
radv: move lots of index related things into the bind.

This just moves lots of stuff to the bind stage rather than
dealing with it in the draw stage.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: move calculating the vertex sgpr to the pipeline.
Dave Airlie [Tue, 6 Jun 2017 23:04:30 +0000 (09:04 +1000)]
radv: move calculating the vertex sgpr to the pipeline.

There is no need to calculate this at draw time.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: rename and make global some functions.
Dave Airlie [Tue, 6 Jun 2017 23:01:38 +0000 (09:01 +1000)]
radv: rename and make global some functions.

I want to use these in the pipeline setup stage.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agotree-wide: remove trailing backslash
Eric Engestrom [Thu, 1 Jun 2017 13:48:06 +0000 (14:48 +0100)]
tree-wide: remove trailing backslash

Simple search for a backslash followed by two newlines.
If one of the newlines were to be removed, this would cause issues, so
let's just remove these trailing backslashes.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
7 years agoradv/gfx9: use correct register setting for uconfig regs
Dave Airlie [Tue, 6 Jun 2017 22:09:03 +0000 (08:09 +1000)]
radv/gfx9: use correct register setting for uconfig regs

Thanks to Marek for pointing this out.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Remove SI num RB override for occlusion queries.
Bas Nieuwenhuizen [Tue, 6 Jun 2017 20:03:49 +0000 (22:03 +0200)]
radv: Remove SI num RB override for occlusion queries.

radeonsi doesn't have it anymore either.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Fixes: f4e499ec791 "radv: add initial non-conformant radv vulkan driver"
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Split out updating the vertex descriptors.
Bas Nieuwenhuizen [Tue, 6 Jun 2017 19:52:15 +0000 (21:52 +0200)]
radv: Split out updating the vertex descriptors.

Simple refactor.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Move pipeline stuff from flush_state to emit_graphics_pipeline.
Bas Nieuwenhuizen [Tue, 6 Jun 2017 19:39:42 +0000 (21:39 +0200)]
radv: Move pipeline stuff from flush_state to emit_graphics_pipeline.

No functional changes.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>