mesa.git
7 years agoegl/x11: Honor the EGL_PLATFORM_X11_SCREEN_EXT attribute
Adam Jackson [Tue, 2 May 2017 16:27:01 +0000 (12:27 -0400)]
egl/x11: Honor the EGL_PLATFORM_X11_SCREEN_EXT attribute

Introduce _egl_display::Options::Platforms for private storage.
For X11 platforms we can use it for the screen number as set by
EGL_PLATFORM_X11_SCREEN_EXT.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
7 years agoanv: vkBindImageMemory() should return VK_ERROR_OUT_OF_{HOST,DEVICE}_MEMORY on failure
Samuel Iglesias Gonsálvez [Thu, 4 May 2017 09:57:36 +0000 (11:57 +0200)]
anv: vkBindImageMemory() should return VK_ERROR_OUT_OF_{HOST,DEVICE}_MEMORY on failure

According to the spec we get VK_ERROR_OUT_OF_HOST_MEMORY or
VK_ERROR_OUT_OF_DEVICE_MEMORY on vkBindImageMemory failure.

Fixes returned value changed by b546c9d.

Fixes: b546c9d ("anv: anv_gem_mmap() returns MAP_FAILED as mapping error")
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: "17.0 17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoglsl: reject memory qualifiers with uniform blocks
Samuel Pitoiset [Wed, 3 May 2017 16:37:28 +0000 (18:37 +0200)]
glsl: reject memory qualifiers with uniform blocks

The spec allows memory qualifiers to be used with image variables,
buffers variables and shader storage blocks. This patch also fixes
validate_memory_qualifier_for_type().

Fixes the following ARB_uniform_buffer_object test:

uniform-block-memory-qualifier.frag

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: reject format qualifiers with non-image types everywhere
Samuel Pitoiset [Mon, 1 May 2017 10:34:42 +0000 (12:34 +0200)]
glsl: reject format qualifiers with non-image types everywhere

Including structures, interfaces and uniform blocks.

Fixes the following ARB_shader_image_load_store test:

format-layout-with-non-image-type.frag

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: rework validate_image_qualifier_for_type()
Samuel Pitoiset [Mon, 1 May 2017 10:34:41 +0000 (12:34 +0200)]
glsl: rework validate_image_qualifier_for_type()

It makes more sense to have two separate validate functions,
mainly because memory qualifiers are allowed with members of
shader storage blocks.

validate_memory_qualifier_for_type() will be fixed in a
separate patch.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: rename image_* qualifiers to memory_*
Samuel Pitoiset [Wed, 3 May 2017 09:16:57 +0000 (11:16 +0200)]
glsl: rename image_* qualifiers to memory_*

It doesn't make sense to prefix them with 'image' because
they are called "Memory Qualifiers" and they can be applied
to members of storage buffer blocks.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Andres Gomez <agomez@igalia.com>
7 years agoanv: anv_gem_mmap() returns MAP_FAILED as mapping error
Samuel Iglesias Gonsálvez [Wed, 3 May 2017 06:02:21 +0000 (08:02 +0200)]
anv: anv_gem_mmap() returns MAP_FAILED as mapping error

Take it into account when checking if the mapping failed.

v2:
- Remove map == NULL and its related comment (Emil)

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Fixes: 6f3e3c715a7 ("vk/allocator: Add a BO pool")
Fixes: 9919a2d34de ("anv/image: Memset hiz surfaces to 0 when binding memory")
Cc: "17.0 17.1" <mesa-stable@lists.freedesktop.org>
7 years agonir/lower_tex: Fix minor error in YUV color conversion matrix
Johnson Lin [Thu, 4 May 2017 06:37:52 +0000 (14:37 +0800)]
nir/lower_tex: Fix minor error in YUV color conversion matrix

The matrix used for YCbCr to RGB is listed in:

    https://en.wikipedia.org/wiki/YCbCr

There was an error in converting the offsets from integers to unorm
values: 0.0625=16/256 should be 16.0/255,and 0.5=128.0/256 should be
128.0/255.  With this fix, the CSC result is bit aligned with wikipedia's
conversion result and FFMPeg's result.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100854
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
7 years agoi965: Port gen4+ state emitting code to genxml.
Rafael Antognolli [Wed, 19 Apr 2017 20:13:25 +0000 (13:13 -0700)]
i965: Port gen4+ state emitting code to genxml.

On this patch, we port:
   - brw_polygon_stipple
   - brw_polygon_stipple_offset
   - brw_line_stipple
   - brw_drawing_rect

v2:
   - Also emit states for gen4-5 with this code.
v3:
   - Style fixes and remove excessive checks (Ken).

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port gen6+ 3DSTATE_CC_STATE_POINTERS state to genxml.
Rafael Antognolli [Wed, 19 Apr 2017 23:16:24 +0000 (16:16 -0700)]
i965: Port gen6+ 3DSTATE_CC_STATE_POINTERS state to genxml.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port gen6+ multisample state emitting code to genxml.
Rafael Antognolli [Wed, 19 Apr 2017 16:56:36 +0000 (09:56 -0700)]
i965: Port gen6+ multisample state emitting code to genxml.

Emit 3DSTATE_MULTISAMPLE using brw_batch_emit.

v3:
   - Remove dead code (Ken)
   - Simplify #if/#endif (Ken)

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port gen4+ emit vertices code to genxml.
Rafael Antognolli [Thu, 6 Apr 2017 23:43:49 +0000 (16:43 -0700)]
i965: Port gen4+ emit vertices code to genxml.

Some code that was placed in brw_draw_upload.c and exported to be used
by gen8+ was also moved to genX_state_upload, and the respective symbols
are not exported anymore.

