mesa.git
7 years agoglsl: don't lose uniform values when falling back to full compile
Timothy Arceri [Wed, 27 Apr 2016 05:41:19 +0000 (15:41 +1000)]
glsl: don't lose uniform values when falling back to full compile

Here we skip the recreation of uniform storage if we are relinking
after a cache miss. This is improtant because uniform values may
have already been set by the application and we don't want to reset
them.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: don't reference shader prog data during cache fallback
Timothy Arceri [Sun, 20 Nov 2016 06:48:27 +0000 (17:48 +1100)]
glsl: don't reference shader prog data during cache fallback

We already have a reference.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa/glsl: add cache_fallback flag to gl_shader_program_data
Timothy Arceri [Sun, 20 Nov 2016 01:47:00 +0000 (12:47 +1100)]
mesa/glsl: add cache_fallback flag to gl_shader_program_data

This will allow us to skip certain things when falling back to
a full recompile on a cache miss such as avoiding reinitialising
uniforms.

In this change we use it to avoid reading the program metadata
from the cache and skipping linking during a fallback.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add api and glsl version to hash generation for shaders
Timothy Arceri [Mon, 13 Feb 2017 00:53:30 +0000 (11:53 +1100)]
glsl: add api and glsl version to hash generation for shaders

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: cache uniform values
Timothy Arceri [Wed, 13 Apr 2016 00:28:04 +0000 (10:28 +1000)]
glsl: cache uniform values

These may be lowered constant arrays or uniform values that we set before linking
so we need to cache the actual uniform values.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: make uniform values helper available for use elsewhere
Timothy Arceri [Wed, 13 Apr 2016 05:42:04 +0000 (15:42 +1000)]
glsl: make uniform values helper available for use elsewhere

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: cache some more image metadata
Timothy Arceri [Wed, 30 Mar 2016 23:37:27 +0000 (10:37 +1100)]
glsl: cache some more image metadata

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add support for caching atomic buffers
Timothy Arceri [Sat, 26 Mar 2016 02:37:30 +0000 (13:37 +1100)]
glsl: add support for caching atomic buffers

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add shader cache support for buffer blocks
Timothy Arceri [Wed, 23 Mar 2016 02:50:08 +0000 (13:50 +1100)]
glsl: add shader cache support for buffer blocks

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: store subroutine remap table in shader cache
Timothy Arceri [Tue, 12 Apr 2016 05:10:24 +0000 (15:10 +1000)]
glsl: store subroutine remap table in shader cache

V2: use new helpers to store/restore table entries.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add support for caching subroutines
Timothy Arceri [Tue, 22 Mar 2016 10:54:27 +0000 (21:54 +1100)]
glsl: add support for caching subroutines

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add support for caching shaders with xfb qualifiers
Timothy Arceri [Mon, 23 Jan 2017 21:34:23 +0000 (08:34 +1100)]
glsl: add support for caching shaders with xfb qualifiers

For now this disables the shader cache when transform feedback is
enabled via the GL API as we don't currently allow for it when
generating the sha for the shader.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add shader cache support for samplers
Timothy Arceri [Sat, 19 Mar 2016 03:42:46 +0000 (14:42 +1100)]
glsl: add shader cache support for samplers

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add basic support for resource list to shader cache
Timothy Arceri [Fri, 18 Mar 2016 10:51:49 +0000 (21:51 +1100)]
glsl: add basic support for resource list to shader cache

This initially adds support for simple uniforms and varyings.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: fix uniform remap table cache when explicit locations used
Timothy Arceri [Tue, 12 Apr 2016 07:20:49 +0000 (17:20 +1000)]
glsl: fix uniform remap table cache when explicit locations used

V2: don't store pointers use an enum instead to flag what should be
restored. Also do the work in a helper that we will later use for
the subroutine remap table.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: Serialize three additional hash tables with program metadata
Carl Worth [Thu, 13 Nov 2014 07:57:15 +0000 (23:57 -0800)]
glsl: Serialize three additional hash tables with program metadata

The three additional tables are AttributeBindings, FragDataBindings,
and FragDataIndexBindings.

The first table (AttributeBindings) was identified as missing by
trying to test the shader cache with a program that called
glGetAttribLocation.

