mesa.git
11 years agomesa: Add "OR COPYRIGHT HOLDERS" to license text disclaiming liability.
Kenneth Graunke [Sun, 21 Apr 2013 20:09:39 +0000 (13:09 -0700)]
mesa: Add "OR COPYRIGHT HOLDERS" to license text disclaiming liability.

This brings the license text in line with the MIT License as published
on the Open Source Initiative website:

http://opensource.org/licenses/mit-license.php

Generated automatically be the following shell command:
$ git grep 'THE AUTHORS BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \
  sed -i 's/THE AUTHORS/THE AUTHORS OR COPYRIGHT HOLDERS/' {}

This introduces some wrapping issues, to be fixed in the next commit.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Change "BRIAN PAUL OR IBM" to "THE AUTHORS" in license text.
Kenneth Graunke [Sun, 21 Apr 2013 20:01:45 +0000 (13:01 -0700)]
mesa: Change "BRIAN PAUL OR IBM" to "THE AUTHORS" in license text.

See previous commit for the rationale.  These weren't caught by the
automatic conversion due to the "OR IBM" addition.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Change "BRIAN PAUL" to "THE AUTHORS" in license text.
Kenneth Graunke [Sun, 21 Apr 2013 19:56:09 +0000 (12:56 -0700)]
mesa: Change "BRIAN PAUL" to "THE AUTHORS" in license text.

Generated automatically be the following shell command:
$ git grep 'BRIAN PAUL BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \
  sed -i 's/BRIAN PAUL/THE AUTHORS/' {}

The intention here is to protect all authors, not just Brian Paul.  I
believe that was already the sensible interpretation, but spelling it
out is probably better.

More practically, it also prevents people from accidentally copy &
pasting the license into a new file which says Brian is not liable when
he isn't even one of the authors.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: make _mesa_save_vtxfmt_init() static
Brian Paul [Tue, 23 Apr 2013 15:19:07 +0000 (09:19 -0600)]
mesa: make _mesa_save_vtxfmt_init() static

It's called from nowhere else.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agodocs: document issue with Viewperf proe-05 test 6
Brian Paul [Tue, 23 Apr 2013 19:18:41 +0000 (13:18 -0600)]
docs: document issue with Viewperf proe-05 test 6

11 years agomesa: use new _mesa_inside_dlist_begin_end() function
Brian Paul [Tue, 23 Apr 2013 16:57:45 +0000 (10:57 -0600)]
mesa: use new _mesa_inside_dlist_begin_end() function

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: use new _mesa_inside_begin_end() function
Brian Paul [Tue, 23 Apr 2013 16:53:00 +0000 (10:53 -0600)]
mesa: use new _mesa_inside_begin_end() function

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: remove unused opcodes AND, DP2A, NOT, NRM3, NRM4, OR, PRINT, XOR
Marek Olšák [Sun, 14 Apr 2013 17:59:06 +0000 (19:59 +0200)]
mesa: remove unused opcodes AND, DP2A, NOT, NRM3, NRM4, OR, PRINT, XOR

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: don't flush vertices and don't flag _NEW_COLOR in ClearColor, ClearIndex
Marek Olšák [Mon, 15 Apr 2013 01:41:43 +0000 (03:41 +0200)]
mesa: don't flush vertices and don't flag _NEW_COLOR in ClearColor, ClearIndex

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: don't flush vertices and don't flag _NEW_COLOR for GL_CLAMP_READ_COLOR
Marek Olšák [Mon, 15 Apr 2013 01:41:43 +0000 (03:41 +0200)]
mesa: don't flush vertices and don't flag _NEW_COLOR for GL_CLAMP_READ_COLOR

There used to be a derived state _ClampReadColor, so setting _NEW_COLOR
made sense. The state is gone now.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: don't flag _NEW_DEPTH in Begin/EndQuery if driver implements the functions
Marek Olšák [Mon, 15 Apr 2013 01:41:43 +0000 (03:41 +0200)]
mesa: don't flag _NEW_DEPTH in Begin/EndQuery if driver implements the functions

We don't want to set the flag for Gallium.

I think only swrast needs the flag to be set for occlusion queries.

v2: fix stats_wm updates in i965

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: don't flush vertices and don't flag _NEW_DEPTH in ClearDepth
Marek Olšák [Mon, 15 Apr 2013 01:40:06 +0000 (03:40 +0200)]
mesa: don't flush vertices and don't flag _NEW_DEPTH in ClearDepth

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: don't flush and don't flag _NEW_STENCIL in ClearStencil, ActiveStencilFace
Marek Olšák [Mon, 15 Apr 2013 00:54:58 +0000 (02:54 +0200)]
mesa: don't flush and don't flag _NEW_STENCIL in ClearStencil, ActiveStencilFace

The functions don't affect driver state. There is no code that would rely
on vertices being flushed prior to changing the states, and no code that
would check for _NEW_STENCIL before using the states.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: don't set _NEW_BUFFERS in GenerateMipmap and BlitFramebuffer
Marek Olšák [Sun, 14 Apr 2013 20:31:50 +0000 (22:31 +0200)]
mesa: don't set _NEW_BUFFERS in GenerateMipmap and BlitFramebuffer

