OSDN Git Service

android-x86/external-mesa.git
7 years agoloader: fix memory leak in loader_dri3_open
Jan Ziak [Sat, 30 Jul 2016 00:31:10 +0000 (02:31 +0200)]
loader: fix memory leak in loader_dri3_open

Found via "valgrind --leak-check=full glxgears".

Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0x9b@gmail.com>
Acked-by: Boyan Ding <boyan.j.ding@gmail.com>
Cc: "12.0 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit fd32868590c7cbc5c6c2b3d59ff66694de3864b8)

7 years agogallium/util: fix align64
Marek Olšák [Fri, 29 Jul 2016 13:00:12 +0000 (15:00 +0200)]
gallium/util: fix align64

it cut off the upper 32 bits

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
(cherry picked from commit 6db93cd167d3ae04688c192806aad54a05a9d161)

7 years agoegl/dri2: Add reference count for dri2_egl_display
Nicolas Boichat [Fri, 22 Jul 2016 03:27:41 +0000 (11:27 +0800)]
egl/dri2: Add reference count for dri2_egl_display

android.opengl.cts.WrapperTest#testGetIntegerv1 CTS test calls
eglTerminate, followed by eglReleaseThread. A similar case is
observed in this bug: https://bugs.freedesktop.org/show_bug.cgi?id=69622,
where the test calls eglTerminate, then eglMakeCurrent(dpy, NULL, NULL, NULL).

With the current code, dri2_dpy structure is freed on eglTerminate
call, so the display is not initialized when eglReleaseThread calls
MakeCurrent with NULL parameters, to unbind the context, which
causes a a segfault in drv->API.MakeCurrent (dri2_make_current),
either in glFlush or in a latter call.

eglTerminate specifies that "If contexts or surfaces associated
with display is current to any thread, they are not released until
they are no longer current as a result of eglMakeCurrent."

However, to properly free the current context/surface (i.e., call
glFlush, unbindContext, driDestroyContext), we still need the
display vtbl (and possibly an active dri dpy connection). Therefore,
we add some reference counter to dri2_egl_display, to make sure
the structure is kept allocated as long as it is required.

One drawback of this is that eglInitialize may not completely reinitialize
the display (if eglTerminate was called with a current context), however,
this seems to meet the EGL spec quite well, and does not permanently
leak any context/display even for incorrectly written apps.

Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 9ee683f877b283020c6f24776236f1145cb7a4ea)

Squashed with commit

egl/dri2: dri2_make_current: Release previous context's display

eglMakeCurrent can also be used to change the active display. In that
case, we need to decrement ref_count of the previous display (possibly
destroying it), and increment it on the next display.

Also, old_dsurf/old_rsurf cannot be non-NULL if old_ctx is NULL, so
we only need to test if old_ctx is non-NULL.

v2: Save the old display before destroying the context.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97214
Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Reported-by: Alexandr Zelinsky <mexahotabop@w1l.ru>
Tested-by: Alexandr Zelinsky <mexahotabop@w1l.ru>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
(cherry picked from commit 78e3cea4197802253401766fc44362786898e024)

Squashed with commit

egl/dri2: dri2_initialize: Do not reference-count TestOnly display

In the case where dri2_initialize is called with a TestOnly display,
the display is not actually initialized, so dri2_egl_display always
fails, and we cannot do any reference counting.

Fixes piglit spec@egl_khr_create_context@verify gl flavor (reproducible
with LIBGL_ALWAYS_SOFTWARE=1).

Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Reported-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 4f3f8bb59dd98e39c363fe47a55a7f97e7df9f4b)

7 years agoegl/android: Set dpy->DriverData to NULL on error
Nicolas Boichat [Thu, 4 Aug 2016 02:07:54 +0000 (10:07 +0800)]
egl/android: Set dpy->DriverData to NULL on error

Avoid use-after-free on error.

Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit c0580f6a3859ec373ed11b3a6266c9b94d01a343)

7 years agoegl/drm: Set disp->DriverData to NULL on error
Nicolas Boichat [Thu, 4 Aug 2016 02:07:53 +0000 (10:07 +0800)]
egl/drm: Set disp->DriverData to NULL on error

Avoid use-after-free on error.

Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit a9e8fb73977beaa407b72c4843e75db3b186ea09)

7 years agoegl/surfaceless: Set disp->DriverData to NULL on error
Nicolas Boichat [Thu, 4 Aug 2016 02:07:52 +0000 (10:07 +0800)]
egl/surfaceless: Set disp->DriverData to NULL on error

Avoid use-after-free on error.

Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 0e67d86540cb5f6bedffe4ff5dfcb1070e76b28b)

7 years agoegl/wayland: Set disp->DriverData to NULL on error
Nicolas Boichat [Thu, 4 Aug 2016 02:07:51 +0000 (10:07 +0800)]
egl/wayland: Set disp->DriverData to NULL on error

Avoid use-after-free, fix spec@egl_khr_fence_sync@conformance.

Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Reported-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 48fd952f28a5fcd71eed5a60c8e3a10231c7a5b0)

7 years agoegl/x11: avoid using freed memory if dri2 init fails
Jan Ziak [Sun, 31 Jul 2016 13:44:18 +0000 (15:44 +0200)]
egl/x11: avoid using freed memory if dri2 init fails

Found with valgrind:

==4841== Invalid read of size 4
==4841==    at 0x56BDC80: dri2_initialize (egl_dri2.c:783)
==4841==    by 0x56BAFE5: _eglMatchAndInitialize (egldriver.c:261)
==4841==    by 0x56BB15E: _eglMatchDriver (egldriver.c:295)
==4841==    by 0x56B58C9: eglInitialize (eglapi.c:480)
==4841==    by 0x4F537DC: _glfwInitEGL (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x4F4BEFB: _glfwPlatformInit (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x4F46F40: glfwInit (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x402E59: main
==4841==  Address 0x6a05824 is 148 bytes inside a block of size 480 free'd
==4841==    at 0x4C2B680: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==4841==    by 0x56C2AAE: dri2_initialize_x11_swrast (platform_x11.c:1233)
==4841==    by 0x56C2AAE: dri2_initialize_x11 (platform_x11.c:1493)
==4841==    by 0x56BDCEB: dri2_initialize (egl_dri2.c:805)
==4841==    by 0x56BAFAF: _eglMatchAndInitialize (egldriver.c:261)
==4841==    by 0x56BB0C9: _eglMatchDriver (egldriver.c:292)
==4841==    by 0x56B58C9: eglInitialize (eglapi.c:480)
==4841==    by 0x4F537DC: _glfwInitEGL (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x4F4BEFB: _glfwPlatformInit (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x4F46F40: glfwInit (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x402E59: main
==4841==  Block was alloc'd at
==4841==    at 0x4C2A868: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==4841==    by 0x56C2A47: dri2_initialize_x11_swrast (platform_x11.c:1171)
==4841==    by 0x56C2A47: dri2_initialize_x11 (platform_x11.c:1493)
==4841==    by 0x56BDCEB: dri2_initialize (egl_dri2.c:805)
==4841==    by 0x56BAFAF: _eglMatchAndInitialize (egldriver.c:261)
==4841==    by 0x56BB0C9: _eglMatchDriver (egldriver.c:292)
==4841==    by 0x56B58C9: eglInitialize (eglapi.c:480)
==4841==    by 0x4F537DC: _glfwInitEGL (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x4F4BEFB: _glfwPlatformInit (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x4F46F40: glfwInit (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x402E59: main

Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0x9b@gmail.com>
Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 769ac1ec78e5bc52191ef0393e4702945bbacaa9)

7 years agoglsl: fix optimization of discard nested multiple levels
Nicolai Hähnle [Tue, 26 Jul 2016 08:04:57 +0000 (10:04 +0200)]
glsl: fix optimization of discard nested multiple levels

The order of optimizations can lead to the conditional discard optimization
being applied twice to the same discard statement. In this case, we must
ensure that both conditions are applied.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96762
Cc: mesa-stable@lists.freedesktop.org
Tested-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 21556d86fc74d91ab58a7496a876ad33e0f950df)
[Emil Velikov: s/get_head_raw()/head/]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
src/compiler/glsl/opt_conditional_discard.cpp

7 years agost_glsl_to_tgsi: only skip over slots of an input array that are present
Nicolai Hähnle [Mon, 25 Jul 2016 16:05:46 +0000 (18:05 +0200)]
st_glsl_to_tgsi: only skip over slots of an input array that are present

When an application declares varying arrays but does not actually do any
indirect indexing, some array indices may end up unused in the consuming
shader, so the number of input slots that correspond to the array ends
up less than the array_size.

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

7 years agoi965/miptree: Stop multiplying cube depth by 6 in HiZ calculations
Jason Ekstrand [Wed, 20 Jul 2016 15:24:15 +0000 (08:24 -0700)]
i965/miptree: Stop multiplying cube depth by 6 in HiZ calculations

intel_mipmap_tree::logical_depth0 is now in number of 2D slices so we no
longer need to be multiplying by 6.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 5d76690f170de9acc541aa6b4a507ccd20a78158)

7 years agoradeonsi: ensure sample locations are set for line and polygon smoothing
Nicolai Hähnle [Sat, 16 Jul 2016 18:41:18 +0000 (20:41 +0200)]
radeonsi: ensure sample locations are set for line and polygon smoothing

Since commit d938b8c, the sample locations are no longer set unconditionally,
so we need to set the atom to dirty on all chips, not just Polaris.

Cc: 12.0 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 3d69357da9f297314f760be092fc55956848425e)

7 years agoradeonsi: fix Polaris MSAA regression
Nicolai Hähnle [Sat, 16 Jul 2016 18:37:29 +0000 (20:37 +0200)]
radeonsi: fix Polaris MSAA regression

The regression was introduced by commit d938b8c. The problem here is that in
order to use the small primitive filter, we need to explicitly set the sample
locations to 0. But the DB doesn't properly process the change of sample
locations without a flush, and so we can end up with incorrect Z values.

Instead of doing a flush, just disable the small primitive filter when MSAA
is force-disabled.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96908
Cc: 12.0 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit f755da0f2f8609e603b50424aa254358eb72fa25)

7 years agomesa: Don't call GenerateMipmap if Width or Height == 0.
Kenneth Graunke [Fri, 22 Jul 2016 05:13:38 +0000 (22:13 -0700)]
mesa: Don't call GenerateMipmap if Width or Height == 0.

One of the WebGL 2.0 conformance tests is trying to call
glGenerateMipmaps with a width and height of 0.  With the meta
implementation, this generates a "framebuffer attachment incomplete"
status, and falls back to the CPU path, calling MapTextureImage.

Except that there's no actual texture to map, and we assert fail.

There's no work to do in this case.  The test expects it to succeed,
so just return early with no error and avoid hassling the driver.

Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96911
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit f80bea2d8066d228e78a1744d036f69a0265116e)

7 years agoanv/pipeline: Set up point coord enables
Jason Ekstrand [Fri, 22 Jul 2016 22:59:22 +0000 (15:59 -0700)]
anv/pipeline: Set up point coord enables

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit b33bccb51917b9058541641702623bbe89841f1e)

7 years agomesa: Add GL_BGRA_EXT to the list of GenerateMipmap internal formats.
Kenneth Graunke [Thu, 21 Jul 2016 23:48:05 +0000 (16:48 -0700)]
mesa: Add GL_BGRA_EXT to the list of GenerateMipmap internal formats.

The GL_EXT_texture_format_BGRA8888 extension specification defines a
GL_BGRA_EXT unsized internal format (which is a little odd - usually
BGRA is a pixel transfer format).  The extension is written against
the ES 1.0 specification, so it's a little hard to map, but I believe
it's effectively adding it to the table used here, so we should allow
it here as well.

Note that GL_EXT_texture_format_BGRA8888 is always enabled (dummy_true),
so we don't need to check if it's enabled here.

This fixes mipmap generation in Skia and ChromeOS.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
References: https://bugs.chromium.org/p/chromium/issues/detail?id=630371
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reported-by: Stéphane Marchesin <marcheu@chromium.org>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit cb7077312954299fb1febed5b016190c00cccfa0)

7 years agoi965: Fix shared atomic intrinsics to pay attention to base.
Kenneth Graunke [Mon, 18 Jul 2016 21:55:07 +0000 (14:55 -0700)]
i965: Fix shared atomic intrinsics to pay attention to base.

Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
(cherry picked from commit 76e161056a424e5b9c35b02a9f4e520c8c44cf2b)

7 years agonir: Add a base const_index to shared atomic intrinsics.
Kenneth Graunke [Mon, 18 Jul 2016 21:47:42 +0000 (14:47 -0700)]
nir: Add a base const_index to shared atomic intrinsics.

Commit 52e75dcb8c04c0dde989970c4c587cbe8313f7cf made nir_lower_io
start using nir_intrinsic_set_base instead of writing const_index[0]
directly.  However, those intrinsics apparently don't /have/ a base,
so this caused assert failures.

However, the old code was happily setting non-existent const_index
fields, so it was pretty bogus too.

Jason pointed out that load_shared and store_shared have a base,
and that the i965 driver uses that field.  So presumably atomics
should have one as well, so that loads/stores/atomics all refer
to variables with consistent addressing.

Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
(cherry picked from commit cf6f2d3ce72a8b9dac5830aaf518aeed17a3833d)

7 years agoi965: Include VUE handles for GS with invocations > 1.
Kenneth Graunke [Wed, 20 Jul 2016 23:11:18 +0000 (16:11 -0700)]
i965: Include VUE handles for GS with invocations > 1.

We always resort to the pull model for instanced GS inputs.  So, we'd
better include the VUE handles, or else we can't actually pull anything.

Ian reports that on his branch with OES_geometry_shader enabled,
this fixes a bunch of dEQP-GLES31.functional.geometry_shading tests::

- instanced.draw_2_instances_geometry_2_invocations
- instanced.draw_2_instances_geometry_8_invocations
- instanced.draw_4_instances_geometry_2_invocations
- instanced.draw_4_instances_geometry_8_invocations
- instanced.draw_8_instances_geometry_2_invocations
- instanced.draw_8_instances_geometry_8_invocations
- instanced.geometry_2_invocations
- instanced.geometry_32_invocations
- instanced.geometry_8_invocations
- instanced.geometry_max_invocations
- instanced.geometry_output_different_2_invocations
- instanced.geometry_output_different_32_invocations
- instanced.geometry_output_different_8_invocations
- instanced.geometry_output_different_max_invocations
- instanced.invocation_output_vary_by_attribute
- instanced.invocation_output_vary_by_texture
- instanced.invocation_output_vary_by_uniform
- query.primitives_generated_instanced

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 2db357e4c3dcb49deabae7b68721d57ad9ea0000)

