mesa.git
7 years agoanv/device: Remove a bogus finishme comment
Jason Ekstrand [Sat, 26 Nov 2016 05:45:02 +0000 (21:45 -0800)]
anv/device: Remove a bogus finishme comment

We've been properly detecting bit6 swizzling for a long time now.

8 years agoi965: Enable fast clears for multi-lod
Ben Widawsky [Wed, 20 Apr 2016 14:23:06 +0000 (07:23 -0700)]
i965: Enable fast clears for multi-lod

On SKL (also fast clear is used for level 0, layer 0):

Manhattan 3.0:          3.88434% +/- 0.814659%
Manhattan 3.0 off:      3.25542% +/- 0.101149%
Trex:                   3.43501% +/- 0.31223%
Trex off:               4.13781% +/- 0.0993569%

ON BDW:

Manhattan 3.0:          1.37079% +/- 0.571208%
Manhattan 3.0 off:      1.74029% +/- 0.267499%

v2 (Ben, Matt): Fix rebase error by removing the perf warning
v3 (Topi): Rebased on top of revised eligibility logic

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Allow single-sampled miptree to be resolved and shared
Topi Pohjolainen [Tue, 22 Nov 2016 19:53:38 +0000 (21:53 +0200)]
i965: Allow single-sampled miptree to be resolved and shared

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965/gen8: Relax asserts prohibiting arrayed/mipmapped fast clears
Topi Pohjolainen [Fri, 10 Jun 2016 06:12:23 +0000 (09:12 +0300)]
i965/gen8: Relax asserts prohibiting arrayed/mipmapped fast clears

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Use ISL for CCS layouts
Topi Pohjolainen [Tue, 8 Nov 2016 12:19:15 +0000 (14:19 +0200)]
i965: Use ISL for CCS layouts

One can now also delete intel_get_non_msrt_mcs_alignment().

v2 (Jason): Do not leak aux buf but allocate only after getting
            ISL surfaces.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Resolve non-compressed fast clears prior layered rendering
Topi Pohjolainen [Mon, 13 Jun 2016 07:51:10 +0000 (10:51 +0300)]
i965: Resolve non-compressed fast clears prior layered rendering

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Restrict fast color clear on first slice only
Topi Pohjolainen [Tue, 14 Jun 2016 06:10:16 +0000 (09:10 +0300)]
i965: Restrict fast color clear on first slice only

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Track fast color clear state in level/layer granularity
Topi Pohjolainen [Fri, 10 Jun 2016 08:09:53 +0000 (11:09 +0300)]
i965: Track fast color clear state in level/layer granularity

Note that RESOLVED is not tracked in the map explicitly. Absence
of item implicitly means RESOLVED state.

v2: Added intel_resolve_map_clear() into intel_miptree_release()
v3 (Jason): Properly handle the assumption of resolve map not
            containing any items with state RESOLVED. Removed
            unnecessary intel_miptree_set_fast_clear_state() call
            in brw_blorp_resolve_color() preventing
            intel_miptree_set_fast_clear_state() from asserting
            against RESOLVED.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Move fast clear state enumeration into resolve map
Topi Pohjolainen [Wed, 8 Jun 2016 17:51:32 +0000 (20:51 +0300)]
i965: Move fast clear state enumeration into resolve map

Status is still tracked per miptree. Next patch will switch to
resolve map per slice/level.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Refactor check if color resolve is needed
Topi Pohjolainen [Fri, 10 Jun 2016 06:01:54 +0000 (09:01 +0300)]
i965: Refactor check if color resolve is needed

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Add plumbing for fast clear layer/level details
Topi Pohjolainen [Thu, 9 Jun 2016 07:59:06 +0000 (10:59 +0300)]
i965: Add plumbing for fast clear layer/level details

Until now fast clear has been supported only for non-layered and
non-mipmapped buffers. However, from gen8 onwards there is hardware
support also for layered/mipmapped. Once this is enabled, fast clear
operations target specific layer/level and call for the state to be
tracked in the same granularity. This is the first step providing
the details from callers to the state tracking.

Patch introduces new interface for reading and writing the state
hiding the upcoming bookkeeping changes in the call sites. There is
bunch of sanity checks added that will be relaxed per hardware
generation later on when the actual functionality is enabled.

v2: Rebased on top current master setting the state in
    blorp_surf_for_miptree().
v3: Replace open-coded resolved check in surface state emission
    with intel_miptree_has_color_unresolved().

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Add interface for checking multiple slices if any is unresolved
Topi Pohjolainen [Mon, 19 Sep 2016 09:03:58 +0000 (12:03 +0300)]
i965: Add interface for checking multiple slices if any is unresolved

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Provide slice details to renderbuffer fast clear state tracker
Topi Pohjolainen [Thu, 15 Sep 2016 05:22:34 +0000 (08:22 +0300)]
i965: Provide slice details to renderbuffer fast clear state tracker

This patch also introduces getter and setter for fast clear state
preparing for tracking the state per slice.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Split per miptree and per slice/level fast clear bits
Topi Pohjolainen [Fri, 10 Jun 2016 07:09:34 +0000 (10:09 +0300)]
i965: Split per miptree and per slice/level fast clear bits

Currently the status bits for fast clear include the flag telling
if non-multisampled mcs buffer should be used at all. Once the
state tracking is changed to follow individual levels/layers one
still needs to have the mcs enabling information in the miptree.
Therefore simply split it out to its own boolean.

Possible follow-up work is to combine disable_aux_buffers and
no_ccs into single enum.

v2 (Jason): Changed no_msrt_mcs to no_ccs and updated comment

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Provide slice details to color resolver
Topi Pohjolainen [Thu, 15 Sep 2016 06:05:55 +0000 (09:05 +0300)]
i965: Provide slice details to color resolver

v2: Make intel_miptree_resolve_color() take start layer and
    layer count.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Add new interface for full color resolves
Topi Pohjolainen [Fri, 10 Jun 2016 05:23:40 +0000 (08:23 +0300)]
i965: Add new interface for full color resolves

Upcoming patches will introduce fast clear in level/layer
granularity like the driver does already for depth/hiz. This patch
introduces equivalent full resolve option.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Refactor lossless compression state tracking
Topi Pohjolainen [Wed, 6 Jul 2016 09:29:41 +0000 (12:29 +0300)]
i965: Refactor lossless compression state tracking

