Commit Graph

95322 Commits

Author SHA1 Message Date
Samuel Pitoiset 3906e8ab64 mesa: add KHR_no_error support to glBeginTransformFeedback()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-08-25 11:35:29 +02:00
Samuel Pitoiset 088d5cb44f mesa: add begin_transform_feedback() helper
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-08-25 11:35:29 +02:00
Samuel Pitoiset b0590ace75 mesa: add KHR_no_error support to glBindTransformFeedback()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-08-25 11:24:17 +02:00
Samuel Pitoiset efb9811680 mesa: add bind_transform_feedback() helper
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-08-25 11:24:08 +02:00
Samuel Pitoiset 5946806064 mesa: port the LastLookedUpVAO optimisation to _mesa_lookup_vao()
It was only used in the errors path.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-08-25 11:11:54 +02:00
Samuel Pitoiset 08ee28b6a8 mesa: don't error check the default buffer object in glBindBufferOffsetEXT()
An allocation check is already done when the buffer is created at
context creation.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-08-25 11:11:51 +02:00
Samuel Pitoiset c7b201a50d mesa: add _fallback suffix to the default transform feedback functions
In preparation for KHR_no_error support.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-08-25 11:11:49 +02:00
Samuel Pitoiset 4f532ab30e mesa: remove unnecessary check in _mesa_init_transform_feedback_object()
All callers already check that, and the common behaviour is to
check in the _mesa_new_XXX() helpers anyway.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-08-25 11:11:46 +02:00
Samuel Pitoiset 41c7c2d968 mesa: check allocation failures in new_transform_feedback()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-08-25 11:11:44 +02:00
Samuel Pitoiset dd53bdd5aa mesa: remove unused _mesa_validate_transform_feedback_buffers()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-08-25 11:11:42 +02:00
Kai Chen 151188d1e3 egl/wayland: Use roundtrips when awaiting buffer release
In get_back_bo, we use wl_display_dispatch_queue() to block and wait for
a buffer release event. However, not all Wayland compositors flush the
client socket on posting a buffer-release event, so by only blocking
client-side, we may block indefinitely, or at least need to wait for an
input event / frame completion to arrive for the compositor to flush.

We now use dispatch_queue as a first pass, but if our entire buffer pool
is exhausted, use a roundtrip (an immediately-triggered wl_callback) to
ensure that the compositor flushes out our release event immediately.

[daniels: Modified comment and commit message.]

Signed-off-by: Kai Chen <kai.chen@intel.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
CC: <mesa-stable@lists.freedesktop.org>
2017-08-25 09:57:03 +01:00
Nicolai Hähnle 4da6cf6c98 glsl: fix glsl_struct_field size calculations for shader cache
Found by address sanitizer:

==22621==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61400000cbd8 at pc 0x7f561610a4ff bp 0x7ffca85f9d50 sp 0x7ffca85f94f8
READ of size 344 at 0x61400000cbd8 thread T0
    #0 0x7f561610a4fe  (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x5f4fe)
    #1 0x7f560bb305a5 in memcpy /usr/include/x86_64-linux-gnu/bits/string3.h:53
    #2 0x7f560bb305a5 in blob_write_bytes ../../../mesa-src/src/compiler/glsl/blob.c:136
    #3 0x7f560be7d7ff in encode_type_to_blob ../../../mesa-src/src/compiler/glsl/shader_cache.cpp:153
    #4 0x7f560be81222 in write_program_resource_data ../../../mesa-src/src/compiler/glsl/shader_cache.cpp:950
    #5 0x7f560be81222 in write_program_resource_list ../../../mesa-src/src/compiler/glsl/shader_cache.cpp:1118
    #6 0x7f560be81222 in shader_cache_write_program_metadata(gl_context*, gl_shader_program*) ../../../mesa-src/src/compiler/glsl/shader_cache.cpp:1407
    #7 0x7f560b825fdb in link_program ../../../mesa-src/src/mesa/main/shaderapi.c:1163

Fixes: 073a84ff60 ("glsl: stop adding pointers from glsl_struct_field to the cache")
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-08-25 09:05:28 +02:00
Ilia Mirkin f623e1742f a2xx: fix DST_ALPHA blending for non-alpha formats
If we're rendering to a format without alpha, convert DST_ALPHA blend to
a ONE so that factors are properly computed. This same workaround is
done on a3xx+ as well.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2017-08-25 00:18:34 -04:00
Ilia Mirkin f3bde890cd a2xx: set constant blend color
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2017-08-25 00:18:33 -04:00
Timothy Arceri f40908f2d1 radeonsi: set IF_THRESHOLD to 4
In 74e39de932 it was set to 3 and it was reported that 4 caused
tesseract to start spilling VGPRs. This no longer seems to be the
case.