v2:
   - Remove code from brw_draw_upload too
   - Emit vertices for gen4-5 too.
   - Use helper to setup brw_address (Kristian)
   - Use macros for MOCS values.
   - Do not use #ifndef NDEBUG on code that is actually used (Ken)
v3:
   - Style and code clenup (Ken)
   - Keep some of the common code inside brw_draw_upload.c (Ken)

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port push constant code to genxml.
Rafael Antognolli [Wed, 5 Apr 2017 23:22:43 +0000 (16:22 -0700)]
i965: Port push constant code to genxml.

The following states are ported on this patch:
   - gen6_gs_push_constants
   - gen6_vs_push_constants
   - gen6_wm_push_constants
   - gen7_tes_push_constants

v2:
   - Use helper to setup brw_address (Kristian)
v3:
   - Do not use macro for upload_constant_state (Ken)
   - Do not re-declare MOCS macro (Ken)
v4: (by Ken)
   - Drop more dead code, change brw->gen checks to GEN_GEN, style nits

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port gen6+ 3DSTATE_SCISSOR_STATE_POINTERS to use genxml.
Rafael Antognolli [Thu, 30 Mar 2017 16:52:19 +0000 (09:52 -0700)]
i965: Port gen6+ 3DSTATE_SCISSOR_STATE_POINTERS to use genxml.

Emit 3DSTATE_SCISSOR_STATE_POINTERS using brw_batch_emit, and pack the
scissor states using GENX(SCISSOR_RECT_pack), generated from genxml.

v3:
   - Remove old code (Ken)
   - Style fixes (Ken)

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port gen7+ 3DSTATE_TE to genxml.
Rafael Antognolli [Wed, 29 Mar 2017 20:43:51 +0000 (13:43 -0700)]
i965: Port gen7+ 3DSTATE_TE to genxml.

Emit 3DSTATE_TE on Gen7+ using brw_batch_emit helper.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port gen6+ blend state code to genxml.
Rafael Antognolli [Mon, 27 Mar 2017 22:52:10 +0000 (15:52 -0700)]
i965: Port gen6+ blend state code to genxml.

Upload blend states using GENX(BLEND_STATE_ENTRY_pack), generated from
genxml.

v3:
   - style fixes (Ken)
   - cleanup to remove excessive #ifdef's (Ken)
   - remove memset (Ken)
   - disable blend.AlphaToCoverageDitherEnable on gen6 (Ken)

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port gen6+ state emitting code to genxml.
Rafael Antognolli [Mon, 27 Mar 2017 15:42:45 +0000 (08:42 -0700)]
i965: Port gen6+ state emitting code to genxml.

Ported in this patch:
   - 3DSTATE_DS
   - 3DSTATE_GS
   - 3DSTATE_HS
   - 3DSTATE_VIEWPORT_STATE_POINTERS_SF_CL

v3:
   - Remove NEW_TRANSFORM blocks (Ken)
   - Bring back some comments and workaround for Ivybridge (Ken)

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port gen6+ 3DSTATE_VS to genxml.
Rafael Antognolli [Wed, 22 Mar 2017 23:26:55 +0000 (16:26 -0700)]
i965: Port gen6+ 3DSTATE_VS to genxml.

Emit 3DSTATE_VS on Gen6+ using brw_batch_emit helper, that uses pack
structs from genxml.

v2:
   - Use render_bo helper to setup brw_address (Kristian)
v3:
   - Bring back some comments for gen6 and remove _NEW_TRANSFORM blocks
   from gen7+.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port gen8+ 3DSTATE_PS_EXTRA to genxml.
Rafael Antognolli [Tue, 21 Mar 2017 23:29:23 +0000 (16:29 -0700)]
i965: Port gen8+ 3DSTATE_PS_EXTRA to genxml.

Emit 3DSTATE_PS_EXTRA on Gen8+ using brw_batch_emit helper, that uses
pack structs from genxml.

v3:
   - Style fixes and moving code around to be cleaner (Ken)

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port gen6+ 3DSTATE_WM to genxml.
Rafael Antognolli [Tue, 21 Mar 2017 21:55:50 +0000 (14:55 -0700)]
i965: Port gen6+ 3DSTATE_WM to genxml.

Emit 3DSTATE_WM on Gen6+ using brw_batch_emit helper, that uses pack
structs from genxml.

v2:
   - Use render_bo helper to setup brw_address (Kristian)
   - Remove TODO and use BRW_PSCDEPTH_OFF.
v3:
   - A couple of style fixes (Ken)
   - Enable RASTRULE_UPPER_RIGHT on gen6+ instead of gen8+ (Ken)

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port gen7+ 3DSTATE_PS to genxml.
Rafael Antognolli [Tue, 21 Mar 2017 20:08:05 +0000 (13:08 -0700)]
i965: Port gen7+ 3DSTATE_PS to genxml.

Emit 3DSTATE_PS on Gen7+ using brw_batch_emit helper, that uses pack
structs from genxml.

v2:
   - Use render_bo helper to setup brw_address (Kristian)
v3:
   - Style fixes and code cleanup (Ken)
v4:
   - More style fixes and code cleanup missed in v3

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port gen7+ 3DSTATE_SOL to genxml.
Rafael Antognolli [Tue, 21 Mar 2017 14:30:03 +0000 (07:30 -0700)]
i965: Port gen7+ 3DSTATE_SOL to genxml.

Emit 3DSTATE_SOL on Gen7+ using brw_batch_emit helper, that uses pack
structs from genxml.

v2:
   - Add helpers to assign struct brw_address (Kristian)
