mesa.git
9 years agovk: Fix format of anv_depth_stencil_view
Chad Versace [Fri, 28 Aug 2015 14:44:32 +0000 (07:44 -0700)]
vk: Fix format of anv_depth_stencil_view

The format of the view itself and of the view's image may differ.
Moreover, if the view's format has no depth aspect but the image's
format does, we must not program the depth buffer. Ditto for stencil.

9 years agovk/gen7: Fix gen of emitted packet in gen7_batch_lri()
Chad Versace [Fri, 28 Aug 2015 14:36:28 +0000 (07:36 -0700)]
vk/gen7: Fix gen of emitted packet in gen7_batch_lri()

Emit GEN7_MI_LOAD_REGISTER_IMM, not the GEN8 version.

9 years agovk: Remove dummy anv_depth_stencil_view
Chad Versace [Fri, 28 Aug 2015 14:35:39 +0000 (07:35 -0700)]
vk: Remove dummy anv_depth_stencil_view

9 years agovk/image: Let anv_image have one anv_surface per aspect
Chad Versace [Fri, 28 Aug 2015 14:08:58 +0000 (07:08 -0700)]
vk/image: Let anv_image have one anv_surface per aspect

Split anv_image::primary_surface into two: anv_image::color_surface and
depth_surface.

9 years agospirv: Bump to the public revision 31
Jason Ekstrand [Thu, 27 Aug 2015 22:24:04 +0000 (15:24 -0700)]
spirv: Bump to the public revision 31

9 years agovk: Update to API version 0.138.2
Jason Ekstrand [Thu, 27 Aug 2015 18:41:04 +0000 (11:41 -0700)]
vk: Update to API version 0.138.2

9 years agovk/gen8: Add support for push constants
Jason Ekstrand [Thu, 27 Aug 2015 00:57:51 +0000 (17:57 -0700)]
vk/gen8: Add support for push constants

9 years agovk/private.h: Handle a NULL bo but valid offset in __gen_combine_address
Jason Ekstrand [Thu, 27 Aug 2015 00:58:22 +0000 (17:58 -0700)]
vk/private.h: Handle a NULL bo but valid offset in __gen_combine_address

9 years agovk/cmd_buffer: Set the CONSTANTS_REL_GENERAL flag on execbuf
Jason Ekstrand [Thu, 27 Aug 2015 00:56:40 +0000 (17:56 -0700)]
vk/cmd_buffer: Set the CONSTANTS_REL_GENERAL flag on execbuf

This tells the kernel that the push constant buffers are relative to the
dynamic state base address.

9 years agoHACK: Don't call nir_setup_uniforms
Jason Ekstrand [Thu, 27 Aug 2015 00:55:45 +0000 (17:55 -0700)]
HACK: Don't call nir_setup_uniforms

We're doing our own uniform setup and we don't need to call into the entire
GL stack to mess with things.

9 years agovk/compiler: Add a helper for setting up prog_data->param
Jason Ekstrand [Wed, 26 Aug 2015 23:20:34 +0000 (16:20 -0700)]
vk/compiler: Add a helper for setting up prog_data->param

This new helper sets it up the way we'll want for handling push constants.

9 years agovk: Add initial API support for setting push constants
Jason Ekstrand [Wed, 26 Aug 2015 22:01:38 +0000 (15:01 -0700)]
vk: Add initial API support for setting push constants

This doesn't add support for actually uploading them, it just ensures that
we have and update the shadow copy.

9 years agoMerge remote-tracking branch 'mesa-public/master' into vulkan
Jason Ekstrand [Wed, 26 Aug 2015 18:04:30 +0000 (11:04 -0700)]
Merge remote-tracking branch 'mesa-public/master' into vulkan

9 years agogallium/radeon: read_registers should return bool meaning success or failure
Marek Olšák [Sat, 22 Aug 2015 12:17:10 +0000 (14:17 +0200)]
gallium/radeon: read_registers should return bool meaning success or failure

Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoradeonsi: add IB parser support for CP DMA packets
Marek Olšák [Wed, 19 Aug 2015 16:45:11 +0000 (18:45 +0200)]
radeonsi: add IB parser support for CP DMA packets

If the packet encoding is defined in the same format as register definitions,
the python script can process them automatically and the parser support
becomes trivial.

Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoradeonsi: add IB tracing support for debug contexts
Marek Olšák [Wed, 19 Aug 2015 09:53:25 +0000 (11:53 +0200)]
radeonsi: add IB tracing support for debug contexts

This adds trace points to all IBs and the parser prints them and also
prints which trace points were reached (executed) by the CP.
This can help pinpoint a problematic packet, draw call, etc.

Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoradeonsi: remove old CS tracing code
Marek Olšák [Mon, 17 Aug 2015 17:17:16 +0000 (19:17 +0200)]
radeonsi: remove old CS tracing code

