mesa.git
6 years agomeson: use correct keyword to fix a meson warning
Jon Turney [Thu, 2 Aug 2018 13:50:27 +0000 (14:50 +0100)]
meson: use correct keyword to fix a meson warning

With a sufficently recent meson, the following warning is produced:

WARNING: Passed invalid keyword argument "extra_args".
WARNING: This will become a hard error in the future.

It seems that compiler.links(args:) is meant here.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-and-Tested-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agodocs: add 18.3.0-devel release notes template
Andres Gomez [Thu, 2 Aug 2018 15:15:33 +0000 (18:15 +0300)]
docs: add 18.3.0-devel release notes template

Signed-off-by: Andres Gomez <agomez@igalia.com>
6 years agomesa: bump version to 18.3.0-devel
Andres Gomez [Thu, 2 Aug 2018 15:00:01 +0000 (18:00 +0300)]
mesa: bump version to 18.3.0-devel

Signed-off-by: Andres Gomez <agomez@igalia.com>
6 years agoegl/main: fix indentation
Eric Engestrom [Thu, 2 Aug 2018 10:56:13 +0000 (11:56 +0100)]
egl/main: fix indentation

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
6 years agoloader: fix indentation
Eric Engestrom [Thu, 2 Aug 2018 10:49:40 +0000 (11:49 +0100)]
loader: fix indentation

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
6 years agoswr: Remove unnecessary memset call
Vlad Golovkin [Wed, 1 Aug 2018 17:56:23 +0000 (20:56 +0300)]
swr: Remove unnecessary memset call

Zeroing memory after calloc is not necessary. This also allows to avoid
possible crash when allocation fails, because memset is called before
checking screen for NULL.

Fixes: a29d63ecf71546c4798c6 "swr: refactor swr_create_screen to allow
                              for proper cleanup on error"
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomesa: replace binary constants with hexadecimal constants
Andres Gomez [Wed, 1 Aug 2018 14:16:24 +0000 (17:16 +0300)]
mesa: replace binary constants with hexadecimal constants

The binary constant notation "0b" is a GCC extension. Instead, we use
hexadecimal notation to fix the MSVC 2013 build:

Compiling src\mesa\main\texcompress_astc.cpp ...
texcompress_astc.cpp
src\mesa\main\texcompress_astc.cpp(111) : error C2059: syntax error : 'bad suffix on number'

...

src\mesa\main\texcompress_astc.cpp(1007) : fatal error C1003: error count exceeds 100; stopping compilation
scons: *** [build\windows-x86-debug\mesa\main\texcompress_astc.obj] Error 2
scons: building terminated because of errors.

v2: Fix wrong conversion (Ilia).

Fixes: 38ab39f6501 ("mesa: add ASTC 2D LDR decoder")
Cc: Marek Olšák <marek.olsak@amd.com>
Cc: Brian Paul <brianp@vmware.com>
Cc: Roland Scheidegger <sroland@vmware.com>
Cc: Mike Lothian <mike@fireburn.co.uk>
Cc: Gert Wollny <gert.wollny@collabora.com>
Cc: Dieter Nützel <Dieter@nuetzel-hh.de>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoddebug: use util_snprintf() in dd_get_debug_filename_and_mkdir
Andres Gomez [Wed, 1 Aug 2018 13:26:48 +0000 (16:26 +0300)]
ddebug: use util_snprintf() in dd_get_debug_filename_and_mkdir

Instead of plain snprintf(). To fix the MSVC 2013 build:

  Compiling src\gallium\auxiliary\driver_ddebug\dd_draw.c ...
dd_draw.c
c:\projects\mesa\src\gallium\auxiliary\driver_ddebug\dd_util.h(60) : warning C4013: 'snprintf' undefined; assuming extern returning int

...

gallium.lib(dd_draw.obj) : error LNK2001: unresolved external symbol _snprintf
build\windows-x86-debug\gallium\targets\graw-gdi\graw.dll : fatal error LNK1120: 1 unresolved externals
scons: *** [build\windows-x86-debug\gallium\targets\graw-gdi\graw.dll] Error 1120
scons: building terminated because of errors.

Fixes: 6ff0c6f4ebc ("gallium: move ddebug, noop, rbug, trace to auxiliary to improve build times")
Cc: Marek Olšák <marek.olsak@amd.com>
Cc: Brian Paul <brianp@vmware.com>
Cc: Roland Scheidegger <sroland@vmware.com>
Cc: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agokutil/queue: use util_snprintf() in util_queue_init
Andres Gomez [Wed, 1 Aug 2018 12:55:51 +0000 (15:55 +0300)]
kutil/queue: use util_snprintf() in util_queue_init

Instead of plain snprintf(). To fix the MSVC 2013 build:

  Compiling src\util\u_queue.c ...
u_queue.c
src\util\u_queue.c(325) : warning C4013: 'snprintf' undefined; assuming extern returning int

...

mesautil.lib(u_queue.obj) : error LNK2001: unresolved external symbol _snprintf
scons: building terminated because of errors.

Fixes: b238e33bc9d ("kutil/queue: add a process name into a thread name")
Cc: Marek Olšák <marek.olsak@amd.com>
Cc: Brian Paul <brianp@vmware.com>
Cc: Roland Scheidegger <sroland@vmware.com>
Cc: Timothy Arceri <tarceri@itsqueeze.com>
Cc: Eric Engestrom <eric.engestrom@intel.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agogallium/aux/util: use util_snprintf() in test_texture_barrier
Andres Gomez [Wed, 1 Aug 2018 12:47:13 +0000 (15:47 +0300)]
gallium/aux/util: use util_snprintf() in test_texture_barrier

Instead of plain snprintf(). To fix the MSVC 2013 build:

  Compiling src\gallium\auxiliary\util\u_tests.c ...
u_tests.c
src\gallium\auxiliary\util\u_tests.c(624) : warning C4013: 'snprintf' undefined; assuming extern returning int

...

