mesa.git
7 years agospirv: Implement IsInf using an integer comparison
Jason Ekstrand [Fri, 17 Mar 2017 04:18:10 +0000 (21:18 -0700)]
spirv: Implement IsInf using an integer comparison

Since we already do fabs on the one source, we're guaranteed to get
positive infinity if we get any infinity at all.  Since +inf only has
one IEEE 754 representation, we can use an integer comparison and avoid
all of the ordered/unordered issues.

Cc: Dave Airlie <airlied@redhat.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/meta: fix image clears for r4g4 format.
Dave Airlie [Fri, 17 Mar 2017 04:23:56 +0000 (14:23 +1000)]
radv/meta: fix image clears for r4g4 format.

This just uses an 8-bit clear and packs the values.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoRevert "radv: fallback to an in-memory cache when no pipline cache is provided"
Dave Airlie [Mon, 20 Mar 2017 03:24:02 +0000 (13:24 +1000)]
Revert "radv: fallback to an in-memory cache when no pipline cache is provided"

This reverts commit 2845a108a9a8bd4b0e6e9b590c976452fb99eb10.

This break VK-GL-CTS randomly.
./deqp-vk --deqp-case=dEQP-VK.texture.filtering.3d.formats.r4g4b4a4*

bounces around here from 6/6 to 3/6 or 4/6 to hanging.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agomesa: disable glthread when glNewList() is called
Timothy Arceri [Thu, 16 Mar 2017 06:01:26 +0000 (17:01 +1100)]
mesa: disable glthread when glNewList() is called

glNewList() swaps dispatch tables, and we don't have anything in
place to handle that in glthread.

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
7 years agoradv: fix primitive reset index emission
Dave Airlie [Sun, 19 Mar 2017 04:17:14 +0000 (14:17 +1000)]
radv: fix primitive reset index emission

This was meant to be checking the index type to get the correct
index not the last emitted one. This fixes:
dEQP-VK.pipeline.input_assembly.primitive_restart.index_type_uint32.triangle_strip_with_adjacency

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoutil/disk_cache: check rename result
Grazvydas Ignotas [Sat, 18 Mar 2017 20:58:55 +0000 (22:58 +0200)]
util/disk_cache: check rename result

I haven't seen this causing problems in practice, but for correctness
we should also check if rename succeeded to avoid breaking accounting
and leaving a .tmp file behind.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoutil/disk_cache: delete .tmp if target exists
Grazvydas Ignotas [Sat, 18 Mar 2017 20:58:54 +0000 (22:58 +0200)]
util/disk_cache: delete .tmp if target exists

At the time of target file check, .tmp file is already created and file
lock is held, so we should remove the .tmp, like in other error paths.

With this, piglit no longer leaves large amount of empty .tmp files
behind, which waste directory entries and may interfere with eviction.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoutil/disk_cache: fix stored_keys index
Grazvydas Ignotas [Sat, 18 Mar 2017 22:46:39 +0000 (00:46 +0200)]
util/disk_cache: fix stored_keys index

It seems there is a bug because:
- 20 bytes are compared, but only 1 byte stored_keys step is used
- entries can overlap each other by 19 bytes
- index_mmap is ~1.3M in size, but only first 64K is used

With this fix for Deus Ex:
- startup time (from launch to Feral logo): ~38s -> ~16s
- disk_cache_has_key() hit rate: ~50% -> ~96%

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agonv30: create uploader after pipe->screen is set
Ilia Mirkin [Sun, 19 Mar 2017 05:22:29 +0000 (01:22 -0400)]
nv30: create uploader after pipe->screen is set

Fixes crashes after recent upload rework.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonv50,nvc0: enable TEX_LZ and TXF_LZ
Ilia Mirkin [Thu, 16 Mar 2017 03:29:47 +0000 (23:29 -0400)]
nv50,nvc0: enable TEX_LZ and TXF_LZ

There should be minimal gain, if any, for nvc0, but nv50 may end up
noticing more often that the lod argument is uniform. This, in turn,
will remove the need for some unnecessary transformations, which were
being hit due to the checks being done pre-ssa.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agost/mesa: set result writemask based on ir type
Ilia Mirkin [Sat, 4 Mar 2017 18:52:48 +0000 (13:52 -0500)]
st/mesa: set result writemask based on ir type

This prevents textureQueryLevels, which maps as LODQ, from ending up
with a xyzw writemask, which is illegal.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100061
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agonvc0/ir: treat FMA like MAD for operand propagation
Karol Herbst [Sun, 19 Mar 2017 00:08:56 +0000 (01:08 +0100)]
nvc0/ir: treat FMA like MAD for operand propagation

Helps mainly Feral-ported games, due to their use of fma()

shader-db changes:
total instructions in shared programs : 3901147 -> 3842505 (-1.50%)
total gprs used in shared programs    : 471258 -> 467359 (-0.83%)
total local used in shared programs   : 27405 -> 27361 (-0.16%)
total bytes used in shared programs   : 35749888 -> 35214176 (-1.50%)

                local        gpr       inst      bytes
    helped          17        1829        4091        4091
      hurt           4          44           3           3

Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
7 years agoutil/disk_cache: pass predicate functions file stats directly (v4)
Alan Swanson [Fri, 17 Mar 2017 18:05:43 +0000 (18:05 +0000)]
util/disk_cache: pass predicate functions file stats directly (v4)

