mesa.git
7 years agogallium/u_suballoc: update comments
Marek Olšák [Mon, 20 Feb 2017 16:54:12 +0000 (17:54 +0100)]
gallium/u_suballoc: update comments

as requested by Brian. Trivial.

7 years agoutil/build-id: define ElfW and NT_GNU_BUILD_ID if needed
Jonathan Gray [Sat, 18 Feb 2017 07:56:58 +0000 (18:56 +1100)]
util/build-id: define ElfW and NT_GNU_BUILD_ID if needed

Define ElfW() and NT_GNU_BUILD_ID if needed as these defines are not
present on at least OpenBSD and FreeBSD.  Fixes the build on OpenBSD.

Fixes: d4fa083e11f ("util: Add utility build-id code.")
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoandroid: define HAVE_DL_ITERATE_PHDR for build-id code
Mauro Rossi [Sat, 18 Feb 2017 22:10:24 +0000 (23:10 +0100)]
android: define HAVE_DL_ITERATE_PHDR for build-id code

Required due to d4fa083 "util: Add utility build-id code."
to avoid following build error and warnings:

external/mesa/src/intel/vulkan/anv_device.c:60:32: error: incompatible integer to pointer conversion initializing 'const struct build_id_note *' with an expression of type 'int' [-Werror,-Wint-conversion]
   const struct build_id_note *note = build_id_find_nhdr("libvulkan_intel.so");
                               ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/mesa/src/intel/vulkan/anv_device.c:64:19: warning: implicit declaration of function 'build_id_length' is invalid in C99 [-Wimplicit-function-declaration]
   unsigned len = build_id_length(note);
                  ^
external/mesa/src/intel/vulkan/anv_device.c:68:4: warning: implicit declaration of function 'build_id_read' is invalid in C99 [-Wimplicit-function-declaration]
   build_id_read(note, uuid, VK_UUID_SIZE);
   ^
3 warnings and 1 error generated.
[ 40% 1438/3588] target  C: libmesa_vulkan_common_32 <= external/mesa/src/intel/vulkan/anv_image.c
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1

Fixes: d4fa083e11f ("util: Add utility build-id code.")
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoandroid: glsl: build shader cache sources
Mauro Rossi [Sat, 18 Feb 2017 21:23:18 +0000 (22:23 +0100)]
android: glsl: build shader cache sources

Fixes the following building errors:

external/mesa/src/compiler/glsl/linker.cpp:4642: error: undefined reference
 to 'shader_cache_read_program_metadata(gl_context*, gl_shader_program*)'
external/mesa/src/mesa/program/ir_to_mesa.cpp:3135: error: undefined reference
 to 'shader_cache_write_program_metadata(gl_context*, gl_shader_program*)'
clang++: error: linker command failed with exit code 1
...
external/mesa/src/mesa/program/ir_to_mesa.cpp:3135: error: undefined reference
 to 'shader_cache_write_program_metadata(gl_context*, gl_shader_program*)'
external/mesa/src/compiler/glsl/linker.cpp:4642: error: undefined reference
 to 'shader_cache_read_program_metadata(gl_context*, gl_shader_program*)'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1

Fixes: 9f8dc3bf03e ("utils: build sha1/disk cache only with
Android/Autoconf")
Acked-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoandroid: radeonsi: fix sid_table.h generated header include path
Mauro Rossi [Wed, 8 Feb 2017 07:14:05 +0000 (08:14 +0100)]
android: radeonsi: fix sid_table.h generated header include path

generated-sources-dir-for macro replaces intermediates-dir-for
and LOCAL_MODULE_CLASS is defined as required by new macro,
in order to avoid the following building error:

external/mesa/src/gallium/drivers/radeonsi/si_debug.c:29:10: fatal error: 'sid_tables.h' file not found
         ^
1 error generated.

Fixes: 730574c58e8 ("android: ac/debug: move sid_tables.h generation and
IB decode to amd/common")
Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs: add news item and link release notes for 13.0.5
Emil Velikov [Mon, 20 Feb 2017 11:56:39 +0000 (11:56 +0000)]
docs: add news item and link release notes for 13.0.5

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs: add sha256 checksums for 13.0.5
Emil Velikov [Mon, 20 Feb 2017 11:54:07 +0000 (11:54 +0000)]
docs: add sha256 checksums for 13.0.5

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 112e75f51bc7c82bde4722485115c99734e62064)

7 years agodocs: add release notes for 13.0.5
Emil Velikov [Mon, 20 Feb 2017 11:43:27 +0000 (11:43 +0000)]
docs: add release notes for 13.0.5

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 71f3ff57fa67ef72630821f4fa13a17e264d7ccb)