gallium.lib(u_tests.obj) : error LNK2019: unresolved external symbol _snprintf referenced in function _test_texture_barrier
build\windows-x86-debug\gallium\targets\graw-gdi\graw.dll : fatal error LNK1120: 1 unresolved externals
scons: *** [build\windows-x86-debug\gallium\targets\graw-gdi\graw.dll] Error 1120
scons: building terminated because of errors.

Fixes: 56342c97ee7 ("gallium/u_tests: test FBFETCH and shader-based blending with MSAA")
Cc: Marek Olšák <marek.olsak@amd.com>
Cc: Brian Paul <brianp@vmware.com>
Cc: Roland Scheidegger <sroland@vmware.com>
Cc: Dieter Nützel <Dieter@nuetzel-hh.de>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agoglsl: use util_snprintf()
Andres Gomez [Wed, 1 Aug 2018 10:22:00 +0000 (13:22 +0300)]
glsl: use util_snprintf()

Instead of plain snprintf(). To fix the MSVC 2013 build.

Fixes: 6ff0c6f4ebc ("gallium: move ddebug, noop, rbug, trace to auxiliary to improve build times")
Cc: Marek Olšák <marek.olsak@amd.com>
Cc: Brian Paul <brianp@vmware.com>
Cc: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agointel/compiler: Add brw_get_compiler_config_value for disk cache
Jordan Justen [Wed, 25 Jul 2018 21:31:05 +0000 (14:31 -0700)]
intel/compiler: Add brw_get_compiler_config_value for disk cache

During code review, Jason pointed out that:

2b3064c0731 "i965, anv: Use INTEL_DEBUG for disk_cache driver flags"

Didn't account for INTEL_SCALER_* environment variables.

To fix this, let the compiler return the disk_cache driver flags.

Another possible fix would be to pull the INTEL_SCALER_* into
INTEL_DEBUG bits, but as we are currently using 41 of 64 bits, I
didn't think it was a good use of 4 more of these bits. (5 since
INTEL_PRECISE_TRIG needs to be accounted for as well.)

Cc: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoi965: Disable shader cache with INTEL_DEBUG=shader_time
Jordan Justen [Wed, 25 Jul 2018 00:13:52 +0000 (17:13 -0700)]
i965: Disable shader cache with INTEL_DEBUG=shader_time

Shader time hard codes an index of the shader time buffer within the
gen program.

In order to support shader time in the disk shader cache, we'd need to
add the shader time index into the program key. This should work, but
probably is not worth it for this particular debug feature.

Therefore, let's just disable the disk shader cache if the shader time
debug feature is used.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106382
Fixes: 96fe36f7acc "i965: Enable disk shader cache by default"
Cc: Eero Tamminen <eero.t.tamminen@intel.com>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoglsl: make a copy of array indices that are used to deref a function out param
Timothy Arceri [Sat, 21 Jul 2018 05:22:24 +0000 (15:22 +1000)]
glsl: make a copy of array indices that are used to deref a function out param

Fixes new piglit test:
tests/spec/glsl-1.20/execution/qualifiers/vs-out-conversion-int-to-float-vec4-index.shader_test

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agoanv/pipeline: Add populate_tcs/tes_key helpers
Jason Ekstrand [Fri, 27 Oct 2017 01:11:25 +0000 (18:11 -0700)]
anv/pipeline: Add populate_tcs/tes_key helpers

They don't really do anything interesting, but it's more consistent this
way.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoanv/pipeline: Rework the parameters to populate_wm_prog_key
Jason Ekstrand [Fri, 27 Oct 2017 00:56:07 +0000 (17:56 -0700)]
anv/pipeline: Rework the parameters to populate_wm_prog_key

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoanv/pipeline: More aggressively optimize away color attachments
Jason Ekstrand [Wed, 11 Jul 2018 06:31:47 +0000 (23:31 -0700)]
anv/pipeline: More aggressively optimize away color attachments

Instead of just looking at the number of color attachments, look at
which ones are actually used by the subpass.  This lets us potentially
throw away chunks of the fragment shader.  In DXVK, for example, all
subpasses have 8 attachments and most are VK_ATTACHMENT_UNUSED so this
is very helpful in that case.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoanv: Restrict the number of color regions to those actually written
Jason Ekstrand [Thu, 28 Jun 2018 01:30:09 +0000 (18:30 -0700)]
anv: Restrict the number of color regions to those actually written

The back-end compiler emits the number of color writes specified by
wm_prog_key::nr_color_regions regardless of what nir_store_outputs we
have.  Once we've gone through and figured out which render targets
actually exist and are written by the shader, we should restrict the key
to avoid extra RT write messages.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoanv/pipeline: Fix up deref modes if we delete a FS output
Jason Ekstrand [Thu, 28 Jun 2018 01:25:17 +0000 (18:25 -0700)]
anv/pipeline: Fix up deref modes if we delete a FS output

With the new deref instructions, we have to keep the modes consistent
between the derefs and the variables they reference.  Since we remove
outputs by changing them to local variables, we need to run the fixup
pass to fix the modes.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agonir/lower_indirect: Bail early if modes == 0
Jason Ekstrand [Sat, 28 Oct 2017 16:05:01 +0000 (09:05 -0700)]
nir/lower_indirect: Bail early if modes == 0

There's no point in walking the program if we're never going to actually
lower anything.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agointel/nir: Call nir_lower_io_to_scalar_early
Jason Ekstrand [Tue, 31 Jul 2018 13:16:34 +0000 (06:16 -0700)]
intel/nir: Call nir_lower_io_to_scalar_early

Shader-db results on Kaby Lake:

    total instructions in shared programs: 15166953 -> 15073611 (-0.62%)
    instructions in affected programs: 2390284 -> 2296942 (-3.91%)
    helped: 16469
    HURT: 505

    total loops in shared programs: 4954 -> 4951 (-0.06%)
    loops in affected programs: 3 -> 0
    helped: 3
    HURT: 0

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agointel/nir: Split IO arrays into elements
Jason Ekstrand [Thu, 26 Jul 2018 05:52:39 +0000 (22:52 -0700)]
intel/nir: Split IO arrays into elements

The NIR nir_lower_io_arrays_to_elements pass attempts to split I/O
variables which are arrays or matrices into a sequence of separate
variables.  This can help link-time optimization by allowing us to
remove varyings at a more granular level.