Since switching to LRU eviction the only user of these predicate
functions now resolves directory entry stats itself so pass them
directly saving calling fstat and strlen twice (and the
expensive strlen is skipped entirely if access time is newer).

v2: Update for empty cache dir detection changes
v3: Fix passing string length to predicate with the +1 for NULL
    termination and also pass sb as pointer
v4: Missed ampersand for passing sb as pointer

Reviewed-by: Grazvydas Ignotas <notasas@gmail.com>
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: use set for copy propagation kills
Timothy Arceri [Fri, 17 Mar 2017 13:40:56 +0000 (00:40 +1100)]
glsl: use set for copy propagation kills

Previously each time we saw a variable we just created a duplicate
entry in the list. This is particularly bad for loops were we add
everything twice, and then throw nested loops into the mix and the
list was growing expoentially.

This stops the glsl-vs-unroll-explosion test which has 16 nested
loops from reaching the tests mem usage limit in this pass. The
test now hits the mem limit in opt_copy_propagation_elements()
instead.

I suspect this was also part of the reason this pass can be so
slow with some shaders.

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
7 years agost/dri: wait for thread to finish before unbinding context
Timothy Arceri [Fri, 17 Mar 2017 00:02:14 +0000 (11:02 +1100)]
st/dri: wait for thread to finish before unbinding context

Fixes a bunch of piglit crashes that hit an assert() when trying
to delete the framebuffer. The assert() was triggered because
WinSysDrawBuffer was set to NULL before glDeleteFramebuffers()
was called.

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoglsl: don't leak memory when trying to count loop iterations
Timothy Arceri [Fri, 17 Mar 2017 10:53:35 +0000 (21:53 +1100)]
glsl: don't leak memory when trying to count loop iterations

Suggested-by: Damian Dixon <damian.dixon@gmail.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99789

7 years agogenxml: Make MI_STORE_DATA_IMM have a single 64-bit data field
Jason Ekstrand [Tue, 14 Mar 2017 23:22:00 +0000 (16:22 -0700)]
genxml: Make MI_STORE_DATA_IMM have a single 64-bit data field

This is way more convenient than having two separate dword fields.

Reviewed-By: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoanv: Turn on inherited queries
Jason Ekstrand [Thu, 16 Mar 2017 21:17:59 +0000 (14:17 -0700)]
anv: Turn on inherited queries

It all just works since it's just a hardware register so we might as
well turn it on.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoanv: Implement pipeline statistics queries
Ilia Mirkin [Sun, 27 Nov 2016 19:23:23 +0000 (14:23 -0500)]
anv: Implement pipeline statistics queries

In the end, pipeline statistics queries look a lot like occlusion
queries only with between 1 and 11 begin/end pairs being generated
instead of just the one.

Reviewed-By: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoanv: Disable VF statistics for blorp and SOL memcpy
Jason Ekstrand [Thu, 16 Mar 2017 21:12:03 +0000 (14:12 -0700)]
anv: Disable VF statistics for blorp and SOL memcpy

In order to get accurate statistics, we need to disable statistics for
blits, clears, and the surface state memcpy at the top of each secondary
command buffer.  There are two possible approaches to this:

 1) Disable before the blit/memcpy and re-enable afterwards

 2) Move emitting 3DSTATE_VF_STATISTICS from initialization and make it
    part of pipeline state and then just disabale statistics before
    blits and memcpy operations.

Emitting 3DSTATE_VF_STATISTICS should be fairly cheap so it doesn't
really matter which path we take.  We choose the second option as it's
more consistent with the way the rest of the statistics are enabled and
disabled.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoanv/pipeline: Enable clipper statistics
Jason Ekstrand [Thu, 16 Mar 2017 19:32:16 +0000 (12:32 -0700)]
anv/pipeline: Enable clipper statistics

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agogenxml: s/Clipper Statistics Enable/Statistics Enable/
Jason Ekstrand [Thu, 16 Mar 2017 19:31:42 +0000 (12:31 -0700)]
genxml: s/Clipper Statistics Enable/Statistics Enable/

It's in 3DSTATE_CLIP, so it doesn't really need the extra detail.  This
matches what we do for VS, FS, etc.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoanv/query: Rework store_query_result
Jason Ekstrand [Wed, 15 Mar 2017 22:29:13 +0000 (15:29 -0700)]
anv/query: Rework store_query_result

The new version is a nice GPU parallel to cpu_write_query_result and it
nicely handles things like dealing with 32 vs. 64-bit offsets in the
destination buffer.

Reviewed-By: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoanv/query: Break GPU query calculation into a helper
Jason Ekstrand [Wed, 15 Mar 2017 22:24:48 +0000 (15:24 -0700)]
anv/query: Break GPU query calculation into a helper

