mesa.git
2 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>
2 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>
2 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>
2 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")
2 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>
2 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>
2 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>
2 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")
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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")
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 years agopanfrost: Take into account flags when looking up in the BO cache
Tomeu Vizoso [Thu, 8 Aug 2019 05:10:32 +0000 (07:10 +0200)]
panfrost: Take into account flags when looking up in the BO cache

This will be useful right now so we avoid retrieving a non-executable
buffer when a executable one is needed.

As we support more flags, this logic will need to be extended to
consider the different trade-offs to be made when matching BO
specifications to BOs in the cache.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
2 years agopanfrost: Allocate shaders in their own BOs
Tomeu Vizoso [Thu, 1 Aug 2019 14:45:50 +0000 (16:45 +0200)]
panfrost: Allocate shaders in their own BOs

Instead of all shaders being stored in a single BO, have each shader in
its own.

This removes the need for a 16MB allocation per context, and allows us
to place transient blend shaders in BOs marked as executable (before
they were allocated in the transient pool, which shouldn't be
executable).

v2: - Store compiled blend shaders in a malloc'ed buffer, to avoid
      reading from GPU-accessible memory when patching (Alyssa).
    - Free struct panfrost_blend_shader (Alyssa).
    - Give the job a reference to regular shaders when emitting
      (Alyssa).

v3: - Split out the allocation flags change (Rob).

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
2 years agoutil/hash_table: Fix hashing in clears on 32-bit
Tomeu Vizoso [Mon, 5 Aug 2019 09:22:49 +0000 (11:22 +0200)]
util/hash_table: Fix hashing in clears on 32-bit

Some hash functions (eg. key_u64_hash) will attempt to dereference the
key, causing an invalid access when passed DELETED_KEY_VALUE (0x1) or
FREED_KEY_VALUE (0x0).

When in 32-bit arch a 64-bit key value doesn't fit into a pointer, so
hash_table_u64 internally use a pointer to a struct containing the
64-bit key value.

Fix _mesa_hash_table_u64_clear() to handle the 32-bit case by creating a
temporary hash_key_u64 to pass to the hash function.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Suggested-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Cc: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: Nicolai Hähnle <nicolai.haehnle@amd.com>
2 years agoanv: support GetSwapchainGrallocUsage2ANDROID for Android
Tapani Pälli [Thu, 1 Aug 2019 10:49:34 +0000 (13:49 +0300)]
anv: support GetSwapchainGrallocUsage2ANDROID for Android

New function supports gralloc1 usage flags that get set separately
for producer and consumer. As we still need to support old method too,
let's share common code and use android_convertGralloc0To1Usage helper.
Bump the VK_ANDROID_native_buffer version to indicate support for the
new call.

Changes were tested on Android Celadon P with Basemark GPU and various
Sascha Willems Vulkan demos.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2 years agost/mesa: eliminate unnecessary redirection
Mark Janes [Wed, 1 May 2019 17:54:43 +0000 (10:54 -0700)]
st/mesa: eliminate unnecessary redirection

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: fix debug typo
Mark Janes [Fri, 19 Jul 2019 09:22:26 +0000 (02:22 -0700)]
intel/perf: fix debug typo

Misspelling was seen with INTEL_DEBUG=perfmon.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: make gen_perf_query_object private
Mark Janes [Wed, 17 Jul 2019 19:29:00 +0000 (12:29 -0700)]
intel/perf: make gen_perf_query_object private

Encapsulate the details of this structure within the perf implemenation.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: make perf context private
Mark Janes [Wed, 10 Jul 2019 23:57:16 +0000 (16:57 -0700)]
intel/perf: make perf context private

Encapsulate the details of this data structure.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: print debug information
Mark Janes [Wed, 17 Jul 2019 21:36:44 +0000 (14:36 -0700)]
intel/perf: print debug information

INTEL_DEBUG=perfmon will iterate over the perf queries, printing
information about the state of each query.  Some of this information
will be private to intel/perf, and needs to a dump routine that can be
called from i965.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: make internal methods private
Mark Janes [Wed, 10 Jul 2019 23:19:31 +0000 (16:19 -0700)]
intel/perf: make internal methods private

Now that all references from i965 have been moved to perf, we can make
internal methods private again.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: make oa_sample_buffers private
Mark Janes [Wed, 10 Jul 2019 21:25:47 +0000 (14:25 -0700)]
intel/perf: make oa_sample_buffers private

All references to this data structure have been moved inside the perf
subsystem.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: expose method to create query
Mark Janes [Fri, 12 Jul 2019 23:35:27 +0000 (16:35 -0700)]
intel/perf: expose method to create query

By encapsulating this implementation within perf, we can eventually
make struct gen_perf_ctx private.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move initialization of pipeline statistics metrics to gen_perf
Mark Janes [Sat, 3 Aug 2019 00:17:54 +0000 (17:17 -0700)]
intel/perf: move initialization of pipeline statistics metrics to gen_perf

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move get_query_data into gen_perf
Mark Janes [Sat, 29 Jun 2019 01:16:07 +0000 (18:16 -0700)]
intel/perf: move get_query_data into gen_perf

