platform/upstream/mesa.git
9 years agovc4: Add shader-db dumping of NIR instruction count.
Eric Anholt [Fri, 20 Feb 2015 08:31:51 +0000 (00:31 -0800)]
vc4: Add shader-db dumping of NIR instruction count.

I was previously using temporary disables of VC4 optimization to show the
benefits of improved NIR optimization, but this can get me quick and dirty
numbers for NIR-only improvements without having to add hacks to disable
VC4's code (disabling of which might hide ways that the NIR changes would
hurt actual VC4 codegen).

9 years agovc4: Convert to consuming NIR.
Eric Anholt [Thu, 30 Oct 2014 19:51:47 +0000 (12:51 -0700)]
vc4: Convert to consuming NIR.

NIR brings us better optimization than I would have bothered to write
within the driver, developers sharing future optimization work, and the
ability to share device-specific lowering code that we and other
GLES2-level drivers need.

total uniforms in shared programs: 13421 -> 13422 (0.01%)
uniforms in affected programs:     62 -> 63 (1.61%)
total instructions in shared programs: 39961 -> 39707 (-0.64%)
instructions in affected programs:     15494 -> 15240 (-1.64%)

v2: Add missing imov support, and assert that there are no dest saturates.
v3: Rebase on the target-specific algebraic series.
v4: Rebase on gallium-includes-from-NIR changes in mater.
v5: Rebase on variables being in lists instead of hash tables.
v6: Squash in intermediate changes that used the NIR-to-TGSI pass (which
    I'm not committing)

9 years agogallium: Add tgsi_to_nir to get a nir_shader for a TGSI shader.
Eric Anholt [Wed, 29 Oct 2014 21:32:16 +0000 (14:32 -0700)]
gallium: Add tgsi_to_nir to get a nir_shader for a TGSI shader.

This will be used by the VC4 driver for doing device-independent
optimization, and hopefully eventually replacing its whole IR.  It also
may be useful to other drivers for the same reason.

v2: Add all of the instructions I was relying on tgsi_lowering to remove,
    and more.
v3: Rebase on SSA rework of the builder.
v4: Use the NIR ineg operation instead of doing a src modifier.
v5: Don't use ineg for fnegs.  (infer_src_type on MOV doesn't do what I
    expect, again).
v6: Fix handling of multi-channel KILL_IF sources.
v7: Make ttn_get_f() return a swizzle of a scalar load_const, rather than
    a vector load_const.  CSE doesn't recognize that srcs out of those
    channels are actually all the same.
v8: Rebase on nir_builder auto-sizing, make the scalar arguments to
    non-ALU instructions actually be scalars.
v9: Add support for if/loop instructions, additional texture targets, and
    untested support for indirect addressing on temps.
v10: Rebase on master, drop bad comment about control flow and just choose
     the X channel, use int comparison opcodes in LIT for now, drop unused
     pipe_context argument..
v11: Fix translation of LRP (previously missed because I mis-translated
     back out), use nir_builder init helpers.
v12: Rebase on master, adding explicit include of mtypes.h to get
     INTERP_QUALIFIER_*
v13: Rebase on variables being in lists instead of hash tables, drop use
     of mtypes.h in favor of util/pipeline.h.  Use Ken's nir_builder
     swizzle and fmov/imov_alu helpers, drop "struct" in front of
     nir_builder, use nir_builder directly as the function arg in a lot of
     cases, drop redundant members of ttn_compile that are also in
     nir_builder, drop some half-baked malloc failure handling.
v14: The indirect uniform src0 should be scalar, not vector (noticed as
     odd by robclark, confirmed by cwabbott).  Apply Ken's review to
     initialize s->num_uniforms and friends, skip ttn_channel for dot
     products, and use the simpler discard_if intrinsic.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v13)
Acked-by: Rob Clark <robclark@freedesktop.org>
9 years agovc4: Tell shader-db how big our UBOs are, if present.
Eric Anholt [Tue, 31 Mar 2015 18:39:45 +0000 (11:39 -0700)]
vc4: Tell shader-db how big our UBOs are, if present.

I had regressed them for a while with the NIR work.

9 years agomesa: Make a shared header for 3D pipeline enum / #defines.
Eric Anholt [Wed, 25 Mar 2015 19:58:51 +0000 (12:58 -0700)]
mesa: Make a shared header for 3D pipeline enum / #defines.

NIR uses these enums/#defines in nir_variables and associated intrinsics,
but I want to be able to use them from TGSI->NIR and NIR->TGSI.
Otherwise, we had to pull in all of mtypes.h.

This doesn't cover all of the enums we might want from a shared compiler
core (like varying slots or vert attribs), but it at least covers what I
need at the moment (system values and interp qualifiers).

v2: Move to src/glsl since util/ is really vague.  Include in Makefile.am
    list.  Use plain bitshifts and stdint types instead of undefined
    BITFIELD64_BIT.
v3: Rename to shader_enums.h. Move it into Makefile.sources.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v2, with
             recommendation to rename)

9 years agonir: add nir_builder.h to the tarball
Emil Velikov [Tue, 31 Mar 2015 09:54:34 +0000 (10:54 +0100)]
nir: add nir_builder.h to the tarball

The header was added with commit 2a135c470e3(nir: Add an ALU op builder
kind of like ir_builder.h) but did not made it into to the sources list.

Fortunately it remained unused until a recent commit faf6106c6f6(nir:
Implement a Mesa IR -> NIR translator.)

v2: Remove the bogus dependency. Tweak commit message.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoxmlpool: remove the clean target
Emil Velikov [Sun, 29 Mar 2015 12:46:32 +0000 (13:46 +0100)]
xmlpool: remove the clean target

... by folding it into CLEANFILES. Don't worry about $(LANG) as it is
essentially the first folder of $(POS). With the latter already handled.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoxmlpool: don't forget to ship the MOS
Emil Velikov [Sun, 29 Mar 2015 12:46:31 +0000 (13:46 +0100)]
xmlpool: don't forget to ship the MOS

This will allow us to finally remove python from the build time
dependencies list. Considering that you're building from a release
tarball of course :-)