Some of it is left there and it will be re-used in the next commit.

Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoradeonsi: parse and dump status registers on GPU hang
Marek Olšák [Sat, 15 Aug 2015 22:54:34 +0000 (00:54 +0200)]
radeonsi: parse and dump status registers on GPU hang

GPU hang detection must be enabled by setting: GALLIUM_DDEBUG=[timeout in ms]

This may print too much information that we might not understand yet,
but some of the bits are very useful.

Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoradeonsi: add an IB parser
Marek Olšák [Sat, 15 Aug 2015 21:57:22 +0000 (23:57 +0200)]
radeonsi: add an IB parser

Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoradeonsi: save the contents of indirect buffers for debug contexts
Marek Olšák [Sat, 15 Aug 2015 10:46:17 +0000 (12:46 +0200)]
radeonsi: save the contents of indirect buffers for debug contexts

This will be used by the IB parser.

Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoradeonsi: generate register and packet tables for an IB parser from sid.h
Marek Olšák [Sat, 15 Aug 2015 21:44:04 +0000 (23:44 +0200)]
radeonsi: generate register and packet tables for an IB parser from sid.h

This makes writing a good IB parser a lot easier.

It generates 2 tables:
- packet3 table
- register table with all registers, fields, and named values

Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoradeonsi: remove duplicated register definitions and instruction definitions
Marek Olšák [Sat, 15 Aug 2015 16:48:06 +0000 (18:48 +0200)]
radeonsi: remove duplicated register definitions and instruction definitions

Instruction encoding isn't needed in Mesa.

The border color address registers were duplicated.

Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
9 years agor600g,radeonsi: remove unused ill-formed register field definitions
Marek Olšák [Sat, 15 Aug 2015 16:43:27 +0000 (18:43 +0200)]
r600g,radeonsi: remove unused ill-formed register field definitions

Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoradeonsi: add an initial dump_debug_state implementation dumping shaders
Marek Olšák [Sat, 15 Aug 2015 21:56:22 +0000 (23:56 +0200)]
radeonsi: add an initial dump_debug_state implementation dumping shaders

This is usually called after a draw call.

Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoradeonsi: allow si_dump_key to write to a file
Marek Olšák [Sat, 11 Jul 2015 11:13:07 +0000 (13:13 +0200)]
radeonsi: allow si_dump_key to write to a file

Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
9 years agogallium/ddebug: new pipe for hang detection and driver state dumping (v2)
Marek Olšák [Sat, 4 Jul 2015 12:10:21 +0000 (14:10 +0200)]
gallium/ddebug: new pipe for hang detection and driver state dumping (v2)

v2: lots of improvements

This is like identity or trace, but simpler. It doesn't wrap most states.

Run with:
  GALLIUM_DDEBUG=1000 [executable]
where "executable" is the app and "1000" is in miliseconds, meaning that
the context will be considered hung if a fence fails to signal in 1000 ms.

If that happens, all shaders, context states, bound resources, draw
parameters, and driver debug information (if any) will be dumped into:
  /home/$username/dd_dumps/$processname_$pid_$index.

Note that the context is flushed after every draw/clear/copy/blit operation
and then waited for to find the exact call that hangs.

You can also do:
  GALLIUM_DDEBUG=always
to do the dumping after every draw/clear/copy/blit operation without
flushing and waiting.

Examples of driver states that can be dumped are:
- Hardware status registers saying which hw block is busy (hung).
- Disassembled shaders in a human-readable form.
- The last submitted command buffer in a human-readable form.

v2: drop pipe-loader changes, drop SConscript
    rename dd.h -> dd_pipe.h

Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
9 years agogallium: add flags parameter to pipe_screen::context_create
Marek Olšák [Sat, 25 Jul 2015 16:40:59 +0000 (18:40 +0200)]
gallium: add flags parameter to pipe_screen::context_create

This allows creating compute-only and debug contexts.

Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
9 years agogallium: add an interface for dumping debug driver state
Marek Olšák [Sat, 11 Jul 2015 10:34:46 +0000 (12:34 +0200)]
gallium: add an interface for dumping debug driver state

Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
9 years agomesa: remove pointless es31 checks, fix indirect to only be in es31
Ilia Mirkin [Mon, 24 Aug 2015 15:34:42 +0000 (11:34 -0400)]
mesa: remove pointless es31 checks, fix indirect to only be in es31

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
9 years agomesa: uncomment checks in es31 computation, add texture_ms
Ilia Mirkin [Mon, 24 Aug 2015 13:35:04 +0000 (09:35 -0400)]
mesa: uncomment checks in es31 computation, add texture_ms

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomesa: create multisample fallback textures like normal textures
Marek Olšák [Sun, 23 Aug 2015 22:22:37 +0000 (00:22 +0200)]
mesa: create multisample fallback textures like normal textures

