3 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().

Fixes: 069fdd5 ("egl/x11: Support DRI3 v1.1")
Signed-off-by: Olivier Fourdan <>
Reviewed-by: Daniel Stone <>
Reviewed-by: Eric Anholt <>
3 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 <>
3 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 <>
3 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 <>
Signed-off-by: Alejandro Piñeiro <>
Reviewed-by: Timothy Arceri <>
3 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 <>
3 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:

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

   * 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 <>
3 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 <>
3 years agonir/gather_info: Set
Neil Roberts [Wed, 17 Jan 2018 15:37:35 +0000 (16:37 +0100)]
nir/gather_info: Set

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

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

Reviewed-by: Jason Ekstrand <>
3 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 <>
3 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":

    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 <>
Signed-off-by: Alejandro Piñeiro <>
v2: squash two Decoration Stream patches (Jason)

Reviewed-by: Jason Ekstrand <>
Reviewed-by: Timothy Arceri <>
3 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 <>
3 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 <>
3 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 <>
3 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

Reviewed-by: Timothy Arceri <>
3 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")
Signed-off-by: Christian Gmeiner <>
Reviewed-by: Chris Healy <>
3 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 <>
Reviewed-by: Nanley Chery <>
Reviewed-by: Eric Anholt <>
3 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 <>
Reviewed-by: Nanley Chery <>
Reviewed-by: Eric Anholt <>
3 years agoegl/surfaceless: Allow DRMless fallback.
David Riley [Wed, 18 Jul 2018 00:12:05 +0000 (17:12 -0700)]
egl/surfaceless: Allow DRMless fallback.

Allow platform_surfaceless to use swrast even if DRM is not available.
To be used to allow a fuzzer for virgl to be run on a jailed VM without
hardware GL or DRM support.

Reviewed-by: Eric Engestrom <>
Reviewed-by: Chad Versace <>
Signed-off-by: David Riley <>
3 years agoegl/surfaceless: Define DRI_SWRastLoader extension when using swrast.
David Riley [Wed, 18 Jul 2018 00:12:04 +0000 (17:12 -0700)]
egl/surfaceless: Define DRI_SWRastLoader extension when using swrast.

Signed-off-by: David Riley <>
Reviewed-by: Eric Engestrom <>
[chadv: Dropped spurious hunk]
Reviewed-by: Chad Versace <>
3 years agov3d: Dump the contents off all the buffers in CLIF mode.
Eric Anholt [Tue, 12 Jun 2018 20:46:32 +0000 (13:46 -0700)]
v3d: Dump the contents off all the buffers in CLIF mode.

A V3D_DEBUG=clif file from a non-texturing .shader_test can now be
successfully run through the CLIF runner in the simulator.  Now I need to
build an open source CLIF runner against the v3d DRM module.

3 years agov3d: Split walking the CLs to generate relocs from walking CLs to dump.
Eric Anholt [Thu, 28 Jun 2018 18:21:55 +0000 (11:21 -0700)]
v3d: Split walking the CLs to generate relocs from walking CLs to dump.

We need to dump each buffer's contents in order for a CLIF file, so we
need to collect all of the relocs into a buffer (such as the indirect CL
full of both uniforms and GL shader states) before we start dumping.

3 years agov3d: Include commands to run the BCL and RCL in CLIF dumps.
Eric Anholt [Wed, 27 Jun 2018 23:58:55 +0000 (16:58 -0700)]
v3d: Include commands to run the BCL and RCL in CLIF dumps.

3 years agov3d: Use a short, underscored name for packets in CLIF/CL dumping.
Eric Anholt [Wed, 27 Jun 2018 22:00:32 +0000 (15:00 -0700)]
v3d: Use a short, underscored name for packets in CLIF/CL dumping.

These will match the names that the CLIF parser expects to see.  I may in
the future decide to change more of the other names so that I match the
names the HW/closed SW team uses for their packets, rather than the names
in the spec (which only they and I can read anyway).

3 years agov3d: Rename "configuration" and "config" in the XML to "cfg"
Eric Anholt [Mon, 30 Jul 2018 20:17:39 +0000 (13:17 -0700)]
v3d: Rename "configuration" and "config" in the XML to "cfg"

This matches what CLIF parsing expects, and makes

3 years agov3d: s/colour/color in the XML.
Eric Anholt [Mon, 30 Jul 2018 19:57:31 +0000 (12:57 -0700)]
v3d: s/colour/color in the XML.

The CLIF format expects american english spelling, and the rest of Mesa is
too.  I was previously adhering to the spec's spelling, which is

3 years agov3d: Rename primitives to prims in the XML to match CLIF names.
Eric Anholt [Mon, 30 Jul 2018 19:55:31 +0000 (12:55 -0700)]
v3d: Rename primitives to prims in the XML to match CLIF names.