v3:
   - Rename MOCS -> SOBufferMOCS
   - Do not re-declare MOCS macros (Ken).
   - Style and code reorganization (Ken).

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Remove calculate_attr_overrides.
Rafael Antognolli [Mon, 20 Mar 2017 18:12:25 +0000 (11:12 -0700)]
i965: Remove calculate_attr_overrides.

This function now lives inside genX_state_upload.c.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port Gen7+ 3DSTATE_SBE state to genxml.
Rafael Antognolli [Mon, 20 Mar 2017 17:32:53 +0000 (10:32 -0700)]
i965: Port Gen7+ 3DSTATE_SBE state to genxml.

Emit 3DSTATE_SBE on Gen7+ using brw_batch_emit helper, that uses pack
structs from genxml.

v2: - Use ACTIVE_COMPONENT_XYZW from gen9.xml.
v3: - Style fixes (Ken)
v4: #undef unconditionally (Ken)

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port gen6+ 3DSTATE_SF to genxml.
Rafael Antognolli [Fri, 17 Mar 2017 17:23:45 +0000 (10:23 -0700)]
i965: Port gen6+ 3DSTATE_SF to genxml.

Emit sf state on Gen6+ using brw_batch_emit helper, using pack structs
from genxml.

v3:
   - Reorganize code and reduce #if/#endif's (Ken)
   - Style fixes (Ken)
   - Always set AALINEDISTANCE_TRUE (Ken)

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Add brw_get_line_width_float.
Rafael Antognolli [Wed, 26 Apr 2017 23:27:13 +0000 (16:27 -0700)]
i965: Add brw_get_line_width_float.

That helper function returns the line width as a float, and is then used
by brw_get_line_width to return the fixed point width.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port Gen8+ 3DSTATE_RASTER state to genxml.
Rafael Antognolli [Thu, 16 Mar 2017 18:39:31 +0000 (11:39 -0700)]
i965: Port Gen8+ 3DSTATE_RASTER state to genxml.

Emits 3DSTATE_RASTER from genX_state_upload.c using pack structs from
genxml.

v3:
   - Style fixes (Ken)

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port Gen6+ 3DSTATE_CLIP state to genxml.
Rafael Antognolli [Thu, 16 Mar 2017 00:08:26 +0000 (17:08 -0700)]
i965: Port Gen6+ 3DSTATE_CLIP state to genxml.

Emit clip state on Gen6+ using brw_batch_emit helper, using pack structs
from genxml.

v3:
   - Lots style fixes (Ken)
   - Do not set CullTestEnableBitMask on Gen8+ (Ken)
v4:
   - Do not include brw_defines_common.h.
v5 (Ken): s/BRW_NEW_WM_PROG_DATA/BRW_NEW_FS_PROG_DATA/

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Port Gen6+ DEPTH_STENCIL state to genxml.
Kenneth Graunke [Wed, 8 Mar 2017 05:54:24 +0000 (21:54 -0800)]
i965: Port Gen6+ DEPTH_STENCIL state to genxml.

This emits 3DSTATE_WM_DEPTH_STENCIL on Gen8+ or DEPTH_STENCIL_STATE
(and the relevant pointer packets) on Gen6-7.5 from a single function.

v3:
   - Watch for BRW_NEW_BATCH too on gen < 8 (Ken)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Get real per-gen atom lists
Kenneth Graunke [Mon, 13 Mar 2017 22:36:43 +0000 (15:36 -0700)]
i965: Get real per-gen atom lists

Make atoms initalization compile conditionally based on the target
platform.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoi965: Add genxml related plumbing in a new genX_state_upload.c file.
Kenneth Graunke [Wed, 8 Mar 2017 05:42:30 +0000 (21:42 -0800)]
i965: Add genxml related plumbing in a new genX_state_upload.c file.

v3 (Rafael): Drop aub parameter
v4 (Ken): Squash in gen4/g45 automake fixes

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoi965: Drop "Destination Element Offset" from Ironlake SGVs.
Kenneth Graunke [Fri, 28 Apr 2017 21:09:24 +0000 (14:09 -0700)]
i965: Drop "Destination Element Offset" from Ironlake SGVs.

The Ironlake documentation is terrible, so it's unclear whether or not
this field exists there.  It definitely doesn't exist on Sandybridge
and later.  It definitely does exist on G45.

We haven't been setting it for our normal vertex attributes - just
the SGVs (VertexID, InstanceID, BaseVertex, BaseInstance, DrawID).
We should be consistent.  My guess is that it isn't necessary and
doesn't exist - this patch drops it from the SGVs elements, making
them follow the behavior of most attributes.

Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agogenxml: Fix 3DSTATE_DEPTH_BUFFER length on gen5.
Rafael Antognolli [Thu, 4 May 2017 00:53:35 +0000 (17:53 -0700)]
genxml: Fix 3DSTATE_DEPTH_BUFFER length on gen5.

The hardware docs are wrong, but the length used in the xml is also
wrong.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoradeonsi: constify a bunch of the perfcounter structs.
Dave Airlie [Tue, 2 May 2017 22:40:41 +0000 (08:40 +1000)]
radeonsi: constify a bunch of the perfcounter structs.

This moves the structs from the data segment to the rodata segment,
which seems like the more correct place for them.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agost/glsl_to_tgsi: remove unrequired tgsi_get_opcode_info() call
Timothy Arceri [Wed, 3 May 2017 00:48:06 +0000 (10:48 +1000)]
st/glsl_to_tgsi: remove unrequired tgsi_get_opcode_info() call

This is already set for the instruction at initialisation.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agomesa: make _mesa_accum() static
Timothy Arceri [Wed, 3 May 2017 03:34:42 +0000 (13:34 +1000)]
mesa: make _mesa_accum() static

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa: tidy up accum.h
Timothy Arceri [Wed, 3 May 2017 03:33:58 +0000 (13:33 +1000)]
mesa: tidy up accum.h

