platform/upstream/mesa.git
9 years agovk/compiler: Set the binding table texture_start
Jason Ekstrand [Thu, 14 May 2015 05:12:01 +0000 (22:12 -0700)]
vk/compiler: Set the binding table texture_start

This is by no means a complete solution to the binding table problems.
However, it does make texturing actually work.  Before, we were texturing
from the render target since they were both starting at 0.

9 years agovk/compiler: Zero the prog data
Jason Ekstrand [Thu, 14 May 2015 05:11:20 +0000 (22:11 -0700)]
vk/compiler: Zero the prog data

We use prog_data[stage] != NULL to determine whether or not we need to
clean up that stage.  Make sure it default to NULL.

9 years agovk/image: Stash more information in images and views
Jason Ekstrand [Thu, 14 May 2015 00:37:12 +0000 (17:37 -0700)]
vk/image: Stash more information in images and views

9 years agovk/meta: Save/restore more stuff in cmd_buffer_restore
Jason Ekstrand [Thu, 14 May 2015 00:34:37 +0000 (17:34 -0700)]
vk/meta: Save/restore more stuff in cmd_buffer_restore

9 years agovk: Install headers
Chad Versace [Thu, 14 May 2015 00:49:26 +0000 (17:49 -0700)]
vk: Install headers

I need this for building a testsuite.

9 years agovk: Add support for sampler descriptors
Kristian Høgsberg [Wed, 13 May 2015 21:43:08 +0000 (14:43 -0700)]
vk: Add support for sampler descriptors

9 years agovk: Use a typesafe anv_descriptor struct
Kristian Høgsberg [Wed, 13 May 2015 21:02:35 +0000 (14:02 -0700)]
vk: Use a typesafe anv_descriptor struct

9 years agovk: Create and bind a sampler in vk.c
Kristian Høgsberg [Wed, 13 May 2015 20:55:43 +0000 (13:55 -0700)]
vk: Create and bind a sampler in vk.c

9 years agovk: Fix copy-n-paste sType in vkCreateSampler
Kristian Høgsberg [Wed, 13 May 2015 20:53:01 +0000 (13:53 -0700)]
vk: Fix copy-n-paste sType in vkCreateSampler

9 years agovk: Add a dynamic state stream to anv_cmd_buffer
Kristian Høgsberg [Wed, 13 May 2015 20:51:08 +0000 (13:51 -0700)]
vk: Add a dynamic state stream to anv_cmd_buffer

We'll need this for sampler state.

9 years agovk: Move struct anv_sampler to private.h
Kristian Høgsberg [Wed, 13 May 2015 20:38:55 +0000 (13:38 -0700)]
vk: Move struct anv_sampler to private.h

9 years agovk: Allocate layout->count number of descriptors
Kristian Høgsberg [Wed, 13 May 2015 18:49:30 +0000 (11:49 -0700)]
vk: Allocate layout->count number of descriptors

layout->count is the number of descriptors the application
requested. layout->total is the number of entries we need across all
stages.

9 years agovk: Fill out sampler state from API values
Kristian Høgsberg [Wed, 13 May 2015 04:44:59 +0000 (21:44 -0700)]
vk: Fill out sampler state from API values

9 years agovk: Ignore vk executable
Chad Versace [Wed, 13 May 2015 19:05:38 +0000 (12:05 -0700)]
vk: Ignore vk executable

9 years agovk: Fix stale error handling in vkQueueSubmit
Kristian Høgsberg [Tue, 12 May 2015 21:38:58 +0000 (14:38 -0700)]
vk: Fix stale error handling in vkQueueSubmit

9 years agovk: Submit all cmd buffers passed to vkQueueSubmit
Kristian Høgsberg [Tue, 12 May 2015 21:38:12 +0000 (14:38 -0700)]
vk: Submit all cmd buffers passed to vkQueueSubmit

9 years agovk: Add generated header for HSW and IVB (GEN75 and GEN7)
Kristian Høgsberg [Tue, 12 May 2015 21:25:47 +0000 (14:25 -0700)]
vk: Add generated header for HSW and IVB (GEN75 and GEN7)