This makes us match up with the V3D HW team's names a bit more.

3 years agov3d: Print CLIF fixed-point values as just their decimal value.
Eric Anholt [Wed, 27 Jun 2018 22:16:05 +0000 (15:16 -0700)]
v3d: Print CLIF fixed-point values as just their decimal value.

The parser doesn't handle float input, so we have to dump the raw value.

3 years agov3d: When not doing terminal pretty-printing, comment struct field names.
Eric Anholt [Mon, 25 Jun 2018 22:20:22 +0000 (15:20 -0700)]
v3d: When not doing terminal pretty-printing, comment struct field names.

The struct field names aren't part of the CLIF ABI, just the order of
fields within the struct.  The comments are there for human readability.

3 years agov3d: Add a separate flag for CLIF ABI output versus human-readable CLs.
Eric Anholt [Mon, 30 Jul 2018 18:29:26 +0000 (11:29 -0700)]
v3d: Add a separate flag for CLIF ABI output versus human-readable CLs.

A few of the upcoming changes would make the V3D_DEBUG=cl output less
readable, so let's make proper CLIF file production be under a separate
V3D_DEBUG=clif flag.

3 years agov3d: Add pack header support for f187 values.
Eric Anholt [Mon, 30 Jul 2018 18:41:15 +0000 (11:41 -0700)]
v3d: Add pack header support for f187 values.

V3D only has one of these (the top 16 bits of a float32) left in its CLs,
but VC4 had many more.  This gets us proper pretty-printing of the values
instead of a large uint.

3 years agov3d: Move depth offset packet setup to CSO creation time.
Eric Anholt [Mon, 30 Jul 2018 20:44:40 +0000 (13:44 -0700)]
v3d: Move depth offset packet setup to CSO creation time.

This should be some simpler memcpying at draw time, and makes the next
change easier.

3 years agor600: reduce num compute threads to 1024.
Dave Airlie [Wed, 25 Jul 2018 03:14:58 +0000 (13:14 +1000)]
r600: reduce num compute threads to 1024.

I copied this value from radeonsi, but it was wrong, 1024
seems to be correct answer from looking at gpuinfo.

This should fix a few compute shader related hangs. (at least in CTS)

Cc: <>
(airlied: pushed because it avoids hangs)

3 years agofreedreno/a5xx: fix txf_ms
Rob Clark [Mon, 30 Jul 2018 14:36:23 +0000 (10:36 -0400)]
freedreno/a5xx: fix txf_ms

Somehow this got lost from the initial MSAA patch.

Signed-off-by: Rob Clark <>
3 years agonvc0: serialize before updating some constant buffer bindings on Maxwell+
Rhys Perry [Sun, 15 Jul 2018 22:14:41 +0000 (23:14 +0100)]
nvc0: serialize before updating some constant buffer bindings on Maxwell+

To avoid serializing, this has the user constant buffer always be 65536
bytes and enabled unless it's required that something else is used for
constant buffer 0.

Fixes artifacts with at least XCOM: Enemy Within, 0 A.D. and Unigine
Valley, Heaven and Superposition.

v2: changed uniform_buffer_bound to be bool instead of a uint32_t
v3: remove magic constants
v3: remove pointless code in nvc0_validate_driverconst

Signed-off-by: Rhys Perry <>
Reviewed-by: Ilia Mirkin <>
3 years agov3d: Block bin on render when doing vertex texturing.
Eric Anholt [Fri, 27 Jul 2018 20:13:55 +0000 (13:13 -0700)]
v3d: Block bin on render when doing vertex texturing.

The kernel by default serializes the BCL on previous BCLs submitted on
this FD, but not RCLs.  For now this fix is conservative and blocks on
last RCL if any vertex texturing is done, which fails to get bin/render
overlap if there was an intermediate job that doesn't draw to the BCL's
buffer.  I've dropped a perf_debug() in here to note that as a potential
future improvement.

Fixes intermittent failures in

3 years agov3d: Fix meson build without vc4.
Eric Anholt [Mon, 30 Jul 2018 02:22:33 +0000 (19:22 -0700)]
v3d: Fix meson build without vc4.

3 years agovc4: Fix meson build when enabled without v3d.
Eric Anholt [Mon, 30 Jul 2018 02:11:53 +0000 (19:11 -0700)]
vc4: Fix meson build when enabled without v3d.

Reported-by: Rob Clark <>
Fixes: e92959c4e03c ("v3d: Pass the whole clif_dump structure to v3d_print_group().")
3 years agonir/instr_set: Fix nir_instrs_equal for derefs
Jason Ekstrand [Wed, 25 Jul 2018 22:07:08 +0000 (15:07 -0700)]
nir/instr_set: Fix nir_instrs_equal for derefs

