OSDN Git Service

android-x86/external-mesa.git
7 years agoandroid: support creating texture from gralloc buffer
WuZhen [Sat, 31 Dec 2016 09:57:11 +0000 (17:57 +0800)]
android: support creating texture from gralloc buffer

7 years agodrisw: support fence externsion and image extension
WuZhen [Sat, 31 Dec 2016 09:16:55 +0000 (17:16 +0800)]
drisw: support fence externsion and image extension

Adds a new type of winsys handle type that allows passing
a pointer sized handle to winsys.

7 years agoandroid: add Android.mk for llvmpipe
WuZhen [Sat, 31 Dec 2016 08:19:06 +0000 (16:19 +0800)]
android: add Android.mk for llvmpipe

This commit enables llvmpipe when using swrast on android.

7 years agoandroid: enable x86 asm and sse4 for x86 and x86_64
WuZhen [Wed, 24 Feb 2016 13:36:10 +0000 (21:36 +0800)]
android: enable x86 asm and sse4 for x86 and x86_64

Support multilib compilation use runtime feature selection.

NO_REF_TASK
Tested: local run

Change-Id: Iee7961effdecde09cfbdaf09455bfb0912699ae3
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
7 years agoandroid: re-generate git_sha1.h if HEAD updated
Chih-Wei Huang [Tue, 22 Nov 2016 05:08:30 +0000 (13:08 +0800)]
android: re-generate git_sha1.h if HEAD updated

The git HEAD may not be updated if we are on a named branch.
Check if HEAD is updated from git logs.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
7 years agoandroid: fix libz dynamic library dependencies
Mauro Rossi [Sat, 4 Mar 2017 14:36:55 +0000 (15:36 +0100)]
android: fix libz dynamic library dependencies

Fixes a series of libz related building errors:

target SharedLib: gallium_dri_32
(out/target/prod...SHARED_LIBRARIES/gallium_dri_intermediates/LINKED/gallium_dri.so)
external/elfutils/libelf/elf_compress.c:117: error: undefined reference to 'deflateInit_'
...
external/elfutils/libelf/elf_compress.c:244: error: undefined reference to 'inflateEnd'
clang++: error: linker command failed with exit code 1 (use -v to see
invocation)

7 years agoHACK: i915: enable image external sampling
Mauro Rossi [Tue, 1 Nov 2016 13:22:54 +0000 (14:22 +0100)]
HACK: i915: enable image external sampling

This hack is the alternative way of enabling GL_OES_EGL_image_external
as opposed to defining mesa environment variable in init.rc

As a reference this hack works on i915 also because of commit
"android: a workaround for GL_INVALID_OPERATION (0x502) error"
which allows for external image being mapped despited not being dma-buf

7 years agoi915: add mock implementation of GL_OES_EGL_image_external (v2)
Mauro Rossi [Tue, 1 Nov 2016 00:03:52 +0000 (01:03 +0100)]
i915: add mock implementation of GL_OES_EGL_image_external (v2)

This is similar to commit 7420c9dab4aaf87e6b840410226c296c4668a48f
but for the i915 driver, as neeeded in android-x86.

In version v2, as per i965 implementation,
the extension GL_OES_EGL_image_external is not enabled by default.

The by-the-book way to enable the extension is mesa environment variable
MESA_EXTENSION_OVERRIDE="+GL_OES_EGL_image_external" to be set in init.rc

7 years agoandroid: always define __STDC_CONSTANT_MACROS
Mauro Rossi [Fri, 15 Jan 2016 21:14:01 +0000 (22:14 +0100)]
android: always define __STDC_CONSTANT_MACROS

Android porting of commit 647d8e95d17b32100995d806b9b2a26a35541042
"configure.ac: always define __STDC_CONSTANT_MACROS"

7 years agoandroid: drop static linking of R600 LLVM libraries
Mauro Rossi [Wed, 4 Jan 2017 19:26:39 +0000 (20:26 +0100)]
android: drop static linking of R600 LLVM libraries

Inspired by Chih-Wei Huang and Zhen Wu similar patches

Linking against llvm with both static and shared may be avoided,
provided that libLLVM shared library for device supports
whole static R600/AMDGPU libraries, necessary for radeonsi/amdgpu.

Complementary changes, limited to android external/llvm project
are necessary to correclty build libLLVM

Tested with marshmallow-x86 and nougat-x86 builds

7 years agoandroid: mesa/st: fix libcxx/stlport dependency (v2)
Mauro Rossi [Mon, 2 Jan 2017 13:42:25 +0000 (14:42 +0100)]
android: mesa/st: fix libcxx/stlport dependency (v2)

Fixes the following building error with both libcxx and stlport:

target  C++: libmesa_st_mesa <= external/mesa/src/mesa/state_tracker/st_glsl_to_nir.cpp
external/mesa/src/mesa/state_tracker/st_glsl_to_tgsi.cpp:58:21: fatal error: algorithm: No such file or directory
compilation terminated.
build/core/binary.mk:432: recipe for target 'out/target/product/x86/obj/STATIC_LIBRARIES/libmesa_st_mesa_intermediates/state_tracker/st_glsl_to_tgsi.o' failed
make: *** [out/target/product/x86/obj/STATIC_LIBRARIES/libmesa_st_mesa_intermediates/state_tracker/st_glsl_to_tgsi.o] Error 1
make: *** Waiting for unfinished jobs....

(v1) was inspired by st/mesa part in Zhen Wu c278beb "android: fix building on lollipop"

(v2) Mauro: use 'LOCAL_C_INCLUDES += external/libcxx/include' and add stlport dependency for kitkat-x86
     Zhen: define LOCAL_CXX_STL := libc++

7 years agonv30 locking fixes
Ilia Mirkin [Wed, 22 Jun 2016 02:59:50 +0000 (22:59 -0400)]
nv30 locking fixes

7 years agonouveau: more locking - make sure that fence work is always done with
Ilia Mirkin [Tue, 7 Jun 2016 00:30:48 +0000 (20:30 -0400)]
nouveau: more locking - make sure that fence work is always done with
the push mutex acquired

7 years agoWIP nouveau: add locking
Ilia Mirkin [Sat, 4 Jun 2016 23:26:26 +0000 (19:26 -0400)]
WIP nouveau: add locking

7 years agovirgl: fix null pointer exceptions
Chih-Wei Huang [Sat, 28 May 2016 04:04:54 +0000 (12:04 +0800)]
virgl: fix null pointer exceptions

