mesa.git
6 years agonir/spirv: Remove unnecessary comment.
Andres Gomez [Sat, 8 Jul 2017 12:21:20 +0000 (15:21 +0300)]
nir/spirv: Remove unnecessary comment.

It should have been removed after 00c47e111c.

Cc: Jason Ekstrand <jason@jlekstrand.net>
Cc: Connor Abbott <cwabbott0@gmail.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoradv: Add compute htile clear for combined depth+stencil surfaces.
Bas Nieuwenhuizen [Fri, 7 Jul 2017 13:56:57 +0000 (15:56 +0200)]
radv: Add compute htile clear for combined depth+stencil surfaces.

Figured out the clear value when we have a combined depth stencil
surface.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agodraw: handle more TGSI_SEMANTIC_COLOR indices
Roland Scheidegger [Fri, 7 Jul 2017 22:14:35 +0000 (00:14 +0200)]
draw: handle more TGSI_SEMANTIC_COLOR indices

It could only handle indices 0/1, otherwise what happened was bad (accessing
array out of bounds, no crash but kind of random). This is enough for the gl
state tracker (primary/secondary color) but not enough for some other state
trackers (d3d9 has no limits on the number of color interpolants).
The complexity with color semantics are all due to the front/back mapping (2
outputs in the vs map to one input in the fs) so this isn't extended to
indices > 1 - d3d9 has no use for back colors, therefore this isn't needed and
still only 2 back colors can be handled correctly.

Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agost/mesa: Fix grabbing the wrong variant if glDrawPixels is called
Matias N. Goldberg [Wed, 5 Jul 2017 17:02:50 +0000 (14:02 -0300)]
st/mesa: Fix grabbing the wrong variant if glDrawPixels is called

By design pixel shaders can have up to 3 variants:
* The standard one.
* glDrawPixels variant.
* glBitmap variant.
However "shader_has_one_variant" ignores this fact, and therefore
st_update_fp would select the wrong variant if glDrawPixels or glBitmap
was ever called.

This patch fixes the problem. If the standard variant has been created,
calling glDrawPixels or glBitmap will append the variant to the second
entry of the linked list, so that st_update_fp still selects the right
one if shader_has_one_variant is set.

If the standard variant hasn't been created yet and glDrawPixel/Bitmap
has been called, st_update_fp will will see this and take the slow path
instead. The standard variant will then be added at the front of the
linked list, so that the next time the fast path is taken.

Blender in particular is hit by this bug.

v2: Marek - cosmetic changes

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=101596

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoRevert "intel/isl: Only create a CCS buffer if the image supports rendering"
Nanley Chery [Wed, 5 Jul 2017 18:42:00 +0000 (11:42 -0700)]
Revert "intel/isl: Only create a CCS buffer if the image supports rendering"

This reverts commit 8aaa13467dc289d35dc7900ab9fab9a7689c4178, which was
based on an incorrect assumption. Unlike the restriction placed on image
views in the Vulkan API, OpenGL allows you to render to texture views
whose formats differ from the originals.

Bugzilla: https://bugzilla.freedesktop.org/show_bug.cgi?id=101677

6 years agomesa: finish implementing glPrimitiveRestartNV() for display lists
Brian Paul [Thu, 6 Jul 2017 23:54:49 +0000 (17:54 -0600)]
mesa: finish implementing glPrimitiveRestartNV() for display lists

If we try to build a display list with just a glPrimitiveRestartNV()
call, we'd crash because of a null GLvertexformat::PrimitiveRestartNV
pointer.  This change fixes that case.

The previous patch fixed the case of calling glPrimitiveRestartNV()
inside a glBegin/End pair.

v2: minor clean-up in save_PrimitiveRestartNV(), per Charmaine.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agovbo: fix glPrimitiveRestartNV crash inside a display list
Olivier Lauffenburger [Thu, 6 Jul 2017 15:45:00 +0000 (09:45 -0600)]
vbo: fix glPrimitiveRestartNV crash inside a display list

glPrimitiveRestartNV crashes when it is called during the compilation
of a display list.

There are two reasons:
- ctx->Driver.CurrentSavePrimitive is not set to the current primitive
- save_PrimitiveRestartNV() calls _save_Begin() which only sets an
  OpenGL error, instead of calling vbo_save_NotifyBegin().

This patch correctly calls vbo_save_NotifyBegin() but it detects
the current primitive mode by looking at the latest saved primitive.

Additional work by Brian Paul

Signed-off-by: Olivier Lauffenburger <o.lauffenburger@topsolid.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101464
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agost/mesa: remove unused st_framebuffer::Private field
Brian Paul [Thu, 6 Jul 2017 22:31:43 +0000 (16:31 -0600)]
st/mesa: remove unused st_framebuffer::Private field

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agomesa: add some braces in _mesa_make_current()
Brian Paul [Thu, 6 Jul 2017 17:59:55 +0000 (11:59 -0600)]
mesa: add some braces in _mesa_make_current()

