platform/upstream/mesa.git
7 years agoblorp: Use FullSurfaceDepthandStencilClear for blorp_hiz_op
Jason Ekstrand [Tue, 6 Jun 2017 00:18:48 +0000 (17:18 -0700)]
blorp: Use FullSurfaceDepthandStencilClear for blorp_hiz_op

The blorp_hiz_op entrypoint always acts on a full subresource of a HiZ
buffer so we can just set the flag unconditionally.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Move the post-HiZ-clear flush/stall to intel_hiz_exec
Jason Ekstrand [Tue, 6 Jun 2017 00:05:02 +0000 (17:05 -0700)]
i965: Move the post-HiZ-clear flush/stall to intel_hiz_exec

This also changes it to be predicated so we only do the flush/stall on
clears and HiZ resolves.  The docs only say it's needed for clears but
empirical evidence says it's also needed for HiZ resolves.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/blorp: Plumb through access to the workaround BO
Jason Ekstrand [Mon, 5 Jun 2017 21:19:28 +0000 (14:19 -0700)]
intel/blorp: Plumb through access to the workaround BO

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101283
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/blorp: Move the depth cache flush outside of BLORP
Nanley Chery [Thu, 27 Apr 2017 23:22:03 +0000 (16:22 -0700)]
anv/blorp: Move the depth cache flush outside of BLORP

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agointel/blorp: Refactor the HiZ op interface
Jason Ekstrand [Mon, 5 Jun 2017 18:32:19 +0000 (11:32 -0700)]
intel/blorp: Refactor the HiZ op interface

This commit does a few things:

 1) Now that BLORP can do HiZ ops on gen8+, drop the gen6 prefix.
 2) Switch parameters to uint32_t to match the rest of blorp.
 3) Take a range of layers and loop internally.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Inline gen6_blorp_exec
Jason Ekstrand [Mon, 5 Jun 2017 18:30:14 +0000 (11:30 -0700)]
i965/blorp: Inline gen6_blorp_exec

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Perform HiZ flush/stall prior to HiZ resolves
Jason Ekstrand [Mon, 5 Jun 2017 18:52:32 +0000 (11:52 -0700)]
i965: Perform HiZ flush/stall prior to HiZ resolves

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Move the pre-depth-clear flush/stalls to intel_hiz_exec
Jason Ekstrand [Mon, 5 Jun 2017 18:49:24 +0000 (11:49 -0700)]
i965: Move the pre-depth-clear flush/stalls to intel_hiz_exec

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Take a layer range in intel_hiz_exec
Jason Ekstrand [Mon, 5 Jun 2017 18:46:22 +0000 (11:46 -0700)]
i965/blorp: Take a layer range in intel_hiz_exec

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/miptree: Store fast clear colors in an isl_color_value
Jason Ekstrand [Sat, 20 May 2017 22:00:42 +0000 (15:00 -0700)]
i965/miptree: Store fast clear colors in an isl_color_value

This commit, out of necessity, makes a number of changes at once:

 1) Changes intel_mipmap_tree to store the clear color for both color
    and depth as an isl_color_value.

 2) Changes the depth/stencil emit code to do the format conversion of
    the depth clear value on Haswell and earlier instead of pulling a
    uint32_t directly from the miptree.

 3) Changes ISL's depth/stencil emit code to perform the format
    conversion of the depth clear value on Haswell and earlier instead
    of assuming that the depth value in the float is pre-converted.

 4) Changes blorp to pass the depth value through as a float.

 5) Changes the Vulkan driver to pass the depth value to blorp as a
    float rather than a uint.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agodri3/GLX: Fix drawable invalidation v2
Thomas Hellstrom [Thu, 1 Jun 2017 10:04:05 +0000 (12:04 +0200)]
dri3/GLX: Fix drawable invalidation v2

A number of internal VMware apitrace traces image comparisons fail with
dri3 because the viewport transformation becomes incorrect after an X
drawable resize. The incorrect viewport transformation sometimes persist
until the second draw-call after a swapBuffer.

Comparing with the dri2 glx code there are a couple of places where dri2
invalidates the drawable in the absence of server-triggered invalidation,
where dri3 doesn't do that. When these invalidation points are added to
dri3, the image comparisons become correct.

