mesa.git
7 years agoglsl: Generate code for constant ir_binop_dot expressions
Ian Romanick [Tue, 12 Jul 2016 19:30:04 +0000 (12:30 -0700)]
glsl: Generate code for constant ir_binop_dot expressions

v2: 'for (a, b) in d' => 'for a, b in d'.  Suggested by Dylan.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
7 years agoglsl: Generate code for constant ir_binop_lshift and ir_binop_rshift expressions
Ian Romanick [Tue, 12 Jul 2016 18:29:21 +0000 (11:29 -0700)]
glsl: Generate code for constant ir_binop_lshift and ir_binop_rshift expressions

The code generated is quite different from what was previously used.  I
believe that it is still correct by the GLSL spec, and I believe, due to
C rules about shifts, the behavior will be the same.

Section 5.9 (Expressions) of the GLSL 4.50 spec says:

    The result is undefined if the right operand is negative, or greater
    than or equal to the number of bits in the left expression's base
    type.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
7 years agoglsl: Generate code for constant ir_binop_ldexp expressions
Ian Romanick [Tue, 12 Jul 2016 17:53:11 +0000 (10:53 -0700)]
glsl: Generate code for constant ir_binop_ldexp expressions

ldexp is weird because its two operands have different types.  Add
support for directly specifying the exact signatures of all the possible
variations of an operation.

v2: Use tuple() instead of () for clarity.  Suggested by Dylan.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
7 years agoglsl: Generate code for constant unary expressions that don't assign the destination
Ian Romanick [Tue, 12 Jul 2016 17:51:43 +0000 (10:51 -0700)]
glsl: Generate code for constant unary expressions that don't assign the destination

These are operations like the pack functions that have separate
functions that assign multiple outputs from a single input.

v2: Correct the source and destination types.  They were previously
transposed.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
7 years agoglsl: Generate code for some constant binary expression that are horizontal
Ian Romanick [Tue, 12 Jul 2016 17:12:57 +0000 (10:12 -0700)]
glsl: Generate code for some constant binary expression that are horizontal

Only operations where the implementation is identical code regardless of
type.  The only such operations are ir_binop_all_equal and
ir_binop_any_nequal.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
7 years agoglsl: Generate code for constant unary expression that are horizontal
Ian Romanick [Tue, 12 Jul 2016 00:38:16 +0000 (17:38 -0700)]
glsl: Generate code for constant unary expression that are horizontal

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
7 years agoglsl: Generate code for constant expressions that have an output type the differs...
Ian Romanick [Tue, 12 Jul 2016 00:09:22 +0000 (17:09 -0700)]
glsl: Generate code for constant expressions that have an output type the differs from the input types

v2: Remove extra int() cast in find_lsb.  Suggested by Matt.  'for (a,
b) in d' => 'for a, b in d'.  Suggested by Dylan.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
7 years agoglsl: Generate code for constant binary expressions that combine vector and scalar...
Ian Romanick [Mon, 11 Jul 2016 18:05:13 +0000 (11:05 -0700)]
glsl: Generate code for constant binary expressions that combine vector and scalar operands

v2: 'for (a, b) in d' => 'for a, b in d'.  Suggested by Dylan.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
7 years agoglsl: Generate code for constant binary expressions that have one operand type
Ian Romanick [Mon, 11 Jul 2016 17:19:31 +0000 (10:19 -0700)]
glsl: Generate code for constant binary expressions that have one operand type

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
7 years agoglsl: Generate code for constant unary expression that have different implementations...
Ian Romanick [Sat, 9 Jul 2016 01:40:58 +0000 (18:40 -0700)]
glsl: Generate code for constant unary expression that have different implementations for each source type

v2: 'for (a, b) in d' => 'for a, b in d'.  Suggested by Dylan.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
7 years agoglsl: Generate code for constant unary expression that map one type to another
Ian Romanick [Sat, 9 Jul 2016 00:12:33 +0000 (17:12 -0700)]
glsl: Generate code for constant unary expression that map one type to another