Reviewed-By: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agogenxml: Add pipeline statistics registers on gen7+
Jason Ekstrand [Wed, 15 Mar 2017 22:18:21 +0000 (15:18 -0700)]
genxml: Add pipeline statistics registers on gen7+

Reviewed-By: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoanv/query: Add a helper for writing a query pool result
Jason Ekstrand [Wed, 15 Mar 2017 21:15:49 +0000 (14:15 -0700)]
anv/query: Add a helper for writing a query pool result

Reviewed-By: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoanv/query: Use a variable-length slot size
Jason Ekstrand [Wed, 15 Mar 2017 00:58:44 +0000 (17:58 -0700)]
anv/query: Use a variable-length slot size

Not all queries are the same.  Even the two queries we support today
require a different amount of data per slot.  Once we introduce pipeline
statistics queries, the size will vary wildly.

Reviewed-By: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoanv/query: Move the available bits to the front
Jason Ekstrand [Wed, 15 Mar 2017 00:56:05 +0000 (17:56 -0700)]
anv/query: Move the available bits to the front

We're about to make slots variable-length and always having the
available bits at the front makes certain operations substantially
easier once we do that.

Reviewed-By: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoanv/query: Let 32-bit values wrap
Jason Ekstrand [Wed, 15 Mar 2017 23:43:54 +0000 (16:43 -0700)]
anv/query: Let 32-bit values wrap

From the Vulkan 1.0.39 Specification:

   "If VK_QUERY_RESULT_64_BIT is not set and the result overflows a
   32-bit value, the value may either wrap or saturate."

So we can either clamp or wrap.  Wrapping is both easier and what the
user gets if they use vkCmdCopyQueryPoolResults and we should be
consistent.  We could make vkCmdCopyQueryPoolResults clamp but it's
annoying and ends up burning extra batch for something the spec clearly
doesn't require.

Reviewed-By: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoradeonsi: add new polaris12 pci id
Alex Deucher [Fri, 17 Mar 2017 15:13:09 +0000 (11:13 -0400)]
radeonsi: add new polaris12 pci id

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agogallium/radeon: formalize that create_batch_query doesn't need pipe_context
Marek Olšák [Wed, 1 Mar 2017 18:24:42 +0000 (19:24 +0100)]
gallium/radeon: formalize that create_batch_query doesn't need pipe_context

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agogallium/radeon: formalize that create_query doesn't need pipe_context
Marek Olšák [Wed, 1 Mar 2017 18:24:42 +0000 (19:24 +0100)]
gallium/radeon: formalize that create_query doesn't need pipe_context

for threaded gallium

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agogallium/radeon: reference pipe_resource in pipe_transfer
Marek Olšák [Thu, 2 Mar 2017 00:06:19 +0000 (01:06 +0100)]
gallium/radeon: reference pipe_resource in pipe_transfer

for threaded gallium

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoradeonsi: compile all TGSI compute shaders asynchronously
Marek Olšák [Sun, 5 Mar 2017 00:14:51 +0000 (01:14 +0100)]
radeonsi: compile all TGSI compute shaders asynchronously

required by threaded gallium

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoradeonsi: require that compiler threads are enabled
Marek Olšák [Thu, 2 Mar 2017 23:24:03 +0000 (00:24 +0100)]
radeonsi: require that compiler threads are enabled

threaded gallium can't use pipe_context's LLVM target machine, because
create_shader_selector can be called from a non-driver thread.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agotrace: remove leftover assertions after pipe_resource wrapping removal
Marek Olšák [Thu, 2 Mar 2017 18:01:35 +0000 (19:01 +0100)]
trace: remove leftover assertions after pipe_resource wrapping removal

7 years agogallium/u_upload: make the first persistent mapping unsynchronized
Marek Olšák [Thu, 2 Mar 2017 00:42:37 +0000 (01:42 +0100)]
gallium/u_upload: make the first persistent mapping unsynchronized

This is simpler for drivers.

7 years agoanv/device: init timestampPeriod from devinfo
Robert Bragg [Fri, 17 Mar 2017 15:54:07 +0000 (15:54 +0000)]
anv/device: init timestampPeriod from devinfo

Now that there's a timebase_scale in gen_device_info which is
effectively the 'period' this switches anv_GetPhysicalDeviceProperties
to using this common device info to initialize the timestampPeriod
device limit.

Signed-off-by: Robert Bragg <robert@sixbynine.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965: Allow a per gen timebase scale factor
Robert Bragg [Thu, 27 Oct 2016 21:08:19 +0000 (22:08 +0100)]
i965: Allow a per gen timebase scale factor

Prior to Skylake the Gen HW timestamps were driven by a 12.5MHz clock
with the convenient property of being able to scale by an integer (80)
to nanosecond units.

For Skylake the frequency is 12MHz or a scale factor of 83.333333

This updates gen_device_info to track a floating point timebase_scale
factor and makes corresponding _queryobj.c changes to no longer assume a
scale factor of 80 works across all gens.

Although the gen6_ code could have been been left alone, the changes
keep the code more comparable, and it now shares a few utility functions
for scaling raw timestamps and calculating deltas. The utility for
calculating deltas takes into account 32 or 36bit overflow depending on
the current kernel version.

