mesa.git
6 years agomesa: add const qualifier on _mesa_is_renderable_texture_format()
Brian Paul [Tue, 5 Dec 2017 19:05:48 +0000 (12:05 -0700)]
mesa: add const qualifier on _mesa_is_renderable_texture_format()

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: add const qualifier on _mesa_base_fbo_format()
Brian Paul [Tue, 5 Dec 2017 19:05:18 +0000 (12:05 -0700)]
mesa: add const qualifier on _mesa_base_fbo_format()

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: s/%u/%d/ in _mesa_error() call in check_layer()
Brian Paul [Tue, 5 Dec 2017 16:57:23 +0000 (09:57 -0700)]
mesa: s/%u/%d/ in _mesa_error() call in check_layer()

The layer parameter is signed.  Fixes the error message seen when
running the arb_texture_multisample-errors test which checks a
negative layer value.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agomesa: simplify/improve some _mesa_error() calls in teximage.c
Brian Paul [Tue, 5 Dec 2017 16:27:52 +0000 (09:27 -0700)]
mesa: simplify/improve some _mesa_error() calls in teximage.c

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agomesa: trivial whitespace fixes in transformfeedback.c
Brian Paul [Tue, 5 Dec 2017 14:14:08 +0000 (07:14 -0700)]
mesa: trivial whitespace fixes in transformfeedback.c

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agomesa: add const qualifier in test_attachment_completeness()
Brian Paul [Tue, 5 Dec 2017 04:27:54 +0000 (21:27 -0700)]
mesa: add const qualifier in test_attachment_completeness()

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agost/mesa: remove unneeded #include in st_format.h
Brian Paul [Tue, 5 Dec 2017 14:13:53 +0000 (07:13 -0700)]
st/mesa: remove unneeded #include in st_format.h

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agost/mesa: rename a few vars to 'bindings'
Brian Paul [Tue, 5 Dec 2017 04:32:33 +0000 (21:32 -0700)]
st/mesa: rename a few vars to 'bindings'

To be consistent.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agost/mesa: whitespace fixes in st_format.c
Brian Paul [Tue, 5 Dec 2017 04:28:34 +0000 (21:28 -0700)]
st/mesa: whitespace fixes in st_format.c

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agofreedreno/a5xx: hide ARB_base_instance
Rob Clark [Tue, 5 Dec 2017 20:58:31 +0000 (15:58 -0500)]
freedreno/a5xx: hide ARB_base_instance

Grrr..

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/ir3: handle input/output component
Rob Clark [Tue, 5 Dec 2017 13:40:18 +0000 (08:40 -0500)]
freedreno/ir3: handle input/output component

After the mesa/st nir linking support, we start to see inputs/outputs
like:

   decl_var shader_out INTERP_MODE_NONE float packed:uv (VARYING_SLOT_VAR9.x, 1, 0)
   decl_var shader_out INTERP_MODE_NONE float packed:uv@0 (VARYING_SLOT_VAR9.y, 1, 0)

(ie. were location_frac != .x)

Unfortunately I overlooked the addition of the component parameter to
load_input/store_output, so when we started encountering inputs/outputs
with component other than .x, we'd end up loading/storing the wrong
input/output.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agomesa/st: move cloning of NIR shader for compute
Rob Clark [Tue, 5 Dec 2017 14:53:56 +0000 (09:53 -0500)]
mesa/st: move cloning of NIR shader for compute

Since in the NIR case, driver takes ownership of the NIR shader, we need
to clone what is passed to the driver.  Normally this is done as part of
creating the shader variant (where is clone is anyways needed).  But
compute shaders have no variants, so we were cloning earlier.

The problem is that after the NIR linking optimizations, we ended up
cloning *before* all the lowering passes where done.

So move this into st_get_cp_variant(), to make compute shaders work more
like other shader stages.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agor600: refactor and export some shader selector code for compute
Dave Airlie [Fri, 3 Nov 2017 01:33:44 +0000 (11:33 +1000)]
r600: refactor and export some shader selector code for compute

