platform/upstream/mesa.git
8 years agofreedreno/a4xx: use generic clear path
Rob Clark [Thu, 11 Aug 2016 16:00:52 +0000 (12:00 -0400)]
freedreno/a4xx: use generic clear path

Signed-off-by: Rob Clark <robdclark@gmail.com>
8 years agofreedreno/a3xx: use generic clear path
Rob Clark [Thu, 11 Aug 2016 15:59:51 +0000 (11:59 -0400)]
freedreno/a3xx: use generic clear path

Signed-off-by: Rob Clark <robdclark@gmail.com>
8 years agofreedreno: support for using generic clear path
Rob Clark [Thu, 11 Aug 2016 15:57:28 +0000 (11:57 -0400)]
freedreno: support for using generic clear path

Since clears are more or less just normal draws, there isn't that much
benefit in having hand-rolled clear path.  Add support to use u_blitter
instead if gen specific backend doesn't implement ctx->clear().

Signed-off-by: Rob Clark <robdclark@gmail.com>
8 years agogallium/u_blitter: split out a helper for common clear state
Rob Clark [Sat, 13 Aug 2016 14:51:51 +0000 (10:51 -0400)]
gallium/u_blitter: split out a helper for common clear state

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/u_blitter: add helper to save FS const buffer state
Rob Clark [Sat, 13 Aug 2016 14:36:00 +0000 (10:36 -0400)]
gallium/u_blitter: add helper to save FS const buffer state

Not (currently) state that is overwridden by u_blitter itself, but
drivers with custom blit/clear which are reusing part of the u_blitter
infrastructure will use it.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/u_blitter: export some functions
Rob Clark [Sat, 13 Aug 2016 14:35:23 +0000 (10:35 -0400)]
gallium/u_blitter: export some functions

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoegl/dri2: dri2_make_current: Release previous context's display
Nicolas Boichat [Thu, 11 Aug 2016 08:43:32 +0000 (16:43 +0800)]
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>
8 years agost/vdpau: change the order in which filters are applied(v3)
Nayan Deshmukh [Fri, 12 Aug 2016 14:02:51 +0000 (19:32 +0530)]
st/vdpau: change the order in which filters are applied(v3)

Apply the median and matrix filter before the compostioning
we apply the deinterlacing first to avoid the extra overhead
in processing the past and the future surfaces in deinterlacing.

v2: apply the filters on all the surfaces (Christian)
v3: use get_sampler_view_planes() instead of
    get_sampler_view_components() and iterate over
    VL_MAX_SURFACES (Christian)

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoglcpp: Update tests for new #undef of built-in macro rules.
Kenneth Graunke [Mon, 15 Aug 2016 04:00:31 +0000 (21:00 -0700)]
glcpp: Update tests for new #undef of built-in macro rules.

Ian recently changed the preprocessor to allow this in most GLSL
versions, but not GLSL ES 3.00+.  This patch converts the existing
test that expects a failure to a #version 300 es shader, and adds
a #version 110 shader to make sure that it's allowed.

Fixes 'make check'.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97307
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Tested-by: Vinson Lee <vlee@freedesktop.org>
8 years agoanv: fix writemask on blit fragment shader.
Dave Airlie [Tue, 16 Aug 2016 00:00:28 +0000 (10:00 +1000)]
anv: fix writemask on blit fragment shader.

I'm not sure if anything even uses this, but I found this on radv, so
just fix it on anv for consistency.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 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>
8 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>
8 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>
8 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>
8 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>
8 years agoanv: add genX_multisample.h to the sources list(s).
Emil Velikov [Mon, 15 Aug 2016 11:10:47 +0000 (12:10 +0100)]
anv: add genX_multisample.h to the sources list(s).

Otherwise it won't end up in the release tarball.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoanv/x11: Add support for Xlib platform
Kevin Strasser [Fri, 12 Aug 2016 21:17:20 +0000 (14:17 -0700)]
anv/x11: Add support for Xlib platform

Some applications continue to use the Xlib client library and expect that
VK_KHR_xlib_surface will be available in the driver. Service these
applications by converting the Display pointer to xcb_connection_t and use
the existing xcb code in the driver.

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoglx: apple specific occurences of dummyContext check
Tapani Pälli [Tue, 7 Jun 2016 10:33:34 +0000 (13:33 +0300)]
glx: apple specific occurences of dummyContext check

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Cc: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
8 years agoglx: fix error code when there is no context bound
Bernard Kilarski [Tue, 7 Jun 2016 10:33:33 +0000 (13:33 +0300)]
glx: fix error code when there is no context bound

