summaryrefslogtreecommitdiffstats
path: root/src/mesa
Commit message (Collapse)AuthorAgeFilesLines
* mesa/st: Handle 16-bit types at st_glsl_storage_type_size()Eduardo Lima Mitev2017-12-061-0/+3
| | | | | | | | | | | This is basically to avoid "not handle in switch" warnings. v2: Let the new types hit the assertion instead. (Marek Olšák and Jason Ekstrand) Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: Add 16-bit typesEduardo Lima Mitev2017-12-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds new INT16, UINT16 and FLOAT16 base types. The corresponding GL types for half floats were reused from the AMD_gpu_shader_half_float extension. The int16 and uint16 types come from NV_gpu_shader_5 extension. This adds the builtins and the lexer support. To avoid a bunch of warnings due to cases not handled in switch, the new types have been added to a few places using same behavior as their 32-bit counterparts, except for a few trivial cases where they are already handled properly. Subsequent patches in this set will provide correct 16-bit implementations when needed. v2: * Use FLOAT16 instead of HALF_FLOAT as name of the base type. * Removed float16_t from builtin types. * Don't copy 16-bit types as if they were 32-bit values in copy_constant_to_storage(). * Use get_scalar_type() instead of adding a new custom switch statement. (Jason Ekstrand) v3: Use GL_FLOAT16_NV instead of GL_HALF_FLOAT for consistency (Ilia Mirkin) v4: Add missing 16-bit base types support in glsl_to_nir (Eduardo Lima). v5: Fix coding style (Topi Poholainen). Signed-off-by: Jose Maria Casanova Crespo <[email protected]> Signed-off-by: Eduardo Lima <[email protected]> Signed-off-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: add const qualifier on _mesa_is_renderable_texture_format()Brian Paul2017-12-052-2/+4
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* mesa: add const qualifier on _mesa_base_fbo_format()Brian Paul2017-12-052-2/+2
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* mesa: s/%u/%d/ in _mesa_error() call in check_layer()Brian Paul2017-12-051-2/+1
| | | | | | | | The layer parameter is signed. Fixes the error message seen when running the arb_texture_multisample-errors test which checks a negative layer value. Reviewed-by: Marek Olšák <[email protected]>
* mesa: simplify/improve some _mesa_error() calls in teximage.cBrian Paul2017-12-051-9/+5
| | | | Reviewed-by: Marek Olšák <[email protected]>
* mesa: trivial whitespace fixes in transformfeedback.cBrian Paul2017-12-051-9/+9
| | | | Reviewed-by: Marek Olšák <[email protected]>
* mesa: add const qualifier in test_attachment_completeness()Brian Paul2017-12-051-1/+1
| | | | Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: remove unneeded #include in st_format.hBrian Paul2017-12-051-1/+0
| | | | | Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: rename a few vars to 'bindings'Brian Paul2017-12-051-10/+10
| | | | | | | To be consistent. Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: whitespace fixes in st_format.cBrian Paul2017-12-051-5/+13
| | | | | Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa/st: move cloning of NIR shader for computeRob Clark2017-12-052-2/+5
| | | | | | | | | | | | | | | | Since in the NIR case, driver takes ownership of the NIR shader, we need to clone what is passed to the driver. Normally this is done as part of creating the shader variant (where is clone is anyways needed). But compute shaders have no variants, so we were cloning earlier. The problem is that after the NIR linking optimizations, we ended up cloning *before* all the lowering passes where done. So move this into st_get_cp_variant(), to make compute shaders work more like other shader stages. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: handle compute atomicsDave Airlie2017-12-052-1/+5
| | | | | | | Just reuse the cs atomics bit and emit the hw atomic state. Reviewed-by: Nicolai Hähnle <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* i965/cnl: Avoid fast-clearing sRGB render buffersNanley Chery2017-12-041-2/+12
| | | | | | | | | | | | | | Gen10 doesn't automatically decode the clear color of sRGB buffers. To get correct rendering, avoid fast-clearing such buffers for now. The driver now passes the following piglit tests: * spec@arb_framebuffer_srgb@msaa-fast-clear * spec@ext_texture_srgb@multisample-fast-clear gl_ext_texture_srgb Suggested-by: Kenneth Graunke <[email protected]> Suggested-by: Jason Ekstrand <[email protected]> Signed-off-by: Nanley Chery <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* meson: Install dri.pc file when building gallium dri driversDylan Baker2017-12-041-7/+11
| | | | | | | | | | | Currently this pkg-config file is only installed if a classic dri driver is built. This is wrong, it should be installed if any dri driver is installed, which includes the gallium dri target. Reported-by: Marc Dietrich <[email protected]> Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* i965: read CS timestamp frequency from the kernel on Gen10+Lionel Landwerlin2017-12-041-0/+24
| | | | | | | | | | | | | | | We cannot figure this value out of the PCI-id anymore. Let's read it from the kernel (which computes this from a few registers). When running on a (upcoming) 4.16-rc1+ kernel, this will fixes piglit tests on CNL : spec@arb_timer_query@query gl_timestamp spec@arb_timer_query@timestamp-get spec@ext_timer_query@time-elapsed Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Rafael Antognolli <[email protected]>
* i965: Emit CS stall before MEDIA_VFE_STATE.Kenneth Graunke2017-12-041-0/+12
| | | | | | | | | | | This fixes hangs on GFXBench 5's Aztec Ruins benchmark. Unfortunately, it regresses OglCSCloth performance by about 10%. There are some ideas for fixing that. The Vulkan driver already emits this stall. Reviewed-by: Matt Turner <[email protected]>
* i965: Move PIPE_CONTROL defines and prototypes to brw_pipe_control.h.Kenneth Graunke2017-12-044-62/+90
| | | | | | | | | We need to be able to emit PIPE_CONTROLs from genX_state_upload.c, which can't safely include brw_defines.h because it conflicts with genxml. Move all the PIPE_CONTROL related stuff together into a separate header. Reviewed-by: Matt Turner <[email protected]>
* glsl: Fix gl_NormalScale.Fabian Bieler2017-12-033-2/+6
| | | | | | | | | | | | | | | | GLSL shaders can access the normal scale factor with the built-in gl_NormalScale. Mesa's modelspace lighting optimization uses a different normal scale factor than defined in the spec. We have to take care not to use this factor for gl_NormalScale. Mesa already defines two seperate states: state.normalScale and state.internal.normalScale. The first is used by the glsl compiler while the later is used by the fixed function T&L pipeline. Previously the only difference was some component swizzling. With this commit state.normalScale always uses the normal scale factor for eyespace lighting. Reviewed-by: Brian Paul <[email protected]>
* st/glsl_to_nir/radeonsi: enable gs support for nir backendTimothy Arceri2017-12-041-0/+12
| | | | | Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* st/glsl_to_nir: add gs support to st_nir_assign_var_locations()Timothy Arceri2017-12-041-6/+17
| | | | | Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* st/glsl_to_nir: use nir_lower_io_arrays_to_elements() to lower arraysTimothy Arceri2017-12-041-1/+1
| | | | | | | | This pass is more fully featured, it supports geom and tess shaders. It also supports interpolation intrinsics. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* st/glsl_to_nir: enable NIR link time optsTimothy Arceri2017-12-041-0/+78
| | | | Reviewed-by: Nicolai Hähnle <[email protected]>
* st/glsl_to_nir: move some calls out of st_glsl_to_nir_post_opts()Timothy Arceri2017-12-041-30/+37
| | | | | | | NIR component packing will be inserted between these calls and the calling of st_glsl_to_nir_post_opts(). Reviewed-by: Nicolai Hähnle <[email protected]>
* st/glsl_to_nir: call some lowering passes earlierTimothy Arceri2017-12-041-8/+12
| | | | | | This is required so that we can enbale NIR linking optimisations. Reviewed-by: Nicolai Hähnle <[email protected]>
* st/glsl_to_nir: add basic NIR opt loop helperTimothy Arceri2017-12-041-0/+31
| | | | | | | | We need to be able to do these NIR opts in the state tracker rather than the driver in order for the NIR linking opts to be useful. Reviewed-by: Nicolai Hähnle <[email protected]>
* st/glsl_to_nir: make st_glsl_to_nir() staticTimothy Arceri2017-12-042-55/+51
| | | | | | Here we also move the extern C functions to the bottom of the file. Reviewed-by: Nicolai Hähnle <[email protected]>
* st/glsl_to_nir: split the st_glsl_to_nir() function in twoTimothy Arceri2017-12-041-22/+34
| | | | | | | | We want to be able to generate NIR then apply NIR optimisations. Once the optimisations are done we can then apply the new post opt function which assigns uniforms etc based on the optimised IR. Reviewed-by: Nicolai Hähnle <[email protected]>
* st/glsl_to_nir: create set_st_program() helperTimothy Arceri2017-12-041-34/+40
| | | | Reviewed-by: Nicolai Hähnle <[email protected]>
* st/glsl: move nir linking loop to new function st_link_nir()Timothy Arceri2017-12-043-17/+41
| | | | | | | This will allow us to refactor linking and include some nir link time optimisations. Reviewed-by: Nicolai Hähnle <[email protected]>
* st/glsl_to_nir: add st_nir_assign_var_locations() helperTimothy Arceri2017-12-041-9/+34
| | | | | | This avoids packed varyings being assigned different driver locations. Reviewed-by: Nicolai Hähnle <[email protected]>
* i965: Serialize nir later in the linking processJordan Justen2017-12-011-9/+16
| | | | | | | | | | | Fixes MESA_GLSL=cache_fb with piglit tests/spec/glsl-1.50/execution/geometry/clip-distance-vs-gs-out.shader_test Fixes: 0610a624a12 i965/link: Serialize program to nir after linking for shader cache Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103988 Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* xlib: remove dummy GLX_MESA_set_3dfx_mode implementationEmil Velikov2017-12-015-65/+0
| | | | | | | | | | | | | The implementation is a simple 'return EGL_FALSE'. Stop pretending and simply remove it. Note: the removal of XMesa API is fine, since there hasn't been any users for it in years. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Adam Jackson <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* xlib: remove empty GLX_MESA_agp_offset stubsEmil Velikov2017-12-013-23/+0
| | | | | | | | | | The extension was never implemented and seemingly never will. The DRI based libGL dropped support for it over 10 years ago. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Adam Jackson <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* xlib: remove empty GLX_NV_vertex_array_range stubsEmil Velikov2017-12-013-68/+0
| | | | | | | | | | The extension was never implemented and seemingly never will. The DRI based libGL dropped support for it over 10 years ago. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Adam Jackson <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* i965/gen10: Change the order of PIPE_CONTROL and load register.Rafael Antognolli2017-12-011-3/+3
| | | | | | | | | | | | I believe the workaround describes that the MI_LOAD_REGISTER_IMM should come right after the 3DSTATE_SAMPLE_PATTERN. This fixes GPU hangs in the i965 initial state batchbuffer when running some Piglit tests with always_flush_batch=true. Signed-off-by: Rafael Antognolli <[email protected]> Cc: Kenneth Graunke <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965/gen10: emit 3DSTATE_MULTISAMPLE more often.Rafael Antognolli2017-12-011-1/+2
| | | | | | | | | | | | | On CNL, we see multiple multisample failures on piglit tests. By emitting this extra state, though not documented in the bspec, those failures seem to go away. This workaround could be removed if we ever find out a better solution, but it should be good enough for now. Signed-off-by: Rafael Antognolli <[email protected]> Cc: Kenneth Graunke <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965: Disable regular fast-clears (CCS_D) on gen9+Jason Ekstrand2017-12-012-25/+43
| | | | | | | | | | | | | This partially reverts commit 3e57e9494c2279580ad6a83ab8c065d01e7e634e which caused a bunch of GPU hangs on several Source titles. To date, we have no clue why these hangs are actually happening. This undoes the final effect of 3e57e9494c227 and gets us back to not hanging. Tested with Team Fortress 2. Reviewed-by: Kenneth Graunke <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102435 Fixes: 3e57e9494c2279580ad6a83ab8c065d01e7e634e Cc: [email protected]
* mesa: add AllowGLSLCrossStageInterpolationMismatch workaroundTapani Pälli2017-11-304-0/+11
| | | | | | | | | | | | | This fixes issues seen with certain versions of Unreal Engine 4 editor and games built with that using GLSL 4.30. v2: add driinfo_gallium change (Emil Velikov) Signed-off-by: Tapani Pälli <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97852 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103801 Acked-by: Andres Gomez <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965: Reorganize batch/state BO fields into a 'brw_growing_bo' struct.Kenneth Graunke2017-11-298-97/+103
| | | | | | | | | | | | | We're about to add more of them, and need to pass the whole lot of them around together when growing them. Putting them in a struct makes this much easier. brw->batch.batch.bo is a bit of a mouthful, but it's nice to have things labeled 'batch' and 'state' now that we have multiple buffers. Fixes: 2dfc119f22f257082ab0 "i965: Grow the batch/state buffers if we need space and can't flush." Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103101 Reviewed-by: Ian Romanick <[email protected]>
* i965: Don't grow batch/state buffer on every emit after an overflow.Kenneth Graunke2017-11-291-23/+19
| | | | | | | | | | | | | | | | | | | | Once we reach the intended size of the buffer (BATCH_SZ or STATE_SZ), we try and flush. If we're not allowed to flush, we resort to growing the buffer so that there's space for the data we need to emit. We accidentally got the threshold wrong. The first non-wrappable call beyond (e.g.) STATE_SZ would grow the buffer to floor(1.5 * STATE_SZ), The next call would see we were beyond STATE_SZ and think we needed to grow a second time - when the buffer was already large enough. We still want to flush when we hit STATE_SZ, but for growing, we should use the actual size of the buffer as the threshold. This way, we only grow when actually necessary. v2: Simplify the control flow (suggested by Jordan) Fixes: 2dfc119f22f257082ab0 "i965: Grow the batch/state buffers if we need space and can't flush." Reviewed-by: Jordan Justen <[email protected]>
* i965: Preserve EXEC_OBJECT_CAPTURE when growing the BO.Kenneth Graunke2017-11-291-0/+3
| | | | | | | | | The original state buffer was marked with EXEC_OBJECT_CAPTURE. When growing it, we want to preserve that flag so we continue to capture it in GPU hang reports. Fixes: 2dfc119f22f257082ab0 "i965: Grow the batch/state buffers if we need space and can't flush." Reviewed-by: Ian Romanick <[email protected]>
* i965: Use old_bo->align when growing batch/state buffer instead of 4096.Kenneth Graunke2017-11-291-1/+2
| | | | | | | | | | | | | | The intention here is make the new BO use the same alignment as the old BO. This isn't strictly necessary, but we would have to update the 'alignment' field in the validation list when swapping it out, and we don't bother today. The batch and state buffers use an alignment of 4096, so this should be equivalent - it's just clearer than cut and pasting a magic constant. Fixes: 2dfc119f22f257082ab0 "i965: Grow the batch/state buffers if we need space and can't flush." Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* i965: Program the dynamic state heap size to MAX_STATE_SIZE.Kenneth Graunke2017-11-293-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | STATE_BASE_ADDRESS specifies a maximum size of the dynamic state section, beyond which data supposedly reads back as 0. On Gen8+, we were programming it to the size of the buffer. This worked fine until we started growing the state buffer in commit 2dfc119f22f25708. When the state buffer grows, the value in STATE_BASE_ADDRESS becomes too small, and our state beyond STATE_SZ bytes would read back as 0. To avoid having to update the value, we program it to MAX_STATE_SIZE. We used to program the upper bound to the maximum on older hardware anyway, so programming it too large isn't a big deal. Bogus SURFACE_STATE can easily lead to GPU hangs and misrendering. DiRT Rally was hitting the statebuffer growth path, and suffered from bad texture corruption and GPU hangs (usually around the same time). This patch fixes both issues. Fixes: 2dfc119f22f257082ab0 "i965: Grow the batch/state buffers if we need space and can't flush." Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103101 Tested-by: Jordan Justen <[email protected]> Reviewed-by: Chris Wilson <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: deal with vs_inputs as 64-bit unsigned integerJuan A. Suarez Romero2017-11-291-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 78942e ("mesa: shrink VERT_ATTRIB bitfields to 32 bits") uses vs_prog_data->vs_inputs as if it were a 32-bit unsigned integer. But actually it is a 64-bit integer, and as such it is used in other parts of Mesa code. It is worth to note that bits from the entire range are used, and not only 32-bits. This is due our implementation for handling 64-bit dual-slot input attributes, which requires to use a larger bitfield to manage them. This commit reverts the changes done in brw_draw_upload.c, keeping the rest of the changes. This fixes the following tests: - KHR-GL45.enhanced_layouts.varying_array_locations - KHR-GL45.enhanced_layouts.varying_locations Fixes: 78942e ("mesa: shrink VERT_ATTRIB bitfields to 32 bits") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103942 CC: Marek Olšák <[email protected]> CC: Ian Romanick <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Signed-off-by: Juan A. Suarez Romero <[email protected]>
* mesa: rework _mesa_add_parameter() to only add a single paramTimothy Arceri2017-11-292-37/+39
| | | | | | | | | This is more inline with what the functions name suggests it should do, and makes the code much easier to follow. This will also make adding uniform packing support much simpler. Reviewed-by: Nicolai Hähnle <[email protected]>
* i965: Change a ret == -1 check to ret != 0.Kenneth Graunke2017-11-281-1/+1
| | | | | | For consistency with most other ret checks. Suggested by Chris. Reviewed-by: Chris Wilson <[email protected]>
* i965: Use C99 struct initializers in brw_bufmgr.c.Kenneth Graunke2017-11-281-91/+49
| | | | | | | | | | This is cleaner than using a non-standard memclear macro (which does a memset to 0) and then initializing fields after the fact. We move the declarations to where we initialized the fields. While we're at it, we move the declaration of 'ret' that goes with the ioctl, eliminating the declaration section altogether. Reviewed-by: Chris Wilson <[email protected]>
* i965: Move perf_debug and WARN_ONCE back to brw_context.h.Kenneth Graunke2017-11-281-0/+29
| | | | | | | | These were moved to src/intel/common/gen_debug.h, but they are not common code. They assume that brw_context or gl_context variables exist, named brw or ctx. That isn't remotely true outside of i965. Reviewed-by: Lionel Landwerlin <[email protected]>
* i965: const a few structs and vars to avoid writing to them by accidentEric Engestrom2017-11-281-4/+4
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>