This works if drivers upsample on upload (like all radeon ones do).
The alternative is an unexpected GL error from anything calling
_mesa_update_state and possibly other issues.

Cc: 10.6 11.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
9 years agoradeonsi: mark unreachable paths to avoid warnings
Grazvydas Ignotas [Tue, 18 Aug 2015 00:23:29 +0000 (03:23 +0300)]
radeonsi: mark unreachable paths to avoid warnings

Otherwise we get:
warning: 'num_user_sgprs' may be used uninitialized in this function
...

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
9 years agomesa: GetTexLevelParameter{if}v changes for OpenGL ES 3.1
Tapani Pälli [Tue, 28 Jul 2015 08:25:35 +0000 (11:25 +0300)]
mesa: GetTexLevelParameter{if}v changes for OpenGL ES 3.1

Patch refactors existing parameters check to first check common enums
between desktop GL and GLES 3.1 and modifies get_tex_level_parameter_image
to be compatible with enums specified in 3.1.

v2: remove extra is_gles31() checks (suggested by Ilia)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com> (v1)
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com> (v1)
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agomesa/es3.1: Allow GL_COMPUTE_WORK_GROUP_SIZE for OpenGL ES 3.1
Marta Lofstedt [Wed, 19 Aug 2015 13:30:33 +0000 (15:30 +0200)]
mesa/es3.1: Allow GL_COMPUTE_WORK_GROUP_SIZE for OpenGL ES 3.1

According to OpenGL ES specification section 7.12,
GL_COMPUTE_WORK_GROUP_SIZE, is supported by the
glGetProgramiv function.

Signed-off-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
9 years agomesa/es3.1: Enable getting MAX_COMPUTE_WORK_GROUP_ values for OpenGL ES 3.1
Marta Lofstedt [Wed, 19 Aug 2015 13:33:21 +0000 (15:33 +0200)]
mesa/es3.1: Enable getting MAX_COMPUTE_WORK_GROUP_ values for OpenGL ES 3.1

According to the OpenGL ES 3.1 specification chapter 17, the
MAX_COMPUTE_WORK_GROUP_COUNT and MAX_COMPUTE_WORK_GROUP_SIZE
is available for glGetIntegeri_v.

Signed-off-by: Marta Lofstedt <marta.lofstedt@linux.intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
9 years agomesa/formats: pass correct parameter to _mesa_is_format_compressed
Dave Airlie [Wed, 26 Aug 2015 00:37:09 +0000 (10:37 +1000)]
mesa/formats: pass correct parameter to _mesa_is_format_compressed

commit 26c549e69d12e44e2e36c09764ce2cceab262a1b
Author: Nanley Chery <nanley.g.chery@intel.com>
Date:   Fri Jul 31 10:26:36 2015 -0700

    mesa/formats: remove compressed formats from matching function

caused a regression in my CTS testing, this looks like a clear
thinko.

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
sSigned-off-by: Dave Airlie <airlied@redhat.com>

9 years agovk/meta: Destroy vertex shaders when setting up clearing
Jason Ekstrand [Wed, 26 Aug 2015 01:51:26 +0000 (18:51 -0700)]
vk/meta: Destroy vertex shaders when setting up clearing

9 years agovk/gen8: Don't duplicate generic pipeline setup
Jason Ekstrand [Wed, 26 Aug 2015 01:32:56 +0000 (18:32 -0700)]
vk/gen8: Don't duplicate generic pipeline setup

gen8_graphics_pipeline_create had a bunch of stuff in it that's already set
up by anv_pipeline_init.  The duplication was causing double-initialization
of a state stream and made valgrind very angry.

9 years agoMerge remote-tracking branch 'mesa-public/master' into vulkan
Jason Ekstrand [Wed, 26 Aug 2015 00:12:03 +0000 (17:12 -0700)]
Merge remote-tracking branch 'mesa-public/master' into vulkan

9 years agogallium/auxiliary: optimize rgb9e5 helper some more
Roland Scheidegger [Sun, 9 Aug 2015 00:50:10 +0000 (02:50 +0200)]
gallium/auxiliary: optimize rgb9e5 helper some more

I used this as some testing ground for investigating some compiler
bits initially (e.g. lrint calls etc.), figured I could do much better
in the end just for fun...
This is mathematically equivalent, but uses some tricks to avoid
doubles and also replaces some float math with ints. Good for another
performance doubling or so. As a side note, some quick tests show that
llvm's loop vectorizer would be able to properly vectorize this version
(which it failed to do earlier due to doubles, producing a mess), giving
another 3 times performance increase with sse2 (more with sse4.1), but this
may not apply to mesa.
No piglit change.