Note: this leaves the timestamp handling of ARB_query_buffer_object
untouched, which continues to use an incorrect scale of 80 on Skylake
for now. This is more awkward to solve since the scaling is currently
done using a very limited uint64 ALU available to the command parser
that doesn't support multiply or divide where it's already taking a
large number of instructions just to effectively multiple by 80.

This fixes piglit arb_timer_query-timestamp-get on Skylake

v2: (Ken) Update timebase_scale for platforms past Skylake/Broxton too.

Signed-off-by: Robert Bragg <robert@sixbynine.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoanv/device: Remove a use of a compound literal
Jason Ekstrand [Thu, 16 Mar 2017 15:50:36 +0000 (08:50 -0700)]
anv/device: Remove a use of a compound literal

Older versions of GCC don't like compound literals in static const
variable declarations because they don't think it's an actual constant
value.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoi965: bounds checks while concatenating sysfs paths
Robert Bragg [Thu, 16 Mar 2017 22:41:09 +0000 (22:41 +0000)]
i965: bounds checks while concatenating sysfs paths

This adds some missing return value checks for all uses of snprintf in
brw_performance_query.c. This also switches a use of strncpy + strncat
for snprintf for consistency and to avoid the chance of the strncpy
leaving an unterminated string in the dest buffer if the src is too
long.

This issue with strncpy was picked up by Coverity.

CID: 1402201
Signed-off-by: Robert Bragg <robert@sixbynine.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agomesa: automake: add all headers to the tarball.
Emil Velikov [Thu, 16 Mar 2017 17:04:54 +0000 (17:04 +0000)]
mesa: automake: add all headers to the tarball.

Fixes: d8d81fbc316 ("mesa: Add infrastructure for a worker thread to process GL commands.")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomapi: automake: add all python scripts to EXTRA_DIST
Emil Velikov [Thu, 16 Mar 2017 16:29:16 +0000 (16:29 +0000)]
mapi: automake: add all python scripts to EXTRA_DIST

Otherwise it'll be missing in the tarball and make distcheck will fail.

Fixes: 05dd4a1104e ("glapi: Generate GL API marshalling code from the XML.")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoglapi: avoid using $< in non-suffix make rules
Jonathan Gray [Fri, 17 Mar 2017 06:10:22 +0000 (17:10 +1100)]
glapi: avoid using $< in non-suffix make rules

Using $< in non-suffix make rules is a GNU extension.  Explicitly use
the name of the python script to fix the build on OpenBSD.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.velikov@collabore.com>
7 years agoradv/ac: Fix shared memory offset calculation
Alex Smith [Thu, 16 Mar 2017 16:40:07 +0000 (16:40 +0000)]
radv/ac: Fix shared memory offset calculation

The index passed to get_shared_memory_ptr is an attribute slot index,
i.e. the index of a vec4 within LDS. Therefore this must be scaled by
sizeof(vec4) to give the LDS byte offset.

Fixes: f4e499ec791 ("radv: add initial non-conformant radv vulkan driver")
Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
CC: <mesa-stable@lists.freedesktop.org>
7 years agoradv: Fix using more than 4 bound descriptor sets
James Legg [Thu, 16 Mar 2017 17:48:13 +0000 (17:48 +0000)]
radv: Fix using more than 4 bound descriptor sets

Avoid a buffer overflow in ac_nir_to_llvm.c's create_function when
using more than 4 descriptor sets. radv claims support for 8.

Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoutil/build-id: check dlpi_name before strstr call
Tapani Pälli [Thu, 16 Mar 2017 06:10:57 +0000 (08:10 +0200)]
util/build-id: check dlpi_name before strstr call

According to dl_iterate_phdr man page first object visited is the
main program where dlpi_name is an empty string. This fixes segfault
on Android when using build-id as identifier.

Fixes: d4fa083e11f ("util: Add utility build-id code.")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoandroid: fix segfault within swap_buffers
Tapani Pälli [Thu, 16 Mar 2017 08:55:32 +0000 (10:55 +0200)]
android: fix segfault within swap_buffers

Function droid_swap_buffers may get called without dri2_surf->buffer set,
in these cases we don't have a back buffer set either. Patch fixes segfault
seen with 3DMark that uses android.opengl.GLSurfaceView for rendering it's UI.

backtrace:
   #00 pc 00013f88  /system/lib/egl/libGLES_mesa.so (droid_swap_buffers+104)
   #01 pc 000117b2  /system/lib/egl/libGLES_mesa.so (dri2_swap_buffers+50)
   #02 pc 000058b2  /system/lib/egl/libGLES_mesa.so (eglSwapBuffers+386)
   #03 pc 00011329  /system/lib/libEGL.so (eglSwapBuffersWithDamageKHR+553)
   #04 pc 000118e7  /system/lib/libEGL.so (eglSwapBuffers+55)
   #05 pc 000754dc  /system/lib/libandroid_runtime.so

v2: do like other backends, call get_back_bo (Emil Velikov)