both functions don't change the framebuffer in any way
(if mesa_meta is not used)

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: remove _NEW_PACKUNPACK
Marek Olšák [Mon, 15 Apr 2013 00:23:37 +0000 (02:23 +0200)]
mesa: remove _NEW_PACKUNPACK

No driver checks the flag. Nobody uses it.

I also removed the FLUSH_VERTICES calls, because PixelStorei has no effect
on rendering.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: convert _NEW_RASTERIZER_DISCARD to a driver flag
Marek Olšák [Mon, 15 Apr 2013 11:00:54 +0000 (13:00 +0200)]
mesa: convert _NEW_RASTERIZER_DISCARD to a driver flag

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa,i965: use NewDriverState to communicate TFB state changes with the driver
Marek Olšák [Sun, 14 Apr 2013 22:50:20 +0000 (00:50 +0200)]
mesa,i965: use NewDriverState to communicate TFB state changes with the driver

_NEW_TRANSFORM_FEEDBACK is not used by core Mesa, so it can be removed.
Instead, an new private flag is added to i965 to serve the same purpose.

If you're new to this:

* When creating a context. you can set private dirty flags
  in gl_context::DriverFlags, eg.:
    ctx->DriverFlags.NewStateX = BRW_NEW_STATE_X;

* When StateX is changed, core Mesa does:
    ctx->NewDriverState |= ctx->DriverFlags.NewStateX;

* When you have to draw, read and clear ctx->NewDriverState.

* Pros: not touching NewState, the driver decides the mapping between
  GL states and hw state groups, unlimited number of flags in core Mesa
  (still limited number of flags in the driver though)

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: remove redundant _NEW_BUFFERS setting in ReadBuffer
Marek Olšák [Sun, 14 Apr 2013 20:24:09 +0000 (22:24 +0200)]
mesa: remove redundant _NEW_BUFFERS setting in ReadBuffer

already set by _mesa_readbuffer

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agost/mesa: add a simple path to BufferData if it only discards buffer contents
Marek Olšák [Sun, 14 Apr 2013 21:28:36 +0000 (23:28 +0200)]
st/mesa: add a simple path to BufferData if it only discards buffer contents

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: depth-stencil-alpha state also depends on _NEW_BUFFERS
Marek Olšák [Mon, 15 Apr 2013 12:39:58 +0000 (14:39 +0200)]
st/mesa: depth-stencil-alpha state also depends on _NEW_BUFFERS

because the code looks at the visual if there is a depth or stencil buffer
before enabling depth or stencil, respectively.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium: Replace gl_rasterization_rules with lower_left_origin and half_pixel_center.
José Fonseca [Tue, 23 Apr 2013 18:40:05 +0000 (19:40 +0100)]
gallium: Replace gl_rasterization_rules with lower_left_origin and half_pixel_center.

Squashed commit of the following:

commit 04c5fa2cbb8e89d6f2fa5a75af1cca03b1f6b852
Author: José Fonseca <jfonseca@vmware.com>
Date:   Tue Apr 23 17:37:18 2013 +0100

    gallium: s/lower_left_origin/bottom_edge_rule/

commit 4dff4f64fa83b9737def136fffd161d55e4f1722
Author: José Fonseca <jfonseca@vmware.com>
Date:   Tue Apr 23 17:35:04 2013 +0100

    gallium: Move diagram to docs.

commit 442a63012c8c3c3797f45e03f2ca20ad5f399832
Author: James Benton <jbenton@vmware.com>
Date:   Fri May 11 17:50:55 2012 +0100

    gallium: Replace gl_rasterization_rules with lower_left_origin and half_pixel_center.

    This change is necessary to achieve correct results when using OpenGL
    FBOs.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agor600g: initialize CMASK and HTILE with the GPU using streamout
Marek Olšák [Sun, 21 Apr 2013 21:26:52 +0000 (23:26 +0200)]
r600g: initialize CMASK and HTILE with the GPU using streamout

This fixes a crash when a resource cannot be mapped to the CPU's address space
because it's too big.

This puts a global pipe_context in r600_screen, which is guarded by a mutex,
so that we can use pipe_context when there isn't one around.
Hopefully our multi-context support is solid.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
NOTE: This is a candidate for the 9.1 branch.

11 years agogallium/u_blitter: implement buffer clearing
Marek Olšák [Sun, 21 Apr 2013 17:39:03 +0000 (19:39 +0200)]
gallium/u_blitter: implement buffer clearing

Although this might be useful for ARB_clear_buffer_object,
I need it for initializating resources in r600g.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
v2: comment cleanups

NOTE: This is a candidate for the 9.1 branch.

11 years agor600/llvm: Read stacksize from config header
Vincent Lejeune [Fri, 19 Apr 2013 18:10:44 +0000 (20:10 +0200)]
r600/llvm: Read stacksize from config header

11 years ago/bin/bash: q : commande introuvable
Vincent Lejeune [Sat, 13 Apr 2013 14:35:39 +0000 (16:35 +0200)]
/bin/bash: q : commande introuvable