ir_unop_i2b is omitted because its source can either be int or uint.
That makes it special.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
7 years agoglsl: Begin generating code for the most basic constant expressions
Ian Romanick [Fri, 8 Jul 2016 07:20:43 +0000 (00:20 -0700)]
glsl: Begin generating code for the most basic constant expressions

Unary operations where all of the supported types use the same C
expression to evaluate them.

v2: 'for (a, b) in d' => 'for a, b in d'.  Suggested by Dylan.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
7 years agoglsl: Convert tuple into a class
Ian Romanick [Fri, 8 Jul 2016 06:03:44 +0000 (23:03 -0700)]
glsl: Convert tuple into a class

This makes things a little more clear now, and it will make future
changes... possible.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
7 years agoglsl: Compact a bunch of things onto one line
Ian Romanick [Wed, 13 Jul 2016 01:25:30 +0000 (18:25 -0700)]
glsl: Compact a bunch of things onto one line

Even though they are much too long for that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Sort constant expression handling by IR operand enum value
Ian Romanick [Wed, 13 Jul 2016 00:26:38 +0000 (17:26 -0700)]
glsl: Sort constant expression handling by IR operand enum value

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Trivial whitespace and punctuation changes
Ian Romanick [Tue, 12 Jul 2016 23:57:43 +0000 (16:57 -0700)]
glsl: Trivial whitespace and punctuation changes

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Sort GLSL type enums in switch-statements in enum order
Ian Romanick [Tue, 12 Jul 2016 23:51:35 +0000 (16:51 -0700)]
glsl: Sort GLSL type enums in switch-statements in enum order

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Always use correct float types in constant expression handling
Ian Romanick [Tue, 12 Jul 2016 23:49:15 +0000 (16:49 -0700)]
glsl: Always use correct float types in constant expression handling

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Extract ir_quadop_bitfield_insert implementation to a separate function
Ian Romanick [Wed, 13 Jul 2016 01:11:29 +0000 (18:11 -0700)]
glsl: Extract ir_quadop_bitfield_insert implementation to a separate function

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Extract ir_triop_bitfield_extract implementation to a separate function
Ian Romanick [Wed, 13 Jul 2016 01:07:51 +0000 (18:07 -0700)]
glsl: Extract ir_triop_bitfield_extract implementation to a separate function

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Extract ir_binop_ldexp implementation to a separate function
Ian Romanick [Wed, 13 Jul 2016 00:49:02 +0000 (17:49 -0700)]
glsl: Extract ir_binop_ldexp implementation to a separate function

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Use find_msb_uint to implement ir_unop_find_lsb
Ian Romanick [Wed, 13 Jul 2016 00:40:48 +0000 (17:40 -0700)]
glsl: Use find_msb_uint to implement ir_unop_find_lsb

(X & -X) calculates a value with only the least significant bit of X
set.  Since there is only one bit set, the LSB is the MSB.

v2: Remove extra int() cast.  Suggested by Matt.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Extract ir_unop_find_msb implementation to a separate function
Ian Romanick [Wed, 13 Jul 2016 00:39:26 +0000 (17:39 -0700)]
glsl: Extract ir_unop_find_msb implementation to a separate function

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Extract ir_unop_bitfield_reverse implementation to a separate function
Ian Romanick [Wed, 13 Jul 2016 00:32:24 +0000 (17:32 -0700)]
glsl: Extract ir_unop_bitfield_reverse implementation to a separate function

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Use _mesa_bitcount to implement constant ir_unop_bit_count
Ian Romanick [Mon, 11 Jul 2016 18:20:02 +0000 (11:20 -0700)]
glsl: Use _mesa_bitcount to implement constant ir_unop_bit_count

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Delete spurious comment about mod not taking integer operands
Ian Romanick [Fri, 8 Jul 2016 05:15:53 +0000 (22:15 -0700)]
glsl: Delete spurious comment about mod not taking integer operands

This hasn't been true since we added support for GLSL 1.30.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Delete spurious comment about updating ir_expression::get_num_operands
Ian Romanick [Fri, 8 Jul 2016 04:39:44 +0000 (21:39 -0700)]
glsl: Delete spurious comment about updating ir_expression::get_num_operands