9 years agovk: Add stub() and stub_return() macros and mark piles of functions as stubs
Jason Ekstrand [Tue, 12 May 2015 20:44:43 +0000 (13:44 -0700)]
vk: Add stub() and stub_return() macros and mark piles of functions as stubs

9 years agovk/util: Add a anv_finishme function/macro
Jason Ekstrand [Tue, 12 May 2015 20:43:36 +0000 (13:43 -0700)]
vk/util: Add a anv_finishme function/macro

9 years agovk/meta: Break setting up meta clear state into it's own functin
Jason Ekstrand [Tue, 12 May 2015 20:03:50 +0000 (13:03 -0700)]
vk/meta: Break setting up meta clear state into it's own functin

9 years agovk/pipeline: Add support for disabling the scissor in "extra"
Jason Ekstrand [Tue, 12 May 2015 19:52:53 +0000 (12:52 -0700)]
vk/pipeline: Add support for disabling the scissor in "extra"

9 years agovk: Add clear load-op for render passes
Kristian Høgsberg [Tue, 12 May 2015 06:25:06 +0000 (23:25 -0700)]
vk: Add clear load-op for render passes

9 years agovk: Add support for driver-internal custom pipelines
Kristian Høgsberg [Tue, 12 May 2015 06:20:01 +0000 (23:20 -0700)]
vk: Add support for driver-internal custom pipelines

This lets us disable the viewport, use rect lists and repclear.

9 years agovk: Fix 3DSTATE_VERTEX_BUFFER emission
Kristian Høgsberg [Tue, 12 May 2015 05:25:52 +0000 (22:25 -0700)]
vk: Fix 3DSTATE_VERTEX_BUFFER emission

Set VertexBufferIndex to the attribute binding, not the location.

9 years agovk: Add 32 bpc signed and unsigned integer formats
Kristian Høgsberg [Tue, 12 May 2015 05:24:57 +0000 (22:24 -0700)]
vk: Add 32 bpc signed and unsigned integer formats

9 years agovk: Add anv_batch_emit_merge() helper macro
Kristian Høgsberg [Tue, 12 May 2015 05:23:38 +0000 (22:23 -0700)]
vk: Add anv_batch_emit_merge() helper macro

This lets us emit a state packet by merging to half-backed versions,
typically one from the pipeline object and one from a dynamic state
objects.

9 years agovk: Store bo pointer in anv_image and anv_buffer
Kristian Høgsberg [Tue, 12 May 2015 05:19:58 +0000 (22:19 -0700)]
vk: Store bo pointer in anv_image and anv_buffer

We don't need to point back to the memory object the bo came from.
Pointing directly to a bo lets us bind images and buffers to other
bos - like our allocator bos.

9 years agovk: Support not having a vertex shader
Kristian Høgsberg [Tue, 12 May 2015 05:17:04 +0000 (22:17 -0700)]
vk: Support not having a vertex shader

This lets us bypass the vertex shader and pass data straight into
the rasterizer part of the pipeline.

9 years agovk: Allow NULL as a valid pipeline layout
Kristian Høgsberg [Tue, 12 May 2015 05:12:56 +0000 (22:12 -0700)]
vk: Allow NULL as a valid pipeline layout

Vertex buffers and render targets aren't part of the layout so having
an empty layout is pretty common.

9 years agoAdd vulkan driver for BDW
Kristian Høgsberg [Sat, 9 May 2015 05:32:37 +0000 (22:32 -0700)]
Add vulkan driver for BDW

9 years agonir: Fix aggressive typos in nir_from_ssa.c.
Kenneth Graunke [Sat, 9 May 2015 02:36:19 +0000 (19:36 -0700)]
nir: Fix aggressive typos in nir_from_ssa.c.

s/agressive/aggressive/g

Trivial.

9 years agonir/search: Save/restore the variables_seen bitmask when matching
Jason Ekstrand [Fri, 8 May 2015 16:48:33 +0000 (09:48 -0700)]
nir/search: Save/restore the variables_seen bitmask when matching