Slightly better readability.

6 years agovbo: rename target->index in loopback code
Brian Paul [Thu, 6 Jul 2017 17:09:10 +0000 (11:09 -0600)]
vbo: rename target->index in loopback code

Because it's a vertex attribute index.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agovbo: whitespace/formatting fixes in vbo_save_loopback.c
Brian Paul [Thu, 6 Jul 2017 17:04:10 +0000 (11:04 -0600)]
vbo: whitespace/formatting fixes in vbo_save_loopback.c

Trivial.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agovbo: simplify vbo_save_NotifyBegin()
Brian Paul [Thu, 6 Jul 2017 16:53:41 +0000 (10:53 -0600)]
vbo: simplify vbo_save_NotifyBegin()

This function always returned GL_TRUE.  Just make it a void function.
Remove unreachable code following the call to vbo_save_NotifyBegin()
in save_Begin() in dlist.c

There were some stale comments that no longer applied since an earlier
code refactoring.

No Piglit regressions.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agosvga: adjust line subpixel position for HWv8
Brian Paul [Thu, 6 Jul 2017 02:08:54 +0000 (20:08 -0600)]
svga: adjust line subpixel position for HWv8

This fixes two regressions on HWv8:
  Piglit gl-1.0-ortho-pos
  Piglit/glean fbo
This was caused by commit c2b92dada076a "svga: clamp device line width
to at least 1 to fix HWv8 line stippling"

This also fixes two conform tests: Vertex Order and Polygon Face

No Piglit/conform changes with HWv9 or later.

VMware bug 1905053

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agoetnaviv: fix refcnt initialization in etna_screen
Aleksander Morgado [Thu, 6 Jul 2017 21:18:57 +0000 (23:18 +0200)]
etnaviv: fix refcnt initialization in etna_screen

Despite being a member of the etna_screen struct, 'refcnt' is used by
the winsys-specific logic to track the reference count of the object
managed in a hash table. When the count reaches zero, the pipe screen
is removed from the table and destroyed.

Fix the logic by initializing the refcnt to 1 when screen created.
This initialization is done in etna_screen_create(), to follow the
same logic as in freedreno and virgl.

Fixes: c9e8b49b885 ("etnaviv: gallium driver for Vivante GPUs")
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
6 years agoa5xx: add support for rendering to RGB10A2_UNORM formats
Ilia Mirkin [Fri, 7 Jul 2017 04:33:50 +0000 (00:33 -0400)]
a5xx: add support for rendering to RGB10A2_UNORM formats

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoa5xx: set uint/sint bits for mrt output register
Ilia Mirkin [Fri, 7 Jul 2017 04:19:03 +0000 (00:19 -0400)]
a5xx: set uint/sint bits for mrt output register

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoa5xx: add backface stencil emission
Ilia Mirkin [Fri, 7 Jul 2017 01:03:03 +0000 (21:03 -0400)]
a5xx: add backface stencil emission

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoradeonsi: fix invalidating bindless buffer descriptors
Samuel Pitoiset [Fri, 30 Jun 2017 16:48:12 +0000 (18:48 +0200)]
radeonsi: fix invalidating bindless buffer descriptors

The VA is stored at [4:5], not [0:1]. This invalidated all
texture buffer descriptors when they were made resident in
the current context.

This removes few partial flushes and cache invalidations which
are needed when updating a bindless descriptor on the fly with
a WRITE_DATA packet.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agost/wgl: Implement wglUseFontBitmaps.
Olivier Lauffenburger [Thu, 6 Jul 2017 15:27:00 +0000 (09:27 -0600)]
st/wgl: Implement wglUseFontBitmaps.

wglUseFontBitmaps is currently a noop.
This patch implements this function for Windows.
Misc code clean-ups by Brian.

Signed-off-by: Olivier Lauffenburger <o.lauffenburger@topsolid.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agost/wgl: improve selection of pixel format
Olivier Lauffenburger [Thu, 6 Jul 2017 15:08:00 +0000 (09:08 -0600)]
st/wgl: improve selection of pixel format

Current selection of pixel format does not enforce the request of
stencil or depth buffer if the color depth is not the same as
requested.

For instance, GLUT requests a 32-bit color buffer with an 8-bit
stencil buffer, but because color buffers are only 24-bit, no
priority is given to creating a stencil buffer.