7 years agovulkan/wsi/x11: add support to detect if we can support rendering (v3)
Dave Airlie [Sun, 19 Feb 2017 05:27:47 +0000 (15:27 +1000)]
vulkan/wsi/x11: add support to detect if we can support rendering (v3)

This adds support to radv_GetPhysicalDeviceXlibPresentationSupportKHR
and radv_GetPhysicalDeviceXcbPresentationSupportKHR to check if the
local device file descriptor is compatible with the descriptor
retrieved from the X server via DRI3.

This will stop radv binding to an X server until we have prime
support in place. Hopefully apps use this API before trying
to render things.

v2: drop unneeded function, don't leak memory. (jekstrand)
v3: also check in surface_get_support callback.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoRevert "radv: detect command buffers that do no work and drop them (v2)"
Dave Airlie [Sun, 19 Feb 2017 22:44:58 +0000 (08:44 +1000)]
Revert "radv: detect command buffers that do no work and drop them (v2)"

This just keeps popping up minor problems and regressions we should
revisit in a more sustainable manner later.

This also reverts:
Revert "radv: query cmds should mark a cmd buffer as having draws."
Revert "radv: also fixup event emission to not get culled."

This reverts commit d1640e79328af4a63c056e3ccab299a3bffbede7.
This reverts commit 8b47b97215af7157bc15676167cab73aa5a61a76.
This reverts commit b4b19afebeac84ddce3f1f8b7ffe0da6474fe29a.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Handle VK_REMAINING_ARRAY_LAYERS in fast clear eliminate.
Bas Nieuwenhuizen [Sun, 19 Feb 2017 13:00:25 +0000 (14:00 +0100)]
radv: Handle VK_REMAINING_ARRAY_LAYERS in fast clear eliminate.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agogallium/u_index_modify: don't add PIPE_TRANSFER_UNSYNCHRONIZED unconditionally
Marek Olšák [Fri, 17 Feb 2017 11:55:24 +0000 (12:55 +0100)]
gallium/u_index_modify: don't add PIPE_TRANSFER_UNSYNCHRONIZED unconditionally

It's OK for r300g (because r300g can't write to buffers via the GPU), but
not later hardware. This issue was spotted randomly.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: fix UNSIGNED_BYTE index buffer fallback with non-zero start (v2)
Marek Olšák [Wed, 15 Feb 2017 16:24:38 +0000 (17:24 +0100)]
radeonsi: fix UNSIGNED_BYTE index buffer fallback with non-zero start (v2)

start can only be non-zero with MultiDrawElements, which is unlikely
to occur with UNSIGNED_BYTE indices.

v2: Also fix the util_shorten_ubyte_elts_to_userptr call.
    Tested with the new piglit.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradv: handle layered fast clears.
Dave Airlie [Sun, 19 Feb 2017 06:33:14 +0000 (16:33 +1000)]
radv: handle layered fast clears.

This iterates the fast clear flush across the layers in the
specified range.

It also moves the compute resolve flush into the function
and builds the range in there.

This fixes:
dEQP-VK.geometry.layered.* regressions since fast clears.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoradv: pass subresourceRange by pointer.
Dave Airlie [Sun, 19 Feb 2017 06:33:13 +0000 (16:33 +1000)]
radv: pass subresourceRange by pointer.

This struct is 5 dwords, we should really just pass a pointer
to it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: fix typo in a2b10g10r10 fast clear calculation.
Dave Airlie [Sun, 19 Feb 2017 06:38:16 +0000 (16:38 +1000)]
radv: fix typo in a2b10g10r10 fast clear calculation.

This fixes:
dEQP-VK.renderpass.formats.a2b10g10r10_unorm_pack32*
regressions.