Acked-by: Marek Olšák <marek.olsak@amd.com>
9 years agogallium/auxiliary: optimize rgb9e5 helper a bit
Roland Scheidegger [Sun, 9 Aug 2015 00:03:33 +0000 (02:03 +0200)]
gallium/auxiliary: optimize rgb9e5 helper a bit

This code (lifted straight from the extension) was doing things the most
inefficient way you could think of.
This drops some of the more expensive float operations, in particular
- int-cast floors (pointless, values always positive)
- 2 raised to (signed) integers (replace with simple exponent manipulation),
  getting rid of a misguided comment in the process (implement with table...)
- float division (replace with mul of reverse of those exponents)
This is like 3 times faster (measured for float3_to_rgb9e5), though it depends
(e.g. llvm is clever enough to replace exp2 with ldexp whereas gcc is not,
division is not too bad on cpus with early-exit divs).
Note that keeping the double math for now (float x + 0.5), as the results may
otherwise differ.

Acked-by: Marek Olšák <marek.olsak@amd.com>
9 years agomesa/texgetimage: fix missing stencil check
Dave Airlie [Sun, 23 Aug 2015 23:52:12 +0000 (09:52 +1000)]
mesa/texgetimage: fix missing stencil check

GetTexImage can read to stencil8 but only from
a stencil or depthstencil textures.

This fixes a bunch of failures in CTS
GL33-CTS.gtf32.GL3Tests.packed_pixels

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agovk/vec4: Use the right constant for offset into a UBO
Kristian Høgsberg Kristensen [Tue, 25 Aug 2015 23:14:59 +0000 (16:14 -0700)]
vk/vec4: Use the right constant for offset into a UBO

We were using constant 0, which is the set.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Use true/false for RenderCacheReadWriteMode
Kristian Høgsberg Kristensen [Tue, 25 Aug 2015 22:58:21 +0000 (15:58 -0700)]
vk: Use true/false for RenderCacheReadWriteMode

This field in surface state is a bool, WriteOnlyCache is an enum from
GEN8.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Support descriptor sets and bindings in vec4 ubo loads
Kristian Høgsberg Kristensen [Tue, 25 Aug 2015 22:57:12 +0000 (15:57 -0700)]
vk: Support descriptor sets and bindings in vec4 ubo loads

Still incomplete, but at least we get the simplest case working.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk/gen7: Enable L3 caching for GEN7 MOCS
Kristian Høgsberg Kristensen [Tue, 25 Aug 2015 22:55:56 +0000 (15:55 -0700)]
vk/gen7: Enable L3 caching for GEN7 MOCS

Do what GL does here.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agomesa/teximage: Add GL error parameter to _mesa_target_can_be_compressed
Nanley Chery [Fri, 21 Aug 2015 20:09:08 +0000 (13:09 -0700)]
mesa/teximage: Add GL error parameter to _mesa_target_can_be_compressed

Enables _mesa_target_can_be_compressed to return the appropriate GL error
depending on it's inputs. Use the parameter to return the appropriate GL error
for ETC2 formats on GLES3.

Suggested-by: Chad Versace <chad.versace@intel.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
9 years agomesa/formats: remove compressed formats from matching function
Nanley Chery [Fri, 31 Jul 2015 17:26:36 +0000 (10:26 -0700)]
mesa/formats: remove compressed formats from matching function

All compressed formats return GL_FALSE and there isn't any evidence to
support that this behaviour would change. Remove all switch cases for
compressed formats.

v2. Since the exhaustive switch is removed, add a gtest to ensure
    all formats are handled.
v3. Ensure that GL_NO_ERROR is set before returning.
v4. Fix an arg to _mesa_uncompressed_format_to_type_and_comps();
    fix formatting and misc improvements (Chad).

Reviewed-by: Chad Versace <chad.versace@intel.com>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
9 years agomesa/formats: make format testing a gtest
Nanley Chery [Tue, 18 Aug 2015 19:42:57 +0000 (12:42 -0700)]
mesa/formats: make format testing a gtest

We currently check that our format info table is sane during context
initialization in debug builds. Perform this check during
`make check` instead. This enables format testing in release builds
and removes the requirement of an exhuastive switch for
_mesa_uncompressed_format_to_type_and_comps().

v2. indentation and conditional inclusion fixes (Chad).
    allow tests to continue running if any format fails
    and display the failing format name.

Reviewed-by: Chad Versace <chad.versace@intel.com>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
9 years agogallium/ttn: Use nir_builder_insert() rather than poking at cf_list.
Kenneth Graunke [Thu, 6 Aug 2015 14:44:35 +0000 (07:44 -0700)]
gallium/ttn: Use nir_builder_insert() rather than poking at cf_list.