Shader-db results on Broadwell:

   total instructions in shared programs: 7152330 -> 7137006 (-0.21%)
   instructions in affected programs:     1330548 -> 1315224 (-1.15%)
   helped:                                5797
   HURT:                                  76
   GAINED:                                0
   LOST:                                  8

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir/search: Assert that variable id's are in range
Jason Ekstrand [Fri, 8 May 2015 16:42:05 +0000 (09:42 -0700)]
nir/search: Assert that variable id's are in range

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir/search: handle explicitly sized sources in match_value
Jason Ekstrand [Fri, 8 May 2015 15:33:01 +0000 (08:33 -0700)]
nir/search: handle explicitly sized sources in match_value

Previously, this case was being handled in match_expression prior to
calling match_value.  However, there is really no good reason for this
given that match_value has all of the information it needs.  Also, they
weren't being handled properly in the commutative case and putting it in
match_value gives us that for free.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir/nir: Use a linked list instead of a hash set for use/def sets
Jason Ekstrand [Fri, 24 Apr 2015 17:16:27 +0000 (10:16 -0700)]
nir/nir: Use a linked list instead of a hash set for use/def sets

This commit switches us from the current setup of using hash sets for
use/def sets to using linked lists.  Doing so should save us quite a bit of
memory because we aren't carrying around 3 hash sets per register and 2 per
SSA value.  It should also save us CPU time because adding/removing things
from use/def sets is 4 pointer manipulations instead of a hash lookup.

Running shader-db 50 times with USE_NIR=0, NIR, and NIR + use/def lists:

   GLSL IR Only:        586.4 +/- 1.653833
   NIR with hash sets:  675.4 +/- 2.502108
   NIR + use/def lists: 641.2 +/- 1.557043

I also ran a memory usage experiment with Ken's patch to delete GLSL IR and
keep NIR.  This patch cuts an aditional 42.9 MiB of ralloc'd memory over
and above what we gained by deleting the GLSL IR on the same dota trace.

On the code complexity side of things, some things are now much easier and
others are a bit harder.  One of the operations we perform constantly in
optimization passes is to replace one source with another.  Due to the fact
that an instruction can use the same SSA value multiple times, we had to
iterate through the sources of the instruction and determine if the use we
were replacing was the only one before removing it from the set of uses.
With this patch, uses are per-source not per-instruction so we can just
remove it safely.  On the other hand, trying to iterate over all of the
instructions that use a given value is more difficult.  Fortunately, the
two places we do that are the ffma peephole where it doesn't matter and GCM
where we already gracefully handle duplicates visits to an instruction.

Another aspect here is that using linked lists in this way can be tricky to
get right.  With sets, things were quite forgiving and the worst that
happened if you didn't properly remove a use was that it would get caught
in the validator.  With linked lists, it can lead to linked list corruption
which can be harder to track.  However, we do just as much validation of
the linked lists as we did of the sets so the validator should still catch
these problems.  While working on this series, the vast majority of the
bugs I had to fix were caught by assertions.  I don't think the lists are
going to be that much worse than the sets.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agoutil/list: Add a list validation function
Jason Ekstrand [Tue, 28 Apr 2015 03:40:11 +0000 (20:40 -0700)]
util/list: Add a list validation function

Acked-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
9 years agoutil/list: Add list_empty and list_length functions
Jason Ekstrand [Tue, 28 Apr 2015 03:39:37 +0000 (20:39 -0700)]
util/list: Add list_empty and list_length functions

v2: Don't use C99 when iterating over the list

Acked-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
9 years agoutil/list: Add C99-based iterator macros
Jason Ekstrand [Tue, 28 Apr 2015 01:56:02 +0000 (18:56 -0700)]
util/list: Add C99-based iterator macros

v2: Use LIST_ENTRY instead of container_of in iterators

Acked-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
9 years agoutil: Move gallium's linked list to util
Jason Ekstrand [Tue, 28 Apr 2015 00:41:27 +0000 (17:41 -0700)]
util: Move gallium's linked list to util