7 years agoandroid: change some PIPE to SVGA3D format mappings
Chih-Wei Huang [Fri, 18 Mar 2016 09:29:13 +0000 (17:29 +0800)]
android: change some PIPE to SVGA3D format mappings

This is a try-and-error patch which fixes the Android-x86 black screen
issue of VMware on Linux host. Tested OK on VMware Workstation 12 Player.
But the red and blue colors are exchanged.

Note it doesn't affect VMware on Windows host.

7 years agoandroid: clean gallium_dri_intermediates
Chih-Wei Huang [Tue, 16 Feb 2016 21:05:51 +0000 (05:05 +0800)]
android: clean gallium_dri_intermediates

Since BOARD_GPU_DRIVERS is updated, clean up gallium_dri to ensure
it is rebuilt correctly.

7 years agoandroid: re-generate git_sha1.h if git HEAD updated (v2)
Mauro Rossi [Mon, 2 Jan 2017 12:03:18 +0000 (13:03 +0100)]
android: re-generate git_sha1.h if git HEAD updated (v2)

Generated header git_sha1.h has to depend on the git HEAD
otherwise it will never be updated.

v2: use absolute path for --git-dir option, in order to support cases
when Android.gen.mk is invoked by other makefiles

7 years agoAndroid: enable texture-float
Rob Herring [Wed, 10 Feb 2016 18:09:14 +0000 (12:09 -0600)]
Android: enable texture-float

This is required by freedreno at least for GLES3 support.

See docs/patents.txt for information about turning this on for s/w
renderers.

Signed-off-by: Rob Herring <robh@kernel.org>
7 years agoegl/android: fix missing gralloc_drm_get_gem_handle dependency
Rob Herring [Mon, 25 Jan 2016 17:54:01 +0000 (11:54 -0600)]
egl/android: fix missing gralloc_drm_get_gem_handle dependency

gralloc_drm_get_gem_handle has been removed from AOSP drm_gralloc.
Remove the dependency on it and just access the struct
gralloc_drm_handle_t directly. Maybe there's a better way than accessing
the gralloc private data.

Signed-off-by: Rob Herring <robh@kernel.org>
7 years agoHACK: glsl: disable error on non-constant array indexing
Rob Herring [Fri, 8 Jan 2016 15:25:37 +0000 (09:25 -0600)]
HACK: glsl: disable error on non-constant array indexing

DRM HWC has a shader program that hits this error. Work-around it by
ignoring the error.

Signed-off-by: Rob Herring <robh@kernel.org>
7 years agogallium: introduce load_pipe_screen()
Rob Herring [Wed, 10 Feb 2016 22:56:56 +0000 (16:56 -0600)]
gallium: introduce load_pipe_screen()

Introduce load_pipe_screen() public entry point for other code which
dlopen()'s gralloc_dri.so for purposes of loading a pipe_screen. This way
drm_gralloc can avoid static linking of each gallium winsys and driver,
and avoid duplicated logic to figure out which pipe driver to load.

This is based on Rob Clark's work. I moved it into pipe_loader which seems
to be a better spot.

Signed-off-by: Rob Herring <robh@kernel.org>
7 years agoAndroid: Export gallium_dri include files
Rob Herring [Thu, 17 Dec 2015 14:18:33 +0000 (08:18 -0600)]
Android: Export gallium_dri include files

This doesn't work yet because the exported include files can't be picked
up by the android build system unless the library has a 'lib' prefix.

Signed-off-by: Rob Herring <robh@kernel.org>
7 years agoandroid: build with c++11 on android lollipop
Mauro Rossi [Sat, 22 Aug 2015 09:07:34 +0000 (11:07 +0200)]
android: build with c++11 on android lollipop

lollipop-x86 needs -std=c++11 (build with libcxx),
while kitkat-x86 cannot use -std=c++11

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
7 years agoandroid: a workaround for GL_INVALID_OPERATION (0x502) error
Chih-Wei Huang [Fri, 23 Jan 2015 19:53:48 +0000 (03:53 +0800)]
android: a workaround for GL_INVALID_OPERATION (0x502) error

Inspired by the nice work of Paulo Sergio (pstglia):

"Bypass a check for external target enabled only for images
created with EGL_EXT_image_dma_buf_import - this makes
Android graphical components receive a GL_INVALID_OPERATION (0x502)."

7 years agoi915: Support Android RGBX8888 format for EGL generated images
Sean V Kelley [Mon, 10 Sep 2012 18:52:35 +0000 (11:52 -0700)]
i915: Support Android RGBX8888 format for EGL generated images

Enabled MESA_FORMAT_R8G8B8X8_UNORM (formerly MESA_FORMAT_RGBX8888_REV)
for RGBX with i915.  Android software requires RGBX8888 format to be
supported for software rendering.

Previously had done so for i965 but have requests for i915 support.

Change-Id: I87c3a8e3f206d75d58b63182ed94851749740762
Signed-off-by: Sean V Kelley <sean.v.kelley@linux.intel.com>
7 years agoi915: enable GL_APPLE_texture_2D_limited_npot in mesa 11.1
Mauro Rossi [Mon, 4 Jan 2016 16:40:44 +0000 (17:40 +0100)]
i915: enable GL_APPLE_texture_2D_limited_npot in mesa 11.1

This is the port of Chia-I Wu commit 79ac0e to mesa 11.1 branch,
where the extensions went to a dedicated file extensions_table.h

Original commit message:

"Enable GL_ARB_texture_non_power_of_two for GLESv1 to advertise
GL_APPLE_texture_2D_limited_npo. The former is actually a superset of
the latter, but we really want to enable NPOT support in some way."

7 years agoandroid: advertise GL_ARB_texture_non_power_of_two in mesa 11.1
Mauro Rossi [Mon, 4 Jan 2016 16:37:39 +0000 (17:37 +0100)]
android: advertise GL_ARB_texture_non_power_of_two in mesa 11.1

This is the port of Chia-I Wu commit 62873a to mesa 11.1 branch,
where the extensions went to a dedicated file extensions_table.h

Original commit message:

"It maps to DisplayHardware::NPOT_EXTENSION in SurfaceFlinger. Does not
seem to matter when EGL_ANDROID_image_native_buffer is available."