This patch gives more priority to the creation of requested buffers
and less priority to the difference in bit depth.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101703
Signed-off-by: Olivier Lauffenburger <o.lauffenburger@topsolid.com>
Tested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agoac/nir: Fix ordering of parameters for image atomic cmpswap intrinsics
Alex Smith [Fri, 30 Jun 2017 10:15:42 +0000 (11:15 +0100)]
ac/nir: Fix ordering of parameters for image atomic cmpswap intrinsics

The NIR parameters are ordered "compare, data", matching GLSL, but both
the image and buffer LLVM intrinsics take them the other way around.
This is already handled correctly for SSBO atomics.

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Fixes: f4e499ec791 "radv: add initial non-conformant radv vulkan driver"
6 years agomesa: simplify get_tex_images_for_clear()
Brian Paul [Wed, 5 Jul 2017 20:48:33 +0000 (14:48 -0600)]
mesa: simplify get_tex_images_for_clear()

Get rid of redundant code.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agomesa: new comments, assertion related to glClearTexSubImage
Brian Paul [Wed, 5 Jul 2017 20:44:08 +0000 (14:44 -0600)]
mesa: new comments, assertion related to glClearTexSubImage

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agost/mesa: find proper mipmap level in st_ClearTexSubImage()
Brian Paul [Wed, 5 Jul 2017 20:31:26 +0000 (14:31 -0600)]
st/mesa: find proper mipmap level in st_ClearTexSubImage()

The Piglit arb_clear_texture-error test creates a texture with only
a 1x1 image at level=1, then tries to clear level 0 (nonexistent)
and level 1 (exists).  The test only checks that the former generates
an error but the later doesn't.  The test passes, but when we try
to clear the level=1 image we're passing an invalid level to
pipe_context::clear_texture().  level=1, but since there's only one
mipmap level in the texture, it should be zero.

This fixes the code to search the gallium texture resource for the
correct mipmap level.  Also, add an assertion to make sure we're not
passing an invalid level to pipe_context::clear_texture().

Fixes device errors with VMware driver.  No Piglit regressions.

v2: don't do the level search when using immutable textures.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agost/mesa: whitespace fixes in st_cb_fbo.c
Brian Paul [Mon, 3 Jul 2017 17:52:41 +0000 (11:52 -0600)]
st/mesa: whitespace fixes in st_cb_fbo.c

Trivial.

6 years agost/mesa: whitespace fixes in st_texture.c
Brian Paul [Mon, 3 Jul 2017 17:48:30 +0000 (11:48 -0600)]
st/mesa: whitespace fixes in st_texture.c

Trivial.

6 years agoradv: don't overallocate depth/stencil formats
Dave Airlie [Thu, 6 Jul 2017 06:23:25 +0000 (07:23 +0100)]
radv: don't overallocate depth/stencil formats

For depth/stencil formats the surface layer allocates the
stencil separately, so we don't need to include it in the
bpe.

This reduces the side of d32s8 allocates to something closer to pro.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: enable sisched toggle in perftest flags.
Dave Airlie [Thu, 6 Jul 2017 02:06:01 +0000 (03:06 +0100)]
radv: enable sisched toggle in perftest flags.

RADV_PERFTEST=sisched

to enable it.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoac/llvm: set xnack like radeonsi does.
Dave Airlie [Thu, 6 Jul 2017 02:01:56 +0000 (03:01 +0100)]
ac/llvm: set xnack like radeonsi does.

Use family, but only set xnack+ for gfx9.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoac/llvm: create features list using snprintf.
Dave Airlie [Thu, 6 Jul 2017 02:00:02 +0000 (03:00 +0100)]
ac/llvm: create features list using snprintf.

Just more moving code around before adding things to it.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoac/radv: change api to create target machine
Dave Airlie [Thu, 6 Jul 2017 01:56:21 +0000 (02:56 +0100)]
ac/radv: change api to create target machine

This just modifies the API to make it easier to add other flags
to target machine creation.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agobuild systems: move git_sha1_gen.sh to bin/
Eric Engestrom [Thu, 6 Jul 2017 19:25:28 +0000 (20:25 +0100)]
build systems: move git_sha1_gen.sh to bin/

There was no reason for this script to live outside the scripts
directory.

Suggested-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agoswr/rast: Correctly allocate SWR_STATS memory as cacheline aligned
Tim Rowley [Thu, 6 Jul 2017 18:16:18 +0000 (13:16 -0500)]
swr/rast: Correctly allocate SWR_STATS memory as cacheline aligned

Cacheline alignment of SWR_STATS to prevent sharing of cachelines
between threads (performance).

