mesa.git
8 years agoi965/fs: Get rid of fs_visitor::do_dual_src.
Francisco Jerez [Thu, 21 Jul 2016 19:46:04 +0000 (12:46 -0700)]
i965/fs: Get rid of fs_visitor::do_dual_src.

This boolean flag was being used for two different things:

 - To set the brw_wm_prog_data::dual_src_blend flag.  Instead we can
   just set it based on whether the dual_src_output register is valid,
   which will be the case if the shader writes the secondary blending
   color.

 - To decide whether to call emit_single_fb_write() once, or in a loop
   that would iterate only once, which seems pretty useless.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonir: Handle FB fetch outputs correctly in nir_lower_io_to_temporaries.
Francisco Jerez [Wed, 20 Jul 2016 03:35:26 +0000 (20:35 -0700)]
nir: Handle FB fetch outputs correctly in nir_lower_io_to_temporaries.

This requires emitting a series of copies at the top of the program
from each output variable to the corresponding temporary.  The initial
copy can be skipped for non-framebuffer fetch outputs whose initial
value is undefined, and the final copy needs to be skipped for
read-only outputs (i.e. gl_LastFragData), since it would be illegal to
emit a store output intrinsic for it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonir: Pass through fb_fetch_output and OutputsRead from GLSL IR.
Francisco Jerez [Wed, 20 Jul 2016 03:33:46 +0000 (20:33 -0700)]
nir: Pass through fb_fetch_output and OutputsRead from GLSL IR.

The NIR representation of framebuffer fetch is the same as the GLSL
IR's until interface variables are lowered away, at which point it
will be translated to load output intrinsics.  The GLSL-to-NIR pass
just needs to copy the bits over to the NIR program.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agovc4: Add support for fddx/fddy
Eric Anholt [Thu, 25 Aug 2016 19:32:19 +0000 (12:32 -0700)]
vc4: Add support for fddx/fddy

Based vaguely on a patch by jonasarrow on github.

8 years agovc4: Add register allocation support for MUL output rotation.
Eric Anholt [Thu, 25 Aug 2016 21:32:47 +0000 (14:32 -0700)]
vc4: Add register allocation support for MUL output rotation.

We need the source to be in r0-r3, so make a new register class for it.
It will be up to the surrounding passes to make sure that the r0-r3
allocation of its source won't conflict with anything other class
requirements on that temp.

8 years agovc4: Add support for MUL output rotation.
Eric Anholt [Thu, 25 Aug 2016 19:31:49 +0000 (12:31 -0700)]
vc4: Add support for MUL output rotation.

Extracted from a patch by jonasarrow on github.

8 years agovc4: Add support for the 2-bit LOAD_IMM variants.
Eric Anholt [Thu, 25 Aug 2016 19:15:29 +0000 (12:15 -0700)]
vc4: Add support for the 2-bit LOAD_IMM variants.

Extracted and fixed up from a patch by jonasarrow on github.  This ended
up not getting used for ddx/ddy, but seems like it might still be useful.

8 years agovc4: Add QPU scheduling to handle MUL rotate sources.
Eric Anholt [Thu, 25 Aug 2016 20:40:27 +0000 (13:40 -0700)]
vc4: Add QPU scheduling to handle MUL rotate sources.

We need MUL rotates to do ddx/ddy support.

8 years agovc4: Add disassembly for constant MUL rotates
Eric Anholt [Thu, 25 Aug 2016 20:26:50 +0000 (13:26 -0700)]
vc4: Add disassembly for constant MUL rotates

8 years agovc4: Add real validation for MUL rotation.
Eric Anholt [Thu, 25 Aug 2016 20:21:58 +0000 (13:21 -0700)]
vc4: Add real validation for MUL rotation.

Caught problems in the upcoming DDX/DDY implementation.

8 years agovc4: Add a QIR value for the QPU element register.
Eric Anholt [Thu, 25 Aug 2016 20:48:21 +0000 (13:48 -0700)]
vc4: Add a QIR value for the QPU element register.

This will be used in the ddx/ddy support for "Am I the top half?" or "Am I
the left half?" checks.

8 years agoi965: Respect miptree offsets in intel_readpixels_tiled_memcpy()
Chad Versace [Thu, 25 Aug 2016 23:08:27 +0000 (16:08 -0700)]
i965: Respect miptree offsets in intel_readpixels_tiled_memcpy()

Respect intel_miptree_slice::x_offset,y_offset and
intel_mipmap_tree::offset. All three may be non-zero when glReadPixels
is called on an EGLImage created from the non-base slice of a miptree.

Patch 2/2 that fixes test
'dEQP-EGL.functional.image.create.gles2_cubemap_*'.

Reported-by: Haixia Shi <hshi@chromium.org>
Diagnosed-by: Haixia Shi <hshi@chromium.org>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Change-Id: I4b397b27e55a743a7094d29fb0a6a4b6b34352b0

8 years agoi965: Fix miptree layout for EGLImage-based renderbuffers
Chad Versace [Thu, 25 Aug 2016 23:08:15 +0000 (16:08 -0700)]
i965: Fix miptree layout for EGLImage-based renderbuffers

When glEGLImageTargetRenderbufferStorageOES() was given an EGLImage
created from the non-base slice of a miptree,
intel_image_target_renderbuffer_storage() forgot to apply the intra-tile
offsets __DRIimage::tile_x,tile_y to the miptree layout.

This patch fixes the problem with a quick hack suitable for
cherry-picking. A proper fix requires more thorough plumbing in
intel_miptree_create_layout() and brw_tex_layout().

Patch 1/2 that fixes test
'dEQP-EGL.functional.image.create.gles2_cubemap_*'.

Reported-by: Haixia Shi <hshi@chromium.org>
Diagnosed-by: Haixia Shi <hshi@chromium.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
Change-Id: I8a64b0048a1ee9e714ebb3f33fffd8334036450b

