summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* mesa: add APPLE_vertex_array_object stubsTimothy Arceri2017-05-227-1/+53
| | | | | | | | | | | APPLE_vertex_array_object support was removed in 7927d0378fc7. However it turns out we can't remove the functions because this can cause issues when libglapi is used together with DRI drivers built prior to said commit Fixes: 7927d0378fc ("mesa: drop APPLE_vertex_array_object support") Reviewed-by: Emil Velikov <[email protected]>
* glsl: set mask via initialisation list rather than in constructor bodyTimothy Arceri2017-05-221-3/+1
| | | | | | | | | Potentially more efficient as it may avoid the struct being initialised twice. Also add var to the initialisation list while we are here. Reviewed-by: Samuel Pitoiset <[email protected]>
* ralloc: Use strnlen() inside of strncat()Vladislav Egorov2017-05-221-6/+1
| | | | | | | | | | | If the str is long or isn't null-terminated, strlen() could take a lot of time or even crash. I don't know why was it used in the first place, maybe for platforms without strnlen(), but strnlen() is already used inside of ralloc_strndup(), so this change should not additionally break anything. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glcpp: Skip unnecessary line continuations removalVladislav Egorov2017-05-221-2/+8
| | | | | | | | | | Overwhelming majority of shaders don't use line continuations. In my shader-db only shaders from the Talos Principle and Serious Sam used them, less than 1% out of all shaders. Optimize for this case, don't do any copying if no line continuation was found. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glcpp: Avoid unnecessary strcmp()Vladislav Egorov2017-05-221-5/+9
| | | | | | | | strcmp() is slow. Initiate comparison with "__LINE__" or "__FILE__" only if the identifier starts with '_', which is rare. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* main: Move hashLockMutex/hashUnlockMutex to header and inlineThomas Helland2017-05-222-45/+40
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* main: Use _mesa_HashLock/UnlockMutex consistentlyThomas Helland2017-05-221-13/+10
| | | | | | | | | This is shorter and easier on the eyes. At the same time this also ensures that we are always asserting that the table pointer is not NULL. Currently that was not done for all situations. Reviewed-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* util: Change the pointer hashing functionThomas Helland2017-05-221-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use our knowledge that pointers are at least 4 byte aligned to remove the useless digits. Then shift by 6, 10, and 14 bits and add this to the original pointer, effectively folding in the entropy of the higher bits of the pointer into a 4-bit section. Stopping at 14 means we can add the entropy from 18 bits, or at least a 600Kbyte section of memory. Assuming that ralloc allocates from a linearly allocated heap less than this we can make a very efficient pointer hashing function for our usecase. Even if we are not on an architecture that is 4 byte aligned, there is still a high big chance that the thing we are allocating is at least 8 bytes in size, so even then we will have entropy into the third bit. The 4 bit increment on the shifts is chosen rather arbitrarily; if we had chosen a 3 bit increment we would need to add another xor to cover a decently sized memorypool. Increasing it to 5 bits would spread our entropy more, possibly hurting us with more collisions on hash tables of size less than 32. With a hash table of size 16 there are a max of 11 entries, and we can assume that with such a small table collisions are not that painfull. This allows us to hash the whole 32 or 64 bit pointer at once, instead of running FNV1a, looping through each byte and doing increments, decrements, muls, and xors on every byte. This cuts _mesa_hash_data from 1.5 % on profiles, to making _mesa_hash_pointer show up with a 0.09% share. Collisions on insertion actually seems to be ever so slightly lower with this hash function, as found by printing a loop counter and sorting the data. perf stat shows a 1.5% reduction in instruction count, and a 5% reduction in stalled cycles. Shader-db runtime goes from 225 to 220 seconds. No instruction-count changes in shader-db, but there are some minor changes in cycle-count that is likely caused by nir walking a set in some of its passes, and this causing a different ordering. That might eventually lead to a difference in register allocation. However, the effect is a net positive; total cycles in shared programs: 24739550 -> 24738482 (-0.00%) cycles in affected programs: 374468 -> 373400 (-0.29%) helped: 178 HURT: 49 Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* vulkan/wsi/wayland: Fix proxy wrappers for swapchain recreationPhilipp Zabel2017-05-201-3/+10
| | | | | | | | | | | | | | Before the swapchain event queue is destroyed, all proxy objects that reference it must be dropped. Otherwise we risk a use-after-free if a frame callback event or buffer release events are received afterwards. This happens when an application destroys and recreates a swapchain in FIFO mode between two frames without using the VkSwapchainCreateInfoKHR::oldSwapchain mechanism to keep the old swapchain until after the next redraw. Fixes: 5034c615582a ("vulkan/wsi/wayland: Use proxy wrappers for swapchain") Signed-off-by: Philipp Zabel <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Cc: [email protected]
* drirc: Add allow_glsl_builtin_variable_redeclaration for Dying Light and ↵John Brooks2017-05-201-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Dead Island Definitive Edition This fixes the long-standing problem with Dying Light where the game would produce a black screen when running under Mesa. This happened because the game's vertex shaders redeclare gl_VertexID, which is a GLSL builtin. Mesa's GLSL compiler is a little more strict than others, and would not compile them: error: `gl_VertexID' redeclared The allow_glsl_builtin_variable_redeclaration directive allows the shaders to compile and the game to render. The game also requires OpenGL 4.4+ (GLSL 440), but does not request it explicitly. It must be forced with an override, such as MESA_GL_VERSION_OVERRIDE=4.5 and MESA_GLSL_VERSION_OVERRIDE=450. A compatibility context is *not* required and forcing one with 4.5COMPAT or allow_higher_compat_version results in graphical artifacts. Dead Island Definitive Edition is another Techland port on the same engine with the same problems, so we set the allow_glsl_builtin_variable_redeclaration option for that game as well. v2 (Samuel Pitoiset): - Rename allow_glsl_builtin_redeclaration -> allow_glsl_builtin_variable_redeclaration Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96449 Signed-off-by: John Brooks <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
* glsl: Conditionally allow redeclaration of built-in variablesJohn Brooks2017-05-203-0/+19
| | | | | | | | | | | | | Conditional on allow_glsl_builtin_variable_redeclaration driconf option. v2 (Samuel Pitoiset): - Rename allow_glsl_builtin_redeclaration -> allow_glsl_builtin_variable_redeclaration - style: put spaces after 'if' Signed-off-by: John Brooks <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
* driconf: Add allow_glsl_builtin_variable_redeclaration optionJohn Brooks2017-05-207-0/+20
| | | | | | | | | | | | | | | This option will allow GLSL builtins to be redeclared verbatim (e.g. redeclaring "in int gl_VertexID" in a vertex shader). This is not strictly valid and would normally fail to compile, but some applications (such as newer Techland ports) do it and need more leniency. v2 (Samuel Pitoiset): - Rename allow_glsl_builtin_redeclaration -> allow_glsl_builtin_variable_redeclaration Signed-off-by: John Brooks <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
* nv50,nvc0: clear index buffer bufctx bin unconditionallyIlia Mirkin2017-05-202-5/+3
| | | | | | | | | The previous condition was to clear it out if it had previously been set, not what's in the current draw. That information is gone now, so just clear it unconditionally. Fixes: 330d0607e ("gallium: remove pipe_index_buffer and set_index_buffer") Signed-off-by: Ilia Mirkin <[email protected]>
* nv50: fix vtxbuf cleanupIlia Mirkin2017-05-201-1/+1
| | | | | | | Use a user-buffer-aware cleanup function. Fixes: c24c3b94ed ("gallium: decrease the size of pipe_vertex_buffer - 24 -> 16 bytes") Signed-off-by: Ilia Mirkin <[email protected]>
* i965: Use the upload BO for push constants on Gen7.5-Gen8.Kenneth Graunke2017-05-202-2/+2
| | | | | | | | | | | | | | | | | | | | We can easily use the upload BO for push constants on Gen7.5/Gen8 too, at the cost of a relocation when emitting 3DSTATE_CONSTANT_XS. We can simply switch to using constant buffer pointer 2 instead of pointer 0, like we do on Gen9+. Ivybridge and Baytrail can't do this trick because they require the constant buffers to be enabled in order, starting with 0. We'd have to set the INSTPM bit to make the constant buffer pointer not relative to dynamic state base address, which would need kernel command parser support. Improves performance in GLBenchmark 2.7/TRex Offscreen by: - Broadwell GT2: 0.305608% +/- 0.19877% (n = 68) - Braswell: No difference proven (n = 742) - Haswell GT3e: 0.180755% +/- 0.0237505% (n = 30) Reviewed-by: Chris Forbes <[email protected]>
* i965: Use the upload BO for push constants on Gen9+.Kenneth Graunke2017-05-202-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Shaders can use quite a bit of uniform data. Better to put it in the upload buffers, like we do for client vertex data, rather than the batch buffer state area, which is primarly used for indirect state. This should free up batch space, allowing us to emit more commands in a batch before flushing. Because BRW_NEW_BATCH also causes a lot of state to be re-emitted, it may also reduce CPU overhead a little bit. We took this approach on Gen4-5, but switched to using the batch area on Gen6+ because buffer 0 is relative to Dynamic State Base Address by default, which is set to the start of the batch. On Gen9+, we already use a relocation due to a workaround, so this is trivial to change and has basically no downside. Unfortunately we can't change compute shader push constants because MEDIA_CURBE_LOAD always uses an offset from dynamic state base address. Improves performance in GLBenchmark 2.7/TRex Offscreen by: - Skylake GT4e: 0.52821% +/- 0.113402% (n = 190) - Apollolake: 0.510225% +/- 0.273064% (n = 70) Reviewed-by: Chris Forbes <[email protected]>
* i965: Drop BRW_NEW_PUSH_CONSTANT_ALLOCATION from CS packets.Kenneth Graunke2017-05-202-3/+1
| | | | | | | | | | | I don't think CS push constant uploading uses the section of L3 controlled by 3DSTATE_PUSH_CONSTANT_ALLOC_XS. So I don't think it needs to be re-emitted when that space is reallocated. The programming note in gen7_allocate_push_constants doesn't indicate this is necessary, at least. Reviewed-by: Chris Forbes <[email protected]>
* nvc0/ir: SHLADD's middle source must be an immediateIlia Mirkin2017-05-201-0/+2
| | | | | | | | The instruction encodings only allow for immediates. Don't try to replace a zero (which is dumb to have in that op in any case) with RZ. Signed-off-by: Ilia Mirkin <[email protected]> Cc: [email protected]
* android: add -Wl,--build-id=sha1 to LDFLAGS for libvulkan_intelTapani Pälli2017-05-201-0/+2
| | | | | | | Just like is done on desktop and what is expected by the build-id code. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* configure.ac: s/xcb-fixes/xcb-xfixes/Emil Velikov2017-05-201-1/+1
| | | | | | | | Former is not a thing, even if I have a hacked xcb-fixes.pc on my system. Thanks for spotting it Mark! Fixes: 9a90d6a9d4e ("configure.ac: add xcb-fixes to the XCB DRI3 list") Signed-off-by: Emil Velikov <[email protected]>
* configure.ac: add xcb-fixes to the XCB DRI3 listEmil Velikov2017-05-201-1/+1
| | | | | | | | | | | | | The XCB module is used by the VL targets. Thus omitting it can lead to link-time errors due to unresolved symbols. Other DRI3 users such as the Vulkan WSI and the dri3 loader helper do not use an update region in their xcb_present_pixmap() call. We will look into that at a later stage. Fixes: acf3d2afab0 ("configure: check once for DRI3 dependencies") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101110 Signed-off-by: Emil Velikov <[email protected]>
* automake: add SWR LLVM gen_builder.hpp workaroundEmil Velikov2017-05-202-30/+15
| | | | | | | | | | | | | | | | | | | | | As gen_builder.hpp file is generated, it contains information that is specific to the LLVM version it originates from. As suggested by Tim, the file seems to be forwards compatible. So in order to produce ship a file which will work everywhere we should be using earlies supported LLVM - 3.9. With this we're back on track and can build all of mesa without python/mako/flex and friends. In the long term we might want to see if the python generators can be updated to produce LLVM version agnostic files. At least within the range supported by SWR. Cc: <[email protected]> Cc: Chuck Atkins <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Tim Rowley <[email protected]>
* st/mesa: don't mark the program as in cache_fallback when there is cache missTimothy Arceri2017-05-203-2/+9
| | | | | | | | | | | | | | | | | | When we fallback currently the gl_program objects are re-allocated. This is likely to change when the i965 cache lands, but for now this fixes a crash when using MESA_GLSL=cache_fb. This env var simulates the fallback path taken when a tgsi cache item doesn't exist due to being evicted previously or some kind of error. Unlike i965 we are always falling back at link time so it's safe to just re-allocate everything. We will be unnecessarily freeing and re-allocate a bunch of things here but it's probably not a huge deal, and can be changed when the i965 code lands. Fixes: 0e9991f957e2 ("glsl: don't reference shader prog data during cache fallback") Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: add an env var to force cache fallbackTimothy Arceri2017-05-204-1/+10
| | | | | | | | | | | | | | | | | For the gallium state tracker a tgsi binary may have been evicted from the cache to make space. In this case we would take the fallback path and recompile/link the shader. On i965 there are a number of reasons we can get to the program upload stage and have neither IR nor a valid cached binary. For example the binary may have been evicted from the cache or we need a variant that wasn't previously cached. This environment variable enables us to force the fallback path that would be taken in these cases and makes it easier to debug these otherwise hard to reproduce scenarios. Reviewed-by: Nicolai Hähnle <[email protected]>
* st/mesa: improve shader cache debug infoTimothy Arceri2017-05-201-2/+4
| | | | | | | | | | | This will explicitly state that we are following the fallback path when we find invalid/corrupt cache items. It will also output the fallback message when the fallback path is forced via an environment variable, the following patches will allow this. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* travis: remove workarounds for the Vulkan targetEmil Velikov2017-05-191-5/+2
| | | | | | | | | | | | | | | Previously we required --enable-egl for the platform selection to work. Additionally due to the broken DRI3 dependency tracking we needed --enable-glx. Since both of these are now sorted now we no longer need the workarounds. While we're here, explicitly enable dri3. Cc: <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* configure: trivial whitespace cleanupEmil Velikov2017-05-191-2/+2
| | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* configure: error out if building XVMC w/o supported platformEmil Velikov2017-05-191-1/+10
| | | | | | Cc: <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* configure: error out if building VDPAU w/o supported platformEmil Velikov2017-05-191-1/+10
| | | | | | Cc: <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* configure: error out if building OMX w/o supported platformEmil Velikov2017-05-191-1/+10
| | | | | | Cc: <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* configure: error out if building VA w/o supported platformEmil Velikov2017-05-191-1/+10
| | | | | | | | | A bit pedantic patch to fool proof should someone start thinkering without knowing what they do. Cc: <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* st/xvmc: add DRI3 supportEmil Velikov2017-05-191-1/+3
| | | | | Signed-off-by: Emil Velikov <[email protected]> Tested-by: Ilia Mirkin <[email protected]>
* st/omx: add DRI3 supportEmil Velikov2017-05-191-1/+3
| | | | | | Cc: Christian König <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-and-Tested-by: Leo Liu <[email protected]>
* gallium/targets: link against XCB only as neededEmil Velikov2017-05-192-4/+12
| | | | | | | | OMX and VA can optionally use the X11 DRI2/DRI3, thus we should link only as required. Cc: <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
* st/omx: fix building against X11-less setupsEmil Velikov2017-05-191-0/+6
| | | | | | | | | | The vl_*_screen_create API properly falls back to a NOP when we're building without specific platforms. So the only thing we need is to handle the lack of X11/Xlib.h and provide a dummy Display define. Cc: <[email protected]> Cc: Christian König <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
* st/omx: remove unneeded X11 includeEmil Velikov2017-05-191-2/+0
| | | | | | | | | En route to a X11-less builds Cc: <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Nayan Deshmukh <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/omx: remove unused drm_driver.h includesEmil Velikov2017-05-192-2/+0
| | | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Nayan Deshmukh <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: check if vl_*_screen_create has failed only onceEmil Velikov2017-05-191-4/+3
| | | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Nayan Deshmukh <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: fix misplaced closing bracketEmil Velikov2017-05-191-1/+1
| | | | | | | | | | | It's been like this since the code was introduced. Fixes: 86eb4131a90 (st/va: add headless support, i.e. VA_DISPLAY_DRM) Cc: <[email protected]> Cc: Julien Isorce <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Nayan Deshmukh <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: move variable declaration to where its usedEmil Velikov2017-05-191-2/+1
| | | | | | | | ... and make it const, since we shouldn't tinker with it. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Nayan Deshmukh <[email protected]> Reviewed-by: Christian König <[email protected]>
* auxiliary/vl: use vl_*_screen_create stubs when building w/o platformEmil Velikov2017-05-195-19/+35
| | | | | | | | | | | | | | | | | | | | Provide a dummy stub when the user has opted w/o said platform, thus we can build the binaries without unnecessarily requiring X11/other headers. In order to avoid build and link-time issues, we remove the HAVE_DRI3 guards in the VA and VDPAU state-trackers. With this change st/va will return VA_STATUS_ERROR_ALLOCATION_FAILED instead of VA_STATUS_ERROR_UNIMPLEMENTED. That is fine since upstream users of libva such as vlc and mpv do little error checking, let alone distinguish between the two. Cc: Leo Liu <[email protected]> Cc: Guttula, Suresh <[email protected]> Cc: [email protected] Cc: Christian König <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
* configure: error out when building X11 Vulkan without DRI3Emil Velikov2017-05-191-0/+10
| | | | | | | | | | | Vulkan supports only DRI3 enabled X11 platforms. Make it obvious, should one consider building without it. Cc: Jason Ekstrand <[email protected]> Cc: Ville Syrjälä <[email protected]> Cc: [email protected] Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* loader: build libloader_dri3_helper.la only with HAVE_PLATFORM_X11Emil Velikov2017-05-191-0/+2
| | | | | | | | Pretty much every other place does the same. Cc: [email protected] Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* vulkan: automake: remove unused VULKAN_LIB_DEPS variableEmil Velikov2017-05-191-6/+0
| | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* configure: check once for DRI3 dependenciesEmil Velikov2017-05-1913-23/+22
| | | | | | | | | | | | | | | | Currently we are having the XCB_DRI3 dependencies duplicated, partially. Just do a once-off check and add all of the respective CFLAGS/LIBS where needed. As a nice side effect this helps us solve a couple of FIXMEs. DRI3 is not a thing w/o X11 so disable it in such cases. Cc: [email protected] Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* configure: error out when building GLX w/o the X11 platformEmil Velikov2017-05-191-0/+6
| | | | | | | | | | | | | | | | Building EGL/Vulkan/other without X11, while GLX is enabled is confusing and misleading. In practise anyone aiming at the former will also disable GLX. The inverse (some examples below) should still work: ./configure --disable-glx --with-platforms=x11 --with-vulkan-drivers=intel ./configure --disable-glx --with-platforms=x11 --enable-egl Keep in mind that the X11 platform is enabled, by default. Cc: <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* configure: set HAVE_foo_PLATFORM as applicableEmil Velikov2017-05-193-6/+5
| | | | | | | | | | Rather than having multiple places that define the macros, do it just once in configure. Makes existing code a bit shorter and easier to manage as we fix the VL targets with follow-up commits. Cc: [email protected] Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* configure: enable the surfaceless platform by defaultEmil Velikov2017-05-192-4/+3
| | | | | | | | | | | | | A simple platform that you want to use in a many usecases. See the spec file details. It has no special requirements plus it takes less than a second to build. Cc: [email protected] Signed-off-by: Emil Velikov <[email protected]> Acked-by: Tapani Pälli <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* configure: loosen --with-platforms heuristicsEmil Velikov2017-05-191-7/+3
| | | | | | | | | Remove the enable-egl pre-requirement. Platform selection does not depend on EGL. Cc: <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* configure: update remaining --with-egl-platforms referencesEmil Velikov2017-05-194-27/+25
| | | | | | | | Rename the remaining references to omit the egl part. Cc: [email protected] Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>