mesa.git
6 years agoanv/cmd_buffer: Move gen7 index buffer state to graphics state
Jason Ekstrand [Sat, 16 Dec 2017 00:55:54 +0000 (16:55 -0800)]
anv/cmd_buffer: Move gen7 index buffer state to graphics state

Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
6 years agoanv/cmd_buffer: Move num_workgroups to compute state
Jason Ekstrand [Sat, 16 Dec 2017 00:53:03 +0000 (16:53 -0800)]
anv/cmd_buffer: Move num_workgroups to compute state

While we're here, make it an anv_address.

Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
6 years agoanv/cmd_buffer: Move dynamic state to graphics state
Jason Ekstrand [Sat, 16 Dec 2017 00:48:53 +0000 (16:48 -0800)]
anv/cmd_buffer: Move dynamic state to graphics state

Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
6 years agoanv/cmd_buffer: Use a temporary variable for dynamic state
Jason Ekstrand [Sat, 16 Dec 2017 00:47:56 +0000 (16:47 -0800)]
anv/cmd_buffer: Use a temporary variable for dynamic state

We were already doing this for some packets to keep the lines shorter.
We may as well just do it for all of them.

Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
6 years agoanv/cmd_buffer: Move vb_dirty bits into anv_cmd_graphics_state
Jason Ekstrand [Sat, 16 Dec 2017 00:39:53 +0000 (16:39 -0800)]
anv/cmd_buffer: Move vb_dirty bits into anv_cmd_graphics_state

Vertex buffers are entirely a graphics pipeline thing.

Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
6 years agoanv/cmd_buffer: Move dirty bits into anv_cmd_*_state
Jason Ekstrand [Sat, 16 Dec 2017 00:38:10 +0000 (16:38 -0800)]
anv/cmd_buffer: Move dirty bits into anv_cmd_*_state

Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
6 years agoanv: Separate compute and graphics descriptor sets
Jason Ekstrand [Fri, 15 Dec 2017 22:02:27 +0000 (14:02 -0800)]
anv: Separate compute and graphics descriptor sets

The Vulkan spec says:

    "pipelineBindPoint is a VkPipelineBindPoint indicating whether the
    descriptors will be used by graphics pipelines or compute pipelines.
    There is a separate set of bind points for each of graphics and
    compute, so binding one does not disturb the other."

Up until now, we've been ignoring the pipeline bind point and had just
one bind point for everything.  This commit separates things out into
separate bind points.

Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102897
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
6 years agoanv/cmd_buffer: Use anv_descriptor_for_binding for samplers
Jason Ekstrand [Fri, 15 Dec 2017 21:59:33 +0000 (13:59 -0800)]
anv/cmd_buffer: Use anv_descriptor_for_binding for samplers

Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
6 years agoanv/cmd_buffer: Add a helper for binding descriptor sets
Jason Ekstrand [Fri, 15 Dec 2017 21:47:53 +0000 (13:47 -0800)]
anv/cmd_buffer: Add a helper for binding descriptor sets

This lets us unify some code between push descriptors and regular
descriptors.  It doesn't do much for us yet but it will.

Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
6 years agoanv/cmd_buffer: Refactor ensure_push_descriptor_set
Jason Ekstrand [Fri, 15 Dec 2017 20:33:34 +0000 (12:33 -0800)]
anv/cmd_buffer: Refactor ensure_push_descriptor_set

It's now a function which returns the push descriptor set.  Since we set
the error on the command buffer, returning the error is a little
redundant.  Returning the descriptor set (or NULL on error) is more
convenient.

Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
6 years agoanv: Remove semicolons from vk_error[f] definitions
Jason Ekstrand [Fri, 15 Dec 2017 21:41:21 +0000 (13:41 -0800)]
anv: Remove semicolons from vk_error[f] definitions

With the semicolons, they can't be used in a function argument without
throwing syntax errors.

Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
6 years agoanv/cmd_buffer: Add substructs to anv_cmd_state for graphics and compute
Jason Ekstrand [Fri, 15 Dec 2017 19:39:31 +0000 (11:39 -0800)]
anv/cmd_buffer: Add substructs to anv_cmd_state for graphics and compute

Initially, these just contain the pipeline in a base struct.

Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
6 years agoanv/cmd_buffer: Use some pre-existing pipeline temporaries
Jason Ekstrand [Fri, 15 Dec 2017 17:32:29 +0000 (09:32 -0800)]
anv/cmd_buffer: Use some pre-existing pipeline temporaries