Many thanks to Tapani Pälli <tapani.palli@intel.com>, as it was review
of related work that he had done previously that pointed me to the
necessity to also save and restore FragDataBindings and
FragDataIndexBindings.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: use correct shader source in case of cache fallback
Timothy Arceri [Sun, 12 Feb 2017 22:34:54 +0000 (09:34 +1100)]
glsl: use correct shader source in case of cache fallback

The scenario is:

glShaderSource
glCompileShader <-- deferred due to cache hit of shader

glShaderSource <-- with new source code

glAttachShader
glLinkProgram <-- no cache hit for program

At this point we need to compile the original source when we
fallback.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: make use of on disk shader cache
Timothy Arceri [Mon, 23 Jan 2017 21:39:13 +0000 (08:39 +1100)]
glsl: make use of on disk shader cache

The hash key for glsl metadata is a hash of the hashes of each GLSL
source string.

This commit uses the put_key/get_key support in the cache put the SHA-1
hash of the source string for each successfully compiled shader into the
cache. This allows for early, optimistic returns from glCompileShader
(if the identical source string had been successfully compiled in the past),
in the hope that the final, linked shader will be found in the cache.

This is based on the intial patch by Carl.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add initial implementation of shader cache
Timothy Arceri [Thu, 14 Apr 2016 01:08:32 +0000 (11:08 +1000)]
glsl: add initial implementation of shader cache

This uses disk_cache.c to write out a serialization of various
state that's required in order to successfully load and use a
binary written out by a drivers backend, this state is referred to as
"metadata" throughout the implementation.

This initial version is intended to work with all stages beside
compute.

This patch is based on the initial work done by Carl.

V2: extend the file's doxygen comment to cover some of the
design decisions.

V3:
- skip cache for fixed function shaders
- add int64 support
- fix glsl IR program parameter caching/restore and cache the
  parameter values which are used by gallium backends.
- use new link status enum

V4:
- add compute program support

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: use shared emit_umsb helper.
Dave Airlie [Thu, 16 Feb 2017 03:54:19 +0000 (03:54 +0000)]
radeonsi: use shared emit_umsb helper.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/ac: use shared umsb helper.
Dave Airlie [Thu, 16 Feb 2017 03:54:01 +0000 (03:54 +0000)]
radv/ac: use shared umsb helper.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradeon/ac: add emit umsb shared code.
Dave Airlie [Thu, 16 Feb 2017 03:53:27 +0000 (03:53 +0000)]
radeon/ac: add emit umsb shared code.

Since we shared imsb, makes sense to share umsb.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradeon/ac: use llvm.amdgcn.sffbh intrinsic instead of AMDGPU.flbit.i32
Dave Airlie [Thu, 16 Feb 2017 03:46:16 +0000 (03:46 +0000)]
radeon/ac: use llvm.amdgcn.sffbh intrinsic instead of AMDGPU.flbit.i32

Use the newer intrinsic.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradeonsi: use shared emit imsb code.
Dave Airlie [Thu, 16 Feb 2017 03:43:50 +0000 (03:43 +0000)]
radeonsi: use shared emit imsb code.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/ac: use shader imsb emission code.
Dave Airlie [Thu, 16 Feb 2017 03:43:29 +0000 (03:43 +0000)]
radv/ac: use shader imsb emission code.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradeon/ac: add ac_emit_imsb helper.
Dave Airlie [Thu, 16 Feb 2017 03:42:56 +0000 (03:42 +0000)]
radeon/ac: add ac_emit_imsb helper.

We want to use a different intrinsic on newer llvm, so move this
code to a shared area.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoegl: _eglFilterArray's filter is always non-null
Emil Velikov [Wed, 15 Feb 2017 15:36:00 +0000 (15:36 +0000)]
egl: _eglFilterArray's filter is always non-null

Drop the extra handling and assert() if things change in the future.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agodocs: add hyperlink to the releasing documentation
Emil Velikov [Mon, 13 Feb 2017 13:42:21 +0000 (13:42 +0000)]
docs: add hyperlink to the releasing documentation

Other files such as xlibdriver.html and versions.html explicitly left
out, for now.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoutil/disk_cache: do not allow space in MESA_GLSL_CACHE_MAX_SIZE
Emil Velikov [Thu, 9 Feb 2017 13:35:34 +0000 (13:35 +0000)]
util/disk_cache: do not allow space in MESA_GLSL_CACHE_MAX_SIZE

