mesa.git
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>
8 years agost/mesa: use PIPE_USAGE_STREAM for GL_CLIENT_STORAGE_BIT without READ_BIT (v2)
Marek Olšák [Fri, 5 Aug 2016 21:33:52 +0000 (23:33 +0200)]
st/mesa: use PIPE_USAGE_STREAM for GL_CLIENT_STORAGE_BIT without READ_BIT (v2)

v2: keep STAGING for GL_MAP_READ_BIT

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agogallium/radeon: add HUD queries for mapped VRAM/GTT
Marek Olšák [Thu, 4 Aug 2016 23:38:23 +0000 (01:38 +0200)]
gallium/radeon: add HUD queries for mapped VRAM/GTT

mainly for monitoring visible VRAM congestion

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agowinsys/radeon: track the amount of mapped memory
Marek Olšák [Thu, 4 Aug 2016 23:28:17 +0000 (01:28 +0200)]
winsys/radeon: track the amount of mapped memory

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agowinsys/amdgpu: track the amount of mapped memory
Marek Olšák [Thu, 4 Aug 2016 23:28:17 +0000 (01:28 +0200)]
winsys/amdgpu: track the amount of mapped memory

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agowinsys/amdgpu: don't try to unmap userptr buffers
Marek Olšák [Thu, 4 Aug 2016 23:18:08 +0000 (01:18 +0200)]
winsys/amdgpu: don't try to unmap userptr buffers

no app calls this AFAIK

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: increase the size of the renderer string
Marek Olšák [Thu, 4 Aug 2016 14:22:59 +0000 (16:22 +0200)]
gallium/radeon: increase the size of the renderer string

Mine is longer than 64 bytes.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: implement ARB_clear_texture (v3)
Marek Olšák [Thu, 4 Aug 2016 17:04:02 +0000 (19:04 +0200)]
gallium/radeon: implement ARB_clear_texture (v3)

Some ideas copied from Jakob Sinclair's implementation, but the color
clearing is completely different.

v2: remove leftover code, disable conditional rendering
    disable render condition cleanly

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: handle render_condition_enable for clear_rt/ds
Marek Olšák [Mon, 8 Aug 2016 22:42:14 +0000 (00:42 +0200)]
gallium/radeon: handle render_condition_enable for clear_rt/ds

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium: add render_condition_enable param to clear_render_target/depth_stencil
Marek Olšák [Mon, 8 Aug 2016 22:37:39 +0000 (00:37 +0200)]
gallium: add render_condition_enable param to clear_render_target/depth_stencil

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoegl: android: query native window default width and height (v2)
Haixia Shi [Thu, 28 Jul 2016 17:51:12 +0000 (10:51 -0700)]
egl: android: query native window default width and height (v2)

On android platform, the width and height of a native window surface may
be updated after initialization. It is therefore necessary to query android
framework for the current width and height.

v2: remove Android specific #ifdef's and just implement the fallback directly
if the platform query_surface() callback is not provided.

TEST=dEQP-EGL.functional.resize.surface_size#* on cyan-cheets

Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org> (v1)
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Chad Versace <chad@kiwitree.net>
Change-Id: I673f7d2f1d90c3bf572b30f63da537f2cae1496e

8 years agoanv/device: Enable sample shading on gen7+
Anuj Phogat [Mon, 8 Aug 2016 23:10:00 +0000 (16:10 -0700)]
anv/device: Enable sample shading on gen7+

Passes all 30 min_sample_shading tests in vulkan cts.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv/gen7_pipeline: Set multisample state using shared function
Anuj Phogat [Mon, 8 Aug 2016 21:36:40 +0000 (14:36 -0700)]
anv/gen7_pipeline: Set multisample state using shared function

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv/pipeline: Add sample locations for gen7-7.5
Anuj Phogat [Mon, 8 Aug 2016 21:53:48 +0000 (14:53 -0700)]
anv/pipeline: Add sample locations for gen7-7.5