7 years agodocs: add sha256 checksums for 17.0.2
Emil Velikov [Mon, 20 Mar 2017 14:17:20 +0000 (14:17 +0000)]
docs: add sha256 checksums for 17.0.2

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs: add release notes for 17.0.2
Emil Velikov [Mon, 20 Mar 2017 14:07:38 +0000 (14:07 +0000)]
docs: add release notes for 17.0.2

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoUpdate version to 17.0.2
Emil Velikov [Mon, 20 Mar 2017 14:02:15 +0000 (14:02 +0000)]
Update version to 17.0.2

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoRevert "radv: Emit cache flushes before CP DMA."
Bas Nieuwenhuizen [Wed, 15 Mar 2017 17:49:29 +0000 (18:49 +0100)]
Revert "radv: Emit cache flushes before CP DMA."

This reverts commit cce43f6d8c40222099badaf52344d6a0eed993f3.

Redundant, as the flush already happens at si_cp_dma_prepare.

Acked-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit ad4dee521d7968a88393dc3685e7c593d27efba5)

7 years agoradv/ac: Fix shared memory offset calculation
Alex Smith [Thu, 16 Mar 2017 16:40:07 +0000 (16:40 +0000)]
radv/ac: Fix shared memory offset calculation

The index passed to get_shared_memory_ptr is an attribute slot index,
i.e. the index of a vec4 within LDS. Therefore this must be scaled by
sizeof(vec4) to give the LDS byte offset.

Fixes: f4e499ec791 ("radv: add initial non-conformant radv vulkan driver")
Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
CC: <mesa-stable@lists.freedesktop.org>
(cherry picked from commit ce4058dafd2dd283addaa99e8d5b51e53f634f9b)

7 years agoradv: Fix using more than 4 bound descriptor sets
James Legg [Thu, 16 Mar 2017 17:48:13 +0000 (17:48 +0000)]
radv: Fix using more than 4 bound descriptor sets

Avoid a buffer overflow in ac_nir_to_llvm.c's create_function when
using more than 4 descriptor sets. radv claims support for 8.

Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
(cherry picked from commit e88cac1df03d01a9e8a1de1a4a2ee888149e727a)

7 years agoradeonsi: disable sinking common instructions down to the end block
Samuel Pitoiset [Tue, 14 Mar 2017 23:59:13 +0000 (00:59 +0100)]
radeonsi: disable sinking common instructions down to the end block

Initially this was a workaround for a bug introduced in LLVM 4.0
in the SimplifyCFG pass that caused image instrinsics to disappear
(because they were badly sunk). Finally, this is a win because it
decreases SGPR spilling and increases the number of waves a bit.

Although, shader-db results are good I think we might want to
remove it in the future once the issue is fixed. For now, enable
it for LLVM >= 4.0.

This also fixes a rendering issue with the speedometer in Dirt Rally.

More information can be found here https://reviews.llvm.org/D26348.

Thanks to Dave Airlie for the patch.

v2: - add a FIXME comment
    - use if (HAVE_LLVM >= 0x0400) instead

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99484
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97988
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 7751ed39e40e08e5aa0633d018c9f25ad17f9bb0)
[Emil Velikov: resolve trivial conflicts]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c

7 years agoradv: Flush before copying with PKT3_WRITE_DATA in CmdUpdateBuffer
Alex Smith [Tue, 14 Mar 2017 15:26:32 +0000 (15:26 +0000)]
radv: Flush before copying with PKT3_WRITE_DATA in CmdUpdateBuffer

Need to flush before updating the buffer to ensure that the copy is
ordered after previous accesses (assuming the app has performed the
appropriate barriers).

This fixes potential issues due to draws prior to an update reading
the new buffer content, despite having the necessary barriers between
them.

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit e0cc32b85bd8cf5c2202037838a208983e2d793a)

7 years agoradv: Emit cache flushes before CP DMA.
Bas Nieuwenhuizen [Tue, 14 Mar 2017 20:46:54 +0000 (21:46 +0100)]
radv: Emit cache flushes before CP DMA.

The flushes could be due to TRANSFER barriers.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit cce43f6d8c40222099badaf52344d6a0eed993f3)

7 years agonir/intrinsics: Make load_barycentric_input take a 2-component coor
Jason Ekstrand [Fri, 3 Mar 2017 01:39:11 +0000 (17:39 -0800)]
nir/intrinsics: Make load_barycentric_input take a 2-component coor

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Cc: "17.0 13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 60d1aac28a1f44ac166e72262e378e063155d6fd)

7 years agoanv/blorp: Only set a clear color for resolves if fast-cleared
Jason Ekstrand [Fri, 3 Mar 2017 07:03:03 +0000 (23:03 -0800)]
anv/blorp: Only set a clear color for resolves if fast-cleared

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 678fd00f2f5b213d0317ba51a8163c4c5bd1f3dc)

7 years agoanv/blorp: Turn off AUX after doing a CCS_D resolve
Jason Ekstrand [Fri, 10 Mar 2017 00:37:23 +0000 (16:37 -0800)]
anv/blorp: Turn off AUX after doing a CCS_D resolve

For render passes with multiple subpasses on gen7, we only fast-clear at
the top but an input attachment use can cause us to do a resolve in the
middle of the render pass.  Once we've done so, we are no longer have a
fast-cleared surface so we can just set aux_usage to NONE.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 273b720310863c2084c55f1371b2d27c2d96dbda)

7 years agoclover: Work around build failure with AltiVec.
Matt Turner [Thu, 2 Mar 2017 04:43:21 +0000 (04:43 +0000)]
clover: Work around build failure with AltiVec.

Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=587210
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68504
Acked-by: Francisco Jerez <currojerez@riseup.net>
(cherry picked from commit 7d1195c1e4d071fe796bf5f210c468ea1cc86225)

7 years agonvc0: increase alignment to 256 for texture buffers on fermi
Ilia Mirkin [Wed, 1 Mar 2017 16:09:30 +0000 (11:09 -0500)]
nvc0: increase alignment to 256 for texture buffers on fermi

When binding as textures, the alignment can be 16. However when binding
as an image, the address has to be aligned to 256. (Also when binding as
an RT, but that can't happen with GL or current gallium APIs.)

Reported-by: Roy Spliet <nouveau@spliet.org>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
(cherry picked from commit 32dd8d59b6d1b6828e16e854d589d0f04536da14)

7 years agoglapi: fix typo in count_scale
Gregory Hainaut [Mon, 6 Mar 2017 04:25:32 +0000 (15:25 +1100)]
glapi: fix typo in count_scale

 2*4=8

Signed-off-by: Gregory Hainaut <gregory.hainaut@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 2ab5eccf5de4a68d0d8d2668f6c5244cc6a41846)