No other env var used in mesa allows for space in the variable contents.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoconfigure.ac: remove unneeded trailing semicolon
Emil Velikov [Wed, 15 Feb 2017 13:07:54 +0000 (13:07 +0000)]
configure.ac: remove unneeded trailing semicolon

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agor100: use correct libdrm_radeon macro
Emil Velikov [Tue, 14 Feb 2017 00:57:24 +0000 (00:57 +0000)]
r100: use correct libdrm_radeon macro

Remove local definition of RADEON_INFO_TILE_CONFIG and use the correct
macro provided by libdrm_radeon RADEON_INFO_TILING_CONFIG.

Latter was present as of libdrm 2.4.22, sirca 2010.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agowinsys/radeon: remove fall-back defines
Emil Velikov [Tue, 14 Feb 2017 00:56:26 +0000 (00:56 +0000)]
winsys/radeon: remove fall-back defines

Provided by libdrm as of last commit.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoconfigure.ac: bump LIBDRM_RADEON requirement to 2.4.71
Emil Velikov [Tue, 14 Feb 2017 01:09:24 +0000 (01:09 +0000)]
configure.ac: bump LIBDRM_RADEON requirement to 2.4.71

Such that we can remove all the local fall-back definitions and use the
official UABI ones.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agobin/get-fixes-pick-list.sh: add new script
Emil Velikov [Sat, 11 Feb 2017 16:47:56 +0000 (16:47 +0000)]
bin/get-fixes-pick-list.sh: add new script

The script parses the "Fixes" tags and nominates respective commit if
applicable.

Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agobin/get-pick-list.sh: remove ancient way of nominating patches
Emil Velikov [Mon, 13 Feb 2017 01:37:55 +0000 (01:37 +0000)]
bin/get-pick-list.sh: remove ancient way of nominating patches

The old way of nominating patches [NOTE: .*[Cc]andidate] was
deprecated and has been unused for approx. 3 years.

Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agobin/get-pick-list.sh: limit `git grep ...' only as needed
Emil Velikov [Mon, 13 Feb 2017 00:37:03 +0000 (00:37 +0000)]
bin/get-pick-list.sh: limit `git grep ...' only as needed

Analogous to previous commit.

Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agobin/get-typod-pick-list.sh: limit `git grep ...' to only as needed
Emil Velikov [Mon, 13 Feb 2017 00:32:21 +0000 (00:32 +0000)]
bin/get-typod-pick-list.sh: limit `git grep ...' to only as needed

The currently used range HEAD..origin/master is far too broad. It looks
for nominations within the already_landed list (branchpoint..HEAD).

Similarly we look for already_landed whiting the [possible] nominations
Rand branchpoint..origin/master.

Improve things by limiting the look ups to the branch point.

Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agobin/get-extra-pick-list: rework to use already_picked list
Emil Velikov [Sat, 11 Feb 2017 12:45:21 +0000 (12:45 +0000)]
bin/get-extra-pick-list: rework to use already_picked list

Currently we loop (git log --grep) to check if the fix has landed. We
can simplify and make things faster by storing the already_picked list
and grep ping through it.

Slim down the message while we're here.

Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agobin/get-extra-pick-list: use git merge-base to get the branchpoint
Emil Velikov [Mon, 13 Feb 2017 00:13:55 +0000 (00:13 +0000)]
bin/get-extra-pick-list: use git merge-base to get the branchpoint

Since mesa development history is linear and the only diversion is at
the branchpoint. Thus we can drop the ad-hoc parsing and use git
merge-base to retrieve it.

Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agodocs: provide some tips where to obtain Mesa binaries
Emil Velikov [Sat, 11 Feb 2017 12:17:09 +0000 (12:17 +0000)]
docs: provide some tips where to obtain Mesa binaries

Mention the generic channels (PPA, Corp, other) as well as give a couple
of examples. Even if the latter became out of date the former should a
be good guide.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agodocs/submittingpatches: assorted grammar fixes
Emil Velikov [Sat, 11 Feb 2017 12:08:34 +0000 (12:08 +0000)]
docs/submittingpatches: assorted grammar fixes