This hasn't been necessary since 007f48815.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Do not generate comments or extra whitespace in expression files
Ian Romanick [Fri, 8 Jul 2016 04:37:22 +0000 (21:37 -0700)]
glsl: Do not generate comments or extra whitespace in expression files

The comments and whitespace can live in the Python code.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
7 years agoglsl: Just access the ir_expression_operation strings table directly
Ian Romanick [Thu, 16 Apr 2015 00:55:32 +0000 (17:55 -0700)]
glsl: Just access the ir_expression_operation strings table directly

The operator_string functions gave us some protection against a
malformed table.  Now that the table is generated from the same data
that generates the enum, this is not a concern.  Just cut out the middle
man.

   text    data     bss     dec     hex filename
7531892  273992   28584 7834468  778b64 i965_dri-64bit-before.so
7531828  273992   28584 7834404  778b24 i965_dri-64bit-after.so

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Generate ir_expression_operation_strings.h from Python
Ian Romanick [Thu, 16 Apr 2015 00:50:57 +0000 (17:50 -0700)]
glsl: Generate ir_expression_operation_strings.h from Python

'diff -ud' is clean.

v2: Massive rebase.

v3: With much help from José Fonseca, fix the SCons build.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
7 years agoglsl: Pull operator_strs out to its own file
Ian Romanick [Thu, 16 Apr 2015 00:34:56 +0000 (17:34 -0700)]
glsl: Pull operator_strs out to its own file

No change except to the copyright symbol.  The next patch will generate
this file with Python, and Unicode + Python = pure rage.

v2: Massive rebase.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Generate the ir_last_* values
Ian Romanick [Thu, 16 Apr 2015 00:19:04 +0000 (17:19 -0700)]
glsl: Generate the ir_last_* values

This ensures that they remain correct if the list is rearranged or new
opcodes are added.  I checked a diff of before and after to ensure that
each ir_last_ had the same value.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
7 years agoglsl: Generate ir_expression_operation.h from Python
Ian Romanick [Wed, 15 Apr 2015 23:59:43 +0000 (16:59 -0700)]
glsl: Generate ir_expression_operation.h from Python

There are differences in where end-of-line comments are placed, but
'diff -wud' is clean.

v2: Massive rebase.

v3: With much help from José Fonseca, fix SCons build.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
7 years agoanv: Rework pipeline caching
Jason Ekstrand [Thu, 25 Aug 2016 08:49:49 +0000 (01:49 -0700)]
anv: Rework pipeline caching

The original pipeline cache the Kristian wrote was based on a now-false
premise that the shaders can be stored in the pipeline cache.  The Vulkan
1.0 spec explicitly states that the pipeline cache object is transiant and
you are allowed to delete it after using it to create a pipeline with no
ill effects.  As nice as Kristian's design was, it doesn't jive with the
expectation provided by the Vulkan spec.

The new pipeline cache uses reference-counted anv_shader_bin objects that
are backed by a large state pool.  The cache itself is just a hash table
mapping keys hashes to anv_shader_bin objects.  This has the added
advantage of removing one more hand-rolled hash table from mesa.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97476
Acked-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
7 years agoanv: Add a struct for storing a compiled shader
Jason Ekstrand [Thu, 25 Aug 2016 06:48:32 +0000 (23:48 -0700)]
anv: Add a struct for storing a compiled shader

This new anv_shader_bin struct stores the compiled kernel (as an anv_state)
as well as all of the metadata that is generated at shader compile time.
The struct is very similar to the old cache_entry struct except that it
is reference counted and stores the actual pipeline_bind_map.  Similarly to
cache_entry, much of the actual data is floating-size and stored after the
main struct.  Unlike cache_entry, which was storred in GPU-accessable
memory, the storage for anv_shader_bin kernels comes from a state pool.
The struct itself is reference-counted so that it can be used by multiple
pipelines at a time without fear of allocation issues.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Acked-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
7 years agoanv: Add pipeline_has_stage guards a few places
Jason Ekstrand [Thu, 25 Aug 2016 19:22:28 +0000 (12:22 -0700)]
anv: Add pipeline_has_stage guards a few places