We weren't returning at the end of the nir_isntr_type_deref case in
nir_instrs_equal and it was falling through to the default of false.
While we're at it, make the default unreachable because all statements
in the switch now have their own returns.  Had we done that before, we
would have caught this bug a long time ago.

Fixes: 19a4662a540a8c94 "nir: Add a deref instruction type"
Reviewed-by: Caio Marcelo de Oliveira Filho <>
Reviewed-by: Thomas Helland<>
3 years agonir: Take if uses into account in ssa_def_components_read
Jason Ekstrand [Wed, 25 Jul 2018 17:33:33 +0000 (10:33 -0700)]
nir: Take if uses into account in ssa_def_components_read

Fixes: d800b7daa5440 "nir: Add a helper for figuring out what..."
Reviewed-by: Caio Marcelo de Oliveira Filho <>
3 years agoutil/list: Make some helpers take const lists
Jason Ekstrand [Wed, 25 Jul 2018 17:37:53 +0000 (10:37 -0700)]
util/list: Make some helpers take const lists

They're all just querying things about the list and not mutating

Reviewed-by: Thomas Helland<>
Reviewed-by: Christian Gmeiner <>
3 years agofreedreno/a5xx: small cleanup
Rob Clark [Tue, 24 Jul 2018 19:45:42 +0000 (15:45 -0400)]
freedreno/a5xx: small cleanup

We no longer have semi-custom clear pipe that uses 3d state.  Normal
clears happen via hw blitter, and everything else uses u_blitter these
days.  So we don't need this hack.

TODO a3xx+a4xx could get same treatment.

Signed-off-by: Rob Clark <>
3 years agofreedreno/a5xx: remove unused prototype
Rob Clark [Fri, 27 Jul 2018 13:52:35 +0000 (09:52 -0400)]
freedreno/a5xx: remove unused prototype

Signed-off-by: Rob Clark <>
3 years agofreedreno: fix caps harder
Rob Clark [Tue, 24 Jul 2018 18:17:37 +0000 (14:17 -0400)]
freedreno: fix caps harder

Fixes: 868ca81c and f485e567
Signed-off-by: Rob Clark <>
3 years agonir/lower_int64: mark all metadata as dirty
Karol Herbst [Mon, 16 Jul 2018 12:58:31 +0000 (14:58 +0200)]
nir/lower_int64: mark all metadata as dirty

v2: use nir_metadata_preserve
    preserve metadata in case of !progress

Fixes: 074f5ba0b56b12ddaca81eac3d9ed19da7054297
       "nir: Add a simple int64 lowering pass"
Signed-off-by: Karol Herbst <>
3 years agoandroid: radv: enable build of vulkan.radv HAL module
Mauro Rossi [Sat, 21 Jul 2018 11:11:34 +0000 (13:11 +0200)]
android: radv: enable build of vulkan.radv HAL module

src/amd/ requires to include src/amd/vulkan/
to enable the build of vulkan.radv module

Signed-off-by: Mauro Rossi <>
Reviewed-by: Robert Foss <>
Reviewed-by: Emil Velikov <>
3 years agoandroid: radv: add for vulkan.radv HAL module
Mauro Rossi [Sat, 21 Jul 2018 10:55:22 +0000 (12:55 +0200)]
android: radv: add for vulkan.radv HAL module

radv implements the Android Vulkan HAL interface, this patch adds building rules by porting of radv automake rules.
vendor HAL module is installed as /vendor/lib/hw/

Signed-off-by: Mauro Rossi <>
Reviewed-by: Emil Velikov <>
3 years agoradv: generate entrypoints for VK_ANDROID_native_buffer
Mauro Rossi [Mon, 11 Jun 2018 20:41:33 +0000 (22:41 +0200)]
radv: generate entrypoints for VK_ANDROID_native_buffer

Patch changes radv entrypoints generator to not skip this extension even
though it is set as disabled in the vk.xml

Reference: 63525ba730 ("android: enable VK_ANDROID_native_buffer")
Fixes: 69f447553c ("vulkan: Drop vk_android_native_buffer.xml")
Signed-off-by: Mauro Rossi <>
Reviewed-by: Bas Nieuwenhuizen <>
Reviewed-by: Robert Foss <>
Reviewed-by: Emil Velikov <>
3 years agoradv: move vk_format_table.c to generated sources
Mauro Rossi [Sun, 11 Feb 2018 23:17:23 +0000 (00:17 +0100)]
radv: move vk_format_table.c to generated sources

Android build system will try to compile vk_format_table.c
as a shipped source, but at compile time it will be missing,
we move it to generated source, where it belongs

