platform/upstream/mesa.git
6 years agoglsl: fix gcc 8 parenthesis warning
Marc Dietrich [Fri, 23 Mar 2018 10:01:23 +0000 (11:01 +0100)]
glsl: fix gcc 8 parenthesis warning

fixes warnings like this:
[184/1137] Compiling C++ object 'src/compiler/glsl/glsl@sta/lower_jumps.cpp.o'.
In file included from ../src/mesa/main/mtypes.h:48,
                 from ../src/compiler/glsl_types.h:149,
                 from ../src/compiler/glsl/lower_jumps.cpp:59:
../src/compiler/glsl/lower_jumps.cpp: In member function '{anonymous}::block_record {anonymous}::ir_lower_jumps_visitor::visit_block(exec_list*)':
../src/compiler/glsl/list.h:650:17: warning: unnecessary parentheses in declaration of 'node' [-Wparentheses]
    for (__type *(__inst) = (__type *)(__list)->head_sentinel.next; \
                 ^
../src/compiler/glsl/lower_jumps.cpp:510:7: note: in expansion of macro 'foreach_in_list'
       foreach_in_list(ir_instruction, node, list) {
       ^~~~~~~~~~~~~~~

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agocompiler: int8/uint8 fixes
Rob Clark [Sun, 15 Apr 2018 16:02:37 +0000 (12:02 -0400)]
compiler: int8/uint8 fixes

A couple spots were missed for handling of the new INT8/UINT8 base type.

Also de-duplicate get_base_type().. get_scalar_type() had nearly the
same switch statement, with the exception that anything with base_type
that was not scalar would return error_type.  So just handle that one
special case in get_scalar_type().

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoradeonsi: don't emit partial flushes for internal CS flushes only
Marek Olšák [Sat, 7 Apr 2018 02:26:49 +0000 (22:26 -0400)]
radeonsi: don't emit partial flushes for internal CS flushes only

Tested-by: Benedikt Schemmer <ben@besd.de>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agowinsys/amdgpu: always set AMDGPU_IB_FLAG_TC_WB_NOT_INVALIDATE
Marek Olšák [Tue, 3 Apr 2018 18:55:02 +0000 (14:55 -0400)]
winsys/amdgpu: always set AMDGPU_IB_FLAG_TC_WB_NOT_INVALIDATE

There is a kernel patch that adds the new flag.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Benedikt Schemmer <ben@besd.de>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoradeonsi: implement mechanism for IBs without partial flushes at the end (v6)
Marek Olšák [Fri, 16 Jun 2017 12:25:34 +0000 (14:25 +0200)]
radeonsi: implement mechanism for IBs without partial flushes at the end (v6)

(This patch doesn't enable the behavior. It will be enabled in a later
commit.)

Draw calls from multiple IBs can be executed in parallel.

v2: do emit partial flushes on SI
v3: invalidate all shader caches at the beginning of IBs
v4: don't call si_emit_cache_flush in si_flush_gfx_cs if not needed,
    only do this for flushes invoked internally
v5: empty IBs should wait for idle if the flush requires it
v6: split the commit

If we artificially limit the number of draw calls per IB to 5, we'll get
a lot more IBs, leading to a lot more partial flushes. Let's see how
the removal of partial flushes changes GPU utilization in that scenario:

With partial flushes (time busy):
    CP: 99%
    SPI: 86%
    CB: 73:

Without partial flushes (time busy):
    CP: 99%
    SPI: 93%
    CB: 81%

Tested-by: Benedikt Schemmer <ben@besd.de>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agonir: fix ir_binop_gequal glsl_to_nir conversion
Erico Nunes [Sat, 14 Apr 2018 19:14:41 +0000 (21:14 +0200)]
nir: fix ir_binop_gequal glsl_to_nir conversion

ir_binop_gequal needs to be converted to nir_op_sge when native integers
are not supported in the driver.
Otherwise it becomes no different than ir_binop_less after the
conversion.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoanv,radv: Drop XML workarounds for VK_ANDROID_native_buffer
Jason Ekstrand [Mon, 16 Apr 2018 14:38:31 +0000 (07:38 -0700)]
anv,radv: Drop XML workarounds for VK_ANDROID_native_buffer

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agovulkan: Update the XML and headers to 1.1.73
Jason Ekstrand [Mon, 16 Apr 2018 14:32:03 +0000 (07:32 -0700)]
vulkan: Update the XML and headers to 1.1.73

Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agoradv: clean up radv_decompress_resolve_subpass_src()
Samuel Pitoiset [Fri, 13 Apr 2018 17:14:52 +0000 (19:14 +0200)]
radv: clean up radv_decompress_resolve_subpass_src()

To handle the source color image transitions in the same place.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Niuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: don't fast-clear eliminate after resolving a subpass with compute
Samuel Pitoiset [Fri, 13 Apr 2018 17:14:51 +0000 (19:14 +0200)]
radv: don't fast-clear eliminate after resolving a subpass with compute

That looks useless, and I think radv_handle_image_transition()
will do a fast-clear eliminate because it's called after the
resolve.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Niuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: handle CMASK/FMASK transitions only if DCC is disabled
Samuel Pitoiset [Fri, 13 Apr 2018 17:14:50 +0000 (19:14 +0200)]
radv: handle CMASK/FMASK transitions only if DCC is disabled

DCC implies a fast-clear eliminate, so I think this sounds
reasonable.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Niuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: merge radv_handle_{dcc,cmask}_image_transition() functions
Samuel Pitoiset [Fri, 13 Apr 2018 17:14:49 +0000 (19:14 +0200)]
radv: merge radv_handle_{dcc,cmask}_image_transition() functions

Into radv_handle_color_image_transition().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Niuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: add radv_init_color_image_metadata() helper
Samuel Pitoiset [Fri, 13 Apr 2018 17:14:48 +0000 (19:14 +0200)]
radv: add radv_init_color_image_metadata() helper

In order to separate initialization from decompression. In the
future, that will allow us to init DCC/FMASK/CMASK in one shot.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Niuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: make radv_initialise_cmask() static
Samuel Pitoiset [Fri, 13 Apr 2018 17:14:47 +0000 (19:14 +0200)]
radv: make radv_initialise_cmask() static

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Niuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: clean up radv_handle_image_transition() a bit
Samuel Pitoiset [Fri, 13 Apr 2018 17:14:46 +0000 (19:14 +0200)]
radv: clean up radv_handle_image_transition() a bit

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Niuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: add radv_handle_color_image_transition() helper
Samuel Pitoiset [Fri, 13 Apr 2018 17:14:45 +0000 (19:14 +0200)]
radv: add radv_handle_color_image_transition() helper

To handle CMASK, FMASK and DCC transitions in the same place.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Niuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: handle DCC image transitions before CMASK/FMASK transitions
Samuel Pitoiset [Fri, 13 Apr 2018 17:14:44 +0000 (19:14 +0200)]
radv: handle DCC image transitions before CMASK/FMASK transitions

Mostly because DCC implies a fast-clear eliminate and we
should be able to skip some DCC decompressions by setting
a predicate like for CMASK and FMASK.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Niuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: disable prediction only if it has been enabled
Samuel Pitoiset [Fri, 13 Apr 2018 17:14:43 +0000 (19:14 +0200)]
radv: disable prediction only if it has been enabled

When decompressing DCC we don't enable it, so it's useless
to disable it. This reduces the number of prediction packets
sent to the GPU when performing color decompression passes.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Niuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoac/nir: Make the GFX9 buffer size fix apply to image loads/atomics too.
Bas Nieuwenhuizen [Sun, 15 Apr 2018 22:09:39 +0000 (00:09 +0200)]
ac/nir: Make the GFX9 buffer size fix apply to image loads/atomics too.

No clue how I missed those ...

Fixes: 4503ff760c "ac/nir: Add workaround for GFX9 buffer views."
CC: <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105320
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agogallium/osmesa: link with winsock2 library on Windows
Brian Paul [Fri, 13 Apr 2018 21:34:23 +0000 (15:34 -0600)]
gallium/osmesa: link with winsock2 library on Windows

To fix the MSVC build.  The build broke because we started to compile
the ddebug code on Windows after the mtypes.h changes.  Building ddebug
caused us to also use the u_network.c code for the first time.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agogallium/util: put (void) in a few function signatures
Brian Paul [Fri, 13 Apr 2018 21:33:39 +0000 (15:33 -0600)]
gallium/util: put (void) in a few function signatures

To match the header file.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agoddebug: add PIPE_OS_UNIX/LINUX checks to fix MSVC build
Brian Paul [Fri, 13 Apr 2018 21:32:48 +0000 (15:32 -0600)]
ddebug: add PIPE_OS_UNIX/LINUX checks to fix MSVC build

Don't include Unix headers or use Unix functions when building with MSVC.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agomesa: protect #include of unistd.h with _MSV_VER check
Brian Paul [Fri, 13 Apr 2018 21:31:49 +0000 (15:31 -0600)]
mesa: protect #include of unistd.h with _MSV_VER check

unistd.h is unix only.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agomesa: remove unused 'i' in dimensions_error_check()
Brian Paul [Fri, 13 Apr 2018 21:31:20 +0000 (15:31 -0600)]
mesa: remove unused 'i' in dimensions_error_check()

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoradeonsi: restore si_emit_cache_flush call at the end of IBs
Marek Olšák [Sat, 14 Apr 2018 00:04:04 +0000 (20:04 -0400)]
radeonsi: restore si_emit_cache_flush call at the end of IBs

Fixes: 918b798668c "radeonsi: make sure CP DMA is idle at the end of IBs"

6 years agoradv: enable subgroup capabilities
Daniel Schürmann [Tue, 6 Mar 2018 14:05:13 +0000 (15:05 +0100)]
radv: enable subgroup capabilities

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoac: handle subgroup intrinsics
Daniel Schürmann [Tue, 6 Mar 2018 14:04:29 +0000 (15:04 +0100)]
ac: handle subgroup intrinsics

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoac: add LLVM build functions for subgroup instrinsics
Daniel Schürmann [Tue, 6 Mar 2018 14:03:36 +0000 (15:03 +0100)]
ac: add LLVM build functions for subgroup instrinsics

Co-authored-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoac: make ballot and umsb capable of 64bit inputs
Daniel Schürmann [Wed, 28 Feb 2018 19:26:03 +0000 (20:26 +0100)]
ac: make ballot and umsb capable of 64bit inputs

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agonir: lower 64bit subgroup shuffle intrinsics
Daniel Schürmann [Tue, 10 Apr 2018 14:07:27 +0000 (16:07 +0200)]
nir: lower 64bit subgroup shuffle intrinsics

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agonir/spirv: Fix warning and add missing breaks.
Daniel Schürmann [Tue, 10 Apr 2018 10:02:44 +0000 (12:02 +0200)]
nir/spirv: Fix warning and add missing breaks.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agonir: use ballot_bit_size when lowering ballot_bitfield_extract
Daniel Schürmann [Fri, 13 Apr 2018 13:05:24 +0000 (15:05 +0200)]
nir: use ballot_bit_size when lowering ballot_bitfield_extract

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agonir: subgroups instructions for 64bit ballot sizes
Daniel Schürmann [Fri, 13 Apr 2018 13:04:16 +0000 (15:04 +0200)]
nir: subgroups instructions for 64bit ballot sizes

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoglsl: #undef THIS macro to fix MSVC build
Brian Paul [Fri, 13 Apr 2018 15:56:33 +0000 (09:56 -0600)]
glsl: #undef THIS macro to fix MSVC build

THIS is a macro in one of the MSVC header files.  It's also a token
in the GLSL lexer.  This causes a compilation failure with MSVC.
This issue seems to be newly exposed after the recent mtypes.h removal
patches.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
6 years agoglsl: rename 'interface' var to 'iface' to fix MSVC build
Brian Paul [Fri, 13 Apr 2018 15:38:16 +0000 (09:38 -0600)]
glsl: rename 'interface' var to 'iface' to fix MSVC build

The recent mtypes.h removal patches seems to have exposed a MSVC
issue where 'interface' is defined as a macro in an MSVC header file.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
6 years agomesa: remove snprintf macro in imports.h to fix MSVC build
Brian Paul [Fri, 13 Apr 2018 15:32:31 +0000 (09:32 -0600)]
mesa: remove snprintf macro in imports.h to fix MSVC build

snprintf is a macro in the MSVC stdio.h header and we needed to
include that header before imports.h where we also defined an
snprintf macro.  Otherwise, the MSVC build would fail.  The recent
mtypes.h removal patches seems to have exposed this issue.

This patch simply removes our snprintf macro and replaces one use
of it in teximage.c with _mesa_snprintf().  There are other calls
to snprintf() in DRI drivers, but none of them are built on Windows.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
6 years agoanv: fix number of planes for depth & stencil
Lionel Landwerlin [Thu, 12 Apr 2018 18:06:47 +0000 (11:06 -0700)]
anv: fix number of planes for depth & stencil

We're not counting correctly with depth & stencil images.

Additionally we need to move an assert that is meant just for color
attachments.

v2: Move an assert() (Reported by Craig)
    Change aspect mask checks (Francesco)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: a62a97933578a ("anv: enable multiple planes per image/imageView")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105994
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agogallium: move ddebug, noop, rbug, trace to auxiliary to improve build times
Marek Olšák [Sat, 7 Apr 2018 18:01:12 +0000 (14:01 -0400)]
gallium: move ddebug, noop, rbug, trace to auxiliary to improve build times

which also simplifies the build scripts.

6 years agoradeonsi: make sure CP DMA is idle at the end of IBs
Marek Olšák [Thu, 5 Apr 2018 21:54:39 +0000 (17:54 -0400)]
radeonsi: make sure CP DMA is idle at the end of IBs

6 years agogallium/hud: add a simple HUD view that only draws text
Marek Olšák [Wed, 4 Apr 2018 22:20:53 +0000 (18:20 -0400)]
gallium/hud: add a simple HUD view that only draws text

Add this prefix to the env var: "simple," For example:
    GALLIUM_HUD=simple,fps

The X coordinates are the same, but the Y coordinates are different, because
there is only text.

'+' happens to behave the same as "\n".
',' happens to behave the same as "\n\n".

6 years agomesa: Include unistd.h in program_lexer
Dylan Baker [Fri, 13 Apr 2018 16:01:29 +0000 (09:01 -0700)]
mesa: Include unistd.h in program_lexer

Which was previously provided implicitly by mtypes.h

CC: Marek Olšák <marek.olsak@amd.com>
CC: Mark Janes <mark.a.janes@intel.com>
Fixes: 43d66c8c2d4d3d4dee1309856b6ce6c5393682e5
       ("mesa: include mtypes.h less")
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agoradeonsi: always prefetch later shaders after the draw packet
Marek Olšák [Tue, 3 Apr 2018 01:08:05 +0000 (21:08 -0400)]
radeonsi: always prefetch later shaders after the draw packet

so that the draw is started as soon as possible.

v2: only prefetch the API VS and VBO descriptors

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradeonsi: emit shader pointers before cache flushes & waits
Marek Olšák [Tue, 3 Apr 2018 00:43:23 +0000 (20:43 -0400)]
radeonsi: emit shader pointers before cache flushes & waits

This code was written with the constant engine in mind.
We can simplify it now.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradeonsi/gfx9: don't use the workaround for gather4 + stencil
Marek Olšák [Tue, 3 Apr 2018 19:20:04 +0000 (15:20 -0400)]
radeonsi/gfx9: don't use the workaround for gather4 + stencil

it doesn't seem to be needed.

Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradeonsi: disable TC-compat HTILE on Tonga and Iceland
Marek Olšák [Tue, 3 Apr 2018 23:32:12 +0000 (19:32 -0400)]
radeonsi: disable TC-compat HTILE on Tonga and Iceland

Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradeonsi: force 2D tiling on VI only when TC-compat HTILE is really enabled
Marek Olšák [Tue, 3 Apr 2018 23:22:24 +0000 (19:22 -0400)]
radeonsi: force 2D tiling on VI only when TC-compat HTILE is really enabled

just pass the flag that indicates it.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradeonsi: don't flush HTILE if there is no HTILE clear
Marek Olšák [Wed, 28 Mar 2018 01:19:15 +0000 (21:19 -0400)]
radeonsi: don't flush HTILE if there is no HTILE clear

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradeonsi: merge 2 identical if statements in si_clear
Marek Olšák [Wed, 28 Mar 2018 01:57:26 +0000 (21:57 -0400)]
radeonsi: merge 2 identical if statements in si_clear

and other cleanups

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradeonsi: don't do GFX-specific texture decompression for compute
Marek Olšák [Tue, 3 Apr 2018 01:30:41 +0000 (21:30 -0400)]
radeonsi: don't do GFX-specific texture decompression for compute

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradeonsi: simplify generating the renderer string
Marek Olšák [Thu, 29 Mar 2018 14:40:30 +0000 (10:40 -0400)]
radeonsi: simplify generating the renderer string

HAVE_LLVM > 0 is a tautology.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agowinsys/amdgpu: allow local BOs on APUs
Marek Olšák [Wed, 28 Mar 2018 00:46:18 +0000 (20:46 -0400)]
winsys/amdgpu: allow local BOs on APUs

Local BOs ignore BO priorities, and we don't need those on APUs.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agogetteximage: assume texture image is empty for non defined levels
Juan A. Suarez Romero [Thu, 12 Apr 2018 15:56:48 +0000 (15:56 +0000)]
getteximage: assume texture image is empty for non defined levels

Current code is returning an INVALID_OPERATION when trying to use
getTextureImage() on a level that has not been explicitly defined.

That is, we define a mipmapped Texture2D with 3 levels, and try to use
GetTextureImage() for the 4th levels, and INVALID_OPERATION is returned.

Nevertheless, such case is not listed as an error in OpenGL 4.6 spec,
section 8.11.4 ("Texture Image Queries"), where all the case errors for
this function are defined. So it seems this is a valid operation.

On the other hand, in section 8.22 ("Texture State and Proxy State") it
states:

  "Each initial texture image is null. It has zero width, height, and
   depth, internal format RGBA, or R8 for buffer textures, component
   sizes set to zero and component types set to NONE, the compressed
   flag set to FALSE, a zero compressed size, and the bound buffer
   object name is zero."

We can assume that we are reading this initialized empty image when
calling GetTextureImage() with a non defined level.

With this assumption, we will reach one of the other error cases defined
for the functions. In the end this means that we would end up returning
INVALID_VALUE to the caller.

This fixes arb_get_texture_sub_image piglit tests.

v2: just return INVALID_VALUE if there is no defined level (Iago)

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
6 years agogettextureimage: verify cube map is complete
Juan A. Suarez Romero [Thu, 5 Apr 2018 09:00:46 +0000 (09:00 +0000)]
gettextureimage: verify cube map is complete

According to OpenGL 4.6 spec, section 8.11.4 ("Texture Image Queries"),
relative to errors for GetTexImage, GetTextureImage, and GetnTexImage:

  "An INVALID_OPERATION error is generated by GetTextureImage if the
   effective target is TEXTURE_CUBE_MAP or TEXTURE_CUBE_MAP_ARRAY, and
   the texture object is not cube complete or cube array complete,
   respectively."

This fixes arb_get_texture_sub_image piglit tests.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
6 years agogettextsubimage: verify zoffset and depth are correct
Juan A. Suarez Romero [Thu, 5 Apr 2018 08:48:26 +0000 (08:48 +0000)]
gettextsubimage: verify zoffset and depth are correct

According to OpenGL 4.6 spec, section 8.11.4 ("Texture Image Queries"),
relative to errors for GetTextureSubImage() function:

  "An INVALID_VALUE error is generated if the effective target is
   TEXTURE_1D and either yoffset is not zero, or height is not one.

   An INVALID_VALUE error is generated if the effective target is
   TEXTURE_1D, TEXTURE_1D_ARRAY, TEXTURE_2D or TEXTURE_RECTANGLE, and
   either zoffset is not zero, or depth is not one."

The commit fixes the check for height and depth.

This fixes arb_get_texture_sub_image piglit tests.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
6 years agomesa: free debug messages when destroying the debug state
Timothy Arceri [Fri, 13 Apr 2018 05:23:57 +0000 (15:23 +1000)]
mesa: free debug messages when destroying the debug state

Fixes: 04a8baad3721 "mesa: refactor _mesa_PopDebugGroup and _mesa_free_errors_data"

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98281

6 years agomesa: fix x86 builds
Timothy Arceri [Fri, 13 Apr 2018 12:11:13 +0000 (22:11 +1000)]
mesa: fix x86 builds

Fixes: 43d66c8c2d4d "mesa: include mtypes.h less"

6 years agoFix make check
Marek Olšák [Fri, 13 Apr 2018 00:03:12 +0000 (20:03 -0400)]
Fix make check

6 years agoFix scons build
Marek Olšák [Thu, 12 Apr 2018 23:54:36 +0000 (19:54 -0400)]
Fix scons build

6 years agomesa: include mtypes.h less
Marek Olšák [Sun, 8 Apr 2018 17:13:08 +0000 (13:13 -0400)]
mesa: include mtypes.h less

- remove mtypes.h from most header files
- add main/menums.h for often used definitions
- remove main/core.h

v2: fix radv build

Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agomesa: include dispatch.h less
Marek Olšák [Sun, 8 Apr 2018 19:24:26 +0000 (15:24 -0400)]
mesa: include dispatch.h less

Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agoradv: Implement VK_EXT_vertex_attribute_divisor.
Bas Nieuwenhuizen [Sun, 8 Apr 2018 08:15:21 +0000 (10:15 +0200)]
radv: Implement VK_EXT_vertex_attribute_divisor.

Pretty straight forward, just pass the divisors through the shader
key and then do a LLVM divide.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agoac/surface: Allow S swizzle for displayable surfaces.
Bas Nieuwenhuizen [Wed, 11 Apr 2018 00:10:29 +0000 (02:10 +0200)]
ac/surface: Allow S swizzle for displayable surfaces.

For dcn1 && < 64 bpp displayable surfaces, addrlib only accepts
S swizzles.

At the same time addrlib prefers D swizzles is allowed, so we can
just allow S swizzles as fallback.

Fixes: b64b712558 "ac/surface/gfx9: request desired micro tile mode explicitly"
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agobroadcom/vc5: Fix a stray '`' in a comment.
Eric Anholt [Wed, 11 Apr 2018 23:28:07 +0000 (16:28 -0700)]
broadcom/vc5: Fix a stray '`' in a comment.

6 years agobroadcom/vc5: Update the UABI for in/out syncobjs
Eric Anholt [Wed, 4 Apr 2018 16:59:18 +0000 (09:59 -0700)]
broadcom/vc5: Update the UABI for in/out syncobjs

This is the ABI I'm hoping to stabilize for merging the driver.  seqnos
are eliminated, which allows for the GPU scheduler to task-switch between
DRM fds even after submission to the kernel.  In/out sync objects are
introduced, to allow the Android fencing extension (not yet implemented,
but should be trivial), and to also allow the driver to tell the kernel to
not start a bin until a previous render is complete.

6 years agobroadcom/vc5: Drop the finished_seqno optimization.
Eric Anholt [Wed, 4 Apr 2018 16:58:23 +0000 (09:58 -0700)]
broadcom/vc5: Drop the finished_seqno optimization.

With the DRM scheduler changes, I'm about to remove all seqnos from the
UABI.

6 years agobroadcom/vc5: Drop the throttling code.
Eric Anholt [Wed, 4 Apr 2018 16:57:51 +0000 (09:57 -0700)]
broadcom/vc5: Drop the throttling code.

Since I'll be using the DRM scheduler, we won't run into the problem of a
runaway client starving other clients of GPU time.

6 years agobroadcom/vc5: Move flush_last_load into load_general, like for stores.
Eric Anholt [Fri, 30 Mar 2018 23:50:23 +0000 (16:50 -0700)]
broadcom/vc5: Move flush_last_load into load_general, like for stores.

This should avoid mistakes with not flushing as we change the series of
loads.  Already, it fixes a hopefully unreachable case where we were
emitting just the TILE_COORDINATES and not the dummy store that needs to
go with it.

6 years agobroadcom/vc5: Rename read_but_not_cleared to loads_pending.
Eric Anholt [Fri, 30 Mar 2018 23:53:39 +0000 (16:53 -0700)]
broadcom/vc5: Rename read_but_not_cleared to loads_pending.

This is a more obvious name for what the variable means, and matches what
it's called for stores.

6 years agobroadcom/vc5: Refactor the implicit coords/stores_pending logic.
Eric Anholt [Fri, 30 Mar 2018 23:43:51 +0000 (16:43 -0700)]
broadcom/vc5: Refactor the implicit coords/stores_pending logic.

Since I just fixed a bug due to forgetting to do these right, do it once
in the helper func.

6 years agobroadcom/vc5: Emit missing TILE_COORDINATES_IMPLICIT in separate z/s stores.
Eric Anholt [Fri, 30 Mar 2018 23:39:14 +0000 (16:39 -0700)]
broadcom/vc5: Emit missing TILE_COORDINATES_IMPLICIT in separate z/s stores.

Fixes a simulator assertion failure in
KHR-GLES3.packed_depth_stencil.blit.depth32f_stencil8

6 years agobroadcom/vc5: Add checks that we don't try to do raw Z+S load/stores.
Eric Anholt [Fri, 30 Mar 2018 23:31:07 +0000 (16:31 -0700)]
broadcom/vc5: Add checks that we don't try to do raw Z+S load/stores.

This was dying in the simulator on
GTF-GLES3.gtf.GL3Tests.packed_depth_stencil.packed_depth_stencil_blit.
We'll need to do basically the same thing as Z32F/S8 does in the MSAA
Z24S8 case.

6 years agobroadcom/vc5: Fix MSAA depth/stencil size setup.
Eric Anholt [Fri, 30 Mar 2018 23:14:29 +0000 (16:14 -0700)]
broadcom/vc5: Fix MSAA depth/stencil size setup.

The v3dX(get_internal_type_bpp_for_output_format)() call only handles
color output formats (which overlap in enum numbers with depth output
formats), so for depth we just need to take the normal cpp times the
number of samples.

6 years agost/va: add VP9 config to enable profile2
Leo Liu [Wed, 14 Mar 2018 21:13:46 +0000 (17:13 -0400)]
st/va: add VP9 config to enable profile2

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agoradeonsi: use PIPE_FORMAT_P016 format for VP9 profile2
Leo Liu [Wed, 14 Mar 2018 21:09:46 +0000 (17:09 -0400)]
radeonsi: use PIPE_FORMAT_P016 format for VP9 profile2

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agoradeon/vcn: add VP9 profile2 support
Leo Liu [Thu, 15 Mar 2018 15:55:27 +0000 (11:55 -0400)]
radeon/vcn: add VP9 profile2 support

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agovl: add VP9 profile2 support
Leo Liu [Wed, 14 Mar 2018 20:59:20 +0000 (16:59 -0400)]
vl: add VP9 profile2 support

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agost/va: add VP9 config to enable profile0
Leo Liu [Wed, 14 Mar 2018 20:56:25 +0000 (16:56 -0400)]
st/va: add VP9 config to enable profile0

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agost/va: parse VP9 uncompressed frame header
Leo Liu [Wed, 14 Mar 2018 20:47:26 +0000 (16:47 -0400)]
st/va: parse VP9 uncompressed frame header

To get some of UVD required parameters.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agost/va: add slice parameter handling for VP9
Leo Liu [Wed, 14 Mar 2018 20:27:18 +0000 (16:27 -0400)]
st/va: add slice parameter handling for VP9

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agost/va: add picture parameter handling for VP9
Leo Liu [Wed, 14 Mar 2018 19:57:48 +0000 (15:57 -0400)]
st/va: add picture parameter handling for VP9

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agost/va: add handles for VP9 buffers
Leo Liu [Wed, 14 Mar 2018 19:55:00 +0000 (15:55 -0400)]
st/va: add handles for VP9 buffers

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agost/va: add VP9 picture to context
Leo Liu [Wed, 14 Mar 2018 19:31:04 +0000 (15:31 -0400)]
st/va: add VP9 picture to context

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agoradeonsi: cap VP9 support to progressive buffer
Leo Liu [Wed, 14 Mar 2018 19:29:04 +0000 (15:29 -0400)]
radeonsi: cap VP9 support to progressive buffer

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agoradeonsi: cap VP9 support to Raven
Leo Liu [Wed, 14 Mar 2018 19:27:01 +0000 (15:27 -0400)]
radeonsi: cap VP9 support to Raven

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agoradeon/vcn: add VP9 context buffer
Leo Liu [Wed, 14 Mar 2018 19:09:07 +0000 (15:09 -0400)]
radeon/vcn: add VP9 context buffer

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agoradeon/vcn: get VP9 msg buffer
Leo Liu [Thu, 15 Mar 2018 17:14:58 +0000 (13:14 -0400)]
radeon/vcn: get VP9 msg buffer

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agoradeon/vcn: fill probability table to prob buffers
Leo Liu [Thu, 15 Mar 2018 17:10:46 +0000 (13:10 -0400)]
radeon/vcn: fill probability table to prob buffers

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agoradeon/vcn: add VP9 message buffer interface
Leo Liu [Wed, 14 Mar 2018 17:25:11 +0000 (13:25 -0400)]
radeon/vcn: add VP9 message buffer interface

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agoradeon/vcn: add VP9 prob table buffer
Leo Liu [Wed, 14 Mar 2018 16:48:22 +0000 (12:48 -0400)]
radeon/vcn: add VP9 prob table buffer

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agovl: add VP9 probability tables
Leo Liu [Tue, 13 Mar 2018 18:35:40 +0000 (14:35 -0400)]
vl: add VP9 probability tables

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agoradeon/vcn: add VP9 dpb buffer size
Leo Liu [Tue, 13 Mar 2018 13:42:57 +0000 (09:42 -0400)]
radeon/vcn: add VP9 dpb buffer size

The current FW has restricted the size to the worse case,
and the new dynamic dpb buffer support is on the way from
firmware side, we will change accordingly.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agoradeon/vcn: add VP9 stream type for decoder
Leo Liu [Tue, 13 Mar 2018 13:40:15 +0000 (09:40 -0400)]
radeon/vcn: add VP9 stream type for decoder

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agovl: add VP9 picture description
Leo Liu [Tue, 13 Mar 2018 13:39:20 +0000 (09:39 -0400)]
vl: add VP9 picture description

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agovl: add VP9 profile0 and format
Leo Liu [Tue, 13 Mar 2018 13:06:17 +0000 (09:06 -0400)]
vl: add VP9 profile0 and format

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
6 years agoradv: fix radv_layout_dcc_compressed() when image doesn't have DCC
Samuel Pitoiset [Wed, 11 Apr 2018 19:34:43 +0000 (21:34 +0200)]
radv: fix radv_layout_dcc_compressed() when image doesn't have DCC

num_dcc_levels means that DCC is supported, but this doesn't
mean that it's enabled by the driver. Instead, we should rely
on radv_image_has_dcc().

This fixes some multisample regressions since 0babc8e5d66
("radv: fix picking the method for resolve subpass") on Vega.
This is because the resolve method changed from HW to FS, but
those fails are totally unexpected, so there might some
differences between Polaris and Vega here.

Fixes: 44fcf587445 ("radv: Disable DCC for GENERAL layout and compute transfer dest.")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: add radv_decompress_resolve_{subpass}_src() helpers
Samuel Pitoiset [Wed, 11 Apr 2018 12:09:16 +0000 (14:09 +0200)]
radv: add radv_decompress_resolve_{subpass}_src() helpers

This helper shares common code before resolving using either
a fragment or a compute shader.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: add radv_init_dcc_control_reg() helper
Samuel Pitoiset [Wed, 11 Apr 2018 12:09:15 +0000 (14:09 +0200)]
radv: add radv_init_dcc_control_reg() helper

And add some comments.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoglsl: fix compat shaders in GLSL 1.40
Timothy Arceri [Wed, 11 Apr 2018 23:23:02 +0000 (09:23 +1000)]
glsl: fix compat shaders in GLSL 1.40

The compatibility and core tokens were not added until GLSL 1.50,
for GLSL 1.40 just assume all shaders built with a compat profile
are compat shaders.

Fixes rendering issues in Dawn of War II on radeonsi which has
enabled OpenGL 3.1 compat support.

Fixes: a0c8b49284ef "mesa: enable OpenGL 3.1 with ARB_compatibility"

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105807

6 years agomesa: Silence remaining unused parameter warnings in teximage.c
Ian Romanick [Tue, 27 Feb 2018 19:34:43 +0000 (11:34 -0800)]
mesa: Silence remaining unused parameter warnings in teximage.c

src/mesa/main/teximage.c: In function ‘_mesa_test_proxy_teximage’:
src/mesa/main/teximage.c:1301:51: warning: unused parameter ‘level’ [-Wunused-parameter]
                           GLuint numLevels, GLint level,
                                                   ^~~~~
src/mesa/main/teximage.c: In function ‘texsubimage_error_check’:
src/mesa/main/teximage.c:2186:30: warning: unused parameter ‘dsa’ [-Wunused-parameter]
                         bool dsa, const char *callerName)
                              ^~~
src/mesa/main/teximage.c: In function ‘copytexture_error_check’:
src/mesa/main/teximage.c:2297:32: warning: unused parameter ‘width’ [-Wunused-parameter]
                          GLint width, GLint height, GLint border )
                                ^~~~~