7 years agoswr: Refactor checks for compiler feature flags
Chuck Atkins [Tue, 28 Jun 2016 19:50:47 +0000 (15:50 -0400)]
swr: Refactor checks for compiler feature flags

Encapsulate the test for which flags are needed to get a compiler to
support certain features.  Along with this, give various options to try
for AVX and AVX2 support.  Ideally we want to use specific instruction
set feature flags, like -mavx2 for instance instead of -march=haswell,
but the flags required for certain compilers are different.  This
allows, for AVX2 for instance, GCC to use -mavx2 -mfma -mbmi2 -mf16c
while the Intel compiler which doesn't support those flags can fall
back to using -march=core-avx2.

This addresses a bug where the Intel compiler will silently ignore the
AVX2 instruction feature flags and then potentially fail to build.

v2: Pass preprocessor-check argument as true-state instead of
    false-state for clarity.
v3: Reduce AVX2 define test to just __AVX2__.  Additional defines suchas
    __FMA__, __BMI2__, and __F16C__ appear to be inconsistently defined
    w.r.t thier availability.
v4: Fix C++11 flags being added globally and add more logic to
    swr_require_cxx_feature_flags

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
Tested-by: Tim Rowley <timothy.o.rowley@Intel.com>
Signed-off-by: Chuck Atkins <chuck.atkins@kitware.com>
(cherry picked from commit c1bf6692beb662e5749e5680e0ebd15af2cd032a)

7 years agoswr: switch from overriding -march to selecting features
Tim Rowley [Thu, 16 Jun 2016 19:56:39 +0000 (14:56 -0500)]
swr: switch from overriding -march to selecting features

Acked-by: Chuck Atkins <chuck.atkins@kitware.com>
Tested-by: Chuck Atkins <chuck.atkins@kitware.com>
(cherry picked from commit 5a64549f54bf1f67a4d0d098ab480affaaabd8ab)

7 years agowinsys/amdgpu: disallow DCC with mipmaps
Marek Olšák [Tue, 7 Jun 2016 16:35:52 +0000 (18:35 +0200)]
winsys/amdgpu: disallow DCC with mipmaps

It has never been implemented. master will get a different fix.

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

Cc: 11.1 11.2 12.0 <mesa-stable@lists.freedesktop.org>
7 years agonvc0: upload sample locations on GM20x
Samuel Pitoiset [Sun, 24 Jul 2016 22:02:12 +0000 (00:02 +0200)]
nvc0: upload sample locations on GM20x

This fixes a bunch of multisample piglit tests on GM206, like
bin/arb_texture_multisample-texelfetch 2 -auto -fbo

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
(cherry picked from commit e7b2ce5fd872f6bf348310dcb6541ee5263886d5)
[Emil Velikov: resolve conflicts]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c

7 years agoAndroid: add missing u_math.h include path for libmesa_isl
Rob Herring [Mon, 13 Jun 2016 18:45:53 +0000 (13:45 -0500)]
Android: add missing u_math.h include path for libmesa_isl

Commit 87d062a94080 ("i965: Fix shared local memory size for Gen9+.")
added u_math.h include which broke the Android build:

In file included from external/mesa3d/src/intel/isl/isl_storage_image.c:25:
In file included from external/mesa3d/src/mesa/drivers/dri/i965/brw_compiler.h:29:
external/mesa3d/src/mesa/main/macros.h:35:10: fatal error: 'util/u_math.h' file not found
         ^

Add the missing include paths for libmesa_isl.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Kenneth Garunke <kenneth@whitecape.org>
Nominated-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 789ed13284cb99b96f2aa69f237959b27c5c3bc2)

7 years agomapi: Massage code to allow clang to compile.
Matt Turner [Mon, 11 Jul 2016 17:44:25 +0000 (10:44 -0700)]
mapi: Massage code to allow clang to compile.

According to https://llvm.org/bugs/show_bug.cgi?id=19778#c3 this code
was violating the spec, resulting in it failing to compile.

Cc: mesa-stable@lists.freedesktop.org
Co-authored-by: Tomasz Paweł Gajc <tpgxyz@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89599
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 5ec140c17b54c25920091501b665b9aa809cc5e8)

Squashed with commit:

mapi: fix typo in macro name

Fixes: 5ec140c17b54c2592009 ("mapi: Massage code to allow clang to compile.")
Reported-by: Alexandre Demers <alexandre.f.demers@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
(cherry picked from commit 4da9f7e7ce3e5fc62336dc6f041a30aabd2cacdc)

7 years agonir/inline: Constant-initialize local variables in the callee if needed
Jason Ekstrand [Fri, 15 Jul 2016 22:44:32 +0000 (15:44 -0700)]
nir/inline: Constant-initialize local variables in the callee if needed

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 9d503aea069e08cffd57a4d590a6a0ca3b8ae4a2)

7 years agonir: Add a nir_deref_foreach_leaf helper
Jason Ekstrand [Fri, 15 Jul 2016 22:21:19 +0000 (15:21 -0700)]
nir: Add a nir_deref_foreach_leaf helper

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit dc9f2436c39d6539b56c9aedceefdc79566e5db8)

7 years agoanv: Properly call gen75_emit_state_base_address on Haswell.
Kenneth Graunke [Mon, 18 Jul 2016 23:13:36 +0000 (16:13 -0700)]
anv: Properly call gen75_emit_state_base_address on Haswell.

This should fix MOCS values.  Caught by Coverity.

CID: 1364155

Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit e614062e548ae58f51082c2cf984c3141cf01ec9)

7 years agogenxml: Rename "API Rendering Disable" to "Rendering Disable".
Kenneth Graunke [Mon, 18 Jul 2016 23:00:20 +0000 (16:00 -0700)]
genxml: Rename "API Rendering Disable" to "Rendering Disable".

Gen7/7.5 call it "Rendering Disable" while Gen8/9 prefix it with "API".

Pick one for consistency, and so we can share code between generations.

Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit 87660579f587dbb390cf89c3ce7f5ccdb5c6839e)

7 years agoanv: Unify 3DSTATE_CLIP code across generations.
Kenneth Graunke [Mon, 18 Jul 2016 21:27:35 +0000 (14:27 -0700)]
anv: Unify 3DSTATE_CLIP code across generations.

The bulk of this is the same.  There are just a couple fields that only
exist on one generation or another, and we can easily handle those with
an #ifdef.

Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit bfd9942cdc0db19838a4516f4a67e1bcf25a9d30)

7 years agoanv: Enable early culling on Gen7.
Kenneth Graunke [Mon, 18 Jul 2016 20:52:07 +0000 (13:52 -0700)]
anv: Enable early culling on Gen7.

We set the cull mode, but forgot the enable bit.  Gen8 uses this.

Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit 44502afd8219c298fafa39625a178713c912d975)

7 years agoanv: Fix near plane clipping on Gen7/7.5.
Kenneth Graunke [Mon, 18 Jul 2016 21:15:49 +0000 (14:15 -0700)]
anv: Fix near plane clipping on Gen7/7.5.

The Gen7/7.5 clip code used APIMODE_OGL, while the Gen8+ clip code used
APIMODE_D3D.  The meaning hasn't changed, so one of these must be wrong.

It appears that the hardware documentation is completely wrong.  It
claims that the "API Mode" bit means:

   0h    APIMODE_OGL    NEAR_VP boundary == 0.0 (NDC)
   1h    APIMODE_D3D    NEAR_VP boundary == -1.0 (NDC)