v2: change all related NULL checks to check against dummyContext
v3: really check for dummyContext *only* when ctx was from
    __glXGetCurrentContext
v4: cover more checks, add dummyBuffer, dummyVtable (Emil)

Signed-off-by: Bernard Kilarski <bernard.r.kilarski@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: "11.2" <mesa-stable@lists.freedesktop.org>
8 years agomesa: Remove duplicate include.
Mathias Fröhlich [Sun, 14 Aug 2016 12:03:58 +0000 (14:03 +0200)]
mesa: Remove duplicate include.

In api_validate.c stdbool.h was included twice.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agovbo: Remove always true return from vbo_bind_arrays.
Mathias Fröhlich [Sun, 14 Aug 2016 12:03:58 +0000 (14:03 +0200)]
vbo: Remove always true return from vbo_bind_arrays.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agomesa: Move check for vbo mapping into api_validate.c.
Mathias Fröhlich [Sun, 14 Aug 2016 12:03:58 +0000 (14:03 +0200)]
mesa: Move check for vbo mapping into api_validate.c.

Instead of checking for mapped buffers in vbo_bind_arrays
do this check in api_validate.c. This additionally
enables printing the draw calls name into the error
string.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agomesa: Move _mesa_all_buffers_are_unmapped to arrayobj.c.
Mathias Fröhlich [Sun, 14 Aug 2016 12:03:58 +0000 (14:03 +0200)]
mesa: Move _mesa_all_buffers_are_unmapped to arrayobj.c.

Move the function to check if all vao buffers are
unmapped into the vao implementation file.
Rename the function to _mesa_all_buffers_are_unmapped.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agovbo: Array draw must not care about glBegin/glEnd vbo mapping.
Mathias Fröhlich [Sun, 14 Aug 2016 12:03:58 +0000 (14:03 +0200)]
vbo: Array draw must not care about glBegin/glEnd vbo mapping.

In array draw do not check if the vertex buffer object that
is used to implement immediate mode glBegin/glEnd is mapped.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agonv50,nvc0: fix depth range when halfz is enabled
Ilia Mirkin [Sat, 13 Aug 2016 01:40:52 +0000 (21:40 -0400)]
nv50,nvc0: fix depth range when halfz is enabled

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97231
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
8 years agogallium/util: add helper to compute zmin/zmax for a viewport state
Ilia Mirkin [Sun, 14 Aug 2016 17:01:45 +0000 (13:01 -0400)]
gallium/util: add helper to compute zmin/zmax for a viewport state

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
8 years agovbo: allow DrawElementsBaseVertex in display lists
Ilia Mirkin [Sun, 14 Aug 2016 06:28:35 +0000 (02:28 -0400)]
vbo: allow DrawElementsBaseVertex in display lists

Looks like it was missed originally. The multi version is there already.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97331
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: mesa-stable@lists.freedesktop.org
8 years agofreedreno/a3xx+a4xx: move common VBOs to fd_context
Rob Clark [Sat, 13 Aug 2016 15:39:25 +0000 (11:39 -0400)]
freedreno/a3xx+a4xx: move common VBOs to fd_context