These were unused.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa/varray: make use of dispatch KHR_no_error support
Timothy Arceri [Thu, 27 Apr 2017 04:56:44 +0000 (14:56 +1000)]
mesa/varray: make use of dispatch KHR_no_error support

Make use of dispatch KHR_no_error support for varray functions.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglapi: add KHR_no_error support to dispatch table generation
Timothy Arceri [Thu, 27 Apr 2017 03:32:43 +0000 (13:32 +1000)]
glapi: add KHR_no_error support to dispatch table generation

This will allows us to create no error versions of functions
noted by a _no_error suffix. We also need to set a no_error
attribute equal to "true" in the xml.

V3: stop the no_error attribute being overwritten when functions
    alias another.
V2: tidy up suggested by Nicolai.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradv: Don't use FLAT_SHADE for constants.
Bas Nieuwenhuizen [Wed, 3 May 2017 17:52:12 +0000 (19:52 +0200)]
radv: Don't use FLAT_SHADE for constants.

Setting both offset to 0x20 and flat shade results in passthrough
mode instead of the constant.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Fixes: f205e19e4f8 "radv/ac: eliminate unused vertex shader outputs. (v2)"
7 years agoi965: Move MOCS macros to brw_context.h.
Rafael Antognolli [Fri, 28 Apr 2017 16:02:31 +0000 (09:02 -0700)]
i965: Move MOCS macros to brw_context.h.

These macros are defined in brw_defines.h, which contains a lot of
macros that conflict with autogenerated code from genxml. But we need to
use them (the MOCS macros) in some of that same genxml code.

Moving them to brw_context.h solves that problem and we don't have to
include brw_defines.h.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoanv: Use BRW_BARYCENTRIC_NONPERSPECTIVE_BITS from common header.
Rafael Antognolli [Mon, 24 Apr 2017 18:25:07 +0000 (11:25 -0700)]
anv: Use BRW_BARYCENTRIC_NONPERSPECTIVE_BITS from common header.

In a previous patch some enums were split out from brw_eu_defines.h, so
they could be used by genxml based code. anv can also benefit from this.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Move enums to brw_compiler.h.
Rafael Antognolli [Tue, 2 May 2017 16:20:02 +0000 (09:20 -0700)]
i965: Move enums to brw_compiler.h.

These enums live inside struct brw_wm_prog_data, so it makes sense to
keep them in the same header. It also allows to use them without
including brw_eu_defines.h.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogenxml: Update 3DSTATE_LINE_STIPPLE xml on gen6.
Rafael Antognolli [Tue, 2 May 2017 17:01:15 +0000 (10:01 -0700)]
genxml: Update 3DSTATE_LINE_STIPPLE xml on gen6.

From the PRM, Line Stipple Inverse Repeat Count is on dw2, bits 31:16,
format U1.13.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogenxml: Normalize xml for 3DSTATE_CC_STATE_POINTERS.
Rafael Antognolli [Wed, 19 Apr 2017 23:13:20 +0000 (16:13 -0700)]
genxml: Normalize xml for 3DSTATE_CC_STATE_POINTERS.

   - "COLOR_CALC_STATE Change" -> "Color Calc State Pointer Valid"
   - "Pointer to COLOR_CALC_STATE" -> "Color Calc State Pointer"
   - "BackFace" -> "Backface"

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogenxml: Normalize xml for 3DSTATE_MULTISAMPLE.
Rafael Antognolli [Wed, 19 Apr 2017 23:04:12 +0000 (16:04 -0700)]
genxml: Normalize xml for 3DSTATE_MULTISAMPLE.

Name the options to "Pixel Location":
   - PIXLOC_CENTER -> CENTER
   - PIXLOC_UL_CORNER -> UL_CORNER

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogenxml: Rename "Function Enable" to "Enable".
Rafael Antognolli [Fri, 31 Mar 2017 22:30:49 +0000 (15:30 -0700)]
genxml: Rename "Function Enable" to "Enable".

Rename that field name on genxml for:
   - 3DSTATE_GS - gen6+
   - 3DSTATE_DS - gen7+
   - 3DSTATE_HS - gen7+

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogenxml: Clip guardbands are float, not int.
Rafael Antognolli [Thu, 30 Mar 2017 17:36:25 +0000 (10:36 -0700)]
genxml: Clip guardbands are float, not int.

This makes genxml create the right struct types, and generate the right
batch commands.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogenxml: 3DSTATE_VS rename Function Enable to Enable.
Rafael Antognolli [Wed, 22 Mar 2017 23:26:07 +0000 (16:26 -0700)]
genxml: 3DSTATE_VS rename Function Enable to Enable.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogenxml: Make "Reorder Mode" fields consistent.
Kenneth Graunke [Wed, 7 Sep 2016 20:46:57 +0000 (13:46 -0700)]
genxml: Make "Reorder Mode" fields consistent.

Both GS and SOL have these fields.  Some were ReorderEnable = true,
some were ReorderMode = REORDER_TRAILING, and some were just TRAILING.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agogenxml: Add alias for MOCS.
Rafael Antognolli [Mon, 20 Mar 2017 23:27:40 +0000 (16:27 -0700)]
genxml: Add alias for MOCS.

Use an alias, so we can set the same value as the #define's.

v3:
   - Call it "SO Buffer MOCS" to follow the most common naming scheme.
   - Add alias for gen7 and gen75 too (Ken).

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogenxml: Add missing field values to 3DSTATE_SBE.
Rafael Antognolli [Mon, 24 Apr 2017 18:03:14 +0000 (11:03 -0700)]
genxml: Add missing field values to 3DSTATE_SBE.