Cc: Bernd Kuhls <bernd.kuhls@t-online.de>
Reported-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoosmesa: don't try to bundle osmesa.def SConscript
Emil Velikov [Sun, 29 Mar 2015 00:56:09 +0000 (00:56 +0000)]
osmesa: don't try to bundle osmesa.def SConscript

Both of which were removed with commit 69db422218b(scons: Don't build
osmesa.)

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agodocs: note that classic osmesa/libEGL no longer builds with scons
Emil Velikov [Wed, 25 Mar 2015 20:12:02 +0000 (20:12 +0000)]
docs: note that classic osmesa/libEGL no longer builds with scons

Plus nuke the final reference to osmesa from README.WIN32.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoi965: Handle scratch accesses where reladdr also points to scratch space
Iago Toral Quiroga [Tue, 17 Mar 2015 09:48:04 +0000 (10:48 +0100)]
i965: Handle scratch accesses where reladdr also points to scratch space

This is a problem when we have IR like this:

(array_ref (var_ref temps) (swiz x (expression ivec4 bitcast_f2i
   (swiz xxxx (array_ref (var_ref temps) (constant int (2)) ) )) )) ) )

where we are indexing an array with the result of an expression that
accesses the same array.

In this scenario, temps will be moved to scratch space and we will need
to add scratch reads/writes for all accesses to temps, however, the
current implementation does not consider the case where a reladdr pointer
(obtained by indexing into temps trough a expression) points to a register
that is also stored in scratch space (as in this case, where the expression
used to index temps access temps[2]), and thus, requires a scratch read
before it is accessed.

v2 (Francisco Jerez):
 - Handle also recursive reladdr addressing.
 - Do not memcpy dst_reg into src_reg when rewriting reladdr.

v3 (Francisco Jerez):
 - Reduce complexity by moving recursive reladdr scratch access handling
   to a separate recursive function.
 - Do not skip demoting reladdr index registers to scratch space if the
   top level GRF has already been visited.

v4 (Francisco Jerez)
 - Remove redundant checks.
 - Simplify code by making emit_resolve_reladdr return a register with
   the original src data except for reg, reg_offset and reladdr.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89508
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agogallivm: (trivial) fix the logic deciding if function call should be used...
Roland Scheidegger [Wed, 1 Apr 2015 11:25:56 +0000 (13:25 +0200)]
gallivm: (trivial) fix the logic deciding if function call should be used...

Copy and paste bug with the img filter decision. Since there's only 2 different
filters anyway just drop this bit.

9 years agomesa/fbo: lock ctx->Shared->Mutex when allocating renderbuffers
Martin Peres [Mon, 30 Mar 2015 07:34:20 +0000 (10:34 +0300)]
mesa/fbo: lock ctx->Shared->Mutex when allocating renderbuffers

This mutex is used to make sure the shared context does not change
while some shared code is looking into it.

Calling BindRenderbufferEXT BindRenderbuffer with a gles context
would not take the mutex before allocating an entry. Commit a34669b
then moved out the allocation out of bind_renderbuffer into
allocate_renderbuffer before using it for the CreateRenderBuffer
entry point. This thus also made this entry point unsafe.

The issue has been hinted by Ilia Mirkin.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomesa/fbo: do not assign a value that is never read later on
Martin Peres [Wed, 25 Mar 2015 14:28:03 +0000 (16:28 +0200)]
mesa/fbo: do not assign a value that is never read later on

The issue has been detected by coverty.

v2:
- move the declaration of obj to the else clause (Brian Paul)

v3: Review by Brian Paul
- get rid of the obj declaration in favor of a direct reference

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agoegl: add initial EGL_MESA_image_dma_buf_export v2.4
Dave Airlie [Mon, 3 Mar 2014 03:57:16 +0000 (13:57 +1000)]
egl: add initial EGL_MESA_image_dma_buf_export v2.4

At the moment to get an EGL image to a dma-buf file descriptor,
you have to use EGL_MESA_drm_image, and then use libdrm to
convert this to a file descriptor.

This extension just provides an API modelled on EGL_MESA_drm_image,
to return a dma-buf file descriptor.

v2: update spec for new API proposal
add internal queries to get the fourcc back from intel driver.

v2.1: add gallium pieces.

v2.2: add offsets to spec and API, rename fd->fds, stride->strides
in API. rewrite spec a bit more, add some q/a

v2.3:
add modifiers to query interface and 64-bit type for that (Daniel Stone)
specifiy what happens to num fds vs num planes differences. (Chad Versace)

v2.4:
fix grammar (Daniel Stone)

Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoi965/state: Remove brw->state.dirty
Jordan Justen [Fri, 20 Mar 2015 07:46:03 +0000 (00:46 -0700)]
i965/state: Remove brw->state.dirty

We now use brw->NewGLState and brw->ctx.NewDriverState instead.

Suggested-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/state: Don't use brw->state.dirty.mesa
Jordan Justen [Fri, 20 Mar 2015 05:33:16 +0000 (22:33 -0700)]
i965/state: Don't use brw->state.dirty.mesa

Now, we only use brw->NewGLState.

I used this bash & sed command in the i965 directory:
  for file in *.[ch] *.[ch]pp; do
    sed -i -e 's/brw->state\.dirty\.mesa/brw->NewGLState/g' $file
  done

Followed by manual changes to brw_state_upload.c.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/state: Don't use brw->state.dirty.brw
Jordan Justen [Fri, 20 Mar 2015 01:57:34 +0000 (18:57 -0700)]
i965/state: Don't use brw->state.dirty.brw

Now, we only use ctx->NewDriverState.

I used this bash & sed command in the i965 directory:
  for file in *.[ch] *.[ch]pp; do
    sed -i -e 's/state\.dirty\.brw/ctx.NewDriverState/g' $file
  done