Essentially this moves fast clear state update away from surface
state setup into brw_postdraw_set_buffers_need_resolve() that gets
called just after draw submission.
Calling intel_miptree_used_for_rendering() can be drop for gen6
and earlier as it is no-op.

v2: Rebased on top current master setting the state in
    blorp_surf_for_miptree().

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoRevert "glsl: allow layout qualifier overrides with ARB_shading_language_420pack"
Andres Gomez [Sat, 22 Oct 2016 14:22:13 +0000 (17:22 +0300)]
Revert "glsl: allow layout qualifier overrides with ARB_shading_language_420pack"

This reverts commit aaa69c79cd584db4d9c6ea7794e93d29f3d54572.

The commit was erroneous because the ast_layout_expression class is
meant to hold a list used for an after check that all the declared
values for a layout-qualifier-name are consistent.

Therefore, the check for the possibility of duplicated values was
previously fixed to happen much sooner, in the GLSL parser and the
merge of layout qualifiers, and the process_qualifier_constant method
only needs to check that the values are consistent.

By now, those layout-qualifier-name represented as a
ast_layout_expression are "max_vertices", "invocations", "vertices",
"local_size_[x|y|z]" and "xfb_stride".

From page 40 (page 46 of the PDF) of the GLSL 1.50 spec:

  " All geometry shader output layout declarations in a program must
    declare the same layout and same value for max_vertices."

From page 44 (page 50 of the PDF) of the GLSL 4.00 spec:

  " If an invocation count is declared, all such declarations must
    specify the same count."

From page 47 (page 53 of the PDF) of the GLSL 4.00 spec:

  " All tessellation control shader layout declarations in a program
    must specify the same output patch vertex count."

From page 60 (page 66 of the PDF) of the GLSL 4.30 spec:

  " Also, if such a layout qualifier is declared more than once in the
    same shader, all those declarations must set the same set of local
    work-group sizes and set them to the same values; otherwise a
    compile-time error results. If multiple compute shaders attached
    to a single program object declare local work-group size, the
    declarations must be identical; otherwise a link-time error
    results."

From page 73 (page 79 of the PDF) of the GLSL 4.40 spec:

  " While xfb_stride can be declared multiple times for the same
    buffer, it is a compile-time or link-time error to have different
    values specified for the stride for the same buffer."

Fixes GL44-CTS.enhanced_layouts.xfb_duplicated_stride

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
8 years agoRevert "glsl: geom shader max_vertices layout must match."
Andres Gomez [Sat, 22 Oct 2016 14:13:16 +0000 (17:13 +0300)]
Revert "glsl: geom shader max_vertices layout must match."

This reverts commit 4c863993780a11cea6f88fa0682796bee5794042.

The commit was erroneous because the ast_layout_expression class was
created to hold a list of values for a layout-qualifier-name which is
allowed to appear in more than one expression in the same
shader/program but not to hold different values.

In other words, the list is used for an after check that all the
declared values for a layout-qualifier-name are consistent.

Therefore, the values stored must match always, not just for
"max_vertices" or any other eventual layout-qualifier-name.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
8 years agoglsl: push layout-qualifier-name values from variable declarations to global
Andres Gomez [Thu, 6 Oct 2016 22:52:06 +0000 (01:52 +0300)]
glsl: push layout-qualifier-name values from variable declarations to global

After the previous modifications in the merging of the
layout-qualifier-name values, we no longer push the final value in a
declaration to the global values.

This regression happens because we don't call for merging on the
right-most layout qualifier of a declaration which is also the
overriding one in case of multiple appearances.

Now, we add a new method to push these values to the global ones and
we call for this just after all the layout-qualifier collapsing has
happened in a declaration.

This simplifies how this was working in two ways; we make a clear
differentiation of when we are pushing this to the global values since
before it was mixed in the merging call and we only run this once all
the processing for layout-qualifiers in a declaration has happened.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
8 years agoglsl: simplified error checking for duplicated layout-qualifiers
Andres Gomez [Sat, 22 Oct 2016 14:04:33 +0000 (17:04 +0300)]
glsl: simplified error checking for duplicated layout-qualifiers

The GLSL parser has been simplified to check for the needed
GL_ARB_shading_language_420pack extension just when merging the
qualifiers in the proper cases.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
8 years agoglsl: simplified ast_type_qualifier::merge_into_[in|out]_qualifier API
Andres Gomez [Thu, 6 Oct 2016 22:52:08 +0000 (01:52 +0300)]
glsl: simplified ast_type_qualifier::merge_into_[in|out]_qualifier API

Since we modified the way in which multiple repetitions of the same
layout-qualifier-name in a single declaration collapse into the
ast_type_qualifier class, we can simplify the
merge_into_[in|out]_qualifier APIs through removing the create_node
parameter.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
8 years agoglsl: ignore all but the rightmost layout qualifier name from the rightmost layout...
Andres Gomez [Sat, 22 Oct 2016 14:01:11 +0000 (17:01 +0300)]
glsl: ignore all but the rightmost layout qualifier name from the rightmost layout qualifier

From page 46 (page 52 of the PDF) of the GLSL 4.20 spec:

  " More than one layout qualifier may appear in a single
    declaration. If the same layout-qualifier-name occurs in multiple
    layout qualifiers for the same declaration, the last one overrides
    the former ones."

Consider this example:

  " #version 150
    #extension GL_ARB_shading_language_420pack: enable

    layout(max_vertices=2) layout(max_vertices=3) out;
    layout(max_vertices=3) out;"

Although different values for "max_vertices" results in a compilation
error. The above code is valid because max_vertices=2 is ignored.

Hence, when merging qualifiers in an ast_type_qualifier, we now ignore
new appearances of a same layout-qualifier-name if the new
"is_multiple_layouts_merge" parameter is on, since the GLSL parser
works in this case from right to left.

In addition, any special treatment for the buffer, uniform, in or out
layout defaults has been moved in the GLSL parser to the rule
triggered just after any previous processing/merging on the
layout-qualifiers has happened in a single declaration since it was
run too soon previously.

Fixes GL44-CTS.shading_language_420pack.qualifier_override_layout

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
8 years agoglsl: refactor duplicated validations between 2 layout-qualifiers
Andres Gomez [Tue, 22 Nov 2016 14:09:54 +0000 (16:09 +0200)]
glsl: refactor duplicated validations between 2 layout-qualifiers

Several layout-qualifier validations are duplicated in the
merge_qualifier and validate_in_qualifier methods.

