mesa.git
5 years agost/mesa: don't allocate mipmapped texture for NEAREST_MIPMAP_LINEAR
Marek Olšák [Fri, 2 Aug 2019 23:11:53 +0000 (19:11 -0400)]
st/mesa: don't allocate mipmapped texture for NEAREST_MIPMAP_LINEAR

Reviewed-by: Brian Paul <brianp@vmware.com>
5 years agoglsl: Optimize the SoftFP64 shader when first creating it.
Kenneth Graunke [Thu, 8 Aug 2019 08:44:52 +0000 (01:44 -0700)]
glsl: Optimize the SoftFP64 shader when first creating it.

By optimizing the shader before inlining, we avoid having to redo this
work for each inlined copy of a function.  It should also reduce the
memory consumption a bit.

This cuts the KHR-GL46.arrays_of_arrays_gl.SubroutineFunctionCalls2
runtime by 25% on my Icelake.  That test compiles many shaders, which
contain large types (dmat4) and division (expensive operations).

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
5 years agoetnaviv: fix compile warnings in release build
Christian Gmeiner [Mon, 12 Aug 2019 09:09:47 +0000 (11:09 +0200)]
etnaviv: fix compile warnings in release build

[27/31] Compiling C object 'src/gallium/drivers/etnaviv/df32d18@@etnaviv@sta/etnaviv_compiler_nir.c.o'.
In file included from ../../src/gitlab_mesa/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c:552:
../../src/gitlab_mesa/src/gallium/drivers/etnaviv/etnaviv_compiler_nir_emit.h: In function 'ra_assign':
../../src/gitlab_mesa/src/gallium/drivers/etnaviv/etnaviv_compiler_nir_emit.h:903:9: warning: unused variable 'ok' [-Wunused-variable]
    bool ok = ra_allocate(g);
         ^~
../../src/gitlab_mesa/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c: In function 'etna_compile_shader_nir':
../../src/gitlab_mesa/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c:663:9: warning: unused variable 'ok' [-Wunused-variable]
    bool ok = emit_shader(c->nir, &options, &v->num_temps, &num_consts);
         ^~

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
5 years agoradv: Do not setup attachments without a framebuffer.
Bas Nieuwenhuizen [Sat, 10 Aug 2019 13:04:30 +0000 (15:04 +0200)]
radv: Do not setup attachments without a framebuffer.

Test that found this: dEQP-VK.geometry.layered.1d_array.secondary_cmd_buffer

Fixes: 49e6c2fb78c "radv: Store color/depth surface info in attachment info instead of framebuffer."
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoanv: Implement VK_EXT_subgroup_size_control version 2
Jason Ekstrand [Mon, 12 Aug 2019 12:41:49 +0000 (07:41 -0500)]
anv: Implement VK_EXT_subgroup_size_control version 2

The version bump adds a proper features struct.

Fixes: d10de253097 "anv: Implement VK_EXT_subgroup_size_control"
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agovulkan: Update the XML and headers to 1.1.119
Jason Ekstrand [Mon, 12 Aug 2019 12:37:54 +0000 (07:37 -0500)]
vulkan: Update the XML and headers to 1.1.119

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoradv: Hash Wave32 settings in shader key.
Bas Nieuwenhuizen [Sat, 3 Aug 2019 23:34:19 +0000 (01:34 +0200)]
radv: Hash Wave32 settings in shader key.

Can result in different shaders.

Fixes: 8a86908e9a7 "radv/gfx10: add Wave32 support for vertex, tessellation and geometry shaders"
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: Properly use Wave64 for non-NGG GS and copy shader.
Bas Nieuwenhuizen [Sat, 3 Aug 2019 23:29:53 +0000 (01:29 +0200)]
radv: Properly use Wave64 for non-NGG GS and copy shader.

Fixes: 8a86908e9a7 "radv/gfx10: add Wave32 support for vertex, tessellation and geometry shaders"
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: Put wave size in shader options/info.
Bas Nieuwenhuizen [Sat, 3 Aug 2019 22:48:05 +0000 (00:48 +0200)]
radv: Put wave size in shader options/info.

Instead of having the three values everywhere. This is also more
future proof if we want the driver to make those decisions eventually.

Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agorelnotes: Make entries for radv more consistent.
Bas Nieuwenhuizen [Fri, 2 Aug 2019 21:06:37 +0000 (23:06 +0200)]
relnotes: Make entries for radv more consistent.