11 years agoradeon/llvm: Fix build with LLVM >= r180063
Tom Stellard [Tue, 23 Apr 2013 14:58:38 +0000 (10:58 -0400)]
radeon/llvm:  Fix build with LLVM >= r180063

11 years agogallivm: Fix build with LLVM >= r180063
Tom Stellard [Tue, 23 Apr 2013 14:57:54 +0000 (10:57 -0400)]
gallivm: Fix build with LLVM >= r180063

11 years agodraw: use the prim count for ia primitives
Zack Rusin [Mon, 22 Apr 2013 23:07:14 +0000 (19:07 -0400)]
draw: use the prim count for ia primitives

Number of vertices to fetch doesn't always equal the number of input
vertices. To correctly compute the number if IA primitives we need
to use the total number of input vertices, not only those that
need to be fetched.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agotgsi/scan: set correct input limits for geometry shader
Zack Rusin [Sat, 20 Apr 2013 07:02:00 +0000 (00:02 -0700)]
tgsi/scan: set correct input limits for geometry shader

TGSI geometry shader input declerations are of the IN[][2] format
and the dimensions of the array have to be deduced from the input
primitive property.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agodraw: add code to reset instance dependent data
Zack Rusin [Fri, 19 Apr 2013 23:51:27 +0000 (16:51 -0700)]
draw: add code to reset instance dependent data

We want to be able to reset certain parts of the pipeline,
in particular the input primitive index, but only either with
seperate invocations of the draw_vbo or new instances. In all
other cases (e.g. new invocations due to primitive restart)
that data needs to be preserved. Add a function through which
we can reset instance dependent data.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agosoftpipe: fix streamout with an emptry geometry shader
Zack Rusin [Fri, 19 Apr 2013 19:51:07 +0000 (12:51 -0700)]
softpipe: fix streamout with an emptry geometry shader

Same approach as in the llvmpipe, if the geometry shader is
null and we have stream output then attach it to the vertex
shader right before executing the draw pipeline.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agoconfigure.ac: Allow OpenGL ES1 and ES2 only with enabled OpenGL
Andreas Boll [Fri, 1 Feb 2013 12:39:42 +0000 (13:39 +0100)]
configure.ac: Allow OpenGL ES1 and ES2 only with enabled OpenGL

Building OpenGL ES1 and/or ES2 without OpenGL is not supported on mesa
9.0.x

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoi965/fs: Don't save value returned by emit() if it's not used.
Matt Turner [Wed, 10 Apr 2013 02:12:39 +0000 (19:12 -0700)]
i965/fs: Don't save value returned by emit() if it's not used.

Probably a copy-n-paste mistake.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Remove extra MapBufferRange in create_beginend_table()
Brian Paul [Mon, 22 Apr 2013 16:42:43 +0000 (10:42 -0600)]
mesa: Remove extra MapBufferRange in create_beginend_table()

Looks like a copy&paste typo.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallium: Add a new clip_halfz rasterizer state.
José Fonseca [Sat, 20 Apr 2013 11:24:44 +0000 (12:24 +0100)]
gallium: Add a new clip_halfz rasterizer state.

gl_rasterization_rules lumps too many different flags.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoi965: Fix a mistake in the comments for software counters.
Kenneth Graunke [Thu, 28 Feb 2013 03:06:32 +0000 (19:06 -0800)]
i965: Fix a mistake in the comments for software counters.

The code doesn't set brw->query.obj to NULL, it sets query->bo to NULL.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agogallivm: Fix assignment of unsigned values to OUT register.
José Fonseca [Mon, 22 Apr 2013 14:28:32 +0000 (15:28 +0100)]
gallivm: Fix assignment of unsigned values to OUT register.

TEMP is not the only register file that accept unsigned. OUT too.

Actually, what determines the appropriate type of the destination value is
not the opcode, but rather the register.

Also cleanup/simplify code.  Add a few more asserts, but also make
code more robust by handling graceful if assert fails.

This fixes segfault / assertion in the included vert-uadd.sh graw shader.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agoi965: Apply CMP NULL {Switch} work-around to other Gen7s.
Matt Turner [Sun, 21 Apr 2013 07:18:11 +0000 (00:18 -0700)]
i965: Apply CMP NULL {Switch} work-around to other Gen7s.

Listed in the restrictions section of CMP, but not on the work-arounds
page.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agost/mesa: minor indentation fixes
Brian Paul [Mon, 22 Apr 2013 16:08:06 +0000 (10:08 -0600)]
st/mesa: minor indentation fixes

11 years agomesa: Introduce a globally-available minify() macro.
Eric Anholt [Sat, 13 Apr 2013 08:46:09 +0000 (01:46 -0700)]
mesa: Introduce a globally-available minify() macro.

This matches u_minify()'s behavior, for consistency.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Generalize TexStorage allocator between swrast and intel.
Eric Anholt [Sat, 13 Apr 2013 08:37:35 +0000 (01:37 -0700)]
mesa: Generalize TexStorage allocator between swrast and intel.

This should be reusable for other non-gallium drivers, so we can make the
extension always be available.