We would rather have them refactored into single calls.

Suggested by Timothy.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
8 years agoglsl: assert on incoherent point mode layout-id-qualifier validation
Andres Gomez [Fri, 11 Nov 2016 19:03:24 +0000 (21:03 +0200)]
glsl: assert on incoherent point mode layout-id-qualifier validation

The point mode value in an ast_type_qualifier can only be true if the
flag is already set since this layout-id-qualifier can only be or not
be present in a shader.

Hence, it is useless to check for its value if the flag is already
set. Just replaced with an assert.

V2: assert instead of checking for coherence and raising a compilation
    error. Suggested by Timothy.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
8 years agoglsl: remove unneeded check for incompatible primitive types in GS
Andres Gomez [Fri, 11 Nov 2016 19:03:02 +0000 (21:03 +0200)]
glsl: remove unneeded check for incompatible primitive types in GS

The validation of the default in layout qualifier already assures that
we won't have 2 ast_gs_input_layout objects with different primitive
type values. In fact, the validation already assures that we won't
have 2 ast_gs_input_layout objects in the AST tree at all.

The check for an error in the shader has been replaced by an assert.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
8 years agoglsl: simplifies the merge of the default in layout qualifier
Andres Gomez [Mon, 14 Nov 2016 15:49:33 +0000 (17:49 +0200)]
glsl: simplifies the merge of the default in layout qualifier

The merge into the default in layout qualifier duplicates a lot of
code that can be reused from the generic merge method.

Now, we use the generic merge method inside the specific merge for the
default in layout qualifier. The generic merge method has been
completed with some bits that were only present in the merge for the
default in layout qualifier and the specific validation bits have been
moved to the validation method for the default in layout qualifier.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
8 years agoglsl: split default in layout qualifier merge
Andres Gomez [Mon, 14 Nov 2016 15:46:05 +0000 (17:46 +0200)]
glsl: split default in layout qualifier merge

Currently, the default in layout qualifier merge performs specific
validation and merge.

We want to split out the validation from the merge so they can be done
independently.

Additionally, for simplification, the direction of the validation and
merge is changed so the ast_type_qualifier calling the method is the
one validated and merged against the default in qualifier.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
8 years agoglsl: split default out layout qualifier merge
Andres Gomez [Mon, 14 Nov 2016 10:23:32 +0000 (12:23 +0200)]
glsl: split default out layout qualifier merge

Currently, the default out layout qualifier merge performs specific
validation and merge.

We want to split out the validation from the merge so they can be done
independently.

Additionally, for simplification, the direction of the validation and
merge is changed so the ast_type_qualifier calling the method is the
one validated and merged against the default out qualifier.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
8 years agoglsl: merge layouts into the default one as the last step in interface blocks
Andres Gomez [Tue, 18 Oct 2016 15:18:21 +0000 (18:18 +0300)]
glsl: merge layouts into the default one as the last step in interface blocks

Consider this example:

    " #version 150 core
      #extension GL_ARB_shading_language_420pack: require
      #extension GL_ARB_explicit_attrib_location: require

      layout(location=0) out vec4 o;
      layout(binding=2) layout(binding=3, std140) uniform U {
          vec4 a;
      } u[2];"

As there is 2 layout-qualifiers for the uniform U and the binding
layout-qualifier-id is duplicated, the rules set by the
ARB_shading_language_420pack spec state that the rightmost should
prevail.

Our ast_type_qualifier merges with others in a way that if the value
for a layout-qualifier-id is set in both, the object being merged
overwrites the value of the object invoking the merge. Hence, the
merge has to happen from the left layout towards the right one and
this was not happening for interface blocks because we were merging
into the default layout qualifier.

Now, the merge is done from left to right and, as a last step, we
merge into the default layout qualifier if needed, so the values of
the explicit layouts prevail over it.

V2: added a default_layout variable instead of a layout_helper and
    make the merge directly over the layout one. Suggested by Timothy.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
8 years agoglsl: ignore all but the rightmost layout-qualifier-name
Andres Gomez [Thu, 6 Oct 2016 22:52:04 +0000 (01:52 +0300)]
glsl: ignore all but the rightmost layout-qualifier-name

When a layout contains a duplicated layout-qualifier-name in a single
declaration, only the last occurrence should be taken into account.

From page 59 (page 65 of the PDF) of the GLSL 4.40 spec:

  " More than one layout qualifier may appear in a single
    declaration. Additionally, the same layout-qualifier-name can
    occur multiple times within a layout qualifier or across multiple
    layout qualifiers in the same declaration. When the same
    layout-qualifier-name occurs multiple times, in a single
    declaration, the last occurrence overrides the former
    occurrence(s)."

Consider this example:

  " #version 150
    #extension GL_ARB_enhanced_layouts: enable

    layout(max_vertices=2, max_vertices=3) out;
    layout(max_vertices=3) out;"

Although different values for "max_vertices" results in a compilation
error. The above code is valid because max_vertices=2 is ignored.

When merging qualifiers in an ast_type_qualifier, we now simply ignore
new appearances of a same layout-qualifier-name if the
"is_single_layout_merge" parameter is true, this works because the GLSL
parser processes qualifiers from right to left.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
8 years agoanv/state: if enabled, use anisotropic filtering also with VK_FILTER_NEAREST
Iago Toral Quiroga [Thu, 24 Nov 2016 10:21:20 +0000 (11:21 +0100)]
anv/state: if enabled, use anisotropic filtering also with VK_FILTER_NEAREST

Fixes multiple Vulkan CTS tests that combine anisotropy and VK_FILTER_NEAREST
in dEQP-VK.texture.filtering_anisotropy.*

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoclover: Restore support for LLVM <= 3.9.
Vedran Miletić [Tue, 22 Nov 2016 19:25:34 +0000 (20:25 +0100)]
clover: Restore support for LLVM <= 3.9.

The commit 8e430ff8b060b4e8e922bae24b3c57837da6ea77 broke support for
LLVM 3.9 and older versions in Clover. This patch restores it and
refactors the support using Clover compatibility layer for LLVM.

v2: merged #ifdef blocks
v3: added support for LLVM 3.6-3.8
v4: add missing #ifdef around <memory>
v5: simplify using templates and lambda