The linked list in gallium is pretty much the kernel list and we would like
to have a C-based linked list for all of mesa.  Let's not duplicate and
just steal the gallium one.

Acked-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
9 years agogallium/double_list: s/INLINE/inline and remove the p_compiler include
Jason Ekstrand [Mon, 27 Apr 2015 23:58:29 +0000 (16:58 -0700)]
gallium/double_list: s/INLINE/inline and remove the p_compiler include

Acked-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
9 years agonir: Use nir_instr_rewrite_src in copy propagation
Jason Ekstrand [Tue, 21 Apr 2015 19:12:26 +0000 (12:12 -0700)]
nir: Use nir_instr_rewrite_src in copy propagation

We were rolling our own rewrite_src variant in copy-propagation.  Let's
stop doing that and use the ones in core NIR.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir: Add a function for rewriting the condition of an if statement
Jason Ekstrand [Fri, 24 Apr 2015 17:34:30 +0000 (10:34 -0700)]
nir: Add a function for rewriting the condition of an if statement

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir: Add and use initializer #defines for nir_src and nir_dest
Jason Ekstrand [Wed, 22 Apr 2015 01:00:21 +0000 (18:00 -0700)]
nir: Add and use initializer #defines for nir_src and nir_dest

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir: Modernize the out-of-SSA pass
Jason Ekstrand [Tue, 21 Apr 2015 18:16:04 +0000 (11:16 -0700)]
nir: Modernize the out-of-SSA pass

The out-of-SSA pass was one of the first passes written when getting SSA
up-and-going (for obvious reasons).  As such, it came before a lot of the
nifty SSA-based helpers were introduced.  This commit modernizes it so that
we're no longer doing nearly as much manual banging on use/def sets.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir/validate: Validate SSA def parent instructions
Jason Ekstrand [Fri, 24 Apr 2015 00:10:42 +0000 (17:10 -0700)]
nir/validate: Validate SSA def parent instructions

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonv50/ir: only propagate saturate up if some actual folding took place
Ilia Mirkin [Fri, 8 May 2015 22:54:08 +0000 (18:54 -0400)]
nv50/ir: only propagate saturate up if some actual folding took place

The former logic would copy the saturate up to any mul with an immediate
if there was a subsequent mul with a saturate. However we only want to
do that if we collapsed 2 muls by multiplying their immediates (or were
able to put the immediate in as a post-multiplier).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
9 years agonir: Delete all traces of nir_op_flog
Ian Romanick [Thu, 7 May 2015 00:04:15 +0000 (17:04 -0700)]
nir: Delete all traces of nir_op_flog

Nothing produces it, and nothing can consume it.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Don't produce nir_op_flog from GLSL IR
Ian Romanick [Thu, 7 May 2015 00:01:37 +0000 (17:01 -0700)]
nir: Don't produce nir_op_flog from GLSL IR

All paths that produce GLSL IR for NIR lower ir_unop_log.  All paths
that consume NIR will explode if they geta nir_op_flog.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Delete all traces of nir_op_fexp
Ian Romanick [Thu, 7 May 2015 00:00:18 +0000 (17:00 -0700)]
nir: Delete all traces of nir_op_fexp

Nothing produces it, and nothing can consume it.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Don't produce nir_op_fexp from GLSL IR
Ian Romanick [Wed, 6 May 2015 23:57:22 +0000 (16:57 -0700)]
nir: Don't produce nir_op_fexp from GLSL IR

All paths that produce GLSL IR for NIR lower ir_unop_exp.  All paths
that consume NIR will explode if they geta nir_op_fexp.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoprog_to_nir: OPCODE_EXP is not nir_op_fexp
Ian Romanick [Wed, 6 May 2015 23:54:06 +0000 (16:54 -0700)]
prog_to_nir: OPCODE_EXP is not nir_op_fexp

It's a weird thing that provides some values related to 2**x.  It's also
already handled by a case in the switch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoi965/fs: Improve a comment about stripping trailing zeroes
Neil Roberts [Fri, 8 May 2015 15:13:52 +0000 (16:13 +0100)]
i965/fs: Improve a comment about stripping trailing zeroes