Cc: Ben Crocker <bcrocker@redhat.com>
Suggested-by: Ben Crocker <bcrocker@redhat.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agodocs/releasing: update the website section
Emil Velikov [Fri, 10 Feb 2017 12:51:22 +0000 (12:51 +0000)]
docs/releasing: update the website section

Things are automated via git hooks.

Cc: Brian Paul <brianp@vmware.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
Guys, let me know when things are in place.

7 years agodocs/releasing: tweak the glxinfo/glxgear/etc. command lines
Emil Velikov [Wed, 1 Feb 2017 09:31:56 +0000 (09:31 +0000)]
docs/releasing: tweak the glxinfo/glxgear/etc. command lines

Print only the information needed. Namely:
*info: the DRI module picked and the vendor/renderer strings
*gears: everything but the "...configuration file..." line(s)

v2: (Eric) Use "2>&1 |" over "|&", properly escape &.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs/releasing: build test the scons/mingw build
Emil Velikov [Wed, 1 Feb 2017 08:42:14 +0000 (08:42 +0000)]
docs/releasing: build test the scons/mingw build

We had multiple cases in the past where files used only by the
Scons/MinGW/Windows build were missing.

Avoid such instances and add a step to catch them early.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agonir: handle some 64-bit integer conversions
Dave Airlie [Wed, 15 Feb 2017 08:40:21 +0000 (18:40 +1000)]
nir: handle some 64-bit integer conversions

These are enough for the spir-v generator to handle UConvert
and SConvert operations, and fix the 4 tests in CTS.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agonir: handle 64-bit integer types in glsl->nir type conversion.
Dave Airlie [Wed, 15 Feb 2017 08:26:46 +0000 (18:26 +1000)]
nir: handle 64-bit integer types in glsl->nir type conversion.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agospirv: handle SpvOpUConvert in proper place.
Dave Airlie [Wed, 15 Feb 2017 08:25:52 +0000 (18:25 +1000)]
spirv: handle SpvOpUConvert in proper place.

This was falling into the quantizetof16 path.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agospirv: add support for Int64 capability
Dave Airlie [Wed, 15 Feb 2017 04:39:43 +0000 (04:39 +0000)]
spirv: add support for Int64 capability

This just adds the support at the spirv->nir level for the Int64
cap.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agospirv/nir: add support for int64
Dave Airlie [Wed, 15 Feb 2017 04:51:56 +0000 (04:51 +0000)]
spirv/nir: add support for int64

This adds the spirv->nir conversion for int64 types.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agonir/types: add C accessors for 64-bit integer types.
Dave Airlie [Wed, 15 Feb 2017 04:51:02 +0000 (04:51 +0000)]
nir/types: add C accessors for 64-bit integer types.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: add fast color clear for b10g11r11
Dave Airlie [Wed, 15 Feb 2017 02:26:57 +0000 (02:26 +0000)]
radv: add fast color clear for b10g11r11

This is used in DOOM, so provide the fast clear path for it.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agomesa: retain gl_shader_programs after glDeleteProgram if they are in use
Timothy Arceri [Thu, 26 Jan 2017 08:29:20 +0000 (19:29 +1100)]
mesa: retain gl_shader_programs after glDeleteProgram if they are in use

Fixes regressions from c505d6d852220f4aaaee161465dd2c579647e672.

Switching from using gl_shader_program to gl_program for the pipline
objects CurrentProgram array meant we were freeing gl_shader_programs
immediately after glDeleteProgram was called, but the spec states
the program should only get deleted once it is no longer in use.

To work around this we add a new ReferencedPrograms array to track
gl_shader_programs in use.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agomesa: remove tabs in dri xmlconfig.c
Timothy Arceri [Mon, 13 Feb 2017 22:03:27 +0000 (09:03 +1100)]
mesa: remove tabs in dri xmlconfig.c

Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: style fixes for dri xmlconfig.c
Timothy Arceri [Mon, 13 Feb 2017 22:03:26 +0000 (09:03 +1100)]
mesa: style fixes for dri xmlconfig.c

Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoi965: Do not use purged bo after calling glObjectUnpurgeable
Chris Wilson [Tue, 10 Jan 2017 21:23:24 +0000 (21:23 +0000)]
i965: Do not use purged bo after calling glObjectUnpurgeable