v2: Add a more detailed comment than the old function had (recommended
    by Brian).

Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
11 years agomesa: Add performance debug for meta code.
Eric Anholt [Sat, 13 Apr 2013 03:16:41 +0000 (20:16 -0700)]
mesa: Add performance debug for meta code.

I noticed a fallback in regnum through sysprof, and wanted a nicer way to
get information about it.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agointel: Mention how much data we're trying to subdata in perf debug.
Eric Anholt [Fri, 12 Apr 2013 00:58:09 +0000 (17:58 -0700)]
intel: Mention how much data we're trying to subdata in perf debug.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoRevert "gallivm: Emit vector selects."
José Fonseca [Sun, 21 Apr 2013 08:02:21 +0000 (09:02 +0100)]
Revert "gallivm: Emit vector selects."

It caused inumerous regressions (LLVM 3.1) in blending. In particular:

 - lp_test_blend

    type=u8nx16 rgb_func=sub rgb_src_factor=zero rgb_dst_factor=inv_src_color alpha_func=rev_sub alpha_src_factor=one alpha_dst_factor=const_color ...  MISMATCH
     Src:  0  0  0 b5 49 29  0 a2  0 21 de  0 c3 1b ec  0
     Src1: 2d 85 14  0 f8  0 79 a1 99  0 d8  0 59 16  0  0
     Dst:  0 a9 97  0 c0  0 78  0  0 8b aa f0 bd  0 78 f6
     Con: 7d  0 c0  0  0 bb 77  0  0  0 50  0 40 51  0  0
     Res:  0  0  0  0  0 29  0  0  0  0 c8  0 97 1b e3  0
     Ref:  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    type=u8nx16 rgb_func=max rgb_src_factor=one rgb_dst_factor=inv_const_color alpha_func=min alpha_src_factor=zero alpha_dst_factor=inv_src1_alpha ...  MISMATCH
     Src:  d  0  0 e9  0 37 35 f0 62  0  0 b2 e9 f7  0 5c
     Src1: 8f  0 bf  0 a8  5  0  0 c4  0 d7  7 92  a  0 17
     Dst: cb  0 1e  0  0  0 19 8e  0 4d  0  0  0  0  3 46
     Con: aa 5a 5f 8f  0  0 bc 92  0 88  0  0 b7 8a c0 88
     Res: 44  0 13  0  0  0  7 8e  0 24  0  0  0  0  1 40
     Ref: 44  0 13  0  0 37 35  0 62 24  0  0 e9 f7  1  0

This reverts commit 1e266c7ef01251ecf72347a2ba1d174b035cbe3b.

11 years agollvmpipe: verify function on blend test.
José Fonseca [Sun, 21 Apr 2013 07:53:31 +0000 (08:53 +0100)]
llvmpipe: verify function on blend test.

11 years agollvmpipe: Don't support Z32_FLOAT_S8X24_UINT texture sampling support either.
José Fonseca [Sat, 20 Apr 2013 09:42:09 +0000 (10:42 +0100)]
llvmpipe: Don't support Z32_FLOAT_S8X24_UINT texture sampling support either.

Because we don't support, and the u_format fallback doesn't work for
zs formats.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agollvmpipe: Ignore depth-stencil state if format has no depth/stencil.
José Fonseca [Sat, 20 Apr 2013 08:43:54 +0000 (09:43 +0100)]
llvmpipe: Ignore depth-stencil state if format has no depth/stencil.

Prevents assertion failures inside the driver for such state combinations.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallivm: Disable LLVM 2.7 workaround on other versions.
José Fonseca [Fri, 19 Apr 2013 21:34:47 +0000 (22:34 +0100)]
gallivm: Disable LLVM 2.7 workaround on other versions.

2.7 was a particularly trouble ridden release.

Furthermore, the bug no longer can be reproduced ever since the
first_level state was taken in account.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallivm: Emit vector selects.
José Fonseca [Fri, 19 Apr 2013 13:04:15 +0000 (14:04 +0100)]
gallivm: Emit vector selects.

They are supported on LLVM 3.1, at least on x86. (I haven't tested on PPC
though.)

Actually lp_build_linear_mip_levels() already has been emitting them for
some time.

This avoids intrinsics, which tend to be an obstacle for certain
optimization passes.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agofreedreno: move ir -> ir2
Rob Clark [Sat, 20 Apr 2013 21:59:41 +0000 (17:59 -0400)]
freedreno: move ir -> ir2

There will be a new IR for a3xx, which has a very different shader ISA
(more scalar oriented).  So rename to avoid conflicts later when I start
adding a3xx support to the gallium driver.

Signed-off-by: Rob Clark <Rob Clark robdclark@freedesktop.org>
11 years agofreedreno: cleanup some cruft left over from fdre
Rob Clark [Sat, 20 Apr 2013 21:31:47 +0000 (17:31 -0400)]
freedreno: cleanup some cruft left over from fdre

The standalone shader assembler needed some meta-data to know about
attributes/varyings/etc, to do the shader linkage.  We don't need these
parts with gallium/tgsi, so just get rid of it.

