mesa.git
5 years agoegl: Use the canonical drm-uapi fourcc header to avoid local defines.
Eric Anholt [Mon, 16 Jul 2018 22:57:24 +0000 (15:57 -0700)]
egl: Use the canonical drm-uapi fourcc header to avoid local defines.

We should only use a #define locally once it's been upstreamed, and at
that point you should just update our drm_fourcc.h.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agov3d: Fix tiling modifier support to use the new UIF define.
Eric Anholt [Wed, 20 Jun 2018 23:54:31 +0000 (16:54 -0700)]
v3d: Fix tiling modifier support to use the new UIF define.

You can't use T tiled buffers on V3D 3.x and newer, it's been replaced
with a newer layout shared with other hardware blocks.

5 years agodrm-uapi: Update drm_fourcc.h for new format modifiers.
Eric Anholt [Wed, 20 Jun 2018 23:51:39 +0000 (16:51 -0700)]
drm-uapi: Update drm_fourcc.h for new format modifiers.

This brings in the Broadcom VC4 SAND and V3D 3.x+ UIF modifiers, from
drm-next commit 4da1d4c751c9b1b713c13043bad7c4d27cd1418c.

5 years agost/mesa: notify u_vbuf/driver that draw index bounds are unknown for indirect
Marek Olšák [Tue, 17 Jul 2018 05:50:42 +0000 (01:50 -0400)]
st/mesa: notify u_vbuf/driver that draw index bounds are unknown for indirect

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agoradeonsi: Use signed char for color_interp_vgpr_index
Timothy Pearson [Mon, 16 Jul 2018 19:20:42 +0000 (14:20 -0500)]
radeonsi: Use signed char for color_interp_vgpr_index

color_interp_vgpr_index was declared as a generic char value.
Because signed values are used in this variable, the result
was not safe across architectures and crashed on ppc64[el]
and arm.

Declare color_interp_vgpr_index as a signed type.

Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
5 years agointel/blorp: Take an explicit filter parameter in blorp_blit
Jason Ekstrand [Mon, 25 Jun 2018 22:14:38 +0000 (15:14 -0700)]
intel/blorp: Take an explicit filter parameter in blorp_blit

This lets us move the glBlitFramebuffer nonsense into the GL driver and
make the usage of BLORP mutch more explicit and obvious as to what it's
doing.

Reviewed-by: Chad Versace <chadversary@chromium.org>
5 years agointel/blorp: Add a blorp_filter enum for use in blorp_blit
Jason Ekstrand [Wed, 20 Jun 2018 05:05:57 +0000 (22:05 -0700)]
intel/blorp: Add a blorp_filter enum for use in blorp_blit

At the moment, this is entirely internal but we'll expose it to clients
of the BLORP API in the next commit.

Reviewed-by: Chad Versace <chadversary@chromium.org>
5 years agointel/tools: add missing include for stdarg.h
Caio Marcelo de Oliveira Filho [Wed, 18 Jul 2018 16:15:53 +0000 (09:15 -0700)]
intel/tools: add missing include for stdarg.h

Fixes build in GCC 8.1.1:

FAILED: src/intel/tools/src@intel@tools@@intel_dump_gpu@sha/aub_write.c.o
gcc -Isrc/intel/tools/src@intel@tools@@intel_dump_gpu@sha -Isrc/intel/tools -I../../src/intel/tools -Isrc/../include -I../../src/../include -Isrc -I../../src -Isrc/mapi -I../../src/mapi -Isrc/mesa -I../../src/mesa -I../../src/gallium/include -I../../src/gallium/auxiliary -Isrc/intel -I../../src/intel -I../../include/drm-uapi -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c99 -O2 -g -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS '-DVERSION="18.2.0-devel"' -DPACKAGE_VERSION=VERSION '-DPACKAGE_BUGREPORT="https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa"' -DGLX_USE_TLS -DENABLE_ST_OMX_BELLAGIO=0 -DENABLE_ST_OMX_TIZONIA=0 -DHAVE_X11_PLATFORM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_DRM -DHAVE_DRM_PLATFORM -DHAVE_SURFACELESS_PLATFORM -DENABLE_SHADER_CACHE -DHAVE___BUILTIN_BSWAP32 -DHAVE___BUILTIN_BSWAP64 -DHAVE___BUILTIN_CLZ -DHAVE___BUILTIN_CLZLL -DHAVE___BUILTIN_CTZ -DHAVE___BUILTIN_EXPECT -DHAVE___BUILTIN_FFS -DHAVE___BUILTIN_FFSLL -DHAVE___BUILTIN_POPCOUNT -DHAVE___BUILTIN_POPCOUNTLL -DHAVE___BUILTIN_UNREACHABLE -DHAVE_FUNC_ATTRIBUTE_CONST -DHAVE_FUNC_ATTRIBUTE_FLATTEN -DHAVE_FUNC_ATTRIBUTE_MALLOC -DHAVE_FUNC_ATTRIBUTE_PURE -DHAVE_FUNC_ATTRIBUTE_UNUSED -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT -DHAVE_FUNC_ATTRIBUTE_WEAK -DHAVE_FUNC_ATTRIBUTE_FORMAT -DHAVE_FUNC_ATTRIBUTE_PACKED -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL -DHAVE_FUNC_ATTRIBUTE_VISIBILITY -DHAVE_FUNC_ATTRIBUTE_ALIAS -DHAVE_FUNC_ATTRIBUTE_NORETURN -D_GNU_SOURCE -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DUSE_X86_64_ASM -DMAJOR_IN_SYSMACROS -DHAVE_SYS_SYSCTL_H -DHAVE_LINUX_FUTEX_H -DHAVE_ENDIAN_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_POSIX_MEMALIGN -DHAVE_TIMESPEC_GET -DHAVE_MEMFD_CREATE -DHAVE_STRTOD_L -DHAVE_DLADDR -DHAVE_DL_ITERATE_PHDR -DHAVE_ZLIB -DHAVE_PTHREAD -DHAVE_LIBDRM -DHAVE_LLVM=0x0600 -DMESA_LLVM_VERSION_PATCH=1 -DHAVE_VALGRIND -DHAVE_LIBUNWIND -DHAVE_WAYLAND_PLATFORM -DWL_HIDE_DEPRECATED -DHAVE_DRI3 -DHAVE_DRI3_MODIFIERS -Wall -Werror=implicit-function-declaration -Werror=missing-prototypes -fno-math-errno -fno-trapping-math -Wno-missing-field-initializers -fPIC -fvisibility=hidden -Wno-override-init  -MD -MQ 'src/intel/tools/src@intel@tools@@intel_dump_gpu@sha/aub_write.c.o' -MF 'src/intel/tools/src@intel@tools@@intel_dump_gpu@sha/aub_write.c.o.d' -o 'src/intel/tools/src@intel@tools@@intel_dump_gpu@sha/aub_write.c.o' -c ../../src/intel/tools/aub_write.c
../../src/intel/tools/aub_write.c: In function ‘fail_if’:
../../src/intel/tools/aub_write.c:243:4: error: implicit declaration of function ‘va_start’; did you mean ‘assert’? [-Werror=implicit-function-declaration]
    va_start(args, format);
    ^~~~~~~~
    assert