Fixes:
f22836dbdd radv: Add CPU color packing for VK_FORMAT_A2B10G10R10_UNORM_PACK32.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoradv: Invert ring SGPR check.
Bas Nieuwenhuizen [Sun, 19 Feb 2017 02:35:02 +0000 (03:35 +0100)]
radv: Invert ring SGPR check.

I assume this wants to check if all pipelines use the same SGPR for
the rings.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
7 years agoradv: Clamp framebuffer dimensions to min. attachment dimensions.
Bas Nieuwenhuizen [Sun, 19 Feb 2017 00:16:19 +0000 (01:16 +0100)]
radv: Clamp framebuffer dimensions to min. attachment dimensions.

Even though the preferred stance is not to fix incorrect applications
via the driver, this prevents some nasty GPU hangs.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agogallium: remove TGSI_OPCODE_CLAMP
Marek Olšák [Thu, 16 Feb 2017 17:01:53 +0000 (18:01 +0100)]
gallium: remove TGSI_OPCODE_CLAMP

Not used and not widely supported. Use MIN+MAX instead.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoac/llvm: use min+max instead of AMDGPU.clamp on LLVM 5.0
Marek Olšák [Thu, 16 Feb 2017 21:52:53 +0000 (22:52 +0100)]
ac/llvm: use min+max instead of AMDGPU.clamp on LLVM 5.0

It selects v_med3_f32, which has the same rate & size.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: stop using TGSI_OPCODE_CLAMP by moving it amd/common
Marek Olšák [Thu, 16 Feb 2017 21:41:16 +0000 (22:41 +0100)]
radeonsi: stop using TGSI_OPCODE_CLAMP by moving it amd/common

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agotgsi/lowering: stop using TGSI_OPCODE_CLAMP
Marek Olšák [Thu, 16 Feb 2017 16:11:30 +0000 (17:11 +0100)]
tgsi/lowering: stop using TGSI_OPCODE_CLAMP

v2: do it correctly

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: stop using TGSI_OPCODE_CLAMP
Marek Olšák [Thu, 16 Feb 2017 15:59:05 +0000 (16:59 +0100)]
st/mesa: stop using TGSI_OPCODE_CLAMP

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: use R600_RESOURCE_FLAG_UNMAPPABLE where it's desirable
Marek Olšák [Wed, 15 Feb 2017 19:44:24 +0000 (20:44 +0100)]
radeonsi: use R600_RESOURCE_FLAG_UNMAPPABLE where it's desirable

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: add R600_RESOURCE_FLAG_UNMAPPABLE
Marek Olšák [Wed, 15 Feb 2017 19:41:01 +0000 (20:41 +0100)]
gallium/radeon: add R600_RESOURCE_FLAG_UNMAPPABLE

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: change r600_aligned_buffer_create to take flags, not bind
Marek Olšák [Wed, 15 Feb 2017 19:07:53 +0000 (20:07 +0100)]
gallium/radeon: change r600_aligned_buffer_create to take flags, not bind

All call sites set bind = 0. The next commit will use this.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: upload constants into VRAM instead of GTT
Marek Olšák [Wed, 15 Feb 2017 18:50:15 +0000 (19:50 +0100)]
radeonsi: upload constants into VRAM instead of GTT

This lowers lgkm wait cycles by 30% on VI and normal conditions.
The might be a measurable improvement when CE is disabled (radeon)
or under L2 thrashing.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: use TCC line size as alignment in other places
Marek Olšák [Wed, 15 Feb 2017 17:49:11 +0000 (18:49 +0100)]
gallium/radeon: use TCC line size as alignment in other places

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: use a clever alignment for index buffer uploads
Marek Olšák [Wed, 15 Feb 2017 17:32:34 +0000 (18:32 +0100)]
radeonsi: use a clever alignment for index buffer uploads

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: use a clever alignment for descriptor uploads
Marek Olšák [Wed, 15 Feb 2017 17:29:34 +0000 (18:29 +0100)]
radeonsi: use a clever alignment for descriptor uploads