All of these worked before because they were depending on prog_data to be
null.  Soon, we won't be able to depend on a nice prog_data pointer and
it's nice to be more explicit anyway.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
7 years agoanv: Remove unused fields from anv_pipeline_bind_map
Jason Ekstrand [Thu, 25 Aug 2016 06:12:18 +0000 (23:12 -0700)]
anv: Remove unused fields from anv_pipeline_bind_map

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
7 years agoanv/pipeline: Properly handle OOM during shader compilation
Jason Ekstrand [Mon, 29 Aug 2016 15:30:37 +0000 (08:30 -0700)]
anv/pipeline: Properly handle OOM during shader compilation

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
7 years agoanv/allocator: Correctly set the number of buckets
Jason Ekstrand [Sat, 27 Aug 2016 02:31:05 +0000 (19:31 -0700)]
anv/allocator: Correctly set the number of buckets

The range from ANV_MIN_STATE_SIZE_LOG2 to ANV_MAX_STATE_SIZE_LOG2 should
be inclusive and we have asserts that ensure that you never try to allocate
a state larger than (1 << ANV_MAX_STATE_SIZE_LOG2).  However, without
adding 1 to the difference, we allocate 1 too few bucckts and so, even
though we have an assert, anything landing in the last bucket will fail to
allocate properly..

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
7 years agoanv/pipeline: Fix bind maps for fragment output arrays
Jason Ekstrand [Thu, 25 Aug 2016 19:21:51 +0000 (12:21 -0700)]
anv/pipeline: Fix bind maps for fragment output arrays

Found by inspection.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
7 years agoanv/descriptor_set: memset anv_descriptor_set_layout
Jason Ekstrand [Thu, 25 Aug 2016 09:37:19 +0000 (02:37 -0700)]
anv/descriptor_set: memset anv_descriptor_set_layout

We hash this data structure so we can't afford to have uninitialized data
even if it is just structure padding.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
7 years agodocs/helpwanted: fix GL3.txt/features.txt link
Eric Engestrom [Tue, 30 Aug 2016 20:16:26 +0000 (21:16 +0100)]
docs/helpwanted: fix GL3.txt/features.txt link

Fixes: f926cf5bd0ade3273b32 ("docs: Rename GL3.txt to features.txt")
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
CC: Andreas Boll <andreas.boll.dev@gmail.com>
7 years agoanv/wayland: fix assert typo
Eric Engestrom [Tue, 30 Aug 2016 10:30:12 +0000 (11:30 +0100)]
anv/wayland: fix assert typo

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agoanv/meta: fix unreachable() typo
Eric Engestrom [Tue, 30 Aug 2016 10:36:03 +0000 (11:36 +0100)]
anv/meta: fix unreachable() typo

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agost/nine: fix unreachable() typo
Eric Engestrom [Tue, 30 Aug 2016 10:36:02 +0000 (11:36 +0100)]
st/nine: fix unreachable() typo

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agoglsl: fix unreachable() typo
Eric Engestrom [Tue, 30 Aug 2016 10:36:01 +0000 (11:36 +0100)]
glsl: fix unreachable() typo

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agoget_reviewer.pl: fix mesa check
Eric Engestrom [Tue, 30 Aug 2016 20:16:25 +0000 (21:16 +0100)]
get_reviewer.pl: fix mesa check

This script was broken for the last few days and I couldn't figure out why.
Turns out it was checking for the existence of a file that got renamed,
so rename it in here too.

Fixes: f926cf5bd0ade3273b32 ("docs: Rename GL3.txt to features.txt")
CC: Ian Romanick <ian.d.romanick@intel.com>
CC: Rob Clark <robclark@freedesktop.org>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agoglsl: Initialize outputs[] array in lower_blend_equation_advanced.
Kenneth Graunke [Mon, 29 Aug 2016 04:43:54 +0000 (21:43 -0700)]
glsl: Initialize outputs[] array in lower_blend_equation_advanced.

Caught by Coverity.  Likely fixes real issues if an output component
is not present.