Signed-off-by: Vedran Miletić <vedran@miletic.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98740
Tested-by[v4]: Pierre Moreau <pierre.morrow@free.fr>
Tested-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
8 years agoscons: Recognize LLVM_CONFIG environment variable.
Vinson Lee [Wed, 23 Nov 2016 01:01:35 +0000 (17:01 -0800)]
scons: Recognize LLVM_CONFIG environment variable.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agoradv: Don't generate radv_timestamp.h
Bas Nieuwenhuizen [Tue, 22 Nov 2016 20:28:28 +0000 (21:28 +0100)]
radv: Don't generate radv_timestamp.h

Not needed anymore.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoradv: fix texel fetch offset with 2d arrays.
Dave Airlie [Thu, 24 Nov 2016 03:10:52 +0000 (03:10 +0000)]
radv: fix texel fetch offset with 2d arrays.

The code didn't limit the offsets to the number supplied, so
if we expected 3 but only got 2 we were accessing undefined memory.

This fixes random failures in:
dEQP-VK.glsl.texture_functions.texelfetchoffset.sampler2darray_*

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agomesa/getteximage: Add validation of target to glGetTextureImage
Eduardo Lima Mitev [Wed, 23 Nov 2016 13:09:59 +0000 (14:09 +0100)]
mesa/getteximage: Add validation of target to glGetTextureImage

There is an specific list of texture targets that can be used with
glGetTextureImage. From OpenGL 4.5 spec, section '8.11 Texture Queries',
page 234 of the PDF:

   "An INVALID_ENUM error is generated if the effective target is
    not one of TEXTURE_1D , TEXTURE_2D , TEXTURE_3D , TEXTURE_1D_-
    ARRAY , TEXTURE_2D_ARRAY , TEXTURE_CUBE_MAP_ARRAY , TEXTURE_-
    RECTANGLE , one of the targets from table 8.19 (for GetTexImage
    and GetnTexImage only), or TEXTURE_CUBE_MAP (for GetTextureImage
    only)."

We are currently not validating the target for glGetTextureImage. As
an example, calling this function on a texture with target
GL_TEXTURE_2D_MULTISAMPLE should return INVALID_ENUM, but instead it
hits an assertion down the road in the i965 driver.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agomain/texobj: Check that texture id > 0 before looking it up in hash-table
Eduardo Lima Mitev [Wed, 23 Nov 2016 13:44:05 +0000 (14:44 +0100)]
main/texobj: Check that texture id > 0 before looking it up in hash-table

_mesa_lookup_texture_err() is not currently checking that the
texture-id can be zero, but _mesa_HashLookup() doesn't expect the key
to be zero, and will fail an assertion.

Considering that _mesa_lookup_texture_err() is called from
_mesa_GetTextureImage and _mesa_GetTextureSubImage with user provided
arguments, we must validate the texture-id before looking it up in the
hash-table.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoutil: fix memory leak from the fragment shaders for SINT<->UINT blits
Charmaine Lee [Thu, 24 Nov 2016 06:53:08 +0000 (22:53 -0800)]
util: fix memory leak from the fragment shaders for SINT<->UINT blits

This patch deletes those fragment shaders in util_blitter_destroy().

Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agoi965: Always reserve clip distance VUE slots in SSO mode.
Kenneth Graunke [Wed, 17 Aug 2016 20:48:44 +0000 (13:48 -0700)]
i965: Always reserve clip distance VUE slots in SSO mode.

This fixes rendering in Dolphin on Vulkan since we enabled clip
distances.  (Dolphin on GL has a similar bug because the linker
fails to eliminate unused clip distance built-in arrays, but it
isn't using SSO...so that needs more fixing.)

Also fixes a Piglit test:
spec/glsl-1.50/execution/geometry.clip-distance-vs-gs-out-sso

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv/gen7: only enable dual-source blending when there are dual-source factors
Ilia Mirkin [Thu, 24 Nov 2016 02:43:38 +0000 (21:43 -0500)]
anv/gen7: only enable dual-source blending when there are dual-source factors

Apparently the hw wedges otherwise, as mentioned in i965 comments.

Reported-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoswr: clear every layer of the attached surfaces
Ilia Mirkin [Thu, 17 Nov 2016 02:45:14 +0000 (21:45 -0500)]
swr: clear every layer of the attached surfaces

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] pipe renderTargetArrayIndex through to clears
Ilia Mirkin [Thu, 17 Nov 2016 02:25:12 +0000 (21:25 -0500)]
swr: [rasterizer core] pipe renderTargetArrayIndex through to clears

Currently clears only operate on the 0th array index (ignoring surface
layout parameters). Instead normalize to take a RTAI like all the
load/store tile logic does, and use ComputeSurfaceAddress to properly
take the surface state's lod/array index into account.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] clear data now comes in as float
Ilia Mirkin [Fri, 18 Nov 2016 00:48:30 +0000 (19:48 -0500)]
swr: [rasterizer core] clear data now comes in as float

The non-fast-clear path was never updated after clear colors were passed
in as floats. Remove the now-harmful conversion from unorm8.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] actually perform clear before store in GetHotTile
Ilia Mirkin [Fri, 18 Nov 2016 00:39:20 +0000 (19:39 -0500)]
swr: [rasterizer core] actually perform clear before store in GetHotTile

When switching render target array indexes (as might happen in a GS, or
in a future change, with layered clears), if the previous state is
HOTTILE_CLEAR, we should actually clear the tile before saving it off.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoi965: Fix a mistake from porting the URB allocation code to arrays.
Kenneth Graunke [Wed, 23 Nov 2016 20:24:22 +0000 (12:24 -0800)]
i965: Fix a mistake from porting the URB allocation code to arrays.

Commit 6d416bcd846a49414f210cd761789156c37a7b3e (i965: Use arrays in
Gen7+ URB code.) introduced a regression which caused us to fail to
allocate all of our URB space.

   -         total_wants -= ds_wants;
   +         total_wants -= additional;

The new line should have been total_wants -= wants[i].

Fixes a large performance regression in TessMark.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98815
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965: Use 3DSTATE_CLIP's User Clip Distance Enable bitmask on Gen8+.
Kenneth Graunke [Wed, 16 Nov 2016 06:59:45 +0000 (22:59 -0800)]
i965: Use 3DSTATE_CLIP's User Clip Distance Enable bitmask on Gen8+.

Gen6-7.5 specify the user clip distance enable bitmask in 3DSTATE_CLIP.
Gen8+ normally uses the new internal signalling mechanism to select the
one specified in the last enabled shader stage (3DSTATE_VS, DS, or GS).