../../src/intel/tools/aub_write.c:245:4: error: implicit declaration of function ‘va_end’; did you mean ‘rand’? [-Werror=implicit-function-declaration]
    va_end(args);
    ^~~~~~
    rand
cc1: some warnings being treated as errors

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agointel/tools: Rename error2aub to intel_error2aub
Jason Ekstrand [Wed, 18 Jul 2018 16:02:25 +0000 (09:02 -0700)]
intel/tools: Rename error2aub to intel_error2aub

Suggested-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoi965: Sweep NIR after linking phase to free held memory
Danylo Piliaiev [Wed, 11 Jul 2018 12:29:00 +0000 (15:29 +0300)]
i965: Sweep NIR after linking phase to free held memory

After optimization passes and many trasfromations most of memory
NIR holds is a garbage which was being freed only after shader deletion.
Freeing it at the end of linking will save memory which would be useful
in case there are a lot of complex shaders being compiled.
The common case for this issue is 32bit game running under Wine.

The cost of the optimization is around ~3-5% of compilation speed
with complex shaders.

V2: by Jason Ekstrand
    - Move nir_sweep up, right after the last change of NIR

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103274
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: mesa-stable@lists.freedesktop.org
5 years agowinsys/amdgpu: fix VDPAU interop by having one amdgpu_winsys_bo per BO (v2)
Marek Olšák [Mon, 16 Jul 2018 17:11:29 +0000 (13:11 -0400)]
winsys/amdgpu: fix VDPAU interop by having one amdgpu_winsys_bo per BO (v2)

Dependencies between rings are inserted correctly if a buffer is
represented by only one unique amdgpu_winsys_bo instance.
Use a hash table keyed by amdgpu_bo_handle to have exactly one
amdgpu_winsys_bo per amdgpu_bo_handle.

v2: return offset and stride properly

Tested-by: Leo Liu <leo.liu@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
5 years agowinsys/amdgpu: use a better hash_pointer function
Marek Olšák [Mon, 16 Jul 2018 17:10:57 +0000 (13:10 -0400)]
winsys/amdgpu: use a better hash_pointer function

Tested-by: Leo Liu <leo.liu@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
5 years agowinsys/amdgpu: clean up error handling in amdgpu_bo_from_handle
Marek Olšák [Mon, 16 Jul 2018 17:07:09 +0000 (13:07 -0400)]
winsys/amdgpu: clean up error handling in amdgpu_bo_from_handle

Tested-by: Leo Liu <leo.liu@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
5 years agowinsys/amdgpu: shorten bo->ws in amdgpu_bo_destroy
Marek Olšák [Mon, 16 Jul 2018 17:04:53 +0000 (13:04 -0400)]
winsys/amdgpu: shorten bo->ws in amdgpu_bo_destroy

Tested-by: Leo Liu <leo.liu@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
5 years agointel/tools: Add an error state to aub translator
Jason Ekstrand [Tue, 17 Jul 2018 16:14:38 +0000 (09:14 -0700)]
intel/tools: Add an error state to aub translator

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agointel/tools: Break aub file writing into a helper
Jason Ekstrand [Tue, 17 Jul 2018 06:13:20 +0000 (23:13 -0700)]
intel/tools: Break aub file writing into a helper

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agointel/tools: Refactor aub dumping to remove singletons
Jason Ekstrand [Tue, 17 Jul 2018 05:38:08 +0000 (22:38 -0700)]
intel/tools: Refactor aub dumping to remove singletons

Instead of having quite so many singletons, we use a struct aub_file to
organize the bits we need for writing an aub file.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agointel/dump_gpu: Fix corner cases in PPGTT range calculations
Jason Ekstrand [Tue, 17 Jul 2018 22:55:07 +0000 (15:55 -0700)]
intel/dump_gpu: Fix corner cases in PPGTT range calculations

For large buffers which span an entire l1 page table, we got the range
calculations wrong.  In this case, we end up with an l1_start which is
the first byte represented by the given l1 table and an l1_end which is
the first byte after the range represented by the l1 table.  Then
l2_start_index == L2_index(l2_end) due to roll-over.  Instead, compute
lN_end using (1Ull << shift) - 1 so that lN_end is the last byte in the
range represented by the Nth level page table.  When we do this, we
don't need the conditional expression anymore.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agointel/blorp: fix uninitialized variable warning
Caio Marcelo de Oliveira Filho [Mon, 16 Jul 2018 22:22:50 +0000 (15:22 -0700)]
intel/blorp: fix uninitialized variable warning

Compiler doesn't pick up that level and start_layer will be defined,
so do as was done for num_layers in 4d8b476fa9a "intel/blorp: Fix
compiler warning about num_layers." and always set it.

Fixes warning