Fixes: f4e499ec791 ("radv: add initial non-conformant radv vulkan driver")
Signed-off-by: Mauro Rossi <>
Reviewed-by: Bas Nieuwenhuizen <>
Reviewed-by: Robert Foss <>
Reviewed-by: Emil Velikov <>
3 years agoxlib: fix build break from _swrast_map_soft_renderbuffer() call
Brian Paul [Fri, 27 Jul 2018 21:17:35 +0000 (15:17 -0600)]
xlib: fix build break from _swrast_map_soft_renderbuffer() call

We need to pass the new flip_y argument.

Reviewed-by: Clayton Craft <>
3 years agoswrast: fix crash in AA line code when there's no texture
Brian Paul [Fri, 27 Jul 2018 18:59:29 +0000 (12:59 -0600)]
swrast: fix crash in AA line code when there's no texture

Fixes a crash running the Piglit polygon-mode-facing test (and
probably others).

Reviewed-by: Neha Bhende <>
3 years agomesa: add switch case for GL 2.1 in _mesa_compute_version()
Brian Paul [Fri, 27 Jul 2018 18:58:35 +0000 (12:58 -0600)]
mesa: add switch case for GL 2.1 in _mesa_compute_version()

The xlib/swrast driver only supports GL 2.1.  This patch fixes a
crash if the app calls glGetString(GL_SHADING_LANGUAGE_VERSION).

Reviewed-by: Neha Bhende <>
3 years agotgsi: whitespace fixes in tgsi_ureg.c
Brian Paul [Tue, 24 Jul 2018 02:20:34 +0000 (20:20 -0600)]
tgsi: whitespace fixes in tgsi_ureg.c


3 years agogallium/util: whitespace fixes in u_inlines.h
Brian Paul [Mon, 23 Jul 2018 21:48:22 +0000 (15:48 -0600)]
gallium/util: whitespace fixes in u_inlines.h


3 years agosvga: whitespace fixes in svga_tgsi_decl_sm30.c
Brian Paul [Mon, 23 Jul 2018 15:47:52 +0000 (09:47 -0600)]
svga: whitespace fixes in svga_tgsi_decl_sm30.c


3 years agomesa: replace tabs with spaces in mipmap.c
Brian Paul [Thu, 5 Jul 2018 16:47:32 +0000 (10:47 -0600)]
mesa: replace tabs with spaces in mipmap.c


3 years agogallium/util: whitespace fixes in u_debug_memory.c
Brian Paul [Mon, 2 Jul 2018 19:40:40 +0000 (13:40 -0600)]
gallium/util: whitespace fixes in u_debug_memory.c


3 years agomesa: whitespace clean-up in texstore.c
Brian Paul [Mon, 2 Jul 2018 18:47:20 +0000 (12:47 -0600)]
mesa: whitespace clean-up in texstore.c


3 years agomesa: move var decls in texstore_rgba()
Brian Paul [Mon, 2 Jul 2018 18:45:14 +0000 (12:45 -0600)]
mesa: move var decls in texstore_rgba()

Move them closer to where they're first used.

Reviewed-by: Charmaine Lee <>
3 years agomesa: remove unneeded free() call in texstore_rgba()
Brian Paul [Mon, 2 Jul 2018 18:39:44 +0000 (12:39 -0600)]
mesa: remove unneeded free() call in texstore_rgba()

The pointer will always be NULL since that's what we just tested for.

Reviewed-by: Charmaine Lee <>
3 years agov3d: Skip printing sub-id or pad fields in CLIF dumping.
Eric Anholt [Wed, 27 Jun 2018 22:42:10 +0000 (15:42 -0700)]
v3d: Skip printing sub-id or pad fields in CLIF dumping.

The parser doesn't expect them, so our fields would end up mismatched.
They're not really useful in console output, either.

3 years agov3d: Emit commands to switch CLIF parser to CL/shader/attr input mode.
Eric Anholt [Tue, 26 Jun 2018 20:04:09 +0000 (13:04 -0700)]
v3d: Emit commands to switch CLIF parser to CL/shader/attr input mode.

By default after saying you are emitting a buffer, it'll expect a buffer
size.  Once you set a format, it'll keep parsing that format until you
announce something else.

3 years agov3d: Dump fields in CLIF output in increasing offset order.
Eric Anholt [Tue, 26 Jun 2018 19:57:16 +0000 (12:57 -0700)]
v3d: Dump fields in CLIF output in increasing offset order.

Previously, we emitted in XML order, which I happen to type in the
decreasing offset order of the specifications.  However, the CLIF parser
wants increasing offsets.

3 years agov3d: Print addresses in CLIFs as references to buffers.
Eric Anholt [Mon, 25 Jun 2018 22:37:51 +0000 (15:37 -0700)]
v3d: Print addresses in CLIFs as references to buffers.

With CLIFs, the parser will choose an address for the buffer being
created, so we need to use effectively relocations to buffers instead of
the addresses that the driver uses.  This is also a whole lot more
intelligible for console output than raw addresses!