8 years agointel: Flatten the makefile structure
Jason Ekstrand [Mon, 22 Aug 2016 21:10:46 +0000 (14:10 -0700)]
intel: Flatten the makefile structure

This pulls isl and genxml into a single make file so that they can properly
build in parallel.  This isn't terribly important now as genxml just
generates sources which happens serially first anyway but it will be more
important as we add more stuff to src/intel.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoisl/tests: Use a longer path for isl.h
Jason Ekstrand [Mon, 22 Aug 2016 21:24:01 +0000 (14:24 -0700)]
isl/tests: Use a longer path for isl.h

The tests assumed that isl would be in the include path but that usually
isn't the case.  Instead, we usually have src/intel and you need to add an
"isl/" prefix.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agointel/isl/gen9: Only use the magic 1D alignment for GEN9_1D surfaces
Jason Ekstrand [Wed, 24 Aug 2016 04:46:58 +0000 (21:46 -0700)]
intel/isl/gen9: Only use the magic 1D alignment for GEN9_1D surfaces

If the surface has a layout of GEN4_2D then we need to compute a normal 2D
alignment and not use the magic linewar 1D alignment.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
8 years agointel/isl: Pass the dim_layout into choose_alignment_el
Jason Ekstrand [Wed, 24 Aug 2016 04:46:23 +0000 (21:46 -0700)]
intel/isl: Pass the dim_layout into choose_alignment_el

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
8 years agointel/isl: Use DIM_LAYOUT_GEN4_2D for tiled 1-D surfaces on SKL
Jason Ekstrand [Wed, 24 Aug 2016 04:35:36 +0000 (21:35 -0700)]
intel/isl: Use DIM_LAYOUT_GEN4_2D for tiled 1-D surfaces on SKL

The Sky Lake 1D layout is only used if the surface is linear.  For tiled
surfaces such as depth and stencil the old gen4 2D layout is used.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
8 years agonir/phi_builder: Don't recurse in value_get_block_def
Jason Ekstrand [Thu, 25 Aug 2016 04:49:10 +0000 (21:49 -0700)]
nir/phi_builder: Don't recurse in value_get_block_def

In some programs, we can have very deep dominance trees and the recursion
can cause us to risk stack overflows.  Instead, we replace the recursion
with a pair of loops, one at the start and one at the end.  This is
functionally equivalent to what we had before and it's actually a bit
easier to read in the new form without the recursion.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97225
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years ago.mailmap: Update my address again
Chad Versace [Thu, 25 Aug 2016 20:54:47 +0000 (13:54 -0700)]
.mailmap: Update my address again

I joined Google's Chrome OS graphics team.

8 years agonir: Walk blocks in source code order in lower_vars_to_ssa.
Matt Turner [Thu, 25 Aug 2016 02:25:58 +0000 (19:25 -0700)]
nir: Walk blocks in source code order in lower_vars_to_ssa.

Prior to this commit rename_variables_block() is recursively called,
performing a depth-first traversal of the control flow graph. The
function uses a non-trivial amount of stack space for local variables,
which puts us in danger of smashing the stack, given a sufficiently deep
dominance tree.

XCOM: Enemy Within contains a shader with such a dominance tree (1574
nir_blocks in total, depth of at least 143).

Jason tells me that he believes that any walk over the nir_blocks that
respects dominance is sufficient (a DFS might have been necessary prior
to the introduction of nir_phi_builder).

In fact, the introduction of nir_phi_builder made the problem worse:
rename_variables_block(), walks to the bottom of the dominance tree
before calling nir_phi_builder_value_get_block_def() which walks back to
the top of the dominance tree...

In any case, this patch ensures we avoid that problem as well.

Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97225
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agoradeonsi: don't use allocas for arrays with LLVM 3.8
Marek Olšák [Thu, 25 Aug 2016 18:22:59 +0000 (20:22 +0200)]
radeonsi: don't use allocas for arrays with LLVM 3.8

It crashes.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97413

8 years agogallium/radeon: unify and simplify checking for an empty gfx IB
Marek Olšák [Wed, 24 Aug 2016 23:26:54 +0000 (01:26 +0200)]
gallium/radeon: unify and simplify checking for an empty gfx IB

We can take advantage of the fact that multi_fence does the obvious thing
with NULL fences.

This fixes unflushed fences that can get stuck due to empty IBs.

8 years agomesa: Drop sed of now dead Plo files.
Matt Turner [Thu, 25 Aug 2016 18:19:55 +0000 (11:19 -0700)]
mesa: Drop sed of now dead Plo files.

gen6/7/8_blorp.c were removed in commits c8bc1ae96ae198983c61, and
16a9fcbbb6 respectively.

8 years agometa: Always do GenerateMipmaps in linear colorspace.
Kenneth Graunke [Fri, 12 Aug 2016 21:48:54 +0000 (14:48 -0700)]
meta: Always do GenerateMipmaps in linear colorspace.

When generating mipmaps for sRGB textures, force both decode and encode,
so the filtering is done in linear colorspace, regardless of settings.

Fixes a WebGL conformance test in Chrome:
https://www.khronos.org/registry/webgl/sdk/tests/conformance2/textures/misc/tex-srgb-mipmap.html?webglVersion=2

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97322
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agoconfigure.ac: raise Mako required version to 0.8.0
Eric Engestrom [Tue, 19 Jul 2016 12:41:36 +0000 (13:41 +0100)]
configure.ac: raise Mako required version to 0.8.0

It seems [0] old versions of Mako are no longer supported. Emil mentioned it
might need v0.8.0 [1] for isl_format_layout [2], although I didn't get
a confirmation that it's really the minimum.
Let's raise it to that to avoid getting other bugs.
We might lower it a bit again later if it turns out we can.