Always use 'on' as for the rest of the drivers.

Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agorelnotes: Add new exts on radv for 19.2.
Bas Nieuwenhuizen [Fri, 2 Aug 2019 21:05:43 +0000 (23:05 +0200)]
relnotes: Add new exts on radv for 19.2.

Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoiris: reorder arguments as expected by the function
Tapani Pälli [Mon, 12 Aug 2019 07:44:41 +0000 (10:44 +0300)]
iris: reorder arguments as expected by the function

CID: 1452262
Fixes: b4c54894bba "iris: Handle vertex shader with window space position"
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
5 years agoiris/android: move iris_query.c to 'per gen' LIBIRIS_SRC_FILES
Tapani Pälli [Mon, 12 Aug 2019 05:33:21 +0000 (08:33 +0300)]
iris/android: move iris_query.c to 'per gen' LIBIRIS_SRC_FILES

Fixes Iris build on Android.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
5 years agoiris: Free query on error path
Kenneth Graunke [Sun, 11 Aug 2019 14:46:03 +0000 (07:46 -0700)]
iris: Free query on error path

CID: 1452276

5 years agoiris: Add missing 'break'
Kenneth Graunke [Sun, 11 Aug 2019 14:44:41 +0000 (07:44 -0700)]
iris: Add missing 'break'

We don't want to fall through to unreachable().

CID: 1452277

5 years agospirv: Drop lower_workgroup_access_to_offsets
Caio Marcelo de Oliveira Filho [Thu, 8 Aug 2019 17:00:45 +0000 (10:00 -0700)]
spirv: Drop lower_workgroup_access_to_offsets

Intel drivers are not using this anymore, and turnip still don't have
Compute Shaders, so won't make a difference to stop using this option.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Rob Clark <robdclark@chromium.org>
5 years agoi965/spirv: Lower shared memory later
Caio Marcelo de Oliveira Filho [Thu, 8 Aug 2019 17:55:50 +0000 (10:55 -0700)]
i965/spirv: Lower shared memory later

Instead of asking spirv_to_nir to lower the workgroup (shared memory)
to offsets, keep them as derefs longer, then lower it later on.

Because Workgroup memory doesn't have explicit offsets, we need to set
those using nir_lower_vars_to_explicit_types before calling the I/O
lowering pass.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoi965: Use force_compat_profile driconf option
Danylo Piliaiev [Wed, 17 Apr 2019 11:27:16 +0000 (14:27 +0300)]
i965: Use force_compat_profile driconf option

Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoi965: fix mem leak in error path
Eric Engestrom [Fri, 9 Aug 2019 22:41:53 +0000 (23:41 +0100)]
i965: fix mem leak in error path

Fixes: 8ae6667992ccca41d088 ("intel/perf: move query_object into perf")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Mark Janes <mark.a.janes@intel.com>
5 years agogitlab-ci: simplify $CROSS option
Eric Engestrom [Fri, 9 Aug 2019 22:46:50 +0000 (23:46 +0100)]
gitlab-ci: simplify $CROSS option

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
5 years agoiris: minor restyling
Kenneth Graunke [Sat, 10 Aug 2019 06:27:29 +0000 (23:27 -0700)]
iris: minor restyling

5 years agoiris/query: enable amd performance monitors
Mark Janes [Wed, 3 Jul 2019 23:27:22 +0000 (16:27 -0700)]
iris/query: enable amd performance monitors

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoiris/perf: get monitor results
Mark Janes [Wed, 3 Jul 2019 23:13:26 +0000 (16:13 -0700)]
iris/perf: get monitor results

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoiris/perf: add begin/end hooks
Mark Janes [Wed, 3 Jul 2019 22:36:42 +0000 (15:36 -0700)]
iris/perf: add begin/end hooks

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoiris/perf: add delete query
Mark Janes [Wed, 3 Jul 2019 19:50:01 +0000 (12:50 -0700)]
iris/perf: add delete query

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoiris/perf: implement iris_create_monitor_object
Mark Janes [Wed, 3 Jul 2019 19:38:16 +0000 (12:38 -0700)]
iris/perf: implement iris_create_monitor_object

This is the first call that provides the iris context to the monitor
implementation.  On the first call, use the iris context to initialize
the monitor context.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoiris/perf: implement routines to return counter info
Mark Janes [Mon, 22 Apr 2019 18:43:12 +0000 (11:43 -0700)]
iris/perf: implement routines to return counter info

With this commit, Iris will report that AMD_performance_monitor is
supported, and will allow the caller to query the available metrics.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoanv: add missing `break`
Eric Engestrom [Fri, 9 Aug 2019 22:34:29 +0000 (23:34 +0100)]
anv: add missing `break`