This just moves some code around to make it easier to add compute.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600: add compute support to compressed resource handling.
Dave Airlie [Fri, 3 Nov 2017 01:27:23 +0000 (11:27 +1000)]
r600: add compute support to compressed resource handling.

This just adds support for decompressing compute resources.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600: update max threads per block for evergreen compute
Dave Airlie [Fri, 3 Nov 2017 01:23:55 +0000 (11:23 +1000)]
r600: update max threads per block for evergreen compute

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/shader: add local memory support to shader assembler.
Dave Airlie [Fri, 3 Nov 2017 01:14:28 +0000 (11:14 +1000)]
r600/shader: add local memory support to shader assembler.

This is needed for compute shaders.

v1.1: make work for vectors, fix missing lds ops.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/cs: add support for compute to image/buffers/atomics state
Dave Airlie [Fri, 3 Nov 2017 01:11:15 +0000 (11:11 +1000)]
r600/cs: add support for compute to image/buffers/atomics state

This just adds the compute paths to state handling for the
main objects

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600: handle compute null key shader state
Dave Airlie [Fri, 3 Nov 2017 02:23:26 +0000 (12:23 +1000)]
r600: handle compute null key shader state

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600: add some missing cayman register defines
Dave Airlie [Mon, 27 Nov 2017 06:54:00 +0000 (06:54 +0000)]
r600: add some missing cayman register defines

These are just taken from the kernel, and were seen in some fglrx dumps.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600: don't set EOP on pop or loop end
Dave Airlie [Thu, 23 Nov 2017 04:05:05 +0000 (14:05 +1000)]
r600: don't set EOP on pop or loop end

This appears to bad, compute shaders hang without it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/ssbo: refactor out buffer coord calcs and use for atomic path.
Dave Airlie [Tue, 5 Dec 2017 08:41:35 +0000 (08:41 +0000)]
r600/ssbo: refactor out buffer coord calcs and use for atomic path.

The atomic rat path has a bug in the ssbo path, refactor out the
address calcs from the load/store paths and reuse to fix the bug
in the buffer rat atomic path.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/ssbo: fix multi-dword buffer loads.
Dave Airlie [Tue, 5 Dec 2017 08:38:26 +0000 (08:38 +0000)]
r600/ssbo: fix multi-dword buffer loads.

This fixes loading from different channels.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/ssbo: use r32ui format for ssbo resources.
Dave Airlie [Tue, 5 Dec 2017 08:35:24 +0000 (08:35 +0000)]
r600/ssbo: use r32ui format for ssbo resources.

This works best for returning the correct values and sizes in
tests.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600: refactor out the immediate setup code.
Dave Airlie [Tue, 5 Dec 2017 08:34:26 +0000 (08:34 +0000)]
r600: refactor out the immediate setup code.

This just refactors the same code out of the images/buffers paths.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/shader: fix ssbo atomic operations formats.
Dave Airlie [Tue, 5 Dec 2017 08:28:13 +0000 (08:28 +0000)]
r600/shader: fix ssbo atomic operations formats.

Don't try and use the image format for ssbo, just 32-bit uint.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/shader: fix thread id loading.
Dave Airlie [Tue, 5 Dec 2017 08:27:38 +0000 (08:27 +0000)]
r600/shader: fix thread id loading.

This just changes how thread id loading is done, it makes
smaller shaders if we don't use thread id gprs.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoAndroid: enable noreturn and returns_nonnull attributes
Rob Herring [Tue, 5 Dec 2017 00:35:48 +0000 (18:35 -0600)]
Android: enable noreturn and returns_nonnull attributes

Commit 94ca8e04adf6 ("spirv: Add vtn_fail and vtn_assert helpers") broke
Android builds which have -Werror enabled with the following errors:

external/mesa3d/src/compiler/spirv/spirv_to_nir.c:272:1: error: control may reach end of non-void function [-Werror,-Wreturn-type]
external/mesa3d/src/compiler/spirv/spirv_to_nir.c:810:1: error: control may reach end of non-void function [-Werror,-Wreturn-type]
...