Followed by manual changes to brw_state_upload.c.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/state: Add compute pipeline with empty atom lists
Jordan Justen [Sun, 8 Mar 2015 08:08:18 +0000 (00:08 -0800)]
i965/state: Add compute pipeline with empty atom lists

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/state: Only upload render programs for render state uploads
Jordan Justen [Fri, 20 Mar 2015 19:36:21 +0000 (12:36 -0700)]
i965/state: Only upload render programs for render state uploads

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/state: Create separate dirty state bits for each pipeline
Jordan Justen [Sun, 8 Mar 2015 07:21:46 +0000 (23:21 -0800)]
i965/state: Create separate dirty state bits for each pipeline

When clearing the state for a pipeline, we will save changed state for
the other pipelines.

v3:
 * Adjust brw_upload_pipeline_state
   * Don't pull pipeline state bits into common state bits
   * Don't clear pipeline state bits
 * Adjust 'clear' phase
   * brw_clear_dirty_bits is now brw_render_state_finished
   * Move cross-pipeline state flagging to brw_pipeline_state_finished
   * Move pipeline clears to brw_pipeline_state_finished

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/state: Support multiple pipelines in brw->num_atoms
Jordan Justen [Sun, 8 Mar 2015 06:44:39 +0000 (22:44 -0800)]
i965/state: Support multiple pipelines in brw->num_atoms

brw->num_atoms is converted to an array, but currently just an array
of length 1.

Adds brw_copy_pipeline_atoms which copies the atoms for a pipeline,
and sets brw->num_atoms[p] for pipeline p.

v2:
 * Rename brw->atoms[] to render_atoms
 * Rename brw_add_pipeline_atoms to brw_copy_pipeline_atoms
 * Rename brw_pipeline_first_atom to brw_get_pipeline_atoms

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/state: Rename brw_clear_dirty_bits to brw_render_state_finished
Jordan Justen [Wed, 18 Mar 2015 22:43:34 +0000 (15:43 -0700)]
i965/state: Rename brw_clear_dirty_bits to brw_render_state_finished

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/state: Rename brw_upload_state to brw_upload_render_state
Jordan Justen [Sun, 8 Mar 2015 04:20:03 +0000 (20:20 -0800)]
i965/state: Rename brw_upload_state to brw_upload_render_state

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agogallivm: do some hack heuristic to disable texture functions
Roland Scheidegger [Tue, 31 Mar 2015 22:56:12 +0000 (00:56 +0200)]
gallivm: do some hack heuristic to disable texture functions

We've seen some cases where performance can hurt quite a bit.
Technically, the more simple the function the more overhead there is
for using a function for this (and the less benefits this provides).
Hence don't do this if we expect the generated code to be simple.
There's an even more important reason why this hurts performance,
which is shaders reusing the same unit with some of the same inputs,
as llvm cannot figure out the calculations are the same if they
are performned in the function (even just reusing the same unit without
any input being the same provides such optimization opportunities though
not very much). This is something which would need to be handled by IPO
passes however.

9 years agoi965/fs: Allow CSE to handle MULs with negated arguments.
Matt Turner [Wed, 28 Jan 2015 03:18:46 +0000 (19:18 -0800)]
i965/fs: Allow CSE to handle MULs with negated arguments.

mul x, -y is equivalent to mul -x, y; and mul x, y is the negation of
mul x, -y.

With NIR:
total instructions in shared programs: 6167779 -> 6161193 (-0.11%)
instructions in affected programs:     983511 -> 976925 (-0.67%)
helped:                                4106
HURT:                                  16
GAINED:                                18
LOST:                                  7

Without NIR:
total instructions in shared programs: 6192323 -> 6185299 (-0.11%)
instructions in affected programs:     987875 -> 980851 (-0.71%)
helped:                                4146
HURT:                                  16
GAINED:                                16
LOST:                                  0

9 years agoi965: Mark brw_inst_bits' brw_inst* parameter const.
Matt Turner [Sat, 28 Mar 2015 18:01:29 +0000 (11:01 -0700)]
i965: Mark brw_inst_bits' brw_inst* parameter const.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: Remove bogus Makefile dependency.
Matt Turner [Tue, 31 Mar 2015 21:06:56 +0000 (14:06 -0700)]
glsl: Remove bogus Makefile dependency.

9 years agoglsl: Reassociate multiplication of mat*mat*vec.
Matt Turner [Sat, 28 Mar 2015 00:13:51 +0000 (17:13 -0700)]
glsl: Reassociate multiplication of mat*mat*vec.

The typical case of mat4*mat4*vec4 is 80 scalar multiplications, but
mat4*(mat4*vec4) is only 32.

On HSW (with vec4 vertex shaders):
instructions in affected programs:     4420 -> 3194 (-27.74%)

On BDW (with scalar vertex shaders):
instructions in affected programs:     12756 -> 6726 (-47.27%)

Implementing a general matrix chain ordering is harder (or at least
tedious) because of having to walk the GLSL IR to create a list of
multiplicands. I'm guessing that this patch handles 90+% of cases, but
of course to tell definitively you'd have to implement the general
thing.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoglsl: Implement type inferencing of matrix types.
Matt Turner [Fri, 27 Mar 2015 17:45:07 +0000 (10:45 -0700)]
glsl: Implement type inferencing of matrix types.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoglsl: Factor out a get_mul_type() function.
Matt Turner [Fri, 27 Mar 2015 17:43:05 +0000 (10:43 -0700)]
glsl: Factor out a get_mul_type() function.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agonouveau: synchronize "scratch runout" destruction with the command stream
Marcin Ślusarz [Tue, 31 Mar 2015 20:04:31 +0000 (22:04 +0200)]
nouveau: synchronize "scratch runout" destruction with the command stream

When nvc0_push_vbo calls nouveau_scratch_done it does not mean
scratch buffers can be freed immediately. It means "when hardware
advances to this place in the command stream the scratch buffers
can be freed".

To fix it, just postpone scratch runout destruction after current
fence is signalled.

The bug existed for a very long time. Nobody noticed, because
"scratch runout" code path is rarely executed.

Fixes hang at the very beginning of first mission in "Serious Sam 3"
on nve7/gk107. It manifested as:

nouveau E[   PFIFO][0000:01:00.0] read fault at 0x000a9e0000 [PTE] from GR/GPC0/PE_2 on channel 0x007f853000 [Sam3[17056]]

Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agodocs: document Viewperf 12 issues
Brian Paul [Tue, 31 Mar 2015 17:30:32 +0000 (11:30 -0600)]
docs: document Viewperf 12 issues

Signed-off-by: Brian Paul <brianp@vmware.com>
9 years agoi965/skl: Avoid using the 1D stencil layout for stencil-only images
Neil Roberts [Tue, 31 Mar 2015 13:58:28 +0000 (14:58 +0100)]
i965/skl: Avoid using the 1D stencil layout for stencil-only images

Commit cf67ca9ffa9 made the layouting code pick a special layout for
1D images on Skylake. This should not be used for depth and stencil
buffers because these need to be treated as 2D tiled images. However
the patch was missing a check for images with a base format of
GL_STENCIL_INDEX. In practice I don't think it's currently possible to
hit this because Mesa doesn't support GL_ARB_texture_stencil8 and it's
not possible to create a 1D renderbuffer, but it'll be good to be
ready for when the extension is supported.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agoclover: Return CL_BUILD_ERROR for CL_PROGRAM_BUILD_STATUS when compilation fails v2
Tom Stellard [Tue, 24 Mar 2015 17:17:22 +0000 (17:17 +0000)]
clover: Return CL_BUILD_ERROR for CL_PROGRAM_BUILD_STATUS when compilation fails v2

v2:
  - Don't use _errs map

Cc: 10.5 10.4 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoradeonsi/compute: Default to the same PIPE_SHADER_CAP values as other shader types v2
Tom Stellard [Sat, 21 Mar 2015 00:27:16 +0000 (00:27 +0000)]
radeonsi/compute: Default to the same PIPE_SHADER_CAP values as other shader types v2

v2:
  - Fix typo

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agoradeon/vce: implement video usability information support
Leo Liu [Mon, 30 Mar 2015 17:33:19 +0000 (13:33 -0400)]
radeon/vce: implement video usability information support

This will help encoding VUI into the bitstream

v2: make backward compatible

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agost/omx/enc: export framerate to vce driver
Leo Liu [Mon, 30 Mar 2015 17:25:15 +0000 (13:25 -0400)]
st/omx/enc: export framerate to vce driver

The framerate will be used for video usability info support by VCE driver

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agollvmpipe: enable ARB_texture_gather
Roland Scheidegger [Tue, 31 Mar 2015 15:23:17 +0000 (17:23 +0200)]
llvmpipe: enable ARB_texture_gather

Just announce support for 4 components.
While here also increase the max/min texel offsets (the limit is completely
artificial, was chosen because that's what other hardware did, however there's
other drivers using larger limits).
Over a thousand little piglits skip->pass.

v2: update docs/GL3.txt

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agogallivm: implement TG4 for ARB_texture_gather
Roland Scheidegger [Sun, 29 Mar 2015 21:40:31 +0000 (23:40 +0200)]
gallivm: implement TG4 for ARB_texture_gather

This is quite trivial, essentially just follow all the same code you'd
use with linear min/mag (and no mip) filter, then just skip the filtering
after looking up the texels in favor of direct assignment of the right channel
to the result. (This is though not true for the multi-offset version if we'd
want to support it - for this would probably need to do something along the
lines of 4x nearest sampling due to the necessity of doing coord wrapping
individually per texel.)
Supports multi-channel formats.
From the SM5 gather cap bit, should support non-constant offsets, plus shadow
comparisons (the former untested), but not component selection (should be
easy to implement but all this stuff is not really exposable anyway for now).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agogallivm: add gather support to sampler interface
Roland Scheidegger [Sun, 29 Mar 2015 21:21:56 +0000 (23:21 +0200)]
gallivm: add gather support to sampler interface

Luckily thanks to the revamped interface this is a lot less work now...

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agogallivm: simplify sampler interface
Roland Scheidegger [Sat, 28 Mar 2015 19:51:23 +0000 (20:51 +0100)]
gallivm: simplify sampler interface

This has got a bit out of control with more and more parameters added.
Worse, whenever something in there changes all callees have to be updated
for that, even though they don't really do much with any parameter in there
except pass it on to the actual sampling function.
Hence simply put almost everything into a struct. Also instead of relying
on some arguments being NULL, be explicit and set this in a key (which is
just reused for function generation for simplicity). (The code still relies
on them being NULL in the end for now.)
Technically there is a minimal functional change here for shadow sampling:
if shadow sampling is done is now determined explicitly by the texture
function (either sample_c or the gl-style tex func inherit this from target)
instead of the static texture state. These two should always match, however.
Otherwise, it should generate all the same code.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agoutil/debug: Update MgwHelp link, drop BfdHelp link.
Jose Fonseca [Wed, 18 Mar 2015 22:06:44 +0000 (22:06 +0000)]
util/debug: Update MgwHelp link, drop BfdHelp link.

9 years agogallivm: Fix build against LLVM 3.7 SVN r233648
Michel Dänzer [Tue, 31 Mar 2015 06:05:01 +0000 (15:05 +0900)]
gallivm: Fix build against LLVM 3.7 SVN r233648

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agovc4: Drop integer multiplies with 0 to moves of 0.
Eric Anholt [Mon, 30 Mar 2015 17:44:28 +0000 (10:44 -0700)]
vc4: Drop integer multiplies with 0 to moves of 0.

This cleans up more instructions generated by uniform array indexing
multiplies.

total instructions in shared programs: 39989 -> 39961 (-0.07%)
instructions in affected programs:     896 -> 868 (-3.12%)

9 years agovc4: Add a constant folding pass.
Eric Anholt [Mon, 30 Mar 2015 17:38:21 +0000 (10:38 -0700)]
vc4: Add a constant folding pass.

This cleans up some pointless operations generated by the in-driver mul24
lowering (commonly generated by making a vec4 index for a matrix in a
uniform array).

I could fill in other operations, but pretty much anything else ought to
be getting handled at the NIR level, I think.

total uniforms in shared programs: 13423 -> 13421 (-0.01%)
uniforms in affected programs:     346 -> 344 (-0.58%)