Gets rid of gcc-7.1 warning about using c++17's over-aligned new
feature.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: remove unused variables
Tim Rowley [Thu, 6 Jul 2017 15:41:58 +0000 (10:41 -0500)]
swr/rast: remove unused variables

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: don't use _mm256_fmsub_ps in AVX code
Tim Rowley [Thu, 6 Jul 2017 15:29:38 +0000 (10:29 -0500)]
swr/rast: don't use _mm256_fmsub_ps in AVX code

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: _mm*_undefined_* implementations for gcc<4.9
Tim Rowley [Thu, 6 Jul 2017 15:28:53 +0000 (10:28 -0500)]
swr/rast: _mm*_undefined_* implementations for gcc<4.9

Define these in terms of setzero for ancient gcc versions which don't
have the undefined intrinsics.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoetnaviv: don't dereference etna_resource pointer if allocation fails
Aleksander Morgado [Thu, 6 Jul 2017 09:35:37 +0000 (11:35 +0200)]
etnaviv: don't dereference etna_resource pointer if allocation fails

The check for the pointer being non-NULL was being done too late.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
6 years agoscons: Check for xlocale.h before defining HAVE_XLOCALE_H.
Vinson Lee [Wed, 5 Jul 2017 21:16:11 +0000 (14:16 -0700)]
scons: Check for xlocale.h before defining HAVE_XLOCALE_H.

Don't assume the header is present on some platforms - use the more
robust CheckHeader() instead.

glibc 2.26 removed xlocale.h.
https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27xlocale.h.27

Fix this build error with glibc 2.26.

  Compiling src/util/strtod.c ...
src/util/strtod.c:32:10: fatal error: xlocale.h: No such file or directory
 #include <xlocale.h>
          ^~~~~~~~~~~

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101657
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Tested-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoradv: add support for cmd predication.
Dave Airlie [Mon, 26 Jun 2017 01:13:24 +0000 (02:13 +0100)]
radv: add support for cmd predication.

This doesn't get used yet, it just adds support to various PKT3
emissions to enable it later.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoglsl: check if any of the named builtins are available first
Ilia Mirkin [Mon, 3 Jul 2017 21:08:12 +0000 (17:08 -0400)]
glsl: check if any of the named builtins are available first

_mesa_glsl_has_builtin_function is used to determine whether any variant
of a builtin are available, for the purpose of enforcing the GLSL ES
3.00+ rule that overloads or overrides of builtins are disallowed.

However the builtin_builder contains information on all builtins,
irrespective of parse state, or versions, or extension enablement. As a
result we would say that a builtin existed even if it was not actually
available.

To resolve this, first check if at least one signature is available for
a builtin before returning true.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101666
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir/spirv: Rework function argument setup
Jason Ekstrand [Thu, 29 Jun 2017 17:33:40 +0000 (10:33 -0700)]
nir/spirv: Rework function argument setup

Now that we have proper pointer types, we can be more sensible about the
way we set up function arguments and deal with the two cases of pointer
vs. SSA parameters distinctly.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Stop trying to convert pointers to SSA in glsl450
Jason Ekstrand [Sat, 1 Jul 2017 00:59:06 +0000 (17:59 -0700)]
nir/spirv: Stop trying to convert pointers to SSA in glsl450

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Use real pointer types
Jason Ekstrand [Thu, 29 Jun 2017 17:33:39 +0000 (10:33 -0700)]
nir/spirv: Use real pointer types

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Stop using glsl_type for function types
Jason Ekstrand [Thu, 29 Jun 2017 17:33:38 +0000 (10:33 -0700)]
nir/spirv: Stop using glsl_type for function types

We're going to want the full vtn_type available to us anyway at which
point glsl_type isn't really buying us anything.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Beef up the type system a bit
Jason Ekstrand [Thu, 29 Jun 2017 17:33:37 +0000 (10:33 -0700)]
nir/spirv: Beef up the type system a bit

This adds a vtn concept of base_type as well as a couple of other
fields.  This lets us be a tiny bit more efficient in some cases but,
more importantly, it will eventually let us express things the GLSL type
system can't.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Compact vtn_type
Jason Ekstrand [Thu, 29 Jun 2017 17:33:36 +0000 (10:33 -0700)]
nir/spirv: Compact vtn_type

Use an anonymous union of structs to help keep the structure small and
better organized.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Simplify type copying
Jason Ekstrand [Thu, 29 Jun 2017 17:33:35 +0000 (10:33 -0700)]
nir/spirv: Simplify type copying

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Compute offsets for UBOs and SSBOs up-front
Jason Ekstrand [Thu, 29 Jun 2017 17:33:34 +0000 (10:33 -0700)]
nir/spirv: Compute offsets for UBOs and SSBOs up-front

Now that we have a pointer wrapper class, we can create offsets for UBOs
and SSBOs up-front instead of waiting until we have the full access
chain.  For push constants, we still use the old mechanism because it
provides us with some nice range information.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Rework the way pointers get dereferenced
Jason Ekstrand [Thu, 29 Jun 2017 17:33:33 +0000 (10:33 -0700)]
nir/spirv: Rework the way pointers get dereferenced