Fixes: 2acc69d ("EGL/Android: Add EGL_EXT_buffer_age extension")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradv: make sure gs copy shader is retrieved from the cache with the variant
Timothy Arceri [Wed, 15 Mar 2017 02:07:40 +0000 (13:07 +1100)]
radv: make sure gs copy shader is retrieved from the cache with the variant

Apps can limit the size of the cache via VkAllocationCallbacks so we
can't be sure that both are always in the cache.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoradv: fallback to an in-memory cache when no pipline cache is provided
Timothy Arceri [Wed, 15 Mar 2017 04:20:48 +0000 (15:20 +1100)]
radv: fallback to an in-memory cache when no pipline cache is provided

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoradv: always create an fallback pipeline cache
Timothy Arceri [Wed, 15 Mar 2017 03:14:24 +0000 (14:14 +1100)]
radv: always create an fallback pipeline cache

This will be used as an in-memory cache when a pipeline cache is
not provided by the app.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoradv: move cache check inside insert and search functions
Timothy Arceri [Wed, 15 Mar 2017 01:40:53 +0000 (12:40 +1100)]
radv: move cache check inside insert and search functions

This will allow us to use fallback in-memory and on-disk caches
should the app not provide a pipeline cache.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agost/mesa: call glthread_destroy() before _vbo_DestroyContext()
Timothy Arceri [Thu, 16 Mar 2017 12:09:19 +0000 (23:09 +1100)]
st/mesa: call glthread_destroy() before _vbo_DestroyContext()

Otherwise we have a race condition between vbo calls in the
glthread and the _vbo_DestroyContext() call.

This fixes a bunch of piglit crashes.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoanv/GetQueryPoolResults: Actually implement the spec
Jason Ekstrand [Wed, 15 Mar 2017 03:48:47 +0000 (20:48 -0700)]
anv/GetQueryPoolResults: Actually implement the spec

The Vulkan spec is fairly clear about when we should and should not
write query pool results.  We're also supposed to return VK_NOT_READY if
VK_QUERY_RESULT_PARTIAL_BIT is not set and we come across any queries
which are not yet finished.  This fixes rendering corruptions on The
Talos Principle where geometry flickers in and out due to bogus query
results being returned by the driver.  These issues are most noticable
on Sky Lake GT4 2hen running on "ultra" settings.

Reviewed-By: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100182
Cc: "17.0 13.0" <mesa-stable@lists.freedesktop.org>
7 years agoanv/query: Invalidate the correct range
Jason Ekstrand [Wed, 15 Mar 2017 01:02:41 +0000 (18:02 -0700)]
anv/query: Invalidate the correct range

Reviewed-By: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "17.0 13.0" <mesa-stable@lists.freedesktop.org>
7 years agoanv/query: Fix the location of timestamp availability
Jason Ekstrand [Wed, 15 Mar 2017 00:52:12 +0000 (17:52 -0700)]
anv/query: Fix the location of timestamp availability

Reviewed-By: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "17.0 13.0" <mesa-dev@lists.freedesktop.org>
7 years agogenxml: Add XML version tags
Jason Ekstrand [Thu, 16 Mar 2017 05:33:00 +0000 (22:33 -0700)]
genxml: Add XML version tags

There's not much point to having them or not having them but this
reduces some pointless diff from the version we can auto-generate

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoaubinator: Use fprintf for output.
Kenneth Graunke [Wed, 15 Mar 2017 08:22:00 +0000 (01:22 -0700)]
aubinator: Use fprintf for output.

This will make it easier to choose an output file.  For now, it remains
stdout.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoaubinator: Reuse decode_structure code for handling commands
Kenneth Graunke [Wed, 15 Mar 2017 07:56:29 +0000 (00:56 -0700)]
aubinator: Reuse decode_structure code for handling commands

The code for decoding structures and commands was almost identical.
The only differences are: we print dword headers for commands, and
we skip the first one (with the command opcode and lengths).

So, generalize decode_structure to add a starting DWord, and a flag
for printing the DWord headers, and reuse it.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoaubinator: Delete redundant NULL check.
Kenneth Graunke [Wed, 15 Mar 2017 07:40:44 +0000 (00:40 -0700)]
aubinator: Delete redundant NULL check.

handle_struct_decode() is just a wrapper around decode_structure()
with a NULL check.  But the only caller already does that NULL check.

So, just use decode_structure() directly.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoaubinator: Fix indentation.
Kenneth Graunke [Wed, 15 Mar 2017 07:38:50 +0000 (00:38 -0700)]
aubinator: Fix indentation.

Three space, not four.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoi965/gen8+: Do full stall when switching pipeline
Topi Pohjolainen [Wed, 15 Mar 2017 19:31:07 +0000 (21:31 +0200)]
i965/gen8+: Do full stall when switching pipeline

just as earlier gens do.

CC: "17.0 13.0" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96743
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: remove uneeded asm/unistd.h include
Jonathan Gray [Thu, 16 Mar 2017 02:48:20 +0000 (13:48 +1100)]
i965: remove uneeded asm/unistd.h include