9 years agoglsl: allow ForceGLSLVersion to override #version directives
Brian Paul [Fri, 27 Mar 2015 16:54:10 +0000 (10:54 -0600)]
glsl: allow ForceGLSLVersion to override #version directives

Previously, the ctx->Const.ForceGLSLVersion setting only worked if
the shader lacked a #version directive.  Now, the ForceGLSLVersion
setting will override the #version directive too.

This change should be safe since it should be rare to have an app
that has a mix of shader versions and we only wanted to override
the #version for shaders which lacked the #version directive.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agovc4: Don't bother masking out the low 24 bits for integer multiplies
Eric Anholt [Mon, 30 Mar 2015 04:26:16 +0000 (21:26 -0700)]
vc4: Don't bother masking out the low 24 bits for integer multiplies

The hardware just uses the low 24 lines, saving us an AND to drop the high
bits.

total uniforms in shared programs: 13433 -> 13423 (-0.07%)
uniforms in affected programs:     356 -> 346 (-2.81%)
total instructions in shared programs: 40003 -> 39989 (-0.03%)
instructions in affected programs:     910 -> 896 (-1.54%)

9 years agovc4: Make integer multiply use 24 bits for the low parts.
Eric Anholt [Mon, 30 Mar 2015 04:21:10 +0000 (21:21 -0700)]
vc4: Make integer multiply use 24 bits for the low parts.

The hardware uses the low 24 bits in integer multiplies, so we can have
fewer high bits (and so probably drop them more frequently).

9 years agoglsl: fail when a shader's input var has not an equivalent out var in previous
Samuel Iglesias Gonsalvez [Fri, 28 Nov 2014 10:23:20 +0000 (11:23 +0100)]
glsl: fail when a shader's input var has not an equivalent out var in previous

GLSL ES 3.00 spec, 4.3.10 (Linking of Vertex Outputs and Fragment Inputs),
page 45 says the following:

"The type of vertex outputs and fragment input with the same name must match,
otherwise the link command will fail. The precision does not need to match.
Only those fragment inputs statically used (i.e. read) in the fragment shader
must be declared as outputs in the vertex shader; declaring superfluous vertex
shader outputs is permissible."
[...]
"The term static use means that after preprocessing the shader includes at
least one statement that accesses the input or output, even if that statement
is never actually executed."

And it includes a table with all the possibilities.

Similar table or content is present in other GLSL specs: GLSL 4.40, GLSL 1.50,
etc but for more stages (vertex and geometry shaders, etc).

This patch detects that case and returns a link error. It fixes the following
dEQP test:

  dEQP-GLES3.functional.shaders.linkage.varying.rules.illegal_usage_1

However, it adds a new regression in piglit because the test hasn't a
vertex shader and it checks the link status.

bin/glslparsertest \
tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom pass \
1.50 --check-link

This piglit test is wrong according to the spec wording above, so if this patch
is merged it should be updated.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
9 years agoradeonsi: Cache LLVMTargetMachineRef in context instead of in screen
Michel Dänzer [Thu, 26 Mar 2015 02:32:59 +0000 (11:32 +0900)]
radeonsi: Cache LLVMTargetMachineRef in context instead of in screen

Fixes a crash in genymotion with several threads compiling shaders
concurrently.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89746

Cc: 10.5 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
9 years agoglsl: fix unreachable(!"") to unreachable("")
Tapani Pälli [Mon, 30 Mar 2015 04:59:53 +0000 (07:59 +0300)]
glsl: fix unreachable(!"") to unreachable("")

Correct error with commit 151fb1e where assert was renamed
to unreachable without removing ! from string argument.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agodocs: add news item and link release notes for mesa 10.5.2
Emil Velikov [Sat, 28 Mar 2015 19:01:15 +0000 (19:01 +0000)]
docs: add news item and link release notes for mesa 10.5.2

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodocs: Add sha256 sums for the 10.5.2 release
Emil Velikov [Sat, 28 Mar 2015 18:50:31 +0000 (18:50 +0000)]
docs: Add sha256 sums for the 10.5.2 release

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit ff87ae1e003be7104d3550250af3343c01cea882)

9 years agoAdd release notes for the 10.5.2 release
Emil Velikov [Sat, 28 Mar 2015 18:42:51 +0000 (18:42 +0000)]
Add release notes for the 10.5.2 release

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 5e59f895c468c1ac497ad925b8bddd7f227c89a2)

9 years agofreedreno/a3xx: add support for point sprite coordinate replacement
Ilia Mirkin [Tue, 17 Mar 2015 05:34:33 +0000 (01:34 -0400)]
freedreno/a3xx: add support for point sprite coordinate replacement

This does not (yet) support different coordinate origins, so the tests
still fail due to fbo flipping.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agofreedreno/a3xx: make vs-set point size work
Ilia Mirkin [Tue, 17 Mar 2015 05:02:32 +0000 (01:02 -0400)]
freedreno/a3xx: make vs-set point size work

This appears to need the A2XX version of the point list, so select it at
draw time if necessary.

Experimentally, always using the A2XX version causes hangs when PSIZE
isn't actually emitted.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agofreedreno/a3xx: point size should not be divided by 2
Ilia Mirkin [Tue, 17 Mar 2015 05:00:38 +0000 (01:00 -0400)]
freedreno/a3xx: point size should not be divided by 2

The division is probably a holdover from the days when the fixed point
inline functions generated by headergen were broken.

Also reduce the maximum point size to 4092 (vs 4096), which is what the
blob does.

Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agofreedreno/a3xx: fix 3d texture layout
Ilia Mirkin [Sun, 15 Mar 2015 20:38:42 +0000 (16:38 -0400)]
freedreno/a3xx: fix 3d texture layout