Originally I wrote that removing the first parameter doesn't work but
I didn't know why. I now found a mention of this in the PRM so it's
probably worthing adding it to the comment.

9 years agodocs: Update the ARB_direct_state_access status
Fredrik Höglund [Wed, 18 Mar 2015 19:50:06 +0000 (20:50 +0100)]
docs: Update the ARB_direct_state_access status

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement GetVertexArrayIndexed[64]iv
Fredrik Höglund [Mon, 2 Mar 2015 18:07:52 +0000 (19:07 +0100)]
mesa: Implement GetVertexArrayIndexed[64]iv

v2: Fix the name of the entry point in the error messages.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Add support for querying GL_VERTEX_ATTRIB_ARRAY_LONG
Fredrik Höglund [Mon, 2 Mar 2015 18:04:16 +0000 (19:04 +0100)]
mesa: Add support for querying GL_VERTEX_ATTRIB_ARRAY_LONG

This parameter was added in OpenGL 4.3 and GL_ARB_direct_state_access.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Add a vao parameter to get_vertex_array_attrib
Fredrik Höglund [Mon, 2 Mar 2015 17:58:36 +0000 (18:58 +0100)]
mesa: Add a vao parameter to get_vertex_array_attrib

This is needed to implement glGetVertexArrayIndexediv and
glGetVertexArrayIndexed64iv.

v2: Make the vao parameter const.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement GetVertexArrayiv
Fredrik Höglund [Mon, 2 Mar 2015 17:56:31 +0000 (18:56 +0100)]
mesa: Implement GetVertexArrayiv

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement VertexArrayBindingDivisor
Fredrik Höglund [Mon, 2 Mar 2015 17:52:36 +0000 (18:52 +0100)]
mesa: Implement VertexArrayBindingDivisor

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Add a vao parameter to vertex_binding_divisor
Fredrik Höglund [Mon, 2 Mar 2015 17:50:49 +0000 (18:50 +0100)]
mesa: Add a vao parameter to vertex_binding_divisor

This is needed to implement VertexArrayBindingDivisor.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement VertexArrayAttribBinding
Fredrik Höglund [Mon, 2 Mar 2015 17:49:06 +0000 (18:49 +0100)]
mesa: Implement VertexArrayAttribBinding

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Add a vao parameter to vertex_attrib_binding
Fredrik Höglund [Mon, 2 Mar 2015 17:46:42 +0000 (18:46 +0100)]
mesa: Add a vao parameter to vertex_attrib_binding

This is needed to implement VertexArrayAttribBinding.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement VertexArrayAttrib[I|L]Format
Fredrik Höglund [Mon, 2 Mar 2015 17:44:00 +0000 (18:44 +0100)]
mesa: Implement VertexArrayAttrib[I|L]Format

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Add a vao parameter to update_array_format
Fredrik Höglund [Mon, 2 Mar 2015 17:41:09 +0000 (18:41 +0100)]
mesa: Add a vao parameter to update_array_format

This is needed to implement VertexArrayAttrib*Format.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Refactor VertexAttrib[I|L]Format
Fredrik Höglund [Mon, 2 Mar 2015 17:39:50 +0000 (18:39 +0100)]
mesa: Refactor VertexAttrib[I|L]Format

The only difference between these functions is the legal types and
sizes, so consolidate the code into a single vertex_attrib_format()
function and call it from all three entry points.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement VertexArrayVertexBuffers
Fredrik Höglund [Mon, 2 Mar 2015 17:37:27 +0000 (18:37 +0100)]
mesa: Implement VertexArrayVertexBuffers

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement VertexArrayVertexBuffer
Fredrik Höglund [Mon, 2 Mar 2015 17:35:10 +0000 (18:35 +0100)]
mesa: Implement VertexArrayVertexBuffer

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Add a vao parameter to bind_vertex_buffer
Fredrik Höglund [Mon, 2 Mar 2015 17:33:14 +0000 (18:33 +0100)]
mesa: Add a vao parameter to bind_vertex_buffer