These are the same for a3xx and later.  (a2xx could probably use them
too, but due to limited hw support and ancient downstream kernels, it
isn't so easy to test.)

Signed-off-by: Rob Clark <robdclark@gmail.com>
8 years agofreedreno/a2xx: add missing casts to silence notices
francians@gmail.com [Tue, 9 Aug 2016 17:38:32 +0000 (19:38 +0200)]
freedreno/a2xx: add missing casts to silence notices

Signed-off-by: Francesco Ansanelli <francians@gmail.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
8 years agofreedreno/ir3: fix issue with emit_tex()
Rob Clark [Thu, 11 Aug 2016 17:27:37 +0000 (13:27 -0400)]
freedreno/ir3: fix issue with emit_tex()

For various tex fetch instructions, coord's get fixed up in different
ways.  But modifying the array returned from get_src() has side-effects
if the same SSA src is used again.. the later instruction will see the
previous fixups.

Fix this, and const'ify things to prevent this sort of mistake in the
future.

Noticed by Varad when adding support for txf_ms.

Signed-off-by: Rob Clark <robdclark@gmail.com>
8 years agoglsl: emit a specific error when ast_*_assign changes type
Ilia Mirkin [Sat, 9 Jul 2016 03:28:22 +0000 (23:28 -0400)]
glsl: emit a specific error when ast_*_assign changes type

For regular ast_add, we can implicitly change either a or b's type.
However in an assignment situation, the type of the lvalue is fixed. So
if the implicit conversion logic decides to change it, it means that the
rhs's type could not be converted to the lhs type.

Emit a specific error for this rather than the rather mysterious "is not
an lvalue" error that results from having a i2f or other operation as
the lvalue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96729
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agost/mesa: provide GL_OES_copy_image support by caching the original ETC data
Ilia Mirkin [Fri, 8 Jul 2016 06:44:57 +0000 (02:44 -0400)]
st/mesa: provide GL_OES_copy_image support by caching the original ETC data

The additional provision of GL_OES_copy_image is that it work for ETC.
However many desktop GPUs don't have native ETC support, so st/mesa does
the decoding by hand. Instead of discarding the compressed data, keep it
around in CPU memory. Use it when performing image copies.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: refactor duplicated etc fallback checks
Ilia Mirkin [Fri, 8 Jul 2016 03:59:03 +0000 (23:59 -0400)]
st/mesa: refactor duplicated etc fallback checks

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoglsl: look for frag data bindings with [0] tacked onto the end for arrays
Ilia Mirkin [Wed, 6 Jul 2016 23:35:16 +0000 (19:35 -0400)]
glsl: look for frag data bindings with [0] tacked onto the end for arrays

The GL spec is very unclear on this point. Apparently this is discussed
without resolution in the closed Khronos bugtracker at
https://cvs.khronos.org/bugzilla/show_bug.cgi?id=7829 . The
recommendation is to allow dropping the [0] for looking up the bindings.

The approach taken in this patch is to instead tack on [0]'s for each
arrayness level of the output's type, and doing the lookup again. That
way, for

out vec4 foo[2][2][2]

we will end up looking for bindings for foo, foo[0], foo[0][0], and
foo[0][0][0], in that order of preference.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96765
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoanv: pipeline: gen7: fix assert in debug mode
Lionel Landwerlin [Thu, 11 Aug 2016 17:25:09 +0000 (18:25 +0100)]
anv: pipeline: gen7: fix assert in debug mode

SampleMask is only 8bits long on gen7.

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

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agomesa: change state query return value for RGB565
Haixia Shi [Fri, 12 Aug 2016 22:34:09 +0000 (15:34 -0700)]
mesa: change state query return value for RGB565

The GL_BGR and GL_UNSIGNED_SHORT_5_6_5_REV are not defined anywhere in
OpenGL ES 3.2 (or earlier) specification, and there are no known extensions
in the Khronos registry that would add these enums as valid responses for
glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE) and
glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT) queries.

Note that this patch does not change the bit layout returned by the query. As
defined by the GL spec, the bit layout of GL_RGB + GL_UNSIGNED_SHORT_5_6_5 and
GL_BGR + GL_UNSIGNED_SHORT_5_6_5_REV are identical.

TEST=dEQP-GLES3.functional.state_query.integers.*

Signed-off-by: Haixia Shi <hshi@chromium.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: Stéphane Marchesin <marcheu@chromium.org>
Change-Id: I81bbc8ccdc7e125edaeae443baf6fa8fdefcc6b6

8 years agoanv/device: Add limits for InterpolationOffset
Anuj Phogat [Fri, 29 Jul 2016 00:37:20 +0000 (17:37 -0700)]
anv/device: Add limits for InterpolationOffset

Fixes the vulkan cts regression in test dEQP-VK.api.info.device.properties

Cc: Mark Janes <mark.a.janes@intel.com>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Change 8X MSAA sample mapping
Anuj Phogat [Thu, 11 Aug 2016 19:05:45 +0000 (12:05 -0700)]
i965: Change 8X MSAA sample mapping

This is required following the change in 8X sample positions.
Fixes the recently modified multisample-scaled-blit piglit tests.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Change 8x multisample positions
Anuj Phogat [Tue, 9 Aug 2016 22:41:24 +0000 (15:41 -0700)]
i965: Change 8x multisample positions

There are no standard sample positions defined in OpenGL and OpenGL
ES specs. Implementations have the freedom to pick the positions
which give plausible results. But the Vulkan 1.0 spec does define
standard sample positions for different sample counts. Defined
positions in Vulkan for all the sample counts except 8X match with
the positions we set in i965. We have an upcoming plan to share the
blorp code between OpenGL and Vulkan driver in near future. Keeping
the 8X sample positions same on both the drivers will help us move
in that direction.

