mesa.git
8 years agonir: Replace vecN(undef, undef, ...) with a single undef.
Kenneth Graunke [Wed, 20 Apr 2016 08:42:25 +0000 (01:42 -0700)]
nir: Replace vecN(undef, undef, ...) with a single undef.

shader-db statistics on Broadwell:

total instructions in shared programs: 8963409 -> 8962455 (-0.01%)
instructions in affected programs: 60858 -> 59904 (-1.57%)
helped: 318
HURT: 0

total cycles in shared programs: 71408022 -> 71406276 (-0.00%)
cycles in affected programs: 398416 -> 396670 (-0.44%)
helped: 199
HURT: 51

GAINED: 1

The only shaders affected were in Dota 2 Reborn.

It also sets up for the next optimization.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agonir: Rename opt_undef_alu to opt_undef_csel; update comments.
Kenneth Graunke [Wed, 20 Apr 2016 08:15:53 +0000 (01:15 -0700)]
nir: Rename opt_undef_alu to opt_undef_csel; update comments.

This better reflects what it does.  I plan to add other ALU
optimizations as well, so the old name would be confusing.

In preparation for that, also move the file comments about csels
above the opt_undef_csel function, and delete the ones about there
not being other optimizations.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965: Rework passthrough TCS checks.
Kenneth Graunke [Tue, 3 May 2016 20:14:31 +0000 (13:14 -0700)]
i965: Rework passthrough TCS checks.

According to Timothy, using program_string_id == 0 to identify the
passthrough TCS is going to be problematic for his shader cache work.

So, change it to strcmp() the name at visitor creation time.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoswr: [rasterizer core] Faster modulo operator in ProcessVerts
Tim Rowley [Mon, 2 May 2016 20:09:39 +0000 (14:09 -0600)]
swr: [rasterizer core] Faster modulo operator in ProcessVerts

Avoid % operator, since we know that curVertex is always incrementing.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agoswr: [rasterizer] Small warning cleanup
Tim Rowley [Mon, 2 May 2016 19:35:25 +0000 (13:35 -0600)]
swr: [rasterizer] Small warning cleanup

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agoswr: [rasterizer] Add SWR_ASSUME / SWR_ASSUME_ASSERT macros
Tim Rowley [Mon, 2 May 2016 17:37:37 +0000 (11:37 -0600)]
swr: [rasterizer] Add SWR_ASSUME / SWR_ASSUME_ASSERT macros

Fix static code analysis errors found by coverity on Linux

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agoswr: [rasterizer] Miscellaneous backend changes
Tim Rowley [Sat, 30 Apr 2016 20:07:20 +0000 (14:07 -0600)]
swr: [rasterizer] Miscellaneous backend changes

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agoswr: [rasterizer] Add support for X24_TYPELESS_G8_UINT format
Tim Rowley [Fri, 29 Apr 2016 18:15:34 +0000 (12:15 -0600)]
swr: [rasterizer] Add support for X24_TYPELESS_G8_UINT format

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agoswr: [rasterizer jitter] Fix printing bugs for tracing.
Tim Rowley [Fri, 29 Apr 2016 06:25:45 +0000 (00:25 -0600)]
swr: [rasterizer jitter] Fix printing bugs for tracing.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agoswr: [rasterizer memory] Add missing store tiles function
Tim Rowley [Thu, 28 Apr 2016 06:58:26 +0000 (00:58 -0600)]
swr: [rasterizer memory] Add missing store tiles function

Storing color hot tile to 8bit w-major stencil format.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agoswr: [rasterizer jitter] Add asserts for supported formats in fetch shader
Tim Rowley [Wed, 27 Apr 2016 23:16:26 +0000 (17:16 -0600)]
swr: [rasterizer jitter] Add asserts for supported formats in fetch shader

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agoswr: [rasterizer core] Fix thread allocation
Tim Rowley [Wed, 27 Apr 2016 22:45:13 +0000 (16:45 -0600)]
swr: [rasterizer core] Fix thread allocation

Fix windows in 32-bit mode when hyperthreading is disabled on Xeons.

Some support for asymmetric processor topologies.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agoswr: [rasterizer core] Fix threadviz support in buckets
Tim Rowley [Wed, 27 Apr 2016 19:02:27 +0000 (13:02 -0600)]
swr: [rasterizer core] Fix threadviz support in buckets