However, DirectX typically uses 0.0 for the near plane, while unextended
OpenGL uses -1.0.  i965's gen6_clip_state.c uses APIMODE_D3D for the
GL_ZERO_TO_ONE case, so I believe the meanings are backwards from what
the documentation says.

Section 23.2 ("Primitive Clipping") of the Vulkan 1.0.21 specification
contains the following equations:

   -w_c <= x_c <= w_c
   -w_c <= y_c <= w_c
      0 <= z_c <= w_c

This means that Vulkan follows D3D semantics.

Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit 0d77f08042b00cff81bebceb7877bc20f80c0965)

7 years agogenxml: Add APIMODE_D3D missing enum values and improve consistency.
Kenneth Graunke [Mon, 18 Jul 2016 20:56:23 +0000 (13:56 -0700)]
genxml: Add APIMODE_D3D missing enum values and improve consistency.

Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit 6b6727026228bd1eab715034416194317e4d0fc6)

7 years agogenxml: Add CLIPMODE_* prefix to 3DSTATE_CLIP's "Clip Mode" enum values.
Kenneth Graunke [Mon, 18 Jul 2016 22:36:43 +0000 (15:36 -0700)]
genxml: Add CLIPMODE_* prefix to 3DSTATE_CLIP's "Clip Mode" enum values.

Gen6-7.5 use CLIPMODE_REJECT_ALL, while Gen8+ just used REJECT_ALL.
Being consistent will let me unify code, and I prefer having the prefix.

Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit c31cf532af4c14ffb82ccbec2e69df82d56c4ef2)

7 years agoi965/miptree: Set logical_depth0 == 6 for cube maps
Jason Ekstrand [Tue, 19 Jul 2016 05:00:30 +0000 (22:00 -0700)]
i965/miptree: Set logical_depth0 == 6 for cube maps

This matches what we do for cube maps where logical_depth0 is in number of
face-layers rather than number of cubes.  This does mean that we will
temporarily be setting the surface bounds too loose for cube map textures
but we are already setting them too loose for cube arrays and we will be
fixing that in the next commit anyway.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Cc: "12.0 11.2 11.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit e19b7f7f1b5d6a1d325c0129d6d6b9da6234330a)

7 years agoi965/miptree: Enforce that height == 1 for 1-D array textures
Jason Ekstrand [Tue, 19 Jul 2016 01:46:43 +0000 (18:46 -0700)]
i965/miptree: Enforce that height == 1 for 1-D array textures

The GL API and mesa internals do this differently than we do.  In GL, there
is no depth parameter for 1-D arrays and height is used.  In the i965
miptree code we do the sane thing and make height == 1 and use depth for
number of slices.  This makes for a mismatch every time we create a 1-D
array texture from GL.  Instead of actually solving this problem, we just
said "1-D is hard, let's make sure it works no matter which way we pass the
parameters" and called it a day.

This commit fixes the one GL -> i965 transition point where we weren't
already handling 1-D array textures to do the right thing and then replaces
the magic fixup code with an assert that you're doing the right thing.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Cc: "12.0 11.2 11.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit d4d505d0b04b9bce7c346fe0710df9921861edd6)

7 years agoAvoid overflow in 'last' variable of FindGLXFunction(...)
Stefan Dirsch [Thu, 14 Jul 2016 13:21:20 +0000 (15:21 +0200)]
Avoid overflow in 'last' variable of FindGLXFunction(...)

This 'last' variable used in FindGLXFunction(...) may become negative,
but has been defined as unsigned int resulting in an overflow,
finally resulting in a segfault when accessing _glXDispatchTableStrings[...].
Fixed this by definining it as signed int. 'first' variable also needs to be
defined as signed int. Otherwise condition for while loop fails due to C
implicitly converting signed to unsigned values before comparison.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Stefan Dirsch <sndirsch@suse.de>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 27ef7bfd6cd2d960844f4c79d6dddc0bda0b20b0)

7 years agoegl/android: Stop leaking DRI images
Tomasz Figa [Fri, 15 Jul 2016 07:53:50 +0000 (16:53 +0900)]
egl/android: Stop leaking DRI images

Current implementation of the DRI image loader does not free the images
created in get_back_bo() and so leaks memory. Moreover, it creates a new
image every time the DRI driver queries for buffers, even if the backing
native buffer has not changed. leaking memory again.

This patch adds missing call to destroyImage() in droid_enqueue_buffer()
and a check if image is already created to get_back_bo() to fix the
above.

Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 9e1248d0752e692714b58ef1f2211ec7e172c8cf)

7 years agoegl/android: Check return value of dri2_get_dri_config()
Tomasz Figa [Fri, 15 Jul 2016 07:53:48 +0000 (16:53 +0900)]
egl/android: Check return value of dri2_get_dri_config()

It might return NULL if specific config variant is unsupported.

Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 94282b6dd0e7c15030b09b6789a7aa5a15e8a869)

7 years agoi965: store reference to the context within struct brw_fence (v2)
Emil Velikov [Fri, 15 Jul 2016 07:27:09 +0000 (16:27 +0900)]
i965: store reference to the context within struct brw_fence (v2)

As the spec allows for {server,client}_wait_sync to be called without
currently bound context, while our implementation requires context
pointer.

v2: Add a mutex and acquire it for the duration of
    brw_fence_client_wait() and brw_fence_is_completed() as suggested
    by Chad.

Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
(cherry picked from commit 4f48674d51f03d8c954a89dfc49539a1dc750c4d)

7 years agoegl/dri2: dri2_make_current: Set EGL error if bindContext fails
Nicolas Boichat [Fri, 15 Jul 2016 08:24:20 +0000 (16:24 +0800)]
egl/dri2: dri2_make_current: Set EGL error if bindContext fails

Without this, if a configuration is, say, available only on GLES2/3, but
not on GLES1, and is rejected by the dri module's bindContext call,
eglMakeCurrent fails with error "EGL_SUCCESS".

In this patch, we set error to EGL_BAD_MATCH, which is what CTS/dEQP
dEQP-EGL.functional.surfaceless_context expect.

Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 9bebef4034c79d0f223a6e61943dd44bcb6442ee)

7 years agoegl/android: Remove unused variables
Tomasz Figa [Wed, 13 Jul 2016 03:33:24 +0000 (11:33 +0800)]
egl/android: Remove unused variables

There are some unused variables left after previous clean-ups triggering
compiler warnings. Let's remove them.

Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit ccda100a5a2838adec16ac10b2cc1c73e666e7d2)

7 years agoplatform_android: prevent deadlock in droid_swap_buffers
Haixia Shi [Thu, 2 Jun 2016 19:48:23 +0000 (12:48 -0700)]
platform_android: prevent deadlock in droid_swap_buffers

To avoid blocking other EGL calls, release the display mutex before
we enqueue buffer to android frameworks and re-acquire the mutex
upon return.

v2: moved lock/unlock inside droid_window_enqueue_buffer().

TEST=verify pinch zoom in Photos app no longer causes hangs

Signed-off-by: Haixia Shi <hshi@chromium.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 1ea233c6f30a74e6ff5456c3521328237b01eed8)

7 years agogallium/dri: Add shared glapi to LIBADD on Android
Tomasz Figa [Wed, 13 Jul 2016 03:29:45 +0000 (11:29 +0800)]
gallium/dri: Add shared glapi to LIBADD on Android