Here is an argument by Neil Roberts (from commit 20250e85) against
any advantage of current 8X sample positions over the new ones:

"The comment above for the 8x sample positions says that the hardware
implements centroid interpolation by picking the centre-most sample
that is inside the primitive. That implies that it might be worthwhile
to pick a pattern that includes 0.5,0.5. However by experimentation
this doesn't seem to actually be the case. With the sample positions
in this patch, if I modify the piglit test below so that it instead
reports the centroid position, it reports 0.492188,0.421875 which
doesn't match any of the positions. If I modify the sample positions
so that they include one at exactly 0.5,0.5 it doesn't help and it
reports another position which is even further from the center for
some reason.

arb_gpu_shader5-interpolateAtSample-different

Kenneth Graunke experimented with some other patterns that have a
higher standard deviation but I think after some discussion it was
decided that it would be better to pick the same pattern as the other
graphics API in case there are games that rely on this pattern."

Observed no regressions in jenkins testing.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv: Use macro to avoid code duplication for sample positions
Anuj Phogat [Wed, 10 Aug 2016 22:22:10 +0000 (15:22 -0700)]
anv: Use macro to avoid code duplication for sample positions

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agost/mesa: BufferData should flag NewDriverState
Marek Olšák [Sun, 7 Aug 2016 00:45:30 +0000 (02:45 +0200)]
st/mesa: BufferData should flag NewDriverState

because NewDriverState is filtered depending on active shader states,
while st->dirty isn't.

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: don't update atomic, SSBO, UBO and TBO states that have no effect
Marek Olšák [Tue, 2 Aug 2016 16:38:45 +0000 (18:38 +0200)]
st/mesa: don't update atomic, SSBO, UBO and TBO states that have no effect

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: _NEW_TEXTURE & CONSTANTS shouldn't flag states that aren't used
Marek Olšák [Tue, 2 Aug 2016 14:59:41 +0000 (16:59 +0200)]
st/mesa: _NEW_TEXTURE & CONSTANTS shouldn't flag states that aren't used

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: when changing shaders, only dirty states that are affected by them
Marek Olšák [Tue, 2 Aug 2016 14:40:50 +0000 (16:40 +0200)]
st/mesa: when changing shaders, only dirty states that are affected by them

This reduces the amount of state processing that has no effect.

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: determine states used or affected by shaders at compile time
Marek Olšák [Tue, 2 Aug 2016 14:40:50 +0000 (16:40 +0200)]
st/mesa: determine states used or affected by shaders at compile time

At compile time, each shader determines which ST_NEW flags should be set
at shader bind time.

This just sets the new field for all shaders. The next commit will use it.

v2: small code unification

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (v1)
8 years agost/mesa: remove TES/TCS/GS state dirtying optimization
Marek Olšák [Tue, 2 Aug 2016 16:40:20 +0000 (18:40 +0200)]
st/mesa: remove TES/TCS/GS state dirtying optimization

This will be replaced with a better mechanism.

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: don't update clip state on VS changes if it has no effect
Marek Olšák [Tue, 2 Aug 2016 13:26:19 +0000 (15:26 +0200)]
st/mesa: don't update clip state on VS changes if it has no effect

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: don't update clip state if it has no effect
Marek Olšák [Tue, 2 Aug 2016 13:17:27 +0000 (15:17 +0200)]
st/mesa: don't update clip state if it has no effect

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agomesa: Document that _mesa_enum_to_string() returns non-null (v2)
Chad Versace [Thu, 11 Aug 2016 15:28:57 +0000 (08:28 -0700)]
mesa: Document that _mesa_enum_to_string() returns non-null (v2)

It always returns non-null, even if the number is an invalid enum.

Cc: Haixia Shi <hshi@chromium.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Change-Id: I26e8843c96130be972e66f48a49e362442e1bf97

8 years agoglsl: Fix invariant matching in GLSL 4.30 and GLSL ES 1.00.
Kenneth Graunke [Thu, 11 Aug 2016 13:12:53 +0000 (06:12 -0700)]
glsl: Fix invariant matching in GLSL 4.30 and GLSL ES 1.00.

Old languages (GLSL <= 4.20 and GLSL ES 1.00) require "invariant"
to be specified on both inputs and outputs, and match when linking.

New languages only allow outputs to be qualified as "invariant"
and remove the "invariant must match" restriction when linking
varyings (because no input can have that qualifier).