Need to do lazy eval of the threadviz knob since order of globals
is undefined.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agoswr: [rasterizer] Whitespace cleanup and misc changes
Tim Rowley [Mon, 25 Apr 2016 20:19:58 +0000 (14:19 -0600)]
swr: [rasterizer] Whitespace cleanup and misc changes

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agoradeonsi: mark descriptor loads as using dynamically uniform indices
Nicolai Hähnle [Mon, 2 May 2016 21:22:03 +0000 (16:22 -0500)]
radeonsi: mark descriptor loads as using dynamically uniform indices

This tells LLVM to always use SMEM loads for descriptors. It fixes a
regression in piglit's arb_shader_storage_buffer_object/execution/indirect.shader_test
that was caused by LLVM r268259 (but the proper fix is really here in Mesa).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoi965/fs: Don't follow pow with an instruction with two dest regs.
Matt Turner [Tue, 3 May 2016 06:32:13 +0000 (23:32 -0700)]
i965/fs: Don't follow pow with an instruction with two dest regs.

Beginning with commit 7b208a73, Unigine Valley began hanging the GPU on
Gen >= 8 platforms.

Evidently that commit allowed the scheduler to make different choices
that somehow finally ran afoul of a hardware bug in which POW and FDIV
instructions may not be followed by an instruction with two destination
registers (including compressed instructions). I presume the conditions
are more complex than that, but the internal hardware bug report (BDWGFX
bug_de 1696294) does not contain much more information.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94924
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com> [v1]
Tested-by: Mark Janes <mark.a.janes@intel.com> [v1]
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoswr: Remove stall waiting for core query counters.
Bruce Cherniak [Thu, 28 Apr 2016 17:13:15 +0000 (12:13 -0500)]
swr: Remove stall waiting for core query counters.

When gathering query results, swr_gather_stats was
unnecessarily stalling the entire pipeline.  Results are now
collected asynchronously, with a fence marking completion.

Reviewed-By: George Kyriazis <george.kyriazis@intel.com>
8 years agomesa/ubo: add missing compute cases for ubo/atomic buffers
Dave Airlie [Thu, 5 May 2016 03:11:11 +0000 (13:11 +1000)]
mesa/ubo: add missing compute cases for ubo/atomic buffers

This fixes: GL43-CTS.compute_shader.resource-ubo

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agomesa/compute: drop pointless casts.
Dave Airlie [Thu, 5 May 2016 00:41:29 +0000 (10:41 +1000)]
mesa/compute: drop pointless casts.

We already are a GLintptr, casting won't help.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agomesa: remove null check before free
Thomas Hindoe Paaboel Andersen [Wed, 4 May 2016 04:15:37 +0000 (06:15 +0200)]
mesa: remove null check before free

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
8 years agofreedreno: remove null check before free
Thomas Hindoe Paaboel Andersen [Wed, 4 May 2016 04:15:36 +0000 (06:15 +0200)]
freedreno: remove null check before free

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
8 years agonir: fix assert for wildcard pairs
Thomas Hindoe Paaboel Andersen [Wed, 4 May 2016 03:48:39 +0000 (05:48 +0200)]
nir: fix assert for wildcard pairs

The assert was null checking dest_arr_parent twice. The intention
seems to be to check both dest_ and src_.

Added in d3636da9

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
8 years agoglapi: fix parameter type for GetSamplerParameterIuivEXT() in es_EXT.xml
Brian Paul [Wed, 4 May 2016 20:02:30 +0000 (14:02 -0600)]
glapi: fix parameter type for GetSamplerParameterIuivEXT() in es_EXT.xml

The function returns GLuint, not GLfloat values.

v2: also fix the OES function

Cc: "11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa: include texture format in glGenerateMipmap error message
Brian Paul [Wed, 4 May 2016 20:01:29 +0000 (14:01 -0600)]
mesa: include texture format in glGenerateMipmap error message

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agomain: uses casts to silence some _mesa_debug() format warnings
Brian Paul [Tue, 3 May 2016 01:10:06 +0000 (19:10 -0600)]
main: uses casts to silence some _mesa_debug() format warnings