This refactor moves several helper functions for get_query_data as
well:

 - accumulate_oa_reports
 - read_gt_frequency
 - get_pipeline_stats_data
 - get_oa_counter_data

Functions which are no longer referenced in brw_performance_query.c
have been removed.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move delete_query to gen_perf
Mark Janes [Sat, 29 Jun 2019 00:10:22 +0000 (17:10 -0700)]
intel/perf: move delete_query to gen_perf

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move is_query_ready to gen_perf
Mark Janes [Fri, 28 Jun 2019 23:19:32 +0000 (16:19 -0700)]
intel/perf: move is_query_ready to gen_perf

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move wait_query to perf
Mark Janes [Fri, 28 Jun 2019 23:12:44 +0000 (16:12 -0700)]
intel/perf: move wait_query to perf

The following methods have duplicate implementation of read_oa_samples_until in
brw_performance_query.c:

 - read_oa_samples_for_query
 - read_oa_samples_until

They ar still referenced by other methods in the file and will be
removed on the subsequent commit.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: create a vtable entry for bo_busy
Mark Janes [Fri, 28 Jun 2019 22:55:37 +0000 (15:55 -0700)]
intel/perf: create a vtable entry for bo_busy

Iris and i965 variants of this method need to be called by perf
routines.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: create a vtable entry for bo_wait_rendering
Mark Janes [Fri, 28 Jun 2019 22:46:50 +0000 (15:46 -0700)]
intel/perf: create a vtable entry for bo_wait_rendering

Iris and i965 variants of this method need to be called by perf
routines.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: create a vtable entry for batch_references
Mark Janes [Fri, 28 Jun 2019 22:43:03 +0000 (15:43 -0700)]
intel/perf: create a vtable entry for batch_references

Iris and i965 variants of this method need to be called by perf
routines.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: refactor gen_perf_end_query into gen_perf
Mark Janes [Fri, 28 Jun 2019 22:11:20 +0000 (15:11 -0700)]
intel/perf: refactor gen_perf_end_query into gen_perf

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: refactor gen_perf_begin_query into gen_perf
Mark Janes [Fri, 28 Jun 2019 21:46:12 +0000 (14:46 -0700)]
intel/perf: refactor gen_perf_begin_query into gen_perf

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move perf-related state into gen_perf_context
Mark Janes [Tue, 6 Aug 2019 17:00:16 +0000 (10:00 -0700)]
intel/perf: move perf-related state into gen_perf_context

To move more operations into intel/perf, several state items are
needed.  Save references to that state in the perf_ctxt, rather than
passing them in for every operation.

This commit includes an initializer for gen_perf_context, to set those
references and also encapsulate the initialization of the sample
buffer state.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: create a vtable entries for buffer object map/unmap
Mark Janes [Wed, 26 Jun 2019 19:26:21 +0000 (12:26 -0700)]
intel/perf: create a vtable entries for buffer object map/unmap

These operations are needed to refactor subsequent methods into perf

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move client reference counts into perf
Mark Janes [Wed, 26 Jun 2019 19:12:20 +0000 (12:12 -0700)]
intel/perf: move client reference counts into perf

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move open_perf into perf
Mark Janes [Wed, 26 Jun 2019 18:56:07 +0000 (11:56 -0700)]
intel/perf: move open_perf into perf

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move close_perf into perf
Mark Janes [Wed, 26 Jun 2019 18:43:20 +0000 (11:43 -0700)]
intel/perf: move close_perf into perf

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: create a vtable entry for emit_mi_flush
Mark Janes [Wed, 26 Jun 2019 18:38:38 +0000 (11:38 -0700)]
intel/perf: create a vtable entry for emit_mi_flush

This method is needed to move subsequent methods into perf.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: use temporary pointers to simplify access to perf state
Mark Janes [Wed, 26 Jun 2019 18:01:48 +0000 (11:01 -0700)]
intel/perf: use temporary pointers to simplify access to perf state

Most accesses to perf state were made through repeated dereferences of
brw_context members.  Prefering temporary variables of perf_ctx and
perf_cfg has the following advantages:

 - more concise implementation
 - easier refactor when moving subsequent methods to perf

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move snapshot_statistics_registers into perf
Mark Janes [Tue, 11 Jun 2019 23:04:02 +0000 (16:04 -0700)]
intel/perf: move snapshot_statistics_registers into perf

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move query_object into perf
Mark Janes [Fri, 7 Jun 2019 19:15:54 +0000 (12:15 -0700)]
intel/perf: move query_object into perf

Query objects can now be encapsulated within the perf subsystem.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: create a vtable entry for store_register_mem64
Mark Janes [Tue, 4 Jun 2019 19:45:01 +0000 (12:45 -0700)]
intel/perf: create a vtable entry for store_register_mem64