Signed-off-by: Rob Clark <Rob Clark robdclark@freedesktop.org>
11 years agogallivm: implement switch opcode
Roland Scheidegger [Fri, 19 Apr 2013 23:46:04 +0000 (01:46 +0200)]
gallivm: implement switch opcode

Should be able to handle all things which make this tricky to implement.
Fallthroughs, including most notably into/out of default, should be handled
correctly but are quite a mess.
If we see largely unoptimized switches in the wild should probably think
about some "real" switch optimization pass, e.g. things like this:

switch
case1
someinst
brk
case2
default
case3
someinst
brk
case4
someinst
endswitch

are legal, but the pointless case2/case3 statements not only cause condition
evaluation but will turn this into a "fake" fallthrough case (because
mask and defaultmask are already updated for case2 when default is
encountered) requiring executing code twice.
If default is at the end though, there's never any code re-execution, and
if that's not the case if there's no fallthrough in (not even a fake one)
and out of default there's no code re-execution neither.

v2: add comments, and use enum for break type instead of magic boolean.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: use uint build context for mask instead of float
Roland Scheidegger [Fri, 19 Apr 2013 01:38:50 +0000 (03:38 +0200)]
gallivm: use uint build context for mask instead of float

Unsurprisingly noone was using it except for grabbing builder.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm/tgsi: fix up breakc
Roland Scheidegger [Fri, 19 Apr 2013 01:26:20 +0000 (03:26 +0200)]
gallivm/tgsi: fix up breakc

It seems there was a typo in gallivm breakc handling (I am actually still
not sure it is really needed but otherwise that statement really should go
away). Also fix the wrong src argument type, even though they weren't really
used.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agosvga: remove TGSI_OPCODE_BREAKC instruction translation
Roland Scheidegger [Fri, 19 Apr 2013 22:38:31 +0000 (00:38 +0200)]
svga: remove TGSI_OPCODE_BREAKC instruction translation

While initially that opcode probably was meant for something along the
lines of sm3 break_comp it has never worked that way (not even the
argument count was right) and now the opcode has quite different
semantics so just remove it. (Discovered by Jose Fonseca)

11 years agogallium: document breakc and switch/case/default/endswitch
Roland Scheidegger [Fri, 19 Apr 2013 22:34:20 +0000 (00:34 +0200)]
gallium: document breakc and switch/case/default/endswitch

docs were missing, especially the opcode-from-hell switch however is anything
but obvious.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: increase nesting limit to 66
Roland Scheidegger [Thu, 18 Apr 2013 15:18:15 +0000 (17:18 +0200)]
gallivm: increase nesting limit to 66

This is still not really correct, since at least for sm 4.0
the nesting limit is 64 per subroutine, and subroutine nesting itself
has a limit of 32, so since we have a flat stack we'd need 32*64.
But this should probably be better fixed with per-subroutine stacks,
since otherwise these structures get really big (like 100kB for the
lp_exec_mask).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agodraw: implement primitive assembler
Zack Rusin [Thu, 18 Apr 2013 10:08:41 +0000 (03:08 -0700)]
draw: implement primitive assembler

Input assembler needs to be able to decompose adjacency primitives
into something that can be understood by the rest of the pipeline.
The specs say that the adjacency primitives are *only* visible
in the geometry shader, for everything else they need to be
decomposed. Which in most of the cases is not an issue, because
the geometry shader always decomposes them for us, but without
geometry shader we were passing unchanged adjacency primitives
to the rest of the pipeline and causing crashes everywhere. This
commit introduces a primitive assembler which, if geometry
shader is missing and the input primitive is one of the
adjacency primitives, decomposes them into something
that the rest of the pipeline can understand.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoutil/prim: fix decomposed counts for adjacency primitives
Zack Rusin [Thu, 18 Apr 2013 10:03:14 +0000 (03:03 -0700)]
util/prim: fix decomposed counts for adjacency primitives

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agodraw/so: uses the correct index with the pre clipped coordinates
Zack Rusin [Thu, 18 Apr 2013 02:25:20 +0000 (19:25 -0700)]
draw/so: uses the correct index with the pre clipped coordinates

pre_clip_pos is a float[4] we just used (*float)[4] to be able to
jump within the array of vertex_headers with it. So if the idx
happened to be anything but 0, we'd actually read from some garbage
in memory. Change it to just be a simple pointer instead of casting
it to something that it's not. As suggested by Jose.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoglapi: Add counter information for glBufferData(), like glBufferSubData().
Eric Anholt [Wed, 27 Feb 2013 21:56:51 +0000 (13:56 -0800)]
glapi: Add counter information for glBufferData(), like glBufferSubData().

This causes this function to become asynchronous with glthread.

11 years agoglapi: Add parameter count information for uniforms.
Eric Anholt [Wed, 27 Feb 2013 20:47:09 +0000 (12:47 -0800)]
glapi: Add parameter count information for uniforms.

This is the kind of information that would have been present for GLX, if
GLX supported modern GL.  This allows these entrypoints to get automatic
asynchronous marshalling code generated for glthread.