Fixes: f6e7de41d7b15185b746 ("anv: Implement VK_EXT_line_rasterization")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoutil: drop final reference to p_compiler.h
Lionel Landwerlin [Fri, 9 Aug 2019 13:14:38 +0000 (16:14 +0300)]
util: drop final reference to p_compiler.h

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoutil: os_misc: drop p_compiler.h include
Lionel Landwerlin [Fri, 9 Aug 2019 13:05:56 +0000 (16:05 +0300)]
util: os_misc: drop p_compiler.h include

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoutil: u_math: drop p_compiler.h include
Lionel Landwerlin [Fri, 9 Aug 2019 13:02:42 +0000 (16:02 +0300)]
util: u_math: drop p_compiler.h include

This file was moved from gallium so drop depending on gallium headers.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agovc4: prepare for p_compiler.h dependency removal
Lionel Landwerlin [Fri, 9 Aug 2019 13:52:30 +0000 (16:52 +0300)]
vc4: prepare for p_compiler.h dependency removal

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoamd: prepare dropping include of p_compiler.h
Lionel Landwerlin [Fri, 9 Aug 2019 13:01:04 +0000 (16:01 +0300)]
amd: prepare dropping include of p_compiler.h

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agomesa: be consistent on GL_TRUE/GL_FALSE & TRUE/FALSE
Lionel Landwerlin [Fri, 9 Aug 2019 13:00:30 +0000 (16:00 +0300)]
mesa: be consistent on GL_TRUE/GL_FALSE & TRUE/FALSE

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agomesa: drop some p_compiler.h types
Lionel Landwerlin [Fri, 9 Aug 2019 12:59:42 +0000 (15:59 +0300)]
mesa: drop some p_compiler.h types

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agomesa: add stddef include in preparation for dropping p_compiler.h
Lionel Landwerlin [Fri, 9 Aug 2019 12:59:10 +0000 (15:59 +0300)]
mesa: add stddef include in preparation for dropping p_compiler.h

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agopanfrost: prepare for p_compiler.h dependency removal
Lionel Landwerlin [Fri, 9 Aug 2019 13:39:58 +0000 (16:39 +0300)]
panfrost: prepare for p_compiler.h dependency removal

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoi965: don't use p_compiler.h types
Lionel Landwerlin [Fri, 9 Aug 2019 13:01:22 +0000 (16:01 +0300)]
i965: don't use p_compiler.h types

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agogitlab-ci: generate meson cross-files earlier
Eric Engestrom [Tue, 6 Aug 2019 10:28:31 +0000 (11:28 +0100)]
gitlab-ci: generate meson cross-files earlier

Suggested-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agopanfrost: Assign varying buffers dynamically
Alyssa Rosenzweig [Wed, 7 Aug 2019 16:49:07 +0000 (09:49 -0700)]
panfrost: Assign varying buffers dynamically

Rather than hardcoding certain varying buffer indices "by convention",
work it out at draw time. This added flexibility is needed for
futureproofing and will be enable streamout.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Assign indices at draw-time
Alyssa Rosenzweig [Wed, 7 Aug 2019 16:38:53 +0000 (09:38 -0700)]
panfrost: Assign indices at draw-time

This will allow us to shuffle buffers.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Break out pan_varyings.c
Alyssa Rosenzweig [Wed, 7 Aug 2019 16:16:32 +0000 (09:16 -0700)]
panfrost: Break out pan_varyings.c

This code is fairly self-contained, so let's factor it out of the giant
pan_context.c monster.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Enable PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS
Alyssa Rosenzweig [Thu, 8 Aug 2019 16:21:27 +0000 (09:21 -0700)]
panfrost: Enable PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS

Just as easy/hard as the rest of XFB.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Import streamout data structures
Alyssa Rosenzweig [Tue, 6 Aug 2019 23:43:28 +0000 (16:43 -0700)]
panfrost: Import streamout data structures

Pretty much copypasted from v3d to jumpstart us.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopan/midgard: Account for swizzle/mask in st_vary
Alyssa Rosenzweig [Thu, 8 Aug 2019 16:16:05 +0000 (09:16 -0700)]
pan/midgard: Account for swizzle/mask in st_vary

Register allocation for varying stores is a bit different, since the
instructions ignore the writemask (varyings are normalized
packed/vectorized..)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopan/decode: Resolve crash with NULL attr/varyings
Alyssa Rosenzweig [Thu, 8 Aug 2019 16:23:29 +0000 (09:23 -0700)]
pan/decode: Resolve crash with NULL attr/varyings