This is needed to implement VertexArrayVertexBuffer and
VertexArrayVertexBuffers.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement VertexArrayElementBuffer
Fredrik Höglund [Mon, 2 Mar 2015 17:30:12 +0000 (18:30 +0100)]
mesa: Implement VertexArrayElementBuffer

v2: Add a doxygen comment.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement EnableVertexArrayAttrib
Fredrik Höglund [Mon, 2 Mar 2015 17:27:58 +0000 (18:27 +0100)]
mesa: Implement EnableVertexArrayAttrib

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement DisableVertexArrayAttrib
Fredrik Höglund [Mon, 2 Mar 2015 17:27:18 +0000 (18:27 +0100)]
mesa: Implement DisableVertexArrayAttrib

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Keep track of the last looked-up VAO
Fredrik Höglund [Mon, 2 Mar 2015 17:25:45 +0000 (18:25 +0100)]
mesa: Keep track of the last looked-up VAO

This saves the cost of repeated hash table lookups when the same
vertex array object is referenced in a sequence of calls such as:

    glVertexArrayAttribFormat(vao, ...);
    glVertexArrayAttribBinding(vao, ...);
    glEnableVertexArrayAttrib(vao, ...);
    ...

Note that VAO's are container objects that are not shared between
contexts.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Add _mesa_lookup_vao_err
Fredrik Höglund [Mon, 2 Mar 2015 17:24:36 +0000 (18:24 +0100)]
mesa: Add _mesa_lookup_vao_err

This is a convenience function that generates GL_INVALID_OPERATION
when the array object doesn't exist.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomesa: Implement CreateVertexArrays
Fredrik Höglund [Mon, 2 Mar 2015 17:22:50 +0000 (18:22 +0100)]
mesa: Implement CreateVertexArrays

v2: Update the documentation for gen_vertex_arrays().

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agoi965/skl: In opt_sampler_eot always set destination register to null
Neil Roberts [Thu, 7 May 2015 13:20:17 +0000 (14:20 +0100)]
i965/skl: In opt_sampler_eot always set destination register to null

opt_sampler_eot enables a direct write to framebuffer from a sample.
In order to do this the sample message needs to have a message header
so if there wasn't one already then the function adds one. In addition
the function sets the destination register to null because it's no
longer used. However it was only doing this in cases where it was
adding a message header. This patch just moves setting the destination
so that it happens even if there's a messge header. In practice this
doesn't seem to make any difference but it's a bit cleaner.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agoi965/fs: Set the header_size on LOAD_PAYLOAD in opt_sampler_eot
Neil Roberts [Thu, 7 May 2015 17:55:55 +0000 (18:55 +0100)]
i965/fs: Set the header_size on LOAD_PAYLOAD in opt_sampler_eot

Commit 94ee908448 added a header size parameter to the function to
create the LOAD_PAYLOAD instruction. However this broke
opt_sampler_eot which manually constructs the instruction and so
wasn't setting the header_size. This ends up making the parameters for
the send message all have the wrong location and it all falls apart.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agodocs: document the LIBGL_DRI3_DISABLE environment variable
Martin Peres [Thu, 7 May 2015 13:57:48 +0000 (16:57 +0300)]
docs: document the LIBGL_DRI3_DISABLE environment variable

Suggested-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agodocs: update ARB_vertex_attrib_64bit status
Dave Airlie [Fri, 24 Apr 2015 02:50:21 +0000 (12:50 +1000)]
docs: update ARB_vertex_attrib_64bit status

Add to GL3.txt and release notes.

Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agost/mesa: add double input support including lowering (v3.1)
Dave Airlie [Fri, 20 Feb 2015 01:42:19 +0000 (11:42 +1000)]
st/mesa:  add double input support including lowering (v3.1)

This takes a different approach to previously, we cannot index into the
inputMapping with anything but the mesa attribute index, so we can't use
the just add one to index trick, we need more info to add one to it
after we've mapped the input.

(Fixed copy propgation and cleaned up a little)