If the buffer has been freed by the kernel under memory pressure, it is
invalid to try and access the backing storage for that buffer in the
future - the backing storage is not recreated automatically. As such we
need to mark the GL object as being freed for unretained buffers and so
recreate the object on next use.

Futhermore from the GL_APPLE_object_purgeable:

    "In contrast, by calling ObjectUnpurgeableAPPLE with an <option> of
    UNDEFINED_APPLE, the application is indicating that it intends to
    recreate the contents of the storage from scratch.  Further, the
    application is is stating that it would like the GL to do only the
    minimal amount of work set PURGEABLE_APPLE to FALSE.   If
    ObjectUnpurgeableAPPLE is called with the <option> set to
    UNDEFINED_APPLE, then ObjectUnpurgeableAPPLE will return the value
    UNDEFINED_APPLE."

we must always report GL_UNDEFINED_APPLE when called with
glObjectUnpurgeable(GL_UNDEFINED_APPLE).

Testcase: piglit/object_purgeable-api-*
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoRevert "i915: Always enable GL 2.0 support."
Matt Turner [Mon, 30 Jan 2017 02:20:10 +0000 (18:20 -0800)]
Revert "i915: Always enable GL 2.0 support."

This partially reverts commit 97217a40f97cdeae0304798b607f704deb0c3558.
It leaves ES 2.0 support in place per Ian's suggestion, because ES 2.0
is designed to work on hardware like i915.

Chrome only uses the GPU if you have GL >= 2.0, and using i915 (and
prog_execute) actually hurt performance compared with the software
paths.

7 years agoanv: Use build-id for pipeline cache UUID.
Matt Turner [Tue, 14 Feb 2017 16:21:43 +0000 (08:21 -0800)]
anv: Use build-id for pipeline cache UUID.

The --build-id=... ld flag has been present since binutils-2.18,
released 28 Aug 2007.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoutil: Add utility build-id code.
Matt Turner [Tue, 14 Feb 2017 15:29:56 +0000 (07:29 -0800)]
util: Add utility build-id code.

Provides the ability to read the .note.gnu.build-id section of ELF
binaries, which is inserted by the --build-id=... flag to ld.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoradv: Add support for shaderStorageImageReadWithoutFormat.
Bas Nieuwenhuizen [Wed, 15 Feb 2017 00:00:07 +0000 (01:00 +0100)]
radv: Add support for shaderStorageImageReadWithoutFormat.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agospirv: Add support for SpvCapabilityStorageImageReadWithoutFormat.
Bas Nieuwenhuizen [Tue, 14 Feb 2017 23:58:41 +0000 (00:58 +0100)]
spirv: Add support for SpvCapabilityStorageImageReadWithoutFormat.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Add support for shaderStorageImageWriteWithoutFormat.
Bas Nieuwenhuizen [Tue, 14 Feb 2017 23:55:19 +0000 (00:55 +0100)]
radv: Add support for shaderStorageImageWriteWithoutFormat.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agogetteximage: Return correct error value when texure object is not found
Eduardo Lima Mitev [Wed, 15 Feb 2017 11:14:40 +0000 (12:14 +0100)]
getteximage: Return correct error value when texure object is not found

glGetTextureSubImage() and glGetCompressedTextureSubImage() are currently
returning INVALID_OPERATION error when the passed texture argument does not
correspond to an existing texture object. However, the error should be
INVALID_VALUE instead. From OpenGL 4.5 spec PDF, section '8.11. Texture
Queries', page 236:

    "An INVALID_VALUE error is generated if texture is not the name of
     an existing texture object."

Same wording applies to the compressed version.

The INVALID_OPERATION error is coming from the call to
_mesa_lookup_texture_err(). This patch uses _mesa_lookup_texture() instead
and emits the correct error in the caller.