v2:
Addressed review comment by Michel Dänzer.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-and-tested-by: Michel Dänzer <michel.daenzer@amd.com>
7 years agoi965: Fix alpha to one with dual color blending.
Kenneth Graunke [Tue, 30 May 2017 05:07:07 +0000 (22:07 -0700)]
i965: Fix alpha to one with dual color blending.

The BLEND_STATE documentation says that alpha to one must be disabled
when dual color blending is enabled.  However, it appears that it simply
fails to override src1 alpha to one.

We can work around this by leaving alpha to one enabled, but overriding
SRC1_ALPHA to ONE and ONE_MINUS_SRC1_ALPHA to ZERO.  This appears to be
what the other driver does, and it looks like it works despite the
documentation saying not to do it.

Fixes spec/ext_framebuffer_multisample/alpha-to-one-dual-src-blend *
Piglit tests.

v2: Add UNUSED to shut up warning on generations which don't use this.

Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agomesa: add KHR_no_error support for glTexSubImage*D()
Samuel Pitoiset [Thu, 1 Jun 2017 10:43:24 +0000 (12:43 +0200)]
mesa: add KHR_no_error support for glTexSubImage*D()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add texsubimage() helper
Samuel Pitoiset [Thu, 1 Jun 2017 10:36:06 +0000 (12:36 +0200)]
mesa: add texsubimage() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: make _mesa_texture_sub_image() static
Samuel Pitoiset [Mon, 5 Jun 2017 12:02:14 +0000 (14:02 +0200)]
mesa: make _mesa_texture_sub_image() static

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: rename texsubimage() to texsubimage_err()
Samuel Pitoiset [Thu, 1 Jun 2017 10:35:34 +0000 (12:35 +0200)]
mesa: rename texsubimage() to texsubimage_err()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glCopyImageSubData()
Samuel Pitoiset [Thu, 1 Jun 2017 09:46:24 +0000 (11:46 +0200)]
mesa: add KHR_no_error support for glCopyImageSubData()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add copy_image_subdata() helper
Samuel Pitoiset [Thu, 1 Jun 2017 09:42:39 +0000 (11:42 +0200)]
mesa: add copy_image_subdata() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add prepare_target() helper
Samuel Pitoiset [Thu, 1 Jun 2017 09:36:13 +0000 (11:36 +0200)]
mesa: add prepare_target() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: rename prepare_target() to prepare_target_err()
Samuel Pitoiset [Thu, 1 Jun 2017 09:35:25 +0000 (11:35 +0200)]
mesa: rename prepare_target() to prepare_target_err()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glBlitNamedFramebuffer()
Samuel Pitoiset [Wed, 31 May 2017 13:57:45 +0000 (15:57 +0200)]
mesa: add KHR_no_error support for glBlitNamedFramebuffer()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add blit_named_framebuffer() helper
Samuel Pitoiset [Mon, 5 Jun 2017 12:18:41 +0000 (14:18 +0200)]
mesa: add blit_named_framebuffer() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glBlitFramebuffer()
Samuel Pitoiset [Wed, 31 May 2017 13:52:57 +0000 (15:52 +0200)]
mesa: add KHR_no_error support for glBlitFramebuffer()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add validate_depth_buffer() helper
Samuel Pitoiset [Mon, 5 Jun 2017 13:32:08 +0000 (15:32 +0200)]
mesa: add validate_depth_buffer() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add validate_stencil_buffer() helper
Samuel Pitoiset [Mon, 5 Jun 2017 13:29:37 +0000 (15:29 +0200)]
mesa: add validate_stencil_buffer() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add validate_color_buffer() helper
Samuel Pitoiset [Mon, 5 Jun 2017 13:12:36 +0000 (15:12 +0200)]
mesa: add validate_color_buffer() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: wrap blit_framebuffer() into blit_framebuffer_err()
Samuel Pitoiset [Tue, 6 Jun 2017 12:32:08 +0000 (14:32 +0200)]
mesa: wrap blit_framebuffer() into blit_framebuffer_err()

