mesa.git
6 years agoi965/fs: Implement ARB_shader_ballot operations
Matt Turner [Thu, 22 Jun 2017 23:46:39 +0000 (16:46 -0700)]
i965/fs: Implement ARB_shader_ballot operations

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoi965/fs: Do not move MOVs writing the flag outside of control flow
Matt Turner [Fri, 30 Jun 2017 21:58:22 +0000 (14:58 -0700)]
i965/fs: Do not move MOVs writing the flag outside of control flow

The implementation of ballotARB() will start by zeroing the flags
register. So, a doing something like

        if (gl_SubGroupInvocationARB % 2u == 0u) {
                ... = ballotARB(true);
[...]
        } else {
                ... = ballotARB(true);
[...]
}

(like fs-ballot-if-else.shader_test does) would generate identical MOVs
to the same destination (the flag register!), and we definitely do not
want to pull that out of the control flow.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoi965/fs: Handle explicit flag sources in flags_read()
Francisco Jerez [Thu, 22 Jun 2017 23:42:34 +0000 (16:42 -0700)]
i965/fs: Handle explicit flag sources in flags_read()

The implementations of the ARB_shader_ballot intrinsics will explicitly
read the flag as a source register.

Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agonir: Add pass to scalarize read_invocation/read_first_invocation
Matt Turner [Thu, 6 Jul 2017 04:57:44 +0000 (21:57 -0700)]
nir: Add pass to scalarize read_invocation/read_first_invocation

i965 will want these to be scalar operations.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Add system values from ARB_shader_ballot
Matt Turner [Thu, 22 Jun 2017 23:37:51 +0000 (16:37 -0700)]
nir: Add system values from ARB_shader_ballot

We already had a channel_num system value, which I'm renaming to
subgroup_invocation to match the rest of the new system values.

Note that while ballotARB(true) will return zeros in the high 32-bits on
systems where gl_SubGroupSizeARB <= 32, the gl_SubGroup??MaskARB
variables do not consider whether channels are enabled. See issue (1) of
ARB_shader_ballot.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Add intrinsics from ARB_shader_ballot
Matt Turner [Thu, 22 Jun 2017 23:43:24 +0000 (16:43 -0700)]
nir: Add intrinsics from ARB_shader_ballot

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoi965: Enable ARB_shader_group_vote
Matt Turner [Thu, 22 Jun 2017 19:24:08 +0000 (12:24 -0700)]
i965: Enable ARB_shader_group_vote

6 years agoi965/fs: Implement ARB_shader_group_vote operations
Matt Turner [Wed, 21 Jun 2017 05:39:22 +0000 (22:39 -0700)]
i965/fs: Implement ARB_shader_group_vote operations

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoi965/fs: Handle explicit flag destinations in flags_written()
Francisco Jerez [Wed, 21 Jun 2017 05:38:48 +0000 (22:38 -0700)]
i965/fs: Handle explicit flag destinations in flags_written()

The implementations of the ARB_shader_group_vote intrinsics will
explicitly write the flag as the destination register.

Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agoi965/vec4: Lower ARB_shader_group_vote intrinsics
Matt Turner [Thu, 22 Jun 2017 19:21:52 +0000 (12:21 -0700)]
i965/vec4: Lower ARB_shader_group_vote intrinsics

I don't expect anyone is going to care about using this in vec4 programs
(vertex/tessellation/geometry on Gen6/7), no one has come up with a good
way to implement it much less test it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Support lowering vote intrinsics
Matt Turner [Thu, 22 Jun 2017 19:20:18 +0000 (12:20 -0700)]
nir: Support lowering vote intrinsics

... trivially (as allowed by the spec!) by reusing the existing
nir_opt_intrinsics code.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Add pass to optimize intrinsics
Matt Turner [Thu, 22 Jun 2017 19:13:25 +0000 (12:13 -0700)]
nir: Add pass to optimize intrinsics

Specifically, constant fold intrinsics from ARB_shader_group_vote, but I
suspect it'll be useful for other things in the future.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Add intrinsics from ARB_shader_group_vote
Matt Turner [Wed, 21 Jun 2017 05:37:43 +0000 (22:37 -0700)]
nir: Add intrinsics from ARB_shader_group_vote

These are intrinsics rather than opcodes, because they operate across
channels.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoi965: Rename batch->exec_objects to validation_list
Chris Wilson [Thu, 20 Jul 2017 16:29:19 +0000 (17:29 +0100)]
i965: Rename batch->exec_objects to validation_list