This has the advantage of moving all of the "extend an access chain"
code into one place.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Break variable creation out into a helper
Jason Ekstrand [Thu, 29 Jun 2017 17:33:32 +0000 (10:33 -0700)]
nir/spirv: Break variable creation out into a helper

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Remove unneeded parameters from pointer_to_offset
Jason Ekstrand [Thu, 29 Jun 2017 17:33:31 +0000 (10:33 -0700)]
nir/spirv: Remove unneeded parameters from pointer_to_offset

Everyone now calls it with stop_at_matrix = false.  Since we're now
always walking all the way to the end of the access chain, the type
returned is just the same as ptr->type;

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Simplify matrix loads/stores
Jason Ekstrand [Thu, 29 Jun 2017 17:33:30 +0000 (10:33 -0700)]
nir/spirv: Simplify matrix loads/stores

Instead of handling all of the complexity at the end, we choose to
decorate types a bit more cleverly.  When we have a row-major matrix
type, we give it the stride of a single vector and give it's array
element type (which represents a column) the actual matrix stride.

Previously, we were using stop_at_matrix and handling everything from
matrix on down as special cases but now we walk the access chain all the
way to the end and then load.  Even though this looks like it may lead
to a significant functional change, it doesn't.  The reason why we
needed to do stop_at_matrix before was to handle row-major properly
since the offsets and strides would be all out-of-order.  Now that row
major matrix types have the small stride on the matrix and the large
stride on the vector, offsetting to a single column of a row-major
matrix works fine.  The load/store code simply picks up on the fact that
the stride isn't the type size and does multiple loads.  The generated
code from these methods should be the same.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Use the correct stride for non-32-bit vectors
Jason Ekstrand [Thu, 29 Jun 2017 17:33:29 +0000 (10:33 -0700)]
nir/spirv: Use the correct stride for non-32-bit vectors

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Wrap access chains in a new vtn_pointer data structure
Jason Ekstrand [Thu, 29 Jun 2017 17:33:28 +0000 (10:33 -0700)]
nir/spirv: Wrap access chains in a new vtn_pointer data structure

The vtn_pointer structure provides a bit better abstraction than passing
access chains around directly.  For one thing, if the pointer just
points to a variable, we don't need the access chain at all.  Also,
pointers know what their dereferenced type is so we can avoid passing
the type in a bunch of places.  Finally, pointers can, in theory, be
extended to the case where you don't actually know what variable is
being referenced.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Rename some things from access_chain to pointer
Jason Ekstrand [Thu, 29 Jun 2017 17:33:27 +0000 (10:33 -0700)]
nir/spirv: Rename some things from access_chain to pointer

We're about to add a vtn_pointer data structure and this will prevent
some rename churn in the next commit.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Split up Uniform and UniformConstant storage classes
Jason Ekstrand [Thu, 29 Jun 2017 17:33:26 +0000 (10:33 -0700)]
nir/spirv: Split up Uniform and UniformConstant storage classes

We were originally handling them together because I was rather unclear
on the distinction.  However, keeping them combined keeps the confusion.
Split them up so that it's more clear from the code how we expect the
two storage classes to be used.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Add a storage_class_to_mode helper
Jason Ekstrand [Thu, 29 Jun 2017 17:33:25 +0000 (10:33 -0700)]
nir/spirv: Add a storage_class_to_mode helper

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Use the type from the deref for atomics
Jason Ekstrand [Thu, 29 Jun 2017 17:33:24 +0000 (10:33 -0700)]
nir/spirv: Use the type from the deref for atomics

Previously, we were using the type of the variable which is incorrect.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agonir/spirv: Move a "}"
Jason Ekstrand [Thu, 29 Jun 2017 17:33:23 +0000 (10:33 -0700)]
nir/spirv: Move a "}"

It's closing a "{" at the begining of a switch case.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
6 years agoi965: Move surface resolves back to draw/dispatch time
Jason Ekstrand [Sat, 24 Jun 2017 22:14:50 +0000 (15:14 -0700)]
i965: Move surface resolves back to draw/dispatch time

This is effectively a revert of 388f02729bbf88ba104f4f8ee1fdf005a240969c
though much code has been added since.  Kristian initially moved it to
try and avoid locking problems with meta-based resolves.  Now that meta
is gone from the resolve path (for good this time, we hope), we can move
it back.  The problem with having it in intel_update_state was that the
UpdateState hook gets called by core mesa directly and all sorts of
things will cause a UpdateState to get called which may trigger resolves
at inopportune times.  In particular, it gets called by _mesa_Clear and,
if we have a HiZ buffer in the INVALID_AUX state, causes a HiZ resolve
right before the clear which is pointless.  By moving it back to
try_draw_prims time, we know it will only get called right before a draw
which is where we want it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agomesa: Avoid set comprehension.
Vinson Lee [Thu, 29 Jun 2017 06:13:26 +0000 (23:13 -0700)]
mesa: Avoid set comprehension.