Fill out "Attribute Active Component Format" possible values.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogenxml: Update xml for 3DSTATE_SF.
Rafael Antognolli [Fri, 31 Mar 2017 22:25:20 +0000 (15:25 -0700)]
genxml: Update xml for 3DSTATE_SF.

 - Normalize "Anti-Aliasing Enable"
 - Add "Multisample Rasterization Mode" constants
 - Rename "Use Point Width on Vertex" to "Vertex"
 - Rename "Use Point Width from State" to "State"

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogenxml: Rename clip enable property.
Rafael Antognolli [Thu, 16 Mar 2017 00:07:10 +0000 (17:07 -0700)]
genxml: Rename clip enable property.

There are two variants:
   - Clip Enable
   - CLIP Enable (on gen6)

Rename everything to Clip Enable.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogenxml: Fill out Gen4, Gen45 and Gen5 XML
Louis-Francis Ratté-Boulianne [Thu, 20 Apr 2017 22:21:38 +0000 (15:21 -0700)]
genxml: Fill out Gen4, Gen45 and Gen5 XML

Add some more details to Gen4 and Gen45 and add what is needed
in Gen5 XML. This commit overwrite the previous work done on Gen4
and Gen45 as it contains more instructions and fixes some mistakes.
However, comments (dword boundaries) are lost in the process.

v3:
   - Set the type of some fields, instead of prefix. Also fix the
     SAMPLER_BORDER_COLOR_STATE fields of gen5.xml.

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoanv: Implement VK_KHX_external_semaphore_fd
Jason Ekstrand [Thu, 16 Feb 2017 01:25:46 +0000 (17:25 -0800)]
anv: Implement VK_KHX_external_semaphore_fd

This implementation allocates a 4k BO for each semaphore that can be
exported using OPAQUE_FD and uses the kernel's already-existing
synchronization mechanism on BOs.

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: Pull the guts of cmd_buffer_execbuf into a helper
Jason Ekstrand [Tue, 28 Feb 2017 00:41:53 +0000 (16:41 -0800)]
anv: Pull the guts of cmd_buffer_execbuf into a helper

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: Implement VK_KHX_external_semaphore
Jason Ekstrand [Thu, 16 Feb 2017 00:06:42 +0000 (16:06 -0800)]
anv: Implement VK_KHX_external_semaphore

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: Implement VK_KHX_external_semaphore_capabilities
Jason Ekstrand [Thu, 16 Feb 2017 00:00:05 +0000 (16:00 -0800)]
anv: Implement VK_KHX_external_semaphore_capabilities

This just stubs things out.  Real external semaphore support will come
with VK_KHX_external_semaphore_fd.

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: Add a real semaphore struct
Jason Ekstrand [Wed, 15 Feb 2017 23:35:38 +0000 (15:35 -0800)]
anv: Add a real semaphore struct

It's just a dummy for now, but we'll flesh it out as needed for external
semaphores.

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoradeonsi/gfx9: fix gl_ViewportIndex
Marek Olšák [Mon, 1 May 2017 15:34:41 +0000 (17:34 +0200)]
radeonsi/gfx9: fix gl_ViewportIndex

v2: remove unnecessary LLVMBuildAnd calls

Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: set VGT_REUSE_OFF = 0
Marek Olšák [Tue, 2 May 2017 13:32:32 +0000 (15:32 +0200)]
radeonsi/gfx9: set VGT_REUSE_OFF = 0

same as Vulkan

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoetnaviv: add L8A8_UNORM texture format
Christian Gmeiner [Tue, 2 May 2017 20:06:53 +0000 (22:06 +0200)]
etnaviv: add L8A8_UNORM texture format

No piglit regressions.

CC: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
7 years agoglsl: Corrected some typos and error messages
Andres Gomez [Wed, 3 May 2017 18:35:24 +0000 (21:35 +0300)]
glsl: Corrected some typos and error messages

v2: left code style/formatting corrections out.

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agoradv: don't leak DRM devices
Grazvydas Ignotas [Tue, 2 May 2017 17:05:07 +0000 (20:05 +0300)]
radv: don't leak DRM devices

After successful drmGetDevices2() call, drmFreeDevices() needs to be called.

Fixes: 743315f2 "radv: do not open random render node(s)"
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoradv: fix possible stack corruption
Grazvydas Ignotas [Tue, 2 May 2017 16:41:13 +0000 (19:41 +0300)]
radv: fix possible stack corruption

drmGetDevices2 takes count and not size. Probably hasn't caused problems
yet in practice and was missed as setups with more than 8 DRM devices
are not very common.

Fixes: 743315f2 "radv: do not open random render node(s)"
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoac: eliminate duplicated VS exports
Marek Olšák [Sat, 29 Apr 2017 21:56:03 +0000 (23:56 +0200)]
ac: eliminate duplicated VS exports

Only very few shaders have them (from 48486 shaders):