There are several places where we'd already saved the pipeline off to a
temporary variable but, due to an artifact of history, weren't actually
using that temporary everywhere.  No functional change.

Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
6 years agoanv/cmd_buffer: Rework anv_cmd_state_reset
Jason Ekstrand [Fri, 15 Dec 2017 17:23:08 +0000 (09:23 -0800)]
anv/cmd_buffer: Rework anv_cmd_state_reset

This splits anv_cmd_state_reset into separate init and finish functions.
This lets us share init code with cmd_buffer_create.  This potentially
fixes subtle bugs where we may have missed some bit of state that needs
to get initialized on command buffer creation.

Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
6 years agoanv/cmd_buffer: Get rid of the meta query workaround
Jason Ekstrand [Fri, 15 Dec 2017 17:12:11 +0000 (09:12 -0800)]
anv/cmd_buffer: Get rid of the meta query workaround

Meta has been gone for a long time.

Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
6 years agoanv/cmd_state: Drop the scratch_size field
Jason Ekstrand [Fri, 15 Dec 2017 16:52:21 +0000 (08:52 -0800)]
anv/cmd_state: Drop the scratch_size field

This is a legacy left-over from the mechanism we used to use to handle
scratch.  The new (and better) mechanism doesn't use this.

Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
6 years agoanv/pipeline: Don't assert on more than 32 samplers
Jason Ekstrand [Fri, 15 Dec 2017 19:27:39 +0000 (11:27 -0800)]
anv/pipeline: Don't assert on more than 32 samplers

This prevents an assert when running one unreleased Vulkan game.

Tested-by: Józef Kucia <joseph.kucia@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
6 years agoradv: fix sample_mask_in loading. (v3.1)
Dave Airlie [Tue, 23 Jan 2018 01:07:26 +0000 (11:07 +1000)]
radv: fix sample_mask_in loading. (v3.1)

This is ported from radeonsi and fixes:
dEQP-VK.pipeline.multisample_shader_builtin.sample_mask.bit_*

v2: don't call this path for radeonsi, it does it in the epilog.
use the radeonsi code path.
v3: handle NULL pCreateInfo->pMultisampleState properly (Samuel)
v3.1: set ps_iter_samples default to 1 (Bas)

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Fixes: bdcbe7c76 (radv: add sample mask input support)
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: don't use hw resolves for r16g16 norm formats.
Dave Airlie [Tue, 23 Jan 2018 06:07:50 +0000 (16:07 +1000)]
radv: don't use hw resolves for r16g16 norm formats.

radeonsi has a workaround for this, but it uses a R16A16 format,
which vulkan doesn't have, we could probably come up with a work
around but for now just avoid hw resolves.

Fixes:
dEQP-VK.renderpass.suballocation.multisample.r16g16_*norm*

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Fixes: 2a04f5481d (radv/meta: select resolve paths)
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: don't use hw resolve for integer image formats
Dave Airlie [Tue, 23 Jan 2018 04:57:12 +0000 (14:57 +1000)]
radv: don't use hw resolve for integer image formats

From reading AMDVLK it currently never uses hw resolve paths.

This patch takes from radeonsi which doesn't use hw resolve
for integer formats, and does the same for radv.

This fixes:
dEQP-VK.renderpass.suballocation.multisample*uint tests.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Fixes: 2a04f5481d (radv/meta: select resolve paths)
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: add fs_key meta format support to resolve passes.
Dave Airlie [Tue, 23 Jan 2018 05:48:08 +0000 (15:48 +1000)]
radv: add fs_key meta format support to resolve passes.

Some of the hw resolve passes need the SPI color format setup
correctly.

This fixes lots of 16-bit and 32-bit format tests in
dEQP-VK.renderpass.suballocation.multisample*

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Fixes: f4e499ec7914 "radv: add initial non-conformant radv vulkan driver"
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agowinsys/svga: check correct member after create
Grazvydas Ignotas [Mon, 22 Jan 2018 22:41:00 +0000 (15:41 -0700)]
winsys/svga: check correct member after create

.mob_fenced was already checked, probably a copy-paste bug.
Found by Coccinelle.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agosvga: fix context alloc error handling
Grazvydas Ignotas [Mon, 22 Jan 2018 22:41:00 +0000 (15:41 -0700)]
svga: fix context alloc error handling