The problem is the noreturn attribute is not enabled and we to define
HAVE_FUNC_ATTRIBUTE_NORETURN.

Auditing src/util/macros.h, we're also missing
HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL and HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT,
so add them too.

Fixes: 94ca8e04adf6 ("spirv: Add vtn_fail and vtn_assert helpers")
Cc: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
6 years agogallium/u_upload_mgr: allow drivers to specify pipe_resource::flags
Marek Olšák [Fri, 1 Dec 2017 02:05:18 +0000 (03:05 +0100)]
gallium/u_upload_mgr: allow drivers to specify pipe_resource::flags

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agowinsys/amdgpu: add RADEON_FLAG_READ_ONLY
Marek Olšák [Fri, 1 Dec 2017 01:07:05 +0000 (02:07 +0100)]
winsys/amdgpu: add RADEON_FLAG_READ_ONLY

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agogallium/radeon: remove RADEON_HEAP_VRAM_GTT
Marek Olšák [Thu, 30 Nov 2017 23:14:51 +0000 (00:14 +0100)]
gallium/radeon: remove RADEON_HEAP_VRAM_GTT

Only winsyses can set VRAM|GTT. Drivers shouldn't if they want to use
winsys allocators.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agogallium/radeon: move setting VRAM|GTT into winsyses
Marek Olšák [Thu, 30 Nov 2017 23:06:34 +0000 (00:06 +0100)]
gallium/radeon: move setting VRAM|GTT into winsyses

The combined VRAM|GTT heap will be removed.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoradeonsi: flush the context after resource_copy_region for buffer exports
Marek Olšák [Thu, 30 Nov 2017 21:46:39 +0000 (22:46 +0100)]
radeonsi: flush the context after resource_copy_region for buffer exports

Cc: 17.2 17.3 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoAndroid: gallium/radeon: fix libmesa_amd_common dependency
Mauro Rossi [Sat, 2 Dec 2017 12:36:57 +0000 (13:36 +0100)]
Android: gallium/radeon: fix libmesa_amd_common dependency

libmesa_amd_common static dependency is added in Android build
to avoid the following building errors:

In file included from external/mesa/src/gallium/drivers/radeon/r600_buffer_common.c:24:
In file included from external/mesa/src/gallium/drivers/radeonsi/si_pipe.h:26:
external/mesa/src/gallium/drivers/radeonsi/si_shader.h:138:10: fatal error: 'ac_binary.h' file not found
         ^~~~~~~~~~~~~
1 error generated.
...
In file included from external/mesa/src/gallium/drivers/radeon/r600_gpu_load.c:34:
In file included from external/mesa/src/gallium/drivers/radeonsi/si_pipe.h:26:
external/mesa/src/gallium/drivers/radeonsi/si_shader.h:138:10: fatal error: 'ac_binary.h' file not found
         ^~~~~~~~~~~~~
1 error generated.

Fixes: 950221f923 ("radeonsi: remove r600_common_screen")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agost/mesa: handle compute atomics
Dave Airlie [Fri, 3 Nov 2017 02:23:01 +0000 (12:23 +1000)]
st/mesa: handle compute atomics

Just reuse the cs atomics bit and emit the hw atomic state.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/atomic: add cayman version of atomic save/restore from GDS (v2)
Dave Airlie [Fri, 1 Dec 2017 04:06:19 +0000 (04:06 +0000)]
r600/atomic: add cayman version of atomic save/restore from GDS (v2)

On Cayman we don't use the append/consume counters (fglrx doesn't)
and they don't seem to work well with compute shaders.

This just uses GDS instead to do the atomic operations.

v1.1: remove unused line.
v2: use EOS on cayman, it appears to work.

Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/atomic: refactor out evergreen atomic setup/save code.
Dave Airlie [Fri, 1 Dec 2017 04:02:33 +0000 (04:02 +0000)]
r600/atomic: refactor out evergreen atomic setup/save code.