[0] https://lists.freedesktop.org/archives/mesa-dev/2016-July/122772.html
[1] https://lists.freedesktop.org/archives/mesa-dev/2016-July/122775.html
[2] https://lists.freedesktop.org/archives/mesa-dev/2016-July/123278.html

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Dave Airlie <Airlied@redhat.com>
8 years agoswrast: fix incorrectly positioned putImage() in swrast driver
Brian Paul [Wed, 24 Aug 2016 14:52:29 +0000 (08:52 -0600)]
swrast: fix incorrectly positioned putImage() in swrast driver

Some front buffer rendering was in the wrong position.  This included
scissored clears, glDrawPixels and glCopyPixels.  The problem was the
y coordinate passed to putImage() didn't match the y coordinate passed
to getImage().

We fix this by setting xrb->map_y to the inverted coordinate in
swrast_map_renderbuffer() which is used later by the putImage() call.
Also pass xrb->map_y to getImage() to be symmetric.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97426
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoradeonsi: disable SDMA texture copying on Carrizo
Marek Olšák [Wed, 24 Aug 2016 21:34:01 +0000 (23:34 +0200)]
radeonsi: disable SDMA texture copying on Carrizo

Cc: 12.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agogallium/noop: use 3-space indentation
Marek Olšák [Sun, 21 Aug 2016 10:41:29 +0000 (12:41 +0200)]
gallium/noop: use 3-space indentation

Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agogallium: add a pipe_context parameter to resource_get_handle
Marek Olšák [Sun, 21 Aug 2016 10:24:59 +0000 (12:24 +0200)]
gallium: add a pipe_context parameter to resource_get_handle

radeonsi needs to do some operations (DCC decompression) for OpenGL-OpenCL
interop and this is the only way to make it coherent with the current
context. It can optionally be set to NULL.

Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agost/mesa: fix sRGB BlitFramebuffer regression
Nicolai Hähnle [Thu, 11 Aug 2016 11:06:47 +0000 (13:06 +0200)]
st/mesa: fix sRGB BlitFramebuffer regression

Broken since: 3190c7ee9727161d627f107c2e7f8ec3a11941c1

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97285

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agoloader/dri3: Overhaul dri3_update_num_back
Michel Dänzer [Wed, 17 Aug 2016 08:02:04 +0000 (17:02 +0900)]
loader/dri3: Overhaul dri3_update_num_back

Always use 3 buffers when flipping. With only 2 buffers, we have to wait
for a flip to complete (which takes non-0 time even with asynchronous
flips) before we can start working on the next frame. We were previously
only using 2 buffers for flipping if the X server supports asynchronous
flips, even when we're not using asynchronous flips. This could result
in bad performance (the referenced bug report is an extreme case, where
the inter-frame stalls were preventing the GPU from reaching its maximum
clocks).

I couldn't measure any performance boost using 4 buffers with flipping.
Performance actually seemed to go down slightly, but that might have
been just noise.

Without flipping, a single back buffer is enough for swap interval 0,
but we need to use 2 back buffers when the swap interval is non-0,
otherwise we have to wait for the swap interval to pass before we can
start working on the next frame. This condition was previously reversed.

Cc: "12.0 11.2" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97260
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoanv: Include the pipeline layout in the shader hash
Jason Ekstrand [Thu, 25 Aug 2016 00:14:11 +0000 (17:14 -0700)]
anv: Include the pipeline layout in the shader hash

The pipeline layout affects shader compilation because it is what
determines binding table locations as well as whether or not a particular
buffer has dynamic offsets.  Since this affects the generated shader, it
needs to be in the hash.  This fixes a bunch of CTS tests now that the CTS
is using a pipeline cache.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
8 years agoanv: Add a --disable-vulkan-icd-full-driver-path option
Jason Ekstrand [Tue, 23 Aug 2016 01:11:41 +0000 (18:11 -0700)]
anv: Add a --disable-vulkan-icd-full-driver-path option

This option makes installed Vulkan ICD files contain only a driver library
name and not a path.  This is intended for distros to help them work around
multi-arch issues.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoi965/fs: Don't consider the stencil output to be a color output.
Francisco Jerez [Tue, 23 Aug 2016 01:50:41 +0000 (18:50 -0700)]
i965/fs: Don't consider the stencil output to be a color output.

This would cause gl_FragStencilRef to be counted as a color output
incorrectly during the precompile phase, which leads to unnecessary
recompilation on master and could trigger an assertion failure in
fs_visitor::emit_fb_writes() on my i965-fb-fetch branch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: Keep track of the set of fragment outputs read by a GL program.
Francisco Jerez [Wed, 20 Jul 2016 03:30:24 +0000 (20:30 -0700)]
glsl: Keep track of the set of fragment outputs read by a GL program.

This is the set of shader outputs whose initial value is provided to
the shader by some external means when the shader is executed, rather
than computed by the shader itself.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: Don't consider read-only fragment outputs to be written to.
Francisco Jerez [Wed, 20 Jul 2016 03:29:55 +0000 (20:29 -0700)]
glsl: Don't consider read-only fragment outputs to be written to.

Since they cannot be written.  This prevents adding fragment outputs
to the OutputsWritten set that are only read from via the
gl_LastFragData array but never written to.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl/linker: Allow fragment output overlap for gl_LastFragData.
Francisco Jerez [Thu, 14 Jul 2016 19:57:14 +0000 (12:57 -0700)]
glsl/linker: Allow fragment output overlap for gl_LastFragData.

gl_LastFragData overlaps gl_FragData by definition.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl/ast: Allow redeclaration of gl_LastFragData with different precision qualifier.
Francisco Jerez [Thu, 14 Jul 2016 19:52:51 +0000 (12:52 -0700)]
glsl/ast: Allow redeclaration of gl_LastFragData with different precision qualifier.