I intend to remove nir_builder::cf_node_list, so I can't have this code
poking at it directly.  The proper way is to set the insertion point and
then simply insert things there.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoprog_to_nir: Use nir_builder_insert() rather than poking at cf_list.
Kenneth Graunke [Thu, 6 Aug 2015 14:39:34 +0000 (07:39 -0700)]
prog_to_nir: Use nir_builder_insert() rather than poking at cf_list.

I intend to remove nir_builder::cf_node_list, so I can't have this code
poking at it directly.  The proper way is to set the insertion point and
then simply insert things there.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agonir: Use nir_shader::stage rather than passing it around.
Kenneth Graunke [Tue, 18 Aug 2015 08:53:29 +0000 (01:53 -0700)]
nir: Use nir_shader::stage rather than passing it around.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agonir: Store gl_shader_stage in nir_shader.
Kenneth Graunke [Tue, 18 Aug 2015 08:48:34 +0000 (01:48 -0700)]
nir: Store gl_shader_stage in nir_shader.

This makes it easy for NIR passes to inspect what kind of shader they're
operating on.

Thanks to Michel Dänzer for helping me figure out where TGSI stores the
shader stage information.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agovk/gen7: Use TILEWALK_XMAJOR for linear surfaces
Kristian Høgsberg Kristensen [Tue, 25 Aug 2015 17:48:43 +0000 (10:48 -0700)]
vk/gen7: Use TILEWALK_XMAJOR for linear surfaces

You wouldn't think the TileWalk mode matters when TiledSurface is
false. However, it has to be TILEWALK_XMAJOR. Make it so.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agoi965/fs: Combine assign_constant_locations and move_uniform_array_access_to_pull_cons...
Jason Ekstrand [Wed, 19 Aug 2015 00:04:53 +0000 (17:04 -0700)]
i965/fs: Combine assign_constant_locations and move_uniform_array_access_to_pull_constants

The comment above move_uniform_array_access_to_pull_constants was
completely bogus because it has nothing to do with lowering instructions.
Instead, it's assiging locations of pull constants.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir/lower_io: Remove assign_var_locations_direct_first
Jason Ekstrand [Tue, 18 Aug 2015 21:45:35 +0000 (14:45 -0700)]
nir/lower_io: Remove assign_var_locations_direct_first

This is no longer used so we might as well get rid of it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs: Rework uniform handling
Jason Ekstrand [Tue, 18 Aug 2015 19:00:15 +0000 (12:00 -0700)]
i965/fs: Rework uniform handling

Previously, we treated the entire UNIFORM file as if it had two elements:
One for direct things and one for indirect.  This is substantially
different from how the old visitor code handled it where each element was
effectively its own uniform.  This commit makes the NIR path more like the
old ir_visitor path where each uniform is separate.  This should allow us
to more easily make decisions about what to push.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/vec4_nir: Get rid of the uniform_driver_location tracking
Jason Ekstrand [Tue, 18 Aug 2015 18:42:02 +0000 (11:42 -0700)]
i965/vec4_nir: Get rid of the uniform_driver_location tracking

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir/lower_io: Separate driver_location and base offset for uniforms
Jason Ekstrand [Tue, 18 Aug 2015 18:20:40 +0000 (11:20 -0700)]
nir/lower_io: Separate driver_location and base offset for uniforms

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir/intrinsics: Add a second const index to load_uniform
Jason Ekstrand [Tue, 18 Aug 2015 18:18:55 +0000 (11:18 -0700)]
nir/intrinsics: Add a second const index to load_uniform

In the i965 backend, we want to be able to "pull apart" the uniforms and
push some of them into the shader through a different path.  In order to do
this effectively, we need to know which variable is actually being referred
to by a given uniform load.  Previously, it was completely flattened by
nir_lower_io which made things difficult.  This adds more information to
the intrinsic to make this easier for us.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: Pass a type_size() function pointer into nir_lower_io().
Kenneth Graunke [Wed, 12 Aug 2015 21:29:25 +0000 (14:29 -0700)]
nir: Pass a type_size() function pointer into nir_lower_io().

Previously, there were four type_size() functions in play - the i965
compiler backend defined scalar and vec4 type_size() functions, and
nir_lower_io contained its own similar functions.

In fact, the i965 driver used nir_lower_io() and then looped over the
components using its own type_size - meaning both were in play.  The
two are /basically/ the same, but not exactly in obscure cases like
subroutines and images.