Within i965, we have many different objects and confusingly when
submitting an execbuf we have lists of both our internal objects and a
list of the kernel's drm_i915_gem_exec_object with very similar names.
Rename the kernel's validation list to avoid the collison as it is only
used for interfacing with the kernel and so a peripheral use of
"object".

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoRevert "i965: Call intel_prepare_render() from intel_update_state()"
Kenneth Graunke [Thu, 20 Jul 2017 04:29:51 +0000 (21:29 -0700)]
Revert "i965: Call intel_prepare_render() from intel_update_state()"

This reverts commit b7153c3e9f9d2d430b0338313587a00e531e4800.

The point of that commit was to ensure intel_prepare_render() occurred
before color resolves on the current framebuffer.  In 0673bbfd9ba16be8
(i965: Move surface resolves back to draw/dispatch time), Jason moved
brw_predraw_resolve_framebuffer back to draw time, which is already
after a intel_prepare_render() call.  So, this is no longer necessary.

Furthermore, it caused problems.  "mpv" would only display a small
corner of movies, and Android started failing camera CTS tests.

This is because intel_prepare_render() ended up handling DRI2 events
which caused the drawable to be resized at an inopportune time, flagging
ctx->NewState |= _NEW_BUFFERS, but at a point where we've already copied
ctx->NewState, and failed to notice the newly set flag.

The lack of _NEW_BUFFERS caused us to skip 3DSTATE_DRAWING_RECTANGLE,
so the drawing ended up being clipped to an outdated framebuffer size.

Just drop the hack and go back to handling this at the proper time.

Thanks to Matti Hämäläinen (ccr), Tomasz Figa (tfiga), and Tapani Palli
for reporting these issues.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101558
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101704
Tested-by: Tapani Pälli <tapani.palli@intel.com>
6 years agomesa: remove useless assert in _mesa_TextureView()
Samuel Pitoiset [Thu, 20 Jul 2017 09:53:04 +0000 (11:53 +0200)]
mesa: remove useless assert in _mesa_TextureView()

Already checked in _mesa_choose_texture_format().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: remove duplicated code around framebuffer_renderbuffer()
Samuel Pitoiset [Thu, 20 Jul 2017 09:53:03 +0000 (11:53 +0200)]
mesa: remove duplicated code around framebuffer_renderbuffer()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: remove one extra check in _mesa_DeleteTextures()
Samuel Pitoiset [Thu, 20 Jul 2017 09:53:02 +0000 (11:53 +0200)]
mesa: remove one extra check in _mesa_DeleteTextures()

Already checked above.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: make _mesa_generate_texture_mipmap() static
Samuel Pitoiset [Thu, 20 Jul 2017 09:53:01 +0000 (11:53 +0200)]
mesa: make _mesa_generate_texture_mipmap() static

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: inline save_array_object()
Samuel Pitoiset [Thu, 20 Jul 2017 09:53:00 +0000 (11:53 +0200)]
mesa: inline save_array_object()

No need to check if ID is not 0 because _mesa_HashFindFreeKeyBlock()
can't generate this value.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: inline remove_array_object()
Samuel Pitoiset [Thu, 20 Jul 2017 09:52:59 +0000 (11:52 +0200)]
mesa: inline remove_array_object()

No need to check if ID is not 0 because _mesa_lookup_vao()
already prevents this to happen.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: tidy up _mesa_DeleteVertexArrays()
Samuel Pitoiset [Thu, 20 Jul 2017 09:52:58 +0000 (11:52 +0200)]
mesa: tidy up _mesa_DeleteVertexArrays()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: remove useless assert in texture_storage()
Samuel Pitoiset [Thu, 20 Jul 2017 09:52:57 +0000 (11:52 +0200)]
mesa: remove useless assert in texture_storage()

Already checked in _mesa_choose_texture_format().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: pass the 'caller' function to texstorage()
Samuel Pitoiset [Thu, 20 Jul 2017 09:52:56 +0000 (11:52 +0200)]
mesa: pass the 'caller' function to texstorage()

To be consistent with texturestorage().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: make _mesa_texture_storage() static
Samuel Pitoiset [Thu, 20 Jul 2017 09:52:55 +0000 (11:52 +0200)]
mesa: make _mesa_texture_storage() static

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoi965: Represent depth surfaces with isl
Topi Pohjolainen [Sat, 22 Apr 2017 08:42:02 +0000 (11:42 +0300)]
i965: Represent depth surfaces with isl

v2 (Jason):
   - s/separate_stencil_surface/make_separate_stencil_surface/
   - drop the check for separate stencil when wrapping an
     existing buffer object with miptree. This is dead code as
     the first needs_separate_stencil() checks is
     MIPTREE_LAYOUT_FOR_BO-flag and says no.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Drop redundant check for non-tiled depth buffer
Topi Pohjolainen [Wed, 7 Jun 2017 08:00:43 +0000 (11:00 +0300)]
i965: Drop redundant check for non-tiled depth buffer