CID: 1372278
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agonvc0: fix indentation in nvc0_screen_init()
Samuel Pitoiset [Tue, 30 Aug 2016 14:45:30 +0000 (16:45 +0200)]
nvc0: fix indentation in nvc0_screen_init()

Trivial.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonvc0: check return value of nvc0_screen_resize_tls_area()
Samuel Pitoiset [Tue, 30 Aug 2016 14:45:29 +0000 (16:45 +0200)]
nvc0: check return value of nvc0_screen_resize_tls_area()

While we are at it, make it static and change the return values
policy to be consistent.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonvc0: make use of FAIL_SCREEN_INIT in nvc0_screen_create()
Samuel Pitoiset [Tue, 30 Aug 2016 14:45:28 +0000 (16:45 +0200)]
nvc0: make use of FAIL_SCREEN_INIT in nvc0_screen_create()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonv50/ir: always emit the NDV bit for OP_QUADOP
Samuel Pitoiset [Thu, 25 Aug 2016 16:41:05 +0000 (18:41 +0200)]
nv50/ir: always emit the NDV bit for OP_QUADOP

This silences a divergent error found with F1 2015.

Basically, the NDV bit has to be set when a FSWZ instruction is
inside divergent code, but it's not needed otherwise. The correct
fix should be to set it only in divergent code situations.

GM107 emitter already sets that bit.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: <mesa-stable@lists.freedesktop.org>
7 years agointel/blorp: Inline get_vs_entry_size into emit_urb_config
Jason Ekstrand [Mon, 29 Aug 2016 15:51:10 +0000 (08:51 -0700)]
intel/blorp: Inline get_vs_entry_size into emit_urb_config

Topi asked to have the prefix removed because there's nothing gen7 about
it.  However, now that everything is in a single file, there is no good
reason to have it split out into a helper function anyway.  Let's just put
the contents in emit_urb_config and call it a day.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoswr: [rasterizer] add archrast instrumentation
Tim Rowley [Mon, 29 Aug 2016 19:56:03 +0000 (14:56 -0500)]
swr: [rasterizer] add archrast instrumentation

Statistics measurement system

7 years agoi915: Check return value of screen->image.loader->getBuffers
Emil Velikov [Wed, 24 Aug 2016 11:50:33 +0000 (12:50 +0100)]
i915: Check return value of screen->image.loader->getBuffers

Ported from the i965 commit e7ab358e8186dd8651cf920d4db1500c60ccd2fc.

Cc: 11.2 12.0 <mesa-stable@lists.freedesktop.org>
Cc: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoegl/android: remove config post-processing
Emil Velikov [Thu, 25 Aug 2016 11:21:31 +0000 (12:21 +0100)]
egl/android: remove config post-processing

No longer needed as of last commit, since we no longer add OPENGL to the
ClientAPIs thus, RenderType and Conformant don't have the desktop GL
bit set.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
7 years agoegl/dri2: check if the EGL API is valid before adding it to ClientAPIs
Emil Velikov [Thu, 25 Aug 2016 11:15:13 +0000 (12:15 +0100)]
egl/dri2: check if the EGL API is valid before adding it to ClientAPIs

In the rather unlikely case that the API is considered invalid, don't
add it to the (supported) ClientAPIs bitmask.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
---
Strictly speaking we only need this in the Android case for OpenGL.
Adding it everywhere doesn't hurt us since the compiler will const
propagate and optimise/remove these.

7 years agoegl/android: annotate static const data as such
Emil Velikov [Thu, 25 Aug 2016 11:08:07 +0000 (12:08 +0100)]
egl/android: annotate static const data as such

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
7 years agoegl: treat EGL_OPENGL_API as invalid on Android
Emil Velikov [Thu, 25 Aug 2016 11:02:07 +0000 (12:02 +0100)]
egl: treat EGL_OPENGL_API as invalid on Android

At the moment one can use OpenGL in eglBindAPI() only to clear the
EGL_OPENGL_BIT from RenderableType and Conformant for _each_ config.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
7 years agonouveau: make color/depth bpp match for pre-nv10 chips
Ilia Mirkin [Sun, 28 Aug 2016 02:49:41 +0000 (22:49 -0400)]
nouveau: make color/depth bpp match for pre-nv10 chips