This is a pretty good fit for Vulkan, or even newer GL, where the
bitmask comes entirely from the shader.  But with glClipPlane(),
this is dynamic state, and we have to listen to _NEW_TRASNFORM.

Clip plane enables are the only reason the VS/DS/GS atoms need to
listen to _NEW_TRANSFORM.  3DSTATE_CLIP already has to listen to it
in order to support ARB_clip_control settings.

Setting the "Use the 3DSTATE_CLIP bitmask" force enable bit allows
us to drop _NEW_TRANSFORM from all the shader stage atoms, so we can
re-emit them less often.

Improves performance of OglBatch7 (version 6) by 2.70773% +/- 0.491257%
(n = 38) at 1024x768 on Cherryview.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoradv: fix flipped blits
Dave Airlie [Tue, 15 Nov 2016 04:54:28 +0000 (04:54 +0000)]
radv: fix flipped blits

This fixes:
dEQP-VK.api.copy_and_blit.blit_image.simple_tests.mirror*

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoradv/meta: just local vars for src/dst subresources.
Dave Airlie [Wed, 23 Nov 2016 23:35:41 +0000 (23:35 +0000)]
radv/meta: just local vars for src/dst subresources.

This is just a cleanup before I rework this code to fix mirrored
blits.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoradv: add support for VK_AMD_draw_indirect_count
Fredrik Höglund [Wed, 23 Nov 2016 22:05:01 +0000 (23:05 +0100)]
radv: add support for VK_AMD_draw_indirect_count

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoradv: add support for VK_AMD_negative_viewport_height
Fredrik Höglund [Wed, 23 Nov 2016 22:05:00 +0000 (23:05 +0100)]
radv: add support for VK_AMD_negative_viewport_height

The driver already supports this extension in practice.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoradv: add support for VK_KHR_sampler_mirror_clamp_to_edge
Fredrik Höglund [Wed, 23 Nov 2016 22:04:59 +0000 (23:04 +0100)]
radv: add support for VK_KHR_sampler_mirror_clamp_to_edge

radv_tex_wrap() already supports VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE,
so all that's needed is to advertise support for the extension.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoradv: add support for anisotropic filtering on SI-CI
Fredrik Höglund [Wed, 23 Nov 2016 22:04:58 +0000 (23:04 +0100)]
radv: add support for anisotropic filtering on SI-CI

Ported from radeonsi.

Note that si_make_texture_descriptor() already sets img7 to the mask
value referred to in the comment.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoi965/gen7: Only advertise 4 samples for RGBA32F on GLES
Jordan Justen [Fri, 22 Jul 2016 22:23:55 +0000 (15:23 -0700)]
i965/gen7: Only advertise 4 samples for RGBA32F on GLES

We can't render to 8x MSAA if the width is greater than 64 bits. (see
brw_render_target_supported)

Fixes ES31-CTS.sample_variables.mask.rgba32f.samples_8.mask_*

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoradeonsi: print new opt flags in si_dump_shader_key
Marek Olšák [Mon, 21 Nov 2016 19:57:05 +0000 (20:57 +0100)]
radeonsi: print new opt flags in si_dump_shader_key

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: add a debug flag that disables optimized shader variants
Marek Olšák [Mon, 21 Nov 2016 19:39:27 +0000 (20:39 +0100)]
radeonsi: add a debug flag that disables optimized shader variants

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agocompiler/glsl/tests: Fix print format when building 32-bit binaries on 64-bit host
Aaron Watry [Mon, 3 Oct 2016 14:47:45 +0000 (09:47 -0500)]
compiler/glsl/tests: Fix print format when building 32-bit binaries on 64-bit host

Avoids two warnings.

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agocompiler/glsl/tests: Fix print format when building 32-bit binaries on 64-bit host
Aaron Watry [Tue, 22 Nov 2016 17:18:11 +0000 (11:18 -0600)]
compiler/glsl/tests: Fix print format when building 32-bit binaries on 64-bit host

Avoids three warnings.

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoanv: fix enumeration of properties
Emil Velikov [Thu, 6 Oct 2016 13:12:27 +0000 (14:12 +0100)]
anv: fix enumeration of properties

Driver should enumerate only up-to min2(num_available, num_requested)
properties and return VK_INCOMPLETE if the # of requested props is
smaller than the ones available.

Presently we assert out in such cases.

Inspired by a similar fix for RADV.

v2: Use MIN2 + typed_memcpy (Jason).

Should fix: dEQP-VK.api.info.device.extensions

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Restructure fast clear eligibility decision
Ben Widawsky [Wed, 20 Apr 2016 14:44:17 +0000 (07:44 -0700)]
i965: Restructure fast clear eligibility decision

v2 (Jason):
   - Use PRM citation for SKL now that it is available
   - Also return false for gen < 8 mipmapped/arrayed

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Set initial msaa fast clear status explicitly
Topi Pohjolainen [Fri, 8 Jul 2016 07:26:30 +0000 (10:26 +0300)]
i965: Set initial msaa fast clear status explicitly

instead of in intel_miptree_init_mcs(). For lossless compression
the status is immediately overwritten in
intel_miptree_alloc_non_msrt_mcs() while the status for
non-compressed non-msaa miptrees is explicitly set in
do_blorp_clear().

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Declare read-only input to level/layer check const
Topi Pohjolainen [Fri, 10 Jun 2016 15:16:22 +0000 (18:16 +0300)]
i965: Declare read-only input to level/layer check const

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965/fbo: Prepare layer multiplier for render buffer compression
Topi Pohjolainen [Tue, 7 Jun 2016 05:22:18 +0000 (08:22 +0300)]
i965/fbo: Prepare layer multiplier for render buffer compression

This path is not yet taken for fast cleared or compressed buffers
but later patches will enable it.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Add multi-slice getter for resolve maps
Topi Pohjolainen [Fri, 10 Jun 2016 15:18:57 +0000 (18:18 +0300)]
i965: Add multi-slice getter for resolve maps

This is useful when checking if any slice is in unresolved state.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965/meta: Split conversion of color and setting it
Topi Pohjolainen [Sun, 12 Jun 2016 17:49:54 +0000 (20:49 +0300)]
i965/meta: Split conversion of color and setting it

And fix a mangled comment while at it.

v2 (Ben): Return the converted color.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agointel/blorp: Fix rectangle size for level-not-zero resolves
Topi Pohjolainen [Tue, 22 Nov 2016 10:15:07 +0000 (12:15 +0200)]
intel/blorp: Fix rectangle size for level-not-zero resolves