This patch removes nir_lower_io's functions, and instead makes the
driver supply a function pointer.  This gives the driver ultimate
flexibility in deciding how it wants to count things, reduces code
duplication, and improves consistency.

v2 (Jason Ekstrand):
 - One side-effect of passing in a function pointer is that nir_lower_io is
   now aware of and properly allocates space for image uniforms, allowing
   us to drop hacks in the backend

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
v2 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

9 years agoprog_to_nir: Don't allocate nir_variable with type vec4[0] for uniforms.
Kenneth Graunke [Mon, 24 Aug 2015 23:39:24 +0000 (16:39 -0700)]
prog_to_nir: Don't allocate nir_variable with type vec4[0] for uniforms.

If there are no parameters, we don't need to create a nir_variable to
hold them...and allocating an array of length 0 is pretty bogus.

Should avoid i965 backend assertions in future patches Jason and I are
working on.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoi965: Move type_size() methods out of visitor classes.
Kenneth Graunke [Wed, 12 Aug 2015 21:19:17 +0000 (14:19 -0700)]
i965: Move type_size() methods out of visitor classes.

I want to use C function pointers to these, and they don't use anything
in the visitor classes anyway.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoi965: Make setup_vec4_uniform_value and _image_uniform_values take an offset
Jason Ekstrand [Wed, 19 Aug 2015 17:32:32 +0000 (10:32 -0700)]
i965: Make setup_vec4_uniform_value and _image_uniform_values take an offset

This way they don't implicitly increment the uniforms variable and don't
have to be called in-sequence during uniform setup.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Rename setup_vector_uniform_values to setup_vec4_uniform_value
Jason Ekstrand [Wed, 19 Aug 2015 16:56:57 +0000 (09:56 -0700)]
i965: Rename setup_vector_uniform_values to setup_vec4_uniform_value

The new name more accurately represents what it does: Set up a single vec4
uniform value.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agofreedreno/ir3: fix compile break after splitting out nir_control_flow.h
Rob Clark [Tue, 25 Aug 2015 12:17:30 +0000 (08:17 -0400)]
freedreno/ir3: fix compile break after splitting out nir_control_flow.h

The commit:

  commit b49371b8ede380f10ea3ab333246a3b01ac6aca5
  Author:     Connor Abbott <cwabbott0@gmail.com>
  AuthorDate: Tue Jul 21 19:54:18 2015 -0700

      nir: move control flow modification to its own file

split out some control flow related APIs into a separate header, but did
not update drivers.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agofreedreno/ir3: fix compile break after fxn->start_block removal
Rob Clark [Tue, 25 Aug 2015 12:13:04 +0000 (08:13 -0400)]
freedreno/ir3: fix compile break after fxn->start_block removal

The commit:

  commit 8e0d4ef3410ea07d9621df3e083bc3e7c1ad2ab0
  Author:     Kenneth Graunke <kenneth@whitecape.org>
  AuthorDate: Thu Aug 6 18:18:40 2015 -0700

      nir: Delete the nir_function_impl::start_block field.

removed the start_block field without fixing up drivers..

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agomesa: enable texture stencil8 for multisample
Dave Airlie [Wed, 29 Jul 2015 08:09:44 +0000 (18:09 +1000)]
mesa: enable texture stencil8 for multisample

This fixes GL45-CTS.gtf44.GL31Tests.texture_stencil8.texture_stencil8_gl44
from the ogl conform suite.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: 10.6 11.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agomesa: make _mesa_bind_texture_unit() static
Brian Paul [Mon, 24 Aug 2015 13:50:51 +0000 (07:50 -0600)]
mesa: make _mesa_bind_texture_unit() static

It's only called from the file it's defined in.

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
9 years agomesa/formats: store whether or not a format is sRGB in gl_format_info
Nanley Chery [Tue, 19 May 2015 16:58:17 +0000 (09:58 -0700)]
mesa/formats: store whether or not a format is sRGB in gl_format_info

v2: remove extra newline.
v3: use bool instead of GLboolean.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
9 years agonir: Use !block_ends_in_jump() in a few places rather than open-coding.
Kenneth Graunke [Mon, 24 Aug 2015 19:18:51 +0000 (12:18 -0700)]
nir: Use !block_ends_in_jump() in a few places rather than open-coding.

Connor introduced this helper recently; we should use it here too.

I had to move the function earlier in the file for it to be available.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agovk: Add gen7 support
Kristian Høgsberg Kristensen [Fri, 21 Aug 2015 05:59:19 +0000 (22:59 -0700)]
vk: Add gen7 support

With all the previous commits in place, we can now drop in support for
multiple platforms. First up is gen7 (Ivybridge).

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Move 3DSTATE_SBE setup to just before 3DSTATE_PS
Kristian Høgsberg Kristensen [Fri, 21 Aug 2015 05:55:08 +0000 (22:55 -0700)]
vk: Move 3DSTATE_SBE setup to just before 3DSTATE_PS