Also add ALWAYS_INLINE to blit_framebuffer().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add 'no_error' parameter to blit_framebuffer()
Samuel Pitoiset [Mon, 5 Jun 2017 13:03:30 +0000 (15:03 +0200)]
mesa: add 'no_error' parameter to blit_framebuffer()

The whole GLES3 block has been moved before the buffer validation
checks.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: make _mesa_blit_framebuffer() static
Samuel Pitoiset [Wed, 31 May 2017 13:41:30 +0000 (15:41 +0200)]
mesa: make _mesa_blit_framebuffer() static

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glBindBuffer()
Samuel Pitoiset [Wed, 31 May 2017 12:26:20 +0000 (14:26 +0200)]
mesa: add KHR_no_error support for glBindBuffer()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glInvalidateBufferData()
Samuel Pitoiset [Wed, 31 May 2017 12:18:00 +0000 (14:18 +0200)]
mesa: add KHR_no_error support for glInvalidateBufferData()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glInvalidateBufferSubData()
Samuel Pitoiset [Wed, 31 May 2017 12:15:37 +0000 (14:15 +0200)]
mesa: add KHR_no_error support for glInvalidateBufferSubData()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add invalidate_buffer_subdata() helper
Samuel Pitoiset [Wed, 31 May 2017 12:14:55 +0000 (14:14 +0200)]
mesa: add invalidate_buffer_subdata() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glBindVertexBuffers()
Samuel Pitoiset [Wed, 31 May 2017 10:42:39 +0000 (12:42 +0200)]
mesa: add KHR_no_error support for glBindVertexBuffers()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glVertexArrayVertexBuffers()
Samuel Pitoiset [Wed, 31 May 2017 10:39:44 +0000 (12:39 +0200)]
mesa: add KHR_no_error support for glVertexArrayVertexBuffers()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add vertex_array_vertex_buffers_err() helper
Samuel Pitoiset [Wed, 31 May 2017 10:35:25 +0000 (12:35 +0200)]
mesa: add vertex_array_vertex_buffers_err() helper

This also adds a 'no_error' parameter to vertex_array_vertex_buffer()
to be used in a following patch.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add KHR_no_error support for glScissor*()
Samuel Pitoiset [Tue, 6 Jun 2017 19:58:29 +0000 (21:58 +0200)]
mesa: add KHR_no_error support for glScissor*()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: add scissor() and scissor_array() helpers
Samuel Pitoiset [Tue, 6 Jun 2017 19:58:28 +0000 (21:58 +0200)]
mesa: add scissor() and scissor_array() helpers

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: rename ScissorIndexed() to scissor_indexed_err()
Samuel Pitoiset [Tue, 6 Jun 2017 19:58:27 +0000 (21:58 +0200)]
mesa: rename ScissorIndexed() to scissor_indexed_err()

And move GET_CURRENT_CONTEXT() into the APIENTRY calls
for consistency.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: use _mesa_set_scissor() in ScissorIndexed()
Samuel Pitoiset [Tue, 6 Jun 2017 19:58:26 +0000 (21:58 +0200)]
mesa: use _mesa_set_scissor() in ScissorIndexed()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: make _mesa_scissor_bounding_box() static
Samuel Pitoiset [Tue, 6 Jun 2017 19:58:25 +0000 (21:58 +0200)]
mesa: make _mesa_scissor_bounding_box() static

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: inline update_image_transfer_state() into _mesa_update_pixel()
Samuel Pitoiset [Tue, 6 Jun 2017 20:58:13 +0000 (22:58 +0200)]
mesa: inline update_image_transfer_state() into _mesa_update_pixel()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa: remove useless check in _mesa_update_pixel()
Samuel Pitoiset [Tue, 6 Jun 2017 20:58:12 +0000 (22:58 +0200)]
mesa: remove useless check in _mesa_update_pixel()

The only caller is _mesa_update_state_locked() which already
checks if _NEW_PIXEL is set before calling _mesa_update_pixel().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglcpp: fix #undef to match latest spec update and GLSLang implementation
Iago Toral Quiroga [Tue, 30 May 2017 11:25:35 +0000 (13:25 +0200)]
glcpp: fix #undef to match latest spec update and GLSLang implementation