This case needs more investigation, but this was found with geometry
shaders.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agogallium/swr: Fix glClear when it's used with glEnable/glDisable GL_SCISSOR_TEST
Krzysztof Raszkowski [Fri, 9 Aug 2019 15:04:57 +0000 (17:04 +0200)]
gallium/swr: Fix glClear when it's used with glEnable/glDisable GL_SCISSOR_TEST

When GL_SCISSOR_TEST is enabled glClear is handled by state tracker
and there is no need to do this in gallium driver.

Reviewed-by: Alok Hota alok.hota@intel.com
5 years agoutil: Revert "util: added missing headers in anon-file"
Gurchetan Singh [Fri, 9 Aug 2019 01:39:17 +0000 (18:39 -0700)]
util: Revert "util: added missing headers in anon-file"

This reverts commit c73988300f943e185a50aaba015f2f114ffcb262.

Reason: Made a fix for this, then saw @eric's change
        ("util/anon_file: add missing"), but some sequence of events
        I don't really remember caused this to get merged. So revert ;-)

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoetnaviv: Remove etna_bo_from_handle() prototype
Marek Vasut [Sat, 8 Jun 2019 22:16:41 +0000 (00:16 +0200)]
etnaviv: Remove etna_bo_from_handle() prototype

Remove etna_bo_from_handle() as there are no known users.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
5 years agoanv: drop unused code
Lionel Landwerlin [Fri, 9 Aug 2019 13:49:17 +0000 (16:49 +0300)]
anv: drop unused code

We stopped using this when we moved to Jason's mi_builder.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoetnaviv: fix typo
Christian Gmeiner [Fri, 9 Aug 2019 11:25:23 +0000 (13:25 +0200)]
etnaviv: fix typo

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
5 years agoetnaviv: add gpu_supports_texture_target(..)
Christian Gmeiner [Fri, 9 Aug 2019 09:26:14 +0000 (11:26 +0200)]
etnaviv: add gpu_supports_texture_target(..)

Currently I am seeing a handful of the following debug message:
translate_texture_target:495: Unhandled texture target: 0

PIPE_BUFFER is not handled in translate_texture_target(..) which makes
sense as it is used to translate from PIPE_XXX to GPU specific value
during etna_create_sampler_view_state(..).

To fix this problem introduce gpu_supports_texture_target(..) which just
checks if the texture target is supported.

Fixes: dfe048058fa ("etnaviv: support 3D and 2D array textures")
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
5 years agoutil: Cygwin has linux-style pthread_setname_np
Jon Turney [Wed, 7 Aug 2019 00:48:36 +0000 (01:48 +0100)]
util: Cygwin has linux-style pthread_setname_np

Fixes: dcf9d91a ("util: Handle differences in pthread_setname_np")
5 years agoanv/android: disable shared representable image support explicitly
Tapani Pälli [Thu, 8 Aug 2019 11:57:14 +0000 (14:57 +0300)]
anv/android: disable shared representable image support explicitly

Android 9 loader conditionally advertises VK_KHR_shared_presentable_image
extension based on this property and it looks like it does not
initialize the struct before query.

Pragmas are added to ignore warnings with Android specific structure
types in same manner as commit 8d386e6eef8  did.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agolima: introduce a struct describing texture descriptor
Vasily Khoruzhick [Wed, 7 Aug 2019 02:58:42 +0000 (19:58 -0700)]
lima: introduce a struct describing texture descriptor

Use a struct with bitfields to construct texture descriptor
instead of poking bits in array of uint32_t. It improves code
readability and makes it easier to experiment with unknown fields.

Also fix mipmapping while we're at it - Utgard can have up to 13
levels, but 64 bytes is enough only for 10. Calculate descriptor
size dynamically to account extra levels if we need them.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
5 years agolima: add texel format table
Vasily Khoruzhick [Wed, 7 Aug 2019 02:54:04 +0000 (19:54 -0700)]
lima: add texel format table

Introduce a table for supported texel formats and use it to check
whether format is supported and for converting pipe format to lima
texel format.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
5 years agoutil: added missing headers in anon-file
Gurchetan Singh [Thu, 8 Aug 2019 16:42:07 +0000 (09:42 -0700)]
util: added missing headers in anon-file

Otherwise I get:

../src/util/anon_file.c: In function ‘create_tmpfile_cloexec’:
../src/util/anon_file.c:75:9: error: implicit declaration of function ‘mkostemp’
[-Werror=implicit-function-declaration]
    fd = mkostemp(tmpname, O_CLOEXEC);
         ^~~~~~~~

../src/util/anon_file.c:133:7: error: implicit declaration of function ‘asprintf’
[-Werror=implicit-function-declaration]
       asprintf(&name, "%s/mesa-shared-%s-XXXXXX", path, debug_name);
       ^~~~~~~~