Fix build error on CentOS 6.9 with Python 2.6.

  GEN    main/format_fallback.c
  File "./main/format_fallback.py", line 42
    names = {fmt.name for fmt in formats}
                        ^
SyntaxError: invalid syntax

Fixes: a1983223d883 ("mesa: Add _mesa_format_fallback_rgbx_to_rgba() [v2]")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agoac/nir: Move VS position exports before param exports.
Bas Nieuwenhuizen [Mon, 3 Jul 2017 22:49:55 +0000 (00:49 +0200)]
ac/nir: Move VS position exports before param exports.

According to Nicolai the SX can already start work when all
the position exports are done, so do those first.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Always set depthbuffer using image format instead of iview format.
Bas Nieuwenhuizen [Sun, 25 Jun 2017 23:27:02 +0000 (01:27 +0200)]
radv: Always set depthbuffer using image format instead of iview format.

We have some cases where changing between depth and stencil only aspect
was causing hangs.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Acked-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Disable depth & stencil tests when the depthbuffer doesn't support it.
Bas Nieuwenhuizen [Wed, 28 Jun 2017 22:38:29 +0000 (00:38 +0200)]
radv: Disable depth & stencil tests when the depthbuffer doesn't support it.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Acked-by: Dave Airlie <airlied@redhat.com>
6 years agoegl: android: Fix potential use of unitialized variable
Tomasz Figa [Wed, 5 Jul 2017 14:56:51 +0000 (23:56 +0900)]
egl: android: Fix potential use of unitialized variable

If dri2_setup_extensions() fails, the "err" variable would not be assigned
causing the error path to access an unitialized variable. Fix it by
assigning an error message.

Fixes: 2c341f2bda4 ("egl: refactor dri2_create_screen() into three separate functions")
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agointel: common: Fix link failure with standalone Android build
Tomasz Figa [Wed, 5 Jul 2017 14:54:18 +0000 (23:54 +0900)]
intel: common: Fix link failure with standalone Android build

Some reshuffle in the Makefiles under src/intel resulted in Android
libraries being no longer linked with code using
src/intel/common/gen_debug.h that contains references to functions
exported by those libraries (namely ALOGW macro, which is currently
resolved into a call to __android_log_print() from cutils).

Fix the build by taking into account ANDROID_CFLAGS and ANDROID_LIBS for
affected module on Android NDK builds.

Fixes: d5b355ce5fd ("i965: Move intel_debug.h to intel/common/gen_debug.h")
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoAndroid: generate symlinks for all enabled gallium drivers
Mauro Rossi [Sat, 1 Jul 2017 15:52:49 +0000 (17:52 +0200)]
Android: generate symlinks for all enabled gallium drivers

Current post install command relies on GALLIUM_TARGET_DRIVERS variable,
however variable needs to be initialized in src/gallium/Android.mk
in order that all enabled gallium drivers symlinks are correctly generated.

At the moment due to sorting of INC_DIRS and variable set with svga (vmwgfx)
only vmwgfx_dri.so and virtio_gpu_dri.so symlinks are generated.

Fixes: a3d98ca62f ("Android: use symlinks for driver loading")
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoandroid: build imx-drm winsys
Tomeu Vizoso [Tue, 4 Jul 2017 11:28:39 +0000 (13:28 +0200)]
android: build imx-drm winsys

Add Android.mk for winsys/imx/drm.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoandroid: add etnaviv driver build support
Rob Herring [Tue, 4 Jul 2017 11:28:38 +0000 (13:28 +0200)]
android: add etnaviv driver build support

Add etnaviv to Android makefiles.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
6 years agost/glsl_to_nir: fix edgeflag passthrough
Nicolai Hähnle [Sun, 25 Jun 2017 16:13:39 +0000 (18:13 +0200)]
st/glsl_to_nir: fix edgeflag passthrough

We have to mark the additional shader input as used, otherwise it will
be eliminated, and we have to setup its index correctly.