This is a more logical place for it, between geometry front end state
and pixel backend state.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Move generic pipeline init to anv_pipeline.c
Kristian Høgsberg Kristensen [Fri, 21 Aug 2015 05:53:54 +0000 (22:53 -0700)]
vk: Move generic pipeline init to anv_pipeline.c

This logic will be shared between multiple gens.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Move gen8 specific state into gen8 sub-structs
Kristian Høgsberg Kristensen [Fri, 21 Aug 2015 05:41:22 +0000 (22:41 -0700)]
vk: Move gen8 specific state into gen8 sub-structs

This commit moves all occurances of gen8 specific state into a gen8
substruct. This clearly identifies the state as gen8 specific and
prepares for adding gen7 state structs. In the process we also rename
the field names to exactly match the command or state packet name,
without the 3DSTATE prefix, eg:

  3DSTATE_VF -> gen8.vf
  3DSTATE_WM_DEPTH_STENCIL -> gen8.wm_depth_stencil

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Always use a placeholder vertex shader in meta
Kristian Høgsberg Kristensen [Fri, 21 Aug 2015 05:32:28 +0000 (22:32 -0700)]
vk: Always use a placeholder vertex shader in meta

The clear pipeline didn't have a vertex shader and relied on the clear
shader being hardcoded by the compiler to accept one attribute. This
necessitated a few special cases in the 3DSTATE_VS setup. Instead,
always provide a vertex shader, even if we disable VS dispatch.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Trim out irrelevant 0-initialized surface state fields
Kristian Høgsberg Kristensen [Fri, 21 Aug 2015 05:24:13 +0000 (22:24 -0700)]
vk: Trim out irrelevant 0-initialized surface state fields

Many of of these fields aren't used for buffer surfaces, so leave them
out for brevity.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Update generated headers
Kristian Høgsberg Kristensen [Fri, 21 Aug 2015 05:12:55 +0000 (22:12 -0700)]
vk: Update generated headers

This adds VALIGN_2 and VALIGN_4 defines for IVB and HSW
RENDER_SURFACE_STATE.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Move anv_color_attachment_view_init() to gen8_state.c
Kristian Høgsberg Kristensen [Thu, 20 Aug 2015 05:19:21 +0000 (22:19 -0700)]
vk: Move anv_color_attachment_view_init() to gen8_state.c

I'd prefer to move anv_CreateAttachmentView() as well, but it's a little
too much generic code to just duplicate for each gen.  For now, we'll
add a anv_color_attachment_view_init() to dispatch to the gen specific
implementation, which we then call from anv_CreateAttachmentView().

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Move anv_CreateImageView to gen8_state.c
Kristian Høgsberg Kristensen [Thu, 20 Aug 2015 04:36:57 +0000 (21:36 -0700)]
vk: Move anv_CreateImageView to gen8_state.c

We'll probably want to move some code back into a shared init function,
but this gets one GEN8 surface state initialization out of anv_image.c.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Make anv_cmd_buffer_begin_subpass() switch on gen
Kristian Høgsberg Kristensen [Thu, 20 Aug 2015 04:30:08 +0000 (21:30 -0700)]
vk: Make anv_cmd_buffer_begin_subpass() switch on gen

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Add generic wrapper for filling out buffer surface state
Kristian Høgsberg Kristensen [Wed, 19 Aug 2015 23:01:33 +0000 (16:01 -0700)]
vk: Add generic wrapper for filling out buffer surface state

We need this for generating surface state on the fly for dynamic buffer
views.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Add helper for adding surface state reloc
Kristian Høgsberg Kristensen [Wed, 19 Aug 2015 21:56:12 +0000 (14:56 -0700)]
vk: Add helper for adding surface state reloc

We're going to have to do this differently for earlier gens, so lets do
it in place only.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Make batch chain code gen-agnostic
Kristian Høgsberg Kristensen [Wed, 19 Aug 2015 21:33:22 +0000 (14:33 -0700)]
vk: Make batch chain code gen-agnostic

Since the extra dword in MI_BATCH_BUFFER_START added in gen8 is at the
end of the struct, we can emit the gen8 packet on all gens as long as we
set the instruction length correctly.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Move vkCmdPipelineBarrier to gen8_cmd_buffer.c
Kristian Høgsberg Kristensen [Wed, 19 Aug 2015 21:39:35 +0000 (14:39 -0700)]
vk: Move vkCmdPipelineBarrier to gen8_cmd_buffer.c

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Use helper function for emitting MI_BATCH_BUFFER_START
Kristian Høgsberg Kristensen [Wed, 19 Aug 2015 18:24:52 +0000 (11:24 -0700)]
vk: Use helper function for emitting MI_BATCH_BUFFER_START

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Use anv_batch_emit() for chaining back to primary batch
Kristian Høgsberg Kristensen [Tue, 18 Aug 2015 22:26:07 +0000 (15:26 -0700)]
vk: Use anv_batch_emit() for chaining back to primary batch