7 years agovulkan/wsi: Improve the DRI3 error message
Jacob Lifshay [Wed, 1 Mar 2017 04:30:57 +0000 (20:30 -0800)]
vulkan/wsi: Improve the DRI3 error message

This commit improves the message by telling them that they could probably
enable DRI3.  More importantly, it includes a little heuristic to check
to see if we're running on AMD or NVIDIA's proprietary X11 drivers and,
if we are, doesn't emit the warning.  This way, users with both a discrete
card and Intel graphics don't get the warning when they're just running
on the discrete card.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99715
Co-authored-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Rene Lindsay <rjklindsay@hotmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Cc: "17.0" <mesa-dev@lists.freedesktop.org>
(cherry picked from commit 3d8feb38e8fdbc05b591164cb934b48a495adfbc)

7 years agoanv: Properly handle destroying NULL devices and instances
Jason Ekstrand [Wed, 1 Mar 2017 16:39:49 +0000 (08:39 -0800)]
anv: Properly handle destroying NULL devices and instances

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "17.0 13.0" <mesa-dev@lists.freedesktop.org>
(cherry picked from commit e3d33a23e6cbe2b73b412a56bb4fc4aa6852d081)

7 years agoanv/image: Remove extra dependency on HiZ-specific variable
Nanley Chery [Wed, 22 Feb 2017 02:17:59 +0000 (18:17 -0800)]
anv/image: Remove extra dependency on HiZ-specific variable

surf_usage is only useful to image views that may use HiZ buffers.
Storage image views don't use HiZ buffers.

v2: Update commit message and add an assertion.

Fixes: 055ff2ec521 ("anv: Replace anv_image_has_hiz() with ISL_AUX_USAGE_HIZ")
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit 258af3a856328934d30b7cdf626d5fdba76852f2)
[Emil Velikov: resolve trivial conflicts]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
src/intel/vulkan/anv_image.c

7 years agoradv: setup llvm target data layout
Dave Airlie [Mon, 13 Mar 2017 20:50:59 +0000 (06:50 +1000)]
radv: setup llvm target data layout

Ported from radeonsi, pointed out by Tom.

"This prevents LLVM from using sext instructions for local memory
offsets and allows the backend to fold immediate offsets into the
instruction. This also prevents some incorrect code generation for
ptrtoint and inttoptr instructions."

Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Tom Stellard <tstellar@redhat.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit b8ee70384adc3286d18febba7a92047118cc0f0f)
[Emil Velikov: resolve trivial conflicts]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
src/amd/common/ac_nir_to_llvm.c

7 years agoradeonsi: mark all bound shader buffer ranges as initialized
Marek Olšák [Mon, 6 Mar 2017 00:47:52 +0000 (01:47 +0100)]
radeonsi: mark all bound shader buffer ranges as initialized

This should prevent cases when a buffer was incorrectly mapped without
synchronization just because this wasn't done.

Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
(cherry picked from commit 71a2e4e9452a6890197f8b629b2d8359bdd58913)

7 years agoanv: Stall before fast-clear operations
Jason Ekstrand [Sat, 11 Mar 2017 07:00:49 +0000 (23:00 -0800)]
anv: Stall before fast-clear operations

During initial CCS bring-up, I discovered that you have to do a full CS
stall prior to doing a CCS resolve as well as afterwards.  It appears
that the same is needed for fast-clears as well.  This fixes rendering
corruptions on The Talos Principle on Sky Lake GT4.  The issue hasn't
been demonstrated on any other hardware however, given that this appears
to be a "too many things in the pipe" problem, having it be easier to
reproduce on a system with more EUs makes sense.  The issues with
resolves is demonstrable on a GT3 or GT2 so this is probably also a
problem on all GTs.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 6b644e571e2344691e4d58ff0bba3ddc059c1a5d)

7 years agoanv: Accurately advertise dynamic descriptor limits
Jason Ekstrand [Sat, 4 Mar 2017 18:52:43 +0000 (10:52 -0800)]
anv: Accurately advertise dynamic descriptor limits

The number of dynamic descriptors is limited by both the number of
descriptors and the total number of dynamic things.  Because there isn't
a single "maximum dynamic things" limit, we need to divide by two so
that they can create the maximum of both UBOs and SSBOs.

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Cc: "17.0 13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 5e44ef4a76d9a3681fb6be605319250d4ab800ee)

7 years agoi965: move brw_define.h ifndef guard to the top
Emil Velikov [Thu, 9 Mar 2017 00:38:21 +0000 (00:38 +0000)]
i965: move brw_define.h ifndef guard to the top

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit 077078ce77e8653725def01ed291eb486989a9ad)
[Emil Velikov: resolve trivial conflicts]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
src/mesa/drivers/dri/i965/brw_defines.h

7 years agoradv: disable mip point pre clamping.
Dave Airlie [Tue, 7 Mar 2017 05:08:42 +0000 (05:08 +0000)]
radv: disable mip point pre clamping.

No idea what this does, but disabling it fixes a bunch
of failing CTS tests in the lod area, so let's go with that.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit d81bd2f75462646d3803d683a28f6682a2ce3078)

7 years agoradv/ac: fix multiple descriptor sets with dynamic buffers
Fredrik Höglund [Tue, 7 Mar 2017 00:53:22 +0000 (01:53 +0100)]
radv/ac: fix multiple descriptor sets with dynamic buffers

The dynamic_offset_offset in the descriptor set binding layout is
relative to the dynamic_offset_start for the set in the pipeline
layout.

Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Fredrik Höglund <fredrik@kde.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
(cherry picked from commit 162beb2abbe6b81d81863b3ac88ec8effcbf7c9d)

7 years agoradv: fix the dynamic buffer index in vkCmdBindDescriptorSets
Fredrik Höglund [Tue, 7 Mar 2017 00:53:20 +0000 (01:53 +0100)]
radv: fix the dynamic buffer index in vkCmdBindDescriptorSets

This fixes the wrong dynamic buffer descriptors being updated when
firstSet > 0.

Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Fredrik Höglund <fredrik@kde.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
(cherry picked from commit 0941d1a574f46c558b0037be81d9a57004f4290b)

7 years agoradv: Disable HTILE for textures with multiple layers/levels.
Bas Nieuwenhuizen [Mon, 6 Mar 2017 22:23:57 +0000 (23:23 +0100)]
radv: Disable HTILE for textures with multiple layers/levels.