Silences warnings with 32-bit Linux gcc builds and MinGW which doesn't
recognize the ‘t’ conversion character.

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
8 years agodocs: Mark GL_ARB_query_buffer_object as done for i965/hsw+
Jordan Justen [Sun, 17 Apr 2016 21:07:47 +0000 (14:07 -0700)]
docs: Mark GL_ARB_query_buffer_object as done for i965/hsw+

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Implement ARB_query_buffer_object for HSW+
Jordan Justen [Tue, 19 Apr 2016 16:42:13 +0000 (09:42 -0700)]
i965: Implement ARB_query_buffer_object for HSW+

v2:
 * Declare loop index variable at loop site (idr)
 * Make arrays of MI_MATH instructions 'static const' (idr)
 * Remove commented debug code (idr)
 * Updated comment in set_query_availability (Ken)
 * Replace switch with if/else in hsw_result_to_gpr0 (Ken)
 * Only divide GL_FRAGMENT_SHADER_INVOCATIONS_ARB by 4 on
   hsw and gen8 (Ken)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965/gen6+: Add load register immediate helper functions
Jordan Justen [Tue, 19 Apr 2016 16:38:50 +0000 (09:38 -0700)]
i965/gen6+: Add load register immediate helper functions

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/hsw+: Add support for copying a register
Jordan Justen [Tue, 19 Apr 2016 16:34:40 +0000 (09:34 -0700)]
i965/hsw+: Add support for copying a register

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/gen6+: Add support for storing immediate data into a buffer
Jordan Justen [Mon, 18 Apr 2016 23:19:34 +0000 (16:19 -0700)]
i965/gen6+: Add support for storing immediate data into a buffer

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Add MI_MATH reg defs for HSW+
Jordan Justen [Sun, 17 Apr 2016 20:48:28 +0000 (13:48 -0700)]
i965: Add MI_MATH reg defs for HSW+

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Add brw_store_register_mem32
Jordan Justen [Fri, 15 Apr 2016 02:43:45 +0000 (19:43 -0700)]
i965: Add brw_store_register_mem32

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Use offset instead of index in brw_store_register_mem64
Jordan Justen [Sun, 17 Apr 2016 20:08:01 +0000 (13:08 -0700)]
i965: Use offset instead of index in brw_store_register_mem64

This matches the byte based offset of brw_load_register_mem*.

The function is also moved into intel_batchbuffer.c like
brw_load_register_mem*.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agor600,compute: create vtx buffer for text + rodata
Jan Vesely [Sat, 9 May 2015 15:52:29 +0000 (11:52 -0400)]
r600,compute: create vtx buffer for text + rodata

Reserve buffer id 2

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
8 years agofreedreno: allow ctx->draw_vbo to fail
Rob Clark [Tue, 3 May 2016 22:36:52 +0000 (18:36 -0400)]
freedreno: allow ctx->draw_vbo to fail

Pretty much only happens if shader variant compile fails.  But in this
case, if we haven't emitted cmdstream, we don't want to set needs_flush.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno: move shader-stage dirty bits to global dirty flag
Rob Clark [Tue, 3 May 2016 20:54:21 +0000 (16:54 -0400)]
freedreno: move shader-stage dirty bits to global dirty flag

This was always a bit overly complicated, and had some issues (like
ctx->prog.dirty not getting reset at the end of the batch).  It also
required some special hacks to avoid resetting dirty state on binning
pass.  So just move it all into ctx->dirty (leaving some free bits
for future shader stages), and make FD_DIRTY_PROG just be the union
of all FD_SHADER_DIRTY_*.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/a4xx: fix bogus offset for f32x24s8 stencil restore
Rob Clark [Tue, 3 May 2016 19:21:15 +0000 (15:21 -0400)]
freedreno/a4xx: fix bogus offset for f32x24s8 stencil restore

fixes: $piglit/bin/fbo-clear-formats GL_ARB_depth_buffer_float

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno: add some debug_asserts() to catch insane offsets
Rob Clark [Tue, 3 May 2016 19:20:13 +0000 (15:20 -0400)]
freedreno: add some debug_asserts() to catch insane offsets

Ofc won't catch *all* faults, but at least helpful for catching offsets
which are completely bogus.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/a4xx: deal with VS which do not write position
Rob Clark [Tue, 3 May 2016 16:43:12 +0000 (12:43 -0400)]
freedreno/a4xx: deal with VS which do not write position