'cleanup' path is dereferencing 'svga' a lot, 'done' is a better choice.
Found by Coccinelle.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agomeson: remove lib prefix from libd3dadapter9.so
Christoph Haag [Sat, 20 Jan 2018 17:53:13 +0000 (18:53 +0100)]
meson: remove lib prefix from libd3dadapter9.so

Fixes: 6b4c7047d57178d336 ("meson: build gallium nine state_tracker")
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan.c.baker@intel.com>
6 years agodocs: update calendar 18.0.0-rc1 is out
Emil Velikov [Tue, 23 Jan 2018 17:01:06 +0000 (17:01 +0000)]
docs: update calendar 18.0.0-rc1 is out

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoradeon: remove left over dead code
Eric Engestrom [Tue, 19 Dec 2017 13:41:35 +0000 (13:41 +0000)]
radeon: remove left over dead code

Fixes: 4e0d99a63588c67a955f "r100: Use shared debug code"
Cc: Pauli Nieminen <suokkos@gmail.com>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agodocs: ask for backport nominations to cc: the author
Eric Engestrom [Fri, 12 Jan 2018 15:10:28 +0000 (15:10 +0000)]
docs: ask for backport nominations to cc: the author

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agomeson: fix some defines misspelled errors in meson.build
Marc Dietrich [Tue, 23 Jan 2018 14:49:43 +0000 (15:49 +0100)]
meson: fix some defines misspelled errors in meson.build

Defines
- HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL
- HAVE_FUNC_ATTRIBUTE_VISIBILITY
were misspelled.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoac/nir: Use instance_rate_inputs per attribute, not per variable.
Bas Nieuwenhuizen [Mon, 22 Jan 2018 08:01:29 +0000 (09:01 +0100)]
ac/nir: Use instance_rate_inputs per attribute, not per variable.

This did the wrong thing if we had e.g. an array for which only some
of the attributes use the instance index. Tripped up some new CTS
tests.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoanv: Return trampoline entrypoints from GetInstanceProcAddr
Jason Ekstrand [Sat, 20 Jan 2018 18:39:16 +0000 (10:39 -0800)]
anv: Return trampoline entrypoints from GetInstanceProcAddr

Technically, the Vulkan spec requires that we return valid entrypoints
for all core functionality and any available device extensions.  This
means that, for gen-specific functions, we need to return a trampoline
which looks at the device and calls the right device function.  In 99%
of cases, the loader will do this for us but, aparently, we're supposed
to do it too.  It's a tiny increase in binary size for us to carry this
around but really not bad.

Before:
       text    data   bss      dec     hex  filename
    3541775  204112  6136  3752023  394057  libvulkan_intel.so

After:
       text    data   bss      dec     hex  filename
    3551463  205632  6136  3763231  396c1f  libvulkan_intel.so

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv/entrypoints: Use an named tuple for params
Jason Ekstrand [Sat, 20 Jan 2018 18:14:10 +0000 (10:14 -0800)]
anv/entrypoints: Use an named tuple for params

This allows us to store a bit more detailed data per-param

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv: Only advertise enabled entrypoints
Jason Ekstrand [Wed, 17 Jan 2018 02:08:09 +0000 (18:08 -0800)]
anv: Only advertise enabled entrypoints

The Vulkan spec annoyingly requires us to track what core version and
what all extensions are enabled and only advertise those entrypoints.
Any call to vkGet*ProcAddr for an entrypoint for an extension the client
has not explicitly enabled is supposed to return NULL.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv: Add a per-device dispatch table
Jason Ekstrand [Wed, 17 Jan 2018 02:24:56 +0000 (18:24 -0800)]
anv: Add a per-device dispatch table

We also switch GetDeviceProcAddr over to use it.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv: Add a per-instance dispatch table
Jason Ekstrand [Wed, 17 Jan 2018 02:11:03 +0000 (18:11 -0800)]
anv: Add a per-instance dispatch table

