summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Fix races during _mesa_HashWalk().Steinar H. Gunderson2016-11-121-11/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is currently no protection against walking a hash (using _mesa_HashWalk()) and modifying it at the same time, for instance by inserting or deleting elements. This leads to segfaults in multithreaded code if e.g. someone calls glTexImage2D (which may have to walk the list of FBOs) while another thread is calling glDeleteFramebuffers on another thread with the two contexts sharing lists. The reason for this is that _mesa_HashWalk() doesn't actually take the mutex that normally protects the hash; it takes an entirely different mutex. Thus, walks are only protected against other walks, and there is also no outer lock taking this. There is an old comment saying that this is to fix problems with deadlock if the callback needs to take a mutex; we solve this by changing the mutex to be recursive. A demonstration Helgrind hit from a real application: ==13412== Possible data race during write of size 8 at 0x3498C6A8 by thread #1 ==13412== Locks held: 2, at addresses 0x1AF09530 0x2B3DF400 ==13412== at 0x1F040C99: _mesa_hash_table_remove (hash_table.c:395) ==13412== by 0x1EE98174: _mesa_HashRemove_unlocked (hash.c:350) ==13412== by 0x1EE98174: _mesa_HashRemove (hash.c:365) ==13412== by 0x1EE2372D: _mesa_DeleteFramebuffers (fbobject.c:2669) ==13412== by 0x6105AA4: movit::ResourcePool::cleanup_unlinked_fbos(void*) (resource_pool.cpp:473) ==13412== by 0x610615B: movit::ResourcePool::release_fbo(unsigned int) (resource_pool.cpp:442) [...] ==13412== This conflicts with a previous read of size 8 by thread #20 ==13412== Locks held: 2, at addresses 0x1AF09558 0x1AF73318 ==13412== at 0x1F040CD9: _mesa_hash_table_next_entry (hash_table.c:415) ==13412== by 0x1EE982A8: _mesa_HashWalk (hash.c:426) ==13412== by 0x1EED6DFD: _mesa_update_fbo_texture.part.33 (teximage.c:2683) ==13412== by 0x1EED9410: _mesa_update_fbo_texture (teximage.c:3043) ==13412== by 0x1EED9410: teximage (teximage.c:3073) ==13412== by 0x1EEDA28F: _mesa_TexImage2D (teximage.c:3105) ==13412== by 0x166A68: operator() (mixer.cpp:454) There are many more interactions than just these two possible. Cc: 11.2 12.0 13.0 <[email protected]> Signed-off-by: Steinar H. Gunderson <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* i965: Drop tabs in brw_state.h.Kenneth Graunke2016-11-111-13/+13
|
* ac/nir/llvm: Fix setting function attributes for intrinsicsDaniel Scharrer2016-11-111-1/+5
| | | | | | | | This fixes a NULL pointer dereference for intrinsics with more than one function attribute introduced in commit 2fdaf38. The fix is ported from the lp_build_intrinsic changes in commit 8bdd52c. Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* i965: Update a comment: s/brw_state_cache/brw_program_cache/gKenneth Graunke2016-11-111-2/+2
| | | | | | Tim renamed this recently - stop referring to it by the old name. Signed-off-by: Kenneth Graunke <[email protected]>
* clover: fix building since llvm r286566Laurent Carlier2016-11-111-0/+5
| | | | pretty trivial fix
* egl/wayland: fix return value in dri2_wl_swrast_commit_backbufferEmil Velikov2016-11-111-1/+1
| | | | | | | | | | The function returns "void" rather than int. We could rework that, yet again there will be no benefit since all the callers have no use of it. Fixes: 9ca6711faa0 ("Revert "wayland: Block for the frame callback in get_back_bo not dri2_swap_buffers"") Reviewed-by: Daniel Stone <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
* glsl: define __STDC_FORMAT_MACROS to get PRIx64 macroBrian Paul2016-11-111-0/+1
| | | | | | | Otherwise, inttypes.h may not define the macro for C++ on MinGW. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98681 Reviewed-by: Emil Velikov <[email protected]>
* mesa: fix comment indentation in bind_buffers_check_offset_and_size()Brian Paul2016-11-111-10/+10
| | | | Trivial.
* glsl: automake: add opt_add_neg_to_sub.h to the sources listEmil Velikov2016-11-111-0/+1
| | | | | | Otherwise it'll be missing in the release tarball. Signed-off-by: Emil Velikov <[email protected]>
* i965: update gl_PrimitiveIDIn to be a system variableTimothy Arceri2016-11-113-13/+4
| | | | | | | Now that we have switched to using nir_shader_gather_info() we can remove the hacks and just use the system variable. Reviewed-by: Kenneth Graunke <[email protected]>
* i965: use nir_shader_gather_info() over do_set_program_inouts()Timothy Arceri2016-11-112-2/+2
| | | | | | | This takes us one step closer to being able to drop the GLSL IR optimisation passes during linking in favour of the NIR passes. Reviewed-by: Kenneth Graunke <[email protected]>
* i965: remove remaining tabs in brw_program_cache.cTimothy Arceri2016-11-111-30/+28
| | | | Acked-by: Kenneth Graunke <[email protected]>
* i965: rename brw_state_cache_check_size() to brw_program_cache_check_size()Timothy Arceri2016-11-114-4/+4
| | | | Acked-by: Kenneth Graunke <[email protected]>
* i965: rename brw_state_cache.c -> brw_program_cache.cTimothy Arceri2016-11-114-9/+9
| | | | Acked-by: Kenneth Graunke <[email protected]>
* i965/gs: Allow primitive id to be a system valueJason Ekstrand2016-11-101-1/+2
| | | | | | | | | This allows for gl_PrimitiveId to come in as a system value rather than as an input. This is the way it will come in from SPIR-V. We keeps the input path working for now so we don't break GL. Reviewed-by: Kenneth Graunke <[email protected]> Cc: "13.0" <[email protected]>
* vulkan/wsi/x11: Implement FIFO mode.Jason Ekstrand2016-11-101-10/+164
| | | | | | | | | | | This implements VK_PRESENT_MODE_FIFO_KHR for X11. Unfortunately, due to the way the present extension works, we have to manage the queue of presented images in a separate thread. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Cc: "13.0" <[email protected]>
* vulkan/wsi: Report the correct min/maxImageCountJason Ekstrand2016-11-102-26/+20
| | | | | | | | | | | | | | | | | | | | | | | | | From the Vulkan spec 1.0.32 section 29.6 docs for vkAcquireNextImageKHR: "Let n be the total number of images in the swapchain, m be the value of VkSurfaceCapabilitiesKHR::minImageCount, and a be the number of presentable images that the application has currently acquired (i.e. images acquired with vkAcquireNextImageKHR, but not yet presented with vkQueuePresentKHR). vkAcquireNextImageKHR can always succeed if a ≤ n - m at the time vkAcquireNextImageKHR is called. vkAcquireNextImageKHR should not be called if a > n - m with a timeout of UINT64_MAX; in such a case, vkAcquireNextImageKHR may block indefinitely." With minImageCount == 2 (as it was previously, the client is allowed to acquire all but one image withoutblocking. If we really need 4 images for mailbox mode + pageflipping, then we need to request a minimum of 4 images up-front. This is a bit unfortunate because it means we will always consume 4 images. In the future, we may be able to optimize this a bit by waiting until the server starts to flip and returning OUT_OF_DATE to get the client to re-allocate with more images or something like that. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Cc: "13.0" <[email protected]>
* vulkan/wsi: Add a thread-safe queue implementationKevin Strasser2016-11-102-1/+156
| | | | | | | | | | | | | | | In order to support FIFO mode without blocking the application on calls to vkQueuePresentKHR it is necessary to enqueue the request and defer calling the server until the next vblank period. The xcb present api doesn't offer a way to register a callback, so we will have to spawn a worker thread that will wait for a request to be added to the queue, call to the server, and then make the image available for reuse. This commit introduces the queue data structure needed to implement this. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Cc: "13.0" <[email protected]>
* android/i965: add libmesa_i965_compiler static libraryTapani Pälli2016-11-111-4/+28
| | | | | | | | this will be shared between OpenGL and Vulkan drivers Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* android: add SPIRV_FILES to libmesa_nirTapani Pälli2016-11-111-1/+2
| | | | | | Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* anv: use STATIC_ASSERT instead of static_assertTapani Pälli2016-11-111-2/+2
| | | | | | | | | | | fixes following compilation warnings on Android build: "warning: implicit declaration of function 'static_assert' is invalid in C99 [-Wimplicit-function-declaration]" Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* util: use STATIC_ASSERT instead of static_assertTapani Pälli2016-11-111-1/+1
| | | | | | | | | | | fixes following compilation warnings on Android build: "warning: implicit declaration of function 'static_assert' is invalid in C99 [-Wimplicit-function-declaration]" Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* vulkan: import latest public vulkan headers + and fix drivers.Dave Airlie2016-11-114-59/+413
| | | | | | | | | I just noticed the new vulkan headers changed a prototype, so I've decided to import them and fix the drivers to use the new API. Acked-by: Jason Ekstrand <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* docs: add news item and link release notes for 12.0.4Emil Velikov2016-11-112-0/+7
| | | | Signed-off-by: Emil Velikov <[email protected]>
* docs: add sha256 checksums for 12.0.4Emil Velikov2016-11-111-1/+2
| | | | | Signed-off-by: Emil Velikov <[email protected]> (cherry picked from commit 7b9d7257b27c15547ffab8d73d10d8a850af364a)
* docs: add release notes for 12.0.4Emil Velikov2016-11-111-0/+320
| | | | | Signed-off-by: Emil Velikov <[email protected]> (cherry picked from commit 3776e97f9d366db8a720e2412ece6a1059999858)
* glsl: include inttypes.h for PRIx64 macroBrian Paul2016-11-101-0/+1
| | | | | | To fix MinGW build. Reviewed-by: Roland Scheidegger <[email protected]>
* radv: fix texturesamples to handle single sample caseDave Airlie2016-11-111-2/+10
| | | | | | | | | | | | We can only read the valid samples if this is an MSAA texture, which means the type field must be 0x14 or 0x15. This fixes: dEQP-VK.glsl.texture_functions.query.texturesamples.* Cc: "13.0" <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* anv/cmd_buffer: Enable a CS stall workaround for Sky Lake gt4Jason Ekstrand2016-11-101-0/+6
| | | | | | | This fixes hangs in Dota2 Reviewed-by: Kenneth Graunke <[email protected]> Cc: "12.0 13.0" <[email protected]>
* anv/cmd_buffer: Take a command buffer instead of a batch in two helpersJason Ekstrand2016-11-101-8/+8
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Cc: "12.0 13.0" <[email protected]>
* glsl/standalone: Add the ability to generate ir_builder codeIan Romanick2016-11-103-0/+14
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* glsl: Add a C++ code generator that uses ir_builder to rebuild a programIan Romanick2016-11-103-0/+790
| | | | | | | | | | | | | This is only in libstandalone currently because it will only be used in the stand-alone compiler. v2: Change the signature of the generated function. The ir_factory is created in the generator, and an availability predicate is taken as a parameter. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: Generate strings that are the enum names without the ir_*op_ prefixIan Romanick2016-11-102-0/+7
| | | | | | | | | | For many expressions, this is different from the printable name. The printable name for ir_binop_add is "+", but we want "add". This is needed for ir_builder_print_visitor. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl/standalone: Enable par-linkingIan Romanick2016-11-104-2/+49
| | | | | | | | | | | | | | | | | | | | | | If the user did not request full linking, link the shader with the built-in functions, inline them, and eliminate them. Previous to this you'd see all these calls to "dot" and "max" in the output. This prevented a lot of expected optimizations and cluttered the output. This gives it some chance of being useful. v2: Rebase on top of Ken's "built-ins now" work. v3: Don't do_common_optimizations if par-linking fails. Update expected output of warnings tests to prevent 'make check' regressions. v4: Optimize harder. Most important, do function inlining. Otherwise it's quite impractical for one function in a file to call another function in the same file. v5: Add some code simplifications and an assertion suggested by Iago. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* glsl/standalone: Optimize dead variable declarationsIan Romanick2016-11-101-0/+61
| | | | | | | | | | | | | We didn't bother with this in the regular compiler because it doesn't change the generated code. In the stand-alone compiler, this can clutter the output with useless variables. It's especially bad after functions are inlined but the foo_retval declarations remain. v2: Use set_foreach. Suggested by Tapani. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* glsl/standalone: Optimize add-of-neg to subtractIan Romanick2016-11-104-0/+276
| | | | | | | | | | | | | This just makes the output of the standalone compiler a little more compact. v2: Fix indexing typo noticed by Iago. Move the add_neg_to_sub_visitor to it's own header file. Add a unit test that exercises the visitor. Both the neg_a_plus_b and neg_a_plus_neg_b tests reproduced the bug that Iago discovered. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl/linker: Allow link_intrastage_shaders when there is no main()Ian Romanick2016-11-102-11/+26
| | | | | | | | This enables a sort of par-linking. The primary use for this feature is resolving built-in functions in the stand-alone compiler. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* nir: update nir_gather_info to only mark used array/matrix elementsTimothy Arceri2016-11-111-53/+207
| | | | | | | | | | This is based on the code from the GLSL IR pass however unlike the GLSL IR pass it also supports arrays of arrays. As well as implementing the logic from the GLSL IR pass we add some additional intrinsic cases to catch more system values. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa/compiler: move MAX_VARYING to shader_enums.hKenneth Graunke2016-11-112-1/+1
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* nir: add more helpers to nir_types.cppTimothy Arceri2016-11-112-0/+21
| | | | | | These new helpers will be used in nir_gather_info.c in a following patch. Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Generalize the "is per-vertex variable?" helpers and export them.Kenneth Graunke2016-11-112-18/+17
| | | | | | | | I want this function for nir_gather_info(), and realized it's basically the same as the ones in nir_lower_io(). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* nvc0: support MP performance counters on MaxwellSamuel Pitoiset2016-11-103-3/+721
| | | | | | | This adds some performance counters/metrics for SM50/SM52. Signed-off-by: Samuel Pitoiset <[email protected]> Tested-by: Pierre Moreau <[email protected]>
* gallium: detect avx512 cpu featuresTim Rowley2016-11-102-0/+36
| | | | | | | v3: fix check for xmm/ymm test v2: style code, add avx512 to cpu dump Reviewed-by: Roland Scheidegger <[email protected]>
* glsl: Parse 0 as a preprocessor INTCONSTANTIan Romanick2016-11-101-0/+4
| | | | | | | | | | | | | | | | | This allows a more reasonable error message for '#version 0' of 0:1(10): error: GLSL 0.00 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES instead of 0:1(10): error: syntax error, unexpected $undefined, expecting INTCONSTANT Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97420 Reviewed-by: Nicolai Hähnle <[email protected]> Cc: [email protected] Cc: Juan A. Suarez Romero <[email protected]> Cc: Karol Herbst <[email protected]>
* glcpp: Handle '#version 0' and other invalid valuesIan Romanick2016-11-102-6/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The #version directive can only handle decimal constants. Enforce that the value is a decimal constant. Section 3.3 (Preprocessor) of the GLSL 4.50 spec says: The language version a shader is written to is specified by #version number profile opt where number must be a version of the language, following the same convention as __VERSION__ above. The same section also says: __VERSION__ will substitute a decimal integer reflecting the version number of the OpenGL shading language. Use a separate flag to track whether or not the #version line has been encountered. Any possible sentinel (0 is currently used) could be specified in a #version directive. This would lead to trying to (internally) redefine __VERSION__. Since there is no parser location for this addition, NULL is passed. This eventually results in a NULL dereference and a segfault. Attempts to use -1 as the sentinel would also fail if '#version 4294967295' or '#version 18446744073709551615' were used. We should have piglit tests for both of these. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97420 Reviewed-by: Nicolai Hähnle <[email protected]> Cc: [email protected] Cc: Juan A. Suarez Romero <[email protected]> Cc: Karol Herbst <[email protected]>
* linker: Remove unnecessary overload of program_resource_visitor::visit_fieldIan Romanick2016-11-105-51/+22
| | | | | | | | | | | | | It looks like I added this version as a short-hand for users that didn't need the fuller version. I don't think there's any real utility in that. I'm not sure what my thinking was there. Maybe if those users overloaded the recursion function could just call the compact version to avoid passing some parameters? None of the users do that. Either way, having this extra overload is not useful. Delete it. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* radv: automake: list correct file in the EXTRA_DISTEmil Velikov2016-11-101-1/+1
| | | | | | | | | Earlier commit renamed the file radeon_icd.json{,.in} but missed one reference of the file - in EXTRA_DIST. Cc: "13.0" <[email protected]> Fixes: 0f434a68a ("radv: Suffix the radeon_icd file with the host CPU") Signed-off-by: Emil Velikov <[email protected]>
* mesa: remove LowerShaderSharedVariablesMarek Olšák2016-11-104-10/+1
| | | | | | always true for compute shaders Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: handle partial swizzles in opt_dead_code_local correctlyMarek Olšák2016-11-101-3/+6
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: don't run loop passes if loop unrolling is disabledMarek Olšák2016-11-101-5/+7
| | | | Reviewed-by: Kenneth Graunke <[email protected]>