Fix the build on OpenBSD by removing an uneeded include for asm/unistd.h.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi965: automake: remove spurious white space
Emil Velikov [Thu, 16 Mar 2017 13:55:42 +0000 (13:55 +0000)]
i965: automake: remove spurious white space

Unintentionally introduced by yours truly with the i965 compiler move.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi965: avoid using a GNU make pattern rule
Jonathan Gray [Thu, 16 Mar 2017 02:49:36 +0000 (13:49 +1100)]
i965: avoid using a GNU make pattern rule

% pattern rules are a GNU extension.  As there is only one file here
avoid patterns and globbing entirely to fix the build on non-GNU make.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
v2 [Emil Velikov: brw_oa.py dependency]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs/releasing: document how to squash/announce queued patches
Emil Velikov [Wed, 15 Mar 2017 17:34:26 +0000 (17:34 +0000)]
docs/releasing: document how to squash/announce queued patches

In the odd case where a patch needs to be fixed, squash the appropriate
fix and document how. Add a note in the pre-release notes, such that
devs can quickly spot it.

v2: Grammar/typo fixes (Eric). Use upstream commit [SHA] as reference.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agodocs/releasing: release.sh is located in xorg/util-modular
Emil Velikov [Wed, 15 Mar 2017 17:34:25 +0000 (17:34 +0000)]
docs/releasing: release.sh is located in xorg/util-modular

Correct the silly typo s/macros/modular/ and add a reference to the
repository.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agodocs/releasing: remove "git clean" step
Emil Velikov [Wed, 15 Mar 2017 17:34:24 +0000 (17:34 +0000)]
docs/releasing: remove "git clean" step

release.sh from master, does not require the tree to be clean.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agomapi: remove Xlib/xcb include in gl_marshal.py
Emil Velikov [Thu, 16 Mar 2017 11:05:23 +0000 (11:05 +0000)]
mapi: remove Xlib/xcb include in gl_marshal.py

The only use of the header is to provide the _X_INLINE macro. We already
require (and provide where needed) 'inline', plus it's used in the file
already.

So replace the macro and drop the include. This fixes the build on
platforms which lack the header - from X-less Linuxes to Androids.

Fixes: 05dd4a1104e ("glapi: Generate GL API marshalling code from the XML.")
Reported-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100223
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs/specs: update Khronos registries URLs
Eric Engestrom [Thu, 16 Mar 2017 09:59:55 +0000 (09:59 +0000)]
docs/specs: update Khronos registries URLs

The registries were migrated to git and are now hosted on GitHub.
The old svn is now read-only, and will not be updated anymore.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
7 years agoanv: improve error reporting when creating pipelines
Iago Toral Quiroga [Thu, 9 Mar 2017 13:37:26 +0000 (14:37 +0100)]
anv: improve error reporting when creating pipelines

Specifically, report 'out of memory' errors that might have happened while
emitting the pipeline's batch.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv: handle errors in emit_binding_table() and emit_samplers()
Iago Toral Quiroga [Thu, 9 Mar 2017 10:34:22 +0000 (11:34 +0100)]
anv: handle errors in emit_binding_table() and emit_samplers()

These can fail to allocate device memory, however, the driver can recover
from this error by allocating a new binding table block and trying again.

v2:
  - Instead of tracking the errors in these functions and making callers
    reset the batch's status before attempting to allocate a new block
    for the binding table, simply make callers responsible for setting
    the error status if they fail to allocate memory during the second
    attempt (Jason).

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv: handle errors while allocating new binding table blocks
Iago Toral Quiroga [Mon, 6 Mar 2017 11:28:44 +0000 (12:28 +0100)]
anv: handle errors while allocating new binding table blocks

Also, we had a couple of instances in flush_descriptor_sets() were
we were returning a VkResult directly upon error, but the return
value of this function is not a VkResult but a uint32_t dirty mask,
so simply return 0 in these cases which reduces the amount of
work the driver will do after the error has been raised.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/blorp: make anv_cmd_buffer_alloc_blorp_binding_table() return a VkResult
Iago Toral Quiroga [Thu, 9 Mar 2017 10:49:01 +0000 (11:49 +0100)]
anv/blorp: make anv_cmd_buffer_alloc_blorp_binding_table() return a VkResult

Instead of asserting inside the function, and then use use that information
to return early from its callers upon failure.

v2:
  - Make sure that clear_color_attachment() and
    clear_depth_stencil_attachment() get the VkResult as well so they
    avoid executing the batch if an error happened. (Topi)

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/device: assert that commands submitted to a queue are not bogus
Iago Toral Quiroga [Thu, 9 Mar 2017 09:44:13 +0000 (10:44 +0100)]
anv/device: assert that commands submitted to a queue are not bogus

Any errors that may have happened during the command buffer recording are
reported by vkEndCommandBuffer() and it is the application's reponsibility
to not submit broken commands to a queue.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/cmd_buffer: skip vkCmdExecuteCommands() on broken command buffers
Iago Toral Quiroga [Mon, 6 Mar 2017 11:16:05 +0000 (12:16 +0100)]
anv/cmd_buffer: skip vkCmdExecuteCommands() on broken command buffers