shaders/private/left_4_dead_2/765.shader_test - ac: 1 matches 2
shaders/private/left_4_dead_2/877.shader_test - ac: 1 matches 6
shaders/private/left_4_dead_2/2141.shader_test - ac: 1 matches 6
shaders/private/ue4_effects_cave/11.shader_test - ac: 4 matches 5
shaders/private/ue4_effects_cave/14.shader_test - ac: 5 matches 6
shaders/private/ue4_effects_cave/46.shader_test - ac: 5 matches 6
shaders/private/ue4_effects_cave/42.shader_test - ac: 4 matches 5
shaders/private/ue4_effects_cave/104.shader_test - ac: 4 matches 5
shaders/private/f1-2015/336.shader_test - ac: 3 matches 4
shaders/private/f1-2015/948.shader_test - ac: 6 matches 7
shaders/private/f1-2015/602.shader_test - ac: 0 matches 3
shaders/private/f1-2015/600.shader_test - ac: 0 matches 3
shaders/private/f1-2015/1214.shader_test - ac: 0 matches 1
shaders/private/f1-2015/988.shader_test - ac: 4 matches 5
shaders/private/ue4_elemental/149.shader_test - ac: 3 matches 4
shaders/private/ue4_elemental/346.shader_test - ac: 4 matches 5
shaders/private/ue4_elemental/178.shader_test - ac: 3 matches 4
shaders/private/ue4_elemental/136.shader_test - ac: 4 matches 5
shaders/private/ue4_elemental/168.shader_test - ac: 4 matches 5
shaders/private/ue4_elemental/690.shader_test - ac: 3 matches 4
shaders/private/ue4_elemental/19.shader_test - ac: 5 matches 6
shaders/private/dota2/1901.shader_test - ac: 0 matches 5
shaders/private/dota2/1357.shader_test - ac: 0 matches 5
shaders/private/dota2/1375.shader_test - ac: 0 matches 5
shaders/private/dota2/1369.shader_test - ac: 0 matches 5
shaders/private/dota2/1583.shader_test - ac: 0 matches 5
shaders/private/dota2/1811.shader_test - ac: 0 matches 5
shaders/private/dota2/1893.shader_test - ac: 0 matches 5
shaders/private/dota2/1533.shader_test - ac: 0 matches 5
shaders/private/dota2/1951.shader_test - ac: 0 matches 5
shaders/private/dota2/1361.shader_test - ac: 0 matches 5
shaders/private/mad_max/2792.shader_test - ac: 0 matches 1
shaders/private/mad_max/2794.shader_test - ac: 0 matches 1
shaders/private/mad_max/2780.shader_test - ac: 0 matches 1
shaders/private/mad_max/2902.shader_test - ac: 0 matches 1
shaders/private/bioshock-infinite/3050.shader_test - ac: 3 matches 7
shaders/private/bioshock-infinite/2544.shader_test - ac: 3 matches 6
shaders/private/bioshock-infinite/3062.shader_test - ac: 3 matches 8
shaders/private/bioshock-infinite/2012.shader_test - ac: 3 matches 7
shaders/private/bioshock-infinite/3058.shader_test - ac: 3 matches 7
shaders/private/bioshock-infinite/3270.shader_test - ac: 3 matches 7
shaders/private/bioshock-infinite/732.shader_test - ac: 3 matches 7
shaders/private/bioshock-infinite/3026.shader_test - ac: 3 matches 7
shaders/private/bioshock-infinite/3258.shader_test - ac: 3 matches 6
shaders/private/bioshock-infinite/3198.shader_test - ac: 3 matches 6
shaders/private/bioshock-infinite/3046.shader_test - ac: 3 matches 7
shaders/private/bioshock-infinite/3168.shader_test - ac: 3 matches 6
shaders/private/bioshock-infinite/2550.shader_test - ac: 3 matches 6
shaders/private/bioshock-infinite/3210.shader_test - ac: 3 matches 6
shaders/private/bioshock-infinite/3032.shader_test - ac: 3 matches 6
shaders/private/bioshock-infinite/668.shader_test - ac: 3 matches 7

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoac: rename ac_eliminate_const_vs_outputs -> ac_optimize_vs_outputs
Marek Olšák [Sat, 29 Apr 2017 21:53:08 +0000 (23:53 +0200)]
ac: rename ac_eliminate_const_vs_outputs -> ac_optimize_vs_outputs

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoac: first parse VS exports before eliminating constant ones
Marek Olšák [Sat, 29 Apr 2017 21:47:08 +0000 (23:47 +0200)]
ac: first parse VS exports before eliminating constant ones

A later commit will make use of this.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoanv: Trivially implement multiDrawIndirect
Jason Ekstrand [Thu, 20 Apr 2017 00:37:46 +0000 (17:37 -0700)]
anv: Trivially implement multiDrawIndirect

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoanv: Enable VK_KHX_multiview and SPV_KHR_multiview
Jason Ekstrand [Thu, 23 Mar 2017 00:43:10 +0000 (17:43 -0700)]
anv: Enable VK_KHX_multiview and SPV_KHR_multiview

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoanv/cmd_buffer: Emit instanced draws for multiple views
Jason Ekstrand [Thu, 23 Mar 2017 00:15:32 +0000 (17:15 -0700)]
anv/cmd_buffer: Emit instanced draws for multiple views

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoanv/cmd_buffer: Pull indirect draw parameter loading into a helper
Jason Ekstrand [Wed, 22 Mar 2017 23:22:38 +0000 (16:22 -0700)]
anv/cmd_buffer: Pull indirect draw parameter loading into a helper

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoanv/pipeline: Add shader lowering for multiview
Jason Ekstrand [Wed, 22 Mar 2017 22:37:17 +0000 (15:37 -0700)]
anv/pipeline: Add shader lowering for multiview

v2 (Jason Ekstrand):
 - Take a view_mask rather than a whole subpass
 - Build the view mask into the VS shader key

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoanv/pipeline: Add a subpass field to anv_pipeline
Jason Ekstrand [Wed, 22 Mar 2017 22:36:46 +0000 (15:36 -0700)]
anv/pipeline: Add a subpass field to anv_pipeline

This simplifies the code a variety of places.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoanv/pipeline: Call nir_gather_info later
Jason Ekstrand [Wed, 22 Mar 2017 22:24:06 +0000 (15:24 -0700)]
anv/pipeline: Call nir_gather_info later