src/mesa/main/teximage.c:2297:45: warning: unused parameter ‘height’ [-Wunused-parameter]
                          GLint width, GLint height, GLint border )
                                             ^~~~~~
src/mesa/main/teximage.c: In function ‘check_rtt_cb’:
src/mesa/main/teximage.c:2679:21: warning: unused parameter ‘key’ [-Wunused-parameter]
 check_rtt_cb(GLuint key, void *data, void *userData)
                     ^~~
src/mesa/main/teximage.c: In function ‘override_internal_format’:
src/mesa/main/teximage.c:2756:55: warning: unused parameter ‘width’ [-Wunused-parameter]
 override_internal_format(GLenum internalFormat, GLint width, GLint height)
                                                       ^~~~~
src/mesa/main/teximage.c:2756:68: warning: unused parameter ‘height’ [-Wunused-parameter]
 override_internal_format(GLenum internalFormat, GLint width, GLint height)
                                                                    ^~~~~~
src/mesa/main/teximage.c: In function ‘texture_sub_image’:
src/mesa/main/teximage.c:3293:24: warning: unused parameter ‘dsa’ [-Wunused-parameter]
                   bool dsa)
                        ^~~
src/mesa/main/teximage.c: In function ‘can_avoid_reallocation’:
src/mesa/main/teximage.c:3788:53: warning: unused parameter ‘x’ [-Wunused-parameter]
                        mesa_format texFormat, GLint x, GLint y, GLsizei width,
                                                     ^
src/mesa/main/teximage.c:3788:62: warning: unused parameter ‘y’ [-Wunused-parameter]
                        mesa_format texFormat, GLint x, GLint y, GLsizei width,
                                                              ^
src/mesa/main/teximage.c: In function ‘valid_texstorage_ms_parameters’:
src/mesa/main/teximage.c:5987:40: warning: unused parameter ‘samples’ [-Wunused-parameter]
                                GLsizei samples, unsigned dims)
                                        ^~~~~~~

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agomesa: Silence unused parameter warning in compressedteximage_only_format
Ian Romanick [Tue, 27 Feb 2018 19:24:44 +0000 (11:24 -0800)]
mesa: Silence unused parameter warning in compressedteximage_only_format

Passing ctx to compressedteximage_only_format was the only use of the
ctx parameter in _mesa_format_no_online_compression, so that parameter
had to go too.

../../SOURCE/master/src/mesa/main/teximage.c: In function ‘compressedteximage_only_format’:
../../SOURCE/master/src/mesa/main/teximage.c:1355:57: warning: unused parameter ‘ctx’ [-Wunused-parameter]
 compressedteximage_only_format(const struct gl_context *ctx, GLenum format)
                                                         ^~~

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>