This method is needed to move subsequent methods into perf.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move free_sample_bufs into perf
Mark Janes [Mon, 3 Jun 2019 23:16:40 +0000 (16:16 -0700)]
intel/perf: move free_sample_bufs into perf

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move reap_old_sample_buffers into perf
Mark Janes [Mon, 3 Jun 2019 23:11:16 +0000 (16:11 -0700)]
intel/perf: move reap_old_sample_buffers into perf

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move get_free_sample_buf into perf
Mark Janes [Fri, 31 May 2019 01:30:25 +0000 (18:30 -0700)]
intel/perf: move get_free_sample_buf into perf

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move the perf context into perf
Mark Janes [Fri, 31 May 2019 01:20:27 +0000 (18:20 -0700)]
intel/perf: move the perf context into perf

The "context" that is necessary to submit and process perf commands to
the hardware was previously present in the brw_context.perfquery
struct.  This commit moves it into perf and provides a more
understandable name.

The intention is for this struct to be private, when all methods that
access it are migrated into perf.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move get_metric_id to perf
Mark Janes [Fri, 31 May 2019 01:09:02 +0000 (18:09 -0700)]
intel/perf: move get_metric_id to perf

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move oa_sample_buf structure to perf
Mark Janes [Wed, 29 May 2019 22:31:58 +0000 (15:31 -0700)]
intel/perf: move oa_sample_buf structure to perf

oa_sample_buf holds the data provided by the kernel that will be
collated into performance metrics.  Since this functionality will be
implemented in perf, the struct needs to be defined there.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: enumerate query-based metrics in perf
Mark Janes [Wed, 29 May 2019 15:48:35 +0000 (08:48 -0700)]
intel/perf: enumerate query-based metrics in perf

Iris and i965 both need to enumerate the available metrics, so these
routines must be located in perf.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: move perf-related constants to common location
Mark Janes [Wed, 29 May 2019 15:43:34 +0000 (08:43 -0700)]
intel/perf: move perf-related constants to common location

The perf subsystem needs several macro definitions that were
duplicated in Iris and i965 headers.  Place these macros within perf,
if the perf implementation contains the only references to the values.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: create a vtable entry for capture_frequency_stat_register
Mark Janes [Fri, 24 May 2019 22:35:34 +0000 (15:35 -0700)]
intel/perf: create a vtable entry for capture_frequency_stat_register

In preparation for calling both Iris and i965 implementions from perf.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: create a vtable entry for batchbuffer_flush
Mark Janes [Fri, 24 May 2019 22:35:34 +0000 (15:35 -0700)]
intel/perf: create a vtable entry for batchbuffer_flush

In preparation for calling both Iris and i965 implementions from perf.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: create a vtable entry for emit_report_count
Mark Janes [Fri, 2 Aug 2019 23:33:25 +0000 (16:33 -0700)]
intel/perf: create a vtable entry for emit_report_count

In preparation for calling both Iris and i965 implementions from perf.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: create a vtable entry for bo_unreference
Mark Janes [Fri, 24 May 2019 21:31:27 +0000 (14:31 -0700)]
intel/perf: create a vtable entry for bo_unreference

In preparation for calling both Iris and i965 implementions from perf.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: create a vtable for low-level driver functions
Mark Janes [Tue, 2 Jul 2019 21:21:57 +0000 (14:21 -0700)]
intel/perf: create a vtable for low-level driver functions

Performance metrics collections requires several actions (eg bo_map())
that have different implementations for Iris and i965.  The perf
subsystem needs a vtable for each of these actions, so it can invoke
the corresponding implementation for each driver.

The first call to be added to the table is bo_alloc.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: use common ioctl wrapper
Mark Janes [Mon, 5 Aug 2019 21:40:29 +0000 (14:40 -0700)]
intel/perf: use common ioctl wrapper

There were multiple ioctl-wrapper functions, so a common
implementation was put in gen_gem.h.   With a common implementation,
perf no longer needs the caller to configure one for it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agointel/perf: rename gen_perf to gen_perf_config
Mark Janes [Tue, 2 Jul 2019 21:11:04 +0000 (14:11 -0700)]
intel/perf: rename gen_perf to gen_perf_config

This structure contains the configurations of the metrics for the
current platform, and the settings needed for the perf subsystem to
query that configuration from the device.  This data is available
without a rendering context, and needed to support MDAPI metrics for
Vulkan.

A gen_perf_context struct will be added later, which holds additional
state from the rendering context necessary for metric data
collection.  The gen_perf struct needs a more precise name to reduce
confusion.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2 years agonvc0: fix program dumping, use _debug_printf
Ilia Mirkin [Wed, 7 Aug 2019 03:00:06 +0000 (23:00 -0400)]
nvc0: fix program dumping, use _debug_printf

This debug situation is unforunate. debug_printf only does something
with DEBUG set, but in practice all that needs to be moved to !NDEBUG.
For now, use _debug_printf which always prints. However the whole
function is guarded by !NDEBUG.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2 years agonvc0: add support for ATOMC_WRAP TGSI operations
Ilia Mirkin [Wed, 7 Aug 2019 03:02:53 +0000 (23:02 -0400)]
nvc0: add support for ATOMC_WRAP TGSI operations

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>