Needed to prevent gpu hangs when mip-mapped compression gets
enabled.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965/miptree: Don't shrink textures when augmenting for more levels
Topi Pohjolainen [Tue, 15 Nov 2016 20:27:12 +0000 (22:27 +0200)]
i965/miptree: Don't shrink textures when augmenting for more levels

This was detected when examining CCS_E failures with piglit test:
"fbo-generatemipmap-formats". Test creates a 2D texture with
dimensions 293x277. It manually loops over all levels and calls
glTexImage2D(). Level one triggers creation of full miptree:
intel_alloc_texture_image_buffer() realizes that there is only one
level in the miptree and calls intel_miptree_create_for_teximage()
to re-allocate the miptree with all 9 levels. However, the end result
is a miptree with level zero dimensions of 292x276.

Related, and possibly calling for treatment of its own is mip-map
generation:
After calling glTexImage2D() against every level test continues by
replacing content for levels one to eight with data derived from level
zero by calling glGenerateMipmapEXT(). This results into the miptree
being allocated anew for every level:
Mip-map generation goes thru meta which ends up validating the texture
(brw_validate_textures()->intel_finalize_mipmap_tree()->
intel_miptree_match_image()) where one finds texture with base level
size 292:276. This results into new miptree being created for the npot
size 293:277. Only here intel_finalize_mipmap_tree() is asked for only
one level, and therefore such is created. Generation for level one in
turn finds right base level size but only one level when two is needed.
And the same goes on for all eight levels.

This patch prevents the shrink maintaining the NPOT size of 293x277.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agomain/getteximage: Use the height argument to calculate memcpy copy size
Eduardo Lima Mitev [Tue, 22 Nov 2016 11:12:48 +0000 (12:12 +0100)]
main/getteximage: Use the height argument to calculate memcpy copy size

In get_tex_memcpy, when copying texture data directly from source
to destination (when row strides match for both src and dst), the
copy size is currently calculated using the full texture height
instead of the sub-region height parameter that was passed.

This can cause a read past the end of the mapped buffer when y-offset
is greater than zero, leading to a segfault.

Fixes CTS test (from crash to pass):
* GL45-CTS/get_texture_sub_image/functional_test

v2: (Jason) Use the passed 'height' instead of copying til the
end of the buffer (tex-height - yoffset).

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/spirv: implement ordered / unordered floating point comparisons properly
Iago Toral Quiroga [Thu, 17 Nov 2016 08:36:36 +0000 (09:36 +0100)]
nir/spirv: implement ordered / unordered floating point comparisons properly

Besides the logical operation involved, these also require that we test if the
operands are ordered / unordered.

For ordered operations, both operands must be ordered (and they must pass the
conditional test) while for unordered operations it is sufficient if only one
of the operands is unordered (or they pass the logical test).

Fixes the following Vulkan CTS tests:

dEQP-VK.spirv_assembly.instruction.compute.opfunord.equal
dEQP-VK.spirv_assembly.instruction.compute.opfunord.greater
dEQP-VK.spirv_assembly.instruction.compute.opfunord.greaterequal
dEQP-VK.spirv_assembly.instruction.compute.opfunord.less
dEQP-VK.spirv_assembly.instruction.compute.opfunord.lessequal

v2: Fixed typo: s/nir_eq/nir_feq

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
8 years agoanv: fix segfault in anv_BindImageMemory
Dave Airlie [Wed, 23 Nov 2016 06:05:34 +0000 (16:05 +1000)]
anv: fix segfault in anv_BindImageMemory

Since bind image memory started memsetting surfaces, the
device node can't be NULL, since we lookup device->info.has_llc.

Not sure why it ever was NULL before.

Fixes some things on my Ivybridge.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoswr: [rasterizer core] fix cast for stencil clear value
Tim Rowley [Wed, 23 Nov 2016 01:50:55 +0000 (19:50 -0600)]
swr: [rasterizer core] fix cast for stencil clear value

Bad type cast for stencil clear value was picking up structure
padding bytes.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoswr: color interpolation is also supposed to get perspective division
Ilia Mirkin [Mon, 21 Nov 2016 02:20:08 +0000 (21:20 -0500)]
swr: color interpolation is also supposed to get perspective division

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: add sprite coord enable mask to fs key
Ilia Mirkin [Mon, 21 Nov 2016 17:45:08 +0000 (12:45 -0500)]
swr: add sprite coord enable mask to fs key

This fixes gl-coord-replace-doesnt-eliminate-frag-tex-coords

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: rework vert <-> frag shader linkage logic
Ilia Mirkin [Thu, 10 Nov 2016 02:04:01 +0000 (21:04 -0500)]
swr: rework vert <-> frag shader linkage logic

Fixes a few things:
 - sprite coords only apply to generic varyings, and are a bitmask
 - back color only applies in 2-sided lighting mode
 - handle some odd situations between only some front/back colors being
   there. This is only semi-legal in GL, but we shouldn't start
   crashing.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: flatshading makes color outputs flat, it doesn't affect others
Ilia Mirkin [Mon, 21 Nov 2016 00:48:38 +0000 (19:48 -0500)]
swr: flatshading makes color outputs flat, it doesn't affect others

We were previously not marking the "regular" flat outputs as flat when
flatshading was enabled.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: only broadcast color0 value, not all color values
Ilia Mirkin [Mon, 21 Nov 2016 00:08:12 +0000 (19:08 -0500)]
swr: only broadcast color0 value, not all color values

The way that dual-source blending is described for GLES2 is very odd,
and we end up with a shader that both has this property set *and* has a
color1 value to be used as the second source. While changing the state
tracker is an option, it seems more reliable to verify that the
broadcast is only done on color0.

Fixes arb_blend_func_extended-fbo-extended-blend-pattern_gles2

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: report a reasonable max lod bias
Ilia Mirkin [Sat, 19 Nov 2016 15:10:47 +0000 (10:10 -0500)]
swr: report a reasonable max lod bias

This is the same value that llvmpipe uses. Since swr uses the same
sampler logic, makes sense for this value to also be the same. Most
applications don't care.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: avoid using exceptions for expected condition handling
Ilia Mirkin [Sun, 13 Nov 2016 03:18:48 +0000 (22:18 -0500)]
swr: avoid using exceptions for expected condition handling