For cayman we want to use different code paths.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradeonsi: pass llvm type directly to buffer_load()
Timothy Arceri [Thu, 23 Nov 2017 00:29:59 +0000 (11:29 +1100)]
radeonsi: pass llvm type directly to buffer_load()

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agomeson: build gallium nine state_tracker
Dylan Baker [Tue, 14 Nov 2017 01:58:51 +0000 (17:58 -0800)]
meson: build gallium nine state_tracker

v2: - set d3d_drivers_path instead of dri_drivers_path
    - Fix nine guard to check for all relavent gallium drivers
    - Link with libswdri and libswkmsdri when necessary
    - Fix pkg-config generation
    - Add missing comma

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: build gallium xa state tracker
Dylan Baker [Tue, 31 Oct 2017 00:40:30 +0000 (17:40 -0700)]
meson: build gallium xa state tracker

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: build gallium va state tracker
Dylan Baker [Mon, 30 Oct 2017 22:49:37 +0000 (15:49 -0700)]
meson: build gallium va state tracker

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: build gallium omx state tracker
Dylan Baker [Mon, 30 Oct 2017 22:23:06 +0000 (15:23 -0700)]
meson: build gallium omx state tracker

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: build gallium xvmc state tracker
Dylan Baker [Mon, 30 Oct 2017 21:32:30 +0000 (14:32 -0700)]
meson: build gallium xvmc state tracker

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: build gallium vdpau state tracker
Dylan Baker [Mon, 30 Oct 2017 21:04:21 +0000 (14:04 -0700)]
meson: build gallium vdpau state tracker

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: drop gallium-media argument
Dylan Baker [Tue, 31 Oct 2017 22:12:20 +0000 (15:12 -0700)]
meson: drop gallium-media argument

This argument is the wrong approach for handling gallium media state
trackers, since it doesn't allow for an auto option. Instead we'll use
tristates, which do allow for auto.

This option has never been wired to anything anyway.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: extend install_megadrivers script to handle symmlinking
Dylan Baker [Fri, 10 Nov 2017 01:52:31 +0000 (17:52 -0800)]
meson: extend install_megadrivers script to handle symmlinking

Which is required for the gallium media state trackers.

v2: - Make symlinks local instead of absolute

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: Add osmesa.sym script as a link dependency (gallium-osmesa)
Dylan Baker [Wed, 29 Nov 2017 17:46:25 +0000 (09:46 -0800)]
meson: Add osmesa.sym script as a link dependency (gallium-osmesa)

v2: - Add this patch

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: use driver_deps for gallium osmesa
Dylan Baker [Wed, 15 Nov 2017 22:00:19 +0000 (14:00 -0800)]
meson: use driver_deps for gallium osmesa

v2: - Put driver_swrast in the correct field (dependencies)
    - Remove unused osmesa_deps

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: Use driver dependencies for libgl-xlib target
Dylan Baker [Wed, 15 Nov 2017 18:50:11 +0000 (10:50 -0800)]
meson: Use driver dependencies for libgl-xlib target

v2: - put driver_swrast in the right field
    - add dep_threads (dep_llvm requires threads, so it masked this
      previously)

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: use the driver dependencies for the gallium dri target
Dylan Baker [Wed, 15 Nov 2017 18:45:29 +0000 (10:45 -0800)]
meson: use the driver dependencies for the gallium dri target

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: define driver dependencies
Dylan Baker [Wed, 15 Nov 2017 18:43:20 +0000 (10:43 -0800)]
meson: define driver dependencies

This allow us to encapsulate the compiler and linkage requirements of
each driver in a reusable way. The result will be that each target that
needs a specific driver can simply add `driver_<name>` to its
dependencies line and the necessary libraries and compiler args will be
added. This will allow for a lot of code de-duplication between gallium
targets.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: sort gallium drivers after winsys
Dylan Baker [Wed, 15 Nov 2017 18:41:42 +0000 (10:41 -0800)]
meson: sort gallium drivers after winsys

This is a requirement of the next patch. Since meson does not have
forward declarations, and we're going to define the driver dependencies
in the drivers folder they need to be after the winsys so that the
winsys libs are defined first.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: Combine gallium target subdirs
Dylan Baker [Tue, 28 Nov 2017 22:30:27 +0000 (14:30 -0800)]
meson: Combine gallium target subdirs