v2: No need to check the GLSL version. (Ken)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: Don't attempt to do dead varying elimination on gl_LastFragData arrays.
Francisco Jerez [Wed, 20 Jul 2016 03:23:17 +0000 (20:23 -0700)]
glsl: Don't attempt to do dead varying elimination on gl_LastFragData arrays.

Apparently this pass can only handle elimination of a single built-in
fragment output array, so the presence of gl_LastFragData (which it
wouldn't split correctly anyway) could prevent it from splitting the
actual gl_FragData array.  Just match gl_FragData by name since it's
the only built-in it can handle.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: Define a gl_LastFragData built-in for older GLSL versions.
Francisco Jerez [Wed, 20 Jul 2016 03:11:53 +0000 (20:11 -0700)]
glsl: Define a gl_LastFragData built-in for older GLSL versions.

The EXT_shader_framebuffer_fetch extension defines alternative
language for GLES2 shaders where user-defined fragment outputs are not
allowed.  Instead of using inout user-defined fragment outputs the
shader is expected to read from the gl_LastFragData built-in array.
In addition this allows using the same language on desktop GLSL
versions prior to 4.2 that support the deprecated gl_FragData built-in
in preparation for the MESA_shader_framebuffer_fetch desktop GL
extension.

Both legacy and user-defined inout outputs have a common
representation at the GLSL IR level, so it shouldn't make any
difference for optimization passes and back-ends whether the
application is using gl_LastFragData or user-defined outputs, all
they'll see is a variable dereference of a fragment output at a
certain interface location with the fb_fetch_output bit set to one.

v2: Don't define the built-in variable on GLSL versions for which
    gl_FragData exists but is deprecated. (Ken)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: Handle the inout qualifier in fragment shader output declarations.
Francisco Jerez [Wed, 20 Jul 2016 03:10:21 +0000 (20:10 -0700)]
glsl: Handle the inout qualifier in fragment shader output declarations.

According to the EXT_shader_framebuffer_fetch extension the inout
qualifier can be used on ESSL 3.0+ shaders to declare a special kind
of fragment output that gets implicitly initialized with the previous
framebuffer contents at the current fragment coordinates.  In addition
we allow using the same language to define FB fetch outputs in GLSL
1.3+ shaders in preparation for the desktop MESA_shader_framebuffer_fetch
extensions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: Add support for representing framebuffer fetch in the GLSL IR.
Francisco Jerez [Wed, 20 Jul 2016 03:07:47 +0000 (20:07 -0700)]
glsl: Add support for representing framebuffer fetch in the GLSL IR.

The GLSL IR representation of framebuffer fetch amounts to a single
bit in the ir_variable object applicable to fragment shader outputs.
The flag indicates that the variable will be implicitly initialized to
the previous contents of the render buffer at the same fragment
coordinates and sample index.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: Add parser state enables for the framebuffer fetch extensions.
Francisco Jerez [Tue, 26 Jul 2016 00:24:52 +0000 (17:24 -0700)]
glsl: Add parser state enables for the framebuffer fetch extensions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agomesa: Add blend barrier entry point and driver hook.
Francisco Jerez [Wed, 6 Jul 2016 06:21:21 +0000 (23:21 -0700)]
mesa: Add blend barrier entry point and driver hook.

Both MESA_shader_framebuffer_fetch_non_coherent and the non-coherent
variant of KHR_blend_equation_advanced will use this driver hook to
request coherency between framebuffer reads and writes.  This
intentionally doesn't hook up glBlendBarrierMESA to the dispatch layer
since the extension isn't exposed to applications yet, see [1]
for more details.

[1] https://lists.freedesktop.org/archives/mesa-dev/2016-July/124028.html

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agomesa: Move shader memory barrier functions into barrier.c.
Francisco Jerez [Wed, 6 Jul 2016 06:18:18 +0000 (23:18 -0700)]
mesa: Move shader memory barrier functions into barrier.c.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agomesa: Rename "texturebarrier" source files to "barrier".
Francisco Jerez [Wed, 6 Jul 2016 06:15:01 +0000 (23:15 -0700)]
mesa: Rename "texturebarrier" source files to "barrier".

In preparation for collecting all pipeline barrier GL entry points
into a single source file.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agomesa: Add support for querying GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT.
Francisco Jerez [Wed, 6 Jul 2016 04:28:11 +0000 (21:28 -0700)]
mesa: Add support for querying GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT.

This can currently only give true as result since the only way you can
expose EXT_shader_framebuffer_fetch right now is by flipping the
MESA_shader_framebuffer_fetch bit, but that could potentially change
in the future, see [1] for an explanation.

[1] https://lists.freedesktop.org/archives/mesa-dev/2016-July/124028.html

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agomesa: Add extension enables for framebuffer fetch extensions.
Francisco Jerez [Wed, 20 Jul 2016 00:40:05 +0000 (17:40 -0700)]
mesa: Add extension enables for framebuffer fetch extensions.

This allows drivers to expose EXT_shader_framebuffer_fetch in GLES2+
contexts if desired.  Note that this adds boolean flags for two MESA
extensions, but only the EXT GLES-only extension is exposed for the
moment, see the cover letter of this series [1] for the rationale.

[1] https://lists.freedesktop.org/archives/mesa-dev/2016-July/124028.html

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglapi: Add XML for GL_EXT_shader_framebuffer_fetch.
Francisco Jerez [Wed, 6 Jul 2016 04:25:56 +0000 (21:25 -0700)]
glapi: Add XML for GL_EXT_shader_framebuffer_fetch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonvc0: invalidate textures/samplers on GK104+
Samuel Pitoiset [Wed, 24 Aug 2016 18:22:52 +0000 (20:22 +0200)]
nvc0: invalidate textures/samplers on GK104+

Like Fermi, textures and samplers are aliased between 3D and compute,
especially the TIC_FLUSH/TSC_FLUSH methods and we have to re-validate
these resources when switching between the two pipelines.

This fixes a GPU hang with Elemental (and most likely with other UE4 demos).

Tested on GK107 and GM107.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
CC: <mesa-stable@lists.freedesktop.org>
8 years agogallium/ttn: Remove duplicated TGSI_OPCODE_DP2A initialization
Rhys Kidd [Wed, 24 Aug 2016 04:13:04 +0000 (00:13 -0400)]
gallium/ttn: Remove duplicated TGSI_OPCODE_DP2A initialization

Duplicate line is currently on 1535.

Identified by Clang, when run through Eric Anholt's Travis harness.

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agotravis: Upgrade LLVM dependency to 3.5 and enable LLVM drivers.
Eric Anholt [Thu, 18 Aug 2016 21:10:57 +0000 (14:10 -0700)]
travis: Upgrade LLVM dependency to 3.5 and enable LLVM drivers.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Rhys Kidd <rhyskidd@gmail.com>
8 years agotravis: Enable vc4 in libdrm to satisfy vc4 test build dependency.
Eric Anholt [Thu, 18 Aug 2016 20:43:12 +0000 (13:43 -0700)]
travis: Enable vc4 in libdrm to satisfy vc4 test build dependency.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Rhys Kidd <rhyskidd@gmail.com>
8 years agotravis: Update to the Ubuntu Trusty image.
Eric Anholt [Thu, 18 Aug 2016 20:12:18 +0000 (13:12 -0700)]
travis: Update to the Ubuntu Trusty image.

This will hopefully fix wget from x.org (no real reason explained in
Travis CI bug reports), and may also mean that we can enable LLVM driver
builds.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Rhys Kidd <rhyskidd@gmail.com>
8 years agotravis: Parse configure.ac to pick an updated LIBDRM_VERSION.
Eric Anholt [Thu, 18 Aug 2016 19:29:31 +0000 (12:29 -0700)]
travis: Parse configure.ac to pick an updated LIBDRM_VERSION.

Travis has been broken a couple of times by configure.ac updates.  To make
it useful, auto-update the version necessary.

This could potentially be used for other dependencies, too, but those get
bumped less frequently.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Rhys Kidd <rhyskidd@gmail.com>
8 years agoanv: meta_blit2d: adapt texel fetch pitch for fake w-tiled
Lionel Landwerlin [Wed, 24 Aug 2016 16:52:12 +0000 (17:52 +0100)]
anv: meta_blit2d: adapt texel fetch pitch for fake w-tiled

We need to compute detiling coordinates using the physical size of W tiling
(128x32) rather than the logical size (64x64).

v2: Correct comment (Jason)

Fixes dEQP-VK.api.copy_and_blit.image_to_image_stencil

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97448
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agovc4: Fix GPU hangs with >16 varying values.
Eric Anholt [Mon, 22 Aug 2016 21:58:28 +0000 (14:58 -0700)]
vc4: Fix GPU hangs with >16 varying values.

Fixes glsl-routing in piglit and hangs in glbenchmark 2.0.2.

8 years agovl/rbsp: fix another three byte not detected
Leo Liu [Mon, 22 Aug 2016 16:05:53 +0000 (12:05 -0400)]
vl/rbsp: fix another three byte not detected

This happens when three byte "00 00 03" is partly loaded to
vlc->buffer, thus at the bottom of buffer with valid bits is
"00" or "00 00" and left  like "00 03" or "03" in the data,
so that it will not be detected by three byte emulation check.
The reason for that is the escaped bit was set to 0 from the
rbsp init.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
8 years agoradeonsi: fix VM faults due NULL internal const buffers on CIK
Marek Olšák [Thu, 18 Aug 2016 13:25:51 +0000 (15:25 +0200)]
radeonsi: fix VM faults due NULL internal const buffers on CIK

They are harmless, but the interrupts do decrease performance.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97039

Cc: 12.0 <mesa-stable@lists.freedesktop.org>
8 years agogallium/winsys/kms: Look up the GEM handle after importing a prime FD
Tomasz Figa [Tue, 2 Aug 2016 10:46:28 +0000 (19:46 +0900)]
gallium/winsys/kms: Look up the GEM handle after importing a prime FD

drmPrimeHandleToFD() will return the same GEM handle every time the same
buffer is imported, even from a different prime FD. Since GEM handles
are not reference counted, we need to make sure that each GEM handle is
referenced only by one display target struct, by looking it up in
kms_sw->bo_list first and bumping the refcount of the found dt on hit
and falling back to creating a new dt only on miss.

v2: Split into separate function.
    Use helper function for lookup.

v3 [Emil Velikov]:
    Rename kms_sw_displaytarget_{lookup,find_and_ref} (Jordan)

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com> (v2)
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agogallium/winsys/kms: Move display target handle lookup to separate function
Tomasz Figa [Tue, 2 Aug 2016 10:46:27 +0000 (19:46 +0900)]
gallium/winsys/kms: Move display target handle lookup to separate function

As a preparation to use the lookup in more than once place, move the
code that looks up given KMS/GEM handle to a separate function. This
change should not introduce any functional changes.

v2: Split into separate patch.
    Move lookup code into separate function.

v3 [Emil Velikov]:
    Rename kms_sw_displaytarget_{lookup,find_and_ref} (Jordan)

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com> (v2)
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agogallium/winsys/kms: Fully initialize kms_sw_dt at prime import time (v2)
Tomasz Figa [Tue, 2 Aug 2016 10:46:26 +0000 (19:46 +0900)]
gallium/winsys/kms: Fully initialize kms_sw_dt at prime import time (v2)

Currently kms_sw_displaytarget_add_from_prime() allocates the struct and
fills in only some of the fields, resulting in a half-baked struct that
needs to be further completed by the caller. To make this a bit more
consistent, pass width, height and stride to this function and fill in
everything there, so that caller can take the returned struct as is.

v2: Split from one big patch into four fixing one thing at a time.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agogallium/winsys/kms: Fix double refcount when importing from prime FD (v2)
Tomasz Figa [Tue, 2 Aug 2016 10:46:25 +0000 (19:46 +0900)]
gallium/winsys/kms: Fix double refcount when importing from prime FD (v2)

Currently the code creates a display target struct with refcount field
initialized to 1 and then the caller again increments it, leading to
a leaked reference. Let's remove the unnecessary increment.

v2: Split from one big patch into four fixing one thing at a time.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoshaderapi: don't generate not linked error on GetProgramStage in general
Alejandro Piñeiro [Tue, 23 Aug 2016 15:00:54 +0000 (17:00 +0200)]
shaderapi: don't generate not linked error on GetProgramStage in general

Both ARB_shader_subroutine and the GL core spec doesn't list any
error when the program is not linked.

We left a error generation for the uniform location, in order to be
consistent with other methods from the spec that generate them.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agogallium/cso: avoid unnecessary null dereference
Eric Engestrom [Tue, 12 Jul 2016 21:48:28 +0000 (22:48 +0100)]
gallium/cso: avoid unnecessary null dereference

The label `out:` calls `destroy()` which dereferences `ctx`.
This is unnecessary as there is nothing to destroy.
Immediately return instead.

CovID: 1258255
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years ago.gitignore: Ignore tags generated by `make tags`
Eric Engestrom [Tue, 31 May 2016 01:30:16 +0000 (02:30 +0100)]
.gitignore: Ignore tags generated by `make tags`

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
[Emil Velikov: rebase]
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agost/xvmc: fix a couple 'unused-but-set-variable' warnings
Eric Engestrom [Tue, 12 Jul 2016 22:41:50 +0000 (23:41 +0100)]
st/xvmc: fix a couple 'unused-but-set-variable' warnings

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoegl: turn a couple asserts static (compile-time)
Eric Engestrom [Mon, 22 Aug 2016 20:52:03 +0000 (21:52 +0100)]
egl: turn a couple asserts static (compile-time)

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoi915: remove unnecessary `if`
Eric Engestrom [Mon, 15 Aug 2016 14:51:21 +0000 (15:51 +0100)]
i915: remove unnecessary `if`

if (x) return true; else return false;
can be simplified as:
return x;
since `x` is already a boolean expression.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoi965: remove unnecessary `if`
Eric Engestrom [Mon, 15 Aug 2016 14:51:20 +0000 (15:51 +0100)]
i965: remove unnecessary `if`

if (x) return true; else return false;
can be simplified as:
return x;
since both `x` are already boolean expressions.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoprogram_resource: subroutine active uniforms should return NumSubroutineUniforms
Alejandro Piñeiro [Thu, 18 Aug 2016 17:44:55 +0000 (19:44 +0200)]
program_resource: subroutine active uniforms should return NumSubroutineUniforms

Before this commit, GetProgramInterfaceiv for pname ACTIVE_RESOURCES
and all the <shader>_SUBROUTINE_UNIFORM programInterface were
returning the count of resources on the shader program using that
interface, instead of the num of uniform resources. This would get a
wrong value (for example) if the shader has an array of subroutine
uniforms.

Note that this means that in order to get a proper value, the shader
needs to be linked, something that is not explicitly mentioned on
ARB_program_interface_query spec, but comes from the general
definition of active uniform. If the program is not linked we
return 0.

v2: don't generate an error if the program is not linked, returning 0
    active uniforms instead, plus extra spec references (Tapani Palli)

Fixes GL44-CTS.program_interface_query.subroutines-compute

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoegl/wayland-egl: Fix for segfault in dri2_wl_destroy_surface.
Stencel, Joanna [Mon, 22 Aug 2016 07:48:50 +0000 (09:48 +0200)]
egl/wayland-egl: Fix for segfault in dri2_wl_destroy_surface.

Segfault occurs when destroying EGL surface attached to already destroyed
Wayland window. The fix is to set to NULL the pointer of surface's
native window when wl_egl_destroy_window() is called.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Stencel, Joanna <joanna.stencel@intel.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agost/va: Remove unused variable coded_size from vlVaEndPicture()
Kai Wasserbäch [Sat, 20 Aug 2016 16:14:54 +0000 (18:14 +0200)]
st/va: Remove unused variable coded_size from vlVaEndPicture()

Removes the following GCC warning:
 ../../../../../src/gallium/state_trackers/va/picture.c:542:17: warning:
  unused variable 'coded_size' [-Wunused-variable]
    unsigned int coded_size;
                 ^~~~~~~~~~

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Boyuan Zhang <boyuan.zhang@amd.com>
8 years agost/va: Remove else case in vlVaEndPicture() made superfluous by c59628d11b
Kai Wasserbäch [Sat, 20 Aug 2016 16:14:53 +0000 (18:14 +0200)]
st/va: Remove else case in vlVaEndPicture() made superfluous by c59628d11b

Commit c59628d11b134fc016388a170880f7646e100d6f made the else statement
and duplication of the context->decoder->end_frame() call superfluous.

Cc: Boyuan Zhang <boyuan.zhang@amd.com>
Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Boyuan Zhang <boyuan.zhang@amd.com>
8 years agost/va: add missing mutex_unlock
Eric Engestrom [Sun, 21 Aug 2016 21:11:48 +0000 (22:11 +0100)]
st/va: add missing mutex_unlock

Fixes: c59628d11b134fc01638 ("st/va: enable dual instances encode by sync surface")
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Boyuan Zhang <boyuan.zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoaubinator: Style fixes.
Kenneth Graunke [Tue, 23 Aug 2016 23:35:59 +0000 (16:35 -0700)]
aubinator: Style fixes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoaubinator: Fix the tool to correctly decode the DWords
Sirisha Gandikota [Fri, 19 Aug 2016 19:13:25 +0000 (12:13 -0700)]
aubinator: Fix the tool to correctly decode the DWords

Several fixes have been added as part of this as listed below:

1) Fix the mask and add disassembler handling for STATE_DS, STATE_HS
as the mask returned wrong values of the fields.