11 years agoglapi: skip padding in get_called_parameter_string
Paul Berry [Wed, 7 Nov 2012 21:49:41 +0000 (13:49 -0800)]
glapi: skip padding in get_called_parameter_string

This bug is currently benign, since get_called_parameter_string() is
currently only used for functions that return true for
glx_function.has_different_protocol(), and none of those functions
include padding.  However, in order to implement marshalling of GL API
functions, we'll need to use get_called_parameter_string() far more
often.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Fix up program_parse.y to avoid uninitialized $$
Paul Berry [Fri, 9 Nov 2012 17:17:22 +0000 (09:17 -0800)]
mesa: Fix up program_parse.y to avoid uninitialized $$

Without this patch, $$.negate, $$.rgba_valid, and $$.xyzw_valid take
on garbage values.  At the moment this problem is benign (the garbage
values happen to be zero), but in my experiments executing GL
operations on a background thread, the garbage values change, leading
to piglit failures.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Use quotes on bool driconf options to prevent stdbool.h breakage.
Eric Anholt [Thu, 3 Jan 2013 01:02:58 +0000 (17:02 -0800)]
mesa: Use quotes on bool driconf options to prevent stdbool.h breakage.

Since stdbool.h's "true" and "false" are #defines, they got expanded when
used as macro arguments, and that expanded value was stored in the
XML string, producing XML that driconf would then fail to parse.

Currently no drivers included stdbool along with driconf, but I keep
accidentally doing so on intel as we move towards using normal C.

v2: rebase on master.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
11 years agosvga: whitespace, comment fixes in svga_pipe_query.c
Brian Paul [Thu, 18 Apr 2013 22:09:27 +0000 (16:09 -0600)]
svga: whitespace, comment fixes in svga_pipe_query.c

11 years agosvga: whitespace, comment fixes in svga_pipe_fs/vs.c
Brian Paul [Thu, 18 Apr 2013 21:56:53 +0000 (15:56 -0600)]
svga: whitespace, comment fixes in svga_pipe_fs/vs.c

11 years agogallivm: Fix half floats with MCJIT.
José Fonseca [Fri, 19 Apr 2013 09:13:02 +0000 (10:13 +0100)]
gallivm: Fix half floats with MCJIT.

Prevents:

  LLVM ERROR: Cannot select: intrinsic %llvm.x86.vcvtph2ps.128

11 years agoRevert "i965: Check reg.nr for BRW_ARF_NULL instead of reg.file."
Matt Turner [Fri, 19 Apr 2013 04:51:49 +0000 (21:51 -0700)]
Revert "i965: Check reg.nr for BRW_ARF_NULL instead of reg.file."

This reverts commit ecdda414d361ab4430fd5747c9217687c1f3d63f.

Commit was supposed to be a simple typo fix. Clearly needs more
investigating.

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

11 years agoconfigure.ac: Remove gallium-g3dvl flag.
Matt Turner [Thu, 18 Apr 2013 01:21:47 +0000 (18:21 -0700)]
configure.ac: Remove gallium-g3dvl flag.

It's next to useless, since it just allows you to turn off VDPAU and
XvMC with a single switch. Just check whether Gallium drivers are
enabled instead.

Reviewed-by: Christian König <christian.koenig@amd.com>
11 years agoradeonsi: add support for compressed texture v2
Jerome Glisse [Mon, 8 Apr 2013 14:57:05 +0000 (10:57 -0400)]
radeonsi: add support for compressed texture v2

Most test pass, issue are with border color and swizzle.

Based on ircnick<maelcum> patch.

v2: Restaged commit hunk

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agoradeonsi: add 2d tiling support for texture v3
Jerome Glisse [Fri, 22 Mar 2013 21:55:49 +0000 (17:55 -0400)]
radeonsi: add 2d tiling support for texture v3

v2: Remove left over code
v3: Restage properly the commit so hunk of first one are not in
    second one.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agogallium: handle drirc disable_glsl_line_continuations option
Vadim Girlin [Thu, 18 Apr 2013 21:04:51 +0000 (01:04 +0400)]
gallium: handle drirc disable_glsl_line_continuations option

NOTE: This is a candidate for the 9.1 branch

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
11 years agollvmpipe: Take in consideration all current constant buffers when mapping.
José Fonseca [Thu, 18 Apr 2013 18:05:53 +0000 (19:05 +0100)]
llvmpipe: Take in consideration all current constant buffers when mapping.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agonv50: add remaining RGBX formats
Christoph Bumiller [Thu, 18 Apr 2013 18:55:32 +0000 (20:55 +0200)]
nv50: add remaining RGBX formats

Not all are supported as render targets.

The state tracker fallback of using RGBA instead of RGBX currently
fails for blending, we could work around this by clearing their alpha
to 1 and modifying the color mask to disable writing alpha.

11 years agost/mesa: optionally apply texture swizzle to border color v2
Christoph Bumiller [Fri, 12 Apr 2013 11:42:01 +0000 (13:42 +0200)]
st/mesa: optionally apply texture swizzle to border color v2

This is the only sane solution for nv50 and nvc0 (really, trust me),
but since on other hardware the border colour is tightly coupled with
texture state they'd have to undo the swizzle, so I've added a cap.