Totals:
SGPRS: 2787844 -> 2787764 (-0.00 %)
VGPRS: 1713121 -> 1712717 (-0.02 %)
Spilled SGPRs: 7532 -> 7532 (0.00 %)
Spilled VGPRs: 49 -> 33 (-32.65 %)
Private memory VGPRs: 2060 -> 2060 (0.00 %)
Scratch size: 2200 -> 2180 (-0.91 %) dwords per thread
Code Size: 79265520 -> 79248360 (-0.02 %) bytes
LDS: 436 -> 436 (0.00 %) blocks
Max Waves: 670535 -> 670608 (0.01 %)
Wait states: 0 -> 0 (0.00 %)

Before:
 VGPR SPILLING APPS   Shaders SpillVGPR  PrivVGPR ScratchSize
 EffectsCaveDemo          301         0       256       264
 ReflectionsSubwayDemo    264         0       256       264
 VehicleGame              295         0       128       132
 bioshock-infinite       1140         0       448       516
 dirt-showdown            453        33         0        28
 gang-beasts              364         0       500       496
 kerbal-space-program    1228         0       472       480
 tomb-raider-ultra       1199        16         0        20

After:
 VGPR SPILLING APPS   Shaders SpillVGPR  PrivVGPR ScratchSize
 EffectsCaveDemo          301         0       256       264
 ReflectionsSubwayDemo    264         0       256       264
 VehicleGame              295         0       128       132
 bioshock-infinite       1140         0       448       516
 dirt-showdown            453        33         0        28
 gang-beasts              364         0       500       496
 kerbal-space-program    1228         0       472       480

The only change in VGPR spills is the elimination of all spills
in Tomb Raider at Ultra settings. Closer examination shows that
the shaders go over the limit because they contain three
expressions a mul, rcp and ubo load. The ubo load is actually
used elsewhere and is therefore stored in a temp already in IR
such as tgsi but glsl ir counts it agaist the if cost.

Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
2017-08-25 14:09:32 +10:00
Timothy Arceri b86ecea344 util/disk_cache: write cache item metadata to disk
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-08-25 13:20:29 +10:00
Timothy Arceri ea2515d780 glsl: pass shader source keys to the disk cache
We don't actually write them to disk here. That will happen in the
following commit.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-08-25 13:20:29 +10:00
Timothy Arceri 07018d49dc util/disk_cache: add struct cache_item_metadata
This will be used to store more information about the cache item
in it's header. This information is intended for 3rd party and
cache analysis use but can also be used for detecting the unlikely
scenario of cache collisions.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-08-25 13:20:29 +10:00
Timothy Arceri ef42423e7b disk_cache: enable limited hash collision detection in release builds
It really doesn't cost us much and will stop strange crashes should
the stars align.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-08-25 13:20:29 +10:00
Timothy Arceri 28b326238b util/disk_cache: rename mesa cache dir and introduce cache versioning
Steam is already analysing cache items, unfortunatly we did not
introduce a versioning mechanism for identifying structural changes
to cache entries earlier so the only way to do so is to rename the
cache directory.

Since we are renaming it we take the opportunity to give the directory
a more meaningful name.

Adding a version field to the header of cache entries will help us to
avoid having to rename the directory in future. Please note this is
versioning for the internal structure of the entries as defined in
disk_cache.{c,h} as opposed to the structure of the data provided to
the disk cache by the GLSL compiler and the various driver backends.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-08-25 13:20:29 +10:00
Dave Airlie 4a091b0788 radv: don't crash if we have no framebuffer
Recording secondaries with no framebuffer attachment may
make this happen, though this might not be the complete solution.

(esp if someone does meta stuff in there, would we have to
save things, not sure).

Fixes: f4e499ec79 ("radv: add initial non-conformant radv vulkan driver")
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-08-25 00:52:48 +01:00
Dave Airlie 19f6906c1e radv/gfx9: gfx9 has buffer sizing rules like pre-VI.
This fixes:
dEQP-VK.robustness.buffer_access.* on GFX9.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "17.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-08-25 00:52:36 +01:00
Dave Airlie 12fd0f8dc1 radv: fix predication on gfx9
When I added gfx9 I did it wrong, this fixes it.