The SZ2 field contains the layer size of a lower miplevel. It only
contains 4 bits, which limits the maximum layer size it can describe. In
situations where the next miplevel would be too big, the hardware
appears to keep minifying the size until it hits one of that size.
Unfortunately the hardware's ideas about sizes can differ from
freedreno's which can still lead to issues. Minimize those by stopping
to minify as soon as possible.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
9 years agofreedreno/a3xx: LAYERSZ2 appears to have no effect on arrays
Ilia Mirkin [Fri, 13 Mar 2015 22:01:11 +0000 (18:01 -0400)]
freedreno/a3xx: LAYERSZ2 appears to have no effect on arrays

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonir: Fix copy and pasted error message in nir_validate.
Kenneth Graunke [Sat, 28 Mar 2015 01:22:20 +0000 (18:22 -0700)]
nir: Fix copy and pasted error message in nir_validate.

These are nir_cf_nodes, not ALU instructions.
Also, use unreachable() to preempt said review feedback.

v2: Do it right (thanks Ilia).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoi965/nir: Use NIR for ARB_vertex_program support on Gen8+.
Kenneth Graunke [Wed, 25 Mar 2015 22:16:30 +0000 (15:16 -0700)]
i965/nir: Use NIR for ARB_vertex_program support on Gen8+.

Everything is already in place; we simply have to take the scalar code
generation path.  This gives us SIMD8 VS programs, instead of SIMD4x2.

v2: Rebase on the patch that drops brw->gen >= 8.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agoi965: Move env_var_as_boolean to intel_debug.c.
Kenneth Graunke [Fri, 27 Mar 2015 20:48:44 +0000 (13:48 -0700)]
i965: Move env_var_as_boolean to intel_debug.c.

I need to use this in brw_vec4.cpp, so it can't be static anymore.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/fs: Add ARB_fragment_program support to the NIR backend.
Kenneth Graunke [Fri, 30 Jan 2015 09:16:49 +0000 (01:16 -0800)]
i965/fs: Add ARB_fragment_program support to the NIR backend.

Use prog_to_nir where we would normally call glsl_to_nir, handle program
parameter lists, and skip a few things that don't exist.

Using NIR generates much better shader code than Mesa IR, since we get
real optimizations, as opposed to prog_optimize:

total instructions in shared programs: 314007 -> 279892 (-10.86%)
instructions in affected programs:     285173 -> 251058 (-11.96%)
helped:                                2001
HURT:                                  67
GAINED:                                4
LOST:                                  7

v2: Change early return in nir_setup_uniforms to if/else (Jordan).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir: Lower subtraction to add with negation when !lower_negate.
Kenneth Graunke [Wed, 25 Mar 2015 22:22:12 +0000 (15:22 -0700)]
nir: Lower subtraction to add with negation when !lower_negate.

prog->nir will generate fsub opcodes, but i965 doesn't implement them.
We may as well lower them at the NIR level, since it's trivial to do.

Suggested by Connor Abbott.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agonir: Implement a Mesa IR -> NIR translator.
Kenneth Graunke [Fri, 30 Jan 2015 07:22:08 +0000 (23:22 -0800)]
nir: Implement a Mesa IR -> NIR translator.

Shamelessly ripped off from Eric Anholt's tgsi_to_nir pass.

This is not built on SCons, like the rest of NIR.

v2:
- Delete redundant c->s, c->impl, and c->cf_node_list pointers (Ken)
- Use nir_builder directly instead of ptn_compile in more places (Ken)
- Drop 'struct' keyword in front of nir_builder (ken)
- Add a file level Doxygen comment (Ken)
- Use scalar constants instead of splatting (Eric)
- Use nir_builder helpers for constants, moves, and swizzles (Connor)

v3: Minor indentation improvements.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agonir: Add builder helpers for MOVs with ALU sources and swizzling MOVs.
Kenneth Graunke [Wed, 25 Mar 2015 21:51:02 +0000 (14:51 -0700)]
nir: Add builder helpers for MOVs with ALU sources and swizzling MOVs.

These will be useful for prog->nir and tgsi->nir.

v2: Don't forget to mark nir_swizzle as inline (Eric).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agonir: Add nir_builder helpers for creating load_const intrinsics.
Kenneth Graunke [Wed, 25 Mar 2015 09:11:52 +0000 (02:11 -0700)]
nir: Add nir_builder helpers for creating load_const intrinsics.

Both prog->nir and tgsi->nir will want to use these.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoi965/skl: Don't use the PMA depth stall workaround
Ben Widawsky [Wed, 25 Mar 2015 23:52:46 +0000 (16:52 -0700)]
i965/skl: Don't use the PMA depth stall workaround

The PMA depth stall must be enabled (optimization turned off) under certain
circumstances on gen8. This was supposedly fixed for Gen9, which means we do not
need to check, or toggle the state. The hardware is supposed to enable the
hardware optimization by default, unlike BDW, so we also don't need to set it at
init. For whatever reason this improves stability on ETQW with the bug mentioned
below.

References: https://bugs.freedesktop.org/show_bug.cgi?id=89039 (doesn't fix)
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Tested-by: Anuj Phogat <anuj.phogat@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/skl: Disable partial resolve in VC
Ben Widawsky [Fri, 27 Feb 2015 02:14:17 +0000 (18:14 -0800)]
i965/skl: Disable partial resolve in VC

Recomendation [sic] is to set this field to 1 always. Programming it to default
value of 0, may have -ve impact on performance for MSAA WLs.

Another don't suck bit which needs to get set.

The patch wasn't as well tested as I would have liked, primarily I don't have
perf numbers for it, but it's getting to a point where it is in danger of being
lost.