We want to insert more lowering code that may insert system values and
we need to gather info after that lowering.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoanv: Move shader hashing to anv_pipeline
Jason Ekstrand [Thu, 27 Apr 2017 13:25:06 +0000 (06:25 -0700)]
anv: Move shader hashing to anv_pipeline

Shader hashing is very closely related to shader compilation.  Putting
them right next to each other in anv_pipeline makes it easier to verify
that we're actually hashing everything we need to be hashing.  The only
real change (other than the order of hashing) is that we now hash in the
shader stage.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoanv/pass: Store the per-subpass view mask
Jason Ekstrand [Tue, 21 Mar 2017 23:04:08 +0000 (16:04 -0700)]
anv/pass: Store the per-subpass view mask

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoanv: Add the KHX_multiview boilerplate
Jason Ekstrand [Tue, 21 Mar 2017 21:40:46 +0000 (14:40 -0700)]
anv: Add the KHX_multiview boilerplate

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoanv/nir: Delete the apply_dynamic_offsets prototype
Jason Ekstrand [Wed, 22 Mar 2017 22:10:14 +0000 (15:10 -0700)]
anv/nir: Delete the apply_dynamic_offsets prototype

That pass hasn't existed since dd4db84640bbb694f180dd50850c3388f67228be
but the prototype stuck around for no reason.

Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agospirv: Add support for SPV_KHR_multiview
Jason Ekstrand [Tue, 21 Mar 2017 22:24:25 +0000 (15:24 -0700)]
spirv: Add support for SPV_KHR_multiview

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agospirv: Bump the SPIR-V header to the latest public version
Jason Ekstrand [Tue, 21 Mar 2017 21:47:32 +0000 (14:47 -0700)]
spirv: Bump the SPIR-V header to the latest public version

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agocompiler: Add a system value and varying for ViewIndex
Jason Ekstrand [Tue, 21 Mar 2017 22:22:10 +0000 (15:22 -0700)]
compiler: Add a system value and varying for ViewIndex

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agomesa/vbo: reduce prim array size
Bartosz Tomczyk [Tue, 2 May 2017 11:19:34 +0000 (13:19 +0200)]
mesa/vbo: reduce prim array size

We always use only single element.

v2: Change single element arrays to variables

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: add const qualifier on _mesa_valid_to_render()
Brian Paul [Tue, 2 May 2017 17:32:08 +0000 (11:32 -0600)]
mesa: add const qualifier on _mesa_valid_to_render()

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoi965/vec4: don't modify regioning parameters to the sources of DF align1 instructions
Samuel Iglesias Gonsálvez [Tue, 25 Apr 2017 10:28:18 +0000 (12:28 +0200)]
i965/vec4: don't modify regioning parameters to the sources of DF align1 instructions

The regioning parameters are now properly set by convert_to_hw_regs()
and we don't need to fix them in the generator. That latter fix
previously done in the generator was strictly speaking wrong for any
non-identity regions.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
7 years agoi965/vec4: fix register width for DF VGRF and UNIFORM
Samuel Iglesias Gonsálvez [Tue, 25 Apr 2017 10:18:17 +0000 (12:18 +0200)]
i965/vec4: fix register width for DF VGRF and UNIFORM

On gen7, the swizzles used in DF align16 instructions works for element
size of 32 bits, so we can address only 2 consecutive DFs. As we assumed that
in the rest of the code and prepare the instructions for this (scalarize_df()),
we need to set it to two again.

However, for DF align1 instructions, a width of 2 is wrong as we are not
reading the data we want. For example, an uniform would have a region of
<0, 2, 1> so it would repeat the first 2 DFs, when we wanted to access
to the first 4.

This patch sets the default one to 4 and then modifies the width of
align16 instruction's DF sources when we translate the logical swizzle
to the physical one.

v2:
- Remove conditional (Curro).

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
7 years agoi965/vec4: fix vertical stride to avoid breaking region parameter rule
Samuel Iglesias Gonsálvez [Wed, 26 Apr 2017 08:12:03 +0000 (10:12 +0200)]
i965/vec4: fix vertical stride to avoid breaking region parameter rule

From IVB PRM, vol4, part3, "General Restrictions on Regioning
Parameters":

  "If ExecSize = Width and HorzStride ≠ 0, VertStride must
   be set to Width * HorzStride."

In next patch, we are going to modify the region parameter for
uniforms and vgrf. For uniforms that are the source of
DF align1 instructions, they will have <0, 4, 1> regioning and
the execsize for those instructions will be 4, so they will break
the regioning rule. This will be the same for VGRF sources where
we use the vstride == 0 exploit.

As we know we are not going to cross the GRF boundary with that
execsize and parameters (not even with the exploit), we just fix
the vstride here.

v2:
- Move is_align1_df() (Curro)
- Refactor exec_size == width calculation (Curro)

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
7 years agoradv/ac: canonicalize the output for 32-bit float min/max.
Dave Airlie [Fri, 17 Mar 2017 03:38:41 +0000 (13:38 +1000)]
radv/ac: canonicalize the output for 32-bit float min/max.

This fixes:
dEQP-VK.glsl.builtin.precision.min.*
dEQP-VK.glsl.builtin.precision.max.*
dEQP-VK.glsl.builtin.precision.clamp.*

The problem is the hw doesn't compare denorms properly,
so we have to flush them, even though the spec says
flushing is optional, if you don't flush the results
should be correct.

The -pro driver changes the shader float mode,
it would be nice if llvm could grow that perhaps.

Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: flush f32->f16 conversion denormals to zero. (v2)
Dave Airlie [Fri, 17 Mar 2017 02:11:30 +0000 (12:11 +1000)]
radv: flush f32->f16 conversion denormals to zero. (v2)