It has issues and the fix I'm working on is too complicated for stable,
so disable for now.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
CC: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 0ab2dd361fd80c3840b1547cb7e05b4361eaf928)

7 years agoradv: Emit pending flushes before executing a secondary command buffer
Alex Smith [Mon, 6 Mar 2017 14:54:28 +0000 (14:54 +0000)]
radv: Emit pending flushes before executing a secondary command buffer

If we have any pending flushes on the primary command buffer, these
must be performed before executing the secondary buffer.

This fixes potential corruption when the contents of a subpass which
clears any of its render targets are given in a secondary buffer: the
flushes after a fast clear would not have been performed until the
vkCmdEndRenderPass call.

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 290d7e892dfa6d04767142f4f6d7ec689933a105)

7 years agoradv: drop Z24 support.
Dave Airlie [Sun, 5 Mar 2017 23:26:16 +0000 (23:26 +0000)]
radv: drop Z24 support.

This isn't exposed in -pro, the hw docs say it is deprecated,
so let's not bother with it.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit cc59e24a6bc9bf8b51a22785beb07089770bec8d)

7 years agonvc0: take extra pushbuf space into account for pushbuf_space calls
Ilia Mirkin [Fri, 3 Mar 2017 01:18:24 +0000 (20:18 -0500)]
nvc0: take extra pushbuf space into account for pushbuf_space calls

See detailed explanation of why this is needed in commit eb60a89bc3a.
This spot was missed/overlooked. Basically as a result of the fact
that BEGIN_* ends up calling PUSH_SPACE, which in turn adds an extra 8
to the requested amount, we have to be mindful of that when doing bare
nouveau_pushbuf_space calls.

Reportedly this fixes some crashes when replaying a hitman trace taken
on radeonsi.

Fixes: eb60a89bc3a ("nouveau: take extra push space into account for pushbuf_space calls")
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
Reported-by: Karol Herbst <nouveau@karolherbst.de>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
(cherry picked from commit 8e6d67685e10b001e07f92a7a6aaff4fe987b6f2)

7 years agoanv/pass: Avoid accessing attachment array out of bounds
Nanley Chery [Mon, 27 Feb 2017 18:23:33 +0000 (10:23 -0800)]
anv/pass: Avoid accessing attachment array out of bounds

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit 178f9e5f29f3fe83eb5af99a69d7c583c30d21d1)

7 years agoralloc: Make sure ralloc() allocations match malloc()'s alignment.
Jonas Pfeil [Wed, 1 Mar 2017 17:11:10 +0000 (18:11 +0100)]
ralloc: Make sure ralloc() allocations match malloc()'s alignment.

The header of ralloc needs to be aligned, because the compiler assumes
that malloc returns will be aligned to 8/16 bytes depending on the
platform, leading to degraded performance or alignment faults with ralloc.

Fixes SIGBUS on Raspberry Pi at high optimization levels.

This patch is not perfect for MSVC, as maybe in the future the alignment
for the most demanding data type might change to more than 8.

v2: Commit message reword/typo fix, and add a bigger explanation in the
    code (by anholt)

Signed-off-by: Jonas Pfeil <pfeiljonas@gmx.de>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit cd2b55e536dc806f9358f71db438dd9c246cdb14)

Squashed with

ralloc: don't leave out the alignment factor

Experimentation shows that without alignment factor gcc and clang choose
a factor of 16 even on IA-32, which doesn't match what malloc() uses (8).
The problem is it makes gcc assume the pointer is 16 byte aligned, so
with -O3 it starts using aligned SSE instructions that later fault,
so always specify a suitable alignment factor.

Cc: Jonas Pfeil <pfeiljonas@gmx.de>
Fixes: cd2b55e5 "ralloc: Make sure ralloc() allocations match malloc()'s alignment."
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100049
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Tested by: Mike Lothian <mike@fireburn.co.uk>
Tested by: Jonas Pfeil <pfeiljonas@gmx.de>

(cherry picked from commit ff494fe999510ea40e3ed5827e7818550b6de126)

7 years agomesa: Avoid read of uninitialized variable
Robert Foss [Thu, 2 Mar 2017 00:14:39 +0000 (19:14 -0500)]
mesa: Avoid read of uninitialized variable

The is_color_attachement variable is later read when handling two
separate error cases, where only one of the cases results in the
variable being initialized.

This can be avoided by giving the variable a safe default value.

Coverity-Id: 1398631
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 88becf73022d780cfd0d7dbc5bb3911f8b0d2b11)

7 years agoegl: Ensure ResetNotificationStrategy matches for shared contexts.
Kenneth Graunke [Wed, 1 Mar 2017 01:20:52 +0000 (17:20 -0800)]
egl: Ensure ResetNotificationStrategy matches for shared contexts.

Fixes:
dEQP-EGL.functional.robustness.negative_context.invalid_robust_shared_context_creation

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit 4061bbccf2ad81612afbf8c3ded58c3b7146c5b2)

7 years agost/mesa: inform the driver of framebuffer changes before compute dispatches
Nicolai Hähnle [Wed, 22 Feb 2017 18:59:06 +0000 (19:59 +0100)]
st/mesa: inform the driver of framebuffer changes before compute dispatches

Even though compute shaders cannot access the framebuffer, there is a
synchronization issue when a compute dispatch accesses a texture that
was previously bound and drawn to as a framebuffer.

Section 9.3 (Feedback Loops Between Textures and the Framebuffer) of
the OpenGL 4.5 spec rather implicitly clarifies that undefined behavior
results if the texture is still attached to the currently bound
framebuffer. However, the feedback loop is broken when the application
changes the framebuffer binding before a compute dispatch, and the
state tracker needs to let the driver known about this.

Fixes GL45-CTS.compute_shader.pipeline-post-fs on SI family Radeons.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 40c77bbf83a369f21c5a95f14417348aae2dbe42)

7 years agost/glsl_to_tgsi: avoid iterating past the head of the instruction list
Nicolai Hähnle [Wed, 22 Feb 2017 19:04:39 +0000 (20:04 +0100)]
st/glsl_to_tgsi: avoid iterating past the head of the instruction list

exec_node::get_prev() does not guard against going past the beginning
of the list, so we need to add explicit checks here.

Found by ASAN in piglit arb_shader_storage_buffer_object-rendering.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 911391bd70fe30ad970c5e56632b2d7ccc29d955)