I was getting a weird segfault from GCC 4.9.3:

 0x00007ffff54f27aa in strlen () from /lib64/libc.so.6
 (gdb) bt
 #0  0x00007ffff54f27aa in strlen () from /lib64/libc.so.6
 #1  0x00007ffff4f128e5 in get_cie_encoding (cie=cie@entry=0x7ffff6e09813)
     at /gcc-4.9.3/libgcc/unwind-dw2-fde.c:272
 #2  0x00007ffff4f1318e in classify_object_over_fdes (ob=ob@entry=0xd7bb90, this_fde=0x7ffff7f11010)
     at /gcc-4.9.3/libgcc/unwind-dw2-fde.c:628
 #3  0x00007ffff4f135ba in init_object (ob=0xd7bb90)
     at /gcc-4.9.3/libgcc/unwind-dw2-fde.c:749
 #4  search_object (ob=ob@entry=0xd7bb90, pc=pc@entry=0x7ffff4f11f4d <_Unwind_RaiseException+61>)
     at /gcc-4.9.3/libgcc/unwind-dw2-fde.c:961
 #5  0x00007ffff4f13e62 in _Unwind_Find_registered_FDE (bases=0x7fffffffd358, pc=0x7ffff4f11f4d <_Unwind_RaiseException+61>)
     at /gcc-4.9.3/libgcc/unwind-dw2-fde.c:1025
 #6  _Unwind_Find_FDE (pc=0x7ffff4f11f4d <_Unwind_RaiseException+61>, bases=bases@entry=0x7fffffffd358)
     at /gcc-4.9.3/libgcc/unwind-dw2-fde-dip.c:450
 #7  0x00007ffff4f11197 in uw_frame_state_for (context=context@entry=0x7fffffffd2b0, fs=fs@entry=0x7fffffffd100)
     at /gcc-4.9.3/libgcc/unwind-dw2.c:1245
 #8  0x00007ffff4f11b15 in uw_init_context_1 (context=context@entry=0x7fffffffd2b0, outer_cfa=outer_cfa@entry=0x7fffffffd660, outer_ra=0x7ffff518d23b <__cxa_throw+91>)
     at /gcc-4.9.3/libgcc/unwind-dw2.c:1566
 #9  0x00007ffff4f11f4e in _Unwind_RaiseException (exc=0xd7c250)
     at /gcc-4.9.3/libgcc/unwind.inc:88
 #10 0x00007ffff518d23b in __cxa_throw () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/libstdc++.so.6
 #11 0x00007ffff51ed556 in std::__throw_out_of_range(char const*) ()
    from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/libstdc++.so.6
 #12 0x00007fffea778be0 in std::map<pipe_format, SWR_FORMAT, std::less<pipe_format>, std::allocator<std::pair<pipe_format const, SWR_FORMAT> > >::at (
     this=0x7fffebeb4c40 <mesa_to_swr_format(pipe_format)::mesa2swr>,
     __k=@0x7fffffffd73c: PIPE_FORMAT_RGTC1_UNORM)
     at /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4/bits/stl_map.h:549
 #13 0x00007fffea776aee in mesa_to_swr_format (format=PIPE_FORMAT_RGTC1_UNORM) at swr_screen.cpp:597

We can just void this whole issue by not using exceptions in the
first place.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agoswr: remove formats from mapping table that don't have StoreTile impls
Ilia Mirkin [Sat, 12 Nov 2016 18:09:21 +0000 (13:09 -0500)]
swr: remove formats from mapping table that don't have StoreTile impls

This table exists for the purpose of determining renderable formats.
Without a StoreTile implementation, that can't happen.

This basically removes rendering support to all L/LA/I formats. They can
be re-added when/if StoreTile implementations are added.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agoswr: remove unnecessary -1 entries in format mapping table
Ilia Mirkin [Wed, 9 Nov 2016 20:13:26 +0000 (15:13 -0500)]
swr: remove unnecessary -1 entries in format mapping table

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agoswr: rework resource layout and surface setup
Ilia Mirkin [Wed, 9 Nov 2016 22:16:36 +0000 (17:16 -0500)]
swr: rework resource layout and surface setup

This is a bit of a mega-commit, but unfortunately there's no great way
to break this up since a lot of different pieces have to match up. Here
we do the following:
 - change surface layout to match swr's Load/StoreTile expectations
 - fix sampler settings to respect all sampler view parameters
 - fix stencil sampling to read from secondary resource
 - respect pipe surface format, level, and layer settings
 - fix resource map/unmap based on the new layout logic
 - fix resource map/unmap to copy proper parts of stencil values in and
   out of the matching depth texture

These fix a massive quantity of piglits, including all the
tex-miplevel-selection ones.

Note that the swr native miptree layout isn't extremely space-efficient,
and we end up using it for all textures, not just the renderable ones. A
back-of-the-envelope calculation suggests about 10%-25% increased memory
usage for miptrees, depending on the number of LODs. Single-LOD textures
should be unaffected.

There are a handful of regressions as a result of this change:
 - Some textureGrad tests, these failures match llvmpipe. (There are
   debug settings allowing improved gallivm sampling accurancy.)
 - Some layered clearing tests as swr doesn't currently support that. It
   was getting lucky before because enough other things were broken.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agoutil: fix missing swizzle components in the SINT <-> UINT conversion string
Charmaine Lee [Tue, 22 Nov 2016 21:33:37 +0000 (13:33 -0800)]
util: fix missing swizzle components in the SINT <-> UINT conversion string

Fixes tgsi error introduced in commit 3817a7a. The error complains missing
swizzle component in the conversion string "UMIN TEMP[0], TEMP[0], IMM[0].x".

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agovc4: Don't conditionalize the src1 mov of qir_SEL().
Eric Anholt [Tue, 22 Nov 2016 07:52:37 +0000 (23:52 -0800)]
vc4: Don't conditionalize the src1 mov of qir_SEL().

My thought in having both arguments conditionally moved was that it should
theoretically save some power by not doing work in those channels.
However, it ends up costing us instructions because we can't
register-coalesce the first of the MOVs, and it also introduces extra
scheduling dependencies.  The instruction cost would swamp whatever power
benefit I was hoping for.

shader-db results:
total instructions in shared programs: 100548 -> 99741 (-0.80%)
instructions in affected programs:     42450 -> 41643 (-1.90%)

With obvious outliers removed (I had an X11 emacs running over the network
in the "after" case), 3DMMES Taiji showed 1.07231% +/- 0.488241% fps
improvement (n=18, 30).