We also switch GetInstanceProcAddr over to use it.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv: Properly NULL for GetInstanceProcAddr with a null instance
Jason Ekstrand [Wed, 17 Jan 2018 00:14:25 +0000 (16:14 -0800)]
anv: Properly NULL for GetInstanceProcAddr with a null instance

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv/extensions: Fix VkVersion::c_vk_version for patch == None
Jason Ekstrand [Wed, 17 Jan 2018 02:08:33 +0000 (18:08 -0800)]
anv/extensions: Fix VkVersion::c_vk_version for patch == None

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv/entrypoints: Parse entrypoints before extensions/features
Jason Ekstrand [Wed, 17 Jan 2018 01:20:33 +0000 (17:20 -0800)]
anv/entrypoints: Parse entrypoints before extensions/features

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv/entrypoints: Expose the different dispatch tables
Jason Ekstrand [Wed, 17 Jan 2018 01:00:05 +0000 (17:00 -0800)]
anv/entrypoints: Expose the different dispatch tables

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv/entrypoints: Split entrypoint index lookup into its own function
Jason Ekstrand [Wed, 17 Jan 2018 00:52:50 +0000 (16:52 -0800)]
anv/entrypoints: Split entrypoint index lookup into its own function

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv/entrypoints: Add a LAYERS helper variable
Jason Ekstrand [Wed, 17 Jan 2018 00:46:35 +0000 (16:46 -0800)]
anv/entrypoints: Add a LAYERS helper variable

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv/entrypoints: Add an Entrypoint class
Jason Ekstrand [Tue, 19 Sep 2017 21:44:15 +0000 (14:44 -0700)]
anv/entrypoints: Add an Entrypoint class

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv: Add a per-device table of enabled extensions
Jason Ekstrand [Wed, 17 Jan 2018 00:22:45 +0000 (16:22 -0800)]
anv: Add a per-device table of enabled extensions

Nothing uses this at the moment, but we will need it soon.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv: Use tables for device extension wrangling
Jason Ekstrand [Wed, 17 Jan 2018 00:15:13 +0000 (16:15 -0800)]
anv: Use tables for device extension wrangling

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv: Add a per-instance table of enabled extensions
Jason Ekstrand [Wed, 17 Jan 2018 00:13:48 +0000 (16:13 -0800)]
anv: Add a per-instance table of enabled extensions

Nothing needs this yet but we will want it later.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv: Use tables for instance extension wrangling
Jason Ekstrand [Tue, 16 Jan 2018 23:49:28 +0000 (15:49 -0800)]
anv: Use tables for instance extension wrangling

This lets us move a bunch of stuff out of codegen and back into
anv_device.c which is a bit nicer.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv/extensions: Generate a header file with extension tables
Jason Ekstrand [Tue, 16 Jan 2018 22:23:29 +0000 (14:23 -0800)]
anv/extensions: Generate a header file with extension tables

This allows us better introspection into extensions.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv/meson: Simplify some dependency and flag tracking
Jason Ekstrand [Tue, 16 Jan 2018 21:42:34 +0000 (13:42 -0800)]
anv/meson: Simplify some dependency and flag tracking

This removes some redundant code between libanv_common, libvulkan_intel,
and libvulkan_intel_test.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv: Split anv_extensions.py into two files
Jason Ekstrand [Tue, 16 Jan 2018 18:10:28 +0000 (10:10 -0800)]
anv: Split anv_extensions.py into two files

The new anv_extensions_gen.py is the code generator while the old
anv_extensions.py file is purely declarative.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoanv/meson: Make anv_entrypoints_gen.py depend on anv_extensions.py
Jason Ekstrand [Tue, 16 Jan 2018 17:54:19 +0000 (09:54 -0800)]
anv/meson: Make anv_entrypoints_gen.py depend on anv_extensions.py

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoac: fix image load store for GLSL_SAMPLER_DIM_3D
Timothy Arceri [Sat, 20 Jan 2018 03:04:55 +0000 (14:04 +1100)]
ac: fix image load store for GLSL_SAMPLER_DIM_3D

Fixes the following piglit tests:

arb_shader_image_load_store/layer/image3d/layered binding test
arb_shader_image_load_store/max-size/image3d max size test/2048x8x8x1
arb_shader_image_load_store/max-size/image3d max size test/8x2048x8x1
arb_shader_image_load_store/max-size/image3d max size test/8x8x2048x1
arb_shader_image_load_store/semantics/imageload/vertex shader/rgba32f/image3d test

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoac: image size builtin for GLSL_SAMPLER_DIM_3D
Timothy Arceri [Thu, 18 Jan 2018 07:15:28 +0000 (18:15 +1100)]
ac: image size builtin for GLSL_SAMPLER_DIM_3D

This is what radeonsi does. Fixes remaing piglit subtest in:

./bin/arb_shader_image_size-builtin --quick -auto -fbo

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoswr: refactor swr_create_screen to allow for proper cleanup on error
Chuck Atkins [Mon, 22 Jan 2018 17:09:28 +0000 (12:09 -0500)]
swr: refactor swr_create_screen to allow for proper cleanup on error