Non-VBO descriptors won't be smaller than the cache line, so simply use
the cache line size.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: use a clever alignment for constant buffer uploads
Marek Olšák [Wed, 15 Feb 2017 17:22:27 +0000 (18:22 +0100)]
radeonsi: use a clever alignment for constant buffer uploads

This results in a very tiny decrease in lgkm wait cycles.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: move index buffer flushing into a non-upload indexed case
Marek Olšák [Wed, 15 Feb 2017 17:36:21 +0000 (18:36 +0100)]
radeonsi: move index buffer flushing into a non-upload indexed case

The other codepaths don't need this.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: use SI_MAX_ATTRIBS where it should be used
Marek Olšák [Thu, 16 Feb 2017 10:39:01 +0000 (11:39 +0100)]
radeonsi: use SI_MAX_ATTRIBS where it should be used

for consistency; no change in behavior

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: sort members of si_shader_key::part
Marek Olšák [Tue, 14 Feb 2017 21:14:55 +0000 (22:14 +0100)]
radeonsi: sort members of si_shader_key::part

and improve some comments

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: have separate LS and ES main shader parts in the shader selector
Marek Olšák [Tue, 14 Feb 2017 21:08:32 +0000 (22:08 +0100)]
radeonsi: have separate LS and ES main shader parts in the shader selector

This might reduce the on-demand compilation if the initial VS/LS/ES
determination is wrong.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: don't compile pure monolithic shaders asynchronously
Marek Olšák [Tue, 14 Feb 2017 21:06:51 +0000 (22:06 +0100)]
radeonsi: don't compile pure monolithic shaders asynchronously

there is no point, we have to wait anyway.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: allow unaligned vertex buffer offsets and strides on CIK-VI
Marek Olšák [Fri, 10 Feb 2017 00:15:21 +0000 (01:15 +0100)]
radeonsi: allow unaligned vertex buffer offsets and strides on CIK-VI

So that we can disable u_vbuf for GL core profiles.

This is a v2 of the previous VI-only patch.
It requires SH_MEM_CONFIG.ALIGNMENT_MODE = UNALIGNED on CIK-VI.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: remove the fix_size3 workaround
Marek Olšák [Thu, 16 Feb 2017 00:20:32 +0000 (01:20 +0100)]
radeonsi: remove the fix_size3 workaround

not needed with the shader fallback

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: add a workaround for clamping unaligned RGB 8 & 16-bit vertex loads
Marek Olšák [Thu, 16 Feb 2017 00:17:48 +0000 (01:17 +0100)]
radeonsi: add a workaround for clamping unaligned RGB 8 & 16-bit vertex loads

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: make fix_fetch an array of uint8_t
Marek Olšák [Wed, 15 Feb 2017 23:47:48 +0000 (00:47 +0100)]
radeonsi: make fix_fetch an array of uint8_t

so that we can add 3-component fallbacks.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agovl: fix a buffer leak in the bicubic filter by using an uploader
Marek Olšák [Wed, 15 Feb 2017 14:07:03 +0000 (15:07 +0100)]
vl: fix a buffer leak in the bicubic filter by using an uploader

there's no error checking, because the previous code didn't do it either.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/hud: create files after graphs are created to get final names
Marek Olšák [Thu, 16 Feb 2017 12:29:16 +0000 (13:29 +0100)]
gallium/hud: create files after graphs are created to get final names

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
7 years agogallium/u_suballoc: allow setting pipe_resource::flags
Marek Olšák [Wed, 15 Feb 2017 19:55:15 +0000 (20:55 +0100)]
gallium/u_suballoc: allow setting pipe_resource::flags

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/u_suballoc: use clear_buffer if available
Marek Olšák [Wed, 15 Feb 2017 00:47:25 +0000 (01:47 +0100)]
gallium/u_suballoc: use clear_buffer if available

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/util: correctly unref a buffer in u_prim_restart
Marek Olšák [Wed, 15 Feb 2017 14:04:51 +0000 (15:04 +0100)]
gallium/util: correctly unref a buffer in u_prim_restart

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/util: remove unused u_index_modify helpers
Marek Olšák [Wed, 15 Feb 2017 13:53:20 +0000 (14:53 +0100)]
gallium/util: remove unused u_index_modify helpers

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/util: remove unused helper util_draw_texquad
Marek Olšák [Wed, 15 Feb 2017 13:50:16 +0000 (14:50 +0100)]
gallium/util: remove unused helper util_draw_texquad

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/docs: remove documentation of non-existent instructions
Marek Olšák [Fri, 17 Feb 2017 10:20:00 +0000 (11:20 +0100)]
gallium/docs: remove documentation of non-existent instructions