GLSL ES spec includes the following:

   "It is an error to undefine or to redefine a built-in
    (pre-defined) macro name."

But desktop GLSL doesn't. This has sparked some discussion
in Khronos, and the final conclusion was to update the
GLSL 4.50 spec to include the following:

   "By convention, all macro names containing two consecutive
    underscores ( __ ) are reserved for use by underlying
    software layers.  Defining or undefining such a name in a
    shader does not itself result in an error, but may result
    in unintended behaviors that stem from having multiple
    definitions of the same name.  All macro names prefixed
    with “GL_” (“GL” followed by a single underscore) are also
    reserved, and defining or undefining such a name results in
    a compile-time error."

In other words, undefining GL_* names should be an error, but
undefining other names with a double underscore in them is
not strictly prohibited in desktop GLSL.

This patch fixes the preprocessor to apply these rules,
following exactly the implementation already present
in GLSLang. This fixes some tests in CTS.

Khronos bug:
https://cvs.khronos.org/bugzilla/show_bug.cgi?id=16003

Fixes:
KHR-GL45.shaders.preprocessor.definitions.undefine_core_profile_vertex
KHR-GL45.shaders.preprocessor.definitions.undefine_core_profile_fragment

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agoac/nir: move gpr counting inside argument handling.
Dave Airlie [Mon, 5 Jun 2017 20:20:33 +0000 (21:20 +0100)]
ac/nir: move gpr counting inside argument handling.

This just moves this code in here to it's cleaner.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoac/nir: assign argument param pointers in one place.
Dave Airlie [Mon, 5 Jun 2017 20:11:05 +0000 (21:11 +0100)]
ac/nir: assign argument param pointers in one place.

Instead of having the fragile code to do a second pass, just
give the pointers you want params in to the initial code,
then call a later pass to assign them.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoac/nir: consolidate setting userdata location
Dave Airlie [Mon, 5 Jun 2017 06:51:07 +0000 (07:51 +0100)]
ac/nir: consolidate setting userdata location

Just pass a pointer and increment inside the function,
makes the code less error prone.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoglthread: remove extra _mesa_glthread_finish() from generated code
Timothy Arceri [Tue, 6 Jun 2017 05:08:16 +0000 (15:08 +1000)]
glthread: remove extra _mesa_glthread_finish() from generated code

The other user of print_sync_dispatch() was ending up with code that
looked like:

      _mesa_glthread_finish(ctx);
      _mesa_glthread_restore_dispatch(ctx);
      _mesa_glthread_finish(ctx);

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agointel: Fix broxton 2x6 way size computation
Anuj Phogat [Tue, 6 Jun 2017 23:14:19 +0000 (16:14 -0700)]
intel: Fix broxton 2x6 way size computation

This patch is undoing the changes to way size computation
in broxton 2x6, made by below commit:

Commit: 0d576fbfbe912cf3fb9ab594bb31eb58bccf2138
Author:     Anuj Phogat <anuj.phogat@gmail.com>
i965: Simplify l3 way size computations

By making use of l3_banks field in gen_device_info struct
l3_way_size for gen7+ = 2 * l3_banks.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101306
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Tested-by: Mark Janes <mark.a.janes@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoradv: move chip_class extraction down further.
Dave Airlie [Tue, 6 Jun 2017 23:34:28 +0000 (09:34 +1000)]
radv: move chip_class extraction down further.

This seems to matter here in a profile, without this we spend a lot
more time exiting this function with no flush bits.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: move lots of index related things into the bind.
Dave Airlie [Tue, 6 Jun 2017 23:14:54 +0000 (09:14 +1000)]
radv: move lots of index related things into the bind.

This just moves lots of stuff to the bind stage rather than
dealing with it in the draw stage.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: move calculating the vertex sgpr to the pipeline.
Dave Airlie [Tue, 6 Jun 2017 23:04:30 +0000 (09:04 +1000)]
radv: move calculating the vertex sgpr to the pipeline.

There is no need to calculate this at draw time.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: rename and make global some functions.
Dave Airlie [Tue, 6 Jun 2017 23:01:38 +0000 (09:01 +1000)]
radv: rename and make global some functions.