7 years agoi965/fs: emit MOV_INDIRECT with the source with the right register type
Samuel Iglesias Gonsálvez [Mon, 13 Feb 2017 11:09:53 +0000 (12:09 +0100)]
i965/fs: emit MOV_INDIRECT with the source with the right register type

This was hiding bugs as it retyped the source to destination's type.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
(cherry picked from commit 0dddad5b1bb3b05190074a71d274c04c0b5ea700)

7 years agoi965/fs: fix source type when emitting MOV_INDIRECT to read ICP handles
Samuel Iglesias Gonsálvez [Thu, 16 Feb 2017 09:47:01 +0000 (10:47 +0100)]
i965/fs: fix source type when emitting MOV_INDIRECT to read ICP handles

When generating the MOV INDIRECT instruction, the source type is ignored
and it is set to destination's type. However, this is going to change in a
later patch, so we need to explicitly set the proper source type.

brw_vec8_grf() creates an float type's fs_reg by default, when the
ICP handle is actually unsigned. This patch fixes these cases before
applying the aforementioned patch.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
(cherry picked from commit d8122128bc6bd291ff0abcb7f2e52d9cdc631527)

7 years agoi965/fs: fix indirect load DF uniforms on BSW/BXT
Samuel Iglesias Gonsálvez [Mon, 13 Feb 2017 12:24:18 +0000 (13:24 +0100)]
i965/fs: fix indirect load DF uniforms on BSW/BXT

The lowered BSW/BXT indirect move instructions had incorrect
source types, which luckily wasn't causing incorrect assembly to be
generated due to the bug fixed in the next patch, but would have
confused the remaining back-end IR infrastructure due to the mismatch
between the IR source types and the emitted machine code.

v2:
- Improve commit log (Curro)
- Fix read_size (Curro)
- Fix DF uniform array detection in assign_constant_locations() when
  it is acceded with 32-bit MOV_INDIRECTs in BSW/BXT.

v3:
- Move changes in assign_constant_locations() to other patch.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
(cherry picked from commit 56266df7ed9dbdf63acfd58944442893b4cd0c0b)

7 years agoi965/fs: detect different bit size accesses to uniforms to push them in proper locations
Samuel Iglesias Gonsálvez [Mon, 20 Feb 2017 10:03:46 +0000 (11:03 +0100)]
i965/fs: detect different bit size accesses to uniforms to push them in proper locations

Previously, if we had accesses with different sizes to the same uniform, we might not
push it aligned with the bigger one. This is a problem in BSW/BXT when we access
an array of DF uniform with both direct and indirect addressing because for the latter
we use 32-bit MOV INDIRECT instructions. However this problem can happen with other
generations and bitsizes.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
(cherry picked from commit a497ab6838ae5a9898abfed82f7bc8295b490911)

7 years agoi965/fs: mark last DF uniform array element as 64 bit live one
Samuel Iglesias Gonsálvez [Tue, 21 Feb 2017 07:27:30 +0000 (08:27 +0100)]
i965/fs: mark last DF uniform array element as 64 bit live one

This bug can make that we don't detect the end of a contiguous area
correctly and push larger areas than the real ones.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
(cherry picked from commit 7427425247d80c9f59a3c3ad2dfeeb2429de6f67)

7 years agost/mesa: set blend state for PBO readbacks
Marek Olšák [Wed, 22 Feb 2017 20:39:55 +0000 (21:39 +0100)]
st/mesa: set blend state for PBO readbacks

v2: restore the state

Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit cc2f92b09f8ab0470106185585fdc1282da523e6)

7 years agost/mesa: reset sample_mask, min_sample, and render_condition for PBO ops
Marek Olšák [Wed, 22 Feb 2017 23:30:49 +0000 (00:30 +0100)]
st/mesa: reset sample_mask, min_sample, and render_condition for PBO ops

Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit a40b76143d8b929412bed6fbed04810902844c40)

7 years agoanv/blorp/clear_subpass: Only set surface clear color for fast clears
Jason Ekstrand [Wed, 22 Feb 2017 02:28:38 +0000 (18:28 -0800)]
anv/blorp/clear_subpass: Only set surface clear color for fast clears

Not all clear colors are valid.  In particular, on Broadwell and
earlier, only 0/1 colors are allowed in surface state.  No CTS tests are
affected outright by this because, apparently, the CTS coverage for
different clear colors is pretty terrible.  However, when multisample
compression is enabled, we do hit it with CTS tests and this commit
prevents regressions when enabling MCS on Broadwell and earlier.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 42b10b175d5e8dfb9c4c46edbc306e7fac6bd3ec)

7 years agocherry-ignore: add the swizzle blorp_clear fix
Emil Velikov [Wed, 15 Mar 2017 18:53:24 +0000 (18:53 +0000)]
cherry-ignore: add the swizzle blorp_clear fix

Addressed an earlier commit [ccdd5b3738e] which did not land in
branch.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs: add sha256 checksums for 17.0.1
Emil Velikov [Sat, 4 Mar 2017 15:53:51 +0000 (15:53 +0000)]
docs: add sha256 checksums for 17.0.1

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs: add release notes for 17.0.1
Emil Velikov [Sat, 4 Mar 2017 15:44:59 +0000 (15:44 +0000)]
docs: add release notes for 17.0.1

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoUpdate version to 17.0.1
Emil Velikov [Sat, 4 Mar 2017 15:32:34 +0000 (15:32 +0000)]
Update version to 17.0.1

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl/wayland: Don't use DRM format codes for SHM
Daniel Stone [Mon, 13 Feb 2017 14:06:10 +0000 (14:06 +0000)]
egl/wayland: Don't use DRM format codes for SHM