The dependency of update_sampler on the texture updates was
introduced to avoid doing the apply_depthmode to the swizzle twice.

v2: Moved swizzling helper to u_format.c, extended the CAP to
provide more accurate information.

11 years agonv50: set BORDER_COLOR_SRGB in sampler objects
Christoph Bumiller [Sat, 13 Apr 2013 13:04:55 +0000 (15:04 +0200)]
nv50: set BORDER_COLOR_SRGB in sampler objects

11 years agonv50: fix 4th component of Lx_SINT/UINT formats
Christoph Bumiller [Fri, 12 Apr 2013 17:11:30 +0000 (19:11 +0200)]
nv50: fix 4th component of Lx_SINT/UINT formats

11 years agor600g: Fix build with --enable-opencl
Tom Stellard [Thu, 18 Apr 2013 18:24:48 +0000 (11:24 -0700)]
r600g: Fix build with --enable-opencl

11 years agomesa: enable GL_ARB_texture_float if TEXTURE_FLOAT_ENABLED is defined
Brian Paul [Thu, 18 Apr 2013 14:20:56 +0000 (08:20 -0600)]
mesa: enable GL_ARB_texture_float if TEXTURE_FLOAT_ENABLED is defined

Per message on mesa-users list, this wasn't working before.

Note: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agogallivm: change cubemaps / derivatives handling, take 55
Roland Scheidegger [Thu, 18 Apr 2013 15:06:43 +0000 (17:06 +0200)]
gallivm: change cubemaps / derivatives handling, take 55

Turns out the previous "fix" for handling per-pixel face selection and
derivatives didn't work out that well - the derivatives were wrong by
quite a bit, in theory transformation of the derivatives into cube space
should work, but would be _a lot_ more work than the "simplified" transform
used.
So, for explicit derivatives, I'm just giving up and go back to not honoring
them.
For implicit derivatives (and the fake explicit ones) however we try
something a little different, we just calculate rho as we would for a 3d
texture, that is after scaling the coords by the inverse major axis.
This gives the same results as calculating the derivs after projection of
the coords to the same face as long as all pixels hit the same face (and
only without rho_no_opt, otherwise it should be a bit worse). And when
not all pixels are hitting the same face, the results aren't so hot but
not catastrophically bad (I believe not off by more than a factor of 2 without
no_rho_approx and not more than sqrt(2) with no_rho_approx). I think this is
better than just picking the wrong face but who knows...

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: Add no_rho_approx debug option
Roland Scheidegger [Thu, 18 Apr 2013 15:04:01 +0000 (17:04 +0200)]
gallivm: Add no_rho_approx debug option