Fixes: GL45-CTS.get_texture_sub_image.errors_test
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoutil: Fix a typo in Makefile.sources
Jason Ekstrand [Wed, 15 Feb 2017 17:24:22 +0000 (09:24 -0800)]
util: Fix a typo in Makefile.sources

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoi965: define default allow_higher_compat_version value
Lionel Landwerlin [Wed, 15 Feb 2017 16:57:50 +0000 (16:57 +0000)]
i965: define default allow_higher_compat_version value

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Fixes: 9d16f3903e2 ("driconf: add allow_higher_compat_version option")
7 years agodrirc: add allow_higher_compat_version for Tropico 5
Samuel Pitoiset [Tue, 14 Feb 2017 15:18:27 +0000 (16:18 +0100)]
drirc: add allow_higher_compat_version for Tropico 5

v2: s/force_compat_profile/allow_higher_compat_version

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agodrirc: add allow_higher_compat_version for Crookz - The Big Heist
Samuel Pitoiset [Tue, 14 Feb 2017 15:18:26 +0000 (16:18 +0100)]
drirc: add allow_higher_compat_version for Crookz - The Big Heist

v2: s/force_compat_profile/allow_higher_compat_version

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agodrirc: add allow_higher_compat_version for Worms WMD
Samuel Pitoiset [Tue, 14 Feb 2017 15:18:25 +0000 (16:18 +0100)]
drirc: add allow_higher_compat_version for Worms WMD

v2: s/force_compat_profile/allow_higher_compat_version

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agodriconf: add allow_higher_compat_version option
Samuel Pitoiset [Tue, 14 Feb 2017 15:18:24 +0000 (16:18 +0100)]
driconf: add allow_higher_compat_version option

Mesa currently doesn't allow to create 3.1+ compatibility profiles
mainly because various features are unimplemented and bugs can
happen.

However, some buggy apps request a compat profile without using
any old features unimplemented in mesa, and they fail to start.

This option should help some games to run but it's not enough
for all (eg. Dying Light).

v2: - s/force_compat_profile/allow_higher_compat_version

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: add a HUD query for monitoring the CS thread activity
Marek Olšák [Sat, 11 Feb 2017 19:24:07 +0000 (20:24 +0100)]
gallium/radeon: add a HUD query for monitoring the CS thread activity

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoanv: wsi: report presentation error per image request
Lionel Landwerlin [Fri, 10 Feb 2017 17:54:12 +0000 (17:54 +0000)]
anv: wsi: report presentation error per image request

vkQueuePresentKHR() takes VkPresentInfoKHR pointer and includes a
pResults fields which must holds the results of all the images
requested to be presented. Currently we're not filling this field.

Also as a side effect we probably want to go through all the images
rather than stopping on the first error.

This commit also makes the QueuePresentKHR() implementation return the
first error encountered.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
7 years agoegl: remove duplicate 0 assignment
Eric Engestrom [Tue, 14 Feb 2017 22:21:47 +0000 (22:21 +0000)]
egl: remove duplicate 0 assignment

The memset on the line before already takes care of this.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoglx/glvnd: Fix GLXdispatchIndex sorting
Hans de Goede [Mon, 6 Feb 2017 11:13:17 +0000 (12:13 +0100)]
glx/glvnd: Fix GLXdispatchIndex sorting

Commit 8bca8d89ef3b ("glx/glvnd: Fix dispatch function names and indices")
fixed the sorting of the array initializers in g_glxglvnddispatchfuncs.c
because FindGLXFunction's binary search needs these to be sorted
alphabetically.

That commit also mostly fixed the sorting of the DI_foo defines in
g_glxglvnddispatchindices.h, which is what actually matters as the
arrays are initialized using "[DI_foo] = glXfoo," but a small error
crept in which at least causes glXGetVisualFromFBConfigSGIX to not
resolve, breaking games such as "The Binding of Isaac: Rebirth" and
"Crypt of the NecroDancer" from Steam not working and possible causes
other problems too.

This commit fixes the last of the sorting errors, fixing these mentioned
games not working.

Fixes: 8bca8d89ef3b ("glx/glvnd: Fix dispatch function names and indices")
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
Cc: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoradv: also fixup event emission to not get culled.
Dave Airlie [Wed, 15 Feb 2017 00:15:39 +0000 (00:15 +0000)]
radv: also fixup event emission to not get culled.