An earlier patch fixed the problem for classic drivers, however Gallium
was still left broken. This patch applies the same workaround to
Gallium, when compiled for Android. Following is a quote from the
original patch:

0cbc90c57cfc mesa: dri: Add shared glapi to LIBADD on Android

/system/vendor/lib/dri/*_dri.so actually depend on libglapi: without
this, loading the so file fails with:
cannot locate symbol "__emutls_v._glapi_tls_Context"

On non-Android (non-bionic) platform, EGL uses the following
workflow, which works fine:
  dlopen("libglapi.so", RTLD_LAZY | RTLD_GLOBAL);
  dlopen("dri/<driver>_dri.so", RTLD_NOW | RTLD_GLOBAL);

However, bionic does not respect the RTLD_GLOBAL flag, and the dri
library cannot find symbols in libglapi.so, so we need to link
to libglapi.so explicitly. Android.mk already does this.

Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 70a28afb296de3e89248ad2a2bc0611e7afb762b)

7 years agomesa: scons: list builddir before srcdir
Emil Velikov [Mon, 18 Jul 2016 18:23:02 +0000 (19:23 +0100)]
mesa: scons: list builddir before srcdir

Analogous to previous commit.

Note: scons always uses OOT builds, while the in-tree generated files
could be created either manually or by the autoconf build.

Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
Cc: Alexander von Gluck IV <kallisti5@unixzen.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 1c7c0d77ac1f7035558c37fc0297e9d22991d429)
[Emil Velikov: remove not-applicable "Dir('main')" entry]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
src/mesa/SConscript

7 years agomesa: automake: list builddir before srcdir
Emil Velikov [Mon, 18 Jul 2016 18:12:17 +0000 (19:12 +0100)]
mesa: automake: list builddir before srcdir

In the case of building in out-of-tree fashion, while having generated
in-tree sources, the latter [likely stale] files will be used.

Flip the order to prevent that.

Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit eafa82e20e35c532bd2918c62d0100cbbecc7f1f)

7 years agogm107/ir: make use of ADD32I for all immediates
Samuel Pitoiset [Tue, 19 Jul 2016 12:47:57 +0000 (14:47 +0200)]
gm107/ir: make use of ADD32I for all immediates

ADD only allows to emit 19-bits immediates.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 9c63224540ef0f727aae24274fa4afdf2e2376ac)

7 years agogm107/ir: add missing NEG modifier for IADD32I
Samuel Pitoiset [Tue, 19 Jul 2016 12:47:56 +0000 (14:47 +0200)]
gm107/ir: add missing NEG modifier for IADD32I

Like FADD32I, the NEG modifier of src0 is at position 56.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit 0904a2ba9717e5706f8869dc9244e2c742fadd12)

7 years agoconfigure.ac: Use ${datarootdir} for --with-vulkan-icddir help string too
Andreas Boll [Tue, 19 Jul 2016 10:30:40 +0000 (12:30 +0200)]
configure.ac: Use ${datarootdir} for --with-vulkan-icddir help string too

The help string wasn't updated in cbc37f7.

Fixes: cbc37f7 ("anv: install the intel_icd.json to ${datarootdir} by
default")

Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
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 d66cb7c84f2b35b76ad47f6f9add2c0512375815)

7 years agonv50,nvc0: srgb rendering is only available for rgba/bgra
Ilia Mirkin [Sun, 17 Jul 2016 21:14:24 +0000 (17:14 -0400)]
nv50,nvc0: srgb rendering is only available for rgba/bgra

Mark both L8_SRGB and L8A8_SRGB as non-renderable (the latter already
didn't have the bind flags). This makes the state tracker pick a
different format when rendering is required, or mark the fb as
incomplete. This fixes:

  bin/getteximage-formats init-by-clear-and-render -auto -fbo
  bin/getteximage-formats init-by-rendering -auto -fbo

which previously ran into srgb-encoding differences.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit ed9dd3bcd9990b321f523823287643cbf893949f)

7 years agovl/dri3: fix a memory leak from front buffer
Leo Liu [Thu, 14 Jul 2016 13:19:59 +0000 (09:19 -0400)]
vl/dri3: fix a memory leak from front buffer

Inspired by fix for mem leak of vdpau interop, resource_from_handle
set texture reference count, that need to be decreased and released,
recall there is a similar case for DRI3, that is with VA-API glx
extension, there is temporary TFP(texture from pixmap), we target it
through dma-buf. leak happens when without count down the reference.

Checked and found with mpv vo=opengl case, there only one static TFP,
the leak happens once, but for totem player using gstreamer VA-API glx,
the dynamic TFP for each frame, so leak quite a bit.

This fixes mem leak for mpv and totem.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 134d6e4e4f980d738361bfcae1daedb8cc58b5df)

7 years agoanv: Handle VK_WHOLE_SIZE properly for buffer views
Jason Ekstrand [Fri, 15 Jul 2016 04:11:14 +0000 (21:11 -0700)]
anv: Handle VK_WHOLE_SIZE properly for buffer views

The old calculation, which used view->offset, encorporated buffer->offset
into the size calculation where it doesn't belong.  This meant that, if
buffer->offset > buffer->size, you would always get a negative size.  This
fixes 170 dEQP-VK.renderpass.attachment.* Vulkan CTS tests on Haswell.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 593731ea3cc1aa9385e43ebc18c67574f181e1c3)
[Emil Velikov: s|bpb / 8|bs|g]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
src/intel/vulkan/anv_image.c

7 years agoanv: Add an align_down_npot_u32 helper
Jason Ekstrand [Fri, 15 Jul 2016 18:50:20 +0000 (11:50 -0700)]
anv: Add an align_down_npot_u32 helper

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 827405f07259424ca716dcb217ef0a813ad67963)

7 years agoanv: Enable independentBlend on gen7
Jason Ekstrand [Fri, 15 Jul 2016 01:01:29 +0000 (18:01 -0700)]
anv: Enable independentBlend on gen7

We can totally do it, we were just only setting up one BLEND_STATE and, now
that the code is unified with gen8, we should be handling it correctly.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit f124f4a394680f8a1847339770c8d245282bbe01)

7 years agoanv/pipeline: Unify blend state setup between gen7 and gen8
Jason Ekstrand [Fri, 15 Jul 2016 01:00:50 +0000 (18:00 -0700)]
anv/pipeline: Unify blend state setup between gen7 and gen8

This fixes all 674 broken dEQP-VK.pipeline.blend Vulkan CTS tests on
Haswell.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit a2e7b2e6538a87c60219319456f55cb42298745c)

7 years agogenxml: Make gen6-7 blending look more like gen8
Jason Ekstrand [Fri, 15 Jul 2016 00:52:07 +0000 (17:52 -0700)]
genxml: Make gen6-7 blending look more like gen8

This renames BLEND_STATE to BLEND_STATE_ENTRY and adds an new struct
BLEND_STATE which is just an array of 8 BLEND_STATE_ENTRYs.  This will make
it much easier to write gen-agnostic blend handling code.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit aaa202ebe7b86f71f596bf01f6177f4cb66f2c4c)

7 years agomesa: use _mesa_clear_texture_image() in clear_texture_fields()
Brian Paul [Wed, 13 Jul 2016 19:52:31 +0000 (13:52 -0600)]
mesa: use _mesa_clear_texture_image() in clear_texture_fields()

This avoids a failed assert(img->_BaseFormat != -1) in
init_teximage_fields_ms() because the internalFormat argument is GL_NONE.
This was hit when using glTexStorage() to do a proxy texture test.

Fixes a failure with the updated Piglit tex3d-maxsize test.

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit e477d92c94d6415d2844f68766adf5339aebe7bf)

7 years agoisl: Fix isl_tiling_is_any_y()
Nanley Chery [Fri, 24 Jun 2016 22:37:34 +0000 (15:37 -0700)]
isl: Fix isl_tiling_is_any_y()

Cc: 12.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit 00caba4152fd85492d1eb3306ae6890b3f9e90b2)

7 years agoanv/device: Fix max buffer range limits
Nanley Chery [Wed, 6 Jul 2016 18:13:48 +0000 (11:13 -0700)]
anv/device: Fix max buffer range limits

Set limits that are consistent with ISL's assertions in
isl_genX(buffer_fill_state_s)() and Anvil's format-DescriptorType
mapping in anv_isl_format_for_descriptor_type().

Fixes the following new crucible tests:
* stress.limits.buffer-update.range.uniform
* stress.limits.buffer-update.range.storage

These tests are in this patch: https://patchwork.freedesktop.org/patch/98726/

Cc: 12.0 <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 a5748cb9204f872cbaa6764b95a33ef20c4dd5da)

7 years agoisl: Fix assert on raw buffer surface state size
Nanley Chery [Wed, 6 Jul 2016 18:13:15 +0000 (11:13 -0700)]
isl: Fix assert on raw buffer surface state size

See inline PRM reference.

Cc: 12.0 <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 028f6d8317f00a94b09df81e8f2cb944077e64a7)

7 years agoanv/descriptor_set: Fix binding partly undefined descriptor sets
Nanley Chery [Tue, 12 Jul 2016 00:33:24 +0000 (17:33 -0700)]
anv/descriptor_set: Fix binding partly undefined descriptor sets

Section 13.2.3. of the Vulkan spec requires that implementations be able to
bind sparsely-defined Descriptor Sets without any errors or exceptions.

When binding a descriptor set that contains a dynamic buffer binding/descriptor,
the driver attempts to dereference the descriptor's buffer_view field if it is
non-NULL. It currently segfaults on undefined descriptors as this field is never
zero-initialized. Zero undefined descriptors to avoid segfaulting. This
solution was suggested by Jason Ekstrand.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96850
Cc: 12.0 <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 fd16e6432104389fa659bb1d011aa6fb82952737)

7 years agosvga: handle mismatched number of samplers, sampler views
Brian Paul [Fri, 15 Jul 2016 13:08:13 +0000 (07:08 -0600)]
svga: handle mismatched number of samplers, sampler views

in svga_init_shader_key_common().  Since the CSO module only tracks
sampler views for fragment shaders, the number of samplers and sampler
views can be mismatched for other types of shaders.  This situation
triggered an assertion in Chrome with maps.google.com

This patch adds defensive code to handle that situation.

Fixes VMware bug 1694027
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
(cherry picked from commit 50a669de4e216d2e3bea3ec1148c7e79f77ecb27)

7 years agost/omx/enc: check uninitialized list from task release
Leo Liu [Mon, 11 Jul 2016 19:27:16 +0000 (15:27 -0400)]
st/omx/enc: check uninitialized list from task release

The uninitialized list should be checked and returned.

Thank Julien for the notification and suggested fix.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit b9d10e79c88842ba05d6937a3803cb5740b866da)

7 years agoglsl/types: Use _mesa_hash_data for hashing function types
Jason Ekstrand [Wed, 13 Jul 2016 21:26:50 +0000 (14:26 -0700)]
glsl/types: Use _mesa_hash_data for hashing function types

This is way better than the stupid string approach especially since you
could overflow the string.  Again, I thought I had something better at one
point but it obviously got lost.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit b919100d6101c0bd7e15a187968af9a36b49e6de)

7 years agoglsl/types: Fix function type comparison function
Jason Ekstrand [Wed, 13 Jul 2016 21:25:11 +0000 (14:25 -0700)]
glsl/types: Fix function type comparison function

It was returning true if the function types have different lengths rather
than false.  This was new with the SPIR-V to NIR pass and I thought I'd
fixed it a while ago but it may have gotten lost in rebasing somewhere.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 11ac1c4dbbc9fc41d163fa4d9a76bb73c3907871)

7 years agost/mesa: fix reference counting bug in st_vdpau
Christian König [Wed, 13 Jul 2016 12:54:31 +0000 (14:54 +0200)]
st/mesa: fix reference counting bug in st_vdpau

Otherwise we leak the resources created for the DMA-buf descriptors.

Signed-off-by: Christian König <christian.koenig@amd.com>
Cc: 12.0 <mesa-stable@lists.freedesktop.org>
Tested-and-Reviewed by: Leo Liu <leo.liu@amd.com>
Ack-by: Tom St Denis <tom.stdenis@amd.com>
(cherry picked from commit 9ce52baf7f479d506bcea17a371dcf2fad92f139)

7 years agoanv: Add a stub for CmdCopyQueryPoolResults on Ivy Bridge
Jason Ekstrand [Thu, 14 Jul 2016 03:11:30 +0000 (20:11 -0700)]
anv: Add a stub for CmdCopyQueryPoolResults on Ivy Bridge

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit b9e99282a6e1b3b2b01645e37bf4b735aace677b)

7 years agoRevert "gallium: Force blend color to 16-byte alignment"
Tim Rowley [Wed, 13 Jul 2016 15:30:46 +0000 (10:30 -0500)]
Revert "gallium: Force blend color to 16-byte alignment"

This reverts commit d8d6091a846ac2a40a011d512d6d57f6c8442e6a.

Heap allocations may be only 8-byte aligned on 32-bit system, and so having
members with 16-byte alignment (such as in the case where pipe_blend_color is
embedded in radeonsi's si_context) is undefined behavior which indeed causes
crashes when compiled with gcc -O3.

Cc: <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96835
Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
Acked-by: Chuck Atkins <chuck.atkins@kitware.com>
(cherry picked from commit 29f53d793781b67a92bb95fe66d7d38adc5488bb)

7 years agonir/spirv: Don't multiply the push constant block size by 4
Jason Ekstrand [Wed, 13 Jul 2016 18:35:29 +0000 (11:35 -0700)]
nir/spirv: Don't multiply the push constant block size by 4

I have no idea why we were multiplying by 4 before.  The offsets we get
from SPIR-V are in bytes and so is nir->num_uniforms so there's no need to
do any adjustment whatsoever.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 49476576ddd5c743b852bb2c1ad75ebfe3e1c72d)

7 years agoradeonsi: add a workaround for a compute VGPR-usage LLVM bug
Marek Olšák [Sun, 3 Jul 2016 18:00:17 +0000 (20:00 +0200)]
radeonsi: add a workaround for a compute VGPR-usage LLVM bug

v2: use abort(), describe which LLVM version is affected

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

7 years agoglsl_to_tgsi: don't use the negate modifier in integer ops after bitcast
Marek Olšák [Sun, 3 Jul 2016 12:33:55 +0000 (14:33 +0200)]
glsl_to_tgsi: don't use the negate modifier in integer ops after bitcast

This bug is uncovered by glsl/lower_if_to_cond_assign.
I don't know if it can be reproduced in any other way.

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
(cherry picked from commit ead7736821633bbbd8ae743a49d2ee87ebef0763)

7 years agomesa: set _NEW_BUFFERS when updating texture bound to current buffers
Ilia Mirkin [Fri, 8 Jul 2016 18:24:38 +0000 (14:24 -0400)]
mesa: set _NEW_BUFFERS when updating texture bound to current buffers

When a glTexImage call updates the parameters of a currently bound
framebuffer, we might miss out on revalidating whether it is complete.
Make sure to set _NEW_BUFFERS which will trigger the revalidation in
that case.

Also while we're at it, fix the fb parameter passed in to the eventual
RenderTexture call.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94148
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
(cherry picked from commit da7223ebdc82609a112aae24003bbdc154c170bf)

7 years agost/mesa: return appropriate mesa format for ETC texture formats
Ilia Mirkin [Fri, 8 Jul 2016 03:46:28 +0000 (23:46 -0400)]
st/mesa: return appropriate mesa format for ETC texture formats

Even when the backend driver does not support ETC formats, we handle the
decoding into an uncompressed backing texture. However as far as core
mesa is concerned, it's an ETC texture and we should return the relevant
ETC mesa format. This condition can get hit when using glTexStorage to
create the texture object.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 00d4315d37ec736fccfee50a402fa2a929054bde)

7 years agomesa: etc2 online compression is unsupported, don't attempt it
Ilia Mirkin [Fri, 8 Jul 2016 22:41:03 +0000 (18:41 -0400)]
mesa: etc2 online compression is unsupported, don't attempt it

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 8ee3cdde049d30095451f44080a9cd2d6e949459)

7 years agonvc0: fix the driver cb size when draw parameters are used
Samuel Pitoiset [Mon, 11 Jul 2016 19:26:25 +0000 (21:26 +0200)]
nvc0: fix the driver cb size when draw parameters are used

The size of the driver constant buffer for each stage should be 2048
and not 512 because it has been increased recently for buffers/images.
While we are at it, do the same change for indirect draws.

This fixes all ARB_shader_draw_parameters tests on GM107.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: 12.0 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 31a615677b26587e63efe2c8cc0bdfecbf82fbae)

7 years agonvc0/ir: fix images indirect access on Fermi
Samuel Pitoiset [Sun, 10 Jul 2016 14:19:46 +0000 (16:19 +0200)]
nvc0/ir: fix images indirect access on Fermi

This fixes the following piglits:

arb_arrays_of_arrays-basic-imagestore-mixed-const-non-const-uniform-index
arb_arrays_of_arrays-basic-imagestore-mixed-const-non-const-uniform-index2

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: 12.0 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 19d0450b2758ec9681747e9229b46f9eb637378b)

7 years agoradeonsi: explicitly choose center locations for 1xAA on Polaris
Nicolai Hähnle [Wed, 6 Jul 2016 14:33:43 +0000 (16:33 +0200)]
radeonsi: explicitly choose center locations for 1xAA on Polaris

Unlike SC, the small primitive filter does not automatically use center
locations in 1xAA mode, so this is needed to avoid artifacts caused by
the small primitive filter discarding triangles that it shouldn't.

As a side effect of how the effective number of samples is now calculated,
this patch also avoids submitting the sample locations for line/poly smoothing
when they're not really needed.

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

7 years agoi965: Fix remaining flush vs invalidate race conditions in brw_emit_pipe_control_flush.
Francisco Jerez [Fri, 1 Jul 2016 00:49:18 +0000 (17:49 -0700)]
i965: Fix remaining flush vs invalidate race conditions in brw_emit_pipe_control_flush.

This hardware race condition has caused problems several times already
(see "i965: Fix cache pollution race during L3 partitioning set-up.",
"i965: Fix brw_render_cache_set_check_flush's PIPE_CONTROLs." and
"i965: intel_texture_barrier reimplemented").  The problem is that
whenever we attempt to both flush and invalidate multiple caches with
a single pipe control command the flush and invalidation happen in
reverse order, so the contents flushed from the R/W caches aren't
guaranteed to become visible from the invalidated caches after the
PIPE_CONTROL command completes execution if some concurrent rendering
workload happened to pollute any of the invalidated R/O caches in the
short window of time between the invalidation and flush.

This makes sure that brw_emit_pipe_control_flush() has the effect
expected by most callers of making the contents flushed from any R/W
caches visible from the invalidated R/O caches.

Cc: "12.0 11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit 37b901003b7bb0c0b003550b1255b42b4fc68695)

7 years agoi965: Make room in the batch epilogue for three more pipe controls.
Francisco Jerez [Fri, 1 Jul 2016 04:15:26 +0000 (21:15 -0700)]
i965: Make room in the batch epilogue for three more pipe controls.

Review carefully, it sucks to have to keep track of the number of
command packet dwords emitted in the batch epilogue manually.  The
MI_REPORT_PERF_COUNT_BATCH_DWORDS calculation was obviously wrong.

Cc: "12.0 11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit 0bd3a121c6ea818b656082676f992b41204c5b41)

7 years agoi965: Emit SKL VF cache invalidation W/A from brw_emit_pipe_control_flush.
Francisco Jerez [Fri, 1 Jul 2016 02:41:49 +0000 (19:41 -0700)]
i965: Emit SKL VF cache invalidation W/A from brw_emit_pipe_control_flush.

There were two places in the driver doing a pipe control VF cache
flush, one of them was missing this workaround, move it down into
brw_emit_pipe_control_flush to make sure we don't miss it again.

Cc: "12.0 11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
(cherry picked from commit a10879f48cedb1ef906becba0abad0af27482f34)

7 years agoglsl: Pack integer and double varyings as flat even if interpolation mode is none
Ian Romanick [Tue, 14 Jun 2016 21:38:04 +0000 (14:38 -0700)]
glsl: Pack integer and double varyings as flat even if interpolation mode is none

v2: Also update varying_matches::compute_packing_class().  Suggested by
Timothy Arceri.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96358
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Cc: Gregory Hainaut <gregory.hainaut@gmail.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
(cherry picked from commit 3119871bd9558e5881466b70a4c366d2f83bba82)

7 years agomesa: Strip arrayness from interface block names in some IO validation
Ian Romanick [Fri, 10 Jun 2016 15:01:30 +0000 (08:01 -0700)]
mesa: Strip arrayness from interface block names in some IO validation

Outputs from the vertex shader need to be able to match
per-vertex-arrayed inputs of later stages.  Acomplish this by stripping
one level of arrayness from the names and types of outputs going to a
per-vertex-arrayed stage.

v2: Add missing checks for TESS_EVAL->GEOMETRY.  Noticed by Timothy
Arceri.

v3: Use a slightly simpler stage check suggested by Ilia.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96358
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Cc: Gregory Hainaut <gregory.hainaut@gmail.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
(cherry picked from commit 73a6a4ce4975016d4f86d644b31d30bb6d3a38f8)

7 years agodocs: add sha256 checksums for 12.0.1
Emil Velikov [Fri, 8 Jul 2016 23:02:13 +0000 (00:02 +0100)]
docs: add sha256 checksums for 12.0.1

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs: add release notes for 12.0.1
Emil Velikov [Fri, 8 Jul 2016 22:45:44 +0000 (23:45 +0100)]
docs: add release notes for 12.0.1

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoUpdate version to 12.0.1
Emil Velikov [Fri, 8 Jul 2016 22:40:03 +0000 (23:40 +0100)]
Update version to 12.0.1

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradeon: reference the correct cdw/max_dw
Emil Velikov [Fri, 8 Jul 2016 21:04:34 +0000 (22:04 +0100)]
radeon: reference the correct cdw/max_dw

With commit f41f78cda10 ("radeonsi: drop the DRAW_PREAMBLE packet on
Polaris") we failed to attribute that the separate current/prev
radeon_winsys_cs_chunk(s) are not applicable/available in branch.

The latter of which introduced with commit 89ba076de4c ("radeon/winsys:
introduce radeon_winsys_cs_chunk").

Just drop "current." from the respective places to get things up and
running again.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96864
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs: add sha256 checksums for 12.0.0
Emil Velikov [Fri, 8 Jul 2016 22:47:39 +0000 (23:47 +0100)]
docs: add sha256 checksums for 12.0.0

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs: Update 12.0.0 release notes
Emil Velikov [Thu, 7 Jul 2016 12:39:06 +0000 (13:39 +0100)]
docs: Update 12.0.0 release notes

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoUpdate version to 12.0.0(final)
Emil Velikov [Thu, 7 Jul 2016 10:39:25 +0000 (11:39 +0100)]
Update version to 12.0.0(final)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agosvga: Fix failures caused in fedora 24
Neha Bhende [Tue, 28 Jun 2016 19:59:19 +0000 (12:59 -0700)]
svga: Fix failures caused in fedora 24

SVGA_3D_CMD_DX_GENRATE_MIPMAP & SVGA_3D_CMD_DX_SET_PREDICATION commands
are not presents in fedora 24 kernel module. Because of this
reason application like supertuxkart are not running.

v2: Add few comments and code modifications suggested by Brian P.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
(cherry picked from commit 7988513ac3d86ba367fbe44e73fe483ff96aaa29)

7 years agoglsl: don't try to lower non-gl builtins as if they were gl_FragData
Ilia Mirkin [Fri, 1 Jul 2016 23:10:36 +0000 (19:10 -0400)]
glsl: don't try to lower non-gl builtins as if they were gl_FragData

If a shader has an output array, it will get treated as though it were
gl_FragData and rewritten into gl_out_FragData instances. We only want
this to happen on the actual gl_FragData and not everything else.

This is a small part of the problem pointed out by the below bug.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96765
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit a37e46323c7e18bec4160f2f66847c10b7041dc1)

7 years agobugzilla_mesa.sh: Drop "Bug " from sed command
Emil Velikov [Thu, 7 Jul 2016 10:51:13 +0000 (11:51 +0100)]
bugzilla_mesa.sh: Drop "Bug " from sed command

After a recent Bugzilla update the word is no longer in the title. Thus
the script ended up producing bogus HTML.

Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit f35f8464ecf35de769629d316db620472a92f995)

7 years agomesa: don't install GLX files if GLX is not built
Akihiko Odaki [Sun, 26 Jun 2016 01:54:35 +0000 (10:54 +0900)]
mesa: don't install GLX files if GLX is not built

Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
[Emil Velikov: Drop guards around dri_interface.h, add stable tag]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 42968424fb4100f2035badf236b005cc8d62a592)

7 years agoosmesa: Export OSMesaCreateContextAttribs.
Mathias Fröhlich [Fri, 1 Jul 2016 05:13:46 +0000 (07:13 +0200)]
osmesa: Export OSMesaCreateContextAttribs.

Since the function is exported like any other
public api function and put in the header
as if you could link against it, export it also
from shared objects.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 13affe0d3f2756771edfab301f31dc69185f91f7)

7 years agoglsl: add driconf to zero-init unintialized vars
Rob Clark [Fri, 24 Jun 2016 18:28:51 +0000 (14:28 -0400)]
glsl: add driconf to zero-init unintialized vars

Some games are sloppy.. perhaps because it is defined behavior for DX or
perhaps because nv blob driver defaults things to zero.

So add driconf param to force uninitialized variables to default to zero.

This issue was observed with rust, from steam store.  But has surfaced
elsewhere in the past.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit f78a6b1ce398a537d77c25b1a93f156109086975)

7 years agoi965: don't drop const initializers in vector splitting
Rob Clark [Sat, 25 Jun 2016 00:03:37 +0000 (20:03 -0400)]
i965: don't drop const initializers in vector splitting

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 01ccb0d91e6f976716eb79cdb0fb11ad4d0b4fcf)

7 years agofreedreno: fix crash on smaller gpus and higher resolutions
Rob Clark [Sun, 3 Jul 2016 15:16:28 +0000 (11:16 -0400)]
freedreno: fix crash on smaller gpus and higher resolutions

Devices with smaller GMEM size need more tiles.  On db410c at 2048x1152,
glmark2 shadow needed ~330 tiles for fullscreen.  Lets bump it up to
512.  (Maybe with MRT you could end up needing more, but at that point
things are probably going to be painfully slow.)

Signed-off-by: Rob Clark <robdclark@gmail.com>
(cherry picked from commit 7295428e4183cca1840e7ed02159519734fdab0a)

7 years agoanv: vulkan: remove the anv_device.$(OBJEXT) rule
Emil Velikov [Wed, 6 Jul 2016 15:18:21 +0000 (16:18 +0100)]
anv: vulkan: remove the anv_device.$(OBJEXT) rule

Atm the actual rule will expand to foo.o which is used for static
libraries only.

Thus the automake manual recommendation [to use OBJEXT] won't help us,
since since we're working with a shared library.

Thus let's 'demote' the file and add it back to BUILT_SOURCES. This will
manage all the complexity for us, at the (existing expense) of working
only with the all, check and install targets.

The crazy (why the issue was hard to spot):
If the dependencies (.deps/*.Plo) are already created one can alter the
anv_device.$(OBJEXT) line and/or nuke it all together. That won't lead
to any warnings/issues, even though the Makefile is regenerated.

Moral of the story:
Always rm -rf top_builddir or don't resolve the dependencies manually
and use BUILT_SOURCES.

Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96825
Fixes: d7a604c3f7a ("anv: use cache uuid based on the build timestamp.")
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Mark Janes <mark.a.janes@intel.com>
(cherry picked from commit 9618e2a24c18b5bbc9ff872d1f6870261d14dee5)

7 years agoanv: install the intel_icd.json to ${datarootdir} by default
Emil Velikov [Fri, 24 Jun 2016 15:35:05 +0000 (16:35 +0100)]
anv: install the intel_icd.json to ${datarootdir} by default

As mentioned by the spec (and used by Archlinux and Debian) default to
${datarootdir} as opposed to ${sysconfdir} for the default location.

Cc: Jason Ekstrand <jason@jlekstrand.net>
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 cbc37f72e3d0d50a2200d6e6520e22dd5992adb5)

7 years agoswr: automake: don't ship LLVM version specific generated sources
Emil Velikov [Fri, 1 Jul 2016 16:17:13 +0000 (17:17 +0100)]
swr: automake: don't ship LLVM version specific generated sources

Otherwise things will fail to build, if the builder is using another
version of LLVM.

v2: annotate all the dependencies of builder_gen.h
v3: clean the generated files as needed
v4: comment cleanups (Tim)

Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Tested-by: Tim Rowley <timothy.o.rowley@intel.com>
Tested-by: Chuck Atkins <chuck.atkins@kitware.com> (v2)
Reported-by: Chuck Atkins <chuck.atkins@kitware.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 744d0d8f3b03b43de19941595f9bd900c7e4b510)