v2: drop float64 format check, just attr->Doubles.
merge enable patch.
v3: cleanup code a bit.
v3.1: minor review fixups (comment, newline) (Ilia)

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agomesa/vbo: add support for 64-bit vertex attributes. (v1)
Dave Airlie [Fri, 20 Feb 2015 01:41:01 +0000 (11:41 +1000)]
mesa/vbo: add support for 64-bit vertex attributes. (v1)

This adds support in the vbo and array code to handle
double vertex attributes.

v0.2: merge code to handle doubles in vbo layer.
v1: don't use v0, merge api_array elt code.

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: check total count of multi-slot double vertex attribs
Dave Airlie [Thu, 30 Apr 2015 00:42:06 +0000 (10:42 +1000)]
glsl: check total count of multi-slot double vertex attribs

The spec is vague all over the place about this, but this seems
to be the intent, we can probably make this optional later if
someone makes hw that cares and writes a driver.

Basically we need to double count some of the d types but
only for totalling not for slot number assignment.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: track which program inputs are doubles
Dave Airlie [Wed, 8 Apr 2015 04:38:19 +0000 (14:38 +1000)]
glsl: track which program inputs are doubles

instead of doing the attempts at dual slot handling here,
let the backend do it.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: add ARB_vertex_attrib_64bit support. (v2)
Dave Airlie [Fri, 20 Feb 2015 01:38:12 +0000 (11:38 +1000)]
glsl: add ARB_vertex_attrib_64bit support. (v2)

Just more boilerplate stuff.

v2:
bad fallthrough on versioning,
this is my ugly but self contained solution (Ian)

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agomesa: add ARB_vertex_attrib_64bit to extensions. (v2)
Dave Airlie [Fri, 20 Feb 2015 01:32:55 +0000 (11:32 +1000)]
mesa: add ARB_vertex_attrib_64bit to extensions. (v2)

Just add the boilerplate bits.

v2: add to version.c

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agomapi: add GL_ARB_vertex_attrib_64bit support
Dave Airlie [Fri, 20 Feb 2015 01:26:33 +0000 (11:26 +1000)]
mapi: add GL_ARB_vertex_attrib_64bit support

This just adds the glapi bits.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agost/glsl_to_tgsi: fix ir_assignment hack doing bad things for doubles
Dave Airlie [Fri, 20 Feb 2015 03:58:18 +0000 (13:58 +1000)]
st/glsl_to_tgsi: fix ir_assignment hack doing bad things for doubles

This hack for fixing gl_FragDepth apparantly caused a GLSL shader
outputting a single double to try and output a dvec4, but we hadn't
assigned outputs for the secondary bit.

This avoids going into the hack code for scalar doubles.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoi965/wm/gen6: Add option for disabling statistics collection
Topi Pohjolainen [Thu, 7 May 2015 13:07:15 +0000 (16:07 +0300)]
i965/wm/gen6: Add option for disabling statistics collection

Normally this is always needed but for internal blits and clears
we need to be able to disable it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/wm/gen6: Refactor state setup
Topi Pohjolainen [Wed, 6 May 2015 17:31:49 +0000 (20:31 +0300)]
i965/wm/gen6: Refactor state setup

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Remove unused variables
Anuj Phogat [Wed, 6 May 2015 22:11:42 +0000 (15:11 -0700)]
i965: Remove unused variables

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
9 years agoi965: Change the order of conditions tested in if
Anuj Phogat [Wed, 15 Apr 2015 18:46:53 +0000 (11:46 -0700)]
i965: Change the order of conditions tested in if

Reduces the number of conditions tested in if to one in case of
non-integer formats. Makes no functional changes.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir: Allow feq/fne/ieq/ine to be optimized with inot.
Matt Turner [Wed, 6 May 2015 05:54:59 +0000 (22:54 -0700)]
nir: Allow feq/fne/ieq/ine to be optimized with inot.

instructions in affected programs:     380 -> 376 (-1.05%)
helped:                                2

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
9 years agonir: Recognize (a < c || b < c) as min(a, b) < c.
Matt Turner [Wed, 6 May 2015 03:25:07 +0000 (20:25 -0700)]
nir: Recognize (a < c || b < c) as min(a, b) < c.