V1: Add multisample positions (Nanley)
V2: Fix 8x sample positions to match OpenGL (Anuj)
V3: Vulkan has standard sample locations. They need not be same as
    in OpenGL. (Anuj)

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv/pipeline: Move emit_ms_state() to genX_pipeline_util.h
Anuj Phogat [Mon, 8 Aug 2016 21:48:07 +0000 (14:48 -0700)]
anv/pipeline: Move emit_ms_state() to genX_pipeline_util.h

This will help sharing multisample state setting code.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agogallium: Add c99_compat.h to u_bitcast.h
Mathias Fröhlich [Sat, 6 Aug 2016 05:26:59 +0000 (07:26 +0200)]
gallium: Add c99_compat.h to u_bitcast.h

We need this for 'inline'.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Tested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agoutil: Move _mesa_fsl/util_last_bit into util/bitscan.h
Mathias Fröhlich [Tue, 2 Aug 2016 06:46:04 +0000 (08:46 +0200)]
util: Move _mesa_fsl/util_last_bit into util/bitscan.h

As requested with the initial creation of util/bitscan.h
now move other bitscan related functions into util.

v2: Split into two patches.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Tested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agoradeonsi: enable multi-draw related pipe caps
Nicolai Hähnle [Thu, 28 Jul 2016 16:01:54 +0000 (17:01 +0100)]
radeonsi: enable multi-draw related pipe caps

This enables GL_shader_draw_parameters and GL_ARB_indirect_parameters as well
as a properly accelerated implementation of GL_ARB_multi_draw_indirect.

Enabling the feature requires a sufficiently uptodate firmware -- those have
already been released a long time ago, although this does mean that the
feature only works with the amdgpu kernel module, since the radeon module
doesn't have a way to query the firmware version.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: program additional multi draw parameters
Nicolai Hähnle [Mon, 8 Aug 2016 14:00:29 +0000 (16:00 +0200)]
radeonsi: program additional multi draw parameters

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: program the DRAWID SGPR
Nicolai Hähnle [Mon, 8 Aug 2016 13:54:50 +0000 (15:54 +0200)]
radeonsi: program the DRAWID SGPR

Note that for indirect draws, the new MULTI firmware packets are required.

There's also no need to reset last_{start_instance,sh_base_reg}, since
resetting last_base_vertex is sufficient.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: add DRAWID parameter to vertex shaders
Nicolai Hähnle [Mon, 8 Aug 2016 13:38:04 +0000 (15:38 +0200)]
radeonsi: add DRAWID parameter to vertex shaders

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: wire up TGSI_SEMANTIC_BASEINSTANCE
Nicolai Hähnle [Mon, 8 Aug 2016 13:33:14 +0000 (15:33 +0200)]
radeonsi: wire up TGSI_SEMANTIC_BASEINSTANCE

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: remove an incorrect assertion
Nicolai Hähnle [Mon, 8 Aug 2016 15:50:42 +0000 (17:50 +0200)]
radeonsi: remove an incorrect assertion

Byte indices don't need any alignment, so remove this assertion (it got moved
into a path where a piglit test hit it during the refactoring of
commit 64ff23a58c).

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: flush TC L2 cache for indirect draw data
Nicolai Hähnle [Mon, 8 Aug 2016 15:06:22 +0000 (17:06 +0200)]
radeonsi: flush TC L2 cache for indirect draw data

This fixes a bug when indirect draw data is generated by transform
feedback.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi/sid: add additional bits for the DRAW_(INDEX)_INDIRECT_MULTI packets
Nicolai Hähnle [Mon, 8 Aug 2016 13:54:56 +0000 (15:54 +0200)]
radeonsi/sid: add additional bits for the DRAW_(INDEX)_INDIRECT_MULTI packets

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: define ST_NEW_ flags as uint64_t values, not enums
Brian Paul [Mon, 8 Aug 2016 22:37:00 +0000 (16:37 -0600)]
st/mesa: define ST_NEW_ flags as uint64_t values, not enums

MSVC doesn't support 64-bit enum values, at least not with C code.
The compiler was warning:

c:\users\brian\projects\mesa\src\mesa\state_tracker\st_atom_list.h(43) : warning
 C4309: 'initializing' : truncation of constant value
c:\users\brian\projects\mesa\src\mesa\state_tracker\st_atom_list.h(44) : warning
 C4309: 'initializing' : truncation of constant value