This makes the following changes to address cleanup issues:
- Error conditions now return NULL instead of calling exit()
- swr_creen is now freed upon error, rather than leak.
- Library handle from dlopen is now closed upon swr_screen destruction

v2: Added additional context in commit msg and remove unnecessary "PUBLIC"
v3: Fix typo in commit message.

Signed-off-by: Chuck Atkins <chuck.atkins@kitware.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: Bruce Cherniak <bruce.cherniak@intel.com>
Cc: Tim Rowley <timothy.o.rowley@intel.com>
cc: mesa-stable@lists.freedesktop.org

6 years agointel: Add Geminilake brand strings
Anuj Phogat [Wed, 17 Jan 2018 21:30:16 +0000 (13:30 -0800)]
intel: Add Geminilake brand strings

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoac: fix ac_build_varying_gather_values() for packed layouts
Timothy Arceri [Fri, 19 Jan 2018 05:48:43 +0000 (16:48 +1100)]
ac: fix ac_build_varying_gather_values() for packed layouts

This fixes a segfault for varyings not starting at component 0.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoac: remove arrays when when querying sampler info
Timothy Arceri [Fri, 19 Jan 2018 04:51:15 +0000 (15:51 +1100)]
ac: remove arrays when when querying sampler info

Fixes the following ARB_arrays_of_arrays piglit tests:

basic-imagestore-const-uniform-index
basic-imagestore-mixed-const-non-const-uniform-index
basic-imagestore-mixed-const-non-const-uniform-index2
basic-imagestore-non-const-uniform-index

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoglsl: add image and sampler (un)packing support to glsl to nir
Timothy Arceri [Fri, 19 Jan 2018 04:11:16 +0000 (15:11 +1100)]
glsl: add image and sampler (un)packing support to glsl to nir

This is needed for ARB_bindless_texture support.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agonir: add image and sampler type to glsl_get_bit_size()
Timothy Arceri [Fri, 19 Jan 2018 04:09:51 +0000 (15:09 +1100)]
nir: add image and sampler type to glsl_get_bit_size()

These are needed for ARB_bindless_texture support.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoac: fix emit vertex stream parameter
Timothy Arceri [Fri, 19 Jan 2018 05:30:37 +0000 (16:30 +1100)]
ac: fix emit vertex stream parameter

Fixes the following piglit test on radeonsi:

./bin/arb_enhanced_layouts-gs-stream-location-aliasing

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoac: add support for gl_HelperInvocation
Timothy Arceri [Thu, 18 Jan 2018 23:04:26 +0000 (10:04 +1100)]
ac: add support for gl_HelperInvocation

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoac/radeonsi: add emit primitive to the abi
Timothy Arceri [Thu, 18 Jan 2018 22:09:29 +0000 (09:09 +1100)]
ac/radeonsi: add emit primitive to the abi

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoradeonsi: add generic emit primitive helper
Timothy Arceri [Thu, 18 Jan 2018 21:50:42 +0000 (08:50 +1100)]
radeonsi: add generic emit primitive helper

This will be shared by the tgsi and nir backends.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoac: add stream handling to visit_end_primitive()
Timothy Arceri [Thu, 18 Jan 2018 21:33:03 +0000 (08:33 +1100)]
ac: add stream handling to visit_end_primitive()

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoradeonsi/nir: fix fs output index
Timothy Arceri [Mon, 22 Jan 2018 03:41:25 +0000 (14:41 +1100)]
radeonsi/nir: fix fs output index

Fixes the following piglit tests:

arb_blend_func_extended-fbo-extended-blend
arb_blend_func_extended-fbo-extended-blend-explicit
arb_blend_func_extended-fbo-extended-blend-explicit_gles3
arb_blend_func_extended-fbo-extended-blend-pattern
arb_blend_func_extended-fbo-extended-blend-pattern_gles2
arb_blend_func_extended-fbo-extended-blend-pattern_gles3
arb_blend_func_extended-fbo-extended-blend_gles3
ext_framebuffer_multisample/alpha-to-coverage-dual-src-blend
ext_framebuffer_multisample/alpha-to-one-dual-src-blend

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoac/nir/radeonsi: add ARB_shader_ballot support
Timothy Arceri [Mon, 22 Jan 2018 01:53:45 +0000 (12:53 +1100)]
ac/nir/radeonsi: add ARB_shader_ballot support

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoac/nir: add ARB_shader_group_vote support
Timothy Arceri [Sun, 21 Jan 2018 23:51:58 +0000 (10:51 +1100)]
ac/nir: add ARB_shader_group_vote support

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoradeonsi/nir: add primitive id to inputs scan
Timothy Arceri [Fri, 19 Jan 2018 11:44:58 +0000 (22:44 +1100)]
radeonsi/nir: add primitive id to inputs scan