trivial

7 years agoanv/TODO: Check off Storage Image Without Format
Jason Ekstrand [Fri, 17 Feb 2017 22:18:27 +0000 (14:18 -0800)]
anv/TODO: Check off Storage Image Without Format

The code for this landed a few days ago.

7 years agoac/llvm: fix various findMSB bugs
Marek Olšák [Fri, 17 Feb 2017 13:26:07 +0000 (14:26 +0100)]
ac/llvm: fix various findMSB bugs

sffbh needs to be suffixed with ".i32"

Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoglsl: link error if unsized array not-last in ssbo
Jose Maria Casanova Crespo [Fri, 17 Feb 2017 13:06:46 +0000 (14:06 +0100)]
glsl: link error if unsized array not-last in ssbo

If an unsized declared array is not the last in an SSBO
and an implicit size can not be defined on linking time,
the linker should raise an error instead of reaching
an assertion on GL.

This reverts part of commit 3da08e166415a745139c1127040a24e8a45dc553
getting back to the behavior of commit 5b2675093e863a52b610f112884ae12d42513770

The original patch was correct for GLES that should produce
a compile-time error but the linker error is still necessary
in desktop GL.

Fixes the following piglit tests:
tests/spec/arb_shader_storage_buffer_object/non_integral_size_array_member.shader_test
tests/spec/arb_shader_storage_buffer_object/unsized_array_member.shader_test

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
7 years agoi965/fs: fix uninitialized memory access
Lionel Landwerlin [Thu, 16 Feb 2017 13:06:07 +0000 (13:06 +0000)]
i965/fs: fix uninitialized memory access

Found while running shader-db under valgrind.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
7 years agoglsl: disable on disk shader cache when running as another user
Timothy Arceri [Sat, 30 Apr 2016 05:26:43 +0000 (15:26 +1000)]
glsl: disable on disk shader cache when running as another user

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa/formatquery: use consistent local function names
Alejandro Piñeiro [Sat, 11 Feb 2017 16:21:35 +0000 (17:21 +0100)]
mesa/formatquery: use consistent local function names

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agoradv: Use different allocator for descriptor set vram.
Bas Nieuwenhuizen [Thu, 16 Feb 2017 20:23:58 +0000 (21:23 +0100)]
radv: Use different allocator for descriptor set vram.

This one only keeps allocated memory in the list, and list nodes
in the descriptor sets. Thsi doesn't need messing around with
max_sets, and we get automatic merging of free regions.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Never try to create more than max_sets descriptor sets.
Bas Nieuwenhuizen [Thu, 16 Feb 2017 19:52:24 +0000 (20:52 +0100)]
radv: Never try to create more than max_sets descriptor sets.

We only use the freed ones after all free space has been used. If
the app only allocates small descriptor sets, we might go over
max_sets before the memory is full.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
CC: <mesa-stable@lists.freedesktop.org>
Fixes: f4e499ec79147f4172f3669ae9dafd941aaeeb65
7 years agoi965/fs: fix 32-bit data type to int64 conversion on BSW/BXT
Samuel Iglesias Gonsálvez [Fri, 10 Feb 2017 13:06:43 +0000 (14:06 +0100)]
i965/fs: fix 32-bit data type to int64 conversion on BSW/BXT

The 32-bit to 64-bit conversions need to have the 32-bit
data source elements aligned to 64-bit but only with doubles as
destination type.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99660
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Tested-by: Mark Janes <mark.a.janes@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: fix scons builds with shader cache
Timothy Arceri [Fri, 17 Feb 2017 05:27:53 +0000 (16:27 +1100)]
glsl: fix scons builds with shader cache

For now its disabled for scons so wrap glsl cache calls in a
define conditional.