v2: Assert on secondary commands, applications should've called
    vkEndCommandBuffer() and received an error for them before (Jason)

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/cmd_buffer: skip vkCmdDispatch() on broken command buffers
Iago Toral Quiroga [Mon, 6 Mar 2017 11:15:06 +0000 (12:15 +0100)]
anv/cmd_buffer: skip vkCmdDispatch() on broken command buffers

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/cmd_buffer: skip vkCmdDraw*() on broken command buffers
Iago Toral Quiroga [Mon, 6 Mar 2017 10:12:31 +0000 (11:12 +0100)]
anv/cmd_buffer: skip vkCmdDraw*() on broken command buffers

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv: handle memory allocation errors during queue submissions
Iago Toral Quiroga [Mon, 6 Mar 2017 11:04:19 +0000 (12:04 +0100)]
anv: handle memory allocation errors during queue submissions

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/cmd_buffer: handle out of memory during vkCmdPushConstants
Iago Toral Quiroga [Fri, 3 Mar 2017 10:31:14 +0000 (11:31 +0100)]
anv/cmd_buffer: handle out of memory during vkCmdPushConstants

Fixes:
dEQP-VK.api.out_of_host_memory.cmd_push_constants

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/cmd_buffer: handle allocation errors during vkCmdBeginRenderPass()
Iago Toral Quiroga [Wed, 8 Mar 2017 12:19:57 +0000 (13:19 +0100)]
anv/cmd_buffer: handle allocation errors during vkCmdBeginRenderPass()

Fixes:
dEQP-VK.api.out_of_host_memory.cmd_begin_render_pass

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/cmd_buffer: skip vkCmdEndRenderPass() for broken command buffers
Iago Toral Quiroga [Wed, 8 Mar 2017 12:18:52 +0000 (13:18 +0100)]
anv/cmd_buffer: skip vkCmdEndRenderPass() for broken command buffers

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/cmd_buffer: skip vkCmdNextSubpass() for broken command buffers
Iago Toral Quiroga [Wed, 8 Mar 2017 12:18:12 +0000 (13:18 +0100)]
anv/cmd_buffer: skip vkCmdNextSubpass() for broken command buffers

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/cmd_buffer: report tracked errors in vkEndCommandBuffer()
Iago Toral Quiroga [Wed, 8 Mar 2017 12:16:16 +0000 (13:16 +0100)]
anv/cmd_buffer: report tracked errors in vkEndCommandBuffer()

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv: handle failures when growing reloc lists
Iago Toral Quiroga [Fri, 3 Mar 2017 09:55:19 +0000 (10:55 +0100)]
anv: handle failures when growing reloc lists

Growing the reloc list happens through calling anv_reloc_list_add() or
anv_reloc_list_append(). Make sure that we call these through helpers
that check the result and set the batch error status if needed.

v2:
  - Handling the crashes is not good enough, we need to keep track of
    the error, for that, keep track of the errors in the batch instead (Jason).
  - Make reloc list growth go through helpers so we can have a central
    place where we can do error tracking (Jason).

v3:
  - Callers that need the offset returned by anv_reloc_list_add() can
    compute it themselves since it is extracted from the inputs to the
    function, so change the function to return a VkResult, make
    anv_batch_emit_reloc() also return a VkResult and let their callers
    do the error management (Topi)

v4:
  - Let anv_batch_emit_reloc() return an uint64_t as it originally did,
    there is no real benefit in having it return a VkResult.
  - Do not add an is_aux parameter to add_surface_state_reloc(), instead
    do error checking for aux in add_image_view_relocs() separately.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv: avoid crashes when failing to allocate batches
Iago Toral Quiroga [Thu, 9 Mar 2017 13:22:25 +0000 (14:22 +0100)]
anv: avoid crashes when failing to allocate batches

Most of the time we use macros that handle this situation transparently,
but there are some cases were we need to handle this explicitly.

This patch makes sure we don't crash, notice that error handling takes
place in the function that actually failed the allocation,
anv_batch_emit_dwords(), which will set the status field of the batch
so it can be used at a later moment to report the error to the user.

v2:
  - Not crashing is not good enough, we need to keep track of the error
    (Topi, Jason). Iago: now that we track errors in the batch, this
    is being handled.
  - Added guards in a few more places that needed it (Iago)

v3:
  - Check result of anv_batch_emitn() for NULL before calling memset()
    in emit_vertex_input() (Topi)

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv: handle allocation failure in anv_batch_emit_dwords()
Iago Toral Quiroga [Fri, 3 Mar 2017 09:56:33 +0000 (10:56 +0100)]
anv: handle allocation failure in anv_batch_emit_dwords()

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv: handle allocation failure in anv_batch_emit_batch()
Iago Toral Quiroga [Fri, 3 Mar 2017 10:17:03 +0000 (11:17 +0100)]
anv: handle allocation failure in anv_batch_emit_batch()

v2:
 - Call the error handler (Topi)