Commit 426a50e2089b12d33f5c075aa5622f64076914a3 introduced the new
behavior for ES 3.00.  It also removed the "must match" restriction
for ES 1.00 shaders, which I believe is incorrect.  This patch adds
that back, as well as making 4.30+ follow the new rules.

Thanks to Qiankun Miao for noticing this discrepancy.

Fixes a WebGL 2.0 conformance test when run in Chromium:
https://www.khronos.org/registry/webgl/sdk/tests/deqp/data/gles3/shaders/qualification_order.html?webglVersion=2

Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96971
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Tidy stream handling in merge_qualifier().
Kenneth Graunke [Thu, 11 Aug 2016 18:44:09 +0000 (11:44 -0700)]
glsl: Tidy stream handling in merge_qualifier().

The previous commit fixed xfb_buffer handling, which was largely copy
and pasted from the stream handling.  The difference is that stream
was set in input_layout_mask, so it worked.

However, that's totally rubbish: stream is only valid on geometry shader
outputs.  Presumably this was to hack around inout.  Instead, apply the
solution I used in the previous fix.

Really, we just need to separate shader interface and parameter
qualifier handling so this isn't a mess, but this patch at least
tidies it slightly.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Fix inout qualifier handling in GLSL 4.40.
Kenneth Graunke [Thu, 11 Aug 2016 18:40:25 +0000 (11:40 -0700)]
glsl: Fix inout qualifier handling in GLSL 4.40.

inout variables have q.in and q.out set.  We were trying to set
xfb_buffer = 1 for shader output variables (and inadvertantly setting
it on inout parameters, too).  But input_layout_mask doesn't have
xfb_buffer set, so it was seen as in invalid input qualifier.

This meant that all 'inout' parameters were broken.

Caught by running a WebGL conformance test in Chromium:
https://www.khronos.org/registry/webgl/sdk/tests/deqp/data/gles3/shaders/qualification_order.html?webglVersion=2

Fixes Piglit's tests/spec/glsl-4.40/compiler/inout-parameter-qualifier.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoswrast: fix active attribs with atifragshader
Miklós Máté [Sun, 26 Jun 2016 19:48:00 +0000 (13:48 -0600)]
swrast: fix active attribs with atifragshader

Only include the ones that can be used by the shader.

This fixes texture coordinates, which were completely wrong,
because WPOS was included in the list of attribs. It also
increases performance noticeably.

Signed-off-by: Miklós Máté <mtmkls@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agost/omx/dec/h264: pass default scaling lists in raster format
Indrajit Das [Tue, 9 Aug 2016 05:13:13 +0000 (10:43 +0530)]
st/omx/dec/h264: pass default scaling lists in raster format

Tested-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
8 years agoappveyor: Force Visual Studio 2013 image.
Jose Fonseca [Thu, 11 Aug 2016 13:11:00 +0000 (14:11 +0100)]
appveyor: Force Visual Studio 2013 image.

It seems the default build image is now Visual Studio 2015, and Visual
Studio 2013 is not installed.

8 years agoappveyor: Install pywin32 extensions.
Jose Fonseca [Thu, 11 Aug 2016 13:00:35 +0000 (14:00 +0100)]
appveyor: Install pywin32 extensions.

AppVeyor build images seem to have been upgraded to Python 2.7.12, but
no longer have pywin32 pre-installed.

8 years agoglsl/tests: fix segfault in uniform initializer test
Timothy Arceri [Thu, 11 Aug 2016 00:34:52 +0000 (10:34 +1000)]
glsl/tests: fix segfault in uniform initializer test

Caused by 549222f5

Tested-by: Aaron Watry <awatry@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97286

8 years agoglcpp: Only disallow #undef of pre-defined macros on GLSL ES >= 3.00 shaders
Ian Romanick [Tue, 9 Aug 2016 21:32:24 +0000 (14:32 -0700)]
glcpp: Only disallow #undef of pre-defined macros on GLSL ES >= 3.00 shaders

Section 3.4 (Preprocessor) of the GLSL ES 3.00 spec says:

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

The GLSL ES 1.00 spec does not contain this text.

Section 3.3 (Preprocessor) of the GLSL 1.30 spec says:

   #define and #undef functionality are defined as is standard for C++
   preprocessors for macro definitions both with and without macro
   parameters.

At least as far as I can tell GCC allow '#undef __FILE__'.  Furthermore,
there are desktop OpenGL conformance tests that expect '#undef
__VERSION__' and '#undef GL_core_profile' to work.