2) Fix the GEN_TYPE_ADDRESS/GEN_TYPE_OFFSET decoding - the address/
offset were handled the same way as the other fields and that gives
the wrong values for the address/offset.

3) Decode nested/recurssive structures - Many packets contain nested
structures, ex: 3DSATE_SO_BUFFER, STATE_BASE_ADDRESS, etc contain MOC
structures. Previously, the aubinator printed 1 if there was a MOC
structure. Now we decode the entire structure and print out its fields.

4) Print out the DWord address along with its hex value - For a better
clarity of information, it is helpful to print both the address and
hex value of the DWord along with the DWord count. Since the DWord0
contains the instruction code and the instruction length, it is
unnecessary to print the decoded values for DWord0. This information
is already available from the DWord hex value.

5) Decode the <group> and the corresponding fields in the group- The
<group> tag can have fields of several types including structures. A
group can contain one or more number of fields and this has be correctly
decoded. Previously, aubinator did not decode the groups or the
fields/structures inside them. Now we decode the <group> in the
instructions and structures where the fields in it repeat for any number
of times specified.

v2: Fix the formatting (per Matt)
Make the start and end pos calculation to extract fields from a DWord
more appropriate by moving %32 away from mask() method

Signed-off-by: Sirisha Gandikota <Sirisha.Gandikota@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Ben Widawsky <ben@bwidawsk.net>
8 years agoaubinator: Add a new tool called Aubinator to the src/intel/tools folder.
Kristian Høgsberg Kristensen [Fri, 19 Aug 2016 19:13:24 +0000 (12:13 -0700)]
aubinator: Add a new tool called Aubinator to the src/intel/tools folder.