3 years agov3d: Stop doing pretty-printed colorful booleans in CLIF output.
Eric Anholt [Mon, 25 Jun 2018 22:18:51 +0000 (15:18 -0700)]
v3d: Stop doing pretty-printed colorful booleans in CLIF output.

The parser wants to see a 1 or 0.  We can put "true" and "false" in a
comment to clarify that it's a boolean and the parser will skip it.

3 years agov3d: Move clif dumping to a separate step from noting where the CLs are.
Eric Anholt [Mon, 25 Jun 2018 22:02:26 +0000 (15:02 -0700)]
v3d: Move clif dumping to a separate step from noting where the CLs are.

Now all the printing happens from the same worklist processing.

3 years agov3d: Move clif dump BO lookup into the clif dumper.
Eric Anholt [Mon, 25 Jun 2018 21:58:15 +0000 (14:58 -0700)]
v3d: Move clif dump BO lookup into the clif dumper.

The clif dumper is going to need information about all of our BOs if we're
going to dump them for replay purposes.

3 years agov3d: Pass the whole clif_dump structure to v3d_print_group().
Eric Anholt [Mon, 25 Jun 2018 18:01:44 +0000 (11:01 -0700)]
v3d: Pass the whole clif_dump structure to v3d_print_group().

To generate CLIF files that the v3dv3 simulator can parse, we're going to
need to decode addresses, and for that we'll need the vaddr lookup
function from the clif structure from within v3d_decoder.

3 years agoac: pass write param to get_sampler_desc() from get_image_descriptor()
Timothy Arceri [Fri, 27 Jul 2018 05:08:28 +0000 (15:08 +1000)]
ac: pass write param to get_sampler_desc() from get_image_descriptor()

Looks like a mistake from when the deref stuff landed.

Fixes: 506a07e4e3a4 ("ac/nir: Add deref support to image intrinsics.")
Reviewed-by: Bas Nieuwenhuizen <>
3 years agogallium/u_vbuf: split u_vbuf_get_minmax_index function (v2)
Marek Olšák [Tue, 17 Jul 2018 05:44:30 +0000 (01:44 -0400)]
gallium/u_vbuf: split u_vbuf_get_minmax_index function (v2)

This will be used by indirect multidraws.

v2: clean up the function further, change return types to unsigned

Reviewed-by: Eric Anholt <> (v1)
3 years agogallium/auxiliary: Extern "c" fixes.
Alexander von Gluck IV [Fri, 27 Jul 2018 20:09:37 +0000 (20:09 +0000)]
gallium/auxiliary: Extern "c" fixes.

Used by C++ code such as Haiku's renderer.

Reviewed-by: Brian Paul <>
3 years agogallium/noop: implement invalidate_resource
Marek Olšák [Fri, 27 Jul 2018 06:34:30 +0000 (02:34 -0400)]
gallium/noop: implement invalidate_resource

3 years agoradv: fix cdw check vs tracing emit
Dave Airlie [Fri, 27 Jul 2018 03:20:03 +0000 (04:20 +0100)]
radv: fix cdw check vs tracing emit

If we have tracing enabled we could do all the tracing emits
and overflow the precalculated cdw_max.

Reviewed-by: Samuel Pitoiset <>
3 years agoradv: return binary code_size not variant code size to cache
Dave Airlie [Fri, 27 Jul 2018 04:18:02 +0000 (05:18 +0100)]
radv: return binary code_size not variant code size to cache