../../src/mesa/drivers/dri/i965/brw_blorp.c: In function ‘brw_blorp_clear_depth_stencil’:
../../src/mesa/drivers/dri/i965/brw_blorp.c:1439:4: warning: ‘start_layer’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    blorp_clear_depth_stencil(&batch, &depth_surf, &stencil_surf,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                              level, start_layer, num_layers,
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                              x0, y0, x1, y1,
                              ~~~~~~~~~~~~~~~
                              (mask & BUFFER_BIT_DEPTH), ctx->Depth.Clear,
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                              stencil_mask, ctx->Stencil.Clear);
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/mesa/drivers/dri/i965/brw_blorp.c:1439:4: warning: ‘level’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
5 years agoutil/string_buffer: fix warning in tests
Caio Marcelo de Oliveira Filho [Mon, 16 Jul 2018 22:12:00 +0000 (15:12 -0700)]
util/string_buffer: fix warning in tests

And also specify the maximum size when writing to static buffers. The
warning below refers to the case where "str5" could be larger than
"str5 - str4", then the strcat would have overlapping dst and src.

Compiler doesn't pick up the bound from the snprintf above, so we make
clear the bounds of str5 by using strncat() instead of strcat().

../../src/util/tests/string_buffer/string_buffer_test.cpp: In member function ‘virtual void string_buffer_string_buffer_tests_Test::TestBody()’:
../../src/util/tests/string_buffer/string_buffer_test.cpp:106:10: warning: ‘char* strcat(char*, const char*)’ accessing 81 or more bytes at offsets 48 and 128 may overlap 1 byte at offset 128 [-Wrestrict]
    strcat(str4, str5);
    ~~~~~~^~~~~~~~~~~~

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
5 years agoi965/miptree: avoid uninitialized variable warnings
Caio Marcelo de Oliveira Filho [Mon, 16 Jul 2018 21:59:32 +0000 (14:59 -0700)]
i965/miptree: avoid uninitialized variable warnings

GCC 8.1.1 is having a hard time identifying that the values are
properly initialized when used. In the 'memset_value' case, we pass
the uninitialized value to another function (that will use only if the
conditions match the initialization).

Just give enough hint to the compiler to figure things out. Fixes the
warnings

../../src/mesa/drivers/dri/i965/intel_mipmap_tree.c: In function ‘intel_miptree_alloc_aux’:
../../src/mesa/drivers/dri/i965/intel_mipmap_tree.c:1839:18: warning: ‘memset_value’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    mt->aux_buf = intel_alloc_aux_buffer(brw, &aux_surf, needs_memset,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                         memset_value);
                                         ~~~~~~~~~~~~~
../../src/mesa/drivers/dri/i965/intel_mipmap_tree.c:1698:10: warning: ‘initial_state’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       if (wants_memset)
          ^
../../src/mesa/drivers/dri/i965/intel_mipmap_tree.c:1772:23: note: ‘initial_state’ was declared here
    enum isl_aux_state initial_state;
                       ^~~~~~~~~~~~~

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
5 years agointel/batch-decoder: fix uninitialized values warnings
Caio Marcelo de Oliveira Filho [Mon, 16 Jul 2018 21:17:38 +0000 (14:17 -0700)]
intel/batch-decoder: fix uninitialized values warnings

Code assumes that all the necessary fields will exist, but compiler
doesn't know about this. Provide zero as default values, like in other
decoding functions.

Fixes warnings

../../src/intel/common/gen_batch_decoder.c: In function ‘handle_media_interface_descriptor_load’:
../../src/intel/common/gen_batch_decoder.c:347:7: warning: ‘binding_entry_count’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       dump_binding_table(ctx, binding_table_offset, binding_entry_count);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/intel/common/gen_batch_decoder.c:347:7: warning: ‘binding_table_offset’ may be used uninitialized in this function [-Wmaybe-uninitialized]

../../src/intel/common/gen_batch_decoder.c:346:7: warning: ‘sampler_count’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       dump_samplers(ctx, sampler_offset, sampler_count);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/intel/common/gen_batch_decoder.c:346:7: warning: ‘sampler_offset’ may be used uninitialized in this function [-Wmaybe-uninitialized]

../../src/intel/common/gen_batch_decoder.c:343:7: warning: ‘ksp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       ctx_disassemble_program(ctx, ksp, "compute shader");
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../../src/intel/common/gen_batch_decoder.c: In function ‘decode_dynamic_state_pointers’:
../../src/intel/common/gen_batch_decoder.c:663:54: warning: ‘state_offset’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    const uint32_t *state_map = ctx->dynamic_base.map + state_offset;
                                ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~