Fixes:

    GL45-CTS.shaders.preprocessor.definitions.undefine_version_vertex
    GL45-CTS.shaders.preprocessor.definitions.undefine_version_fragment
    GL45-CTS.shaders.preprocessor.definitions.undefine_core_profile_vertex
    GL45-CTS.shaders.preprocessor.definitions.undefine_core_profile_fragment

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Cc: mesa-stable@lists.freedesktop.org
8 years agoglcpp: Track the actual version instead of just the version_resolved flag
Ian Romanick [Tue, 9 Aug 2016 21:31:49 +0000 (14:31 -0700)]
glcpp: Track the actual version instead of just the version_resolved flag

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Cc: mesa-stable@lists.freedesktop.org
8 years agoglsl: remove remaining tabs in link_uniform_initializers.cpp
Timothy Arceri [Wed, 27 Jul 2016 05:20:45 +0000 (15:20 +1000)]
glsl: remove remaining tabs in link_uniform_initializers.cpp

Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoglsl: use UniformHash to find storage location
Timothy Arceri [Wed, 27 Jul 2016 05:20:44 +0000 (15:20 +1000)]
glsl: use UniformHash to find storage location

There is no need to be looping over all the uniforms.

Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoglsl: remove dead builtins before assigning varying locations
Timothy Arceri [Wed, 27 Jul 2016 05:20:43 +0000 (15:20 +1000)]
glsl: remove dead builtins before assigning varying locations

Builtins already have locations assigned so this shouldn't
change anything. We want to call it earlier so we can tranform
GLSL IR to NIR earlier.

Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoglsl: split out varying and uniform linking code
Timothy Arceri [Wed, 27 Jul 2016 05:20:42 +0000 (15:20 +1000)]
glsl: split out varying and uniform linking code

Here a new function link_varyings_and_uniforms() is created this
should help make it easier to follow the code in link_shader()
which was getting very large.

Note the end of the new function contains a for loop with some
lowering calls that currently don't seem related to varyings or
uniforms but they are a dependancy for converting to NIR ealier
so we move things here now to keep things easy to follow.

Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoi965/vec4: Make opt_vector_float reset at the top of each block
Jason Ekstrand [Wed, 20 Jul 2016 19:21:41 +0000 (12:21 -0700)]
i965/vec4: Make opt_vector_float reset at the top of each block

The pass isn't really control-flow aware and you can get into case where it
tries to combine instructions from different blocks.  This can actually
lead to an assertion failure when removing unneeded instructions if part of
the vector is set in one block and part in another.  This prevents
regressions in the next commit.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
8 years agomesa: Use a temporary set to track whether we've added a resource yet.
Eric Anholt [Tue, 9 Aug 2016 07:43:15 +0000 (00:43 -0700)]
mesa: Use a temporary set to track whether we've added a resource yet.

Saves another .1s on servo.trace.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoprog_hash_table: Convert to using util/hash_table.h.
Eric Anholt [Tue, 9 Aug 2016 07:11:13 +0000 (00:11 -0700)]
prog_hash_table: Convert to using util/hash_table.h.

Improves glretrace -b servo.trace (a trace of Mozilla's servo rendering
engine booting, rendering a page, and exiting) from 1.8s to 1.1s.  It uses
a large uniform array of structs, making a huge number of separate program
resources, and the fixed-size hash table was killing it.  Given how many
times we've improved performance by swapping the hash table to
util/hash_table.h, just do it once and for all.

This just rebases the old hash table API on top of util/, for minimal
diff.  Cleaning things up is left for later, particularly because I want
to fix up the new hash table API a little bit.

v2: Add UNUSED to the now-unused parameter.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoprog_hash_table: Convert compare funcs to match util/hash_table.h.
Eric Anholt [Tue, 9 Aug 2016 07:02:44 +0000 (00:02 -0700)]
prog_hash_table: Convert compare funcs to match util/hash_table.h.

I'm going to replace this hash table with util/hash_table.h, and the first
step is to compare things the same way.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agonir: Drop an unused program/hash_table.h include.
Eric Anholt [Tue, 9 Aug 2016 06:50:52 +0000 (23:50 -0700)]
nir: Drop an unused program/hash_table.h include.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoswr: [rasterizer core] unused variable warning fixes
Tim Rowley [Tue, 9 Aug 2016 22:23:19 +0000 (17:23 -0500)]
swr: [rasterizer core] unused variable warning fixes

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer jitter] add core string to JitManager
Tim Rowley [Tue, 9 Aug 2016 21:29:06 +0000 (15:29 -0600)]
swr: [rasterizer jitter] add core string to JitManager

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] fix OOB check of viewport indices
Tim Rowley [Tue, 9 Aug 2016 16:36:58 +0000 (10:36 -0600)]
swr: [rasterizer core] fix OOB check of viewport indices