The code sizes return here get passed to the cache shader insert function,
which then memcpy from the code ptr, and causes all sorts of valgrind
errors like:
==6755== Invalid read of size 8
==6755==    at 0x4C32FEE: memcpy@GLIBC_2.2.5 (vg_replace_strmem.c:1021)
==6755==    by 0x2305D4C7: radv_pipeline_cache_insert_shaders (radv_pipeline_cache.c:416)
==6755==    by 0x2305791D: radv_create_shaders (radv_pipeline.c:2158)
==6755==    by 0x2305C523: radv_pipeline_init (radv_pipeline.c:3404)
==6755==    by 0x2305C890: radv_graphics_pipeline_create (radv_pipeline.c:3515)
==6755==    by 0x230188AB: radv_device_init_meta_blit_color (radv_meta_blit.c:871)
==6755==    by 0x2301D50E: radv_device_init_meta_blit_state (radv_meta_blit.c:1278)
==6755==    by 0x23011893: radv_device_init_meta (radv_meta.c:352)
==6755==    by 0x2300744B: radv_CreateDevice (radv_device.c:1576)
==6755==    by 0x5187D0F: ??? (in /usr/lib64/
==6755==    by 0x518F6A3: ??? (in /usr/lib64/
==6755==    by 0x5192A42: vkCreateDevice (in /usr/lib64/
==6755==  Address 0x22a58548 is 4 bytes after a block of size 116 alloc'd
==6755==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==6755==    by 0x23089DC4: ac_elf_read (ac_binary.c:144)
==6755==    by 0x23090A60: ac_compile_module_to_binary (ac_llvm_helper.cpp:162)
==6755==    by 0x23053F06: compile_to_memory_buffer (radv_llvm_helper.cpp:58)
==6755==    by 0x23053F06: radv_compile_to_binary (radv_llvm_helper.cpp:98)
==6755==    by 0x23052769: ac_llvm_compile (radv_nir_to_llvm.c:3394)
==6755==    by 0x23052823: ac_compile_llvm_module (radv_nir_to_llvm.c:3418)
==6755==    by 0x23053C05: radv_compile_nir_shader (radv_nir_to_llvm.c:3542)
==6755==    by 0x23061B4E: shader_variant_create (radv_shader.c:580)
==6755==    by 0x23061CFD: radv_shader_variant_create (radv_shader.c:634)
==6755==    by 0x23057765: radv_create_shaders (radv_pipeline.c:2123)
==6755==    by 0x2305C523: radv_pipeline_init (radv_pipeline.c:3404)
==6755==    by 0x2305C890: radv_graphics_pipeline_create (radv_pipeline.c:3515)

Since we are just inserting the code into the cache, we can avoid these
bad reads and data in the cache by just using the binary code size here.

Fixes: 939e5a382 (radv: add padding for the UMR disassembler)
Reviewed-by: Samuel Pitoiset <>
3 years agov3d: Drop the use of the semaphores.
Eric Anholt [Thu, 26 Jul 2018 23:48:30 +0000 (16:48 -0700)]
v3d: Drop the use of the semaphores.

The kernel's scheduler doesn't rely on our emitting them, and in fact we'd
get in trouble if the kernel decided to schedule too many bins in a row
before getting around to scheduling the corresponding render.

3 years agov3d: Drop the VG support from the XML.
Eric Anholt [Thu, 26 Jul 2018 23:43:28 +0000 (16:43 -0700)]
v3d: Drop the VG support from the XML.

This reflects a change on the HW/closed SW side to drop this unused HW.
With it dropped on their side, the CLIF parser no longer expects to find
VG fields.

3 years agov3d: Use /* */ instead of () for enum names in CLIF output.
Eric Anholt [Mon, 25 Jun 2018 22:24:27 +0000 (15:24 -0700)]
v3d: Use /* */ instead of () for enum names in CLIF output.

This lets the comments be ignored by the CLIF parser.

3 years agov3d: CLIF-dump the "Vec size" field as 0 == maximum value.
Eric Anholt [Wed, 27 Jun 2018 23:34:50 +0000 (16:34 -0700)]
v3d: CLIF-dump the "Vec size" field as 0 == maximum value.

That's what a user should want to see, and what the CLIF parser wants.
This should maybe be generalized.

3 years agov3d: Stop using spaces in the names of our buffers.
Eric Anholt [Mon, 25 Jun 2018 23:08:06 +0000 (16:08 -0700)]
v3d: Stop using spaces in the names of our buffers.

For CLIF dumping, we need names to not have spaces.  Rather than rewriting
them after the fact, just change the two cases where I had put a space in.

3 years agoi965: implement GL_MESA_framebuffer_flip_y [v3]
Fritz Koenig [Mon, 23 Jul 2018 17:10:55 +0000 (10:10 -0700)]
i965: implement GL_MESA_framebuffer_flip_y [v3]

Instead of using _mesa_is_winsys_fbo or
_mesa_is_user_fbo to infer if an fbo is
flipped use the FlipY flag.

  * additional window-system framebuffer checks [for jason]
  * s/inverted_y/flip_y/g [for chadv]
  * s/InvertedY/FlipY/g [for chadv]

Reviewed-by: Chad Versace <>
3 years agomesa: GL_MESA_framebuffer_flip_y extension [v4]
Fritz Koenig [Mon, 23 Jul 2018 17:10:54 +0000 (10:10 -0700)]
mesa: GL_MESA_framebuffer_flip_y extension [v4]

Adds an extension to glFramebufferParameteri
that will specify if the framebuffer is vertically
flipped. Historically system framebuffers are
vertically flipped and user framebuffers are not.
Checking to see the state was done by looking at
the name field.  This adds an explicit field.

  * updated spec language [for chadv]
  * correctly specifying ES 3.1 [for chadv]
  * refactor access to rb->Name [for jason]
  * handle GetFramebufferParameteriv [for chadv]
  * correct _mesa_GetMultisamplefv [for kusmabite]
  * update spec language [for chadv]
  * s/GLboolean/bool/g [for chadv]
  * s/InvertedY/FlipY/g [for chadv]
  * s/inverted_y/flip_y/g [for chadv]
  * assert changes [for chadv]

Reviewed-by: Chad Versace <>
3 years agogallium/auxiliary: Fix Autotools on Android (v2)
Chad Versace [Wed, 25 Jul 2018 00:41:44 +0000 (17:41 -0700)]
gallium/auxiliary: Fix Autotools on Android (v2)

Problem 1: u_debug_stack_android.cpp transitively included
"pipe/p_compiler.h", but src/gallium/include was missing from the C++
include path.

Problem 2: Add -std=c++11 to AM_CXXFLAGS. Android's libbacktrace headers
require C++11, but the Android toolchain (at least in the Chrome OS SDK)
does not enable C++11 by default.

v2: Add -std=c++11.

Reviewed-by: Gurchetan Singh <>
Reviewed-by: Marek Olšák <>
Reviewed-by: Tomasz Figa <>
Cc: Eric Engestrom <>
3 years agoi965/icl: Disable binding table prefetching
Topi Pohjolainen [Wed, 30 May 2018 11:46:08 +0000 (07:46 -0400)]
i965/icl: Disable binding table prefetching

Gen 11 workarounds table #2056 WABTPPrefetchDisable suggests to
disable prefetching of binding tables for ICLLP A0 and B0
steppings. It fixes multiple gpu hangs in
ext_framebuffer_multisample* tests on ICLLP B0 h/w.

Anuj: Add comments and commit message.
      Add gen 11 checks in the code.

Signed-off-by: Anuj Phogat <>
Reviewed-by: Rafael Antognolli <>
3 years agoglsl: use only copy_propagation_elements
Caio Marcelo de Oliveira Filho [Fri, 15 Jun 2018 21:06:57 +0000 (14:06 -0700)]
glsl: use only copy_propagation_elements

Now that the elements version handles both cases, remove the
non-elements version.

Reviewed-by: Eric Anholt <>
Reviewed-by: Thomas Helland <>
3 years agoglsl: teach copy_propagation_elements to deal with whole variables
Caio Marcelo de Oliveira Filho [Wed, 27 Jun 2018 21:39:54 +0000 (14:39 -0700)]
glsl: teach copy_propagation_elements to deal with whole variables

Keep information in acp_entry whether the entry is full or not, and
use the ACP in more nodes when visiting the instructions:

- add_copy: write whole variables to the ACP state (regardless the

- visit(ir_dereference_variable *): perform the propagation here if we have a
  full candidate. Element-wise here doesn't apply because the mask
  isn't available at this point.

- visit_leave(ir_assignment *): process beyond scalar and vector, as
  the full variables might have other types.

Also import an improvement from opt_copy_propagation.cpp: if ir_call
is an intrinsic, we know the variables affected, so keep going.

v2: (all from Eric Anholt)
    Describe how acp_entry attributes are used.
    Don't do book-keeping to avoid adding repeated element to
    the dsts in write_elements().

v3: Use _mesa_set_remove_key. (Thomas Helland)

Reviewed-by: Eric Anholt <>
Reviewed-by: Thomas Helland <>
3 years agoi965: Disable guardband clipping on SandyBridge for odd dimensions
vadym.shovkoplias [Thu, 24 May 2018 11:16:46 +0000 (14:16 +0300)]
i965: Disable guardband clipping on SandyBridge for odd dimensions

Signed-off-by: Andriy Khulap <>
Acked-by: Rafael Antognolli <>
3 years agodocs: Update release calendar, add news item, and add release notes for 18.1.5
Dylan Baker [Fri, 27 Jul 2018 14:08:59 +0000 (07:08 -0700)]
docs: Update release calendar, add news item, and add release notes for 18.1.5

3 years agodocs: Add sha-256 sums for 18.1.5
Dylan Baker [Fri, 27 Jul 2018 14:06:08 +0000 (07:06 -0700)]
docs: Add sha-256 sums for 18.1.5

3 years agodocs: add 18.1.5 release notes
Dylan Baker [Thu, 26 Jul 2018 17:48:51 +0000 (10:48 -0700)]
docs: add 18.1.5 release notes

3 years agointel/compiler: fix lower conversions to account for predication
Iago Toral Quiroga [Tue, 17 Jul 2018 09:10:34 +0000 (11:10 +0200)]
intel/compiler: fix lower conversions to account for predication

The pass can create a temporary result for the instruction and then
moves from it to the original destination, however, if the original
instruction was predicated, the mov has to be predicated as well.

Reviewed-by: Jose Maria Casanova Crespo <>
3 years agoradv: allocate enough space in radv_cmd_buffer_after_draw()
Samuel Pitoiset [Wed, 25 Jul 2018 15:01:46 +0000 (17:01 +0200)]
radv: allocate enough space in radv_cmd_buffer_after_draw()

The driver might emit up to 4 dwords when RADV_TRACE_FILE is

Signed-off-by: Samuel Pitoiset <>
Reviewed-by: Bas Nieuwenhuizen <>
3 years agoradv: check CS space in radv_emit_write_data_packet()
Samuel Pitoiset [Wed, 25 Jul 2018 14:56:06 +0000 (16:56 +0200)]
radv: check CS space in radv_emit_write_data_packet()

This wasn't wrong but it looks better to me like this. It's
only used for debugging purposes (ie. RADV_TRACE_FILE).

Signed-off-by: Samuel Pitoiset <>
Reviewed-by: Bas Nieuwenhuizen <>
3 years agoradv: do not emit pipeline stats flushes on compute queue
Samuel Pitoiset [Fri, 27 Jul 2018 09:50:27 +0000 (11:50 +0200)]
radv: do not emit pipeline stats flushes on compute queue

Signed-off-by: Samuel Pitoiset <>
Reviewed-by: Bas Nieuwenhuizen <>
3 years agoradv: reduce CB/DB meta flushes in radv_dst_access_flush()
Samuel Pitoiset [Fri, 27 Jul 2018 09:50:03 +0000 (11:50 +0200)]
radv: reduce CB/DB meta flushes in radv_dst_access_flush()

Signed-off-by: Samuel Pitoiset <>
Reviewed-by: Bas Nieuwenhuizen <>
3 years agoradv: Fix build
Kenneth Graunke [Fri, 27 Jul 2018 06:56:30 +0000 (23:56 -0700)]
radv: Fix build

I renamed this pass and forgot to update radv.

Fixes: 488972222c6454551ab1559f753c13a493dc513f ("i965: Combine both gl_PatchVerticesIn lowering passes.")
3 years agoi965: Combine both gl_PatchVerticesIn lowering passes.
Kenneth Graunke [Wed, 18 Jul 2018 23:42:03 +0000 (16:42 -0700)]
i965: Combine both gl_PatchVerticesIn lowering passes.

Until now, we had separate passes for lowering gl_PatchVerticesIn to
a statically known constant (for TES inputs when linked against a TCS),
and a uniform in the other cases.  Annoyingly, one had to be run before
nir_lower_system_values, and the other afterward.  This simplified the
passes, but made life painful for the callers.

This patch combines both into a single pass.  If you give it a non-zero
static count, it uses that.  If you give it Mesa state slots, it turns
it back into a built-in uniform.  Otherwise, it does nothing.

This also moves the i965 uniform lowering out to shared code.

v2: Make token arrays const.

Reviewed-by: Eric Anholt <>
3 years agoi965: Expose EXT_base_instance extension in OpenGLES 3.0
Sagar Ghuge [Wed, 25 Jul 2018 17:48:31 +0000 (10:48 -0700)]
i965: Expose EXT_base_instance extension in OpenGLES 3.0

The extension requires at least OpenGL 3.0 and
OpenGL ES 3.0.

Fixes two ext_base_instance tests:


Signed-off-by: Sagar Ghuge <>
Reviewed-by: Jordan Justen <>
Reviewed-by: Anuj Phogat <>
3 years agoradv: Add support for ETC2 textures.
Bas Nieuwenhuizen [Thu, 4 Jan 2018 00:32:04 +0000 (01:32 +0100)]
radv: Add support for ETC2 textures.

Was surprised that is even supported by Vega.

Reviewed-by: Samuel Pitoiset <>
3 years agoclover: Reduce wait_count in abort path.
Jan Vesely [Wed, 25 Jul 2018 02:17:28 +0000 (22:17 -0400)]
clover: Reduce wait_count in abort path.

Trigger waiter condition variable.
Passes 'events' CTS on carrizo and turks.
v2: reduce to 0

Signed-off-by: Jan Vesely <>
Reviewed-by: Francisco Jerez <>
3 years agoclover: Don't extend illegal integer types.
Jan Vesely [Sun, 22 Jul 2018 18:14:21 +0000 (14:14 -0400)]
clover: Don't extend illegal integer types.

It's OK to pass them in memory, which is what kernel invocation needs.
Fixes regressions since llvm r337535 ("Reapply "AMDGPU: Fix handling of alignment padding in DAG argument lowering"):

Signed-off-by: Jan Vesely <>
Reviewed-by: Francisco Jerez <>
3 years agointel/compiler: Delete dead VS intrinsic handling.
Kenneth Graunke [Wed, 18 Jul 2018 22:45:46 +0000 (15:45 -0700)]
intel/compiler: Delete dead VS intrinsic handling.

These are lowered by brw_nir_lower_vs_inputs().  If they weren't, we
would have already hit the unreachable() in emit_system_values_block().

Reviewed-by: Jason Ekstrand <>