Shader-db results on Kaby Lake:

    total instructions in shared programs: 15177645 -> 15168494 (-0.06%)
    instructions in affected programs: 79857 -> 70706 (-11.46%)
    helped: 392
    HURT: 0

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoi965/fs: Flag all slots of a flat input as flat
Jason Ekstrand [Tue, 31 Jul 2018 12:31:47 +0000 (05:31 -0700)]
i965/fs: Flag all slots of a flat input as flat

Otherwise, only the first vec4 of a matrix or other complex type will
get marked as flat and we'll interpolate the others.  This was caught by
a dEQP test which started failing because it did a SSO vs. non-SSO
comparison.  Previously, we did the interpolation wrong consistently in
both versions.  However, with one of Tim Arceri's NIR linkingpatches, we
started splitting the matrix input into vectors at link time in the
non-SSO version and it started getting correctly interpolated which
didn't match the broken SSO version.  As of this commit, they both get
correctly interpolated.

Fixes: e61cc87c757f8bc "i965/fs: Add a flat_inputs field to prog_data"
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agointel/nir: Use the correct scalar stage for consumers when linking
Jason Ekstrand [Tue, 31 Jul 2018 18:31:22 +0000 (11:31 -0700)]
intel/nir: Use the correct scalar stage for consumers when linking

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agodocs: update 18.2.0 release notes for virgl
Dave Airlie [Wed, 1 Aug 2018 22:43:56 +0000 (08:43 +1000)]
docs: update 18.2.0 release notes for virgl

6 years agonir/meson: fix c vs cpp args for nir test
Dylan Baker [Tue, 22 May 2018 22:34:38 +0000 (15:34 -0700)]
nir/meson: fix c vs cpp args for nir test

Fixes: d1992255bb29054fa51763376d125183a9f602f3
       ("meson: Add build Intel "anv" vulkan driver")
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agogallium: fix ddebug on windows
Dylan Baker [Wed, 18 Apr 2018 17:21:14 +0000 (10:21 -0700)]
gallium: fix ddebug on windows

By including the proper headers for getpid and for mkdir.

Fixes: 6ff0c6f4ebcb87ea6c6fe5a4ba90b548f666067d
       ("gallium: move ddebug, noop, rbug, trace to auxiliary to improve build times")
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoutil: move process.[ch] to u_process.[ch]
Dylan Baker [Tue, 10 Jul 2018 22:00:13 +0000 (15:00 -0700)]
util: move process.[ch] to u_process.[ch]

On windows process.h is a system provided header, and it's required in
include/c11/threads_win32.h. This header interferes with searching for
that header, and results in windows build warnings with scons, but
errors in meson which doesn't allow implicit function declarations. Just
rename process to u_process, which follows the style of utils anyway.

Fixes: 2e1e6511f76370870b5cde10caa9ca3b6d0dc65f
       ("util: extract get_process_name from xmlconfig.c")
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoac,radeonsi: reduce optimizations for complex compute shaders on older APUs (v2)
Marek Olšák [Fri, 20 Jul 2018 02:55:49 +0000 (22:55 -0400)]
ac,radeonsi: reduce optimizations for complex compute shaders on older APUs (v2)

To make dEQP-GLES31.functional.ssbo.layout.random.all_shared_buffer.23
finish sooner on the older CPUs. (otherwise it gets killed and we fail
the test)

Acked-by: Dave Airlie <airlied@gmail.com>
6 years agov3d: Actually put the "%s" in the snprintf.
Eric Anholt [Wed, 1 Aug 2018 18:25:58 +0000 (11:25 -0700)]
v3d: Actually put the "%s" in the snprintf.

I missed an important part when porting the change over, fixing my
compiler warning but breaking -Werror=format-security.

Fixes: e6ff5ac4468e ("v3d: use snprintf(..., "%s", ...) instead of strncpy")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107443

6 years agovc4: Fix automake linking error.
Juan A. Suarez Romero [Tue, 31 Jul 2018 12:17:23 +0000 (14:17 +0200)]
vc4: Fix automake linking error.

  CXXLD    gallium_dri.la