Fixes: 5247b311e9 "radv/gfx9: fix set predication packet."
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-08-25 00:52:32 +01:00
Jason Ekstrand 95f533d922 anv,i965: Move CS shared lowering into anv
Right now, OpenGL uses the GLSL lowering for shared variables and anv
uses NIR to lower them.  For a long time, we've done this weird thing
where we do the NIR lowering unconditionally and then add the SLM sizes
from the two together.  This works because one of them will always be 0
but it's a bit sketchy.  Let's just move the NIR-based lowering into
anv_pipeline and get rid of the sketch.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2017-08-24 16:34:29 -07:00
Mauro Rossi 725741f10d ac/debug: use util_strchrnul() to fix android build error
Similar to e09d04cd56 "radeonsi: use util_strchrnul() to fix android build error"

Android Bionic does not support strchrnul() string function,
gallium auxiliary util/u_string.h provides util_strchrnul()

This change avoids the following warning and error:

external/mesa/src/amd/common/ac_debug.c:501:15: warning: implicit declaration of function 'strchrnul' is invalid in C99
                char *end = strchrnul(out, '\n');
                            ^
external/mesa/src/amd/common/ac_debug.c:501:9: error: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int'
                char *end = strchrnul(out, '\n');
                      ^     ~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.

Fixes: c2c3912410 "ac/debug: annotate IB dumps with the raw values"
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2017-08-24 17:23:24 -05:00
Marek Olšák fc99cb3c9e radeonsi: get the raster config from AMDGPU on SI
Not sure yet if we wanna do this on CIK and VI too.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-08-24 23:54:55 +02:00
Marek Olšák 28d5c30179 radeonsi: clean up setting GRBM_GFX_INDEX
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-08-24 23:54:55 +02:00
Marek Olšák 0b50f0915b radeonsi: move PA_SC_RASTER_CONFIG emission into a separate function
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-08-24 23:54:55 +02:00
Rob Herring 7db0bf8b31 Android: fix Android O version check for LLVM
With the release of O, the MESA_ANDROID_MAJOR_VERSION has changed to 8.
Change the LLVM check to match. There's no point to continue to support 'O'
as no one is going to use an old AOSP master.

Presumably, we'll be back here again to fix things again for P (or 9).

Reviewed-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Signed-off-by: Rob Herring <robh@kernel.org>
2017-08-24 15:04:37 -05:00
Adam Jackson 5d2205fafb include: Sync Khronos headers for OpenGL 4.6
Taken from c21e602b9fda1d3bbaecb08194592f67e6a0649b from
OpenGL-Registry. (This time without breaking glext.h.)

Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
2017-08-24 13:47:18 -04:00
Bas Nieuwenhuizen ba51ad2f25 radv: Expose VK_KHX_multiview.
Reviewed-by: Dave Airlie <airlied@redhat.com>
2017-08-24 19:20:47 +02:00
Bas Nieuwenhuizen e3265c10c8 radv: Implement multiview draws.
v2: - Use for_each_bit.
    - split emitting the draw packets out to separate functions.

Reviewed-by: Dave Airlie <airlied@redhat.com>
2017-08-24 19:20:47 +02:00
Bas Nieuwenhuizen db8e99f72d radv: Implement determining the has_multiview_view_index key.
Reviewed-by: Dave Airlie <airlied@redhat.com>
2017-08-24 19:20:47 +02:00
Bas Nieuwenhuizen 180c1b924e ac/nir: Add shader support for multiviews.
It uses an user SGPR to pass the view index to the shaders, except
for the fragment shader where we use layer=view (which comes in
handy when we want to do the NV ext that allows us to execute pre-FS
stages once instead of per view).

Reviewed-by: Dave Airlie <airlied@redhat.com>
2017-08-24 19:20:47 +02:00
Bas Nieuwenhuizen 2e86f6b259 radv: Add multiview clears.
v2: Use for_each_bit.

Reviewed-by: Dave Airlie <airlied@redhat.com>
2017-08-24 19:20:47 +02:00
Bas Nieuwenhuizen 3907d63259 radv: Store multiview info in renderpass.
Reviewed-by: Dave Airlie <airlied@redhat.com>
2017-08-24 19:20:47 +02:00
Bas Nieuwenhuizen eec5578158 ac/nir: Make shader key a struct.
Some bits can be passed to almost every shader, and I don't like
adding 5 variables.

Reviewed-by: Dave Airlie <airlied@redhat.com>
2017-08-24 19:20:47 +02:00
Bas Nieuwenhuizen 64164a1313 radv: Use 0 for the layer id if the vertex shader does not export it.
To use when we have e.g. input attachments, but there is no layer
export in the previous shader and hence no layered rendering.