The wl_drm interface (akin to X11's DRI2) uses the standard set of DRM
FourCC format codes. wl_shm copies this, except for ARGB8888/XRGB8888,
which use their own definitions.

Make sure we only use wl_shm format codes when we're working with
wl_shm. Otherwise, using swrast with 32bpp formats would fail with an
error.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Daniel Stone <daniels@collabora.com> (v1)
Fixes: cb5e799448 ("egl/wayland: unify dri2_wl_create_surface implementations")

v2: [Emil Velikov: move to dri2_wl_create_window_surface]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com> (IRC)
(cherry picked from commit a1727aa75ed252cd19c296ccf83cb595be971744)

7 years agoconfigure.ac: Drop LLVM compiler flags more radically
Michel Dänzer [Thu, 9 Feb 2017 04:00:03 +0000 (13:00 +0900)]
configure.ac: Drop LLVM compiler flags more radically

Drop all -m*, -W*, -O*, -g* and -f* flags, with the exception of
-fno-rtti, which must be used if it's part of the llvm-config --cxxflags
output. We don't want LLVM to dictate the flags we use, and it can even
cause build failures, e.g. if LLVM and Mesa are built with different
compilers.

While we're at it, eat any whitespace preceding dropped flags as well.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 0f53404565b9ef9da9d7022b5732463acd496742)
Nominated-by: Marek Olšák <marek.olsak@amd.com>
Bugzilla: https://bugs.freedesktop.org/100028

7 years agogallium/u_queue: set num_threads correctly if not all threads start
Grazvydas Ignotas [Sun, 26 Feb 2017 00:44:07 +0000 (02:44 +0200)]
gallium/u_queue: set num_threads correctly if not all threads start

If i-th thread could not be created it means we have i threads,
not i+1, because we start from 0.

Fixes: 404d0d5 "gallium/u_queue: add an option to have multiple worker threads"
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 7f268cf12b39d1de8ff38cf5beea50298cf841c2)

7 years agogallium/u_queue: fix a crash with atexit handlers
Grazvydas Ignotas [Sun, 26 Feb 2017 00:44:06 +0000 (02:44 +0200)]
gallium/u_queue: fix a crash with atexit handlers

Commit 4aea8fe ("gallium/u_queue: fix random crashes when the app calls
exit()") added a atexit handler which calls
util_queue_killall_and_wait() for each queue to stop the threads.
However the app is also free to use atexit handlers to clean up things,
leading to util_queue_destroy() call which will also call
util_queue_killall_and_wait() for the same queue again, causing threads
being joined twice, and that is undefined. This happens with libglut,
for example. A simple fix is to just set num_threads to 0 as there are
no more valid threads after util_queue_killall_and_wait() returns.

Fixes: 4aea8fe "gallium/u_queue: fix random crashes when the app calls exit()"
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 993612193575f5f218af52c4ed7525e15083548e)

7 years agoradv: fix txs for sampler buffers
Dave Airlie [Tue, 28 Feb 2017 06:26:55 +0000 (16:26 +1000)]
radv: fix txs for sampler buffers

I messed this up when I wrote it, this fixes:
dEQP-VK.memory.pipeline_barrier.*uniform_texel_buffer.*

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit e66be3d3bb40160c7b7d57c596e4a25da168f1e6)

7 years agoamd/common: fix ASICREV_IS_POLARIS11_M for Polaris12
Marek Olšák [Tue, 28 Feb 2017 19:06:48 +0000 (20:06 +0100)]
amd/common: fix ASICREV_IS_POLARIS11_M for Polaris12

Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 8c838730d070cbf4da035593b374e3c5566cf944)

7 years agoegl/dri3: implement query surface hook
Brendan King [Fri, 17 Feb 2017 15:12:21 +0000 (15:12 +0000)]
egl/dri3: implement query surface hook

This is a DRI3 version of a change made for DRI2
(4d6d4f939e0af4252e0b, "egl/dri2: implement query surface hook"),
that fixed failures in dEQP-EGL.functional.resize.surface_size.grow
and dEQP-EGL.functional.resize.surface_size.shrink.

Cc: Tapani Pälli <tapani.palli@intel.com>
Cc: Mark Janes <mark.a.janes@intel.com>
Cc: Chad Versace <chadversary@chromium.org>
Signed-off-by: Brendan King <Brendan.King@imgtec.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 884f65e1856733697a894c86f94803343cfa9a21)

7 years agoradv: fix depth format in blit2d.
Dave Airlie [Mon, 27 Feb 2017 06:59:06 +0000 (16:59 +1000)]
radv: fix depth format in blit2d.

For blitting we need to use the depth or stencil format, never
the combined.

This fixes:
dEQP-VK.texture.shadow.2d.nearest.less_or_equal_d32_sfloat_s8_uint
and a few others.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 800b82ea1315d68fccd8b1f218d614d26e7b6478)

7 years agoradv: Use correct size for availability flag.
Bas Nieuwenhuizen [Sun, 26 Feb 2017 21:36:10 +0000 (22:36 +0100)]
radv: Use correct size for availability flag.

Per spec, VK_QUERY_RESULT_64_BIT specifies the integer size and the
availability flag is an integer. We apparently handled this correctly
already for the copy to buffer case.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 43d833ae97daa73a2422b5696b587a7b46750e07)

7 years agoradv: Only use PKT3_OCCLUSION_QUERY when it doesn't hang.
Bas Nieuwenhuizen [Sun, 26 Feb 2017 21:26:30 +0000 (22:26 +0100)]
radv: Only use PKT3_OCCLUSION_QUERY when it doesn't hang.

PKT3_OCCLUSION_QUERY hangs when used in a nested IB. This only
calls it when in a primary command buffer and we change
GetQueryPoolResults to not need it. CmdCopyQueryPoolResults
still needs it so we break that behavior for secondary command buffers.
However, that would hang already and using an unitialized value is
better than a hang.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 8ea34a98c06af4e3ce00ea665ee07480bcbd199f)

7 years agoradv: Reset emitted compute pipeline when calling secondary cmd buffer.
Bas Nieuwenhuizen [Sun, 26 Feb 2017 19:01:26 +0000 (20:01 +0100)]
radv: Reset emitted compute pipeline when calling secondary cmd buffer.

Otherwise if the new compute pipeline is the same as the last used
pipeline before the call, we don't emit it again.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit bb878db7eb94e48476a920d66174a45da2585e19)

7 years agoradeonsi: fix broken tessellation on Carrizo and Stoney
Marek Olšák [Wed, 22 Feb 2017 18:56:26 +0000 (19:56 +0100)]
radeonsi: fix broken tessellation on Carrizo and Stoney

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99850

Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 35915af6c9ab4bdc0f1f8584ca346602405bd7e4)

7 years agoconfigure.ac: check require_basic_egl only if egl enabled
Leo Liu [Thu, 23 Feb 2017 18:37:58 +0000 (13:37 -0500)]
configure.ac: check require_basic_egl only if egl enabled

Otherwise the configuration fails when building independant libs
like vdpau, vaapi or omx

Fixes: 1ac40173c2a ("configure.ac: simplify EGL requirements for
drivers dependent on EGL")

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 5398d006de3d2bd668e3fc4b80a3de0c101a3e43)
[Emil Velikov: resolve trivial conflicts]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
configure.ac