Fixes $piglit/bin/glsl-1.40-tf-no-position

a3xx may need similar?

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: remove a couple redundant is_flow()s
Rob Clark [Tue, 3 May 2016 15:47:47 +0000 (11:47 -0400)]
freedreno/ir3: remove a couple redundant is_flow()s

Now that the opc's encode the instruction category (making them unique)
we no longer need to check the category in addition to the opc.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: cp small negative integers too
Rob Clark [Sun, 1 May 2016 14:06:57 +0000 (10:06 -0400)]
freedreno/ir3: cp small negative integers too

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: fix # of registers
Rob Clark [Sat, 30 Apr 2016 17:47:04 +0000 (13:47 -0400)]
freedreno/ir3: fix # of registers

The instruction encoding allows for more registers, but at least on
a3xx/a4xx they don't actually exist.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: lower immeds to const
Rob Clark [Mon, 11 Apr 2016 18:47:19 +0000 (14:47 -0400)]
freedreno/ir3: lower immeds to const

Helps reduce register pressure and instruction counts for immediates
that would otherwise require a mov into gpr.

total instructions in shared programs:          4455332 -> 4369297 (-1.93%)
total dwords in shared programs:                8807872 -> 8614432 (-2.20%)
total full registers used in shared programs:   263062 -> 250846 (-4.64%)
total half registers used in shader programs:   9845 -> 9845 (0.00%)
total const registers used in shared programs:  1029735 -> 1466993 (42.46%)

                 half       full      const      instr     dwords
    helped           0       10415           0       17861        5912
      hurt           0        1157       21458         947          33

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: add ir3_cp_ctx
Rob Clark [Mon, 11 Apr 2016 18:33:01 +0000 (14:33 -0400)]
freedreno/ir3: add ir3_cp_ctx

Needed in next commit.. just split out to reduce noise.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agoadd REVIEWERS and get_reviewer.pl script
Rob Clark [Tue, 19 Apr 2016 20:55:09 +0000 (16:55 -0400)]
add REVIEWERS and get_reviewer.pl script