7 years agoutil/disk_cache: fix typo in function stub
Timothy Arceri [Fri, 17 Feb 2017 04:51:30 +0000 (15:51 +1100)]
util/disk_cache: fix typo in function stub

7 years agoi965/fs: Remove hand-coded 64-bit packing optimizations
Jason Ekstrand [Wed, 15 Feb 2017 06:22:51 +0000 (22:22 -0800)]
i965/fs: Remove hand-coded 64-bit packing optimizations

The optimization in unpack_64 is clearly subsumed with the opt_algebraic
optimizations in the previous commit.  The pack optimization may not be
quite handled by opt_algebraic but opt_algebraic should get the really
bad cases.  Also, it's been broken since it was merged and we've never
noticed so it must not be doing anything.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agonir/algebraic: Optimize 64bit pack/unpack
Jason Ekstrand [Wed, 15 Feb 2017 06:22:36 +0000 (22:22 -0800)]
nir/algebraic: Optimize 64bit pack/unpack

This reduces the instruction count in some fp64 and int64 piglit tests

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agonir: Rename lower_double_pack to lower_64bit_pack
Jason Ekstrand [Wed, 15 Feb 2017 06:20:32 +0000 (22:20 -0800)]
nir: Rename lower_double_pack to lower_64bit_pack

There's nothing "double" about it other than, perhaps, the fact that it
packs two 32-bit values.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agonir: Combine the int and double [un]pack opcodes
Jason Ekstrand [Wed, 15 Feb 2017 06:15:16 +0000 (22:15 -0800)]
nir: Combine the int and double [un]pack opcodes

NIR is a typeless IR and the two opcodes, when considered bitwise, do
exactly the same thing.  There's no reason to have two versions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/fs: Fix the inline nir_op_pack_double optimization
Jason Ekstrand [Wed, 15 Feb 2017 07:00:51 +0000 (23:00 -0800)]
i965/fs: Fix the inline nir_op_pack_double optimization

We can only do the optimization if the source *is* SSA.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
7 years agoswr: remove unneeded extern "C"
George Kyriazis [Thu, 16 Feb 2017 02:55:55 +0000 (20:55 -0600)]
swr: remove unneeded extern "C"

the guards have been added to the header files that needed them.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agogallium: add extern "C" guards
George Kyriazis [Thu, 16 Feb 2017 02:54:43 +0000 (20:54 -0600)]
gallium: add extern "C" guards

Added extern "C" __cplusplus guards on headers that did not have them.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agoutil/disk_cache: check cache exists before calling munmap()
Timothy Arceri [Tue, 7 Feb 2017 01:10:19 +0000 (12:10 +1100)]
util/disk_cache: check cache exists before calling munmap()

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoutil/disk_cache: add support for removing old versions of the cache
Timothy Arceri [Mon, 6 Feb 2017 22:49:47 +0000 (09:49 +1100)]
util/disk_cache: add support for removing old versions of the cache

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoutil/disk_cache: allow drivers to pass a directory structure
Timothy Arceri [Mon, 6 Feb 2017 01:56:08 +0000 (12:56 +1100)]
util/disk_cache: allow drivers to pass a directory structure

In order to avoid costly fallback recompiles when cache items are
created with an old version of Mesa or for a different gpu on the
same system we want to create directories that look like this:

./{TIMESTAMP}_{LLVM_TIMESTAMP}/{GPU_ID}

Note: The disk cache util will take a single timestamp string, it is
up to the backend to concatenate the llvm string with the mesa string
if applicable.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: remove cache creation from _mesa_initialize_context()
Timothy Arceri [Mon, 6 Feb 2017 10:23:31 +0000 (21:23 +1100)]
mesa: remove cache creation from _mesa_initialize_context()

We will change the way we create the cache directory in the following
patches.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa/glsl: build string of dri options and use as input to building sha for shaders
Timothy Arceri [Thu, 16 Feb 2017 23:16:16 +0000 (10:16 +1100)]
st/mesa/glsl: build string of dri options and use as input to building sha for shaders

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: reserve parameter storage on cache restore
Timothy Arceri [Wed, 8 Jun 2016 00:18:33 +0000 (10:18 +1000)]
glsl: reserve parameter storage on cache restore