...

And at runtime we crashed since the high 32-bits of the 'dirty' bitmask
was always 0xffffffff and the 32+u_bit_scan() index went out of bounds of
the atoms[] array.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agomesa: simplify ff fs generator a bit
Miklós Máté [Sat, 6 Aug 2016 21:34:00 +0000 (15:34 -0600)]
mesa: simplify ff fs generator a bit

Literally.

Signed-off-by: Miklós Máté <mtmkls@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agoddebug: dump driver states and shaders for apitrace calls
Marek Olšák [Sun, 7 Aug 2016 14:24:40 +0000 (16:24 +0200)]
ddebug: dump driver states and shaders for apitrace calls

I think this was an oversight when the PIPE_DUMP flags were added.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agonir: make use of nir_cf_list_extract() helper
Timothy Arceri [Fri, 5 Aug 2016 01:08:20 +0000 (11:08 +1000)]
nir: make use of nir_cf_list_extract() helper

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonir: Always print non-identity swizzles.
Matt Turner [Tue, 22 Sep 2015 17:30:05 +0000 (10:30 -0700)]
nir: Always print non-identity swizzles.

Previously we would not print a swizzle on ssa_52 when only its .x
component is used (as seen in the definition of ssa_53):

   vec3 ssa_52 = fadd ssa_51, ssa_51
   vec1 ssa_53 = flog2 ssa_52
   vec1 ssa_54 = flog2 ssa_52.y
   vec1 ssa_55 = flog2 ssa_52.z

But this makes the interpretation of the RHS of the definition difficult
to understand and dependent on the size of the LHS. Just print swizzles
when they are not the identity swizzle, so the previous example is now
printed as:

   vec3 ssa_52 = fadd ssa_51.xyz, ssa_51.xyz
   vec1 ssa_53 = flog2 ssa_52.x
   vec1 ssa_54 = flog2 ssa_52.y
   vec1 ssa_55 = flog2 ssa_52.z

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv/pipeline/gen7: Set multisample modes
Lionel Landwerlin [Mon, 8 Aug 2016 19:30:08 +0000 (20:30 +0100)]
anv/pipeline/gen7: Set multisample modes

Fixes the following failures :

dEQP-VK.api.copy_and_blit.resolve_image.whole_4_bit
dEQP-VK.api.copy_and_blit.resolve_image.whole_8_bit
dEQP-VK.api.copy_and_blit.resolve_image.partial_4_bit
dEQP-VK.api.copy_and_blit.resolve_image.partial_8_bit
dEQP-VK.api.copy_and_blit.resolve_image.with_regions_4_bit
dEQP-VK.api.copy_and_blit.resolve_image.with_regions_8_bit

Tested on IVB/HSW

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv/pipeline: rename info to rs_info in emit_rs_state
Lionel Landwerlin [Mon, 8 Aug 2016 19:30:07 +0000 (20:30 +0100)]
anv/pipeline: rename info to rs_info in emit_rs_state

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoRevert "glsl: don't try to lower non-gl builtins as if they were gl_FragData"
Marek Olšák [Mon, 8 Aug 2016 20:05:29 +0000 (22:05 +0200)]
Revert "glsl: don't try to lower non-gl builtins as if they were gl_FragData"

This reverts commit a37e46323c7e18bec4160f2f66847c10b7041dc1.

It broke the game Overlord such that it hung a GCN GNU. While I don't know
how the hang happened because of its randomness and gfx corruption precedes
it, many of the shaders contain this:

out vec4 FragData[gl_MaxDrawBuffers];

8 years agoegl/android: Add support for YV12 pixel format (v2)
Tomasz Figa [Tue, 2 Aug 2016 11:07:54 +0000 (20:07 +0900)]
egl/android: Add support for YV12 pixel format (v2)

This patch adds support for YV12 pixel format to the Android platform
backend. Only creating EGL images is supported, it is not added to the
list of available visuals.

v2: Use const array defined just for YV12 instead of trying to be overly
    generic.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
Tested-by: Rob Herring <rob@kernel.org>
Reviewed-by: Chad Versace <chad@kiwitree.net>
Change-Id: I4aeb2d67a95c5cdd10b530c549b23146c8f0b983