Copied from linux kernel (where it is called MAINTAINERS and
get_maintainer.pl), with minimal changes to script (to recognize
mesa src tree rather than linux kernel src tree, and to avoid
accidentaly CC'ing Linus Torvalds on mesa patches), and slimmed
down MAINTAINER file syntax to recognize that we don't really have
subsystem "maintainers" in the same sense as the linux kernel (ie. no
different mailing lists and git trees per subsystem).

The main point is to automate slapping on the correct CC's for patches
via git's --cc-cmd feature, more than anything else.

I didn't attempt to fully populate the REVIEWERS file, by a long shot.
This is an opt-in system and anyone else can add their own entries.

To utilize:

  git send-email --cc-cmd ./scripts/get_reviewer.pl ...

or to configure it to be the default:

  git config sendemail.cccmd ./scripts/get_reviewer.pl

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agonouveau/video: properly detect the decoder class for availability checks
Ilia Mirkin [Wed, 4 May 2016 05:28:23 +0000 (01:28 -0400)]
nouveau/video: properly detect the decoder class for availability checks

The kernel is now more strict with the class ids it exposes, so we need
to check the G98 and MCP89 classes as well as the GT215 class. This
effectively caused us to decide there were no decoding capabilities on
newer kernel for VP3 chips.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95251
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.2" <mesa-stable@lists.freedesktop.org>
8 years agoi965: Delete stale perf_debug().
Kenneth Graunke [Wed, 4 May 2016 09:28:31 +0000 (02:28 -0700)]
i965: Delete stale perf_debug().

MOCS for 3DSTATE_SO_BUFFER has existed for ages.

8 years agoi965: Silence unused variable warning
Kenneth Graunke [Wed, 4 May 2016 07:46:31 +0000 (00:46 -0700)]
i965: Silence unused variable warning

I added this when deleting some unnecessary code in a rebase.

8 years agomesa/main: handle double uniform matrices properly
Juan A. Suarez Romero [Tue, 9 Feb 2016 11:51:03 +0000 (12:51 +0100)]
mesa/main: handle double uniform matrices properly

When computing the offset in the uniform storage table, take into account
the size multiplier so double precision matrices are handled correctly.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonir: Separate 32 and 64-bit fmod lowering
Samuel Iglesias Gonsálvez [Thu, 28 Apr 2016 10:19:13 +0000 (12:19 +0200)]
nir: Separate 32 and 64-bit fmod lowering

Split 32-bit and 64-bit fmod lowering as the drivers might need to
lower them separately inside NIR depending on the HW support.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir/lower_double_ops: lower mod()
Samuel Iglesias Gonsálvez [Tue, 12 Apr 2016 08:55:44 +0000 (10:55 +0200)]
nir/lower_double_ops: lower mod()

There are rounding errors with the division in i965 that affect
the mod(x,y) result when x = N * y. Instead of returning '0' it
was returning 'y'.

This lowering pass fixes those cases.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Define GEN_GE/GEN_LE macros in terms of GEN_LT.
Matt Turner [Sun, 1 May 2016 20:20:25 +0000 (13:20 -0700)]
i965: Define GEN_GE/GEN_LE macros in terms of GEN_LT.

GEN_LT has a straightforward implementation on which we can build the
GEN_GE and GEN_LE macros.

Suggested-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Add disassembler support for remaining opcodes.
Matt Turner [Sat, 30 Apr 2016 00:03:43 +0000 (17:03 -0700)]
i965: Add disassembler support for remaining opcodes.

For opcodes that changed meaning on different generations, we store a
pointer to a secondary table and the table's size in a tagged union in
place of the mnemonic and number of sources.

Acked-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Make opcode_descs and gen_from_devinfo() static.
Matt Turner [Fri, 29 Apr 2016 23:56:35 +0000 (16:56 -0700)]
i965: Make opcode_descs and gen_from_devinfo() static.

The previous commit replaced direct uses of opcode_descs with calls to
the wrapper function, which should be the only method of accessing
opcode_descs's data. As a result gen_from_devinfo() can also be made
static.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Actually check whether the opcode is supported.
Matt Turner [Fri, 29 Apr 2016 23:54:55 +0000 (16:54 -0700)]
i965: Actually check whether the opcode is supported.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Merge inst_info and opcode_desc tables.
Matt Turner [Fri, 29 Apr 2016 23:34:10 +0000 (16:34 -0700)]
i965: Merge inst_info and opcode_desc tables.

I merged opcode_desc into inst_info (instead of the other way around)
because inst_info was sorted by opcode number.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Move inst_info from brw_eu_validate.c to brw_eu.c.
Matt Turner [Fri, 29 Apr 2016 23:07:44 +0000 (16:07 -0700)]
i965: Move inst_info from brw_eu_validate.c to brw_eu.c.

Drop the uses of 'enum gen' to a plain int, so that we don't have to
expose the bitfield definitions and GEN_GE/GEN_LE macros to other users
of brw_eu.h. As a result, s/.gen/.gens/ to avoid confusion with
devinfo->gen.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/disasm: Wrap opcode_desc look-up in a function.
Francisco Jerez [Thu, 28 Apr 2016 07:19:14 +0000 (00:19 -0700)]
i965/disasm: Wrap opcode_desc look-up in a function.

The function takes a device info struct as argument in addition to the
opcode number in order to disambiguate between multiple opcode_desc
entries for different instructions with the same opcode number.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> [v1]
[v2] mattst88: Put brw_opcode_desc() in brw_eu.c instead of moving it
               there in a later patch.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v2]
[v3] mattst88: Return NULL if opcode >= ARRAY_SIZE(opcode_descs)
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965: Pass devinfo pointer to is_3src() helpers.
Francisco Jerez [Thu, 28 Apr 2016 07:19:13 +0000 (00:19 -0700)]
i965: Pass devinfo pointer to is_3src() helpers.

This is not strictly required for the following changes because none
of the three-source opcodes we support at the moment in the compiler
back-end has been removed or redefined, but that's likely to change in
the future.  In any case having hardware instructions specified as a
pair of hardware device and opcode number explicitly in all cases will
simplify the opcode look-up interface introduced in a subsequent
commit, since the opcode number alone is in general ambiguous.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Pass devinfo pointer to brw_instruction_name().
Francisco Jerez [Thu, 28 Apr 2016 07:19:12 +0000 (00:19 -0700)]
i965: Pass devinfo pointer to brw_instruction_name().