This avoids generating fbconfigs whose winsys framebuffers will be
incomplete (see nouveau_check_framebuffer_complete).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonouveau: always enable at least one RC
Ilia Mirkin [Sat, 27 Aug 2016 23:51:29 +0000 (19:51 -0400)]
nouveau: always enable at least one RC

Experimentally, this is required for glxgears and others to display the
proper colors. This is also what the code used to do before the
referenced commit.

Fixes: c703658b396 (mesa: Drop _EnabledUnits.)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
7 years agonouveau: allow NV3x's to be used with nouveau_vieux
Ilia Mirkin [Sat, 27 Aug 2016 23:46:25 +0000 (19:46 -0400)]
nouveau: allow NV3x's to be used with nouveau_vieux

NV34 and possibly other NV3x hardware has the capability of exposing the
NV25 graph class. This allows forcing nouveau_vieux to be used instead
of the gallium driver, primarily for testing purposes. (Among other
things, NV2x only ever came as AGP or inside an Xbox, never PCI/PCIe).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonvc0: undo overzealous enum usage
Ilia Mirkin [Tue, 30 Aug 2016 04:16:17 +0000 (00:16 -0400)]
nvc0: undo overzealous enum usage

Commit 7413625ad3 flipped a few functions too many to use
pipe_shader_type. These functions actually take an integer that does not
correspond 1:1 with the enum.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agosvga: fix a texture readback bug
Brian Paul [Fri, 26 Aug 2016 22:25:39 +0000 (16:25 -0600)]
svga: fix a texture readback bug

Backing views/surfaces are used to handle the case when a resource is
bound both as a render target and as a sampler source (such as when
doing auto mipmap generation).

This patch fixes a bug where mapping a resource (to do a glReadPixels)
was reading the stale data in the original surface rather than the
backing surface which was rendered to.

We need to propagate the backing resource (which we rendered to) back
to the original resource before we read from it.  The problem was the
svga_propagate_rendertargets() function was examining the wrong surface
views.

This fixes the "poc9" test described in VMware bug 1686661.
Also tested with Piglit, Cinebench, Lightsmark, etc.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: move surface propagation code into new function
Brian Paul [Fri, 26 Aug 2016 15:53:47 +0000 (09:53 -0600)]
svga: move surface propagation code into new function

Put new svga_propagate_rendertargets() function where all the other
surface propagation code lives.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agomesa: fix format conversion bug in get_tex_rgba_uncompressed()
Brian Paul [Mon, 29 Aug 2016 17:18:18 +0000 (11:18 -0600)]
mesa: fix format conversion bug in get_tex_rgba_uncompressed()

We need to set the need_convert flag with each loop iteration, not
just when the rgba pointer is null.

Bug reported by Markus Müller <mueller@imfusion.de> on mesa-users list.
Fixes new piglit arb_texture_float-get-tex3d test.

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agoradeonsi: add support for cull distances. (v1.1)
Dave Airlie [Fri, 13 May 2016 06:49:02 +0000 (16:49 +1000)]
radeonsi: add support for cull distances. (v1.1)

This should be all that is required for cull distances to work
on radeonsi.

v1.1: whitespace cleanup, add docs fix clipdist_mask usage.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agospirv: replace assert with unreachable
Timothy Arceri [Mon, 29 Aug 2016 02:13:52 +0000 (12:13 +1000)]
spirv: replace assert with unreachable

Fixes uninitialised warning for coord_components.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
7 years agoisl/state: Add some asserts about format capabilities
Jason Ekstrand [Tue, 26 Jul 2016 18:47:05 +0000 (11:47 -0700)]
isl/state: Add some asserts about format capabilities

This keeps invalid surface states from leaking through and potentially
hanging the GPU.  We shouldn't actually be hitting this on a regular basis,
but a helpful assert is better than a hang.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agointel/blorp: Add a format parameter to blorp_fast_clear
Jason Ekstrand [Wed, 24 Aug 2016 00:13:07 +0000 (17:13 -0700)]
intel/blorp: Add a format parameter to blorp_fast_clear