So that state trackers, targets, and special winsys requirements are all
in a single if statement. This is a cosmetic only cleanup with no
functional changes.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoi965/cnl: Avoid fast-clearing sRGB render buffers
Nanley Chery [Fri, 1 Dec 2017 22:18:21 +0000 (14:18 -0800)]
i965/cnl: Avoid fast-clearing sRGB render buffers

Gen10 doesn't automatically decode the clear color of sRGB buffers. To
get correct rendering, avoid fast-clearing such buffers for now.

The driver now passes the following piglit tests:
* spec@arb_framebuffer_srgb@msaa-fast-clear
* spec@ext_texture_srgb@multisample-fast-clear gl_ext_texture_srgb

Suggested-by: Kenneth Graunke <kenneth@whitecape.org>
Suggested-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agomeson: Fix overlinkage of dri3 loader
Dylan Baker [Fri, 1 Dec 2017 22:54:31 +0000 (14:54 -0800)]
meson: Fix overlinkage of dri3 loader

This was covering for underinkage elsewhere. With that fixed these can
be removed.

v2: - sort dependencies

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk> (v1)
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agomeson: fix underlinkage without dri3
Dylan Baker [Fri, 1 Dec 2017 22:51:11 +0000 (14:51 -0800)]
meson: fix underlinkage without dri3

There are some case where the dri3 loader is covering for underlinkage
for GLX and EGL, provide the linkage that they actually need.

v2: - remove dep_xcb_dri3 from glx. This was an oversight in v1 and is
      not needed.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk> (v1)
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agomeson: Reformat glx code to match more common style
Dylan Baker [Fri, 1 Dec 2017 22:46:42 +0000 (14:46 -0800)]
meson: Reformat glx code to match more common style

Generally in our meson build large arrays are formated in the form:
[
  ..., ..., ..., $
  ...,
]

So use that form

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoradv: fix a crash in radv_can_dump_shader()
Samuel Pitoiset [Mon, 4 Dec 2017 14:32:58 +0000 (15:32 +0100)]
radv: fix a crash in radv_can_dump_shader()

module can be NULL, oops.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agointel/isl: Declare private array as static const
Chad Versace [Wed, 29 Nov 2017 18:56:26 +0000 (10:56 -0800)]
intel/isl: Declare private array as static const

It's array isl_drm.c:modifier_info[] .

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agomeson: Install dri.pc file when building gallium dri drivers
Dylan Baker [Fri, 1 Dec 2017 22:01:40 +0000 (14:01 -0800)]
meson: Install dri.pc file when building gallium dri drivers

Currently this pkg-config file is only installed if a classic dri driver
is built. This is wrong, it should be installed if any dri driver is
installed, which includes the gallium dri target.

Reported-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoanv: query CS timestamp frequency from the kernel
Lionel Landwerlin [Mon, 4 Dec 2017 15:22:12 +0000 (15:22 +0000)]
anv: query CS timestamp frequency from the kernel

The reference value in gen_device_info isn't going to be acurate on
Gen10+. We should query it from the kernel, which reads a couple of
register to compute the actual value.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
6 years agoi965: read CS timestamp frequency from the kernel on Gen10+
Lionel Landwerlin [Mon, 6 Nov 2017 11:11:42 +0000 (11:11 +0000)]
i965: read CS timestamp frequency from the kernel on Gen10+

We cannot figure this value out of the PCI-id anymore. Let's read it
from the kernel (which computes this from a few registers).

When running on a (upcoming) 4.16-rc1+ kernel, this will fixes piglit
tests on CNL :

    spec@arb_timer_query@query gl_timestamp
    spec@arb_timer_query@timestamp-get
    spec@ext_timer_query@time-elapsed

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
6 years agodrm-uapi: Update drm/i915 headers from drm-next
Lionel Landwerlin [Mon, 4 Dec 2017 15:12:40 +0000 (15:12 +0000)]
drm-uapi: Update drm/i915 headers from drm-next