I want to use these in the pipeline setup stage.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agotree-wide: remove trailing backslash
Eric Engestrom [Thu, 1 Jun 2017 13:48:06 +0000 (14:48 +0100)]
tree-wide: remove trailing backslash

Simple search for a backslash followed by two newlines.
If one of the newlines were to be removed, this would cause issues, so
let's just remove these trailing backslashes.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
7 years agoradv/gfx9: use correct register setting for uconfig regs
Dave Airlie [Tue, 6 Jun 2017 22:09:03 +0000 (08:09 +1000)]
radv/gfx9: use correct register setting for uconfig regs

Thanks to Marek for pointing this out.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Remove SI num RB override for occlusion queries.
Bas Nieuwenhuizen [Tue, 6 Jun 2017 20:03:49 +0000 (22:03 +0200)]
radv: Remove SI num RB override for occlusion queries.

radeonsi doesn't have it anymore either.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Fixes: f4e499ec791 "radv: add initial non-conformant radv vulkan driver"
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Split out updating the vertex descriptors.
Bas Nieuwenhuizen [Tue, 6 Jun 2017 19:52:15 +0000 (21:52 +0200)]
radv: Split out updating the vertex descriptors.

Simple refactor.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Move pipeline stuff from flush_state to emit_graphics_pipeline.
Bas Nieuwenhuizen [Tue, 6 Jun 2017 19:39:42 +0000 (21:39 +0200)]
radv: Move pipeline stuff from flush_state to emit_graphics_pipeline.

No functional changes.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Add early exit for cache flushes.
Bas Nieuwenhuizen [Tue, 6 Jun 2017 17:15:47 +0000 (19:15 +0200)]
radv: Add early exit for cache flushes.

No sense checking each bit separately in the common case of none
being set.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Remove vertex_descriptors_dirty.
Bas Nieuwenhuizen [Tue, 6 Jun 2017 16:43:38 +0000 (18:43 +0200)]
radv: Remove vertex_descriptors_dirty.

Redundant.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Don't use a divide by index_size.
Bas Nieuwenhuizen [Tue, 6 Jun 2017 16:22:23 +0000 (18:22 +0200)]
radv: Don't use a divide by index_size.

Divides are pretty slow, and this is in the hot path of a draw.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoi965: Explicitly disallow tiled memcpy path on Gen4 with swizzling.
Chris Wilson [Fri, 17 Mar 2017 07:58:13 +0000 (00:58 -0700)]
i965: Explicitly disallow tiled memcpy path on Gen4 with swizzling.

The manual detiling paths are not prepared to handle Gen4-G45 with
swizzling enabled, so explicitly disable them.  (They're already
disabled because these platforms don't have LLC but a future patch could
enable this path).

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Remove brw_bo_map_unsynchronized()
Matt Turner [Thu, 1 Jun 2017 04:18:38 +0000 (21:18 -0700)]
i965: Remove brw_bo_map_unsynchronized()

Call brw_bo_map() directly.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Use unsynchronized mappings for BufferSubData on non-LLC
Matt Turner [Mon, 5 Jun 2017 16:54:06 +0000 (09:54 -0700)]
i965: Use unsynchronized mappings for BufferSubData on non-LLC

Now that unsynchronized maps actually work, we can use them, like we do
on LLC platforms.

On Broxton, the performance of Unigine Valley 1.1-rc1 is improved by
37.6656% +/- 0.401389% (n=20) at 1280x720/QUALITY_LOW, and by
20.862% +/- 2.20901% (n=3) at 1920x1080/QUALITY_LOW.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Make unsynchronized maps unsynchronized on non-LLC
Matt Turner [Thu, 1 Jun 2017 04:14:15 +0000 (21:14 -0700)]
i965: Make unsynchronized maps unsynchronized on non-LLC

On Broxton, the performance of Unigine Valley 1.0 is improved by
13.3067% +/- 0.144322% (n=40) at 1280x720/QUALITY_LOW, and by
1.68478% +/- 0.484226% (n=3) at 1920x1080/QUALITY_LOW.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Implement brw_bo_map_unsynchronized() with MAP_ASYNC
Matt Turner [Thu, 1 Jun 2017 04:12:01 +0000 (21:12 -0700)]
i965: Implement brw_bo_map_unsynchronized() with MAP_ASYNC