Fixes:
dEQP-VK.api.out_of_host_memory.cmd_execute_commands

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv: add anv_batch_set_error() and anv_batch_has_error() helpers
Iago Toral Quiroga [Wed, 8 Mar 2017 11:59:58 +0000 (12:59 +0100)]
anv: add anv_batch_set_error() and anv_batch_has_error() helpers

The anv_batch_set_error() helper will track the first error that happened
while recording a command buffer. The helper returns the currently tracked
error to help the job of internal functions that may generate errors that
need to be tracked and return a VkResult to the caller.

We will use the anv_batch_has_error() helper to guard parts of the driver
that are not safe to execute if an error has been generated while recording
a particular command buffer.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/cmd_buffer: add a status field to anv_batch
Iago Toral Quiroga [Wed, 8 Mar 2017 11:45:37 +0000 (12:45 +0100)]
anv/cmd_buffer: add a status field to anv_batch

The vkCmd*() functions do not report errors, instead, any errors should be
reported by the time we call vkEndCommandBuffer(). This means that we
need to make the driver robust against incosistent and/or imcomplete
command  buffer states through the command recording process, particularly,
avoid crashes due to access to memory that we failed to allocate previously.

The strategy used to do this is to track the first error ocurred while
recording a command buffer in the batch associated with it. We use the
batch to track this information because the command buffer may not be
visible to all parts of the driver that can produce errors we need to be
aware of (such as allocation failures during batch emissions).

Later patches will use this error information to guard parts of the driver
that may not be safe to execute.

v2: Move the field from the command buffer to the batch so we can track
    errors from batch emissions (Jason)

v3: Registering errors in the command buffer's batch during
    anv_create_cmd_buffer() is unnecessary, since the command buffer
    is freed at the end of the function in that case (Topi)

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/cmd_buffer: report errors in vkBeginCommandBuffer()
Iago Toral Quiroga [Mon, 6 Mar 2017 12:27:11 +0000 (13:27 +0100)]
anv/cmd_buffer: report errors in vkBeginCommandBuffer()

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv: do not try to ref/unref NULL shaders
Iago Toral Quiroga [Fri, 3 Mar 2017 09:57:17 +0000 (10:57 +0100)]
anv: do not try to ref/unref NULL shaders

This situation can happen if we failed to allocate memory for the shader.

v2:
 - We shouldn't see NULL shaders in anv_shader_bin_ref so we should not check
   for that (Jason). Make sure that callers don't attempt to call this
   function with a NULL shader and assert that this never happens (Iago).

v3:
 - All callers to anv_shader_bin_unref seem to check for NULL before calling,
   so just assert that it is not NULL (Topi)

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/blorp: return early if we failed to create the shader binary
Iago Toral Quiroga [Fri, 3 Mar 2017 09:58:23 +0000 (10:58 +0100)]
anv/blorp: return early if we failed to create the shader binary

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/blorp: make upload_shader() return a bool indicating success or failure
Iago Toral Quiroga [Tue, 14 Mar 2017 12:12:22 +0000 (13:12 +0100)]
intel/blorp: make upload_shader() return a bool indicating success or failure

For now we always return true, follow-up patches will handle fail scenarios.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv: remove unnecessary function prototype.
Iago Toral Quiroga [Thu, 9 Mar 2017 08:07:39 +0000 (09:07 +0100)]
anv: remove unnecessary function prototype.

The function is defined right after the prototype declaration. Also, the
protoype for it is included in anv_genX.h which is included via anv_private.h.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agomapi: don't include X11/Xlib-xcb.h on non PTHREAD platforms
Timothy Arceri [Thu, 16 Mar 2017 04:43:48 +0000 (15:43 +1100)]
mapi: don't include X11/Xlib-xcb.h on non PTHREAD platforms

Should fix the last of the glthread build issues on windows.

7 years agomesa: fix glthread marshal build issues on platforms without PTHREAD
Timothy Arceri [Thu, 16 Mar 2017 04:28:47 +0000 (15:28 +1100)]
mesa: fix glthread marshal build issues on platforms without PTHREAD

7 years agomesa: fix glthread build issues on platforms without PTHREAD
Timothy Arceri [Thu, 16 Mar 2017 03:46:16 +0000 (14:46 +1100)]
mesa: fix glthread build issues on platforms without PTHREAD

7 years agogallium: implement the backend of threaded GL dispatch
Marek Olšák [Sun, 5 Feb 2017 00:20:51 +0000 (01:20 +0100)]
gallium: implement the backend of threaded GL dispatch

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
7 years agomesa/glthread: restore the dispatch table when incompatible gl calls are detected
Gregory Hainaut [Sun, 12 Feb 2017 14:21:47 +0000 (15:21 +0100)]
mesa/glthread: restore the dispatch table when incompatible gl calls are detected

While a context only has a single glthread, the context itself can be
attached to several threads. Therefore the dispatch table must be
updated in all threads before the destruction of glthread. In others
words, glthread can only be destroyed safely when the context is deleted.

Fixes remaining crashes in the glx-multithread-makecurrent* tests.

V2: (Timothy Arceri) updated gl_API.dtd marshal_fail description.

Signed-off-by: Gregory Hainaut <gregory.hainaut@gmail.com>
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>