Use correct comparison intrinsic for OOB check of viewport indices.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer common] add linux definition for InterlockedAdd64
Tim Rowley [Tue, 9 Aug 2016 06:44:39 +0000 (00:44 -0600)]
swr: [rasterizer common] add linux definition for InterlockedAdd64

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer jitter] add VMASKSTOREPS intrinsic
Tim Rowley [Mon, 8 Aug 2016 23:42:42 +0000 (17:42 -0600)]
swr: [rasterizer jitter] add VMASKSTOREPS intrinsic

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer jitter] add mask support for odd format fetch
Tim Rowley [Mon, 8 Aug 2016 19:57:27 +0000 (13:57 -0600)]
swr: [rasterizer jitter] add mask support for odd format fetch

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] routing of viewport indexes through frontend
Tim Rowley [Mon, 8 Aug 2016 19:08:39 +0000 (13:08 -0600)]
swr: [rasterizer core] routing of viewport indexes through frontend

Viewport transform performed based on per-prim viewport index if available.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] split FE and BE stats
Tim Rowley [Sun, 7 Aug 2016 02:10:14 +0000 (20:10 -0600)]
swr: [rasterizer core] split FE and BE stats

Separated FE stats out into its own structure.  There are 17 FE vs 3 BE
stat fields.  Since there is only one FE thread per DC then we don't have
to loop over all threads and sum up FE stats over all the worker threads.
This also reduces size of DC since we only need to store one copy of the
FE stats and not one per worker.  Finally, we can use the new FE callback
mechanism to update these.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] remove all old stats code
Tim Rowley [Fri, 5 Aug 2016 22:45:41 +0000 (16:45 -0600)]
swr: [rasterizer core] remove all old stats code

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] viewport array support
Tim Rowley [Fri, 5 Aug 2016 22:42:24 +0000 (16:42 -0600)]
swr: [rasterizer core] viewport array support

Change viewport matrix storage from AOS to SOA to support viewport arrays.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer jitter] fetch support for offsetting VertexID
Tim Rowley [Fri, 5 Aug 2016 22:19:10 +0000 (16:19 -0600)]
swr: [rasterizer jitter] fetch support for offsetting VertexID

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] fundamentally change how stats work
Tim Rowley [Fri, 5 Aug 2016 17:17:25 +0000 (11:17 -0600)]
swr: [rasterizer core] fundamentally change how stats work

Add a per draw stats callback to update driver stats.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] add rasterizerSampleCount to PS context
Tim Rowley [Thu, 4 Aug 2016 23:37:19 +0000 (17:37 -0600)]
swr: [rasterizer core] add rasterizerSampleCount to PS context

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] remove cygwin threads.cpp stubs
Tim Rowley [Thu, 4 Aug 2016 19:06:49 +0000 (13:06 -0600)]
swr: [rasterizer core] remove cygwin threads.cpp stubs

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] allow override of KNOB thread settings
Tim Rowley [Wed, 3 Aug 2016 23:59:37 +0000 (17:59 -0600)]
swr: [rasterizer core] allow override of KNOB thread settings

- Remove HYPERTHREADED_FE support
- Add threading info as optional data passed to SwrCreateContext.
  If supplied this data will override any KNOB thread settings.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] add SwrWaitForIdleFE
Tim Rowley [Wed, 3 Aug 2016 22:40:27 +0000 (16:40 -0600)]
swr: [rasterizer core] add SwrWaitForIdleFE

This is a blocking call that waits until all FE work is complete.
This is useful for waiting for FE work to complete such as for streamout.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] change threadsDone to be a 32-bit value.
Tim Rowley [Wed, 3 Aug 2016 21:22:20 +0000 (15:22 -0600)]
swr: [rasterizer core] change threadsDone to be a 32-bit value.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] update trivial accept test conditions
Tim Rowley [Tue, 2 Aug 2016 21:07:24 +0000 (15:07 -0600)]
swr: [rasterizer core] update trivial accept test conditions

