summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
Commit message (Collapse)AuthorAgeFilesLines
* st/glsl_to_nir: don't generate nir twice for gsTimothy Arceri2017-11-211-8/+2
| | | | | | This was left out of c980a3aa3133 Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: use asynchronous flushes in st_finishNicolai Hähnle2017-11-201-1/+1
| | | | | | | | | With threaded gallium, the driver may currently be running in another thread. In that case, we will execute all remaining commands in that thread instead of syncing, which should be better for cache locality. Reviewed-by: Andres Rodriguez <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: implement st_server_wait_sync properlyNicolai Hähnle2017-11-201-2/+24
| | | | | | | | | | | | | | | | | | | | | Asynchronous flushes require a proper implementation of st_server_wait_sync, because we could have the following with threaded Gallium: Context 1 app Context 1 driver Context 2 ------------- ---------------- --------- f = glFenceSync glFlush <-- app sync --> <-- app sync --> glWaitSync(f) .. draw calls .. pipe_context::flush for glFenceSync pipe_context::flush for glFlush Reviewed-by: Andres Rodriguez <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: use enum types instead of int/unsigned (v3)Brian Paul2017-11-164-12/+23
| | | | | | | | | | | | | Use the proper enum types for various variables. Makes life in gdb a little nicer. Note that the size of enum bitfields must be one larger so the high bit is always zero (for MSVC). v2: also increase size of image_format bitfield, per Eric Engestrom. v3: use the new ASSERT_BITFIELD_SIZE() macro Reviewed-by: Charmaine Lee <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* st/mesa: don't move ssbo after atomic buffers if we support hw atomicsDave Airlie2017-11-172-9/+13
| | | | | | | There is no need to have these overlap if we support hw atomics. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* mesa: split extensions overrides and glGetString(GL_EXTENSIONS)Emil Velikov2017-11-161-0/+1
| | | | | | | | | | | | | Currently we apply the extension overrides and construct the extensions string upon MakeCurrent. They are two distinct things, so let's slit the two while pushing the overrides management _before_ _mesa_compute_version(). This ensures that the version is updated to reflect the enabled/disabled extensions. Cc: Jordan Justen <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* st/mesa: whitespace fixes in st_manager.cBrian Paul2017-11-151-5/+31
| | | | Trivial.
* st/mesa: whitespace clean-ups in st_context.cBrian Paul2017-11-151-31/+46
| | | | Trivial.
* st/mesa: move st_manager_destroy() earlier in fileBrian Paul2017-11-151-13/+15
| | | | | | To avoid forward declaration. Reviewed-By: Gert Wollny <[email protected]>
* st/mesa: move st_init_driver_flags() earlier in fileBrian Paul2017-11-151-61/+62
| | | | | | To get rid of forward declaration. Reviewed-By: Gert Wollny <[email protected]>
* st/glsl_to_tgsi: use tgsi_get_gl_varying_semantic() for gs/tes outputsTimothy Arceri2017-11-151-91/+5
| | | | Reviewed-by: Nicolai Hähnle <[email protected]>
* st/glsl_to_tgsi: make use of tgsi_get_gl_varying_semantic()Timothy Arceri2017-11-151-71/+11
| | | | Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa/st: add missing copyright headers to memoryobjects filesAndres Rodriguez2017-11-142-0/+48
| | | | | Signed-off-by: Andres Rodriguez <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa/st/nir: assign driver_location for imagesRob Clark2017-11-121-2/+6
| | | | Signed-off-by: Rob Clark <[email protected]>
* st/program: fix compute shader nir referencesRob Clark2017-11-122-6/+24
| | | | | | | | | | | In case the IR is NIR, the driver takes reference to the nir_shader. Also, because there are no variants, we need to clone the shader, instead of sharing the reference with gl_program, which would result in a double free in _mesa_delete_program(). Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* st/atifs: remove unrequired initialisation of gl_program fieldsTimothy Arceri2017-11-121-4/+0
| | | | | | | | As far as I can tell these fields are only used to query arb program info and are not related to ATI_fragment_shader. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Miklós Máté <[email protected]>
* st/dri: fix deadlock when waiting on android fencesMarek Olšák2017-11-111-2/+0
| | | | | | | Android fences can't be deferred, because st/dri calls fence_finish with ctx = NULL, so the driver can't flush u_threaded_context. Reviewed-by: Nicolai Hähnle <[email protected]>
* st/dri: fix android fence regressionMarek Olšák2017-11-101-2/+5
| | | | | | | | | | | | | Fixes piglit - egl_khr_fence_sync/android_native tests. Broken by 884a0b2a9e55d4c1ca39475b50d9af598d7d7280. Introduce state-tracker flush flags, analogous to the pipe ones. Use the former when with stapi->flush(). Fixes: 884a0b2a9e5 ("st/dri: use stapi flush instead of pipe flush when creating fences") Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: enable ARB_texture_buffer_* extensions in the Compatibility profileMarek Olšák2017-11-094-4/+11
| | | | | | | | | | | | | | We already have piglit tests testing alpha, luminance, and intensity formats. They were skipped by piglit until now. Additionally, I'm enabling one ARB_texture_buffer_range piglit test to run with the compat profile. i965 behavior is unchanged except that it doesn't expose TBOs in the Compat profile. Not sure how that affects the GL version override. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* st/mesa: add support for hw atomics to glsl->tgsi. (v5)Dave Airlie2017-11-101-15/+87
| | | | | | | | | | | | | | | This adds support for creating the hw atomic tgsi from the glsl codepaths. v2: drop the atomic index and move to backend. v3: drop buffer decls. (Marek) v4: fix off by one (Gert) v5: fix off by one the other way (Dave) Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Tested-By: Gert Wollny <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* st/mesa: setup hw atomic limits. (v1.1)Dave Airlie2017-11-101-10/+35
| | | | | | | | | | | | | | | HW atomics need to use caps to set some limits, and some other limits may also need limiting. This fixes things up to work for evergreen hw, it may need more changes in the future if other hw wants to use this path. v1.1: fix indent. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Tested-By: Gert Wollny <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* st/mesa: start adding support for hw atomics atom. (v2)Dave Airlie2017-11-105-4/+48
| | | | | | | | | | | | | This adds a new atom that calls the new driver API to bind buffers containing hw atomics. v2: fixup bindings for sparse buffers. (mareko/nha) don't bind buffer atomics when hw atomics are enabled. use NewAtomicBuffer (mareko) Tested-By: Gert Wollny <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* st/mesa: remove 'struct' keyword on function parameterBrian Paul2017-11-091-2/+1
| | | | | | | st_src_reg is a class, not a struct. Simply remove 'struct' to silence a MSVC compiler warning (class vs. struct mismatch). Reviewed-by; Charmaine Lee <[email protected]>
* mesa: s/GLint/gl_buffer_index/ for _ColorDrawBufferIndexesBrian Paul2017-11-092-4/+4
| | | | | | | Also fix local variable declarations and replace -1 with BUFFER_NONE. No Piglit changes. Reviewed-by: Charmaine Lee <[email protected]>
* st/mesa: whitespace clean-up in st_mesa_to_tgsi.cBrian Paul2017-11-091-167/+169
| | | | | | Remove trailing whitespace, fix indentation, wrap lines to 78 columns, etc. Reviewed-by: Charmaine Lee <[email protected]>
* st/mesa: remove redundant flushes from st_flushNicolai Hähnle2017-11-093-3/+6
| | | | | | | | | | | st_flush should flush state tracker-internal state and the pipe, but not mesa/main state. Of the four callers: - glFlush/glFinish already call FLUSH_{VERTICES,STATE}. - st_vdpau doesn't need to call them. - st_manager will now call them explicitly. Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: guard sampler views changes with a mutexNicolai Hähnle2017-11-095-96/+250
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some locking is unfortunately required, because well-formed GL programs can have multiple threads racing to access the same texture, e.g.: two threads/contexts rendering from the same texture, or one thread destroying a context while the other is rendering from or modifying a texture. Since even the simple mutex caused noticable slowdowns in the piglit drawoverhead micro-benchmark, this patch uses a slightly more involved approach to keep locks out of the fast path: - the initial lookup of sampler views happens without taking a lock - a per-texture lock is only taken when we have to modify the sampler view(s) - since each thread mostly operates only on the entry corresponding to its context, the main issue is re-allocation of the sampler view array when it needs to be grown, but the old copy is not freed Old copies of the sampler views array are kept around in a linked list until the entire texture object is deleted. The total memory wasted in this way is roughly equal to the size of the current sampler views array. Fixes non-deterministic memory corruption in some dEQP-EGL.functional.sharing.gles2.multithread.* tests, e.g. dEQP-EGL.functional.sharing.gles2.multithread.simple.images.texture_source.create_texture_render Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: re-arrange st_finalize_textureNicolai Hähnle2017-11-092-8/+11
| | | | | | | | | | Move the early-out for surface-based textures earlier. This narrows the scope of the locking added in a follow-up commit. Fix one remaining case of initializing a surface-based texture without properly finalizing it. Reviewed-by: Marek Olšák <[email protected]>
* gallium: clarify the constraints on sampler_view_destroyNicolai Hähnle2017-11-091-1/+0
| | | | | | | | | | | | | | | | | r600 expects the context that created the sampler view to still be alive (there is a per-context list of sampler views). svga currently bails when the context of destruction is not the same as creation. The GL state tracker, which is the only one that runs into the multi-context subtleties (due to share groups), already guarantees that sampler views are destroyed before their context of creation is destroyed. Most drivers are context-agnostic, so the warning message in pipe_sampler_view_release doesn't really make sense. Reviewed-by: Marek Olšák <[email protected]>
* configure: check for -std=c++11 support and enable st/mesa test accordinglyGert Wollny2017-11-081-1/+3
| | | | | | | | | | | | | | | | | | Add a check that tests whether the c++ compiler supports c++11, either by default, by adding the compiler flag -std=c++11, or by adding a compiler flag that the user has specified via the environment variable CXX11_CXXFLAGS. The test only does a very shallow check of c++11 support, i.e. it tests whether the define __cplusplus >= 201103L to confirm language support by the compiler, and it checks whether the header <tuple> is available to test the availability of the c++11 standard library. A make file conditional HAVE_STD_CXX11 is provided that is used in this patch to enable the test in st/mesa if C++11 support is available. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102665 Acked-by: Emil Velikov <[email protected]>
* st/glsl_to_nir: use nir_shader_gather_info()Timothy Arceri2017-11-081-8/+10
| | | | | | | | Use the NIR helper rather than the GLSL IR helper to get in/out masks. This allows us to ignore varyings removed by NIR optimisations. Reviewed-by: Nicolai Hähnle <[email protected]>
* st/glsl_to_nir: generate NIR earlierTimothy Arceri2017-11-082-37/+14
| | | | | | | | We want to use nir_shader_gather_info() the GLSL IR version might be including varyings that NIR later eliminates. To do this we need to generate NIR before we we start using the in/out bitmasks. Reviewed-by: Nicolai Hähnle <[email protected]>
* st/glsl_to_nir: delay adding built-in uniforms to Parameters listTimothy Arceri2017-11-082-36/+34
| | | | | | | | Delaying adding built-in uniforms until after we convert to NIR gives us a better chance to optimise them away. Also NIR allows us to iterate over the uniforms directly so should be faster. Reviewed-by: Nicolai Hähnle <[email protected]>
* gallium: Wire up flush controlAdam Jackson2017-11-061-0/+3
| | | | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Adam Jackson <[email protected]>
* st/glsl_to_nir: pass gl_shader_program to st_finalize_nir()Timothy Arceri2017-11-033-27/+11
| | | | Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa/st: implement max combined output resources limiting.Dave Airlie2017-11-011-0/+6
| | | | | | | if the driver sets the cap, then use the value it gives us. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: Remove ir_binop_greater and ir_binop_lequal expressionsIan Romanick2017-10-301-20/+0
| | | | | | | | | | | | | | | | | | | NIR does not have these instructions. TGSI and Mesa IR both implement them using < and >=, repsectively. Removing them deletes a bunch of code and means I don't have to add code to the SPIR-V generator for them. v2: Rebase on 2+ years of change... and fix a major bug added in the rebase. text data bss dec hex filename 8255291 268856 294072 8818219 868e2b 32-bit i965_dri.so before 8254235 268856 294072 8817163 868a0b 32-bit i965_dri.so after 7815339 345592 420592 8581523 82f193 64-bit i965_dri.so before 7813995 345560 420592 8580147 82ec33 64-bit i965_dri.so after Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* st/mesa: enable nir path for all shaders.Dave Airlie2017-10-261-9/+1
| | | | | | | | There is no reason to block this here, if a driver enables it, let it handle it. Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* st/program: add support for gs/tes/tcs nir shaders.Dave Airlie2017-10-263-4/+56
| | | | | | | | This probably needs more work but this just add the initial code to convert gs/tcs/tes nir based shaders in the state tracker. Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* st/program: rework basic variant interfaceDave Airlie2017-10-263-15/+12
| | | | | | | This just passes st_common_program and uses it. Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl_to_tgsi: remove unused glsl_version variableMarek Olšák2017-10-261-3/+0
| | | | trivial
* nir: Get rid of nir_shader::stageJason Ekstrand2017-10-201-5/+5
| | | | | | | | It's redundant with nir_shader::info::stage. Acked-by: Timothy Arceri <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* st/mesa: correct a u_vbuf commentMarek Olšák2017-10-201-3/+5
| | | | trivial.
* st/mesa: set dimension for constants in ATI_fragment_shaderMiklós Máté2017-10-181-0/+4
| | | | | | | | | This fixes an assertion failure introduced by 30a2f0dfd46de. Fixes: 30a2f0dfd46 ("radeonsi: add an assertion that only Signed-off-by: Miklós Máté <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
* st/mesa: Initialize textures array in st_framebuffer_validateMichel Dänzer2017-10-181-0/+2
| | | | | | | | | | | | | | | | And just reference pipe_resources to it in the validate callbacks. Avoids pipe_resource leaks when st_framebuffer_validate ends up calling the validate callback multiple times, e.g. when a window is resized. v2: * Use generic stable tag instead of Fixes: tag, since the problem could already happen before the commit referenced in v1 (Thomas Hellstrom) * Use memset to initialize the array on the stack instead of allocating the array with os_calloc. Cc: [email protected] Reviewed-by: Thomas Hellstrom <[email protected]>
* compiler/blob: Switch to init/finish instead of create/destroyJason Ekstrand2017-10-121-11/+12
| | | | | | | | | There's no reason why that tiny bit of memory needs to be on the heap. We always put blob_reader on the stack, so why not do the same with the writable blob. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* compiler: Move blob up a levelJason Ekstrand2017-10-121-1/+1
| | | | | | | | We're going to want to use the blob for Vulkan pipeline caching so it makes sense to have it in libcompiler not libglsl. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* compiler: Move gl_program::TexelFetchSamplers to shader_info.Kenneth Graunke2017-10-122-2/+3
| | | | | | | I'd like to put this sort of metadata in the shader_info structure, rather than adding more things to gl_program. Reviewed-by: Nicolai Hähnle <[email protected]>
* st/glsl_to_tgsi: the second destination doesn't support relative addressingNicolai Hähnle2017-10-111-5/+2
| | | | | | | | It's not used -- DFRACEXP gets array indexes of its exponent out-parameter lowered earlier -- and it wouldn't have worked correctly anyway when both dst and dst1 use relative addressing. Reviewed-by: Marek Olšák <[email protected]>
* st/glsl_to_tgsi: fix DFRACEXP with only one destinationNicolai Hähnle2017-10-111-15/+23
| | | | | | | | Replace the undefined destination by a new temporary register. Cleanup merge_two_dsts while we're at it. Reviewed-by: Marek Olšák <[email protected]>