8 years agovc4: Re-add R4 to the "any" register class.
Eric Anholt [Tue, 22 Nov 2016 07:29:04 +0000 (23:29 -0800)]
vc4: Re-add R4 to the "any" register class.

I screwed this up in fdad4d24024ab7bc9b6b9cb6288f8b76ccac0d89 which was
supposed to be making this code more maintainable.  What's amazing is
multithreaded FS showed the wins it did despite this bug.

shader-db results:
total instructions in shared programs: 103535 -> 100548 (-2.89%)
instructions in affected programs:     83794 -> 80807 (-3.56%)

8 years agovc4: Disable MSAA rasterization when the job binning is single-sampled.
Eric Anholt [Tue, 22 Nov 2016 21:51:03 +0000 (13:51 -0800)]
vc4: Disable MSAA rasterization when the job binning is single-sampled.

Gallium core just changed to start setting MSAA enabled in the rasterizer
state even with samples==1 buffers.  This caused disagreements in our
driver between binning and rasterization state, which the simulator threw
assertion failures about.  Keep the single-sampled samples==1 behavior for
now.

8 years agovc4: Make sure we don't overflow texture input/output FIFOs when threaded.
Eric Anholt [Tue, 22 Nov 2016 21:31:46 +0000 (13:31 -0800)]
vc4: Make sure we don't overflow texture input/output FIFOs when threaded.

I dropped the first hunk of this change last minute when I decided it
wasn't actually needed, and apparently failed to piglit it in simulation.
The simulator threw an an assertion in gl-1.0-drawpixels-color-index,
which queued up 5 coordinates (3 before a switch, two after) before
loading the result.

8 years agoradv: move pipeline barrier image transitions after src flushing
Dave Airlie [Tue, 25 Oct 2016 06:23:48 +0000 (07:23 +0100)]
radv: move pipeline barrier image transitions after src flushing

This seems like it would conform better with the spec.

noticed while digging into fast clears.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoanv: Enable fast clears on gen7-8
Jason Ekstrand [Sat, 19 Nov 2016 16:47:25 +0000 (08:47 -0800)]
anv: Enable fast clears on gen7-8

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv: Add support for fast clears on gen9
Jason Ekstrand [Fri, 18 Nov 2016 06:55:30 +0000 (22:55 -0800)]
anv: Add support for fast clears on gen9

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/blorp: Rework flushing around resolves
Jason Ekstrand [Sat, 19 Nov 2016 16:25:28 +0000 (08:25 -0800)]
anv/blorp: Rework flushing around resolves

It turns out that the flushing required around resolves is a bit more
extensive than I first thought.  You actually need render cache flush
and a CS stall both before *and* after the resolve.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/cmd_buffer: Apply remaining flushes in EndCommandBuffer
Jason Ekstrand [Sat, 19 Nov 2016 01:39:26 +0000 (17:39 -0800)]
anv/cmd_buffer: Apply remaining flushes in EndCommandBuffer

Otherwise, some pipe flushes may just never happen.  This is unlikely to
cause problems depending on how the kernel schedules batches, but we
shouldn't count on it.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/blorp: Use regular blorp clears for subpass clears
Jason Ekstrand [Fri, 18 Nov 2016 21:35:42 +0000 (13:35 -0800)]
anv/blorp: Use regular blorp clears for subpass clears

At vkCmdNextSubpass time, we have the actual framebuffer so we can use
regular blorp_clear for subpass clears.  For fast clears, there is no
attachment version, so this will make fast clears a bit easier.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv: Add a vk_to_isl_color helper
Jason Ekstrand [Fri, 18 Nov 2016 21:35:16 +0000 (13:35 -0800)]
anv: Add a vk_to_isl_color helper

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/cmd_buffer: Make setup_attachments take a RenderPassBeginInfo
Jason Ekstrand [Fri, 18 Nov 2016 06:26:52 +0000 (22:26 -0800)]
anv/cmd_buffer: Make setup_attachments take a RenderPassBeginInfo

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv: Set up binding tables and surface states for input attachments
Jason Ekstrand [Tue, 15 Nov 2016 23:25:55 +0000 (15:25 -0800)]
anv: Set up binding tables and surface states for input attachments

This commit adds the last remaining bits to support input attachments in
the Intel Vulkan driver.  For color and depth attachments, we allocate an
input attachment surface state during vkCmdBeginRenderPass like we do for
the render target surface states.  This is so that we can incorporate the
clear color and aux information as used in rendering.  For stencil, we just
treat it like a regular texture because we don't there is no aux.  Also,
only having to worry about at most one input attachment surface for each
attachment makes some of the vkCmdBeginRenderPass code simpler.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/pipeline: Handle depth/stencil self-dependencies
Jason Ekstrand [Wed, 16 Nov 2016 18:39:15 +0000 (10:39 -0800)]
anv/pipeline: Handle depth/stencil self-dependencies

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv: Use pass attachment information to insert flushes
Jason Ekstrand [Wed, 16 Nov 2016 07:11:55 +0000 (23:11 -0800)]
anv: Use pass attachment information to insert flushes

Input and resolve attachments can cause an implicit dependency in the
pipeline.  It's our job to insert the needed flushes.  Fortunately, we can
easily reuse the usage tracking that we use for CCS resolves.

This fixes 159 Vulkan CTS tests on Haswell because we're now flushing in
between drawing and MSAA resolves.  I have no idea how they were passing
before on newer hardware.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/cmd_buffer: Fix pipeline barriers for input attachments
Jason Ekstrand [Wed, 16 Nov 2016 19:20:50 +0000 (11:20 -0800)]
anv/cmd_buffer: Fix pipeline barriers for input attachments

We were using VK_IMAGE_ACCESS_COLOR_ATTACHMENT_READ_BIT to detect an input
attachment read.  We should use VK_IMAGE_ACCESS_INPUT_ATTACHMENT_READ_BIT
instead.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/pipeline: Add a input_attachment_index to the bindings
Jason Ekstrand [Tue, 15 Nov 2016 23:21:08 +0000 (15:21 -0800)]
anv/pipeline: Add a input_attachment_index to the bindings

This allows us to go from the binding to either the descriptor or the input
attachment at will.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/pass: Calculate the combined image usage of attachments
Jason Ekstrand [Tue, 15 Nov 2016 01:18:47 +0000 (17:18 -0800)]
anv/pass: Calculate the combined image usage of attachments

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>