This is possibly a bad idea, I might have to consider a better one.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoanv: Use vk_foreach_struct for handling extension structs
Jason Ekstrand [Tue, 14 Feb 2017 22:29:19 +0000 (14:29 -0800)]
anv: Use vk_foreach_struct for handling extension structs

Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoutil: Add helpers for iterating over Vulkan extension structs
Jason Ekstrand [Tue, 14 Feb 2017 23:56:54 +0000 (15:56 -0800)]
util: Add helpers for iterating over Vulkan extension structs

Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: query cmds should mark a cmd buffer as having draws.
Dave Airlie [Tue, 14 Feb 2017 23:58:09 +0000 (23:58 +0000)]
radv: query cmds should mark a cmd buffer as having draws.

This fixes a regression with the remove non-draw cmd buffers in
queries.

Fixes: 8b47b97215a radv: detect command buffers that do no work and drop them (v2)
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoglsl: Handle packed_type == ivec4[] in lower_packed_varyings().
Kenneth Graunke [Sat, 11 Feb 2017 08:25:57 +0000 (00:25 -0800)]
glsl: Handle packed_type == ivec4[] in lower_packed_varyings().

For GS input arrays, we may turn a packed_type of ivec4 into an
array of ivec4s.  We still want flat qualification.

Found by inspection.  Not known to help anything.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoanv: Implement the Skylake stencil PMA optimization
Jason Ekstrand [Thu, 2 Feb 2017 00:41:04 +0000 (16:41 -0800)]
anv: Implement the Skylake stencil PMA optimization

Unfortunately, this doesn't substantially improve the performance of any
known apps.  With Dota 2 on my Sky Lake gt4, it seems help by somewhere
between 0% and 1% but there's enough noise that it's hard to get a clear
picture.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
7 years agogenxml: Add the CACHE_MODE_0 register on gen9
Jason Ekstrand [Thu, 2 Feb 2017 00:39:32 +0000 (16:39 -0800)]
genxml: Add the CACHE_MODE_0 register on gen9

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoanv/pipeline: Be smarter about depth/stencil state
Jason Ekstrand [Fri, 9 Dec 2016 01:39:14 +0000 (17:39 -0800)]
anv/pipeline: Be smarter about depth/stencil state

It's a bit hard to measure because it almost gets lost in the noise,
but this seemed to help Dota 2 by a percent or two on my Broadwell
GT3e desktop.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
7 years agoanv/pipeline: Make a copy of VkPipelineDepthStencilStateCreateinfo
Jason Ekstrand [Fri, 9 Dec 2016 02:34:24 +0000 (18:34 -0800)]
anv/pipeline: Make a copy of VkPipelineDepthStencilStateCreateinfo

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
7 years agoanv: Add support for the PMA fix on Broadwell
Jason Ekstrand [Wed, 7 Dec 2016 01:52:14 +0000 (17:52 -0800)]
anv: Add support for the PMA fix on Broadwell

This helps Dota 2 on Broadwell by 8-9%.  I also hacked up the driver and
used the Sascha "shadowmapping" demo to get some results.  Setting
uses_kill to true dropped the framerate on the demo by 25-30%.  Enabling
the PMA fix brought it back up to around 90% of the original framerate.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
7 years agogenxml: Add the CACHE_MODE_1 register on gen8
Jason Ekstrand [Wed, 7 Dec 2016 01:51:26 +0000 (17:51 -0800)]
genxml: Add the CACHE_MODE_1 register on gen8

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoanv: Disable stencil writes when both write masks are zero
Jason Ekstrand [Thu, 8 Dec 2016 04:31:12 +0000 (20:31 -0800)]
anv: Disable stencil writes when both write masks are zero

Vulkan doesn't have a stencilWriteEnable bit like it does for depth.
Instead, you have a stencil mask.  Since the stencil mask is handled as
dynamic state, we have to handle it later during command buffer
construction.  This, combined with a later commit, seems to help Dota2
on my Broadwell GT3e desktop by a couple percent because it allows the
hardware to move the depth and stencil writes to early in more cases.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
7 years agoanv/entrypoints: Only generate entrypoints for supported features
Jason Ekstrand [Tue, 14 Feb 2017 18:24:14 +0000 (10:24 -0800)]
anv/entrypoints: Only generate entrypoints for supported features