Since we know how big the list will be we can allocate the storage
upfront.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: don't try to load/store buffer object values in the cache
Timothy Arceri [Thu, 2 Jun 2016 04:13:26 +0000 (14:13 +1000)]
glsl: don't try to load/store buffer object values in the cache

Also add an assert to catch buffer overflows.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: don't reprocess or clear UBOs on cache fallback
Timothy Arceri [Mon, 20 Jun 2016 01:09:34 +0000 (11:09 +1000)]
glsl: don't reprocess or clear UBOs on cache fallback

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: skip more uniform initialisation when doing fallback linking
Timothy Arceri [Sat, 23 Apr 2016 12:34:38 +0000 (22:34 +1000)]
glsl: skip more uniform initialisation when doing fallback linking

We already pull these values from the metadata cache so no need to
recreate them.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: don't lose uniform values when falling back to full compile
Timothy Arceri [Wed, 27 Apr 2016 05:41:19 +0000 (15:41 +1000)]
glsl: don't lose uniform values when falling back to full compile

Here we skip the recreation of uniform storage if we are relinking
after a cache miss. This is improtant because uniform values may
have already been set by the application and we don't want to reset
them.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: don't reference shader prog data during cache fallback
Timothy Arceri [Sun, 20 Nov 2016 06:48:27 +0000 (17:48 +1100)]
glsl: don't reference shader prog data during cache fallback

We already have a reference.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa/glsl: add cache_fallback flag to gl_shader_program_data
Timothy Arceri [Sun, 20 Nov 2016 01:47:00 +0000 (12:47 +1100)]
mesa/glsl: add cache_fallback flag to gl_shader_program_data

This will allow us to skip certain things when falling back to
a full recompile on a cache miss such as avoiding reinitialising
uniforms.

In this change we use it to avoid reading the program metadata
from the cache and skipping linking during a fallback.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add api and glsl version to hash generation for shaders
Timothy Arceri [Mon, 13 Feb 2017 00:53:30 +0000 (11:53 +1100)]
glsl: add api and glsl version to hash generation for shaders

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: cache uniform values
Timothy Arceri [Wed, 13 Apr 2016 00:28:04 +0000 (10:28 +1000)]
glsl: cache uniform values

These may be lowered constant arrays or uniform values that we set before linking
so we need to cache the actual uniform values.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: make uniform values helper available for use elsewhere
Timothy Arceri [Wed, 13 Apr 2016 05:42:04 +0000 (15:42 +1000)]
glsl: make uniform values helper available for use elsewhere

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: cache some more image metadata
Timothy Arceri [Wed, 30 Mar 2016 23:37:27 +0000 (10:37 +1100)]
glsl: cache some more image metadata

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add support for caching atomic buffers
Timothy Arceri [Sat, 26 Mar 2016 02:37:30 +0000 (13:37 +1100)]
glsl: add support for caching atomic buffers

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add shader cache support for buffer blocks
Timothy Arceri [Wed, 23 Mar 2016 02:50:08 +0000 (13:50 +1100)]
glsl: add shader cache support for buffer blocks

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: store subroutine remap table in shader cache
Timothy Arceri [Tue, 12 Apr 2016 05:10:24 +0000 (15:10 +1000)]
glsl: store subroutine remap table in shader cache

V2: use new helpers to store/restore table entries.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add support for caching subroutines
Timothy Arceri [Tue, 22 Mar 2016 10:54:27 +0000 (21:54 +1100)]
glsl: add support for caching subroutines

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add support for caching shaders with xfb qualifiers
Timothy Arceri [Mon, 23 Jan 2017 21:34:23 +0000 (08:34 +1100)]
glsl: add support for caching shaders with xfb qualifiers

For now this disables the shader cache when transform feedback is
enabled via the GL API as we don't currently allow for it when
generating the sha for the shader.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add shader cache support for samplers
Timothy Arceri [Sat, 19 Mar 2016 03:42:46 +0000 (14:42 +1100)]
glsl: add shader cache support for samplers

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add basic support for resource list to shader cache
Timothy Arceri [Fri, 18 Mar 2016 10:51:49 +0000 (21:51 +1100)]
glsl: add basic support for resource list to shader cache