The Aubinator tool is designed to help the driver developers in debugging
the driver functionality by decoding the data in the .aub files.
Primary Authors of this tool are Damien Lespiau <damien.lespiau at intel.com>
and Kristian Høgsberg Kristensen <krh at bitplanet.net>.

v2: Review comments are incorporated by Sirisha Gandikota as below:
1) Make Makefile.am more crisp, reuse intel_aub.h from libdrm (per Emil)
2) Aubinator will use platform name instead of GEN number (per Matt)
3) Disassmebler gets created based on pciid rather then GEN number (per Matt)
4) Other formatting comments (per Ken, Matt and Emil)

Signed-off-by: Sirisha Gandikota <Sirisha.Gandikota@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Ben Widawsky <ben@bwidawsk.net>
8 years agoglsl: Mark tessellation qualifier maps static const.
Kenneth Graunke [Mon, 22 Aug 2016 23:39:14 +0000 (16:39 -0700)]
glsl: Mark tessellation qualifier maps static const.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoisl/formats: Integer formats are not filterable
Jason Ekstrand [Tue, 23 Aug 2016 21:11:18 +0000 (14:11 -0700)]
isl/formats: Integer formats are not filterable

In ca2a8e56285, we updated the format table to add more formats (most of
which are new on SKL) but accidentally marked some integer formats as
filterable.  You can't filter an integer format.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
8 years agost/dri: respect driver's request to avoid mixed color/depth bit configs
Ilia Mirkin [Sun, 21 Aug 2016 02:42:45 +0000 (22:42 -0400)]
st/dri: respect driver's request to avoid mixed color/depth bit configs

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium: add a cap to expose whether driver supports mixed color/zs bits
Ilia Mirkin [Sun, 21 Aug 2016 02:40:33 +0000 (22:40 -0400)]
gallium: add a cap to expose whether driver supports mixed color/zs bits