This is a bit of a hack, but so is everything surrounding edgeflag
passthrough.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agost/mesa: use pipe_shader_type_from_mesa
Nicolai Hähnle [Wed, 17 May 2017 16:09:14 +0000 (18:09 +0200)]
st/mesa: use pipe_shader_type_from_mesa

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agotgsi_from_mesa: add tgsi_get_gl_frag_result_semantic
Nicolai Hähnle [Thu, 8 Jun 2017 17:36:59 +0000 (19:36 +0200)]
tgsi_from_mesa: add tgsi_get_gl_frag_result_semantic

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agotgsi_from_mesa: add pipe_shader_type_from_mesa
Nicolai Hähnle [Wed, 17 May 2017 16:09:03 +0000 (18:09 +0200)]
tgsi_from_mesa: add pipe_shader_type_from_mesa

So... the pipe_ prefix doesn't really fit into a TGSI header; on the
other hand, the return type has the pipe_ prefix.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agotgsi,st/mesa: move varying slot to semantic mapping into a helper for VS
Nicolai Hähnle [Wed, 17 May 2017 15:44:34 +0000 (17:44 +0200)]
tgsi,st/mesa: move varying slot to semantic mapping into a helper for VS

We will use this helper in radeonsi's NIR path.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoddebug: handle some cases of non-TGSI shaders
Nicolai Hähnle [Fri, 9 Jun 2017 13:12:23 +0000 (15:12 +0200)]
ddebug: handle some cases of non-TGSI shaders

NIR shaders are not captured properly in pipelined mode currently. This
would require shader cloning, which requires linking all the Gallium
drivers against NIR. We can always do that later.

v2: avoid immediate crashes in pipelined mode

Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v1)
6 years agoglsl_to_nir: zero-initialize var->data.descriptor_set
Nicolai Hähnle [Fri, 9 Jun 2017 15:59:45 +0000 (17:59 +0200)]
glsl_to_nir: zero-initialize var->data.descriptor_set

This is convenient for backends that support both Vulkan and OpenGL while
lowering samplers to derefs with nir_lower_samplers_as_deref.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoglsl: add glsl_base_type_is_integer
Nicolai Hähnle [Sat, 24 Jun 2017 11:34:27 +0000 (13:34 +0200)]
glsl: add glsl_base_type_is_integer

We will use this from radeonsi/nir, which we want to keep as pure C code.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agonir: add NIR_PRINT environment variable
Nicolai Hähnle [Sat, 20 May 2017 15:19:06 +0000 (17:19 +0200)]
nir: add NIR_PRINT environment variable

Reviewed-by: Rob Clark <robdclark@gmail.com>
6 years agoglsl/blob: add valgrind checks that written data is defined
Nicolai Hähnle [Sat, 24 Jun 2017 08:26:29 +0000 (10:26 +0200)]
glsl/blob: add valgrind checks that written data is defined

Undefined data will eventually trigger a valgrind error while computing
its CRC32 while writing it into the disk cache, but at that point, it is
basically impossible to track down where the undefined data came from.

With this change, finding the origin of undefined data becomes easy.

v2: remove duplicate VALGRIND_CFLAGS (Emil)

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoglsl: explicitly zero out padding to gl_shader_variable bitfield
Nicolai Hähnle [Sat, 24 Jun 2017 08:27:18 +0000 (10:27 +0200)]
glsl: explicitly zero out padding to gl_shader_variable bitfield

Otherwise, the padding bits remain undefined, which leads to valgrind
errors when storing the gl_shader_variable in the disk cache.

v2: use rzalloc instead of an explicit padding member variable

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoglsl: simplify add_uniform_to_shader::visit_field
Nicolai Hähnle [Fri, 23 Jun 2017 18:20:31 +0000 (20:20 +0200)]
glsl: simplify add_uniform_to_shader::visit_field

Each field gets a distinct name, so we should never hit the case where
the name already exists in the parameter list.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoglsl: look for multiple variables simultaneously with find_assignment_visitor
Nicolai Hähnle [Thu, 22 Jun 2017 10:12:44 +0000 (12:12 +0200)]
glsl: look for multiple variables simultaneously with find_assignment_visitor

Save some passes over the IR.

v2: redesign to make the users of find_assignments more readable
v3:
- fix missing !
- add some comments and make the num_found check more explicit (Timothy)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agogallium/radeon: fix VDPAU breakage, need VRAM with WC
Marek Olšák [Tue, 4 Jul 2017 23:14:03 +0000 (01:14 +0200)]
gallium/radeon: fix VDPAU breakage, need VRAM with WC

6 years agoa5xx: enable polygon offset clamps
Ilia Mirkin [Tue, 4 Jul 2017 22:07:08 +0000 (18:07 -0400)]
a5xx: enable polygon offset clamps

This is already set and emitted by the code.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Rob Clark <robdclark@gmail.com>
6 years agoa5xx: implement logicop support
Ilia Mirkin [Tue, 4 Jul 2017 21:58:41 +0000 (17:58 -0400)]
a5xx: implement logicop support