This initially adds support for simple uniforms and varyings.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: fix uniform remap table cache when explicit locations used
Timothy Arceri [Tue, 12 Apr 2016 07:20:49 +0000 (17:20 +1000)]
glsl: fix uniform remap table cache when explicit locations used

V2: don't store pointers use an enum instead to flag what should be
restored. Also do the work in a helper that we will later use for
the subroutine remap table.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: Serialize three additional hash tables with program metadata
Carl Worth [Thu, 13 Nov 2014 07:57:15 +0000 (23:57 -0800)]
glsl: Serialize three additional hash tables with program metadata

The three additional tables are AttributeBindings, FragDataBindings,
and FragDataIndexBindings.

The first table (AttributeBindings) was identified as missing by
trying to test the shader cache with a program that called
glGetAttribLocation.

Many thanks to Tapani Pälli <tapani.palli@intel.com>, as it was review
of related work that he had done previously that pointed me to the
necessity to also save and restore FragDataBindings and
FragDataIndexBindings.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: use correct shader source in case of cache fallback
Timothy Arceri [Sun, 12 Feb 2017 22:34:54 +0000 (09:34 +1100)]
glsl: use correct shader source in case of cache fallback

The scenario is:

glShaderSource
glCompileShader <-- deferred due to cache hit of shader

glShaderSource <-- with new source code

glAttachShader
glLinkProgram <-- no cache hit for program

At this point we need to compile the original source when we
fallback.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: make use of on disk shader cache
Timothy Arceri [Mon, 23 Jan 2017 21:39:13 +0000 (08:39 +1100)]
glsl: make use of on disk shader cache

The hash key for glsl metadata is a hash of the hashes of each GLSL
source string.

This commit uses the put_key/get_key support in the cache put the SHA-1
hash of the source string for each successfully compiled shader into the
cache. This allows for early, optimistic returns from glCompileShader
(if the identical source string had been successfully compiled in the past),
in the hope that the final, linked shader will be found in the cache.

This is based on the intial patch by Carl.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add initial implementation of shader cache
Timothy Arceri [Thu, 14 Apr 2016 01:08:32 +0000 (11:08 +1000)]
glsl: add initial implementation of shader cache

This uses disk_cache.c to write out a serialization of various
state that's required in order to successfully load and use a
binary written out by a drivers backend, this state is referred to as
"metadata" throughout the implementation.

This initial version is intended to work with all stages beside
compute.

This patch is based on the initial work done by Carl.

V2: extend the file's doxygen comment to cover some of the
design decisions.

V3:
- skip cache for fixed function shaders
- add int64 support
- fix glsl IR program parameter caching/restore and cache the
  parameter values which are used by gallium backends.
- use new link status enum

V4:
- add compute program support

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: use shared emit_umsb helper.
Dave Airlie [Thu, 16 Feb 2017 03:54:19 +0000 (03:54 +0000)]
radeonsi: use shared emit_umsb helper.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/ac: use shared umsb helper.
Dave Airlie [Thu, 16 Feb 2017 03:54:01 +0000 (03:54 +0000)]
radv/ac: use shared umsb helper.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradeon/ac: add emit umsb shared code.
Dave Airlie [Thu, 16 Feb 2017 03:53:27 +0000 (03:53 +0000)]
radeon/ac: add emit umsb shared code.

Since we shared imsb, makes sense to share umsb.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradeon/ac: use llvm.amdgcn.sffbh intrinsic instead of AMDGPU.flbit.i32
Dave Airlie [Thu, 16 Feb 2017 03:46:16 +0000 (03:46 +0000)]
radeon/ac: use llvm.amdgcn.sffbh intrinsic instead of AMDGPU.flbit.i32

Use the newer intrinsic.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradeonsi: use shared emit imsb code.
Dave Airlie [Thu, 16 Feb 2017 03:43:50 +0000 (03:43 +0000)]
radeonsi: use shared emit imsb code.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/ac: use shader imsb emission code.
Dave Airlie [Thu, 16 Feb 2017 03:43:29 +0000 (03:43 +0000)]
radv/ac: use shader imsb emission code.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>