Some hardware can't render to color/depth buffers of mixed bitness. When
that happens a fallback has to happen, but this allows the driver to
express that this isn't an optimal scenario. The purpose of this is to
remove such fbconfigs from the GLX/EGL config list.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agodri: add a way to request that modes have matching color/zs depths
Ilia Mirkin [Sat, 20 Aug 2016 20:10:20 +0000 (16:10 -0400)]
dri: add a way to request that modes have matching color/zs depths

Some GPUs, notably nv3x/nv4x can't render to mismatched color/zs
framebuffer depths. Fallbacks can be done by the driver, with shadow
surfaces, but no reason to encourage applications to select non-matching
glx visuals.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agonv50/ir: make sure cfg iterator always hits all blocks
Ilia Mirkin [Fri, 19 Aug 2016 04:41:59 +0000 (00:41 -0400)]
nv50/ir: make sure cfg iterator always hits all blocks

In some very specially-crafted cases, we could attempt to visit a node
that has already been visited, and then run out of bb's to visit, while
there were still cross blocks on the list. Make sure that those get
moved over in that case.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96274
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
8 years agoanv/clear: Clear E5B9G9R9 images as R32_UINT
Jason Ekstrand [Wed, 3 Aug 2016 18:41:45 +0000 (11:41 -0700)]
anv/clear: Clear E5B9G9R9 images as R32_UINT