This allows us to use the actual render format as opposed to the texture
format.  I don't know that the hardware actually cares in the case of fast
clears, but it certainly seems more correct.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Move blorp into src/intel/blorp
Jason Ekstrand [Fri, 19 Aug 2016 11:27:18 +0000 (04:27 -0700)]
i965: Move blorp into src/intel/blorp

At this point, blorp is completely driver agnostic and can be safely moved
into its own folder.  Soon, we hope to start using it for doing blits in
the Vulkan driver.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Remove the remaining brw prefixes from the blorp.h API
Jason Ekstrand [Fri, 19 Aug 2016 12:43:29 +0000 (05:43 -0700)]
i965/blorp: Remove the remaining brw prefixes from the blorp.h API

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Use isl_format_get_depth_format for setting depth formats
Jason Ekstrand [Fri, 19 Aug 2016 11:30:25 +0000 (04:30 -0700)]
i965/blorp: Use isl_format_get_depth_format for setting depth formats

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Move the type_size function declartaions to brw_nir.h
Jason Ekstrand [Fri, 19 Aug 2016 11:28:31 +0000 (04:28 -0700)]
i965: Move the type_size function declartaions to brw_nir.h

Signed-of-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agoi965: Move get_fast_clear_rect to blorp_clear.c
Jason Ekstrand [Fri, 19 Aug 2016 10:53:33 +0000 (03:53 -0700)]
i965: Move get_fast_clear_rect to blorp_clear.c

This has been the only caller since we deleted the meta fast clear code.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Roll brw_get_ccs_resolve_rect into blorp_ccs_resolve
Jason Ekstrand [Fri, 19 Aug 2016 10:49:45 +0000 (03:49 -0700)]
i965: Roll brw_get_ccs_resolve_rect into blorp_ccs_resolve

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Get rid of most brw and mesa includes
Jason Ekstrand [Fri, 19 Aug 2016 08:58:41 +0000 (01:58 -0700)]
i965/blorp: Get rid of most brw and mesa includes

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Move the hiz_op enum to blorp
Jason Ekstrand [Fri, 19 Aug 2016 10:15:41 +0000 (03:15 -0700)]
i965: Move the hiz_op enum to blorp

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Add a fast_clear_op enum
Jason Ekstrand [Fri, 19 Aug 2016 09:23:04 +0000 (02:23 -0700)]
i965/blorp: Add a fast_clear_op enum

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Make blorp_addres::buffer a void*
Jason Ekstrand [Fri, 19 Aug 2016 08:42:31 +0000 (01:42 -0700)]
i965/blorp: Make blorp_addres::buffer a void*

The Vulkan driver doesn't use libdrm so we don't want to bake that in.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Get rid of brw_context
Jason Ekstrand [Fri, 19 Aug 2016 07:54:56 +0000 (00:54 -0700)]
i965/blorp: Get rid of brw_context

This commit switches all of blorp from taking a brw_context to taking a
blorp_context and, where useful, a void *batch.  In the GL driver, we only
have one active batch at a time so the brw_context *is* the batch but in
Vulkan, batch will point to the anv_cmd_buffer in which we are building
instructions.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Take a blorp_context in compile_nir_shader
Jason Ekstrand [Fri, 19 Aug 2016 07:49:18 +0000 (00:49 -0700)]
i965/blorp: Take a blorp_context in compile_nir_shader

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/meta_util: Take an isl_device in get_fast_clear_rect
Jason Ekstrand [Fri, 19 Aug 2016 07:37:38 +0000 (00:37 -0700)]
i965/meta_util: Take an isl_device in get_fast_clear_rect

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Add an "exec" function pointer to blorp_context
Jason Ekstrand [Thu, 18 Aug 2016 17:02:03 +0000 (10:02 -0700)]
i965/blorp: Add an "exec" function pointer to blorp_context

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Remove some i965-isms from genX_blorp_exec.h
Jason Ekstrand [Tue, 23 Aug 2016 23:49:08 +0000 (16:49 -0700)]
i965/blorp: Remove some i965-isms from genX_blorp_exec.h

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Move the guts of brw_blorp_exec into genX_blorp_exec.c
Jason Ekstrand [Thu, 18 Aug 2016 16:44:45 +0000 (09:44 -0700)]
i965/blorp: Move the guts of brw_blorp_exec into genX_blorp_exec.c

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Pull the guts of blorp_exec into a driver-agnostic header
Jason Ekstrand [Thu, 18 Aug 2016 16:36:58 +0000 (09:36 -0700)]
i965/blorp: Pull the guts of blorp_exec into a driver-agnostic header

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp/exec: Refactor to use a new blorp_batch struct
Jason Ekstrand [Wed, 17 Aug 2016 15:31:53 +0000 (08:31 -0700)]
i965/blorp/exec: Refactor to use a new blorp_batch struct