Taken from drm-next ca797d29cd63e7b71b4eea29aff3b1cefd1ecb59

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
6 years agoradv: Implement VK_KHR_get_surface_capabilities2
Jason Ekstrand [Fri, 17 Nov 2017 01:15:27 +0000 (17:15 -0800)]
radv: Implement VK_KHR_get_surface_capabilities2

The WSI core code does all the hard work.  Just add the wrappers and
turn it on.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: Initialize individual WSI interfaces in wsi_device_init
Jason Ekstrand [Thu, 16 Nov 2017 20:49:27 +0000 (12:49 -0800)]
vulkan/wsi: Initialize individual WSI interfaces in wsi_device_init

Now that we have anv_device_init/finish functions, there's no reason to
have the individual driver do any more work than that.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: Drop some unneeded cruft from the API
Jason Ekstrand [Thu, 16 Nov 2017 20:38:26 +0000 (12:38 -0800)]
vulkan/wsi: Drop some unneeded cruft from the API

This drops the unneeded callbacks struct as well as the queue_get_family
callback we were using before we'd pulled QueuePresent inside.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: Add wrappers for all of the surface queries
Jason Ekstrand [Thu, 16 Nov 2017 20:26:26 +0000 (12:26 -0800)]
vulkan/wsi: Add wrappers for all of the surface queries

This lets us move wsi_interface to wsi_common_private.h

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: Drop the can_handle_different_gpu parameter from get_support
Jason Ekstrand [Thu, 16 Nov 2017 20:05:35 +0000 (12:05 -0800)]
vulkan/wsi: Drop the can_handle_different_gpu parameter from get_support

Both anv and radv can handle prime now.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: Move wsi_swapchain to wsi_common_private.h
Jason Ekstrand [Thu, 16 Nov 2017 18:46:26 +0000 (10:46 -0800)]
vulkan/wsi: Move wsi_swapchain to wsi_common_private.h

The drivers no longer poke at this directly.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: Add a helper for AcquireNextImage
Jason Ekstrand [Thu, 16 Nov 2017 18:44:41 +0000 (10:44 -0800)]
vulkan/wsi: Add a helper for AcquireNextImage

Unfortunately, due to the fact that AcquireNextImage does not take a
queue, the ANV trick for triggering the fence won't work in general.  We
leave dealing with the fence up to the caller for now.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: move swapchain create/destroy to common code
Dave Airlie [Thu, 16 Nov 2017 02:02:04 +0000 (12:02 +1000)]
vulkan/wsi: move swapchain create/destroy to common code

v2 (Jason Ekstrand):
 - Rebase
 - Alter the names of the helpers to better match the vulkan entrypoints
 - Use the helpers in anv

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: Move prime blitting into queue_present
Jason Ekstrand [Thu, 16 Nov 2017 17:30:16 +0000 (09:30 -0800)]
vulkan/wsi: Move prime blitting into queue_present

This lets us save a QueueSubmit and it also makes prime a lot less
X11-specific.  Also, it means we can only wait on the semaphores once
instead of on every blit.

Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agovulkan/wsi: Move get_images into common code
Jason Ekstrand [Thu, 16 Nov 2017 17:56:37 +0000 (09:56 -0800)]
vulkan/wsi: Move get_images into common code

This moves bits out of all four corners (anv, radv, x11, wayland) and
into the wsi common code.  We also switch to using an outarray to ensure
we get our return code right.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agoanv/wsi: Enable prime support
Jason Ekstrand [Thu, 16 Nov 2017 19:56:00 +0000 (11:56 -0800)]
anv/wsi: Enable prime support

Now that we're using the same common code as radv, we get prime support
for free.  Just enable it.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agoanv/wsi: Use the common QueuePresent code
Jason Ekstrand [Thu, 16 Nov 2017 17:46:50 +0000 (09:46 -0800)]
anv/wsi: Use the common QueuePresent code

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: Set a proper pWaitDstStageMask on the dummy submit
Jason Ekstrand [Thu, 16 Nov 2017 17:18:48 +0000 (09:18 -0800)]
vulkan/wsi: Set a proper pWaitDstStageMask on the dummy submit