../src/util/anon_file.c:141:4: error: implicit declaration of function ‘free’
[-Werror=implicit-function-declaration]
    free(name)

Fixes: c0376a ("util: add anon_file.h for all memfd/temp file usage")
5 years agovirgl: check scanout mask
Gurchetan Singh [Wed, 7 Aug 2019 02:15:58 +0000 (19:15 -0700)]
virgl: check scanout mask

Otherwise, virgl will report renderable or texturable formats as
also scan-out formats.

v2: drop host feature check (@kusma)

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agovirgl: fixup_readback_format --> fixup_formats
Gurchetan Singh [Wed, 7 Aug 2019 23:22:16 +0000 (16:22 -0700)]
virgl: fixup_readback_format --> fixup_formats

This function is generalizable.

Suggested-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agovirgl: access caps in a less verbose way in virgl_is_format_supported
Gurchetan Singh [Wed, 7 Aug 2019 02:04:25 +0000 (19:04 -0700)]
virgl: access caps in a less verbose way in virgl_is_format_supported

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agopan/midgard: Disassemble load/store barrel shift
Alyssa Rosenzweig [Mon, 5 Aug 2019 20:16:08 +0000 (13:16 -0700)]
pan/midgard: Disassemble load/store barrel shift

Arm assembly intensifies.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agoutil/anon_file: const string param
Eric Engestrom [Thu, 8 Aug 2019 09:45:08 +0000 (10:45 +0100)]
util/anon_file: const string param

Fixes: c0376a123418df0050dc ("util: add anon_file.h for all memfd/temp file usage")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Tested-by: Eric Anholt <eric@anholt.net>
Tested-by: Andreas Baierl <ichgeh@imkreisrum.de>
5 years agoutil/anon_file: drop unused #include
Eric Engestrom [Thu, 8 Aug 2019 09:44:18 +0000 (10:44 +0100)]
util/anon_file: drop unused #include

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Tested-by: Eric Anholt <eric@anholt.net>
Tested-by: Andreas Baierl <ichgeh@imkreisrum.de>
5 years agoutil/anon_file: add missing #include
Eric Engestrom [Thu, 8 Aug 2019 09:44:54 +0000 (10:44 +0100)]
util/anon_file: add missing #include

Fixes: c0376a123418df0050dc ("util: add anon_file.h for all memfd/temp file usage")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Tested-by: Eric Anholt <eric@anholt.net>
Tested-by: Andreas Baierl <ichgeh@imkreisrum.de>
5 years agointel/perf: use MAJOR_IN_SYSMACROS/MAJOR_IN_MKDEV
Greg V [Sun, 19 May 2019 20:24:45 +0000 (23:24 +0300)]
intel/perf: use MAJOR_IN_SYSMACROS/MAJOR_IN_MKDEV

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Fixes: 134e750e16bfc53480e0 ("i965: extract performance query metrics")
5 years agoutil: fix cpuset support on FreeBSD
Greg V [Sun, 16 Sep 2018 16:51:51 +0000 (19:51 +0300)]
util: fix cpuset support on FreeBSD

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoi965/tiled_memcpy: avoid creating bswap32 if it exists as a macro (e.g. on FreeBSD)
Greg V [Sat, 26 May 2018 21:36:30 +0000 (00:36 +0300)]
i965/tiled_memcpy: avoid creating bswap32 if it exists as a macro (e.g. on FreeBSD)

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoanv: add MAP_POPULATE fallback define for portability
Greg V [Thu, 18 Jan 2018 20:31:03 +0000 (23:31 +0300)]
anv: add MAP_POPULATE fallback define for portability

FreeBSD does not have MAP_POPULATE

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoanv: remove unused Linux-specific include
Greg V [Sun, 24 Dec 2017 16:46:30 +0000 (19:46 +0300)]
anv: remove unused Linux-specific include

Fixes: 4201cc2dd3a ("anv: Implement VK_KHX_external_semaphore_fd")
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agomeson: define ETIME to ETIMEDOUT if not present
Greg V [Thu, 18 Jan 2018 21:48:30 +0000 (00:48 +0300)]
meson: define ETIME to ETIMEDOUT if not present

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agolima: Fix Android.mk
Roman Stratiienko [Tue, 6 Aug 2019 07:23:45 +0000 (10:23 +0300)]
lima: Fix Android.mk

1. Update LOCAL_SRC_FILES according to commit
54434fe67068 ("lima/gpir: Rework the scheduler").

2. Add libpanfrost_shared.a dependency.