This will calculate rho correctly as
sqrt(max((ds/dx)^2 + (dt/dx)^2 + (dr/dx)^2), (ds/dx)^2 + (dt/dx)^2 + (dr/dx)^2))
instead of max(|ds/dx|,|dt/dx|,|dr/dx|,|ds/dy|,|dt/dy,|dr/dy|)
(for 3 coords - 2 coords work analogous, for 1 coord there's no point doing
the exact version), for both implicit and explicit derivatives.
While such approximation seems to be allowed in OpenGL some APIs may be less
forgiving, and the error can be quite large (sqrt(2) for 2 coords, sqrt(3) for
3 coords so wrong by nearly one mip level in the latter case).
This also helps to single out "real" bugs from "expected" ones, so it is debug
only (though at least combined with no_brilinear I didn't really see much of a
performance difference but only tested with a debug build - at least with
implicit mipmaps the instruction count is almost exactly the same though the
instructions are more complex (1 sqrt and mul/adds instead of and/max mostly).
The code when the option isn't set stays exactly the same.

v2: rename no_rho_opt to no_rho_approx.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agollvmpipe: Support half integer pixel center fs coord.
José Fonseca [Thu, 18 Apr 2013 10:39:19 +0000 (11:39 +0100)]
llvmpipe: Support half integer pixel center fs coord.

Tested with graw/fs-fragcoord 2/3, and piglit
glsl-arb-fragment-coord-conventions.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agollvmpipe: Remove the static interpolation.
José Fonseca [Thu, 18 Apr 2013 09:33:09 +0000 (10:33 +0100)]
llvmpipe: Remove the static interpolation.

No longer used.

If we ever want the old behavior we can run a loop unroller pass.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallivm: Drop pos arg from lp_build_tgsi_soa.
José Fonseca [Thu, 18 Apr 2013 08:55:35 +0000 (09:55 +0100)]
gallivm: Drop pos arg from lp_build_tgsi_soa.

Never used.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agodocs: update release notes for 9.2
Andreas Boll [Wed, 17 Apr 2013 15:26:08 +0000 (17:26 +0200)]
docs: update release notes for 9.2

Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoralloc: Move declarations before statements.
José Fonseca [Thu, 18 Apr 2013 05:21:04 +0000 (06:21 +0100)]
ralloc: Move declarations before statements.

Trivial.  Should fix MSVC build.

11 years agoconfigure: enable vdpau and xvmc detection, with gallium
Emil Velikov [Thu, 18 Apr 2013 00:40:40 +0000 (01:40 +0100)]
configure: enable vdpau and xvmc detection, with gallium

Currently the vdpau and xvmc detection code, is enabled for all builds. The
state trackers exist only within gallium. Enable whenever at least one gallium
driver is selected

v2: removed stray '-a'
[mattst88 v3]: Removed stray $.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63645
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
11 years agoi965: Check reg.nr for BRW_ARF_NULL instead of reg.file.
Matt Turner [Mon, 15 Apr 2013 22:00:08 +0000 (15:00 -0700)]
i965: Check reg.nr for BRW_ARF_NULL instead of reg.file.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Implement work-around for CMP with null dest on Haswell.
Matt Turner [Mon, 15 Apr 2013 21:59:09 +0000 (14:59 -0700)]
i965: Implement work-around for CMP with null dest on Haswell.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi915g: Release old fragment shader sampler views with current pipe
Stuart Abercrombie [Thu, 11 Apr 2013 17:57:43 +0000 (10:57 -0700)]
i915g: Release old fragment shader sampler views with current pipe

We were trying to use a destroy method from a deleted context.
This fix is based on what's in the svga driver.

Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
11 years agoi965/vec4: Fix hypothetical use of uninitialized data in attribute_map[].
Paul Berry [Tue, 16 Apr 2013 19:49:51 +0000 (12:49 -0700)]
i965/vec4: Fix hypothetical use of uninitialized data in attribute_map[].

Fixes issue identified by Klocwork analysis:

    'attribute_map' array elements might be used uninitialized in this
    function (vec4_visitor::lower_attributes_to_hw_regs).

The attribute_map array contains the mapping from shader input
attributes to the hardware registers they are stored in.
vec4_vs_visitor::setup_attributes() only populates elements of this
array which, according to core Mesa, are actually used by the shader.
Therefore, when vec4_visitor::lower_attributes_to_hw_regs() accesses
the array to lower a register access in the shader, it should in
principle only access elements of attribute_map that contain valid
data.  However, if a bug ever caused the driver back-end to access an
input that was not flagged as used by core Mesa, then
lower_attributes_to_hw_regs() would access uninitialized memory, which
could cause illegal instructions to get generated, resulting in a
possible GPU hang.

This patch makes the situation more robust by using memset() to
pre-initialize the attribute_map array to zero, so that if such a bug
ever occurred, lower_attributes_to_hw_regs() would generate a (mostly)
harmless access to r0.  In addition, it adds assertions to
lower_attributes_to_hw_regs() so that if we do have such a bug, we're
likely to discover it quickly.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoralloc: don't write to memory in case of alloc fail.
Dave Airlie [Wed, 17 Apr 2013 01:07:49 +0000 (11:07 +1000)]
ralloc: don't write to memory in case of alloc fail.

For some reason I made this happen under indirect rendering,
I think we might have a leak, valgrind gave out, so I said I'd
fix the basic problem.

NOTE: This is a candidate for stable branches.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agomesa: generate glGetInteger/Boolean/Float/Doublev() code for all APIs
Brian Paul [Wed, 17 Apr 2013 15:49:39 +0000 (09:49 -0600)]
mesa: generate glGetInteger/Boolean/Float/Doublev() code for all APIs

No longer pass -a flag to the get_hash_generate.py script to specify
OpenGL, ES1, ES2, etc.  This updates the autoconf, scons and android
build files too (so we can bisect).

This is the last of the API-dependent conditional compilation in
core Mesa.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agomesa: remove mfeatures.h
Brian Paul [Wed, 17 Apr 2013 15:49:39 +0000 (09:49 -0600)]
mesa: remove mfeatures.h

No longer needed.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agomesa: remove #include "mfeatures.h" from numerous source files
Brian Paul [Wed, 17 Apr 2013 15:49:39 +0000 (09:49 -0600)]
mesa: remove #include "mfeatures.h" from numerous source files

None of the remaining FEATURE_x symbols in mfeatures.h are used anymore.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoglapi: no longer emit #include "mfeatures.h" in generated files
Brian Paul [Wed, 17 Apr 2013 15:49:39 +0000 (09:49 -0600)]
glapi: no longer emit #include "mfeatures.h" in generated files

None of the symbols in mfeatures.h are used anymore.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agomesa: remove FEATURE_remap_table from remap.[ch]
Brian Paul [Wed, 17 Apr 2013 15:49:39 +0000 (09:49 -0600)]
mesa: remove FEATURE_remap_table from remap.[ch]

It was always defined.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoglapi: remove FEATURE_remap_table test (it's always defined)
Brian Paul [Wed, 17 Apr 2013 15:49:39 +0000 (09:49 -0600)]
glapi: remove FEATURE_remap_table test (it's always defined)

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agodraw/so: respect leading/provoking vertex info
Zack Rusin [Wed, 17 Apr 2013 22:21:35 +0000 (15:21 -0700)]
draw/so: respect leading/provoking vertex info

we were ignoring leading/provoking vertex settings which was
breaking decomposition of some strips.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>