7 years agor300g: only allow byteswapped formats on big endian
Grazvydas Ignotas [Fri, 10 Feb 2017 23:01:40 +0000 (01:01 +0200)]
r300g: only allow byteswapped formats on big endian

They cause regressions on little endian.

Fixes: 172bfdaa9e ("r300g: add support for PIPE_FORMAT_x8R8G8B8_*")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98869
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 66d1cb587ac7b24fb04f26d30e686c3991fc8885)

7 years agoandroid: glsl: build shader cache sources
Mauro Rossi [Sat, 18 Feb 2017 21:23:18 +0000 (22:23 +0100)]
android: glsl: build shader cache sources

Fixes the following building errors:

external/mesa/src/compiler/glsl/linker.cpp:4642: error: undefined reference
 to 'shader_cache_read_program_metadata(gl_context*, gl_shader_program*)'
external/mesa/src/mesa/program/ir_to_mesa.cpp:3135: error: undefined reference
 to 'shader_cache_write_program_metadata(gl_context*, gl_shader_program*)'
clang++: error: linker command failed with exit code 1
...
external/mesa/src/mesa/program/ir_to_mesa.cpp:3135: error: undefined reference
 to 'shader_cache_write_program_metadata(gl_context*, gl_shader_program*)'
external/mesa/src/compiler/glsl/linker.cpp:4642: error: undefined reference
 to 'shader_cache_read_program_metadata(gl_context*, gl_shader_program*)'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1

Fixes: 9f8dc3bf03e ("utils: build sha1/disk cache only with
Android/Autoconf")
Acked-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 9e3d66c1e58f14d9c5e8df2a5ba7fdcf04b3258e)

7 years agoandroid: radeonsi: fix sid_table.h generated header include path
Mauro Rossi [Wed, 8 Feb 2017 07:14:05 +0000 (08:14 +0100)]
android: radeonsi: fix sid_table.h generated header include path

generated-sources-dir-for macro replaces intermediates-dir-for
and LOCAL_MODULE_CLASS is defined as required by new macro,
in order to avoid the following building error:

external/mesa/src/gallium/drivers/radeonsi/si_debug.c:29:10: fatal error: 'sid_tables.h' file not found
         ^
1 error generated.

Fixes: 730574c58e8 ("android: ac/debug: move sid_tables.h generation and
IB decode to amd/common")
Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 933988901ab14b3c950272b60a56cb48265076b0)

7 years agoandroid: fix droid_create_image_from_prime_fd_yuv for YV12
Tapani Pälli [Thu, 2 Feb 2017 12:05:46 +0000 (14:05 +0200)]
android: fix droid_create_image_from_prime_fd_yuv for YV12

Earlier changes introduced is_ycrcb flag which checks the component
order of u and v components. Condition for setting the flag was
incorrect, with ycrcb we are supposed to have cr before cb.

This patch (together with a fix in our gralloc) fixes corrupted
rendering from 'test-opengl-gl2_yuvtex' native test and corrupted
gallery thumbnail in application switcher on Android-IA.

Fixes: 51727b1cf57e8c4630767eb9ead207b102ffa489
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
(cherry picked from commit 0a2dcd3a8ac4bf18cd6ec2f778c9ef859ef90a51)

7 years agoglsl: fix heap-use-after-free in ast_declarator_list::hir()
Samuel Iglesias Gonsálvez [Thu, 9 Feb 2017 12:54:46 +0000 (13:54 +0100)]
glsl: fix heap-use-after-free in ast_declarator_list::hir()

The get_variable_being_redeclared() function can free 'var' because
a re-declaration of an unsized array variable can establish the size, so
we set the array type to the 'earlier' declaration and free 'var' as it is
not needed anymore.

However, the same 'var' is referenced later in ast_declarator_list::hir().

This patch fixes it by picking the ir_variable_mode from the proper
ir_variable.

This error was detected by Address Sanitizer.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Suggested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99677
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit a73a61893323c74f38b1baa30d63a5cc665b7b58)

7 years agogallium/u_queue: fix random crashes when the app calls exit()
Marek Olšák [Mon, 20 Feb 2017 14:27:07 +0000 (15:27 +0100)]
gallium/u_queue: fix random crashes when the app calls exit()

This fixes:
    vdpauinfo: ../lib/CodeGen/TargetPassConfig.cpp:579: virtual void
    llvm::TargetPassConfig::addMachinePasses(): Assertion `TPI && IPI &&
    "Pass ID not registered!"' failed.

v2: use list_head, switch the call order in destroy

Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit 4aea8fe7e01f2b65ffad3982687f90c8fa941524)

7 years agointel/blorp: Explicitly flush all allocated state
Jason Ekstrand [Mon, 20 Feb 2017 19:03:04 +0000 (11:03 -0800)]
intel/blorp: Explicitly flush all allocated state

Found by inspection.  However, I expect it fixes real bugs when using
blorp from Vulkan on little-core platforms.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 075ed20614e91110322aadff44dbd4c1ca2422e8)

7 years agoanv/query: Perform CmdResetQueryPool on the GPU
Jason Ekstrand [Sat, 18 Feb 2017 23:21:04 +0000 (15:21 -0800)]
anv/query: Perform CmdResetQueryPool on the GPU

This fixes a some rendering corruption in The Talos Principle

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 40087bcb517bda60e666428a7a8f85dfdcbd9a56)

7 years agogenxml: Make MI_STORE_DATA_IMM more consistent
Jason Ekstrand [Sat, 18 Feb 2017 23:18:31 +0000 (15:18 -0800)]
genxml: Make MI_STORE_DATA_IMM more consistent

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit dc9abd0e6b448292c025ed1024fcaa8ef1a4edaa)

7 years agoanv/query: clflush the bo map on non-LLC platforms
Jason Ekstrand [Sat, 18 Feb 2017 21:25:04 +0000 (13:25 -0800)]
anv/query: clflush the bo map on non-LLC platforms

Found by inspection

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 3788cd32391d6d7eea3af3c40f952325caea5360)

7 years agoanv: Add an invalidate_range helper
Jason Ekstrand [Mon, 20 Feb 2017 18:18:57 +0000 (10:18 -0800)]
anv: Add an invalidate_range helper

This is similar to clflush_range except that it puts the mfence on the
other side to ensure caches are flushed prior to reading.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 8582ab2d6eff1d8fc1964ba0f353037af212bdfe)