3. Generate lima_nir_algebraic.c with Android.mk
Fixes Android build error introduced by commit 5adfc8602c63
("lima/ppir: move sin/cos input scaling into NIR")

Signed-off-by: Roman Stratiienko <roman.stratiienko@globallogic.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Acked-by: Qiang Yu <yuq825@gmail.com>
5 years agoAdd libpanfrost_shared to Android build
Roman Stratiienko [Tue, 6 Aug 2019 07:14:50 +0000 (10:14 +0300)]
Add libpanfrost_shared to Android build

1. Add missing directory to ./Android.mk
2. Fix ./src/panfrost/Android.shared.mk

Signed-off-by: Roman Stratiienko <roman.stratiienko@globallogic.com>
Reviewed-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Acked-by: Qiang Yu <yuq825@gmail.com>
5 years agoanv,i965,iris: deduplicate setting of total_shared
Rhys Perry [Tue, 2 Jul 2019 14:32:15 +0000 (15:32 +0100)]
anv,i965,iris: deduplicate setting of total_shared

v5: add patch

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv: use derefs for shared memory access
Rhys Perry [Wed, 5 Jun 2019 13:14:23 +0000 (14:14 +0100)]
anv: use derefs for shared memory access

vkpipeline-db for my Skylake GPU:
total instructions in shared programs: 8847602 -> 8847896 (<.01%)
instructions in affected programs: 10165 -> 10459 (2.89%)
helped: 8
HURT: 2

total cycles in shared programs: 1606273555 -> 1606251634 (<.01%)
cycles in affected programs: 2201803 -> 2179882 (-1.00%)
helped: 7
HURT: 3

The shaders with more instructions is due to a loop over a shared array
in Three Kingdoms being unrolled (and creating a lot of nested ifs). Not sure
if that's good or bad.

One of the shaders with worse cycles is only worse by 0.04% and the other
two are the shaders with loops unrolled.

v2: add patch
v4: don't set spirv_options.shared_addr_format
v4: move comment concerning the shared address format used and NULL
v4: add vkpipeline-db results
v5: rename to nir_lower_vars_to_explicit_types
v5: move setting of total_shared to outside brw_compile_cs
v6: set shared_addr_format
v6: formatting changes

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> (v5)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir: add nir_lower_to_explicit()
Rhys Perry [Tue, 9 Apr 2019 19:18:11 +0000 (20:18 +0100)]
nir: add nir_lower_to_explicit()

v2: use glsl_type_size_align_func
v2: move get_explicit_type() to glsl_types.cpp/nir_types.cpp
v2: use align() instead of util_align_npot()
v2: pack arrays a bit tighter
v2: rename mem_* to field_*
v2: don't attempt to handle when struct offsets are already set
v2: use column_type() instead of recreating it
v2: use a branch instead of |= in nir_lower_to_explicit_impl()
v2: assign locations to variables and update shared_size and num_shared
v2: allow the pass to be used with nir_var_{shader_temp,function_temp}
v4: rebase
v5: add TODO
v5: small formatting changes
v5: remove incorrect assert in get_explicit_type()
v5: rename to nir_lower_vars_to_explicit_types
v5: correctly update progress when only variables are updated
v5: rename get_explicit_type() to get_explicit_shared_type()
v5: add comment explaining how get_explicit_shared_type() is different
v5: update cast strides
v6: update progress when lowering nir_var_function_temp variables
v6: formatting changes
v6: add more detailed documentation comment for get_explicit_shared_type
v6: rename get_explicit_shared_type to get_explicit_type_for_size_align
v7: fix comment in nir_lower_vars_to_explicit_types_impl()

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> (v5)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir/lower_explicit_io: add nir_var_mem_shared support
Rhys Perry [Tue, 9 Apr 2019 16:28:13 +0000 (17:28 +0100)]
nir/lower_explicit_io: add nir_var_mem_shared support

v2: require nir_address_format_32bit_offset instead
v3: don't call nir_intrinsic_set_access() for shared atomics

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agomesa: avoid warning on Windows
Erik Faye-Lund [Mon, 5 Aug 2019 15:29:22 +0000 (17:29 +0200)]
mesa: avoid warning on Windows

On Windows, p_atomic_inc_return returns an unsigned long long rather
than the type the pointer refers to, so let's make sure we cast the
result to the right type. Otherwise, we'll trigger a warning about
the wrong format-string for the type.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Acked-by: Eric Engestrom <eric@engestrom.ch>
5 years agomesa/main: cast away constness
Erik Faye-Lund [Mon, 5 Aug 2019 15:29:05 +0000 (17:29 +0200)]
mesa/main: cast away constness