The former 0x60 hardcoded in is equivalent to ROP_COPY with the shift.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Rob Clark <robdclark@gmail.com>
6 years agoa5xx: enable polygon mode selection
Ilia Mirkin [Tue, 4 Jul 2017 21:43:15 +0000 (17:43 -0400)]
a5xx: enable polygon mode selection

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Rob Clark <robdclark@gmail.com>
6 years agoa5xx: disable ARB_depth_clamp for now
Ilia Mirkin [Tue, 4 Jul 2017 20:06:28 +0000 (16:06 -0400)]
a5xx: disable ARB_depth_clamp for now

We need to figure out how to implement it properly. Right now it doesn't
work at all.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Rob Clark <robdclark@gmail.com>
6 years agoa5xx: fix clip_halfz support
Ilia Mirkin [Tue, 4 Jul 2017 20:02:55 +0000 (16:02 -0400)]
a5xx: fix clip_halfz support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Rob Clark <robdclark@gmail.com>
6 years agoa5xx: improve 3d texture sampling
Ilia Mirkin [Tue, 4 Jul 2017 15:48:25 +0000 (11:48 -0400)]
a5xx: improve 3d texture sampling

At least the first level works now. Eventually the later levels stop
working, there appears to be some alignment issue. But this improves the
situation immensely.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Rob Clark <robdclark@gmail.com>
6 years agoa5xx: remove one of the MIPFILTER_LINEAR bits
Ilia Mirkin [Tue, 4 Jul 2017 13:38:23 +0000 (09:38 -0400)]
a5xx: remove one of the MIPFILTER_LINEAR bits

It doesn't appear to do what we want. Removing this bit makes
lodclamp-between as well as a number of dEQP tests pass, with no visible
ill effect.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Rob Clark <robdclark@gmail.com>
6 years agoa5xx: enable formats newly added to the headers
Ilia Mirkin [Tue, 4 Jul 2017 04:25:26 +0000 (00:25 -0400)]
a5xx: enable formats newly added to the headers

This enables S3TC, BPTC, ETC2, and ASTC texture decoding. Additionally
this enables RGB32 texture buffer objects, as well as 11_11_10_FLOAT and
10_10_10_2 vertex formats (and related extensions).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Rob Clark <robdclark@gmail.com>
6 years agoa5xx: include color swap when decoding vertices
Ilia Mirkin [Tue, 4 Jul 2017 04:24:34 +0000 (00:24 -0400)]
a5xx: include color swap when decoding vertices

This fixes support for BGRA vertex formats

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Rob Clark <robdclark@gmail.com>
6 years agoa5xx: update headers
Ilia Mirkin [Tue, 4 Jul 2017 04:24:05 +0000 (00:24 -0400)]
a5xx: update headers

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Rob Clark <robdclark@gmail.com>
6 years agogallium/radeon: attempt to fix a compiler failure in radeon_winsys.h
Marek Olšák [Tue, 4 Jul 2017 20:40:09 +0000 (22:40 +0200)]
gallium/radeon: attempt to fix a compiler failure in radeon_winsys.h

trivial.

6 years agowinsys/amdgpu: use 128KB BOs for suballocations of up to 64KB BOs
Marek Olšák [Tue, 27 Jun 2017 19:54:20 +0000 (21:54 +0200)]
winsys/amdgpu: use 128KB BOs for suballocations of up to 64KB BOs

This decreases the number of BOs, but might also increase memory usage.
It's better for small textures.

The gameplay is on the far right:
https://people.freedesktop.org/~mareko/suballoc.svg

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agogallium/radeon: allow suballocating textures
Marek Olšák [Tue, 27 Jun 2017 18:32:37 +0000 (20:32 +0200)]
gallium/radeon: allow suballocating textures

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agogallium/radeon: generalize the function for in-place texture reallocation
Marek Olšák [Tue, 27 Jun 2017 18:12:25 +0000 (20:12 +0200)]
gallium/radeon: generalize the function for in-place texture reallocation

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agogallium/radeon: add radeon_winsys::buffer_is_suballocated
Marek Olšák [Tue, 27 Jun 2017 18:27:29 +0000 (20:27 +0200)]
gallium/radeon: add radeon_winsys::buffer_is_suballocated

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agogallium/radeon: clean up pb_cache bucket/usage determination
Marek Olšák [Thu, 29 Jun 2017 16:49:48 +0000 (18:49 +0200)]
gallium/radeon: clean up pb_cache bucket/usage determination

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agogallium/radeon: enable suballocations for VRAM with no CPU access
Marek Olšák [Thu, 29 Jun 2017 16:33:05 +0000 (18:33 +0200)]
gallium/radeon: enable suballocations for VRAM with no CPU access

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>