8 years agost/mesa: Make Gallium's BlitFramebuffer follow the GL 4.4 sRGB rules.
Kenneth Graunke [Wed, 3 Aug 2016 18:39:18 +0000 (11:39 -0700)]
st/mesa: Make Gallium's BlitFramebuffer follow the GL 4.4 sRGB rules.

OpenGL 4.4 specifies that BlitFramebuffer should perform sRGB encode
and decode like ES 3.x does, but only when GL_FRAMEBUFFER_SRGB is
enabled.  This is technically incompatible in certain cases, but is
more consistent across GL, ES, and WebGL, and more flexible.

The NVIDIA 367.35 drivers appear to follow this behavior.

For the awful spec analysis, please read Piglit's
tests/spec/arb_framebuffer_srgb/blit.c, which explains the differences
between GL 4.1, 4.2, 4.3 (2012), 4.3 (2013), and 4.4, and why this
is the right rule to implement.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agometa: Make Meta's BlitFramebuffer() follow the GL 4.4 sRGB rules.
Kenneth Graunke [Tue, 2 Aug 2016 23:32:52 +0000 (16:32 -0700)]
meta: Make Meta's BlitFramebuffer() follow the GL 4.4 sRGB rules.

Just avoid whacking GL_FRAMEBUFFER_SRGB altogether, so we respect
the application's setting.  This appears to work.

v2: Update one more comment (requested by Ian).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Make BLORP's BlitFramebuffer follow the GL 4.4 sRGB rules.
Kenneth Graunke [Tue, 2 Aug 2016 04:56:38 +0000 (21:56 -0700)]
i965: Make BLORP's BlitFramebuffer follow the GL 4.4 sRGB rules.

OpenGL 4.4 specifies that BlitFramebuffer should perform sRGB encode
and decode like ES 3.x does, but only when GL_FRAMEBUFFER_SRGB is
enabled.  This is technically incompatible in certain cases, but is
more consistent across GL, ES, and WebGL, and more flexible.

The NVIDIA 367.35 drivers appear to follow this behavior.

For the awful spec analysis, please read Piglit's
tests/spec/arb_framebuffer_srgb/blit.c, which explains the differences
between GL 4.1, 4.2, 4.3 (2012), 4.3 (2013), and 4.4, and why this
is the right rule to implement.

Note that ctx->Color.sRGBEnabled is initialized to _mesa_is_gles(ctx),
and ES doesn't have enable/disable flags for GL_FRAMEBUFFER_SRGB, so
it's effectively on all the time.  This means the ES behavior should
be unchanged.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Make BLORP do sRGB encode/decode on ES 2 as well.
Kenneth Graunke [Wed, 3 Aug 2016 06:48:47 +0000 (23:48 -0700)]
i965: Make BLORP do sRGB encode/decode on ES 2 as well.

This should have no effect, as all drivers which support BLORP also
support ES 3.0 - so ES 2.0 would be promoted and follow the ES 3 rules.

ES 1.0 doesn't have BlitFramebuffer.

This is purely to clarify the next patch a bit.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoRevert "st/mesa: use sRGB formats for MSAA resolving if destination is sRGB"
Kenneth Graunke [Wed, 3 Aug 2016 18:32:21 +0000 (11:32 -0700)]
Revert "st/mesa: use sRGB formats for MSAA resolving if destination is sRGB"

This reverts commit 4e549ddb500cf677b6fa16d9ebdfa67cc23da097,
dropping the hack from Gallium that I just deleted from i965.

See the previous commit for rationale.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoi965: Drop the "do resolves in sRGB" hack.
Kenneth Graunke [Tue, 2 Aug 2016 18:04:01 +0000 (11:04 -0700)]
i965: Drop the "do resolves in sRGB" hack.

I've never quite understood the purpose of this hack - supposedly,
doing resolves in the sRGB colorspace is slightly more accurate.

Currently, BlitFramebuffer() ignores sRGB encoding and decoding
on OpenGL, although it encodes and decodes in GLES 3.x.