This avoids a warning about implicitly casting away the constness of the
pointer.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Acked-by: Eric Engestrom <eric@engestrom.ch>
5 years agospirv: fixup signature
Erik Faye-Lund [Mon, 5 Aug 2019 15:23:51 +0000 (17:23 +0200)]
spirv: fixup signature

This avoids a warning on some compiler, complaining about implicitly
casting the function-pointer.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Fixes: d482a8f "spirv: Update the OpenCL.std.h header"
Acked-by: Eric Engestrom <eric@engestrom.ch>
5 years agoetnaviv: remember data offset into BO
Lucas Stach [Wed, 23 May 2018 15:19:52 +0000 (17:19 +0200)]
etnaviv: remember data offset into BO

Imported resources might not start at offset 0 into the buffer object.
Make sure to remember the offset that is provided with the handle on
import.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
5 years agoi965: Emit a dummy MEDIA_VFE_STATE before switching from GPGPU to 3D
Danylo Piliaiev [Thu, 1 Aug 2019 10:57:14 +0000 (13:57 +0300)]
i965: Emit a dummy MEDIA_VFE_STATE before switching from GPGPU to 3D

There is an object-level  preemption workaround which requires this.
However, even without object-level preemption, we seem to have issues
with geometry flickering when 3D and compute are combined in the same
batch and this appears to fix it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110395
Suggested-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
5 years agoradv: Avoid VEGA/RAVEN scissor bug in binning.
Bas Nieuwenhuizen [Thu, 8 Aug 2019 00:28:12 +0000 (02:28 +0200)]
radv: Avoid VEGA/RAVEN scissor bug in binning.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: Avoid binning RAVEN hangs.
Bas Nieuwenhuizen [Thu, 8 Aug 2019 00:24:58 +0000 (02:24 +0200)]
radv: Avoid binning RAVEN hangs.

Mirroring radeonsi.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: Fix off by one for S_028C48_MAX_ALLOC_COUNT.
Bas Nieuwenhuizen [Thu, 8 Aug 2019 00:05:45 +0000 (02:05 +0200)]
radv: Fix off by one for S_028C48_MAX_ALLOC_COUNT.

Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoswr/rasterizer: modernize thread TLB
Jan Zielinski [Thu, 1 Aug 2019 13:14:03 +0000 (15:14 +0200)]
swr/rasterizer: modernize thread TLB

Reviewed-by: Alok Hota <alok.hota@intel.com>
5 years agoswr/rasterizer: Refactor events collection mechanism
Jan Zielinski [Thu, 1 Aug 2019 12:30:58 +0000 (14:30 +0200)]
swr/rasterizer: Refactor events collection mechanism

Several improvements and cleanups in events and statstics mechanisms

Reviewed-by: Alok Hota <alok.hota@intel.com>
5 years agoswr/rasterizer: improvements in simdlib
Jan Zielinski [Wed, 31 Jul 2019 14:01:01 +0000 (16:01 +0200)]
swr/rasterizer: improvements in simdlib

1. fix build issues with MSVC 2019 compiler

The MSVC 2019 compiler seems to have an issue with optimized code-gen
when using the _mm256_and_si256() intrinsic.
Only disable use of integer vpand on buggy versions MSVC 2019.
Otherwise allow use of integer vpand intrinsic.

2. Remove unused vec/matrix functionality

Reviewed-by: Alok Hota <alok.hota@intel.com>
5 years agoswr/rasterizer: Events are now grouped and enabled by knobs
Jan Zielinski [Wed, 31 Jul 2019 13:43:47 +0000 (15:43 +0200)]
swr/rasterizer: Events are now grouped and enabled by knobs

All events are now grouped as follows:

-Framework (i.e. ThreadStart) [always ON]
-Api (i.e. SwrSync) [always ON]
-Pipeline [default ON]
-Shader [default ON]
-SWTag [default OFF]
-Memory [default OFF]

Reviewed-by: Alok Hota <alok.hota@intel.com>
5 years agoswr/rasterizer: do not mark tiles dirty until actually rendered
Jan Zielinski [Tue, 30 Jul 2019 13:33:53 +0000 (15:33 +0200)]
swr/rasterizer: do not mark tiles dirty until actually rendered

Reviewed-by: Alok Hota <alok.hota@intel.com>
5 years agoswr/rasterizer: enable size accumulation in mem stats
Jan Zielinski [Fri, 26 Jul 2019 14:43:58 +0000 (16:43 +0200)]
swr/rasterizer: enable size accumulation in mem stats

Small refactoring is also performed