A future series will implement support for an instruction that happens
to have the same opcode number as another instruction we support
already on a disjoint set of hardware generations.  In order to
disambiguate which instruction it is brw_instruction_name() will need
some way to find out which device we are generating code for.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Write a scalar TCS backend that runs in SINGLE_PATCH mode.
Kenneth Graunke [Sun, 15 Nov 2015 01:40:43 +0000 (17:40 -0800)]
i965: Write a scalar TCS backend that runs in SINGLE_PATCH mode.

Unlike most shader stages, the Hull Shader hardware makes us explicitly
tell it how many threads to dispatch and manually configure the channel
mask.  One perk of this is that we have a lot of flexibility - we can
run it in either SIMD4x2 or SIMD8 mode.

Treating it as SIMD8 means that shaders with 8 or fewer output vertices
(which is overwhemingly the common case) can be handled by a single
thread.  This has several intriguing properties:

- Accessing input arrays with gl_InvocationID as the index is a simple
  SIMD8 URB read with g1 as the header.  No indirect addressing required.
- Barriers are no-ops.
- We could potentially do output shadowing to combine writes, as the
  concurrency concerns are gone.  (We don't do this yet, though.)

v2: Drop first_non_payload_grf change, as it was always adding 0
    (caught by Jordan Justen).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Rework the TCS passthrough shader to use NIR.
Kenneth Graunke [Sat, 9 Apr 2016 06:19:34 +0000 (23:19 -0700)]
i965: Rework the TCS passthrough shader to use NIR.

I'm about to implement a scalar TCS backend, and I'd rather not
duplicate all of this code there.

One change is that we now write the tessellation levels from all
TCS threads, rather than just the first.  This is pretty harmless,
and was easier.  The IF/ENDIF needed for that are gone; otherwise
the generated code is basically identical.

I chose to emit load/store intrinsics directly because it was easier.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agogallium/util: change assertion to conditional in util_bitmask_destroy()
Brian Paul [Tue, 3 May 2016 21:07:56 +0000 (15:07 -0600)]
gallium/util: change assertion to conditional in util_bitmask_destroy()

If we fail to create a context in the VMware driver we call this function
unconditionally to free a bunch of bit vectors.  Instead of asserting on
a null pointer, just no-op.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agocso: null-out previously bound sampler states
Brian Paul [Mon, 2 May 2016 16:24:43 +0000 (10:24 -0600)]
cso: null-out previously bound sampler states

If, for example, we previously had 2 sampler states bound and now we
are binding one, we'd leave the second sampler state unchanged.
This change nulls-out the second sampler state in this situation.
We're already doing the same thing for sampler views.

This silences an occasional warning issued by the VMware driver when
the number of sampler views and sampler states disagreed.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agosvga: try to flag surfaces for sampling, in addition to rendering
Brian Paul [Mon, 2 May 2016 16:29:52 +0000 (10:29 -0600)]
svga: try to flag surfaces for sampling, in addition to rendering

This silences some warnings when we try to sample from surfaces that were
created for drawing, such as when blitting from one of the framebuffer
surfaces.  We were already doing the opposite situation (adding a bind
flag for rendering to surfaces declared as texture sources).

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agosvga: fix copying non-zero layers of 1D array textures
Brian Paul [Mon, 2 May 2016 16:33:18 +0000 (10:33 -0600)]
svga: fix copying non-zero layers of 1D array textures

Like cube maps, we need to convert the z information to a layer index.
Also rename the *_face vars to *_face_layer to make things a little more
understandable.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agosvga: clean up svga_pipe_blit.c
Brian Paul [Mon, 2 May 2016 23:57:43 +0000 (17:57 -0600)]
svga: clean up svga_pipe_blit.c

Remove dead code.  Fix formatting.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agorbug: s/Elements/ARRAY_SIZE/
Brian Paul [Thu, 28 Apr 2016 17:42:58 +0000 (11:42 -0600)]
rbug: s/Elements/ARRAY_SIZE/

Signed-off-by: Brian Paul <brianp@vmware.com>
8 years agofreedreno: s/Elements/ARRAY_SIZE/
Brian Paul [Thu, 28 Apr 2016 17:41:39 +0000 (11:41 -0600)]
freedreno: s/Elements/ARRAY_SIZE/

Signed-off-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agotrace: s/Elements/ARRAY_SIZE/
Brian Paul [Thu, 28 Apr 2016 17:40:28 +0000 (11:40 -0600)]
trace: s/Elements/ARRAY_SIZE/

Signed-off-by: Brian Paul <brianp@vmware.com>
8 years agoilo: s/Elements/ARRAY_SIZE/
Brian Paul [Thu, 28 Apr 2016 17:39:15 +0000 (11:39 -0600)]
ilo: s/Elements/ARRAY_SIZE/

Signed-off-by: Brian Paul <brianp@vmware.com>
8 years agoi915g: s/Elements/ARRAY_SIZE/
Brian Paul [Thu, 28 Apr 2016 17:37:50 +0000 (11:37 -0600)]
i915g: s/Elements/ARRAY_SIZE/

Signed-off-by: Brian Paul <brianp@vmware.com>
8 years agonvc0: compute a percentage for metric-achieved_occupancy
Samuel Pitoiset [Mon, 2 May 2016 20:12:44 +0000 (22:12 +0200)]
nvc0: compute a percentage for metric-achieved_occupancy

metric-issue_slot_utilization and metric-branch_efficiency are already
computed as percentages.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agonvc0: display some performance metrics with a percentage
Samuel Pitoiset [Mon, 2 May 2016 20:12:43 +0000 (22:12 +0200)]
nvc0: display some performance metrics with a percentage

This makes more sense for them.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agonvc0: store the driver query type for performance metrics
Samuel Pitoiset [Mon, 2 May 2016 20:12:42 +0000 (22:12 +0200)]
nvc0: store the driver query type for performance metrics

This will allow to use percentages for some metrics because the Gallium
HUD doesn't allow to display floating point numbers and 0 is printed
instead.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agonvc0: fix exposing of metric-issue_slots for SM21/SM30
Samuel Pitoiset [Mon, 2 May 2016 20:12:41 +0000 (22:12 +0200)]
nvc0: fix exposing of metric-issue_slots for SM21/SM30

This is most likely a copy-paste error when I reworked this area few
weeks ago. For SM20, metric-issue_slots is equal to inst_issued because
there is only one pipeline, so the metric is not exposed there.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reported-by: Karol Herbst <nouveau@karolherbst.de>
8 years agomesa/objectlabel: handle NULL src string
Mark Janes [Tue, 3 May 2016 20:50:49 +0000 (13:50 -0700)]
mesa/objectlabel: handle NULL src string

This prevents a crash when a NULL src is passed with a non-NULL length.

fixes: dEQP-GLES31.functional.debug.object_labels.query_length_only
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95252

Signed-off-by: Mark Janes <mark.a.janes@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: subroutine types cannot be used in constructors.
Dave Airlie [Tue, 3 May 2016 04:33:16 +0000 (14:33 +1000)]
glsl: subroutine types cannot be used in constructors.

This fixes two of the cases in
GL43-CTS.shader_subroutine.subroutines_not_allowed_as_variables_constructors_and_argument_or_return_types

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: resource is a reserved keyword in GLSL 4.20 as well
Dave Airlie [Tue, 3 May 2016 06:44:20 +0000 (16:44 +1000)]
glsl: resource is a reserved keyword in GLSL 4.20 as well

resource just appears in GLSL 4.20 without any fanfare.

Fixes GL43-CTX.CommonBugs.CommonBug_ReservedNames

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agogallium,utils: Fix trivial sign compare warnings
Jan Vesely [Fri, 29 Apr 2016 19:46:06 +0000 (15:46 -0400)]
gallium,utils: Fix trivial sign compare warnings

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Jakob Sinclair <sinclair.jakob@openmailbox.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agoanv: fix hang during generation of dev_icd.json.
Knut Andre Tidemann [Tue, 3 May 2016 10:30:56 +0000 (12:30 +0200)]
anv: fix hang during generation of dev_icd.json.

Fixes: b370ec7c76d ("anv: tweak the %.json rule")
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoswrast: Add texfetch_funcs entries for astc 3d formats
Anuj Phogat [Thu, 11 Feb 2016 20:33:27 +0000 (12:33 -0800)]
swrast: Add texfetch_funcs entries for astc 3d formats

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Enable translation between astc 3d gl formats and mesa formats
Anuj Phogat [Thu, 11 Feb 2016 20:29:53 +0000 (12:29 -0800)]
mesa: Enable translation between astc 3d gl formats and mesa formats

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Handle astc 3d formats in _mesa_get_compressed_formats()
Anuj Phogat [Thu, 11 Feb 2016 20:28:31 +0000 (12:28 -0800)]
mesa: Handle astc 3d formats in _mesa_get_compressed_formats()

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Handle astc 3d formats in _mesa_base_tex_format()
Anuj Phogat [Thu, 11 Feb 2016 20:10:52 +0000 (12:10 -0800)]
mesa: Handle astc 3d formats in _mesa_base_tex_format()

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Account for astc 3d formats in _mesa_is_astc_format()
Anuj Phogat [Thu, 11 Feb 2016 20:09:51 +0000 (12:09 -0800)]
mesa: Account for astc 3d formats in _mesa_is_astc_format()

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Add a helper function is_astc_3d_format()
Anuj Phogat [Thu, 11 Feb 2016 20:08:50 +0000 (12:08 -0800)]
mesa: Add a helper function is_astc_3d_format()

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Add the missing defines for GL_OES_texture_compression_astc
Anuj Phogat [Thu, 11 Feb 2016 20:12:48 +0000 (12:12 -0800)]
mesa: Add the missing defines for GL_OES_texture_compression_astc

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Align the values of #define's in glheader.h
Anuj Phogat [Thu, 11 Feb 2016 19:44:21 +0000 (11:44 -0800)]
mesa: Align the values of #define's in glheader.h

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Add OES_texture_compression_astc to extension table and gl_extensions
Anuj Phogat [Thu, 11 Feb 2016 19:27:01 +0000 (11:27 -0800)]
mesa: Add OES_texture_compression_astc to extension table and gl_extensions

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Add entries for astc 3d formats initializing struct gl_format_info
Anuj Phogat [Thu, 11 Feb 2016 18:51:03 +0000 (10:51 -0800)]
mesa: Add entries for astc 3d formats initializing struct gl_format_info

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Add mesa formats for astc 3d formats
Anuj Phogat [Thu, 11 Feb 2016 18:37:22 +0000 (10:37 -0800)]
mesa: Add mesa formats for astc 3d formats

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agoglapi: Update dispatch XML files for OES_texture_compression_astc.xml
Anuj Phogat [Fri, 12 Feb 2016 19:10:29 +0000 (11:10 -0800)]
glapi: Update dispatch XML files for OES_texture_compression_astc.xml

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Account for block depth in _mesa_format_image_size()
Anuj Phogat [Thu, 11 Feb 2016 18:08:49 +0000 (10:08 -0800)]
mesa: Account for block depth in _mesa_format_image_size()

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Handle 3d block sizes in _mesa_compute_compressed_pixelstore
Anuj Phogat [Fri, 11 Mar 2016 23:05:38 +0000 (15:05 -0800)]
mesa: Handle 3d block sizes in _mesa_compute_compressed_pixelstore

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Handle 3d block sizes in teximage error checks
Anuj Phogat [Thu, 11 Feb 2016 18:06:13 +0000 (10:06 -0800)]
mesa: Handle 3d block sizes in teximage error checks

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Handle 3d block sizes in getteximage error checks
Anuj Phogat [Thu, 10 Mar 2016 00:39:34 +0000 (16:39 -0800)]
mesa: Handle 3d block sizes in getteximage error checks

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Add an assert for BlockDepth in _mesa_get_format_block_size()
Anuj Phogat [Wed, 9 Mar 2016 19:47:07 +0000 (11:47 -0800)]
mesa: Add an assert for BlockDepth in _mesa_get_format_block_size()

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Add a helper function to query 3D block sizes
Anuj Phogat [Wed, 9 Mar 2016 19:38:54 +0000 (11:38 -0800)]
mesa: Add a helper function to query 3D block sizes

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Add block depth field in struct gl_format_info
Anuj Phogat [Thu, 11 Feb 2016 00:41:23 +0000 (16:41 -0800)]
mesa: Add block depth field in struct gl_format_info

This will be later required for 3D ASTC formats.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>