Fixes the following piglit tests:

arb_tessellation_shader/fs-primitiveid-instanced
glsl-1.50/primitive-id-no-gs
glsl-1.50/primitive-id-no-gs-first-vertex
glsl-1.50/primitive-id-no-gs-instanced
glsl-1.50/primitive-id-no-gs-strip
glsl-1.50/primitive-id-no-gs-strip-first-vertex

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoradeonsi/nir: add nir_intrinsic_load_sample_mask_in to ir scan
Timothy Arceri [Fri, 19 Jan 2018 10:52:24 +0000 (21:52 +1100)]
radeonsi/nir: add nir_intrinsic_load_sample_mask_in to ir scan

Fixes a bunch of ARB_sample_shading piglit tests.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agou_thread: Use pthread_setname_np on linux only.
Samuel Thibault [Sat, 13 Jan 2018 11:33:15 +0000 (12:33 +0100)]
u_thread: Use pthread_setname_np on linux only.

pthread_setname_np was added in glibc 2.12 for the Linux port only, other
ports do not necessarily have it.

Signed-off-by: Jose Fonseca <jfonseca@vmware.com>
6 years agosvga: Prevent use after free.
Jose Fonseca [Mon, 22 Jan 2018 15:05:22 +0000 (15:05 +0000)]
svga: Prevent use after free.

Courtesy of clang static analyzer.

I was hunting for potential sources of memory corruption using Mesa with
a GL trace, and happened to find this (unrelated) issue.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
6 years agoi965: Drop render_target_start from binding table struct.
Kenneth Graunke [Wed, 3 Jan 2018 07:59:06 +0000 (23:59 -0800)]
i965: Drop render_target_start from binding table struct.

We have to start render targets at binding table index 0 in order to use
headerless FB write messages, and in fact already assume this in a bunch
of places in the code.  Let's finish that off, and not bother storing 0
in a struct to pretend to add it in a few places.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
6 years agoi965: make brw_context::num_samples unsigned int
Emil Velikov [Fri, 19 Jan 2018 15:57:50 +0000 (15:57 +0000)]
i965: make brw_context::num_samples unsigned int

It is never a negative number. Variable is compared against unsigned
values and passed into functions that expect unsigned int.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agost/mesa: provide static inline st_init_vdpau_functions
Emil Velikov [Fri, 19 Jan 2018 16:53:47 +0000 (16:53 +0000)]
st/mesa: provide static inline st_init_vdpau_functions

The ifdef spaghetty in st_vdpau.c is rather confusing and misleading.
Simplily it by introducing a static inline helper noop (when
HAVE_ST_VDPAU is not defined) in the header.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agoradv: add an option that allows to dump pre-optimization ir
Samuel Pitoiset [Fri, 19 Jan 2018 11:12:02 +0000 (12:12 +0100)]
radv: add an option that allows to dump pre-optimization ir

With RADV_DEBUG=preoptir.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoi965: Accept CONTEXT_ATTRIB_PRIORITY for brwCreateContext
Chris Wilson [Sat, 20 Jan 2018 00:19:47 +0000 (00:19 +0000)]
i965: Accept CONTEXT_ATTRIB_PRIORITY for brwCreateContext