We can't actually clear these images normally because we can't render to
them.  Instead, we have to manually unpack the rgb9e5 color value on the
CPU and clear it as R32_UINT.  We still have a bit of work to do to clear
non-power-of-two images, but this should get all of the power-of-two clears
working on at least Haswell.  This fixes three of the new Vulkan CTS tests
in the dEQP-VK.api.image_clearing.clear_color_image.* group.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
8 years agoanv/clear: Make cmd_clear_image take an actual VkClearValue
Jason Ekstrand [Wed, 3 Aug 2016 18:37:24 +0000 (11:37 -0700)]
anv/clear: Make cmd_clear_image take an actual VkClearValue

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
8 years agoanv/blit2d: Add support for RGB destinations
Jason Ekstrand [Tue, 2 Aug 2016 15:47:51 +0000 (08:47 -0700)]
anv/blit2d: Add support for RGB destinations

This fixes 104 of the new image_clearing and copy_and_blit Vulkan CTS
tests.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
8 years agoanv/blit2d: Add a format parameter to bind_dst and create_iview
Jason Ekstrand [Tue, 2 Aug 2016 15:28:39 +0000 (08:28 -0700)]
anv/blit2d: Add a format parameter to bind_dst and create_iview

Signed-off-by: Jasosn Ekstrand <jason@jlekstrand.net>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
8 years agoanv/image: Don't create invalid render target surfaces
Jason Ekstrand [Tue, 26 Jul 2016 22:29:40 +0000 (15:29 -0700)]
anv/image: Don't create invalid render target surfaces

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoisl/formats: Update the table with more samplable formats
Jason Ekstrand [Wed, 27 Jul 2016 00:31:11 +0000 (17:31 -0700)]
isl/formats: Update the table with more samplable formats

There were a lot of formats where support was added on Haswell or later but
we never updated the format table.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
8 years agoisl/formats: Report ETC as being samplable on Bay Trail
Jason Ekstrand [Wed, 27 Jul 2016 00:32:01 +0000 (17:32 -0700)]
isl/formats: Report ETC as being samplable on Bay Trail

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
8 years agoi965/surface_formats: Don't advertise 8 or 16-bit RGB formats
Jason Ekstrand [Wed, 27 Jul 2016 03:59:38 +0000 (20:59 -0700)]
i965/surface_formats: Don't advertise 8 or 16-bit RGB formats

We have implicitly been not advertising these formats since we had them
turned off in the format capabilities table.  We are about to update that
table and this prevents a change in behavior.  The only change in behavior
created by this patch is that we no longer advertise support for
R16G16B16_FLOAT which means that it's now renderable which seems like a
bonus.  Maybe someday we'll want to change things to start supporting
16-bit RGB formats natively but, at the moment, there's no need.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
8 years agoanv/formats: Don't use an RGBX format if it isn't renderable
Jason Ekstrand [Tue, 26 Jul 2016 18:33:45 +0000 (11:33 -0700)]
anv/formats: Don't use an RGBX format if it isn't renderable

The whole point of using RGBX is so that we can render to it so if it isn't
renderable, that kind-of defeats the purpose.  Some formats (one example is
R32G32B32X32_SFLOAT) exist in the format table but aren't actually
renderable.  Eventually, we'd like to get away from RGBX entirely, but this
fixes hangs on BDW today.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoegl/dri2: dri2_initialize: Do not reference-count TestOnly display
Nicolas Boichat [Wed, 3 Aug 2016 13:54:22 +0000 (21:54 +0800)]
egl/dri2: dri2_initialize: Do not reference-count TestOnly display

In the case where dri2_initialize is called with a TestOnly display,
the display is not actually initialized, so dri2_egl_display always
fails, and we cannot do any reference counting.

Fixes piglit spec@egl_khr_create_context@verify gl flavor (reproducible
with LIBGL_ALWAYS_SOFTWARE=1).

Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Reported-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agovbo: fix format string compiler warning for 32-bit machines
Jan Ziak [Tue, 2 Aug 2016 14:40:00 +0000 (08:40 -0600)]
vbo: fix format string compiler warning for 32-bit machines

Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0x9b@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agoegl/dri2: remove error checks on return values from mtx_lock and cnd_wait
Dongwon Kim [Mon, 15 Aug 2016 22:12:03 +0000 (15:12 -0700)]
egl/dri2: remove error checks on return values from mtx_lock and cnd_wait

This removes unnecessary error checks on return result of mtx_lock
and cnd_wait calls as in all other places in MESA source since there
is no chance that any of these functions return any of error codes
in current implementation.

This patch also removes a redundent _eglError call that follows
EGL_FALSE check in the bottom of dri2_client_wait_sync.

Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoi965: report bound buffer size not underlying buffer size for image size (v2)
Dave Airlie [Fri, 27 May 2016 05:00:57 +0000 (15:00 +1000)]
i965: report bound buffer size not underlying buffer size for image size (v2)

This seems to make sense, the image is bound to a subset of the buffer
so the image size should be from the bound size not the underlying
object.

This fixes:
GL44-CTS.shader_image_size.advanced-nonMS-fs-int

v2: get mininum of the two values, same as we write to the hw.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoanv: Throw INCOMPATIBLE_DRIVER for non-fatal initialization errors
Jason Ekstrand [Tue, 23 Aug 2016 01:10:14 +0000 (18:10 -0700)]
anv: Throw INCOMPATIBLE_DRIVER for non-fatal initialization errors

The only reason we should throw INITIALIZATION_FAILED is if we have found
useable intel hardware but have failed to bring it up for some reason.
Otherwise, we should just throw INCOMPATIBLE_DRIVER which will turn into
successfully advertising 0 physical devices

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tested-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
8 years agost/glsl_to_tgsi: fix st_src_reg_for_double constant.
Dave Airlie [Tue, 5 Jul 2016 00:26:14 +0000 (10:26 +1000)]
st/glsl_to_tgsi: fix st_src_reg_for_double constant.

This needs to set the src swizzle so it doesn't access the .zw
members ever when we are just emitting a 0 constant here.

This fixes:
vert-conversion-explicit-dvec3-bvec3.shader_test
and a bunch of other fp64 tests on softpipe and radeonsi.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>