Depth buffers are always Y-tiled. In brw_miptree_choose_tiling()
driver opts to use linear buffers for small and 1D but this does
not apply for depth - GL_DEPTH_COMPONENT and GL_DEPTH_STENCIL_EXT
are considered first.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agointel/isl/gen4: Represent cube maps with 3D layout
Topi Pohjolainen [Fri, 7 Jul 2017 05:40:50 +0000 (08:40 +0300)]
intel/isl/gen4: Represent cube maps with 3D layout

v2 (Jason): Check for !ISL_SURF_DIM_3D instead of CUBE_BIT.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/miptree: Prepare 3D surfaces with physical 2D layout
Topi Pohjolainen [Wed, 28 Jun 2017 09:56:27 +0000 (12:56 +0300)]
i965/miptree: Prepare 3D surfaces with physical 2D layout

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/miptree: Prepare aux state map for isl based
Topi Pohjolainen [Tue, 13 Jun 2017 18:30:45 +0000 (21:30 +0300)]
i965/miptree: Prepare aux state map for isl based

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/miptree: Represent y-tiled stencil copies with isl
Topi Pohjolainen [Thu, 27 Apr 2017 07:45:05 +0000 (10:45 +0300)]
i965/miptree: Represent y-tiled stencil copies with isl

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/miptree: Represent w-tiled stencil surfaces with isl
Topi Pohjolainen [Fri, 26 May 2017 08:36:38 +0000 (11:36 +0300)]
i965/miptree: Represent w-tiled stencil surfaces with isl

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/miptree: Prepare compressed offsets for isl based
Topi Pohjolainen [Mon, 3 Jul 2017 09:57:57 +0000 (12:57 +0300)]
i965/miptree: Prepare compressed offsets for isl based

v2 (Jason): Simply switch to isl_surf_get_image_offset_el()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/miptree: Add support for imported bo offsets for isl based
Topi Pohjolainen [Wed, 28 Jun 2017 05:56:26 +0000 (08:56 +0300)]
i965/miptree: Add support for imported bo offsets for isl based

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/fbo: Add support for isl-based miptrees in rb wrapper
Topi Pohjolainen [Sun, 4 Jun 2017 09:36:08 +0000 (12:36 +0300)]
i965/fbo: Add support for isl-based miptrees in rb wrapper

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Prepare image setup from miptree for isl based
Topi Pohjolainen [Thu, 22 Jun 2017 18:50:18 +0000 (21:50 +0300)]
i965: Prepare image setup from miptree for isl based

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Prepare tex, img and rt state emission for isl based miptrees
Topi Pohjolainen [Mon, 24 Apr 2017 14:41:51 +0000 (17:41 +0300)]
i965: Prepare tex, img and rt state emission for isl based miptrees

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Refactor miptree to isl converter and adjustment
Topi Pohjolainen [Mon, 24 Apr 2017 14:29:01 +0000 (17:29 +0300)]
i965: Refactor miptree to isl converter and adjustment

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Prepare tex (sub)image for isl based
Topi Pohjolainen [Thu, 22 Jun 2017 18:28:15 +0000 (21:28 +0300)]
i965: Prepare tex (sub)image for isl based

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/wm: Prepare image surfaces for isl based
Topi Pohjolainen [Thu, 22 Jun 2017 18:20:51 +0000 (21:20 +0300)]
i965/wm: Prepare image surfaces for isl based

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/wm: Fix number of layers in 3D images
Topi Pohjolainen [Wed, 19 Jul 2017 13:45:44 +0000 (16:45 +0300)]
i965/wm: Fix number of layers in 3D images

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/miptree: Prepare intel_miptree_copy() for isl based
Topi Pohjolainen [Thu, 22 Jun 2017 18:12:40 +0000 (21:12 +0300)]
i965/miptree: Prepare intel_miptree_copy() for isl based

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Prepare blit engine for isl based miptrees
Topi Pohjolainen [Thu, 22 Jun 2017 18:04:29 +0000 (21:04 +0300)]
i965: Prepare blit engine for isl based miptrees

v2: Do not concern cpp, pitch and tiling which are already
    transitioned.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/miptree: Store chars-per-pixel even for isl based
Topi Pohjolainen [Thu, 22 Jun 2017 17:56:47 +0000 (20:56 +0300)]
i965/miptree: Store chars-per-pixel even for isl based