The forward port of commit 6d87500fe12e ("dri: Change
__DriverApiRec::CreateContext to take a struct for attribs") failed to
adapt the set of allowed attributes for the earlier introduction of
context priorities (commit 1617fca6d12e "i965: Pass the EGL/DRI context
priority through to the kernel").

Fixes: 6d87500fe12e ("dri: Change __DriverApiRec::CreateContext to take a struct for attribs")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Adam Jackson <ajax@redhat.com>
Cc: Nicolai Hähnle <nicolai.haehnle@amd.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Cc: mesa-stable@lists.freedesktop.org
6 years agoradv: restore previous stencil reference after depth-stencil clear
Matthew Nicholls [Fri, 19 Jan 2018 14:11:48 +0000 (14:11 +0000)]
radv: restore previous stencil reference after depth-stencil clear

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Alex Smith <asmith@feralinteractive.com>
6 years agoi965: Set tiling on BOs imported with modifiers
Jason Ekstrand [Fri, 12 Jan 2018 01:33:36 +0000 (17:33 -0800)]
i965: Set tiling on BOs imported with modifiers

We need this to ensure that GTT maps work on buffers we get from Vulkan
on the off chance that someone does a readpixels or something.  Soon, we
will be removing GTT maps from i965 entirely and this can be reverted.
None the less, it's needed for stable.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
6 years agoi965/bufmgr: Add a create_from_prime_tiled function
Jason Ekstrand [Fri, 19 Jan 2018 04:39:50 +0000 (20:39 -0800)]
i965/bufmgr: Add a create_from_prime_tiled function

This new function is an import and a set tiling in one go.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
6 years agoi965/miptree: Use the tiling from the modifier instead of the BO
Jason Ekstrand [Sat, 18 Nov 2017 00:10:54 +0000 (16:10 -0800)]
i965/miptree: Use the tiling from the modifier instead of the BO

This fixes a bug where we were taking the tiling from the BO regardless
of what the modifier said.  When we got images in from Vulkan where it
doesn't set the tiling on the BO, we would treat them as linear even
though the modifier expressly said to treat it as Y-tiled.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
6 years agoi965/miptree: Add an explicit tiling parameter to create_for_bo
Jason Ekstrand [Sat, 18 Nov 2017 00:10:53 +0000 (16:10 -0800)]
i965/miptree: Add an explicit tiling parameter to create_for_bo

Otherwise, create_for_bo will just grab the tiling from the BO which is
not what we want when using modifiers.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
6 years agoradv: Don't allow 3d or 1d depth/stencil textures.
Bas Nieuwenhuizen [Sun, 21 Jan 2018 22:39:36 +0000 (23:39 +0100)]
radv: Don't allow 3d or 1d depth/stencil textures.

addrlib asserts when that happens, and supporting it is not
required so lets not allow this for now.

It also assert on fmask, but we don't have the number of samples here.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Init variant entry with memset.
Bas Nieuwenhuizen [Sun, 21 Jan 2018 21:03:02 +0000 (22:03 +0100)]
radv: Init variant entry with memset.

This gets memcpy'd and written driectly, and due to alignment, this
resulted in uninitialized gaps. This makes those gaps go away.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Fix bufimage failure deallocation.
Bas Nieuwenhuizen [Sun, 21 Jan 2018 21:01:49 +0000 (22:01 +0100)]
radv: Fix bufimage failure deallocation.

The inidividual init parts don't clean up their own stuff on failure.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Fix fragment resolve init memory allocation failure paths.
Bas Nieuwenhuizen [Sun, 21 Jan 2018 20:59:26 +0000 (21:59 +0100)]
radv: Fix fragment resolve init memory allocation failure paths.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Fix freeing meta state if the device pipeline cache fails to allocate.
Bas Nieuwenhuizen [Sun, 21 Jan 2018 20:47:31 +0000 (21:47 +0100)]
radv: Fix freeing meta state if the device pipeline cache fails to allocate.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Fix memory allocation failure path in compute resolve init.
Bas Nieuwenhuizen [Sun, 21 Jan 2018 19:20:50 +0000 (20:20 +0100)]
radv: Fix memory allocation failure path in compute resolve init.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Fix ordering issue in meta memory allocation failure path.
Bas Nieuwenhuizen [Sun, 21 Jan 2018 19:19:48 +0000 (20:19 +0100)]
radv: Fix ordering issue in meta memory allocation failure path.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoetnaviv: dirty TS state when framebuffer has changed
Lucas Stach [Thu, 11 Jan 2018 10:29:29 +0000 (11:29 +0100)]
etnaviv: dirty TS state when framebuffer has changed

When switching between framebuffers with and without TS, the TS state
needs to be flushed to the command stream even if the derived state
isn't changed.

Fixes: 4ee7c2c2843c ("etnaviv: enable TS, but disable autodisable")
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
6 years agobroadcom/vc5: Fix source file name.
Vinson Lee [Sat, 20 Jan 2018 01:19:34 +0000 (01:19 +0000)]
broadcom/vc5: Fix source file name.

Fixes: c9b2cb78972d ("vc5: add missing files to the tarball")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agobroadcom/vc5: Add missing include paths.
Vinson Lee [Sat, 20 Jan 2018 00:56:12 +0000 (00:56 +0000)]
broadcom/vc5: Add missing include paths.

Fixes: 954a704da305 ("broadcom/vc5: Port the RCL setup to V3D4.1.")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agomesa: Only require independent blending for GLES 3.2.
Eric Anholt [Fri, 19 Jan 2018 00:24:42 +0000 (16:24 -0800)]
mesa: Only require independent blending for GLES 3.2.

We've been requiring this since GLES 3.0 was introduced, but the GLES 3.2
spec is the one that has "Supporting blending on a per-draw-buffer basis"
in the new features.  V3D 3.3 would require lowering blending to shader
code to implement independent blending.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agoi965: Delete completely bogus comment
Kenneth Graunke [Sat, 20 Jan 2018 09:28:07 +0000 (01:28 -0800)]
i965: Delete completely bogus comment

This hasn't been true in 6+ years, if it was even true then.  Before
we rewrote the compiler and introduced GLSL IR in 2010-2011, i965 used
to have two compiler backends for WM programs, based on Mesa IR.  One
handled flow control and was SIMD8-only, while the other was SIMD16
only and didn't handle flow control.  Or something like that.

Even then, this certainly didn't handle vertex shaders, so "all ...
code generation" is a bit strong.

6 years agoautotools: include meson build files in tarball
Dylan Baker [Wed, 17 Jan 2018 22:13:11 +0000 (14:13 -0800)]
autotools: include meson build files in tarball

This adds the meson.build, meson_options.txt, and a few scripts that are
used exclusively by the meson build.

v2: - Remove accidentally included changes needed to test make dist with
      LLVM > 3.9

Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Acked-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoswr/rast: Fix llvm5 behavior
George Kyriazis [Fri, 19 Jan 2018 22:46:56 +0000 (16:46 -0600)]
swr/rast: Fix llvm5 behavior

For some reason llvm5 is picky about accepting a void * type in the
case of building an argument list.

Since we don't care about the type (we ignore the argument for now),
pick another pointer type

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: Enable early rasterization
George Kyriazis [Fri, 19 Jan 2018 21:47:15 +0000 (15:47 -0600)]
swr/rast: Enable early rasterization

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: Implement Early Rasterization optimization
George Kyriazis [Fri, 19 Jan 2018 21:47:14 +0000 (15:47 -0600)]
swr/rast: Implement Early Rasterization optimization

Early Rasterization is an optimization for small triangles.

Scientific workloads often contain very small triangles that has non-zero
area and cannot be trivially rejected as falling between pixel centers,
but does not cover any pixel center. Those triangles can be initially
rasterized as early as in binner and rejected if they cover no pixels The
optimization can be disabled in compilation using KNOB_ENABLE_EARLY_RAST
option in knobs.h

The Early Rast is disabled by default.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: Enable simd16 vertex shaders
George Kyriazis [Fri, 19 Jan 2018 21:47:13 +0000 (15:47 -0600)]
swr/rast: Enable simd16 vertex shaders

Flip the switch(es) to enable simd16 vertex shaders:

USE_SIMD16_SHADERS and USE_SIMD16_VS

Both have to be enabled at the same time.  Currently, just setting
USE_SIMD16_SHADERS does not work correctly.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr: Support simd16 vertex shaders
George Kyriazis [Fri, 19 Jan 2018 21:47:12 +0000 (15:47 -0600)]
swr: Support simd16 vertex shaders

Supporting simd16 vertex shaders involves packing the output of the
fetch shader appropriately, especially the vertexID buffers that have to
be formatted in one simd16 register, needed by the VS.

As part of this support, we needed to remove the 2nd JitManager, since it
was not accounting for vector width correctly.

USE_SIMD16_SHADERS is also split into two defines.  The additional
one (USE_SIMD16_VS) controls the width of the vertex shader (VS), while
the original one (USE_SIMD16_SHADERS) controls overall front end width.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: changed jit debug magic number
George Kyriazis [Fri, 19 Jan 2018 21:47:11 +0000 (15:47 -0600)]
swr/rast: changed jit debug magic number

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: Added ICLAMP builder function
George Kyriazis [Fri, 19 Jan 2018 21:47:10 +0000 (15:47 -0600)]
swr/rast: Added ICLAMP builder function

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: Jit debug work
George Kyriazis [Fri, 19 Jan 2018 21:47:09 +0000 (15:47 -0600)]
swr/rast: Jit debug work

Properly validate DLL matches OBJ for jitted function

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>