... and (a >= c) || (b >= c) as max(a, b) >= c.

Similar to commit 97e6c1b9.

total instructions in shared programs: 6182276 -> 6182180 (-0.00%)
instructions in affected programs:     6400 -> 6304 (-1.50%)
helped:                                68
HURT:                                  4

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
9 years agonir: Recognize trivial min/max.
Matt Turner [Wed, 6 May 2015 03:20:30 +0000 (20:20 -0700)]
nir: Recognize trivial min/max.

No changes, but does prevent some regressions in the next commit.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
9 years agonir: Recognize i2b(b2i(x)) as x.
Matt Turner [Wed, 6 May 2015 02:56:27 +0000 (19:56 -0700)]
nir: Recognize i2b(b2i(x)) as x.

Helps the same set of programs as the previous commit.

instructions in affected programs:     4490 -> 4346 (-3.21%)
helped:                                8

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
9 years agonir: Recognize imul(b2i(a), b2i(b)) as a logical AND.
Matt Turner [Wed, 6 May 2015 02:50:58 +0000 (19:50 -0700)]
nir: Recognize imul(b2i(a), b2i(b)) as a logical AND.

Four shaders in Unreal 4's Sun Temple are helped, and gain SIMD16
because we avoid an integer multiplication.

instructions in affected programs:     2353 -> 2245 (-4.59%)
helped:                                4
GAINED:                                4

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
9 years agoi965/sync: Implement DRI2_Fence extension
Chad Versace [Wed, 6 May 2015 02:05:32 +0000 (19:05 -0700)]
i965/sync: Implement DRI2_Fence extension

This enables EGL_KHR_fence_sync and EGL_KHR_wait_sync.

Below is the difference in piglit results, before and after this patch.
No regressions and several tests improve from 'skip' to 'pass'. Out of
EGL_KHR_fence_sync tests, two of the multithreaded tests skip; all other
tests pass.

  cmdline: piglit run -p gbm -t sync tests/quick.py
  mesa: master@1ac7db0
  piglit: 4069bec
  hw: Ivybridge

        | before after
  ------+-------------
   pass |     32    46
   fail |      0     0
  crash |      0     0
   skip |     35    21
  total |     67    67

v2:
  - Set fence->signalled = true in brw_fence_has_completed() too.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/sync: Replace prefix 'intel_sync' -> 'intel_gl_sync'
Chad Versace [Wed, 6 May 2015 02:05:32 +0000 (19:05 -0700)]
i965/sync: Replace prefix 'intel_sync' -> 'intel_gl_sync'

I'm about to implement DRI2_Fenc in intel_syncobj.c.  To prevent
madness, we need to prefix functions for GL_ARB_sync with 'gl' and
functions for DRI2_Fence with 'dri'. Otherwise, the file will become
a jumble of similiarly named functions.

For example:
    old-name:      intel_client_wait_sync()
    new-name:      intel_gl_client_wait_sync()
    soon-to-come:  intel_dri_client_wait_sync()

I wrote this renaming commit separately from the commit that implements
DRI2_Fence because I wanted the latter diff to be reviewable.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi915/sync: Return early when calloc fails
Chad Versace [Wed, 6 May 2015 02:05:31 +0000 (19:05 -0700)]
i915/sync: Return early when calloc fails

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/sync: Return NULL when calloc fails
Chad Versace [Wed, 6 May 2015 02:05:30 +0000 (19:05 -0700)]
i965/sync: Return NULL when calloc fails

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi915/sync: Don't crash when deleting sync object
Chad Versace [Wed, 6 May 2015 02:05:29 +0000 (19:05 -0700)]
i915/sync: Don't crash when deleting sync object

Don't pass NULL to drm_intel_bo_unreference(). It doesn't like that.

Bug found by code inspection.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/sync: Don't crash when deleting sync object
Chad Versace [Wed, 6 May 2015 02:05:28 +0000 (19:05 -0700)]
i965/sync: Don't crash when deleting sync object

Don't pass NULL to drm_intel_bo_unreference(). It doesn't like that.

Bug found by code inspection.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>