This way we can let brw_bo_map() choose the best mapping type.

Part of the patch inlines map_gtt() into brw_bo_map_gtt() (and removes
map_gtt()). brw_bo_map_gtt() just wrapped map_gtt() with locking and a
call to set_domain(). map_gtt() is called by brw_bo_map_unsynchronized()
to avoid the call to set_domain(). With the MAP_ASYNC flag, we now have
the same behavior previously provided by brw_bo_map_unsynchronized().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Elide call to set_domain() if MAP_ASYNC
Matt Turner [Thu, 1 Jun 2017 04:06:18 +0000 (21:06 -0700)]
i965: Elide call to set_domain() if MAP_ASYNC

No functional change (no callers currently pass MAP_ASYNC)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Add and use brw_bo_map()
Matt Turner [Thu, 18 May 2017 18:26:08 +0000 (11:26 -0700)]
i965: Add and use brw_bo_map()

We can encapsulate the logic for choosing the mapping type. This will
also help when we add WC mappings.

A few functional changes are made in this patch. On non-LLC, what were
previously WB mappings are now GTT mappings (in the prefilling debug
code in brw_performance_query.c; the shader_time code in brw_program.c;
and in the case of an RW mapping in intel_buffer_objects.c).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Drop MAP_READ from some write-only mappings
Matt Turner [Thu, 18 May 2017 18:29:00 +0000 (11:29 -0700)]
i965: Drop MAP_READ from some write-only mappings

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Pass flags to brw_bo_map_*
Matt Turner [Thu, 18 May 2017 17:59:23 +0000 (10:59 -0700)]
i965: Pass flags to brw_bo_map_*

brw_bo_map_cpu() took a write_enable arg, but it wasn't always clear
whether we were also planning to read from the buffer. I kept everything
semantically identical by passing only MAP_READ or MAP_READ | MAP_WRITE
depending on the write_enable argument.

The other flags are not used yet, but MAP_ASYNC for instance, will be
used in a later patch to remove the need for a separate
brw_bo_map_unsynchronized() function.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Rename brw_bo_map() -> brw_bo_map_cpu()
Matt Turner [Wed, 17 May 2017 22:44:30 +0000 (15:44 -0700)]
i965: Rename brw_bo_map() -> brw_bo_map_cpu()

I'm going to make a new function named brw_bo_map() in a later patch
that is responsible for choosing the mapping type, so this patch clears
the way.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Rename *_virtual -> map_*
Matt Turner [Wed, 17 May 2017 18:41:40 +0000 (11:41 -0700)]
i965: Rename *_virtual -> map_*

I think these are better names, and it reduces the delta between
upstream and Chris Wilson's brw-batch branch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Pass the map-mode along to intel_mipmap_tree_map_raw()
Chris Wilson [Wed, 6 May 2015 10:19:44 +0000 (11:19 +0100)]
i965: Pass the map-mode along to intel_mipmap_tree_map_raw()

Since we can distinguish when mapping between READ and WRITE, we can
pass along the map mode to avoid stalls and flushes where possible.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoi965: Add a cache_coherent field to brw_bo
Matt Turner [Thu, 18 May 2017 19:02:39 +0000 (12:02 -0700)]
i965: Add a cache_coherent field to brw_bo

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Remove unused 'use_resource_streamer' field
Matt Turner [Thu, 11 May 2017 18:53:27 +0000 (11:53 -0700)]
i965: Remove unused 'use_resource_streamer' field

Missing in the resource streamer removal of commit 951f56cd43bc.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Remove brw_bo's virtual member
Matt Turner [Fri, 5 May 2017 18:20:05 +0000 (11:20 -0700)]
i965: Remove brw_bo's virtual member

Just return the map from brw_map_bo_*

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Remove unused brw_bo_map__* functions
Matt Turner [Wed, 3 May 2017 21:19:11 +0000 (14:19 -0700)]
i965: Remove unused brw_bo_map__* functions

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoanv: Set better descriptor set limits
Alex Smith [Mon, 5 Jun 2017 14:49:05 +0000 (15:49 +0100)]
anv: Set better descriptor set limits