SPIR-V defines the f32->f16 operation as flushing denormals to 0,
this compares the class using amd class opcode.

Thanks to Matt Arsenault for figuring it out.

This fix is VI+ only, add a TODO for SI/CIK.

This fixes:
dEQP-VK.spirv_assembly.instruction.compute.opquantize.flush_to_zero

Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Add userspace fence buffer per context.
Bas Nieuwenhuizen [Wed, 3 May 2017 00:21:39 +0000 (02:21 +0200)]
radv: Add userspace fence buffer per context.

Having it in the winsys didn't work when multiple devices use
the same winsys, as we then have multiple contexts per queue,
and each context counts separately.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Fixes: 7b9963a28f4 "radv: Enable userspace fence checking."
7 years agoradv: enable lower_sub to fix loop unrolling.
Dave Airlie [Tue, 2 May 2017 22:59:56 +0000 (08:59 +1000)]
radv: enable lower_sub to fix loop unrolling.

Loop unroll asserts if it hits a sub, we don't really want
to lower subs as llvm handles these things, but do this for
now, until we can fix loop unroll to work with subs.

Fixes: 14ae0bfa5 (radv: Add NIR loop unrolling)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Don't set dynamic state for pipelines with rasterizer dicard.
Bas Nieuwenhuizen [Tue, 2 May 2017 21:39:29 +0000 (23:39 +0200)]
radv: Don't set dynamic state for pipelines with rasterizer dicard.

All of the dynamic states apply to rasterization & fragment processing,
so we don't need to set them if we don't rasterize.

We don't clear the dirty flags for them though, so we don't miss any
updates for the next pipeline with rasterization.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Fixes: 76603aa90b8 "radv: Drop the default viewport when 0 viewports are given."
7 years agoradv: flush more stages when semaphore are waiting.
Dave Airlie [Tue, 2 May 2017 21:13:21 +0000 (07:13 +1000)]
radv: flush more stages when semaphore are waiting.

This still doesn't give us complete pWaitDstStageMask support,
but it should provide enough to be correct if not as efficent as
possible.

If we have wait semaphores we must flush between submits and
flush the shaders as well.

This fixes the remaining fails in:
dEQP-VK.synchronization.op.single_queue.semaphore.*ssbo*

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoglsl: set vector_elements to 1 for samplers
Samuel Pitoiset [Wed, 26 Apr 2017 11:49:13 +0000 (13:49 +0200)]
glsl: set vector_elements to 1 for samplers

I don't see any reasons why vector_elements is 1 for images and
0 for samplers. This increases consistency and allows to clean
up some code a bit.

This will also help for ARB_bindless_texture.

No piglit regressions with RadeonSI.

This time the Intel CI system doesn't report any failures.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agovc4: Use runtime CPU detection for whether NEON is available.
Eric Anholt [Thu, 13 Apr 2017 18:48:22 +0000 (11:48 -0700)]
vc4: Use runtime CPU detection for whether NEON is available.

This will allow Raspbian's ARMv6 builds to take advantage of the new NEON
code, and could prevent problems if vc4 ends up getting used on a v7 CPU
without NEON.

v2: Drop dead NEON_SUFFIX (noted by Erik Faye-Lund)

7 years agovc4: Use a wrapper file to set VC4_BUILD_NEON instead of CFLAGS.
Eric Anholt [Thu, 13 Apr 2017 22:09:16 +0000 (15:09 -0700)]
vc4: Use a wrapper file to set VC4_BUILD_NEON instead of CFLAGS.

Android.mk was setting the flag across the entire driver, so we didn't
have non-NEON versions getting built.  This was going to be a problem with
the next commit, when I start auto-detecting NEON support and use the
non-NEON version when appropriate.

Reviewed-by: Rob Herring <robh@kernel.org>
7 years agogallium: Enable ARM NEON CPU detection.
Eric Anholt [Thu, 13 Apr 2017 18:43:30 +0000 (11:43 -0700)]
gallium: Enable ARM NEON CPU detection.

I wrote this code with reference to pixman, though I've only decided to
cover Linux (what I'm testing) and Android (seems obvious enough).  Linux
has getauxval() as a cleaner interface to the /proc entry, but it's more
glibc-specific and I didn't want to add detection for that.

This will be used to enable NEON at runtime on ARMv6 builds of vc4.

v2: Actually initialize the temp vars in the Android path (noticed by
    daniels)
v3: Actually pull in the cpufeatures library (change by robher).
    Use O_CLOEXEC.  Break out of the loop when we find our feature.
v4: Drop VFP code, which was confused about what it was detecting and not
    actually used yet.

Reviewed-by: Grazvydas Ignotas <notasas@gmail.com>
7 years agoradv: fix stencil only clears.
Dave Airlie [Tue, 2 May 2017 05:29:28 +0000 (15:29 +1000)]
radv: fix stencil only clears.

If we are clearing stencil only, we still need to provide a
a valid Z output from the vertex shader, we can't rely
on the depth clear value having any meaning, as we use this
for the position output, and it could get clipped, so we
don't end up clearing anything.

Fixes:
dEQP-VK.renderpass.simple.stencil
since I added S8 support.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agorenderonly: use drmIoctl
Philipp Zabel [Fri, 28 Apr 2017 11:14:20 +0000 (13:14 +0200)]
renderonly: use drmIoctl

To restart interrupted system calls, use drmIoctl.

Fixes: 848b49b288f ("gallium: add renderonly library")
CC: <mesa-stable@lists.freedesktop.org>
Suggested-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>