v2: v1 was a mix of two patches. Since 0x7004 is masked, we only need to set it
once at initialization and make sure the pma workaround doesn't set the mask bit
(which it doesn't).
Move LRI to init gpu state (Ken)
Add a comment.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agollvmpipe: simplify address calculation for 4x4 blocks
Roland Scheidegger [Fri, 27 Mar 2015 15:49:54 +0000 (16:49 +0100)]
llvmpipe: simplify address calculation for 4x4 blocks

These functions looked quite complicated, even though what they actually did
was trivial (ever since we dropped swizzled rendering). Also drop lookup of
format block per bytes done for each block, and do it once per scene instead.
This improves everybody's favorite "benchmark" by 3% or so, though
lp_rast_shade_quads_all() which calls this shows up still quite high for a
function which does little more than call the jit function.
(This would most likely be much better handled by the jit function itself,
the strides are passed through anyway already, though for being able to
handle layers it would definitely add some complexity.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agogallivm: fix texture function name (key) when using txf/ld
Roland Scheidegger [Sat, 28 Mar 2015 01:57:13 +0000 (02:57 +0100)]
gallivm: fix texture function name (key) when using txf/ld

When using the texel fetch functions rather than ordinary texturing,
the arguments are all int vecs instead of float vecs, not to mention
the actual function would look completely different. Hence this must
be included in the texture function name (which serves as the key)
otherwise things crash badly when a shader accesses the same texture
and sampler unit with both txf/ld and ordinary texturing instructions
with otherwise matching keys.

9 years agoglsl: mark uniform and input interface blocks as read only
Timothy Arceri [Fri, 27 Mar 2015 12:03:40 +0000 (23:03 +1100)]
glsl: mark uniform and input interface blocks as read only

Reviewed-by: Mark Janes <mark.a.janes@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonv50/ir/gk110: fix offset flag position for TXD opcode
Ilia Mirkin [Fri, 27 Mar 2015 22:38:24 +0000 (18:38 -0400)]
nv50/ir/gk110: fix offset flag position for TXD opcode

Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonv50/ir: take postFactor into account when doing peephole optimizations
Ilia Mirkin [Wed, 25 Mar 2015 22:00:00 +0000 (18:00 -0400)]
nv50/ir: take postFactor into account when doing peephole optimizations

Multiply operations can have a post-factor on them, which other ops
don't support. Only perform the peephole optimizations when there is no
post-factor involved.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89758
Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agogallivm: Fix build since llvm r233411
Jan Vesely [Fri, 27 Mar 2015 22:45:23 +0000 (18:45 -0400)]
gallivm: Fix build since llvm r233411

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
9 years agonir: Add optional lowering of flrp.
Eric Anholt [Wed, 18 Feb 2015 20:24:38 +0000 (12:24 -0800)]
nir: Add optional lowering of flrp.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agogallivm: use llvm function calls for texturing instead of inlining
Roland Scheidegger [Fri, 27 Mar 2015 01:39:59 +0000 (02:39 +0100)]
gallivm: use llvm function calls for texturing instead of inlining

There are issues with inlining everything, most notably llvm will use much
more memory (and be slower) when compiling. Ideally we'd probably use
functions for shader functions too but texture sampling usually is responsible
for quite some IR (it can easily reach 80% of total IR instructions) so this
seems like a good start.
This still generates a different function for all different combinations just
like before, however it is possible llvm is missing some optimization
opportunities - it is believed though such opportunities should be somewhat
rare, but at least for now it can still be switched off (at compile time only).
It should probably make compiled code also smaller because the same function
should be used for different variants in the same module (so for the
opaque/partial or linear/elts variants).
No piglit change (though it does indeed speed up unrealistic tests like
fp-indirections2 by a factor of 30 or so).
Has a small negative performance impact in openarena - I suspect this could
be fixed by running some IPO passes (despite the private linkage, llvm right
now does NO optimization at all wrt anything going past the call, even if
there's just one caller - so things like values stored before the call and then
always written by the function etc. will not be optimized away, nor will dead
arguments (which we mostly shouldn't have) be eliminated, always constant
arguments promoted etc.).

v2: use proper return values instead of pointer function arguments.
llvm supports aggregate return values, which do wonders here eliminating
unnecessary stack variables - everything in fact will be returned in registers
even without any IPO optimizations. It makes the code simpler too.
With this I could not measure a peformance impact in openarena any longer
(though since there's still no constant value propagation etc. into the tex
functions this does not mean it couldn't have a negative impact elsewhere).

v3: fix some minor issues suggested by Jose, and do disassembly (and the
profiling) without hacks.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agogallivm: pass jit_context pointer through to sampling
Roland Scheidegger [Wed, 25 Mar 2015 02:10:10 +0000 (03:10 +0100)]
gallivm: pass jit_context pointer through to sampling

The callbacks used for getting the dynamic texture/sampler state were using
the jit_context from the generated jit function. This works just fine, however
that way it's impossible to generate separate functions for texture sampling,
as will be done in the next commit. Hence, pass this pointer through all
interfaces so it can be passed to a separate function (technically, it would
probably be possible to extract this pointer from the current function instead,
but this feels hacky and would probably require some more hacks if we'd use
real functions instead of inlining all shader functions at some point).
There should be no difference in the generated code for now.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agogallium/vl: partially revert "Use util_cpu_to_le{16,32} in many more places."
Christian König [Thu, 26 Mar 2015 13:49:18 +0000 (14:49 +0100)]
gallium/vl: partially revert "Use util_cpu_to_le{16,32} in many more places."

The data in memory is in big endian format and needs to be converted
into CPU byte order. So the patch actually reversed what needs to be done.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agotgsi: fix out-of-bounds access for cube arrays
Ilia Mirkin [Thu, 26 Mar 2015 23:06:37 +0000 (19:06 -0400)]
tgsi: fix out-of-bounds access for cube arrays

The CUBE_ARRAY case uses r[4]. Make sure that the stack variable is
there.

Noticed by Coverity.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
9 years agost/mesa: initialize have_fma in constructor
Ilia Mirkin [Thu, 26 Mar 2015 23:33:01 +0000 (19:33 -0400)]
st/mesa: initialize have_fma in constructor

Spotted by Coverity.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agogallium/util: remove u_linkage
Ilia Mirkin [Thu, 26 Mar 2015 23:26:38 +0000 (19:26 -0400)]
gallium/util: remove u_linkage

Does not appear to be used in tree. Coverity spotted some errors in the
bitmask stuff, but the whole thing appears to be unused.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agogallium/hud: avoid overflowing hud graph name size
Ilia Mirkin [Thu, 26 Mar 2015 23:37:50 +0000 (19:37 -0400)]
gallium/hud: avoid overflowing hud graph name size

Spotted by Coverity.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agost/mesa: update arrays when the current attrib has been updated
Ilia Mirkin [Thu, 26 Mar 2015 19:14:22 +0000 (15:14 -0400)]
st/mesa: update arrays when the current attrib has been updated

Fixes the recently-sent gl-2.0-vertex-const-attr piglit test. Makes sure
to revalidate arrays when only the current attribute has been updated
via glVertexAttrib*.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89754
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
9 years agost_glsl_to_tgsi: only do mov copy propagation on temps (v2)
Dave Airlie [Wed, 25 Mar 2015 23:17:39 +0000 (09:17 +1000)]
st_glsl_to_tgsi: only do mov copy propagation on temps (v2)

Don't propagate ARRAYs

This should fix:
https://bugs.freedesktop.org/show_bug.cgi?id=89759

v2: just specify arrays so we get input propagation
Signed-off-by: Dave Airlie <airlied@redhat.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoi965: Drop unnecessary brw->gen >= 8 check from scalar VS code.
Kenneth Graunke [Wed, 25 Mar 2015 22:15:43 +0000 (15:15 -0700)]
i965: Drop unnecessary brw->gen >= 8 check from scalar VS code.

brw->scalar_vs already implies that brw->gen >= 8.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
9 years agoi965/fs: Implement texture projection support.
Kenneth Graunke [Sun, 1 Feb 2015 07:36:52 +0000 (23:36 -0800)]
i965/fs: Implement texture projection support.

Our fragment program backend implements support for TXP directly, and
there's no NIR lowering pass to remove the projection.  When we switch
fragment program support over to NIR, we need to support it somehow.

It's easy enough to support directly.

v2: Split out offset/tex_offset rename (requested by Jordan).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
9 years agoi965/fs: Rename offset to tex_offset to avoid shadowing offset().
Kenneth Graunke [Wed, 25 Mar 2015 20:12:20 +0000 (13:12 -0700)]
i965/fs: Rename offset to tex_offset to avoid shadowing offset().

fs_visitor::nir_emit_texture() created an fs_reg variable called offset,
which shadowed the offset() helper function in brw_ir_fs.h.

Rename the variable to tex_offset so we can still call offset().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
9 years agonir: Add glsl_float_type() wrapper.
Kenneth Graunke [Tue, 24 Feb 2015 03:56:00 +0000 (19:56 -0800)]
nir: Add glsl_float_type() wrapper.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
9 years agoglsl: Use INFINITY instead of std::numeric_limits<float>::infinity().
Matt Turner [Tue, 13 Jan 2015 06:35:53 +0000 (22:35 -0800)]
glsl: Use INFINITY instead of std::numeric_limits<float>::infinity().

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agoautomake: add missing egl files to the tarball
Emil Velikov [Sat, 21 Mar 2015 20:45:22 +0000 (20:45 +0000)]
automake: add missing egl files to the tarball

Namely the Haiku EGL driver backend and the SConscript for the dri2 EGL
driver backend.

Cc: Alexander von Gluck IV <kallisti5@unixzen.com>
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoglsl: Constify ir_instruction::equals
Ian Romanick [Thu, 19 Mar 2015 02:00:48 +0000 (19:00 -0700)]
glsl: Constify ir_instruction::equals

v2: Don't be lazy.  Constify the as_foo functions and use those instead
of ugly casts.  Suggested by Curro.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoglsl: Constify the as_foo functions
Ian Romanick [Tue, 24 Mar 2015 16:14:35 +0000 (09:14 -0700)]
glsl: Constify the as_foo functions

Now that they're all implemented using macros, this is trivial.

v2: Remove redundant parenthesis.  Suggested by Curro.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoglsl: Implement remaining as_foo functions with macros
Ian Romanick [Tue, 24 Mar 2015 16:02:24 +0000 (09:02 -0700)]
glsl: Implement remaining as_foo functions with macros

The downcast functions for non-leaf classes were previously implemented
"by hand."  Now they are implemented using macros based on the is_foo
functions added in the previous patch.

v2: Remove redundant parenthesis.  Suggested by Curro (on the next
patch).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoglsl: Add is_rvalue, is_dereference, and is_jump methods
Ian Romanick [Tue, 24 Mar 2015 15:55:15 +0000 (08:55 -0700)]
glsl: Add is_rvalue, is_dereference, and is_jump methods

These functions deteremine when an IR node is one of the non-leaf
classes.

v2: Adjust indentation to line up.  Suggested by Matt.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoutil/u_atomic: Ignore warnings interlocked accesses.
Jose Fonseca [Tue, 24 Mar 2015 19:56:21 +0000 (19:56 +0000)]
util/u_atomic: Ignore warnings interlocked accesses.

These are due how we implemented the atomic tests, not the atomic
implementation itself.  It's also difficult to refactor the code to
avoid the warnings due to the use of macros -- the code would be quite
hairy.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoscons: Disable MSVC warnings about inconsistent function annotation.
Jose Fonseca [Tue, 24 Mar 2015 19:50:48 +0000 (19:50 +0000)]
scons: Disable MSVC warnings about inconsistent function annotation.

Somehow, merely including any of the *intrin.h headers causes dozens of
this warnings (when compiling pretty much every source file).  MSVC does
not always complain the same -- so it's possible we're doing something
weird --, but silence these warnings in the meanwhile.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agomesa: Avoid MSVC C6334 warning in /analyze mode.
Jose Fonseca [Tue, 24 Mar 2015 19:01:46 +0000 (19:01 +0000)]
mesa: Avoid MSVC C6334 warning in /analyze mode.

MSVC's implementation of signbit(x) uses sizeof(x) with expressions to
dispatch to an internal function based on the argument's type (float,
double, etc), but that raises a flag with MSVC's own static analyzer,
and because this is an inline function in a header it causes substantial
warning spam.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoc99_math: Don't reimplement lrint and friends on MSVC 2013.
Jose Fonseca [Tue, 24 Mar 2015 13:16:24 +0000 (13:16 +0000)]
c99_math: Don't reimplement lrint and friends on MSVC 2013.

MSVC 2013 declares these functions, both for C and C++ source files.

This was caught with MSVC in analyze mode.

Reviewed-by: Brian Paul <brianp@vmware.com>