enable/disable raster tile trivial accept test based on scissor enable trait.
Can be optimized further.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] improve implementation for SoWriteOffset
Tim Rowley [Tue, 2 Aug 2016 19:16:52 +0000 (13:16 -0600)]
swr: [rasterizer core] improve implementation for SoWriteOffset

1. SoWriteOffset is no longer treated as a stat
2. Added callback from core to update streamout write offset

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer common] make disabled asserts always print (but not break)
Tim Rowley [Tue, 2 Aug 2016 00:10:18 +0000 (18:10 -0600)]
swr: [rasterizer common] make disabled asserts always print (but not break)

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agovl/rbsp: add a check for emulation prevention three byte
Leo Liu [Mon, 8 Aug 2016 20:01:23 +0000 (16:01 -0400)]
vl/rbsp: add a check for emulation prevention three byte

This is the case when the "00 00 03" is very close to the beginning of
nal unit header

v2: move the check to rbsp init

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoRe-apply "glsl: 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)]
Re-apply "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>
8 years agoradeonsi: set CB_COLORn_INFO.ROUND_MODE
Marek Olšák [Tue, 9 Aug 2016 10:58:25 +0000 (12:58 +0200)]
radeonsi: set CB_COLORn_INFO.ROUND_MODE

just do what the register spec says

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
8 years agoradeonsi: set CB_COLORn_INFO.SIMPLE_FLOAT
Marek Olšák [Tue, 9 Aug 2016 10:49:51 +0000 (12:49 +0200)]
radeonsi: set CB_COLORn_INFO.SIMPLE_FLOAT

This can help enable some blend optimizations (see the register spec).
Vulkan always sets this.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
8 years agoradeonsi: disallow MIN/MAX blend equations for dual source blending
Marek Olšák [Tue, 9 Aug 2016 11:26:23 +0000 (13:26 +0200)]
radeonsi: disallow MIN/MAX blend equations for dual source blending

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
8 years agoradeonsi: only set dual source blending for MRT0
Marek Olšák [Tue, 9 Aug 2016 10:43:13 +0000 (12:43 +0200)]
radeonsi: only set dual source blending for MRT0

This is the proper fix for Overlord and Witcher 2 hangs.

The hang condition is that 1 app must write to MRT0 and MRT1 from a pixel
shader while MRT1 is disabled in CB_TARGET_MASK (does this generate
unflushable pixel quads? I don't know), and another app (e.g. Glamor)
must enable dual source blending in both MRT0 and MRT1. The hw gets
confused, which leads to corruption and hangs.

Cc: 12.0 11.2 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
8 years agost/mesa: in ATI fs don't assume TEMP0=REG0
Miklós Máté [Sun, 7 Aug 2016 22:48:31 +0000 (00:48 +0200)]
st/mesa: in ATI fs don't assume TEMP0=REG0

The temporaries are allocated dynamically.

Signed-off-by: Miklós Máté <mtmkls@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/nine: Fix invalid attempt to use indirect draws.
Trevor Davenport [Wed, 10 Aug 2016 03:28:07 +0000 (20:28 -0700)]
st/nine: Fix invalid attempt to use indirect draws.

Since commit 6d7177f01b231e9fe79a558c28d2b562a218d7ea, radeonsi
would take a different path if info->indirect_params was not
initialized properly.  Nine was not initializating this field.

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agoutil: Use win32 intrinsics for util_last_bit if present.
Mathias Fröhlich [Sat, 6 Aug 2016 05:26:51 +0000 (07:26 +0200)]
util: Use win32 intrinsics for util_last_bit if present.

v2: Split into two patches.
v3: Fix off by one problem.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
8 years agogallium/radeon: use unflushed fences for deferred flushes (v2)
Marek Olšák [Mon, 1 Aug 2016 22:48:04 +0000 (00:48 +0200)]
gallium/radeon: use unflushed fences for deferred flushes (v2)

+23% Bioshock Infinite performance.

v2: - use the new fence_finish interface
    - allow deferred fences with multiple contexts
    - clear the ctx pointer after a deferred flush

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: set the ctx parameter of fence_finish
Marek Olšák [Sat, 6 Aug 2016 15:00:20 +0000 (17:00 +0200)]
st/mesa: set the ctx parameter of fence_finish

for deferred flushes

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium: add a pipe_context parameter to fence_finish
Marek Olšák [Sat, 6 Aug 2016 14:41:42 +0000 (16:41 +0200)]
gallium: add a pipe_context parameter to fence_finish

required by glClientWaitSync (GL 4.5 Core spec) that can optionally flush
the context

Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>