Neither mesa driver really cares, but we should set it none the less for
the sake of correctness.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: Only wait on semaphores on the first swapchain
Jason Ekstrand [Thu, 16 Nov 2017 17:07:58 +0000 (09:07 -0800)]
vulkan/wsi: Only wait on semaphores on the first swapchain

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: Refactor result handling in queue_present
Jason Ekstrand [Thu, 16 Nov 2017 16:59:21 +0000 (08:59 -0800)]
vulkan/wsi: Refactor result handling in queue_present

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agoradv/wsi: Move the guts of QueuePresent to wsi common
Dave Airlie [Thu, 16 Nov 2017 01:52:39 +0000 (11:52 +1000)]
radv/wsi: Move the guts of QueuePresent to wsi common

v2 (Jason Ekstrand):
 - Better comit message
 - Rebase
 - Re-indent to follow wsi_common style
 - Drop the unneeded _swapchain from the newly added helper
 - Make the clone more true to the original (as per the rebase)

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: Add a WSI_FROM_HANDLE macro
Jason Ekstrand [Thu, 16 Nov 2017 17:39:50 +0000 (09:39 -0800)]
vulkan/wsi: Add a WSI_FROM_HANDLE macro

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agoradv/wsi: drop allocate memory special case
Dave Airlie [Thu, 16 Nov 2017 01:03:22 +0000 (11:03 +1000)]
radv/wsi: drop allocate memory special case

Just check if image has scanout flag set

v2 (Jason Ekstrand):
 - Rebase
 - Also drop the now unused radv_mem_flag_bits enum

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: Do image creation in common code
Jason Ekstrand [Thu, 16 Nov 2017 06:30:20 +0000 (22:30 -0800)]
vulkan/wsi: Do image creation in common code

This uses the mock extension created in a previous commit to tell the
driver that the image it's just been asked to create is, in fact, a
window system image with whatever assumptions that implies.  There was a
lot of redundant code between the two drivers to do basically exactly
the same thing.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: Implement prime in a completely generic way
Jason Ekstrand [Thu, 16 Nov 2017 03:04:10 +0000 (19:04 -0800)]
vulkan/wsi: Implement prime in a completely generic way

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agoradv: Move wsi initialization later in physical_device_init
Jason Ekstrand [Sat, 18 Nov 2017 23:30:34 +0000 (15:30 -0800)]
radv: Move wsi initialization later in physical_device_init

We need it to happen after memory type setup so that we can query memory
types in wsi_device_init.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agoradv/image: Implement the wsi "extension"
Jason Ekstrand [Thu, 16 Nov 2017 16:27:01 +0000 (08:27 -0800)]
radv/image: Implement the wsi "extension"

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agoanv/image: Implement the wsi "extension"
Jason Ekstrand [Thu, 16 Nov 2017 06:11:46 +0000 (22:11 -0800)]
anv/image: Implement the wsi "extension"

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agoanv: Require a dedicated allocation for modified images
Jason Ekstrand [Tue, 28 Nov 2017 16:49:29 +0000 (08:49 -0800)]
anv: Require a dedicated allocation for modified images

This lets us set the BO tiling when we allocate the memory.  This is
required for GL to work properly.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agoanv/image: Add a drm_format_mod field
Jason Ekstrand [Tue, 28 Nov 2017 17:28:12 +0000 (09:28 -0800)]
anv/image: Add a drm_format_mod field

At the moment, this is always initialized to DRM_FORMAT_MOD_INVALID.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agoradv: Implement VK_EXT_external_memory_dma_buf
Jason Ekstrand [Tue, 28 Nov 2017 02:43:43 +0000 (18:43 -0800)]
radv: Implement VK_EXT_external_memory_dma_buf

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agoanv: Implement VK_EXT_external_memory_dma_buf
Jason Ekstrand [Tue, 28 Nov 2017 02:33:44 +0000 (18:33 -0800)]
anv: Implement VK_EXT_external_memory_dma_buf