This changes the way anv_entrypoints_gen.py works from generating a
table containing every single entrypoint in the XML to just the ones
that we actually need.  There's no reason for us to burn entrypoint
table space on a bunch of NV extensions we never plan to implement.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoanv: fix Get*MemoryRequirements for !LLC
Connor Abbott [Tue, 14 Feb 2017 17:23:59 +0000 (12:23 -0500)]
anv: fix Get*MemoryRequirements for !LLC

Even though we supported both coherent and non-coherent memory types, we
effectively forced apps to use the coherent types by accident. Found by
inspection, only compile tested.

Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
7 years agoradeonsi: implement uploading zero-stride vertex attribs
Marek Olšák [Sat, 11 Feb 2017 12:12:22 +0000 (13:12 +0100)]
radeonsi: implement uploading zero-stride vertex attribs

This is the only kind of user buffer we can get with the GL core profile.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: include SDMA in the GPU load query
Marek Olšák [Sat, 11 Feb 2017 20:21:10 +0000 (21:21 +0100)]
gallium/radeon: include SDMA in the GPU load query

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/hud: add monitoring of API thread busy status
Marek Olšák [Sat, 11 Feb 2017 19:46:02 +0000 (20:46 +0100)]
gallium/hud: add monitoring of API thread busy status

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/u_queue: add util_queue_get_thread_time_nano
Marek Olšák [Sat, 11 Feb 2017 19:51:41 +0000 (20:51 +0100)]
gallium/u_queue: add util_queue_get_thread_time_nano

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/os: add per-thread time clock queries
Marek Olšák [Sat, 11 Feb 2017 19:48:13 +0000 (20:48 +0100)]
gallium/os: add per-thread time clock queries

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: tell u_vbuf that GL core doesn't have user VBOs
Marek Olšák [Fri, 10 Feb 2017 00:12:22 +0000 (01:12 +0100)]
st/mesa: tell u_vbuf that GL core doesn't have user VBOs

I think this only affects radeonsi - VI, because all other drivers using
u_vbuf probably don't support GL_DOUBLE, so they won't be affected by this.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium: let state trackers tell u_vbuf whether user VBOs are possible
Marek Olšák [Fri, 10 Feb 2017 00:09:27 +0000 (01:09 +0100)]
gallium: let state trackers tell u_vbuf whether user VBOs are possible

This can affect whether u_vbuf will be enabled or not.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agovdpau: skip vlVdpOutputSurfacePutBitsNative with a zero-area rectangle
Marek Olšák [Sun, 12 Feb 2017 14:48:48 +0000 (15:48 +0100)]
vdpau: skip vlVdpOutputSurfacePutBitsNative with a zero-area rectangle

This prevents errors:
"EE r600_texture.c:1571 r600_texture_transfer_map - failed to create
 temporary texture to hold untiled copy"

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

Tested-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agogallium/radeon: add an assertion to texture_transfer_map for app bugs
Marek Olšák [Sun, 12 Feb 2017 14:48:31 +0000 (15:48 +0100)]
gallium/radeon: add an assertion to texture_transfer_map for app bugs

Tested-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Kai Wasserbäch <kai@dev.carbon-project.org>
7 years agoradeonsi: implement legacy GL_DOUBLE vertex formats
Marek Olšák [Fri, 10 Feb 2017 00:16:34 +0000 (01:16 +0100)]
radeonsi: implement legacy GL_DOUBLE vertex formats

so that we can disable u_vbuf for GL core profiles.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: clean up si_get_param
Marek Olšák [Sat, 11 Feb 2017 16:21:04 +0000 (17:21 +0100)]
radeonsi: clean up si_get_param

has_streamout is always true

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/hud: don't use user vertex buffers
Marek Olšák [Sat, 11 Feb 2017 22:43:20 +0000 (23:43 +0100)]
gallium/hud: don't use user vertex buffers

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/hud: call u_upload_alloc only once
Marek Olšák [Sat, 11 Feb 2017 22:20:37 +0000 (23:20 +0100)]
gallium/hud: call u_upload_alloc only once

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/u_upload_mgr: remove deprecated function u_upload_buffer
Marek Olšák [Wed, 8 Feb 2017 19:36:26 +0000 (20:36 +0100)]
gallium/u_upload_mgr: remove deprecated function u_upload_buffer

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Tested-by: Charmaine Lee <charmainel@vmware.com>