We used to use a manual GEN8_MI_BATCH_BUFFER_START_pack() call, but this
refactors the code to use anv_batch_emit();

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Downgrade state packet to gen7 where they're common
Kristian Høgsberg Kristensen [Tue, 18 Aug 2015 18:04:19 +0000 (11:04 -0700)]
vk: Downgrade state packet to gen7 where they're common

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Reorder gen8 specific code into three new files
Kristian Høgsberg Kristensen [Mon, 17 Aug 2015 23:17:07 +0000 (16:17 -0700)]
vk: Reorder gen8 specific code into three new files

We'll organize gen specific code in three files per gen: pipeline,
cmd_buffer and state, eg:

    gen8_cmd_buffer.c
    gen8_pipeline.c
    gen8_state.c

where gen8_cmd_buffer.c holds all vkCmd* entry points, gne8_pipeline.c
all gen specific code related to pipeline building and remaining state
code (sampler, surface state, dynamic state) in gen8_state.c.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Move gen8_CmdBindIndexBuffer() to anv_gen8.c
Kristian Høgsberg Kristensen [Mon, 17 Aug 2015 18:36:10 +0000 (11:36 -0700)]
vk: Move gen8_CmdBindIndexBuffer() to anv_gen8.c

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Move gen8_cmd_buffer_emit_state_base_address() to anv_gen8.c
Kristian Høgsberg Kristensen [Fri, 14 Aug 2015 21:50:11 +0000 (14:50 -0700)]
vk: Move gen8_cmd_buffer_emit_state_base_address() to anv_gen8.c

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Move gen8 specific parts of queries to anv_gen8.c
Kristian Høgsberg Kristensen [Fri, 14 Aug 2015 17:03:27 +0000 (10:03 -0700)]
vk: Move gen8 specific parts of queries to anv_gen8.c

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Move dynamic depth stenctil to anv_gen8.c
Kristian Høgsberg Kristensen [Fri, 14 Aug 2015 16:31:11 +0000 (09:31 -0700)]
vk: Move dynamic depth stenctil to anv_gen8.c

9 years agovk: Move pipeline creation to anv_gen8.c
Kristian Høgsberg Kristensen [Fri, 14 Aug 2015 16:30:41 +0000 (09:30 -0700)]
vk: Move pipeline creation to anv_gen8.c

9 years agovk: Move anv_CreateSampler to anv_gen8.c
Kristian Høgsberg Kristensen [Fri, 14 Aug 2015 04:52:31 +0000 (21:52 -0700)]
vk: Move anv_CreateSampler to anv_gen8.c

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Move anv_CreateBufferView to anv_gen8.c
Kristian Høgsberg Kristensen [Fri, 14 Aug 2015 04:48:19 +0000 (21:48 -0700)]
vk: Move anv_CreateBufferView to anv_gen8.c

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Add new anv_gen8.c and move CreateDynamicRasterState there
Kristian Høgsberg Kristensen [Fri, 14 Aug 2015 04:05:47 +0000 (21:05 -0700)]
vk: Add new anv_gen8.c and move CreateDynamicRasterState there

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
9 years agovk: Implement multi-gen dispatch mechanism
Kristian Høgsberg Kristensen [Thu, 30 Jul 2015 21:44:01 +0000 (14:44 -0700)]
vk: Implement multi-gen dispatch mechanism

9 years agonir/cf: reimplement nir_cf_node_remove() using the new API
Connor Abbott [Wed, 22 Jul 2015 02:54:35 +0000 (19:54 -0700)]
nir/cf: reimplement nir_cf_node_remove() using the new API

This gives us some testing of it. Also, the old nir_cf_node_remove()
wasn't handling phi nodes correctly and was calling cleanup_cf_node()
too late.

Signed-off-by: Connor Abbott <connor.w.abbott@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir/cf: add new control modification API's
Connor Abbott [Wed, 22 Jul 2015 02:54:34 +0000 (19:54 -0700)]
nir/cf: add new control modification API's

These will help us do a number of things, including:

- Early return elimination.
- Dead control flow elimination.
- Various optimizations, such as replacing:

if (foo) {
    ...
}
if (!foo) {
    ...
}

with:

if (foo) {
    ...
} else {
    ...
}

Signed-off-by: Connor Abbott <connor.w.abbott@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>