The updated OpenGL 4.4 rules also allow for encoding and decoding
if GL_FRAMEBUFFER_SRGB is enabled, allowing the application to
control what colorspace blits are done in.  I don't think this hack
makes any sense in such a world - the application can do what it
wants, and we shouldn't second guess them.

A related Piglit patch, "Make multisample accuracy test set
GL_FRAMEBUFFER_SRGB when resolving." makes the Piglit MSAA accuracy
test explicitly request SRGB encoding/decoding during resolves when
running "srgb" subtests.  Without that patch, this commit will regress
those tests, but with it, they should continue to work just fine.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Bail on the BLT path if BlitFramebuffer requires sRGB conversion.
Kenneth Graunke [Wed, 3 Aug 2016 03:58:30 +0000 (20:58 -0700)]
i965: Bail on the BLT path if BlitFramebuffer requires sRGB conversion.

Modern OpenGL BlitFramebuffer require sRGB encode/decode when
GL_FRAMEBUFFER_SRGB is enabled.  The blitter can't handle this,
so we need to bail.  On Gen4-5, this means falling back to Meta,
which should handle it.

We allow sRGB <-> sRGB blits, as decode then encode ought to be a noop
(other than potential precision loss, which nobody wants anyway).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoegl/android: Make get_fourcc() accept HAL formats
Tomasz Figa [Tue, 2 Aug 2016 11:07:53 +0000 (20:07 +0900)]
egl/android: Make get_fourcc() accept HAL formats

There are DRI_IMAGE_FOURCC macros, for which there are no corresponding
DRI_IMAGE_FORMAT macros. To support such formats we need to make the
lookup function take the native format directly. As a side effect, it
simplifies all existing calls to this function, because they all called
get_format() first to convert from native to DRI_IMAGE_FORMAT.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Rob Herring <rob@kernel.org>
Reviewed-by: Chad Versace <chad@kiwitree.net>
Change-Id: I4674000fb5ccfd02e38b8fa89bc567ac1d4fc16b

8 years agoegl/android: Refactor image creation to separate flink and prime paths (v2)
Tomasz Figa [Tue, 2 Aug 2016 11:07:52 +0000 (20:07 +0900)]
egl/android: Refactor image creation to separate flink and prime paths (v2)

This patch splits current dri2_create_image_android_native_buffer() into
main entry point and two additional functions, one for creating an image
from flink name and one for handling prime FDs using the generic DMA-buf
path. This makes the code cleaner and also prepares for disabling flink
path more easily in the future.

v2: Split into separate patch.
    Add error messages.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Rob Herring <rob@kernel.org>
Reviewed-by: Chad Versace <chad@kiwitree.net>
Change-Id: Ifdfb5927399d56992fe707160423c29278f49172

8 years agoegl/android: Respect buffer mask in droid_image_get_buffers (v2)
Tomasz Figa [Tue, 2 Aug 2016 11:07:50 +0000 (20:07 +0900)]
egl/android: Respect buffer mask in droid_image_get_buffers (v2)

Drivers can request different set of buffers depending on the buffer
mask they pass to the get_buffers callback. This patch makes
droid_image_get_buffers() respect this mask.

v2: Return error only in case of real error condition and ignore requests
    of unavailable buffers.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Rob Herring <rob@kernel.org>
Reviewed-by: Chad Versace <chad@kiwitree.net>
Change-Id: I6c3c4eca90f4c618579f6725dec323c004cb44ba

8 years agoegl/android: Remove unused variables in droid_get_buffers_with_format()
Tomasz Figa [Tue, 2 Aug 2016 11:07:49 +0000 (20:07 +0900)]
egl/android: Remove unused variables in droid_get_buffers_with_format()

Fix compilation warnings due to unused variables left after some earlier
code changes.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Rob Herring <rob@kernel.org>
Reviewed-by: Chad Versace <chad@kiwitree.net>
Change-Id: Iec09eb2a62887f3a38dff156756ed8385f3f3447

8 years agoanv/pipeline/gen7: Set the depth format in 3DSTATE_SF
Jason Ekstrand [Sat, 6 Aug 2016 16:11:53 +0000 (09:11 -0700)]
anv/pipeline/gen7: Set the depth format in 3DSTATE_SF

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>