../../src/intel/common/gen_batch_decoder.c: In function ‘gen_print_batch’:
../../src/intel/common/gen_batch_decoder.c:856:13: warning: ‘next_batch.map’ may be used uninitialized in this function [-Wmaybe-uninitialized]
          if (next_batch.map == NULL) {
             ^
../../src/intel/common/gen_batch_decoder.c:860:13: warning: ‘next_batch.addr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             gen_print_batch(ctx, next_batch.map, next_batch.size,
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                             next_batch.addr);
                             ~~~~~~~~~~~~~~~~

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
5 years agointel/decoder: use snprintf(..., "%s", ...) instead of strncpy
Caio Marcelo de Oliveira Filho [Mon, 16 Jul 2018 21:06:09 +0000 (14:06 -0700)]
intel/decoder: use snprintf(..., "%s", ...) instead of strncpy

strncpy() doesn't guarantee the terminator NUL, so we would need to
set ourselves. Just use snprintf() instead.

Fixes the warnings

../../src/intel/common/gen_decoder.c: In function ‘iter_decode_field’:
../../src/intel/common/gen_decoder.c:897:7: warning: ‘strncpy’ specified bound 128 equals destination size [-Wstringop-truncation]
       strncpy(iter->name, iter->field->name, sizeof(iter->name));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘iter_advance_field’,
    inlined from ‘gen_field_iterator_next’ at ../../src/intel/common/gen_decoder.c:1015:9:
../../src/intel/common/gen_decoder.c:844:7: warning: ‘strncpy’ specified bound 128 equals destination size [-Wstringop-truncation]
       strncpy(iter->name, iter->field->name, sizeof(iter->name));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
5 years agoanv: give more room to debug report
Caio Marcelo de Oliveira Filho [Mon, 16 Jul 2018 20:56:23 +0000 (13:56 -0700)]
anv: give more room to debug report

The error buffer is limited to 256, but the report contains the
filename and possibly other data. So give it more space.

Avoids the warnings

../../src/intel/vulkan/anv_util.c: In function ‘__anv_perf_warn’:
../../src/intel/vulkan/anv_util.c:66:42: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 254 [-Wformat-truncation=]
    snprintf(report, sizeof(report), "%s: %s", file, buffer);
                                          ^~         ~~~~~~
../../src/intel/vulkan/anv_util.c:66:4: note: ‘snprintf’ output 3 or more bytes (assuming 258) into a destination of size 256
    snprintf(report, sizeof(report), "%s: %s", file, buffer);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../../src/intel/vulkan/anv_util.c: In function ‘__vk_errorf’:
../../src/intel/vulkan/anv_util.c:96:48: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 252 [-Wformat-truncation=]
       snprintf(report, sizeof(report), "%s:%d: %s (%s)", file, line, buffer,
                                                ^~                    ~~~~~~
../../src/intel/vulkan/anv_util.c:96:7: note: ‘snprintf’ output 8 or more bytes (assuming 263) into a destination of size 256
       snprintf(report, sizeof(report), "%s:%d: %s (%s)", file, line, buffer,
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                error_str);
                ~~~~~~~~~~

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
5 years agoanv: avoid warning when switching in VkStructureType
Caio Marcelo de Oliveira Filho [Mon, 16 Jul 2018 20:50:07 +0000 (13:50 -0700)]
anv: avoid warning when switching in VkStructureType

When one of the cases is not part of the enum, the compilar complains:

../../src/intel/vulkan/anv_formats.c: In function ‘anv_GetPhysicalDeviceFormatProperties2’:
../../src/intel/vulkan/anv_formats.c:728:7: warning: case value ‘1000001004’ not in enumerated type ‘VkStructureType’ {aka ‘enum VkStructureType’} [-Wswitch]
       case VK_STRUCTURE_TYPE_WSI_FORMAT_MODIFIER_PROPERTIES_LIST_MESA:
       ^~~~

Given the switch has an "default:" case, we don't lose anything by
switching on the unsigned value to avoid the warning.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
5 years agoglsl: remove unnecessary parenthesis from macro
Caio Marcelo de Oliveira Filho [Mon, 16 Jul 2018 20:40:26 +0000 (13:40 -0700)]
glsl: remove unnecessary parenthesis from macro

The "__inst" will contain the name used for the variable of type
"__type *". Parenthesis is not necessary as the name itself shouldn't
be an expression.

Fixes warning:

In file included from ../../src/mesa/main/mtypes.h:49,
                 from ../../src/intel/compiler/brw_compiler.h:30,
                 from ../../src/intel/compiler/brw_shader.h:29,
                 from ../../src/intel/compiler/brw_fs.h:31,
                 from ../../src/intel/compiler/brw_fs_cse.cpp:24:
../../src/intel/compiler/brw_fs_cse.cpp: In member function ‘bool fs_visitor::opt_cse_local(bblock_t*)’:
../../src/compiler/glsl/list.h:675:12: warning: unnecessary parentheses in declaration of ‘entry’ [-Wparentheses]
    __type *(__inst);                                      \
            ^
../../src/intel/compiler/brw_fs_cse.cpp:257:10: note: in expansion of macro ‘foreach_in_list_use_after’
          foreach_in_list_use_after(aeb_entry, entry, &aeb) {
          ^~~~~~~~~~~~~~~~~~~~~~~~~

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
5 years agointel/compiler: fix -Wsign-compare warning
Caio Marcelo de Oliveira Filho [Mon, 16 Jul 2018 20:32:36 +0000 (13:32 -0700)]
intel/compiler: fix -Wsign-compare warning

Explicitly convert to signed integer. Conversion is valid since is the
same (implicitly) used to initialize the loop. Avoids the warning:

../../src/intel/compiler/brw_fs.cpp: In member function ‘bool fs_visitor::lower_simd_width()’:
../../src/intel/compiler/brw_fs.cpp:5761:45: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
             split_inst.eot = inst->eot && i == n - 1;
                                           ~~^~~~~~~~

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
5 years agointel/compiler: silence -Wclass-memaccess warnings
Caio Marcelo de Oliveira Filho [Mon, 16 Jul 2018 20:19:30 +0000 (13:19 -0700)]
intel/compiler: silence -Wclass-memaccess warnings

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
5 years agospirv: initialize is_vertex_input
Caio Marcelo de Oliveira Filho [Mon, 16 Jul 2018 19:36:29 +0000 (12:36 -0700)]
spirv: initialize is_vertex_input

Fixes warning:

../../src/compiler/spirv/vtn_variables.c: In function ‘var_decoration_cb’:
../../src/compiler/spirv/vtn_variables.c:1400:12: warning: ‘is_vertex_input’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       bool is_vertex_input;
            ^~~~~~~~~~~~~~~

The code used to set is_vertex_input in all possible codepaths, but
after 23edc5b1ef3 "spirv: translate default-block uniforms" the
compiler isn't sure all codepaths will initialize the variable.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
5 years agofreedreno/a5xx: perfmance counters
Rob Clark [Wed, 18 Jul 2018 13:42:29 +0000 (09:42 -0400)]
freedreno/a5xx: perfmance counters

AMD_performance_monitor support

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno: batch query support (perfcounters)
Rob Clark [Wed, 18 Jul 2018 13:40:04 +0000 (09:40 -0400)]
freedreno: batch query support (perfcounters)

Core infrastructure for performance counters, using gallium's batch
query interface (to support AMD_performance_monitor).

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno: batch query prep-work
Rob Clark [Thu, 28 Jun 2018 12:16:12 +0000 (08:16 -0400)]
freedreno: batch query prep-work

For batch queries we have N different query_type's for one query, so
mapping a single query_type to a sample_provider doesn't really work
out.  Instead add a new constructor to construct a query directly
from a sample_provider.

Also, the sample buffer size needs to be determined at runtime, as
it depends on the number of query_types.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno: rework accumulated query result vfunc
Rob Clark [Thu, 28 Jun 2018 12:14:10 +0000 (08:14 -0400)]
freedreno: rework accumulated query result vfunc

Take the query object, rather than the ctx.  The ctx ptr isn't hugely
useful but for back queries we will need the query object to properly
get the results.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno/ir3: output ir3 and nir asm for frameretrace
Rob Clark [Mon, 9 Jul 2018 17:17:12 +0000 (13:17 -0400)]
freedreno/ir3: output ir3 and nir asm for frameretrace

See: https://github.com/janesma/apitrace/commit/298dc8195bf082fe1f47aa474e28411f85dd5393

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno/ir3: redirectable ir3 disasm output
Rob Clark [Mon, 9 Jul 2018 16:36:10 +0000 (12:36 -0400)]
freedreno/ir3: redirectable ir3 disasm output

For now it still goes to stdout, this will make it easier to support
output on stderr like what frameretrace expects.

(If we eventually have a proper GL extension for this, implementation
probably looks like dumping shader disasm to a tmp file and then dumping
that out over whatever mechanism is used.)

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno/ir3: resync ir3 disassembler
Rob Clark [Mon, 9 Jul 2018 14:14:14 +0000 (10:14 -0400)]
freedreno/ir3: resync ir3 disassembler

Pull in latest updates from cffdump in envytools tree, so we can output
to other than just stdout.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno: register usage queries
Rob Clark [Mon, 25 Jun 2018 12:47:55 +0000 (08:47 -0400)]
freedreno: register usage queries

Avg number of (half) regs per draw, so we can corrolate fps dips to
shader register usage.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agonir: add lowering for gl_HelperInvocation
Rob Clark [Fri, 1 Jun 2018 18:07:15 +0000 (14:07 -0400)]
nir: add lowering for gl_HelperInvocation

v2: reword comment about lower_helper_invocations to be more clear
    that it might not work on all hardware
v3: add special variant of load_sample_id which does not imply per-
    sample shading

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agomesa: don't double incr/decr ActiveCounters
Rob Clark [Mon, 2 Jul 2018 14:40:36 +0000 (10:40 -0400)]
mesa: don't double incr/decr ActiveCounters

Frameretrace ends up w/ excess calls to SelectPerfMonitorCountersAMD()
which ends up re-enabling already enabled counters.  Which causes
ActiveCounters[group] to be double incremented for the same counter.
This causes BeginPerfMonitorAMD() to fail.

The AMD_performance_monitor spec doesn't say that an error should be
generated in this case.  So I think the safe thing to do is just safe-
guard against excess increments/decrements.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agomesa: fix error msg typo
Rob Clark [Mon, 2 Jul 2018 12:15:43 +0000 (08:15 -0400)]
mesa: fix error msg typo

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
5 years agonir: fixup intrinsic comment
Rob Clark [Sat, 23 Jun 2018 22:22:42 +0000 (18:22 -0400)]
nir: fixup intrinsic comment

Now the deref is the first src.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
5 years agomesa: handle a bunch of formats in IMPLEMENTATION_COLOR_READ_*
Tomeu Vizoso [Fri, 22 Jun 2018 13:04:04 +0000 (15:04 +0200)]
mesa: handle a bunch of formats in IMPLEMENTATION_COLOR_READ_*

Virgl could save a lot of work converting buffers in the host side
between formats if Mesa supported a bunch of other formats when reading
pixels.

This commit adds cases to handle specific formats so that the values
reported by the two calls match more closely the underlying native
formats.

In GLES is important that IMPLEMENTATION_COLOR_READ_* return the native
format and data type because the spec only allows reading with those,
besides GL_RGBA or GL_RGBA_INTEGER.

Additionally, because virgl currently doesn't implement such
conversions, this commit fixes several tests in
dEQP-GLES3.functional.fbo.color.clear.*, when using virgl in the guest
side.

The logic is based on knowledge that is shared with
_mesa_format_matches_format_and_type() but we cannot assert that the
results match as we don't have all the starting information at both
points. So leave the assert out and hope CI comes soon to save us all.

v2: * Let R10G10B10A2_UINT fall back to GL_RGBA_INTEGER (Eric Anholt)
    * Assert with _mesa_format_matches_format_and_type (Eric Anholt)

v3: * Remove the assert, as it won't be reliable (Eric Anholt)

v4: * Use _mesa_is_format_integer in the fallback (Eric Anholt)

v5: * Remove superfluous call to
      _mesa_uncompressed_format_to_type_and_comps (Eric Anholt)

Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
5 years agoradv: add support for VK_EXT_conditional_rendering
Samuel Pitoiset [Mon, 9 Jul 2018 09:37:15 +0000 (11:37 +0200)]
radv: add support for VK_EXT_conditional_rendering

Inherited commands buffers are not supported.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: add support for non-inverted conditional rendering
Samuel Pitoiset [Mon, 9 Jul 2018 09:33:28 +0000 (11:33 +0200)]
radv: add support for non-inverted conditional rendering

By default, our internal rendering commands are discarded
only if the predicate is non-zero (ie. DRAW_VISIBLE). But
VK_EXT_conditional_rendering also allows to discard commands
when the predicate is zero, which means we have to use a
different flag.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: set the predicate for indirect/indexed draw commands
Samuel Pitoiset [Mon, 9 Jul 2018 09:16:43 +0000 (11:16 +0200)]
radv: set the predicate for indirect/indexed draw commands

VK_EXT_conditional_rendering allows to discard draw commands
(not only normal draws).

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: set the predicate for dispatch commands
Samuel Pitoiset [Mon, 9 Jul 2018 09:12:25 +0000 (11:12 +0200)]
radv: set the predicate for dispatch commands

VK_EXT_conditional_rendering allows to discard dispatch commands.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoi965: batchbuffer: write correct canonical offset with softpin
Lionel Landwerlin [Tue, 17 Jul 2018 14:05:28 +0000 (15:05 +0100)]
i965: batchbuffer: write correct canonical offset with softpin

Addresses in the command streams should be in canonical form (i.e
bit[63:48] == bit[47]). If the [bo->gtt_offset, bo->gtt_offset +
target_offset] range contains the address 0x800000000000, the current
code will fail that criteria.

v2: Fix missing include (Lionel)

Fixes: 1c9053d0765dc6 ("i965: Prepare batchbuffer module for softpin support.")
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoradv: remove unused variable in radv_CreateRenderPass2KHR()
Samuel Pitoiset [Wed, 18 Jul 2018 08:54:26 +0000 (10:54 +0200)]
radv: remove unused variable in radv_CreateRenderPass2KHR()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agoradv: optimize radv_stage_flush() for pre fragment shader stages
Samuel Pitoiset [Tue, 17 Jul 2018 15:03:26 +0000 (17:03 +0200)]
radv: optimize radv_stage_flush() for pre fragment shader stages

We don't need to emit PS_PARTIAL_FLUSH for the pre fragment shader
stages (ie. geometry/tessellation). Emitting VS_PARTIAL_FLUSH
is enough for these stages. Note that PS_PARTIAL_FLUSH also
synchronizes all vertex stages.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoanv: fix assert in anv_CmdBindDescriptorSets()
Samuel Iglesias Gonsálvez [Tue, 17 Jul 2018 06:55:48 +0000 (08:55 +0200)]
anv: fix assert in anv_CmdBindDescriptorSets()

The assert is checking that we are not binding more descriptor sets
than the supported by the driver. When binding the descriptor set
number MAX_SETS-1, it was breaking the assert because
descriptorSetCount = 1.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoclover: Report error when pipe driver fails to create compute state
Jan Vesely [Tue, 17 Jul 2018 06:07:45 +0000 (02:07 -0400)]
clover: Report error when pipe driver fails to create compute state

CC: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
5 years agoclover: Catch errors from executing event action
Jan Vesely [Tue, 17 Jul 2018 06:05:02 +0000 (02:05 -0400)]
clover: Catch errors from executing event action

Abort all dependent events.
v2: Abort the current event as well.

CC: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
5 years agonir: add a couple of ior opts to nir_opt_algebraic
Timothy Arceri [Mon, 16 Jul 2018 05:19:29 +0000 (15:19 +1000)]
nir: add a couple of ior opts to nir_opt_algebraic

One of these was seen in a Deus Ex shader.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir: allow opt_peephole_select to handle nir_instr_type_deref
Timothy Arceri [Sun, 15 Jul 2018 23:26:33 +0000 (09:26 +1000)]
nir: allow opt_peephole_select to handle nir_instr_type_deref

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agor600: fix warnings when unref'ing pool->bo
Marek Olšák [Tue, 17 Jul 2018 18:51:16 +0000 (14:51 -0400)]
r600: fix warnings when unref'ing pool->bo

5 years agor600g: some -Wsign-compare fixes
Konstantin Kharlamov [Fri, 29 Dec 2017 05:32:31 +0000 (08:32 +0300)]
r600g: some -Wsign-compare fixes

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
5 years agost/glx: constify some variables
Konstantin Kharlamov [Fri, 29 Dec 2017 05:32:30 +0000 (08:32 +0300)]
st/glx: constify some variables

Just a nice hint for both peoples and compilers.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
5 years agost/nine: constify some variables
Konstantin Kharlamov [Fri, 29 Dec 2017 05:32:29 +0000 (08:32 +0300)]
st/nine: constify some variables

Just a nice hint for both peoples and compilers.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
5 years agor600g: constify some variables
Konstantin Kharlamov [Fri, 29 Dec 2017 05:32:28 +0000 (08:32 +0300)]
r600g: constify some variables

Just a nice hint for both peoples and compilers.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
5 years agor600g: do not use "fast-clear" for small textures (v3)
Konstantin Kharlamov [Mon, 1 Jan 2018 07:38:37 +0000 (10:38 +0300)]
r600g: do not use "fast-clear" for small textures (v3)

Ported from radeonsi. Improves windowed glxgears ran as

vblank_mode=0 glxgears -info -geometry 0+0+512+512

from ≈2270 FPS to ≈2360 FPS. Tested with AMD TURKS.

v2: turned out glxgears ignores the option above, the correct way would
be "512x512+0+0". Now it can be seen 512x512 actually loses 30 FPS.
300×300 however wins around a hundred FPS, and to leave some room in
case results may differ for other cards I want not to nitpick in search
of an optimum but to simply leave 300×300 in the code.
v3: remove redundant braces, and try harder for the mail to stick to
the rest of the series.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Reviewed-by: Gert Wollny <gw.fossdev@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
5 years agofreedreno: re-work fd_batch_reference() locking
Rob Clark [Tue, 17 Jul 2018 14:14:59 +0000 (10:14 -0400)]
freedreno: re-work fd_batch_reference() locking

Annoyingly we still have to briefly drop the lock to unref resources..
but push the lock down into __fd_batch_destroy() so we can invalidate
the batch and reset resources before dropping the lock.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno: make fd_batch a one-shot thing
Rob Clark [Tue, 17 Jul 2018 14:12:55 +0000 (10:12 -0400)]
freedreno: make fd_batch a one-shot thing

Re-allocate rather than re-use.  Originally we had an unnecessarily
complex design to avoid re-allocating cmdstream buffers.  But now that
support for "growable" cmdstream buffers has been in place for a couple
years, I guess we can care a bit less about the extra overhead on older
kernels.

But making the batches one-shot removes a class of potential race
conditions vs the flush_queue.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno: flush immediately when reading a pending batch
Rob Clark [Tue, 17 Jul 2018 14:02:51 +0000 (10:02 -0400)]
freedreno: flush immediately when reading a pending batch

Instead of the reading batch setting a dependency on the writing batch,
simply flush the writing batch immediately.  This avoids situations
where we have to flush the context's current batch later.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno: get rid of noop render
Rob Clark [Tue, 17 Jul 2018 13:54:23 +0000 (09:54 -0400)]
freedreno: get rid of noop render

This was basically to avoid a zero-dword IB (indirect-branch), but
instead just don't emit the IB packet in that case.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno: fix samples=0 vs samples=1 confusion
Rob Clark [Tue, 17 Jul 2018 13:44:23 +0000 (09:44 -0400)]
freedreno: fix samples=0 vs samples=1 confusion

pipe_framebuffer_state can have samples=0 in various cases, which is
actually the same thing as samples=1.  So use the _get_num_samples()
helper to populate the key, to avoid this looking like two distinct
fb states to the cache.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno: comment for _invalidate_batch()
Rob Clark [Tue, 17 Jul 2018 13:42:27 +0000 (09:42 -0400)]
freedreno: comment for _invalidate_batch()

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno: hold batch references when flushing
Rob Clark [Tue, 17 Jul 2018 13:40:23 +0000 (09:40 -0400)]
freedreno: hold batch references when flushing

It is possible for a batch to be freed under our feet when flushing, so
it is best to hold a reference to all of them up-front.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agonir/spirv: print id for unsupported alu opcode
Karol Herbst [Sat, 14 Jul 2018 04:17:08 +0000 (06:17 +0200)]
nir/spirv: print id for unsupported alu opcode

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonir: prepare for bumping up max components to 16
Karol Herbst [Thu, 12 Jul 2018 01:40:23 +0000 (03:40 +0200)]
nir: prepare for bumping up max components to 16

OpenCL knows vector of size 8 and 16.

v2: rebased on master (nir_swizzle rework)
    rework more declarations with nir_component_mask_t
    adjust print_var_decl

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agoradv/winsys: use alloca() for semaphore dependencies
Samuel Pitoiset [Thu, 12 Jul 2018 14:26:34 +0000 (16:26 +0200)]
radv/winsys: use alloca() for semaphore dependencies

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: reduce number of CB/DB meta flushes for VK_ACCESS_TRANSFER_WRITE_BIT
Samuel Pitoiset [Fri, 13 Jul 2018 15:35:58 +0000 (17:35 +0200)]
radv: reduce number of CB/DB meta flushes for VK_ACCESS_TRANSFER_WRITE_BIT

If we know that the given image doesn't have any metadata,
we don't need to flush.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: fix implementation of VK_KHR_create_renderpass2 for multiviews
Samuel Pitoiset [Fri, 13 Jul 2018 12:14:52 +0000 (14:14 +0200)]
radv: fix implementation of VK_KHR_create_renderpass2 for multiviews

The Vulkan 1.1.80 spec says:

"viewMask has the same effect for the described subpass as
 VkRenderPassMultiviewCreateInfo::pViewMasks has on each
 corresponding subpass."

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agovirgl: respect max_vertex_attrib_stride cap
Erik Faye-Lund [Tue, 17 Jul 2018 05:43:57 +0000 (15:43 +1000)]
virgl: respect max_vertex_attrib_stride cap

This is required for OpenGL 4.4 and OpenGL ES 3.1 support.

Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agovirgl: Fix flush in virgl_encoder_inline_write.
Lepton Wu [Tue, 17 Jul 2018 01:56:32 +0000 (18:56 -0700)]
virgl: Fix flush in virgl_encoder_inline_write.

The current code is buggy: if there are only 12 dwords left in cbuf,
we emit a zero data length command which will be rejected by virglrenderer.
Fix it by calling flush in this case.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agovirgl: implement set_min_samples
Erik Faye-Lund [Mon, 16 Jul 2018 10:37:31 +0000 (12:37 +0200)]
virgl: implement set_min_samples

This allows us to implement glMinSampleShading correctly, which up
until now just got ignored.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoglsl: do second pass of const propagation in loops
Caio Marcelo de Oliveira Filho [Tue, 26 Jun 2018 22:46:53 +0000 (15:46 -0700)]
glsl: do second pass of const propagation in loops

When handling loops in constant propagation, implement the "FINISHME"
comment like copy propagation: perform a first pass to find values
that can't be propagated, then perform a second pass with the ACP
containing still valid values.

Certain values are killed because the loop may run more than one
iteration, so we can't copy propagate them as they would be invalid in
the later iterations.

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agoglsl: don't let an 'if' then-branch kill const propagation for else-branch
Caio Marcelo de Oliveira Filho [Fri, 15 Jun 2018 20:59:45 +0000 (13:59 -0700)]
glsl: don't let an 'if' then-branch kill const propagation for else-branch

When handling 'if' in constant propagation, if a certain variable was
killed when processing the first branch of the 'if', then the second
would get any propagation from previous nodes. This is similar to the
change done for copy propagation code.

    x = 1;
    if (...) {
        z = x;  // This would turn into z = 1.
        x = 22; // x gets killed.
    } else {
        w = x;  // This would NOT turn into w = 1.
    }

With the change, we let constant propagation happen independently in
the two branches and only then apply the killed values for the
subsequent code.

The new code use a single hash table for keeping the kills of both
branches (the branches only write to it), and it gets deleted after we
use -- instead of waiting for mem_ctx to collect it.

NIR deals well with constant propagation, so it already covered for
the missing ones that this patch fixes.

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agov3d: Disable shader-db cycle estimates until we sort out TMU estimates.
Eric Anholt [Mon, 16 Jul 2018 20:57:03 +0000 (13:57 -0700)]
v3d: Disable shader-db cycle estimates until we sort out TMU estimates.

I keep having to ignore these shader-db changes since I don't trust them,
so just disable the reports entirely.

5 years agov3d: Emit the lowered uniform just before its first use in a block.
Eric Anholt [Mon, 16 Jul 2018 20:27:13 +0000 (13:27 -0700)]
v3d: Emit the lowered uniform just before its first use in a block.

total instructions in shared programs: 98578 -> 98119 (-0.47%)
instructions in affected programs:     27571 -> 27112 (-1.66%)

and it also eliminates most spills/fills on the CTS's randomized uniform
usage testcases.

5 years agov3d: Add an assert that we don't provide an invalid texture return words.
Eric Anholt [Mon, 16 Jul 2018 19:41:28 +0000 (12:41 -0700)]
v3d: Add an assert that we don't provide an invalid texture return words.

The docs had an update noting this restriction, so reflect it in the code.

5 years agov3d: Apply GFXH-1625 restriction on TMUWT in the end of the shader.
Eric Anholt [Mon, 16 Jul 2018 19:35:11 +0000 (12:35 -0700)]
v3d: Apply GFXH-1625 restriction on TMUWT in the end of the shader.

This doesn't affect us yet since we're not doing TMUWTs, but I think we
will for GLES 3.1.

5 years agointel/batch_decoder: decoding of 3DSTATE_CONSTANT_BODY.
Sergii Romantsov [Thu, 12 Jul 2018 12:47:48 +0000 (15:47 +0300)]
intel/batch_decoder: decoding of 3DSTATE_CONSTANT_BODY.

SNB doesn't have a definition of 3DSTATE_CONSTANT_BODY, thats
why we got segmentation fault when used INTEL_DEBUG=bat.
Fixed by adding of 3DSTATE_CONSTANT_BODY into 3DSTATE_CONSTANT
of VS, GS and PS structures.

v2: added definition of 3DSTATE_CONSTANT_BODY to the gen6.xml

Fixes: 169d8e011ae (intel: Fix 3DSTATE_CONSTANT buffer decoding.)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107190
Signed-off-by: Sergii Romantsov <sergii.romantsov@globallogic.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agor600: fix build after the removal of RADEON_PRIO_* flags
Marek Olšák [Mon, 16 Jul 2018 18:32:58 +0000 (14:32 -0400)]
r600: fix build after the removal of RADEON_PRIO_* flags

5 years agonir: fix msvc build
Roland Scheidegger [Sat, 14 Jul 2018 02:49:36 +0000 (04:49 +0200)]
nir: fix msvc build

Empty initializer braces aren't valid c (it's a gnu extension, and
it's valid in c++).
Hopefully fixes appveyor / msvc build...

Fixes a3150c1d06ae7766c3d3fe3b33432e55c3c7527e

5 years agonir/worklist: Rework the foreach macro
Jason Ekstrand [Wed, 4 Jul 2018 02:18:28 +0000 (19:18 -0700)]
nir/worklist: Rework the foreach macro

This makes the arguments match the (thing, container) pattern used in
other nir_foreach macros and also renames it to make that a bit more
clear.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agointel: tools: Fix uninitialized variable warnings in intel_dump_gpu.
Eric Anholt [Thu, 12 Jul 2018 18:45:27 +0000 (11:45 -0700)]
intel: tools: Fix uninitialized variable warnings in intel_dump_gpu.

Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
5 years agospirv: Fix a couple of image atomic load/store bugs
Jason Ekstrand [Fri, 6 Jul 2018 21:41:12 +0000 (14:41 -0700)]
spirv: Fix a couple of image atomic load/store bugs

For one thing, the NIR opcodes for image load/store always take and
return a vec4 value regardless of the image type.  We need to fix up
both the source and destination to handle it.  For another thing, we
weren't actually setting up a destination in the OpAtomicLoad case.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: mesa-stable@lists.freedesktop.org
5 years agowinsys/amdgpu: clean up error handling in amdgpu_cs_submit_ib
Marek Olšák [Thu, 12 Jul 2018 04:47:11 +0000 (00:47 -0400)]
winsys/amdgpu: clean up error handling in amdgpu_cs_submit_ib

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agoradeonsi: rework RADEON_PRIO flags to be <= 31
Marek Olšák [Thu, 12 Jul 2018 04:27:06 +0000 (00:27 -0400)]
radeonsi: rework RADEON_PRIO flags to be <= 31

This decreases sizeof(struct amdgpu_cs_buffer) from 24 to 16 bytes.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agoradeonsi: merge DCC/CMASK/HTILE priority flags
Marek Olšák [Thu, 12 Jul 2018 04:17:02 +0000 (00:17 -0400)]
radeonsi: merge DCC/CMASK/HTILE priority flags

For a later simplification.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agoradeonsi: remove non-GFX BO priority flags
Marek Olšák [Thu, 12 Jul 2018 04:05:23 +0000 (00:05 -0400)]
radeonsi: remove non-GFX BO priority flags

For a later simplification.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agowinsys/amdgpu: use alloca when using global_bo_list
Marek Olšák [Thu, 12 Jul 2018 03:24:31 +0000 (23:24 -0400)]
winsys/amdgpu: use alloca when using global_bo_list

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agowinsys/amdgpu: remove label bo_list_error
Marek Olšák [Thu, 12 Jul 2018 03:21:16 +0000 (23:21 -0400)]
winsys/amdgpu: remove label bo_list_error

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agowinsys/amdgpu: always update gfx_bo_list_counter
Marek Olšák [Thu, 12 Jul 2018 03:20:06 +0000 (23:20 -0400)]
winsys/amdgpu: always update gfx_bo_list_counter

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agowinsys/amdgpu: make amdgpu_cs_context::flags & handles local
Marek Olšák [Thu, 12 Jul 2018 03:19:15 +0000 (23:19 -0400)]
winsys/amdgpu: make amdgpu_cs_context::flags & handles local

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agomesa/virgl: Fix off-by-one and copy-paste error in multisample position evaluation
Gert Wollny [Fri, 13 Jul 2018 12:46:31 +0000 (14:46 +0200)]
mesa/virgl: Fix off-by-one and copy-paste error in multisample position evaluation

Converting from a switch statement that would not allow intermediate sample counts
to use an if-else chain went a bit wrong, so that in some cases the range that
should be inclusive was exclusive and the line for 16 samples was copies wrongly.

v2: elaborate commit message.

Fixes: 91f48cdfe5c817158c533a8f67c60e9aabbe4479
       virgl: Add support for glGetMultisample
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> (v1)
5 years agonouveau: fix 3D blitter for unsigned to signed integer conversions
Karol Herbst [Sun, 24 Jun 2018 20:10:28 +0000 (22:10 +0200)]
nouveau: fix 3D blitter for unsigned to signed integer conversions

fixes a couple of packed_pixel CTS tests. No regressions inside a CTS run.

v2: simplify the changes a bit

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonir: fix printing of vec16 type
Karol Herbst [Thu, 12 Jul 2018 04:27:49 +0000 (06:27 +0200)]
nir: fix printing of vec16 type

Fixes: 2f181c8c183cc8b4d0450789bb20c2be48d32db3
       "glsl_types: vec8/vec16 support"

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonir/spirv: implement BuiltInWorkDim
Rob Clark [Thu, 8 Mar 2018 19:18:59 +0000 (14:18 -0500)]
nir/spirv: implement BuiltInWorkDim

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonir/spirv: print id for unsupported builtins
Karol Herbst [Wed, 11 Jul 2018 23:18:23 +0000 (01:18 +0200)]
nir/spirv: print id for unsupported builtins

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Karol Herbst <kherbst@redhat.com>