Based on discussions with Jason, Ivy Bridge and Bay Trail only actually
support 16 samplers, while newer hardware can support more than the
current limit of 64. Therefore set the lower limit where needed, and
bump up to 128 for everything else. There is also a limit on the total
number of other resources of around 250.

This allows Dawn of War III to render correctly on ANV.

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv: Set driver version to Mesa version
Alex Smith [Tue, 6 Jun 2017 09:42:41 +0000 (10:42 +0100)]
anv: Set driver version to Mesa version

As already done by RADV.

v2: Move version calculation function to src/vulkan/util to share with
    RADV.

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoradv/vulkan: Move radv_get_driver_version to src/vulkan/util
Alex Smith [Tue, 6 Jun 2017 15:09:07 +0000 (16:09 +0100)]
radv/vulkan: Move radv_get_driver_version to src/vulkan/util

This means it can be reused for other Vulkan drivers. Also fix up a
typo, need to search for '.' in the version string rather than ','.

v2: Remove unneeded temporary version variable (Emil, Eric)

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoutil/vulkan: Move Vulkan utilities to src/vulkan/util
Alex Smith [Tue, 6 Jun 2017 11:31:05 +0000 (12:31 +0100)]
util/vulkan: Move Vulkan utilities to src/vulkan/util

We have Vulkan utilities in both src/util and src/vulkan/util. The
latter seems a more appropriate place for Vulkan-specific things, so
move them there.

v2: Android build system changes (from Tapani Pälli)

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agointel: gen-decoder: rework how we handle groups
Lionel Landwerlin [Tue, 30 May 2017 19:06:48 +0000 (20:06 +0100)]
intel: gen-decoder: rework how we handle groups

The current way of handling groups doesn't seem to be able to handle
MI_LOAD_REGISTER_* with more than one register. This change reworks
the way we handle groups by building a traversal list on loading the
GENXML files.

Let's say you have

Instruction {
  Field0
  Field1
  Field2
  Group0 (count=2) {
    Field0-0
    Field0-1
  }
  Group1 (count=4) {
    Field1-0
    Field1-1
  }
}

We build of linked on load that goes :

Instruction -> Group0 -> Group1

All of those are gen_group structures, making the traversal trivial.
We just need to iterate groups for the right number of timers (count
field in genxml).

The more fancy case is when you have only a single group of unknown
size (count=0). In that case we keep on reading that group for as long
as we're within the DWordLength of that instruction.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoradeonsi: fix a GPU hang with tessellation on 2-CU configs
Marek Olšák [Tue, 23 May 2017 19:52:11 +0000 (21:52 +0200)]
radeonsi: fix a GPU hang with tessellation on 2-CU configs

Only harvested Stoney has 2 CUs. Tested on 2-CU Stoney and Fiji forced
to 2 CUs.

Cc: 17.0 17.1 <mesa-stable@lists.freedesktop.org>
Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
7 years agomesa: make use of NewWindowRectangles driver flags
Samuel Pitoiset [Fri, 2 Jun 2017 12:31:49 +0000 (14:31 +0200)]
mesa: make use of NewWindowRectangles driver flags

Now, st_update_window_rectangles() won't be called when the
scissor is going to be updated.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agomesa: add new gl_driver_flags::NewWindowRectangles
Samuel Pitoiset [Fri, 2 Jun 2017 12:31:48 +0000 (14:31 +0200)]
mesa: add new gl_driver_flags::NewWindowRectangles

This new driver flag will replace _NEW_SCISSOR which is
emitted when setting new window rectangles but it actually
triggers useless changes in the state tracker (like scissor
and rasterizer).

EXT_window_rectangles is currently only supported by Nouveau.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agomesa: remove call to Driver.Scissor() in _mesa_WindowRectanglesEXT()
Samuel Pitoiset [Fri, 2 Jun 2017 12:31:47 +0000 (14:31 +0200)]
mesa: remove call to Driver.Scissor() in _mesa_WindowRectanglesEXT()