This is a modified version of the patch originally sent by Chad Versace.
The primary difference is that this version claims that OPQAUE_FD and
DMA_BUF are compatible handle types.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: Add a mock image creation extension
Jason Ekstrand [Thu, 16 Nov 2017 06:11:23 +0000 (22:11 -0800)]
vulkan/wsi: Add a mock image creation extension

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: Add wsi_swapchain_init/finish functions
Jason Ekstrand [Thu, 16 Nov 2017 04:08:53 +0000 (20:08 -0800)]
vulkan/wsi: Add wsi_swapchain_init/finish functions

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: Add a wsi_device_init function
Jason Ekstrand [Thu, 16 Nov 2017 02:50:44 +0000 (18:50 -0800)]
vulkan/wsi: Add a wsi_device_init function

This gives the opportunity to collect some function pointers if we'd
like which will be very useful in future.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi/x11: Handle the geometry check earlier in create_swapchain
Jason Ekstrand [Thu, 16 Nov 2017 03:59:01 +0000 (19:59 -0800)]
vulkan/wsi/x11: Handle the geometry check earlier in create_swapchain

This fixes a potential leak if allocating the swapchain fails.  Since
geometry checking and bit-depth fetching is self-contained, it makes
sense to just do it first so we can delete the geometry reply.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: Add a wsi_image structure
Daniel Stone [Thu, 20 Jul 2017 10:51:48 +0000 (11:51 +0100)]
vulkan/wsi: Add a wsi_image structure

This is used to hold information about the allocated image, rather than
an ever-growing function argument list.

v2 (Jason Ekstrand):
 - Rename wsi_image_base to wsi_image

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agovulkan/wsi: use function ptr definitions from the spec.
Dave Airlie [Wed, 15 Nov 2017 22:46:41 +0000 (08:46 +1000)]
vulkan/wsi: use function ptr definitions from the spec.

This just seems cleaner, and we may expand this in future.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoi965: Emit CS stall before MEDIA_VFE_STATE.
Kenneth Graunke [Tue, 31 Oct 2017 16:57:54 +0000 (09:57 -0700)]
i965: Emit CS stall before MEDIA_VFE_STATE.

This fixes hangs on GFXBench 5's Aztec Ruins benchmark.

Unfortunately, it regresses OglCSCloth performance by about 10%. There
are some ideas for fixing that.

The Vulkan driver already emits this stall.

Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agoi965: Move PIPE_CONTROL defines and prototypes to brw_pipe_control.h.
Kenneth Graunke [Tue, 31 Oct 2017 17:02:02 +0000 (10:02 -0700)]
i965: Move PIPE_CONTROL defines and prototypes to brw_pipe_control.h.

We need to be able to emit PIPE_CONTROLs from genX_state_upload.c,
which can't safely include brw_defines.h because it conflicts with
genxml.  Move all the PIPE_CONTROL related stuff together into a
separate header.

Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agospirv: Replace unreachable with vtn_fail
Jason Ekstrand [Tue, 5 Sep 2017 22:46:58 +0000 (15:46 -0700)]
spirv: Replace unreachable with vtn_fail

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
6 years agospirv: Replace assert with vtn_assert
Jason Ekstrand [Thu, 17 Aug 2017 00:38:13 +0000 (17:38 -0700)]
spirv: Replace assert with vtn_assert

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
6 years agospirv: Add vtn_fail and vtn_assert helpers
Jason Ekstrand [Wed, 16 Aug 2017 23:15:23 +0000 (16:15 -0700)]
spirv: Add vtn_fail and vtn_assert helpers

These helpers are much nicer than just using assert because they don't
kill your process.  Instead, it longjmps back to spirv_to_nir(), cleans
up all the temporary memory, and nicely returns NULL.  While crashing is
completely OK in the Vulkan world, it's not considered to be quite so
nice in GL.  This should help us to make SPIR-V parsing much more
robust.  The one downside here is that vtn_assert is not compiled out in
release builds like assert() is so it isn't free.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>