Reviewed-by: Alok Hota <alok.hota@intel.com>
5 years agoswr/rasterizer: enable using AOS vertex data format
Jan Zielinski [Fri, 26 Jul 2019 14:43:50 +0000 (16:43 +0200)]
swr/rasterizer: enable using AOS vertex data format

Reviewed-by: Alok Hota <alok.hota@intel.com>
5 years agov3d: handle wait requirement when retrieving query results correctly
Iago Toral Quiroga [Thu, 1 Aug 2019 12:43:35 +0000 (14:43 +0200)]
v3d: handle wait requirement when retrieving query results correctly

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agov3d: use the GPU to record primitives written to transform feedback
Iago Toral Quiroga [Thu, 1 Aug 2019 10:30:34 +0000 (12:30 +0200)]
v3d: use the GPU to record primitives written to transform feedback

We can use the PRIMITIVE_COUNTS_FEEDBACK packet to write various primitive
counts to a buffer, including the number of primives written to transform
feedback buffers, which will handle buffer overflow correctly.

There are a couple of caveats with this:

Primitive counters are reset when we emit a 'Tile Binning Mode Configuration'
packet, which can happen in the middle of a primitives query, so we need to
read the buffer when we submit a job and accumulate the counts in the context
so we don't lose them.

We also need to do the same when we switch primitive type during transform
feedback so we can compute the correct number of recorded vertices from
the number of primitives. This is necessary so we can provide an accurate
vertex count for draw from transform feedback.

v2:
 - When computing the number of vertices for a primitive, pass in the base
   primitive, since that is what the hardware will count.
 - No need to update primitive counts when switching primitive types if
   the base primitives are the same.
 - Log perf warning when mapping the primitive counts BO for readback (Eric).
 - Only emit the primitive counts packet once at job end (Eric).
 - Use u_upload mechanism for the primitive counts buffer (Eric).
 - Use the XML to generate indices into the primitive counters buffer (Eric).

Fixes piglit tests:
spec/ext_transform_feedback/overflow-edge-cases
spec/ext_transform_feedback/query-primitives_written-bufferrange
spec/ext_transform_feedback/query-primitives_written-bufferrange-discard
spec/ext_transform_feedback/change-size base-shrink
spec/ext_transform_feedback/change-size base-grow
spec/ext_transform_feedback/change-size offset-shrink
spec/ext_transform_feedback/change-size offset-grow
spec/ext_transform_feedback/change-size range-shrink
spec/ext_transform_feedback/change-size range-grow
spec/ext_transform_feedback/intervening-read prims-written

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agogallium/util: add a helper to compute vertex count from primitive count
Iago Toral Quiroga [Thu, 1 Aug 2019 09:56:29 +0000 (11:56 +0200)]
gallium/util: add a helper to compute vertex count from primitive count

v2:
  - Only compute vertex counts for base primitives.
  - Add a unit test (Eric)

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agov3d: be more explicit about the query types supported
Iago Toral Quiroga [Thu, 1 Aug 2019 06:48:56 +0000 (08:48 +0200)]
v3d: be more explicit about the query types supported

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agov3d: generate packet unpack functions
Iago Toral Quiroga [Fri, 26 Jul 2019 06:57:52 +0000 (08:57 +0200)]
v3d: generate packet unpack functions

These were not being compiled because of the lack of __gen_unpack_address.

v2:
 - Shift raw address correctly (Eric).

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agov3d: add header guards in v3d_packet_helpers.h
Iago Toral Quiroga [Fri, 26 Jul 2019 06:55:44 +0000 (08:55 +0200)]
v3d: add header guards in v3d_packet_helpers.h

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agopanfrost: Print errors from kernel
Tomeu Vizoso [Mon, 5 Aug 2019 12:54:23 +0000 (14:54 +0200)]
panfrost: Print errors from kernel

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Mark buffers as PANFROST_BO_HEAP
Tomeu Vizoso [Wed, 31 Jul 2019 14:29:25 +0000 (16:29 +0200)]
panfrost: Mark buffers as PANFROST_BO_HEAP

What we call GROWABLE in Mesa corresponds to the HEAP BO flag in the
kernel. These buffers cannot be memory mapped in the CPU side at the
moment, so make sure they are also marked INVISIBLE.

This allows us to allocate a big heap upfront (16MB) without actually
reserving space unless it's needed.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Mark BOs as NOEXEC
Tomeu Vizoso [Wed, 31 Jul 2019 13:00:46 +0000 (15:00 +0200)]
panfrost: Mark BOs as NOEXEC

Unless a BO has the EXECUTABLE flag, mark it as NOEXEC.

v2: - Rework version detection (Alyssa).

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>