Reviewed-by: Dave Airlie <airlied@redhat.com>
2017-08-24 19:20:47 +02:00
Bas Nieuwenhuizen 3d5f29f5f9 ac/nir: Implement input attachments with layered rendering.
Reviewed-by: Dave Airlie <airlied@redhat.com>
2017-08-24 19:20:47 +02:00
Bas Nieuwenhuizen c848e642d2 ac/nir: Determine if input attachments are used in the info pass.
Reviewed-by: Dave Airlie <airlied@redhat.com>
2017-08-24 19:20:47 +02:00
Bas Nieuwenhuizen 43595db302 ac/nir: Cast sources of integer ops to int.
The int32->float semantic conversion got dropped in a testcase,
because the src was already float. On closer inspection I decided
to add a few more casts for integer op operands to be safe too.

Cc: 17.2 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2017-08-24 19:20:47 +02:00
Adam Jackson 9e45440833 Revert "include: Sync Khronos headers for OpenGL 4.6"
Broke the BUILDING_MESA bit, oops.

This reverts commit ef1e87e6cd.
2017-08-24 13:15:15 -04:00
Adam Jackson ef1e87e6cd include: Sync Khronos headers for OpenGL 4.6
Taken from c21e602b9fda1d3bbaecb08194592f67e6a0649b from
OpenGL-Registry.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
2017-08-24 12:48:30 -04:00
Eric Engestrom 39f3e2507c dri: fix typo
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-08-24 16:14:34 +01:00
Eric Engestrom 55db2b6cfb i965: add missing `const` in function signature
Gets rid of a few warnings of the form:
  src/mesa/drivers/dri/i965/intel_screen.c:918:49: warning: passing argument 2 of ‘modifier_is_supported’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
          !modifier_is_supported(&screen->devinfo, f, 0, modifier))
                                                   ^
  src/mesa/drivers/dri/i965/intel_screen.c:301:1: note: expected ‘struct intel_image_format *’ but argument is of type ‘const struct intel_image_format *’

Fixes: 1efd73df39 "i965: Advertise the CCS modifier"
Cc: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2017-08-24 16:11:45 +01:00
Eric Engestrom 688d866eca egl/android: add missing include
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2017-08-24 16:02:14 +01:00
Brian Paul fe2f5cfdc7 vbo: fix glVertexAttrib(index=0)
Depending on which extension or GL spec you read the behavior of
glVertexAttrib(index=0) either sets the current value for generic
attribute 0, or it emits a vertex just like glVertex().  I believe
it should do either, depending on context (see below).

The piglit gl-2.0-vertex-const-attr test declares two vertex attributes:
  attribute vec2 vertex;
  attribute vec4 attr;
and the GLSL linker assigns "vertex" to location 0 and "attr" to location 1.
The test passes.

But if the declarations were reversed such that "attr" was location 0 and
"vertex" was location 1, the test would fail to draw properly.

The problem is the call to glVertexAttrib(index=0) to set attr's value
was interpreted as glVertex() and did not set generic attribute[0]'s value.
Interesting, calling glVertex() outside glBegin/End (which is effectively
what the piglit test does) does not generate a GL error.

I believe the behavior of glVertexAttrib(index=0) should depend on
whether it's called inside or outside of glBegin/glEnd().  If inside
glBegin/End(), it should act like glVertex().  Else, it should behave
like glVertexAttrib(index > 0).  This seems to be what NVIDIA does.

This patch makes two changes:

1. Check if we're inside glBegin/End for glVertexAttrib()
2. Fix the vertex array binding for recalculate_input_bindings().  As it was,
   we were using &vbo->currval[VBO_ATTRIB_POS], but that's interpreted
   as a zero-stride attribute and doesn't make sense for array drawing.

No Piglit regressions.  Fixes updated gl-2.0-vertex-const-attr test and
passes new gl-2.0-vertex-attrib-0 test.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101941
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2017-08-24 07:36:10 -06:00
Brian Paul a7e65a443f gallivm: remove unused variable
Trivial.
2017-08-24 07:36:10 -06:00
Brian Paul 84f35c3423 st/mesa: add const qualifiers in st_extensions.c
Trivial.
2017-08-24 07:30:23 -06:00
Brian Paul 6ad313acf5 st/mesa: whitespace/indentation fixes in st_init_extensions() 2017-08-24 07:30:23 -06:00