This is actually useless because this driver call is only used
by the classic DRI drivers which don't support that extension
and probably won't never support it.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agomesa: only emit _NEW_MULTISAMPLE when min sample shading changes
Samuel Pitoiset [Fri, 2 Jun 2017 15:52:49 +0000 (17:52 +0200)]
mesa: only emit _NEW_MULTISAMPLE when min sample shading changes

We usually check that given parameters are different before
updating the state.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agomesa: only emit _NEW_MULTISAMPLE when sample mask changes
Samuel Pitoiset [Fri, 2 Jun 2017 15:52:48 +0000 (17:52 +0200)]
mesa: only emit _NEW_MULTISAMPLE when sample mask changes

We usually check that given parameters are different before
updating the state.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agomesa: only emit _NEW_MULTISAMPLE when coverage parameters change
Samuel Pitoiset [Fri, 2 Jun 2017 15:52:47 +0000 (17:52 +0200)]
mesa: only emit _NEW_MULTISAMPLE when coverage parameters change

We usually check that given parameters are different before
updating the state.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoi965: Change INTEL_DEBUG=vec4 to INTEL_SCALAR_VS for consistency.
Kenneth Graunke [Sat, 3 Jun 2017 19:26:29 +0000 (12:26 -0700)]
i965: Change INTEL_DEBUG=vec4 to INTEL_SCALAR_VS for consistency.

We moved to INTEL_SCALAR_* when we added more than a single stage, but
never went back and converted the VS to work that way.  Be consistent.

Also update the documentation to actually mention these debug variables.

Acked-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoradv: expose integrated device type for APUs.
Dave Airlie [Mon, 15 May 2017 01:27:10 +0000 (11:27 +1000)]
radv: expose integrated device type for APUs.

This just sets the vulkan device type depending on whether
this is an APU or GPU.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Fixes: f4e499ec791 "radv: add initial non-conformant radv vulkan driver"

7 years agoac/surface: Fix HTILE for radv.
Bas Nieuwenhuizen [Sun, 21 May 2017 21:40:54 +0000 (23:40 +0200)]
ac/surface: Fix HTILE for radv.

We always compute HTILE size using addrlib, even when not TC compatible.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlied <airlied@redhat.com>
7 years agoradv: fix write event eop on vega.
Dave Airlie [Tue, 6 Jun 2017 00:39:16 +0000 (10:39 +1000)]
radv: fix write event eop on vega.

Typo here, fixes command submission hangs on vega

7 years agoradv: enable GFX9 on radv
Dave Airlie [Mon, 5 Jun 2017 23:06:57 +0000 (09:06 +1000)]
radv: enable GFX9 on radv

I'm open to reverting this closer to release if bad things
happen, but it might be easier to debugging to leave it for now.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: turn off geom/tess for gfx9.
Dave Airlie [Mon, 5 Jun 2017 23:06:41 +0000 (09:06 +1000)]
radv: turn off geom/tess for gfx9.

We don't support these yet, and it'll take a bit of work to do so.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: misc GFX9 changes.
Dave Airlie [Mon, 5 Jun 2017 23:06:21 +0000 (09:06 +1000)]
radv: misc GFX9 changes.

These are just some register changes ported from radeonsi for gfx9.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: add some GFX9 specific events.
Dave Airlie [Mon, 5 Jun 2017 23:05:47 +0000 (09:05 +1000)]
radv: add some GFX9 specific events.

These are ported from radeonsi, don't know all the rules for
when they should be inserted.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: add IA_MULTI_VGT_PARAM support for GFX9.
Dave Airlie [Mon, 5 Jun 2017 23:05:12 +0000 (09:05 +1000)]
radv: add IA_MULTI_VGT_PARAM support for GFX9.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: add rb+ support for GFX9
Dave Airlie [Mon, 5 Jun 2017 23:03:55 +0000 (09:03 +1000)]
radv: add rb+ support for GFX9

This adds some rb+ support, as on GFX9 we have to disable
it as per radeonsi.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: add GFX9 cache flushing support.
Dave Airlie [Mon, 5 Jun 2017 23:01:48 +0000 (09:01 +1000)]
radv: add GFX9 cache flushing support.

GFX9 needs to write event EOP to a fence buffer, allocate some
space for this, and just write an ever increasing number to it,
this isn't exactly what radeonsi does, but it seems to work.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>