This gets rid of brw_context throughout the core of the state setup code.
Instead, it is replaced with blorp_batch which contains a pointer to the
blorp_context and a void* that the driver can use for its own blorp data.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Add a helper for allocating binding tables and surface states
Jason Ekstrand [Thu, 18 Aug 2016 13:36:06 +0000 (06:36 -0700)]
i965/blorp: Add a helper for allocating binding tables and surface states

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Use BT_INDEX enums for setting up the binding table
Jason Ekstrand [Thu, 18 Aug 2016 13:29:51 +0000 (06:29 -0700)]
i965/blorp: Use BT_INDEX enums for setting up the binding table

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Shorten binding table index enum names
Jason Ekstrand [Thu, 18 Aug 2016 13:29:35 +0000 (06:29 -0700)]
i965/blorp: Shorten binding table index enum names

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp/genX: Add a blorp_surface_reloc helper
Jason Ekstrand [Thu, 18 Aug 2016 09:57:33 +0000 (02:57 -0700)]
i965/blorp/genX: Add a blorp_surface_reloc helper

Previously, we passed the buffer address (as per the latest offset from the
kernel) to ISL to use when it filled out the surface state.  We then called
drm_intel_bo_emit_reloc() to add the relocation to the list.  The newly
added blorp_surface_reloc helper adds the relocation to the list and then
writes the buffer address directly into the surface state.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Use blorp_address in brw_blorp_surface instead of bo+offset
Jason Ekstrand [Thu, 18 Aug 2016 09:19:29 +0000 (02:19 -0700)]
i965/blorp: Use blorp_address in brw_blorp_surface instead of bo+offset

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Pull emit_surface_state into genX_blorp_exec.c
Jason Ekstrand [Wed, 17 Aug 2016 16:42:18 +0000 (09:42 -0700)]
i965/blorp: Pull emit_surface_state into genX_blorp_exec.c

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Add driver mocs settings to the context
Jason Ekstrand [Wed, 17 Aug 2016 16:31:27 +0000 (09:31 -0700)]
i965/blorp: Add driver mocs settings to the context

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp/genX: Move emit_urb_config into another helper
Jason Ekstrand [Wed, 17 Aug 2016 15:08:36 +0000 (08:08 -0700)]
i965/blorp/genX: Move emit_urb_config into another helper

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Use gen6_upload_urb
Jason Ekstrand [Wed, 17 Aug 2016 15:04:43 +0000 (08:04 -0700)]
i965/blorp: Use gen6_upload_urb

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/gen6: Refactor gen6_upload_urb
Jason Ekstrand [Wed, 17 Aug 2016 15:01:01 +0000 (08:01 -0700)]
i965/gen6: Refactor gen6_upload_urb

This splits it into two functions very similar to gen7_upload_urb.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp/genX: Pull emit_3dstate_multisample into a helper
Jason Ekstrand [Wed, 17 Aug 2016 13:55:59 +0000 (06:55 -0700)]
i965/blorp/genX: Pull emit_3dstate_multisample into a helper

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp/genX: Add helpers for allocating various bits of state
Jason Ekstrand [Wed, 17 Aug 2016 13:37:59 +0000 (06:37 -0700)]
i965/blorp/genX: Add helpers for allocating various bits of state

This pulls most of the brw-specific bits into helpers with generic names.
Later, those will become the driver hooks for generic code.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>