../../../../src/gallium/drivers/vc4/.libs/libvc4.a(vc4_cl_dump.o): In function `vc4_dump_cl':
src/gallium/drivers/vc4/vc4_cl_dump.c:45: undefined reference to `clif_dump_init'
src/gallium/drivers/vc4/vc4_cl_dump.c:82: undefined reference to `clif_dump_destroy'
../../../../src/broadcom/cle/.libs/libbroadcom_cle.a(cle_libbroadcom_cle_la-v3d_decoder.o): In function `v3d_field_iterator_next':
src/broadcom/cle/v3d_decoder.c:902: undefined reference to `clif_lookup_bo'

Fixes: e92959c4e0 ("v3d: Pass the whole clif_dump structure to v3d_print_group().")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107423
CC: Eric Anholt <eric@anholt.net>
Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Andres Gomez <agomez@igalia.com>
6 years agoscons: require scons 2.4 or greater
Juan A. Suarez Romero [Wed, 1 Aug 2018 15:48:11 +0000 (17:48 +0200)]
scons: require scons 2.4 or greater

There is a bug with scons 2.3, used in Travis, where it fails to detect
some C functions.

Reviewed-by: Andres Gomez <agomez@igalia.com>
6 years agotravis: install scons from pip
Juan A. Suarez Romero [Wed, 1 Aug 2018 15:14:56 +0000 (17:14 +0200)]
travis: install scons from pip

The ubuntu version provided by Travis is a bit old, and does not detect
correctly some C functions.

Use a more modern version through scons.

Reviewed-by: Andres Gomez <agomez@igalia.com>
6 years agodocs: mark ARB_ES3_2_compatibility as done for radeonsi
Marek Olšák [Wed, 1 Aug 2018 15:36:18 +0000 (11:36 -0400)]
docs: mark ARB_ES3_2_compatibility as done for radeonsi

6 years agointel: tools: aubwrite: split gen[89] from gen10+
Lionel Landwerlin [Sat, 28 Jul 2018 12:52:44 +0000 (13:52 +0100)]
intel: tools: aubwrite: split gen[89] from gen10+

Gen10+ has an additional bit in MI_BATCH_BUFFER_END to signal the end
of the context image.

We select the largest size for the context image regardless of the
generation.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
6 years agopython: Use the unicode_escape codec
Mathieu Bridon [Thu, 7 Jun 2018 10:26:20 +0000 (12:26 +0200)]
python: Use the unicode_escape codec

Python 2 had string_escape and unicode_escape codecs. Python 3 only has
the latter. These work the same as far as we're concerned, so let's use
the future-proof one.

However, the reste of the code expects unicode strings, so we need to
decode them again.

Signed-off-by: Mathieu Bridon <bochecha@daitauha.fr>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agopython: Explicitly add the 'L' suffix on Python 3
Mathieu Bridon [Mon, 25 Jun 2018 16:31:01 +0000 (18:31 +0200)]
python: Explicitly add the 'L' suffix on Python 3

Python 2 had two integer types: int and long. Python 3 dropped the
latter, as it made the int type automatically support bigger numbers.

As a result, Python 3 lost the 'L' suffix on integer litterals.

This probably doesn't make much difference when compiling the generated
C code, but adding it explicitly means that both Python 2 and 3 generate
the exact same C code anyway, which makes it easier to compare and check
for discrepencies when moving to Python 3.

Signed-off-by: Mathieu Bridon <bochecha@daitauha.fr>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agopython: Explicitly use byte strings
Mathieu Bridon [Sun, 17 Jun 2018 12:40:31 +0000 (14:40 +0200)]
python: Explicitly use byte strings

In both Python 2 and 3, zlib.Compress.compress() takes a byte string,
and returns a byte string as well.

In Python 2, the script was working because:

1. string literalls were byte strings;
2. opening a file in unicode mode, reading from it, then passing the
   unicode string to compress() would automatically encode to a byte
   string;

On Python 3, the above two points are not valid any more, so:

1. zlib.Compress.compress() refuses the passed unicode string;
2. compressed_data, defined as an empty unicode string literal, can't be
   concatenated with the byte string returned by compress();

This commit fixes this by explicitly using byte strings where
appropriate, so that the script works on both Python 2 and 3.

Signed-off-by: Mathieu Bridon <bochecha@daitauha.fr>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agopython: Use open(), not file()
Mathieu Bridon [Fri, 1 Jun 2018 13:02:21 +0000 (15:02 +0200)]
python: Use open(), not file()

The latter is a constructor for file objects, but when actually opening
a file, using the former is more idiomatic.

In addition, file() is not a builtin any more in Python 3, so this makes
the script compatible with both Python 2 and Python 3.

Signed-off-by: Mathieu Bridon <bochecha@daitauha.fr>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agopython: Open file in binary mode
Mathieu Bridon [Tue, 26 Jun 2018 06:52:08 +0000 (08:52 +0200)]
python: Open file in binary mode

The XML parser wants byte strings, not unicode strings.

In both Python 2 and 3, opening a file without specifying the mode will
open it for reading in text mode ('r').

On Python 2, the read() method of the file object will return byte
strings, while on Python 3 it will return unicode strings.

Explicitly specifying the binary mode ('rb') makes the behaviour
identical in both Python 2 and 3, returning what the XML parser
expects.

Signed-off-by: Mathieu Bridon <bochecha@daitauha.fr>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agopython: Don't abuse hex()
Mathieu Bridon [Sun, 17 Jun 2018 15:53:16 +0000 (17:53 +0200)]
python: Don't abuse hex()

The hex() builtin returns a string containing the hexa-decimal
representation of an integer.

When the argument is not an integer, then the function calls that
object's __hex__() method, if one is defined. That method is supposed to
return a string.

While that's not explicitly documented, that string is supposed to be a
valid hexa-decimal representation for a number. Python 2 doesn't enforce
this though, which is why we got away with returning things like
'NIR_TRUE' which are not numbers.

In Python 3, the hex() builtin instead calls an object's __index__()
method, which itself must return an integer. That integer is then
automatically converted to a string with its hexa-decimal representation
by the rest of the hex() function.

As a result, we really can't make this compatible with Python 3 as it
is.

The solution is to stop using the hex() builtin, and instead use a hex()
object method, which can return whatever we want, in Python 2 and 3.

Signed-off-by: Mathieu Bridon <bochecha@daitauha.fr>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agopython: Better get character ordinals
Mathieu Bridon [Sun, 17 Jun 2018 12:44:46 +0000 (14:44 +0200)]
python: Better get character ordinals

In Python 2, iterating over a byte-string yields single-byte strings,
and we can pass them to ord() to get the corresponding integer.

In Python 3, iterating over a byte-string directly yields those
integers.

Transforming the byte string into a bytearray gives us a list of the
integers corresponding to each byte in the string, removing the need to
call ord().

This makes the script compatible with both Python 2 and 3.

Signed-off-by: Mathieu Bridon <bochecha@daitauha.fr>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoloader_dri3: Handle mismatched depth 30 formats for Prime renderoffload.
Mario Kleiner [Thu, 14 Jun 2018 04:04:24 +0000 (06:04 +0200)]
loader_dri3: Handle mismatched depth 30 formats for Prime renderoffload.

Detect if the display (X-Server) gpu and Prime renderoffload gpu prefer
different channel ordering for color depth 30 formats ([X/A]BGR2101010
vs. [X/A]RGB2101010) and perform format conversion during the blitImage()
detiling op from tiled backbuffer -> linear buffer.

For this we need to find the visual (= red channel mask) for the
X-Drawable used to display on the server gpu. We use the same proven
logic for finding that visual as in commit "egl/x11: Handle both depth
30 formats for eglCreateImage()".

This is mostly to allow "NVidia Optimus" at depth 30, as Intel/AMD
gpu's prefer xRGB2101010 ordering, whereas NVidia gpu's prefer
xBGR2101010 ordering, so we can offload to nouveau without getting
funky colors.

Tested on Intel single gpu, NVidia single gpu, Intel + NVidia prime
offload with DRI3/Present.

Note: An unintended but pleasant surprise of this patch is that it also
seems to make the modesetting-ddx of server 1.20.0 work at depth 30
on nouveau, at least with unredirected "classic" X rendering, and
with redirected desktop compositing under XRender accel, and with OpenGL
compositing under GLX. Only X11 compositing via OpenGL + EGL still gives
funky colors. modesetting-ddx + glamor are not yet ready to deal with
nouveau's ABGR2101010 format, and treat it as ARGB2101010, also exposing
X-visuals with ARGB2101010 style channel masks. Seems somehow this triggers
the logic in this patch on modesetting-ddx + depth 30 + DRI3 buffer sharing
and does the "wrong" channel swizzling that then cancels out the "wrong"
swizzling of glamor and we end up with the proper pixel formatting in
the scanout buffer :). This so far tested on a NVA5 Tesla card under KDE5
Plasma as shipping with Ubuntu 16.04.4 LTS.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoegl/x11: Handle both depth 30 formats for eglCreateImage(). (v4)
Mario Kleiner [Wed, 13 Jun 2018 04:04:13 +0000 (06:04 +0200)]
egl/x11: Handle both depth 30 formats for eglCreateImage(). (v4)

We need to distinguish if the backing storage of a pixmap
is XRGB2101010 or XBGR2101010, as different gpu hw supports
different formats. NVidia hw prefers XBGR, whereas AMD and
Intel are happy with XRGB.

Use the red channel mask of the first depth 30 visual of
the x-screen to distinguish which hw format to choose.

This fixes desktop composition of color depth 30 windows
when the X11 compositor uses EGL.

v2: Switch from using the visual of the root window to simply
    using the first depth 30 visual for the x-screen, as testing
    shows that each driver only exports either xrgb ordering or
    xbgr ordering for the channel masks of its depth 30 visuals,
    so this should be unambiguous and avoid trouble if X ever
    supports depth 30 pixmaps on screens with a non-depth 30 root
    window visual. This per Michels suggestion.

v3: No change to v2, but spent some time testing this more on
    AMD hw, with my software hacked up to intentionally choose
    pixel formats/visual with the non-preferred xBGR2101010
    ordering on the ati-ddx, also with a standard non-OpenGL
    X-Window with depth 30 visual, to make sure that things show
    up properly with the right colors on the screen when going
    through EGL+OpenGL based compositing on KDE-5. Iow. to confirm
    that my explanation to the v2 patch on the mailing list of why
    it should work and the actual practice agree (or possibly that
    i am good at fooling myself during testing ;).

v4: Drop the local `red_mask` and just `return visual->red_mask`/
    `return 0`, as suggested by Eric Engestrom.

    Rebased onto current master, to take the cleanup via the new
    function dri2_format_for_depth() into account.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agogbm: Add support for 10bpp BGR formats
Daniel Stone [Wed, 13 Jun 2018 04:04:12 +0000 (06:04 +0200)]
gbm: Add support for 10bpp BGR formats

Add support for XBGR2101010 and ABGR2101010 formats.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoegl/wayland: Add 10bpc BGR configs
Daniel Stone [Wed, 13 Jun 2018 04:04:11 +0000 (06:04 +0200)]
egl/wayland: Add 10bpc BGR configs

Add support for XBGR2101010 and ABGR2101010.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agointel/compiler: implement 8-bit constant load
Iago Toral Quiroga [Fri, 27 Jul 2018 11:38:39 +0000 (13:38 +0200)]
intel/compiler: implement 8-bit constant load

Fixes VK-GL-CTS CL#2567

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agointel/compiler: add setup_imm_(u)b helpers
Iago Toral Quiroga [Fri, 27 Jul 2018 11:38:38 +0000 (13:38 +0200)]
intel/compiler: add setup_imm_(u)b helpers

The hardware doesn't support byte immediates, so similar to setup_imm_df()
for doubles, these helpers work by loading the constant value into a
VGRF.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoglsl: fix function inlining with opaque parameters
Rhys Perry [Wed, 6 Jun 2018 19:55:08 +0000 (20:55 +0100)]
glsl: fix function inlining with opaque parameters

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoglsl, glsl_to_tgsi: fix sampler/image constants
Rhys Perry [Wed, 6 Jun 2018 19:55:07 +0000 (20:55 +0100)]
glsl, glsl_to_tgsi: fix sampler/image constants

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoglsl: allow ?: operator with images and samplers when bindless is enabled
Rhys Perry [Wed, 6 Jun 2018 19:55:06 +0000 (20:55 +0100)]
glsl: allow ?: operator with images and samplers when bindless is enabled

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoglsl_to_tgsi: allow bound samplers and images to be used as l-values
Rhys Perry [Wed, 6 Jun 2018 19:55:05 +0000 (20:55 +0100)]
glsl_to_tgsi: allow bound samplers and images to be used as l-values

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agogallium: add new SAMP2HND and IMG2HND opcodes
Rhys Perry [Wed, 6 Jun 2018 19:55:03 +0000 (20:55 +0100)]
gallium: add new SAMP2HND and IMG2HND opcodes

This commit does not add support for the opcodes in gallivm or tgsi_to_nir.c

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agodocs/features: update virgl GLES 3.1/3.2 status
Dave Airlie [Mon, 30 Jul 2018 19:07:23 +0000 (05:07 +1000)]
docs/features: update virgl GLES 3.1/3.2 status

virgl now exposes GLES3.1 and 3.2

6 years agodocs/features: update virgl GL 4.3 support
Dave Airlie [Mon, 30 Jul 2018 19:07:06 +0000 (05:07 +1000)]
docs/features: update virgl GL 4.3 support

virgl with up to date host renderer now exposes GL 4.3.

6 years agovirgl: enable FBFETCH if virglrenderer supports it
Erik Faye-Lund [Fri, 20 Jul 2018 10:10:56 +0000 (11:10 +0100)]
virgl: enable FBFETCH if virglrenderer supports it

This fixes the following dEQP-GLES31 cases from NotSupported to
Pass for me:

- dEQP-GLES31.functional.blend_equation_advanced.state_query.*
- dEQP-GLES31.functional.blend_equation_advanced.basic.*
- dEQP-GLES31.functional.blend_equation_advanced.srgb.*
- dEQP-GLES31.functional.blend_equation_advanced.msaa.*
- dEQP-GLES31.functional.blend_equation_advanced.barrier.*
- dEQP-GLES31.functional.draw_buffers_indexed.overwrite_*advanced_blend_eq*
- dEQP-GLES31.functional.state_query.indexed.blend_equation_advanced_*
- dEQP-GLES31.functional.debug.negative_coverage.*.advanced_blend.*

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agovirgl: add texture_barrier stub
Erik Faye-Lund [Fri, 20 Jul 2018 10:10:20 +0000 (11:10 +0100)]
virgl: add texture_barrier stub

In gallium, supporting FBFETCH means supporting non-coherent fetches, but
in virglrenderer, due to technical reasons this is backed by coherent
fetches instead. This means we don't need to do anything for the barriers.

However, if we don't have a texture_barrier implementation, we get crashes
because the non-coherent extensions is exposed.

So, let's leave this as a NOP for now.

[airlied: I've got a more complete impl of this somewhere, once we
land the host side].
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
6 years agovirgl: enable robustness if the host exposes it
Dave Airlie [Mon, 30 Jul 2018 18:45:15 +0000 (04:45 +1000)]
virgl: enable robustness if the host exposes it

Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agovirgl: Support ARB_framebuffer_no_attachments
Dave Airlie [Wed, 18 Jul 2018 19:35:53 +0000 (05:35 +1000)]
virgl: Support ARB_framebuffer_no_attachments

This uses new protocol to send the default sizes to the host.

Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agovirgl: add initial ARB_compute_shader support
Dave Airlie [Fri, 15 Jun 2018 01:20:53 +0000 (11:20 +1000)]
virgl: add initial ARB_compute_shader support

This hooks up compute shader creation and launch grid support.

Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agoutil: don't use __builtin_clz unconditionally
Marek Olšák [Wed, 1 Aug 2018 02:50:44 +0000 (22:50 -0400)]
util: don't use __builtin_clz unconditionally

This fixes the build if __builtin_clz is unsupported.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agoac/surface: fix MSAA corruption on Vega due to FMASK tile swizzle
Marek Olšák [Fri, 27 Jul 2018 02:46:21 +0000 (22:46 -0400)]
ac/surface: fix MSAA corruption on Vega due to FMASK tile swizzle

a needle in the haystack?

Cc: 18.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agov3d: use snprintf(..., "%s", ...) instead of strncpy
Eric Anholt [Tue, 31 Jul 2018 23:41:28 +0000 (16:41 -0700)]
v3d: use snprintf(..., "%s", ...) instead of strncpy

Fixes a compiler warning about terminator NUL, based on f836d799f906
("intel/decoder: use snprintf(..., "%s", ...) instead of strncpy")

6 years agov3d: Add support for the TMUWT instruction.
Eric Anholt [Thu, 14 Dec 2017 17:28:42 +0000 (09:28 -0800)]
v3d: Add support for the TMUWT instruction.

This instruction is used to ensure that TMU stores have been processed
before moving on.  In particular, you need any TMU ops to be done by the
time the shader ends.

6 years agoradeonsi: report supported EQAA combinations from is_format_supported
Marek Olšák [Thu, 24 May 2018 02:56:25 +0000 (22:56 -0400)]
radeonsi: report supported EQAA combinations from is_format_supported

Framebuffer without attachments now supports 16 samples.

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradeonsi: use storage_samples instead of color_samples in most places
Marek Olšák [Thu, 24 May 2018 02:42:49 +0000 (22:42 -0400)]
radeonsi: use storage_samples instead of color_samples in most places

and use pipe_resource::nr_storage_samples instead of
r600_texture::num_color_samples.

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agogallium: add storage_sample_count parameter into is_format_supported
Marek Olšák [Wed, 23 May 2018 22:46:19 +0000 (18:46 -0400)]
gallium: add storage_sample_count parameter into is_format_supported

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agogallium: add pipe_resource::nr_storage_samples, and set it same as nr_samples
Marek Olšák [Thu, 24 May 2018 02:25:12 +0000 (22:25 -0400)]
gallium: add pipe_resource::nr_storage_samples, and set it same as nr_samples

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agogallium: add PIPE_CAP_FRAMEBUFFER_MSAA_CONSTRAINTS
Marek Olšák [Wed, 23 May 2018 21:45:50 +0000 (17:45 -0400)]
gallium: add PIPE_CAP_FRAMEBUFFER_MSAA_CONSTRAINTS

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agodocs: update radeonsi features and release notes
Marek Olšák [Tue, 24 Jul 2018 00:07:20 +0000 (20:07 -0400)]
docs: update radeonsi features and release notes

6 years agost/mesa: implement ASTC 2D LDR fallback for all drivers
Marek Olšák [Tue, 13 Feb 2018 03:25:29 +0000 (04:25 +0100)]
st/mesa: implement ASTC 2D LDR fallback for all drivers

Tested-by: Mike Lothian <mike@fireburn.co.uk>
Tested-By: Gert Wollny<gert.wollny@collabora.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-By: Gert Wollny <gw.fossdev@gmail.com>
6 years agost/mesa: add ETC2 & ASTC fast path for GetTex(Sub)Image
Marek Olšák [Tue, 13 Feb 2018 16:37:56 +0000 (17:37 +0100)]
st/mesa: add ETC2 & ASTC fast path for GetTex(Sub)Image

Not sure if GL/GLES can hit this path, but it's just decompression.

Tested-by: Mike Lothian <mike@fireburn.co.uk>
Tested-By: Gert Wollny<gert.wollny@collabora.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-By: Gert Wollny <gw.fossdev@gmail.com>
6 years agost/mesa: generalize fallback_copy_image for compressed textures
Marek Olšák [Wed, 14 Feb 2018 00:49:33 +0000 (01:49 +0100)]
st/mesa: generalize fallback_copy_image for compressed textures

in order to support ASTC

Tested-by: Mike Lothian <mike@fireburn.co.uk>
Tested-By: Gert Wollny<gert.wollny@collabora.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-By: Gert Wollny <gw.fossdev@gmail.com>
6 years agost/mesa: generalize code for the compressed texture map/unmap fallback
Marek Olšák [Tue, 13 Feb 2018 15:39:11 +0000 (16:39 +0100)]
st/mesa: generalize code for the compressed texture map/unmap fallback

in order to support ASTC

Tested-by: Mike Lothian <mike@fireburn.co.uk>
Tested-By: Gert Wollny<gert.wollny@collabora.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-By: Gert Wollny <gw.fossdev@gmail.com>
6 years agost/mesa: use st_compressed_format_fallback more
Marek Olšák [Tue, 13 Feb 2018 03:19:05 +0000 (04:19 +0100)]
st/mesa: use st_compressed_format_fallback more

Tested-by: Mike Lothian <mike@fireburn.co.uk>
Tested-By: Gert Wollny<gert.wollny@collabora.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-By: Gert Wollny <gw.fossdev@gmail.com>
6 years agost/mesa: generalize st_etc_fallback -> st_compressed_format_fallback
Marek Olšák [Tue, 13 Feb 2018 03:00:17 +0000 (04:00 +0100)]
st/mesa: generalize st_etc_fallback -> st_compressed_format_fallback

for ASTC support later

Tested-by: Mike Lothian <mike@fireburn.co.uk>
Tested-By: Gert Wollny<gert.wollny@collabora.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-By: Gert Wollny <gw.fossdev@gmail.com>
6 years agomesa: add ASTC 2D LDR decoder
Marek Olšák [Tue, 13 Feb 2018 15:02:14 +0000 (16:02 +0100)]
mesa: add ASTC 2D LDR decoder

Tested-by: Mike Lothian <mike@fireburn.co.uk>
Tested-By: Gert Wollny <gert.wollny@collabora.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agodocs/features: mark virgl image features and GL4.2 as done
Dave Airlie [Mon, 30 Jul 2018 19:04:56 +0000 (05:04 +1000)]
docs/features: mark virgl image features and GL4.2 as done

6 years agovirgl: also mark sampler views as dirty
Gurchetan Singh [Tue, 10 Jul 2018 23:19:24 +0000 (16:19 -0700)]
virgl: also mark sampler views as dirty

When texture buffers are used as images in compute shaders, the guest
never sees the modified data since the TBO is always marked as clean.

Fixes most dEQP-GLES31.functional.image_load_store.buffer.* tests.

Example test cases:
   dEQP-GLES31.functional.image_load_store.buffer.load_store.r32ui
   dEQP-GLES31.functional.image_load_store.buffer.qualifiers.coherent_r32f
   dEQP-GLES31.functional.image_load_store.buffer.format_reinterpret.rgba8_rgba8ui

Note: virglrenderer side patch also needed to bind TBOs correctly

Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agovirgl: add memory barrier support
Dave Airlie [Wed, 18 Jul 2018 03:37:49 +0000 (13:37 +1000)]
virgl: add memory barrier support

Reviwed-by: Gert Wollny <gert.wollny@collabora.com>
6 years agovirgl: add TXQS support
Dave Airlie [Thu, 19 Jul 2018 23:18:04 +0000 (09:18 +1000)]
virgl: add TXQS support

Reviwed-by: Gert Wollny <gert.wollny@collabora.com>
6 years agovirgl: add initial images support (v2)
Dave Airlie [Wed, 18 Jul 2018 02:54:30 +0000 (12:54 +1000)]
virgl: add initial images support (v2)

v2: add max image samples support

Reviwed-by: Gert Wollny <gert.wollny@collabora.com>
6 years agoMake glXChooseFBConfig handle unspecified sRGB correctly
Jon Turney [Sat, 14 Jul 2018 14:24:14 +0000 (15:24 +0100)]
Make glXChooseFBConfig handle unspecified sRGB correctly

Make glXChooseFBConfig properly handle the case where the only matching
configs have the sRGB flag set, but no sRGB attribute is specified.

Since 6e06e281, the sRGBcapable flag is now actually compared, using
MATCH_DONT_CARE.

7b0f912e added defaulting of sRGBcapable to GL_FALSE in
__glXInitializeVisualConfigFromTags(), to handle servers which don't report
it, but this function is also used by glXChooseFBConfig(), so sRGBcapable is
implicitly false when not explicitly specified.

(This can cause e.g. glxinfo to fail to find anything matching the simple
config it looks for if all the candidates have the sRGB flag set to true.
I'm assuming this doesn't happen 'normally' as candidate configs with and
without sRGB true are available)

Move this defaulting to createConfigsFromProperties(), and set the default
for glXChooseFBConfig() in init_fbconfig_for_chooser() to GLX_DONT_CARE.

Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agodri3: For 1.2, use root window instead of pixmap drawable
Olivier Fourdan [Thu, 26 Jul 2018 07:46:39 +0000 (09:46 +0200)]
dri3: For 1.2, use root window instead of pixmap drawable

get_supported_modifiers() and pixmap_from_buffers() requests both
expect a window as drawable, passing a pixmap will fail as the Xserver
will fail to match the given drawable to a window.

That leads to dri3_alloc_render_buffer() to return NULL and breaks
rendering when using GLX_DOUBLEBUFFER on pixmaps.

Query the root window of the pixmap on first init, and use the root
window instead of the pixmap drawable for get_supported_modifiers()
and pixmap_from_buffers().

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107117
Fixes: 069fdd5 ("egl/x11: Support DRI3 v1.1")
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agoi965: enable XFB and GeometryStreams for gen7+
Alejandro Piñeiro [Fri, 13 Jul 2018 11:35:38 +0000 (13:35 +0200)]
i965: enable XFB and GeometryStreams for gen7+

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoi965: Link XFB varyings for SPIR-V shaders
Neil Roberts [Tue, 12 Dec 2017 16:30:57 +0000 (17:30 +0100)]
i965: Link XFB varyings for SPIR-V shaders

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agonir/linker: Add the start of a pure-NIR linker for XFB
Neil Roberts [Tue, 12 Dec 2017 16:27:44 +0000 (17:27 +0100)]
nir/linker: Add the start of a pure-NIR linker for XFB

v2: ignore names on purpose, for consistency with other places where
    we are doing the same (Alejandro)

v3: changes proposed by Timothy Arceri, implemented by Alejandro Piñeiro:
   * Remove redundant 'struct active_xfb_varying'
   * Update several comments, including spec quotes if needed
   * Rename struct 'active_xfb_varying_array' to 'active_xfb_varyings'
   * Rename variable 'array' to 'active_varyings'
   * Replace one if condition for an assert (<MAX_FEEDBACK_BUFFERS)
   * Remove BufferMode initialization (was already done)

v4: simplify output pointer handling (Timothy)

Signed-off-by: Neil Roberts <nroberts@igalia.com>
Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agonir/types: Add a wrapper to access gl_type
Neil Roberts [Mon, 18 Dec 2017 17:33:32 +0000 (18:33 +0100)]
nir/types: Add a wrapper to access gl_type

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoarb_gl_spirv: add calls to several nir lowerings
Alejandro Piñeiro [Fri, 20 Jul 2018 11:03:05 +0000 (13:03 +0200)]
arb_gl_spirv: add calls to several nir lowerings

For now we are just adding nir lowerings that are needed/mandatory to
get things working. After everything is settled, we would start to add
good-to-have lowerings.

This patch adds the following calls:

  * nir_split_var_copits and nir_split_per_member_structs: as vulkan
    drivers are doing now. See commit
    b0c643d8f579a3e1e45a08f6d9de099f2c45898b ("spirv: Use NIR
    per-member splitting") for more info.

    Without this commit, piglit tests like this crashes:
    spec/arb_gl_spirv/execution/varying/block

    And in general most of the shaders that includes any kind of
    struct.

   * nir_copy_prop: after nir_deref_instr introduction, function calls
    need this. See commit "nir,spirv: Rework function calls"
    (c11833ab24dcba26de1b0a5805e35a5d6761514e) for more info.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agocompiler/spirv: add XFB and GeometryStreams capability check support
Alejandro Piñeiro [Fri, 13 Jul 2018 11:34:08 +0000 (13:34 +0200)]
compiler/spirv: add XFB and GeometryStreams capability check support

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agonir/gather_info: Set info.gs.uses_streams
Neil Roberts [Wed, 17 Jan 2018 15:37:35 +0000 (16:37 +0100)]
nir/gather_info: Set info.gs.uses_streams

Whenever a non-zero stream is written to it now sets uses_streams to
true. This reflects the code in validate_geometry_shader_emissions for
GLSL.

v2: set uses_streams at gather_info instead that at spirv to nir
    (Jason Ekstrand)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agospirv/nir: Fix the stream ID when emitting a primitive or vertex
Neil Roberts [Tue, 16 Jan 2018 18:47:07 +0000 (19:47 +0100)]
spirv/nir: Fix the stream ID when emitting a primitive or vertex

It looks like it was previously taking the SPIR-V instruction number
directly instead of looking up the constant value.

v2: use vtn_constant_value helper (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agospirv: Handle the SpvDecorationStream decoration
Neil Roberts [Wed, 17 Jan 2018 15:35:56 +0000 (16:35 +0100)]
spirv: Handle the SpvDecorationStream decoration

From SPIR-V 1.0 spec, section 3.20, "Decoration":

   "Stream
    Apply to an object or a member of a structure type. Indicates the
    stream number to put an output on."

Note the "or", so that means that it is allowed for both a full struct
or a membef or a struct (although the wording is not really ideal, and
somewhat error-prone, imho).

We found this with some Geometry Streams tests for ARB_gl_spirv, where
the full gl_PerVertex is assigned Stream 0 (default value on OpenGL
for gl_PerVertex).

So this commit allows structs to have this Decoration, and sets the
stream at the nir variable if needed.

Signed-off-by: Neil Roberts <nroberts@igalia.com>
Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
v2: squash two Decoration Stream patches (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa/glspirv: Set last_vert_prog
Neil Roberts [Mon, 18 Dec 2017 18:00:17 +0000 (19:00 +0100)]
mesa/glspirv: Set last_vert_prog

v2: simplify last_vert check (Timothy)

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agospirv: Handle XFB variable decorations
Neil Roberts [Tue, 12 Dec 2017 16:22:49 +0000 (17:22 +0100)]
spirv: Handle XFB variable decorations

These set the new explicit XFB members on nir_variable.

This is needed to support ARB_gl_spirv, as Vulkan doesn't support
transform feedback.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agospirv: Handle SpvExecutionModeXfb
Neil Roberts [Tue, 12 Dec 2017 16:18:32 +0000 (17:18 +0100)]
spirv: Handle SpvExecutionModeXfb

This just sets has_transform_feedback_varyings on the shader.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agonir: Add members for the explicit XFB properties to nir_variable
Neil Roberts [Tue, 12 Dec 2017 16:09:19 +0000 (17:09 +0100)]
nir: Add members for the explicit XFB properties to nir_variable

These are copied from the from the corresponding values in
ir_variable. The intention is to eventually use them in a pure-NIR
linker.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoetnaviv: fix typo in query names
Christian Gmeiner [Mon, 30 Jul 2018 07:44:01 +0000 (09:44 +0200)]
etnaviv: fix typo in query names

Fixes: d0bed0b4944d ("etnaviv: support HI performance counters")
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Chris Healy <cphealy@gmail.com>
6 years agomesa: fix a typo (trivial)
Tapani Pälli [Tue, 24 Jul 2018 05:58:21 +0000 (08:58 +0300)]
mesa: fix a typo (trivial)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agomesa: add glRenderbufferStorage support for EXT_texture_norm16 formats
Tapani Pälli [Tue, 24 Jul 2018 05:58:20 +0000 (08:58 +0300)]
mesa: add glRenderbufferStorage support for EXT_texture_norm16 formats

These bits were missing, found when extending the Piglit test.

Fixes: 7f467d4f73 "mesa: GL_EXT_texture_norm16 extension plumbing"
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>