This will significantly reduce chrun when switching remaaining
surface types to isl. After the full transition it will be easier
to calculate on-demand and drop the helper member in miptree.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/miptree: Switch to isl_surf::row_pitch
Topi Pohjolainen [Thu, 22 Jun 2017 12:54:04 +0000 (15:54 +0300)]
i965/miptree: Switch to isl_surf::row_pitch

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/miptree: Take interleaving into account in stencil pitch
Topi Pohjolainen [Wed, 19 Jul 2017 10:04:06 +0000 (13:04 +0300)]
i965/miptree: Take interleaving into account in stencil pitch

This makes intel_mipmap_tree::pitch and isl_surf::row_pitch
semantically equivalent.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/miptree: Switch to isl_surf::tiling
Topi Pohjolainen [Thu, 22 Jun 2017 12:17:41 +0000 (15:17 +0300)]
i965/miptree: Switch to isl_surf::tiling

v2 (Daniel): Use isl tiling converters instead of introducing local.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agointel/isl: Add i915 to isl_tiling converter
Topi Pohjolainen [Wed, 19 Jul 2017 17:35:29 +0000 (20:35 +0300)]
intel/isl: Add i915 to isl_tiling converter

v2: s/i915_tiling_to_isl_tiling(/isl_tiling_from_i915_tiling/

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/miptree: Use isl_tiling_to_i915_tiling()
Topi Pohjolainen [Wed, 19 Jul 2017 17:30:30 +0000 (20:30 +0300)]
i965/miptree: Use isl_tiling_to_i915_tiling()

and drop local copy.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/miptree: Switch to isl_surf::samples
Topi Pohjolainen [Thu, 22 Jun 2017 11:03:31 +0000 (14:03 +0300)]
i965/miptree: Switch to isl_surf::samples

v2 (Jason):
   - Don't trigger miptree re-creation in vain later on with ISL
     based. Core GL uses zero to indicate single sampled while
     ISL uses one - this would cause intel_miptree_match_image()
     to always fail.
   - Now that native miptree is already using sample number of
     one, there is no need for MAX2() when converting to ISL.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/miptree: Use num_samples of 1 instead of 0 for single-sampled
Topi Pohjolainen [Wed, 19 Jul 2017 06:25:19 +0000 (09:25 +0300)]
i965/miptree: Use num_samples of 1 instead of 0 for single-sampled

Patch moves "assert(brw->num_samples <= 16)" from
emit_3dstate_multisample2() to upload_multisample_state(). Latter
is the only caller of the former and passes "brw->num_samples"
as argument. Therefore it is clearer to assert in the caller.

Possible bug fix in genX(emit_3dstate_multisample2) which
doesn't have a case for num_samples == 0 in the switch
statement.

It should be noted that intel_miptree_map()/unmap() now checks
additionally for "mt->surf.samples == 1" in order to support gen6
stencil which is already transitioned to ISL. This will go away in
next patch when native miptrees start to use isl_surf::samples as
well.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/miptree: Switch to isl_surf::msaa_layout
Topi Pohjolainen [Thu, 22 Jun 2017 06:44:57 +0000 (09:44 +0300)]
i965/miptree: Switch to isl_surf::msaa_layout

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoradv: Add support for VK_KHR_variable_pointers.
Bas Nieuwenhuizen [Wed, 19 Jul 2017 21:55:58 +0000 (23:55 +0200)]
radv: Add support for VK_KHR_variable_pointers.

Just a trivial enable.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Add VK_KHR_storage_buffer_storage_class support.
Bas Nieuwenhuizen [Wed, 19 Jul 2017 21:33:59 +0000 (23:33 +0200)]
radv: Add VK_KHR_storage_buffer_storage_class support.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
6 years agomesa: check API profile for GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION
Brian Paul [Tue, 18 Jul 2017 20:19:04 +0000 (14:19 -0600)]
mesa: check API profile for GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION

If we have a compat profile context, it means that GL_QUADS[_STRIP] are
supported so this query makes sense.  It's also legal for 3.2 core profile
because of a spec bug.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agoradv: port to new libdrm API.
Dave Airlie [Wed, 19 Jul 2017 03:02:39 +0000 (04:02 +0100)]
radv: port to new libdrm API.

This bumps the libdrm requirement for amdgpu to the 2.4.82.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: introduce some wrapper in cs code to make porting off libdrm_amdgpu easier.
Dave Airlie [Wed, 19 Jul 2017 02:56:04 +0000 (03:56 +0100)]
radv: introduce some wrapper in cs code to make porting off libdrm_amdgpu easier.

This just introduces a central semaphore info struct, and passes it around,
and introduces some wrappers that will make porting off libdrm_amdgpu easier.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoconfigure/swr: add KNL and SKX architecture targets
Tim Rowley [Fri, 7 Jul 2017 18:58:09 +0000 (13:58 -0500)]
configure/swr: add KNL and SKX architecture targets

Not built by default.  Currently only builds with icc.

v2:
 * document knl,skx possibilities for swr_archs
 * merge with changed loader lib selection code

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoconfigure/swr: configurable swr architectures
Tim Rowley [Fri, 7 Jul 2017 18:38:22 +0000 (13:38 -0500)]
configure/swr: configurable swr architectures

Allow configuration of the SWR architecture depend libraries
we build for with --with-swr-archs.  Maintains current behavior
by defaulting to avx,avx2.

Scons changes made to make it still build and work, but
without the changes for configuring which architectures.

v2:
 * add missing comma for swr_archs default
 * check that at least one architecture is enabled
 * modify loader logic to make it clearer how to add archs

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agogallium/util: fix nondeterministic avx512 detection
Tim Rowley [Wed, 19 Jul 2017 19:18:49 +0000 (14:18 -0500)]
gallium/util: fix nondeterministic avx512 detection

cpuid.7 requires cx=0 to select the extended feature leaf.

avx512 detection was using the non-indexed cpuid resulting
in random non-detection of avx512.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agodrirc: whitelist War Thunder (Wine) for glthread
Marek Olšák [Wed, 19 Jul 2017 15:53:43 +0000 (11:53 -0400)]
drirc: whitelist War Thunder (Wine) for glthread

Nominated by František Zatloukal <zatloukal.frantisek@gmail.com>

6 years agotravis: add missing wayland-protocols
Andres Gomez [Wed, 19 Jul 2017 16:14:03 +0000 (19:14 +0300)]
travis: add missing wayland-protocols

> checking for WAYLAND... no
>
> configure: error: Package requirements (wayland-client >= 1.11 wayland-server >= 1.11 wayland-protocols >= 1.8) were not met:
>
> No package 'wayland-protocols' found
>
> Consider adjusting the PKG_CONFIG_PATH environment variable if you
> installed software in a non-standard prefix.
>
> Alternatively, you may set the environment variables WAYLAND_CFLAGS
> and WAYLAND_LIBS to avoid the need to call pkg-config.
> See the pkg-config man page for more details.

Also, added extra path to PKG_CONFIG_PATH env variable.

Fixes: 02cc359372 ("egl/wayland: Use linux-dmabuf interface for buffers")
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoanv/image: Fix VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT
Chad Versace [Mon, 17 Jul 2017 22:18:51 +0000 (15:18 -0700)]
anv/image: Fix VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT

We incorrectly detected VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT.  We looked
for the bit in VkImageCreateInfo::usage, but it's actually in
VkImageCreateInfo::flags.

Found by assertion failures while enabling VK_ANDROID_native_buffer.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agodocs: update master's release notes, news and calendar commit
Andres Gomez [Sat, 8 Jul 2017 19:59:41 +0000 (22:59 +0300)]
docs: update master's release notes, news and calendar commit

This reflects closer what we are actually doing.

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agodocs: avoid overwrite of LD_LIBRARY_PATH during basic testing
Andres Gomez [Sat, 8 Jul 2017 19:59:40 +0000 (22:59 +0300)]
docs: avoid overwrite of LD_LIBRARY_PATH during basic testing

The LD_LIBRARY_PATH environment variable could be already defined so
we extend it and restore it rather than just overwriting it.

v2:
 - Unset the __old_ld helper variable when we are done with it.
 - Corrected test for and escaping of variables (Eric).

v3: Remove unneeded variable (Emil).

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agodocs: add instructions to specify LLVM version for basic testing
Andres Gomez [Sat, 8 Jul 2017 19:59:38 +0000 (22:59 +0300)]
docs: add instructions to specify LLVM version for basic testing

The "Perform basic testing" and "Use the release.sh script from xorg
util-modular" sections provide some instructions to do so. We add now
some comments in order to use a recent enough LLVM version to run
dist/distcheck and the automake generated binaries.

v2: Suggested the need to define LLVM_CONFIG also before running the
    release.sh script.

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl: fix line continuation
Eric Engestrom [Wed, 19 Jul 2017 14:30:32 +0000 (15:30 +0100)]
egl: fix line continuation

Trailing space after the backslash meant the rest of the AM_CFLAGS lines
were no longer included.
This has been silently ignored because of the next line starting with
a `-` dash, instructing make to be silent about that line.

Fixes: 02cc359372773800de81 "egl/wayland: Use linux-dmabuf interface for buffers"
Cc: Daniel Stone <daniels@collabora.com>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agogbm: fix typo
Eric Engestrom [Wed, 19 Jul 2017 13:30:06 +0000 (14:30 +0100)]
gbm: fix typo

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoconfigure.ac: fix whitespace
Eric Engestrom [Wed, 19 Jul 2017 09:12:17 +0000 (10:12 +0100)]
configure.ac: fix whitespace

Whitespace-only change (`diff -w` is empty).

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoetnaviv: advertise supported dmabuf modifiers
Lucas Stach [Fri, 23 Jun 2017 14:22:43 +0000 (16:22 +0200)]
etnaviv: advertise supported dmabuf modifiers

Simply advertise all supported modifiers, independent of the format.
Special formats, like compressed, which don't support all those modifiers
are already culled from the dmabuf format list, as we don't support
the render target binding for them.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoetnaviv: implement resource creation with modifier
Lucas Stach [Thu, 22 Jun 2017 13:14:31 +0000 (15:14 +0200)]
etnaviv: implement resource creation with modifier

This allows to create buffers with a specific tiling layout, which is primarily
used by GBM to allocate the EGL back buffers with the correct tiling/modifier
for use with the scanout engines.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoetnaviv: fill in modifier in etna_resource_get_handle
Lucas Stach [Thu, 22 Jun 2017 11:56:24 +0000 (13:56 +0200)]
etnaviv: fill in modifier in etna_resource_get_handle

This allows the state trackers to know the tiling layout of the
resource and pass this through the various userspace protocols.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoetnaviv: fold etna_screen_bo_get_handle into etna_resource_get_handle
Lucas Stach [Thu, 22 Jun 2017 11:43:36 +0000 (13:43 +0200)]
etnaviv: fold etna_screen_bo_get_handle into etna_resource_get_handle

There is no point in keeping this indirection. Makes the code easier to
follow.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com> (v1)
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoetnaviv: implement resource import with modifier
Lucas Stach [Thu, 22 Jun 2017 10:49:17 +0000 (12:49 +0200)]
etnaviv: implement resource import with modifier

This implements resource import with modifier, deriving the correct
internal layout from the modifier and constructing a render compatible
base resource if needed.

This removes the special cases for DDX and renderonly scanout allocated
buffers, as the linear modifier is enough to trigger correct handling
of those buffers.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
6 years agoetnaviv: also update textures from external resources
Lucas Stach [Thu, 22 Jun 2017 14:02:10 +0000 (16:02 +0200)]
etnaviv: also update textures from external resources

This reworks the logic in etna_update_sampler_source to select the
newest resource view for updating the texture view. This should make
the logic easier to follow and fixes texture updates from imported
dma-bufs.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
6 years agoetnaviv: increment correct seqno for external resources
Lucas Stach [Thu, 22 Jun 2017 14:07:46 +0000 (16:07 +0200)]
etnaviv: increment correct seqno for external resources

If we import a dma-buf with a sampler/pixel pipe incompatible modifier,
the imported buffer will end up in an external resource view. As
resource_changed signals the change of the imported resource, we need
to update the external view seqno, instead of the base resource seqno.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
6 years agoetnaviv: pad scanout buffer size to RS alignment
Lucas Stach [Fri, 9 Jun 2017 16:44:46 +0000 (18:44 +0200)]
etnaviv: pad scanout buffer size to RS alignment

This fixes failures to import the scanout buffer with screen resolutions
that don't satisfy the RS alignment restrictions, like 1680x1050.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
6 years agoetnaviv: add helper to work out RS alignment
Lucas Stach [Tue, 4 Jul 2017 14:19:51 +0000 (16:19 +0200)]
etnaviv: add helper to work out RS alignment

The minimum RS alignment calculation is needed in various places.
Extract a helper to avoid open-coding the calcuation at every site.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
6 years agorenderonly/etnaviv: stop importing resource from renderonly
Lucas Stach [Fri, 9 Jun 2017 16:23:16 +0000 (18:23 +0200)]
renderonly/etnaviv: stop importing resource from renderonly

The current way of importing the resource from renderonly after allocation
is opaque and is taking away control from the driver, which it needs in
order to implement more advanced scenarios than the simple linear scanout
with matching stride alignments.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
6 years agoconfigure.ac: bump required etnaviv libdrm version to 2.4.82
Lucas Stach [Wed, 19 Jul 2017 12:37:54 +0000 (14:37 +0200)]
configure.ac: bump required etnaviv libdrm version to 2.4.82

The following changes need the modifier definitions for the Vivante tiled
formats, which are shipped with libdrm 2.4.82.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
6 years agodri/common: use designated initializers for OptConfElems
Emil Velikov [Tue, 18 Jul 2017 11:22:21 +0000 (12:22 +0100)]
dri/common: use designated initializers for OptConfElems

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agogallium: auxiliary: Fix standalone Android build of u_cpu_detect (v2)
Tomasz Figa [Tue, 18 Jul 2017 07:20:52 +0000 (16:20 +0900)]
gallium: auxiliary: Fix standalone Android build of u_cpu_detect (v2)

Commit 463b7d0332c5("gallium: Enable ARM NEON CPU detection.")
introduced CPU feature detection based Android cpufeatures library.
Unfortunately it also added an assumption that if PIPE_OS_ANDROID is
defined, the library is also available, which is not true for the
standalone build without using Android build system.

Fix it by defining HAS_ANDROID_CPUFEATURES in Android.mk and replacing
respective #ifdefs to use it instead.

v2:
 - Add a comment explaining why the separate flag is needed (Emil).

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl: propagate EGL_BAD_ATTRIBUTE during EGLImage attr parsing
Emil Velikov [Thu, 13 Jul 2017 19:04:33 +0000 (20:04 +0100)]
egl: propagate EGL_BAD_ATTRIBUTE during EGLImage attr parsing

Earlier commit refactored/split the parsing into separate hunks.
While no functional change was intended, it did not attribute that
different error is set when the attrib. value is incorrect.

Fixes: 3ee2be4113d ("egl: split _eglParseImageAttribList into per
extension functions")
Cc: Michel Dänzer <michel@daenzer.net>
Reported-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoswr: remove unneeded fallback strcasecmp define
Emil Velikov [Mon, 17 Jul 2017 14:34:14 +0000 (15:34 +0100)]
swr: remove unneeded fallback strcasecmp define

The last user of the function was removed with earlier commit.

Fixes: 50842e8a931 ("swr: replace gallium->swr format enum conversion")
Cc: Tim Rowley <timothy.o.rowley@intel.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
6 years agost/dri: list __DRI2_FENCE extension only where needed
Emil Velikov [Fri, 7 Jul 2017 18:41:29 +0000 (19:41 +0100)]
st/dri: list __DRI2_FENCE extension only where needed

The extension should be present (if applicable) in the list returned by
getExtensions(). AFAICT no loader has ever looked for it in
__driDriverExtensions/__driDriverGetExtensions.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoswrast: add dri2ConfigQueryExtension to the correct extension list
Emil Velikov [Fri, 7 Jul 2017 18:13:59 +0000 (19:13 +0100)]
swrast: add dri2ConfigQueryExtension to the correct extension list

The extension should be in the list as returned by getExtensions().
Seems to have gone unnoticed since close to nobody wants to change the
vblank mode for the software driver.

v2: Rebase

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
6 years agoradeon: remove local vblank_mode option
Emil Velikov [Fri, 7 Jul 2017 18:08:42 +0000 (19:08 +0100)]
radeon: remove local vblank_mode option

Analogous to previous commits.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoi915: remove local vblank_mode option
Emil Velikov [Fri, 7 Jul 2017 18:06:35 +0000 (19:06 +0100)]
i915: remove local vblank_mode option

Analogous to previous commit.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoi965: remove local vblank_mode option
Emil Velikov [Fri, 7 Jul 2017 17:43:35 +0000 (18:43 +0100)]
i965: remove local vblank_mode option

The option is only queried from the loader, which has access to the
dri common code in src/mesa/drivers/dri/common/.

One could grant the loader access to brw_config_options but even
then, having the same option in both places is not a good idea.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoegl/dri2: remove unused buffer_count variable
Gwan-gyeong Mun [Tue, 18 Jul 2017 08:12:26 +0000 (17:12 +0900)]
egl/dri2: remove unused buffer_count variable

It removes unused buffer_count variable from dri2_egl_surface.
And it polishes the assert of dri2_drm_get_buffers_with_format().

Signed-off-by: Mun Gwan-gyeong <elongbug@gmail.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl/drm: Format code in platform_drm.c according to style guide.
Gwan-gyeong Mun [Mon, 17 Jul 2017 15:21:32 +0000 (00:21 +0900)]
egl/drm: Format code in platform_drm.c according to style guide.

This is a tiny housekeeping patch which does the following:
  * Limit lines to 78 or fewer characters.
According to the mesa coding style guidelines.

Signed-off-by: Mun Gwan-gyeong <elongbug@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl/drm: add going out of the loop when the designated buffer is found
Gwan-gyeong Mun [Mon, 17 Jul 2017 15:03:14 +0000 (00:03 +0900)]
egl/drm: add going out of the loop when the designated buffer is found

Because the color_buffers have a each unique bo, if the designated buffer is
found, release_buffer() can go out the loop which seaches the buffer.

Signed-off-by: Mun Gwan-gyeong <elongbug@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agogbm: fix typo in doxygen comment
Gwan-gyeong Mun [Mon, 17 Jul 2017 14:01:27 +0000 (23:01 +0900)]
gbm: fix typo in doxygen comment

This fixes the misspelling of gbm_bo_import api param.

Signed-off-by: Mun Gwan-gyeong <elongbug@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl: Add MKDIR_GEN definition
Daniel Stone [Wed, 19 Jul 2017 08:51:23 +0000 (09:51 +0100)]
egl: Add MKDIR_GEN definition

Adding linux-dmabuf Wayland protocol files as generated did the right
thing, by prepending $(MKDIR_GEN) so autotools didn't try to write into
a build directory which didn't yet exist.

Unfortunately MKDIR_GEN needs to be defined in every Makefile it's used
in (which we do now), or alternately defined and substituted in
configure.ac (which we don't do), and src/egl/ didn't actually have it
from either method. As unset variables expand to nothing, it was
silently being skipped.

Copy & paste the defintion to make sure drivers/dri2/ exists before we
try to generate files into it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reported-by: Nick Sarnie <commendsarnex@gmail.com>
Reported-by: Mike Lothian <mike@fireburn.co.uk>
Fixes: 02cc35937277 ("egl/wayland: Use linux-dmabuf interface for buffers")
6 years agoutil: Make CLAMP turn NaN into MIN.
Kenneth Graunke [Thu, 13 Jul 2017 23:22:12 +0000 (16:22 -0700)]
util: Make CLAMP turn NaN into MIN.

The previous implementation of CLAMP() allowed NaN to pass through
unscathed, by failing both comparisons.  NaN isn't exactly a value
between MIN and MAX, which can break the assumptions of many callers.

This patch changes CLAMP to convert NaN to MIN, arbitrarily.  Callers
that need NaN to be handled in a specific manner should probably open
code something, or use a macro specifically designed to do that.

Section 2.3.4.1 of the OpenGL 4.5 spec says:

   "Any representable floating-point value is legal as input to a GL
    command that requires floating-point data. The result of providing a
    value that is not a floating-point number to such a command is
    unspecified, but must not lead to GL interruption or termination.
    In IEEE arithmetic, for example, providing a negative zero or a
    denormalized number to a GL command yields predictable results,
    while providing a NaN or an infinity yields unspecified results."

While CLAMP may apply to more than just GL inputs, it seems reasonable
to follow those rules, and allow MIN as an "unspecified result".

This prevents assertion failures in i965 when running the games
"XCOM: Enemy Unknown" and "XCOM: Enemy Within", which call

   glTexEnv(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT,
            -nan(0x7ffff3));

presumably unintentionally.  i965 clamps the LOD bias to be in range,
and asserts that it's in the proper range when converting to fixed
point.  NaN is not, so it crashed.  We'd like to at least avoid that.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agonir: Use nir_src_copy instead of direct assignments.
Kenneth Graunke [Tue, 18 Jul 2017 04:08:42 +0000 (21:08 -0700)]
nir: Use nir_src_copy instead of direct assignments.

If the source is an indirect register, there is ralloc'd data.  Copying
with a direct assignment will copy the pointer, but the data will still
belong to the old instruction's memory context.  Since we're lowering
and throwing away instructions, that could free the data by mistake.

Instead, use nir_src_copy, which properly handles this.

This is admittedly not a common case, so I think the bug is real,
but unlikely to be hit.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agoglsl: disable array splitting for AoA
Timothy Arceri [Thu, 25 May 2017 02:29:20 +0000 (12:29 +1000)]
glsl: disable array splitting for AoA

While it produces functioning code the pass creates worse code
for arrays of arrays. See the comment added in this patch for more
detail.

V2: skip splitting of AoA of matrices too.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agonir: fix nir_opt_copy_prop_vars() for arrays of arrays
Timothy Arceri [Fri, 30 Jun 2017 02:03:18 +0000 (12:03 +1000)]
nir: fix nir_opt_copy_prop_vars() for arrays of arrays

Previously we only incremented the guide for a single
dimension/wildcard.

V2: rework logic to avoid code duplication

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: mesa-stable@lists.freedesktop.org
6 years agonir/vars_to_ssa: Handle missing struct members in foreach_deref_node
Jason Ekstrand [Tue, 18 Jul 2017 23:50:39 +0000 (16:50 -0700)]
nir/vars_to_ssa: Handle missing struct members in foreach_deref_node

This can happen if, for instance, you have an array of structs and there
are both direct and wildcard references to the same struct and some
members only have direct or only have indirect.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Cc: mesa-stable@lists.freedesktop.org
6 years agoi965/blorp: Use the return value of brw_emit_reloc.
Kenneth Graunke [Sun, 23 Apr 2017 03:00:14 +0000 (20:00 -0700)]
i965/blorp: Use the return value of brw_emit_reloc.

This guarantees that the value written in the batch matches the
value recorded in the relocation entry.

(Chris Wilson wrote an identical patch as well.)