mesa.git
12 years agomesa: Create the default (name==0) buffer texture.
Eric Anholt [Mon, 26 Mar 2012 23:49:23 +0000 (16:49 -0700)]
mesa: Create the default (name==0) buffer texture.

All that should be needed is that it exists.  Fixes segfaults on first
_mesa_update_context() with a samplerBuffer-using shader active but
without a particular buffer texture enabled.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoglsl: Add texelFetch(*samplerBuffer) entrypoints to GLSL 1.40.
Eric Anholt [Mon, 26 Mar 2012 21:04:48 +0000 (14:04 -0700)]
glsl: Add texelFetch(*samplerBuffer) entrypoints to GLSL 1.40.

Fix texelFetch(sampler2DRect) and textureSize(samplerBuffer)
generation to not reference a LOD at the same time because it's easier
than not fixing it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoglsl: Add support for parsing [iu]samplerBuffer types in GLSL 1.40.
Eric Anholt [Mon, 26 Mar 2012 21:13:17 +0000 (14:13 -0700)]
glsl: Add support for parsing [iu]samplerBuffer types in GLSL 1.40.

The samplerBuffer type will be undefined in !glsl 1.40, and the
keyword is marked as reserved.  The [iu]samplerBuffer types are not
marked as reserved pre-1.40, so they don't have separate tokens and
fall through to normal type handling.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Set the correct initial value of the texture buffer object format.
Eric Anholt [Tue, 20 Mar 2012 23:52:30 +0000 (16:52 -0700)]
mesa: Set the correct initial value of the texture buffer object format.

Fixes piglit GL_ARB_texture_buffer_object/get

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Set up glTexBuffer{,ARB} for display list compile.
Eric Anholt [Tue, 20 Mar 2012 23:31:21 +0000 (16:31 -0700)]
mesa: Set up glTexBuffer{,ARB} for display list compile.

We're supposed to just immediately call it.  Fixes piglit
GL_ARB_texture_buffer_object/dlist

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoglapi: regen for TBO change.
Eric Anholt [Wed, 28 Mar 2012 17:27:39 +0000 (10:27 -0700)]
glapi: regen for TBO change.

12 years agoglapi: Mark TexBuffer as an alias of TexBufferARB.
Eric Anholt [Tue, 20 Mar 2012 23:50:51 +0000 (16:50 -0700)]
glapi: Mark TexBuffer as an alias of TexBufferARB.

This is set correctly in gl.spec, but was missed in Mesa.  As a
result, only one of the two was hooked up in Mesa.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoglsl: Drop the round-trip through ast_type_specifier for many builtin types.
Eric Anholt [Fri, 30 Mar 2012 06:17:32 +0000 (23:17 -0700)]
glsl: Drop the round-trip through ast_type_specifier for many builtin types.

We have lexer recognition of a bunch of our types based on the
handling.  This code was mapping those recognized tokens to an enum
and then to a string of their name.  Just drop the enums and provide
the string directly in the parser.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoglsl: Use (const char *) in AST nodes rather than plain (char *).
Kenneth Graunke [Fri, 30 Mar 2012 06:17:31 +0000 (23:17 -0700)]
glsl: Use (const char *) in AST nodes rather than plain (char *).

Nothing actually relied on them being mutable, and there was at least
one cast which discarded const qualifiers.  The next patch would have
introduced many more.

Casting away const qualifiers should be avoided if at all possible.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoff_fragment_shader: Remove some dead fields.
Eric Anholt [Mon, 19 Mar 2012 23:02:06 +0000 (16:02 -0700)]
ff_fragment_shader: Remove some dead fields.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agox86-64: Don't print "Initializing x86-64 optimizations" in debug builds.
Kenneth Graunke [Mon, 2 Apr 2012 21:53:00 +0000 (14:53 -0700)]
x86-64: Don't print "Initializing x86-64 optimizations" in debug builds.

In "release" builds, Mesa would print this message if the MESA_DEBUG
variable was set.  Make it so for debug builds as well.

I build debug builds all the time, but I'm not debugging this.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoir_to_mesa: Remove pretense of support for function calls.
Kenneth Graunke [Mon, 2 Apr 2012 20:29:37 +0000 (13:29 -0700)]
ir_to_mesa: Remove pretense of support for function calls.

While ir_to_mesa contains code that attempts to support functions, I
honestly doubt it's been tested and have little confidence that it
works.

The comment in visit(ir_function *ir) doesn't inspire confidence:
/* Ignore function bodies other than main() -- we shouldn't see calls to
 * them since they should all be inlined before we get to ir_to_mesa.
 */

Furthermore, hardware drivers such as i915, i965, and (AFAICT) r200
don't support the BGNSUB/ENDSUB/CAL opcodes anyway.  Only swrast does.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Remove vestiges of function call support from the old VS backend.
Kenneth Graunke [Mon, 2 Apr 2012 21:03:08 +0000 (14:03 -0700)]
i965: Remove vestiges of function call support from the old VS backend.

This never worked.  brwProgramStringNotify also explicitly rejects
programs that use CAL and RET.  So there's no need for this to exist.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi915: set SPRITE_POINT_ENABLE bit correctly
Yuanhan Liu [Sat, 17 Mar 2012 02:48:23 +0000 (10:48 +0800)]
i915: set SPRITE_POINT_ENABLE bit correctly

When SPRITE_POINT_ENABLE bit is set, the texture coord would be
replaced, and this is only needed when we called something like
glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE).

And more,  we currently handle varying inputs as texture coord,
we would be careful when setting this bit and set it just when
needed, or you will find the value of varying input is not right
and changed.

Thus we do set SPRITE_POINT_ENABLE bit only when all enabled tex
coord units need do CoordReplace. Or fallback is needed to make
sure the rendering is right.

With handling the bit setup at i915_update_sprite_point_enable(),
we don't need the relative code at i915Enable then.

This patch would _really_ fix the webglc point-size.html test case and
of course, not regress piglit point-sprite and glean-pointSprite
testcase.

NOTE: This is a candidate for stable release branches.

v2: fallback just when all enabled tex coord units need do
    CoordReplace (Eric)
v3: move the sprite point validate code at I915InvalidateState (Eric)
v4: sprite point enable bit update based on _NEW_PROGRAM, too
    add relative _NEW-state comments to show what state is being used(Eric)

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
12 years agoglx: fix compile warnings
Yuanhan Liu [Wed, 28 Mar 2012 02:09:55 +0000 (10:09 +0800)]
glx: fix compile warnings

Fix 'set but not used' warnings; gl_version, gl_versions_profiles and
glx_extensions variables are used just only HAVE_XCB_GLX_CREATE_CONTEXT
is defined. Thus those warnings are shown when that macro isn't defined.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
12 years agost/xa: Link with -Wl,-r instead of -r.
Johannes Obermayr [Sat, 7 Apr 2012 18:31:41 +0000 (20:31 +0200)]
st/xa: Link with -Wl,-r instead of -r.

This is required to link with clang:
  /usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000400160.

12 years agotgsi: Fix conflict with fortify printf redirect in glibc.
Johannes Obermayr [Mon, 5 Mar 2012 18:37:39 +0000 (19:37 +0100)]
tgsi: Fix conflict with fortify printf redirect in glibc.

 Fixes clang error:

   tgsi/tgsi_dump.c:72:12: error: no member named '__printf_chk' in 'struct dump_ctx'
         ctx->printf( ctx, "%u", e );
         ~~~  ^
   /usr/include/bits/stdio2.h:109:3: note: expanded from macro 'printf'
     __printf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
     ^

 Idea stolen from:
   http://www.mail-archive.com/pld-cvs-commit@lists.pld-linux.org/msg210998.html

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agost/mesa: fix max_offset computation for base vertex
Brian Paul [Mon, 2 Apr 2012 18:05:16 +0000 (20:05 +0200)]
st/mesa: fix max_offset computation for base vertex

Add the maximum base vertex offset to max_index for computing the
buffer size.  Fixes a failed assertion in the u_upload_mgr.c code with
the VMware svga driver.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=48141

v2: incorporate Marek's suggestions.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
12 years agosvga: add missing cases for PIPE_CAP_x queries
Brian Paul [Thu, 5 Apr 2012 21:28:09 +0000 (15:28 -0600)]
svga: add missing cases for PIPE_CAP_x queries

Return 0 for features we don't support.  Added debug_printf()
warnings when we fail to handle a new PIPE_CAP_x case.  That will
alert us to interfaces changes in the future.  We don't want to
just ignore new PIPE_CAPs and possibly miss something important.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agosvga: return 1 for PIPE_CAP_VERTEX_COLOR_UNCLAMPED query
Brian Paul [Wed, 4 Apr 2012 22:04:00 +0000 (16:04 -0600)]
svga: return 1 for PIPE_CAP_VERTEX_COLOR_UNCLAMPED query

Before, we weren't clamping the vertex colors produced by ARB vertex
programs.  This could result in some rendering being too bright (in
ETQW, for example).

Also add cases for PIPE_CAP_VERTEX_COLOR_CLAMPED and
PIPE_CAP_FRAGMENT_COLOR_CLAMPED with comments to be complete.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agosvga: handle TGSI_SEMANTIC_CLIPDIST/VERTEX semantics
Brian Paul [Mon, 2 Apr 2012 18:05:50 +0000 (20:05 +0200)]
svga: handle TGSI_SEMANTIC_CLIPDIST/VERTEX semantics

We can't support these vertex attributes, but don't die in an assertion.
Issue a warning instead.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=48142

12 years agogallium/docs: fix typos
Brian Paul [Fri, 30 Mar 2012 15:41:42 +0000 (09:41 -0600)]
gallium/docs: fix typos

12 years agoi965: Actually upload sampler state pointers for the VS unit on Gen6.
Kenneth Graunke [Wed, 4 Apr 2012 23:48:21 +0000 (16:48 -0700)]
i965: Actually upload sampler state pointers for the VS unit on Gen6.

We already program all the sampler state correctly, we just didn't give
the GPU a pointer to it for the VS stage.  Thus, any texturing other
than texelFetch() wouldn't work.

Fixes piglit test vs-textureLod-miplevels and 99 of oglconform's
glsl-bif-tex subtests.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agogallivm: Updated lp_build_log2_approx to use a more accurate polynomial.
James Benton [Thu, 5 Apr 2012 19:34:11 +0000 (20:34 +0100)]
gallivm: Updated lp_build_log2_approx to use a more accurate polynomial.

Tested with lp_test_arit with 100% passes and piglit tests with 100%
pass for log but some tests still fail for pow.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
12 years agogallivm: Updated lp_build_polynomial to compute odd and even terms separately to...
James Benton [Thu, 5 Apr 2012 19:32:51 +0000 (20:32 +0100)]
gallivm: Updated lp_build_polynomial to compute odd and even terms separately to decrease data dependency for faster runtime.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
12 years agoxatracker: fix the build of a 32bit lib on a 64bit os
Alexandre Demers [Thu, 5 Apr 2012 04:18:25 +0000 (00:18 -0400)]
xatracker: fix the build of a 32bit lib on a 64bit os

we were missing cflags.

Signed-off-by: Zack Rusin <zackr@vmware.com>
12 years agor600g: inline r600_upload_index_buffer
Marek Olšák [Mon, 2 Apr 2012 01:01:01 +0000 (03:01 +0200)]
r600g: inline r600_upload_index_buffer

12 years agor600g: inline r600_upload_const_buffer
Marek Olšák [Mon, 2 Apr 2012 00:45:27 +0000 (02:45 +0200)]
r600g: inline r600_upload_const_buffer

12 years agor600g: handle DISCARD_WHOLE_RESOURCE for buffers
Marek Olšák [Mon, 2 Apr 2012 04:08:58 +0000 (06:08 +0200)]
r600g: handle DISCARD_WHOLE_RESOURCE for buffers

This should prevent stalls and therefore increase perfomance in some cases.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: invalidate caches at the beginning of CS
Marek Olšák [Mon, 2 Apr 2012 03:01:20 +0000 (05:01 +0200)]
r600g: invalidate caches at the beginning of CS

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: remove dead code after the rework
Marek Olšák [Sun, 1 Apr 2012 22:33:52 +0000 (00:33 +0200)]
r600g: remove dead code after the rework

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: rework state emission of constant buffers
Marek Olšák [Sun, 1 Apr 2012 20:03:15 +0000 (22:03 +0200)]
r600g: rework state emission of constant buffers

Framerate in ipers:
  before: 43.6 FPS
  after:  46.6 FPS

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: rework state emission of vertex buffers
Marek Olšák [Fri, 30 Mar 2012 21:52:45 +0000 (23:52 +0200)]
r600g: rework state emission of vertex buffers

This reduces a little of CPU overhead.
The idea is to translate pipe vertex buffers directly into the CS
and not using any intermediate representations.

Framerate in Torcs:
  before: 32.2
  after:  34.6

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: kill off the fallback for crazy src_offset values
Marek Olšák [Fri, 30 Mar 2012 21:39:55 +0000 (23:39 +0200)]
r600g: kill off the fallback for crazy src_offset values

st/mesa doesn't allow src_offset to be greater than stride and the maximum
stride r600 supports is 2047.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agost/xvmc: fix library installation dir
Alexandre Demers [Wed, 4 Apr 2012 08:54:56 +0000 (10:54 +0200)]
st/xvmc: fix library installation dir

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=47878

v2: some reordering and while at it also fix the
    comment in Makefile.xvmc

Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agor300g/swtcl: fix crash when back color is present in vertex shader
Marek Olšák [Wed, 4 Apr 2012 01:55:42 +0000 (03:55 +0200)]
r300g/swtcl: fix crash when back color is present in vertex shader

The shader transformation code sometimes produced invalid TGSI.

12 years agor300g/swtcl: initialize some Draw options
Marek Olšák [Wed, 4 Apr 2012 00:07:55 +0000 (02:07 +0200)]
r300g/swtcl: initialize some Draw options

12 years agor300g/swtcl: fix polygon offset
Marek Olšák [Tue, 3 Apr 2012 23:46:31 +0000 (01:46 +0200)]
r300g/swtcl: fix polygon offset

12 years agor300g/swtcl: don't expose shader subroutine support
Marek Olšák [Tue, 3 Apr 2012 21:00:18 +0000 (23:00 +0200)]
r300g/swtcl: don't expose shader subroutine support

RET in the main function doesn't work. This should be fixed in Draw, but meh.

12 years agor300g: initialize state & render functions before creating u_vbuf & u_blitter
Marek Olšák [Tue, 3 Apr 2012 20:12:35 +0000 (22:12 +0200)]
r300g: initialize state & render functions before creating u_vbuf & u_blitter

12 years agor300g/swtcl: don't enter u_vbuf_mgr
Marek Olšák [Sat, 31 Mar 2012 20:17:19 +0000 (22:17 +0200)]
r300g/swtcl: don't enter u_vbuf_mgr

12 years agor300g/swtcl: don't print an error when getting ClipVertex
Marek Olšák [Tue, 3 Apr 2012 20:37:30 +0000 (22:37 +0200)]
r300g/swtcl: don't print an error when getting ClipVertex

Draw can do it just fine.

12 years agost/egl: Update to the new wl_shm_pool interface
Benjamin Franzke [Tue, 3 Apr 2012 18:20:49 +0000 (20:20 +0200)]
st/egl: Update to the new wl_shm_pool interface

12 years agou_blitter: don't use user buffers
Marek Olšák [Tue, 3 Apr 2012 17:58:48 +0000 (19:58 +0200)]
u_blitter: don't use user buffers

12 years agogallivm: Pass in a MCInstrInfo to createMCInstPrinter on llvm-3.1.
Vinson Lee [Tue, 3 Apr 2012 05:14:15 +0000 (22:14 -0700)]
gallivm: Pass in a MCInstrInfo to createMCInstPrinter on llvm-3.1.

llvm-3.1svn r153860 makes MCInstrInfo available to the MCInstPrinter.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agost/vdpau: fix deadlock in PresentationQueueQuerySurfaceStatus
Christian König [Thu, 29 Mar 2012 13:53:28 +0000 (15:53 +0200)]
st/vdpau: fix deadlock in PresentationQueueQuerySurfaceStatus

Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agor600g: remove dead code in r600_update_derived_state
Marek Olšák [Tue, 3 Apr 2012 15:09:47 +0000 (17:09 +0200)]
r600g: remove dead code in r600_update_derived_state

12 years agogallivm: Maximum loop iterations
James Benton [Mon, 2 Apr 2012 15:29:34 +0000 (16:29 +0100)]
gallivm: Maximum loop iterations

Limits maximum loop iterations in a TGSI shader to prevent infinite
loops from occurring, any iteration in any loop counts towards this
limit

Signed-off-by: José Fonseca <jfonseca@vmware.com>
12 years agogallivm: Simplify/reorder minimax helper.
José Fonseca [Tue, 3 Apr 2012 08:10:53 +0000 (09:10 +0100)]
gallivm: Simplify/reorder minimax helper.

12 years agoswrast: Fix memory leaks in blit_linear.
Vinson Lee [Sun, 1 Apr 2012 06:11:42 +0000 (23:11 -0700)]
swrast: Fix memory leaks in blit_linear.

Fixes Coverity resource leak defects.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoglsl: Demote 'type' from ir_instruction to ir_rvalue and ir_variable.
Kenneth Graunke [Wed, 21 Sep 2011 00:58:45 +0000 (17:58 -0700)]
glsl: Demote 'type' from ir_instruction to ir_rvalue and ir_variable.

Variables have types, expression trees have types, but statements don't.
Rather than have a nonsensical field that stays NULL in the base class,
just move it to where it makes sense.

Fix up a few places that lazily used ir_instruction even though they
actually knew the particular subclass.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Remove ir_call::get_callee() and set_callee().
Kenneth Graunke [Wed, 21 Sep 2011 01:08:11 +0000 (18:08 -0700)]
glsl: Remove ir_call::get_callee() and set_callee().

Previously, set_callee() performed some assertions about the type of the
ir_call; protecting the bare pointer ensured these checks would be run.

However, ir_call no longer has a type, so the getter and setter methods
don't actually do anything useful.  Remove them in favor of accessing
callee directly, as is done with most other fields in our IR.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Convert ir_call to be a statement rather than a value.
Kenneth Graunke [Tue, 20 Mar 2012 22:56:37 +0000 (15:56 -0700)]
glsl: Convert ir_call to be a statement rather than a value.

Aside from ir_call, our IR is cleanly split into two classes:
- Statements (typeless; used for side effects, control flow)
- Values (deeply nestable, pure, typed expression trees)

Unfortunately, ir_call confused all this:
- For void functions, we placed ir_call directly in the instruction
  stream, treating it as an untyped statement.  Yet, it was a subclass
  of ir_rvalue, and no other ir_rvalue could be used in this way.
- For functions with a return value, ir_call could be placed in
  arbitrary expression trees.  While this fit naturally with the source
  language, it meant that expressions might not be pure, making it
  difficult to transform and optimize them.  To combat this, we always
  emitted ir_call directly in the RHS of an ir_assignment, only using
  a temporary variable in expression trees.  Many passes relied on this
  assumption; the acos and atan built-ins violated it.

This patch makes ir_call a statement (ir_instruction) rather than a
value (ir_rvalue).  Non-void calls now take a ir_dereference of a
variable, and store the return value there---effectively a call and
assignment rolled into one.  They cannot be embedded in expressions.

All expression trees are now pure, without exception.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Split out ir_reader's ability to read ir_dereference_variables.
Kenneth Graunke [Thu, 22 Sep 2011 21:29:53 +0000 (14:29 -0700)]
glsl: Split out ir_reader's ability to read ir_dereference_variables.

Most of the time, we just want to read an ir_dereference, so there's no
need to have these in separate functions.  However, the next patch will
want to read an ir_dereference_variable directly.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Move constant expression handling from calls to signatures.
Kenneth Graunke [Tue, 20 Sep 2011 07:14:05 +0000 (00:14 -0700)]
glsl: Move constant expression handling from calls to signatures.

When translating a call from AST to HIR, we need to decide whether it
can be evaluated to a constant before emitting any code (namely, the
temporary declaration, assignment, and call.)

Soon, ir_call will become a statement taking a dereference of where to
store the return value, rather than an rvalue to be used on the RHS of
an assignment.  It will be more convenient to try evaluation before
creating a call.  ir_function_signature seems like a reasonable place.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Use ir_rvalue to represent generic error_type values.
Kenneth Graunke [Thu, 22 Sep 2011 22:04:56 +0000 (15:04 -0700)]
glsl: Use ir_rvalue to represent generic error_type values.

Currently, ir_call can be used as either a statement (for void
functions) or a value (for non-void functions).  This is rather awkward,
as it's the only class that can be used in both forms.

A number of places use ir_call::get_error_instruction() to construct a
generic value of error_type.  If ir_call is to become a statement, it
can no longer serve this purpose.

Unfortunately, none of our classes are particularly well suited for
this, and creating a new one would be rather aggrandizing.  So, this
patch introduces ir_rvalue::error_value(), a static method that creates
an instance of the base class, ir_rvalue.  This has the nice property
that you can't accidentally try and access uninitialized fields (as it
doesn't have any).  The downside is that the base class is no longer
abstract.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Combine AST-level and IR-level parameter mode checking loops.
Kenneth Graunke [Thu, 29 Mar 2012 02:24:45 +0000 (19:24 -0700)]
glsl: Combine AST-level and IR-level parameter mode checking loops.

generate_call() and ast_function_expression::hir() both tried to verify
that 'out' and 'inout' parameters used l-values.  Irritatingly, it
turned out that this was not redundant; both checks caught -some- cases.

This patch combines the two into a single "complete" function that does
all the parameter mode checking.  It also adds a comment clarifying why
AST-level checking is necessary in the first place.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Split up function matching and call generation a bit more.
Kenneth Graunke [Wed, 28 Mar 2012 22:57:50 +0000 (15:57 -0700)]
glsl: Split up function matching and call generation a bit more.

We used to have one big function, match_signature_by_name, which found
a matching signature, performed out-parameter conversions, and generated
the ir_call.  As the code for matching against built-in functions became
more complicated, I split it internally, creating generate_call().

However, I left the same awkward interface.  This patch splits it into
three functions:
1. match_signature_by_name()

   This now takes a name, a list of parameters, the symbol table, and
   returns an ir_function_signature.  Simple and one purpose: matching.

2. no_matching_function_error()

   Generate the "no matching function" error and list of prototypes.
   This was complex enough that I felt it deserved its own function.

3. generate_call()

   Do the out-parameter conversion and generate the ir_call.  This
   could probably use more splitting.

The caller now has a more natural workflow: find a matching signature,
then either generate an error or a call.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Don't trust loop analysis in the presence of function calls.
Kenneth Graunke [Wed, 28 Mar 2012 21:00:42 +0000 (14:00 -0700)]
glsl: Don't trust loop analysis in the presence of function calls.

Function calls may have side effects that alter variables used inside
the loop.  In the fragment shader, they may even terminate the shader.
This means our analysis about loop-constant or induction variables may
be completely wrong.

In general it's impossible to determine whether they actually do or not
(due to the halting problem), so we'd need to perform conservative
static analysis.  For now, it's not worth the complexity: most functions
will be inlined, at which point we can unroll them successfully.

Fixes Piglit tests:
- shaders/glsl-fs-unroll-out-param
- shaders/glsl-fs-unroll-side-effect

NOTE: This is a candidate for release branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965/aub: Dump a final bitmap from DestroyContext.
Kenneth Graunke [Fri, 30 Mar 2012 06:37:09 +0000 (23:37 -0700)]
i965/aub: Dump a final bitmap from DestroyContext.

Certain applications don't call SwapBuffers before exiting.  Yet, we'd
really like to see a bitmap containing the final rendered image even if
they choose never to present it.

In particular, Piglit tests (at least with -auto -fbo) fall into this
category.  Many of them failed to dump any images at all.

Dumping one final image at context destruction time seems to work.
We may wish to pursue a more elegant solution later.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agor600g: unduplicate code for PS partial flush
Marek Olšák [Sun, 1 Apr 2012 17:19:21 +0000 (19:19 +0200)]
r600g: unduplicate code for PS partial flush

12 years agor600g: determine in advance if hw has vertex cache
Marek Olšák [Sat, 31 Mar 2012 21:44:31 +0000 (23:44 +0200)]
r600g: determine in advance if hw has vertex cache

12 years agor600g: optimize r600_resource_va
Marek Olšák [Fri, 30 Mar 2012 23:31:47 +0000 (01:31 +0200)]
r600g: optimize r600_resource_va

Avoid calling get_radeon_bo and inline it.

12 years agotargets/{xvmc,vdpau,va}: remove all objects on make clean
Marcin Slusarz [Sun, 1 Apr 2012 15:31:51 +0000 (17:31 +0200)]
targets/{xvmc,vdpau,va}: remove all objects on make clean

12 years agointel: add PCI IDs for Ivy Bridge GT2 server variant
Eugeni Dodonov [Sat, 31 Mar 2012 15:38:59 +0000 (12:38 -0300)]
intel: add PCI IDs for Ivy Bridge GT2 server variant

Those IDs are used by Bromolow.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
12 years agolinker: Fix memory leak in count_uniform_size::visit_field.
Vinson Lee [Sat, 31 Mar 2012 06:36:45 +0000 (23:36 -0700)]
linker: Fix memory leak in count_uniform_size::visit_field.

Fixes a Coverity resource leak defect.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agointel: Add some PCI IDs for Haswell.
Kenneth Graunke [Mon, 19 Mar 2012 20:42:16 +0000 (13:42 -0700)]
intel: Add some PCI IDs for Haswell.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Set "Shader Channel Select" fields in Haswell's SURFACE_STATE.
Kenneth Graunke [Thu, 20 Oct 2011 09:00:52 +0000 (02:00 -0700)]
i965: Set "Shader Channel Select" fields in Haswell's SURFACE_STATE.

These can be used to implement EXT_texture_swizzle without baking
state-dependent swizzle instructions into the shader and forcing
recompiles.

For now, just set them to pass-through mode, so everything continues to
work as it did on Ivybridge.  We can optimize this later.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Fill in Sample Mask in Haswell's 3DSTATE_PS.
Kenneth Graunke [Thu, 20 Oct 2011 09:00:43 +0000 (02:00 -0700)]
i965: Fill in Sample Mask in Haswell's 3DSTATE_PS.

We only need one sample, since we don't support multisampling yet.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Set "Stencil Buffer Enable" bit on Haswell.
Kenneth Graunke [Sat, 24 Sep 2011 08:45:18 +0000 (01:45 -0700)]
i965: Set "Stencil Buffer Enable" bit on Haswell.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Set Line Stipple enable bit in 3DSTATE_SF for Haswell.
Kenneth Graunke [Sat, 24 Sep 2011 07:42:23 +0000 (00:42 -0700)]
i965: Set Line Stipple enable bit in 3DSTATE_SF for Haswell.

Apparently this needs to be the same as in 3DSTATE_WM.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Update max VS/PS threads shift offsets for Haswell.
Kenneth Graunke [Fri, 23 Sep 2011 00:12:50 +0000 (17:12 -0700)]
i965: Update max VS/PS threads shift offsets for Haswell.

These now start at bit 23 instead of bit 24/25.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Disable HiZ on Haswell for now.
Kenneth Graunke [Wed, 7 Mar 2012 18:16:00 +0000 (10:16 -0800)]
i965: Disable HiZ on Haswell for now.

Getting HiZ working means updating all the state packets for resolves
and clears.  It's not worth doing until we get the basics working.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Add initial IS_HASWELL() macros.
Kenneth Graunke [Sat, 13 Aug 2011 01:22:48 +0000 (18:22 -0700)]
i965: Add initial IS_HASWELL() macros.

For now, these all return 0, as I don't yet want to enable Haswell
support.  Eventually they will be filled in with proper PCI IDs.

Also add an is_haswell field similar to is_g4x to make it easy to
distinguish Gen7 and Gen7.5.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Avoid explicit accumulator operands in SIMD16 mode on Gen7.
Kenneth Graunke [Fri, 30 Mar 2012 20:58:06 +0000 (13:58 -0700)]
i965: Avoid explicit accumulator operands in SIMD16 mode on Gen7.

According to the BSpec ISA volume's "Accumulator Register" section:

"[DevIVB] SIMD16 execution on dwords is not allowed when accumulator is
 explicit source or destination operand."

Fixes piglit tests:
- fs-multiply-const-ivec4
- fs-multiply-const-uvec4
- fs-multiply-ivec4-const
- fs-multiply-uvec4-const

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agogallium/postprocess: document serious issue causing undefined behavior
Marek Olšák [Thu, 29 Mar 2012 19:28:55 +0000 (21:28 +0200)]
gallium/postprocess: document serious issue causing undefined behavior

12 years agor600g: cleanup after get_query_result change
Marek Olšák [Thu, 29 Mar 2012 14:45:44 +0000 (16:45 +0200)]
r600g: cleanup after get_query_result change

Finally, union r600_query_result can be removed.

12 years agor300g: cleanup after get_query_result change
Marek Olšák [Thu, 29 Mar 2012 14:38:53 +0000 (16:38 +0200)]
r300g: cleanup after get_query_result change

12 years agogallium/util: add helper function util_query_clear_result
Marek Olšák [Fri, 30 Mar 2012 15:07:45 +0000 (17:07 +0200)]
gallium/util: add helper function util_query_clear_result

12 years agogallium: adapt to get_query_result interface change
Marek Olšák [Tue, 27 Mar 2012 20:42:30 +0000 (22:42 +0200)]
gallium: adapt to get_query_result interface change

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agogallium: make get_query_result return union* and not void*
Marek Olšák [Tue, 27 Mar 2012 19:51:50 +0000 (21:51 +0200)]
gallium: make get_query_result return union* and not void*

This replaces the cryptic void* parameter with a union.
(based on union r600_query_result)

Users of this can still pass uint64* in it, but that cannot work for every
query type, obviously. Most importantly, the code now documents what should
be expected from get_query_result.

This also adds pipe_query_data_pipeline_statistics as per the D3D11 docs.

v2: fix indentation, add comments and use the doxygen style

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoconfigure: Add --with-llvm-shared-libs
Tom Stellard [Wed, 28 Mar 2012 02:24:39 +0000 (22:24 -0400)]
configure: Add --with-llvm-shared-libs

This option allows targets to link against the LLVM shared library
instead of the static libs.  With LLVM 2.9, his saves ~11 MB for each of
the r300 target libraries.

12 years agoshared-glapi: Include from builddir
Kristian Høgsberg [Thu, 29 Mar 2012 13:20:53 +0000 (09:20 -0400)]
shared-glapi: Include from builddir

Fixes out-of-tree builds.

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

12 years agogallivm: Fix method overriding in raw_debug_ostream.
Vinson Lee [Wed, 28 Mar 2012 04:51:17 +0000 (21:51 -0700)]
gallivm: Fix method overriding in raw_debug_ostream.

Use matching type qualifers to avoid method hiding.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agoegl_dri2: use gbm_surface as the native window type in drm platform
Ander Conselvan de Oliveira [Wed, 25 Jan 2012 14:24:17 +0000 (16:24 +0200)]
egl_dri2: use gbm_surface as the native window type in drm platform

12 years agogbm: Create hooks for dri2_loader_extension in dri backend
Ander Conselvan de Oliveira [Wed, 25 Jan 2012 14:24:18 +0000 (16:24 +0200)]
gbm: Create hooks for dri2_loader_extension in dri backend

Pass a dri2_loader extension to the dri driver when gbm creates the dri
screen.  The implementation jumps through pointers in the gbm device
so that an EGL on GBM implementation can provide the real implementations.

12 years agogbm: Add gbm_surface interface
Ander Conselvan de Oliveira [Wed, 25 Jan 2012 14:24:14 +0000 (16:24 +0200)]
gbm: Add gbm_surface interface

The idea here is to be able to create an egl window surface from a
gbm_surface.  This avoids the need for the surfaceless extension and
lets the EGL platform handle buffer allocation, while keeping the user
in charge of somehow presenting the buffers (using kms page flipping,
for example).

gbm_surface_lock_front_buffer() locks a surface's front buffer and
returns a gbm bo representing it.  This bo should later be returned
to the gbm surface using gbm_surface_release_buffer().

12 years agodraw: fix missing immediates bug in polygon stipple code
Brian Paul [Fri, 23 Mar 2012 20:53:48 +0000 (14:53 -0600)]
draw: fix missing immediates bug in polygon stipple code

The function that counts the number of TGSI immediates also needs to
emit the immediates.  This fixes assorted failures when using polygon
stipple with fragment shaders that have their own immediates.

NOTE: This is a candidate for the 8.0 branch.

12 years agovl: move winsys helper out of winsys directory
Christian König [Mon, 26 Mar 2012 17:40:42 +0000 (19:40 +0200)]
vl: move winsys helper out of winsys directory

They aren't winsys of their own,
just help dealing with them.

v2: add some more comments in vl_winsys.h

Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agoUse -no-undefined libtool flag in src/glx/Makefile.am
Jon TURNEY [Tue, 13 Mar 2012 18:38:59 +0000 (18:38 +0000)]
Use -no-undefined libtool flag in src/glx/Makefile.am

"Use -no-undefined to assure libtool that the library has no unresolved
symbols at link time, so that libtool will build a shared library on
platforms that require that all symbols are resolved when the library is linked."

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
12 years agointel: fix un-blanced map_refcount issue
Yuanhan Liu [Tue, 27 Mar 2012 07:41:52 +0000 (15:41 +0800)]
intel: fix un-blanced map_refcount issue

This is a regression introduced by commit cdcfd5, which forget to
increase the map_refcount for successfully-mapped region. Thus caused a
wrong non-blanced map_refcount.

This would fix the regression found in the two following webglc testcase
on Pineview platform:
   texture-npot.html
   gl-max-texture-dimensions.html

Cc: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
12 years agoglx:dri_common.c: check psc->driScreen->createDrawable return value
Wang YanQing [Tue, 20 Mar 2012 03:49:42 +0000 (11:49 +0800)]
glx:dri_common.c: check psc->driScreen->createDrawable return value

createDrawable may return NULL value, we should check it, or it will
make a segment failed.

[minor-indent-issue-fixed-by: Yuanhan Liu]

Signed-off-by: Wang YanQing <udknight@gmail.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
12 years agor600g: also disable transform feedback on cayman
Marek Olšák [Wed, 28 Mar 2012 00:21:03 +0000 (02:21 +0200)]
r600g: also disable transform feedback on cayman

It's said to cause troubles there.
The env var is R600_STREAMOUT again.

12 years agor600g: enable transform feedback on everything that isn't r700
Marek Olšák [Tue, 27 Mar 2012 19:00:49 +0000 (21:00 +0200)]
r600g: enable transform feedback on everything that isn't r700

Use R700_STREAMOUT=1 if you wanna hack transform feedback on r700.

12 years agost/egl: Also remove wl_buffer_damage in wayland backend
Benjamin Franzke [Tue, 27 Mar 2012 16:50:30 +0000 (18:50 +0200)]
st/egl: Also remove wl_buffer_damage in wayland backend

As commit 03eca9d92d407c71a59ff8a43067759769da0ae4 does for egl_dri2.

12 years agogallivm: Use InitializeNativeTargetDisassembler().
ojab [Tue, 27 Mar 2012 03:05:58 +0000 (07:05 +0400)]
gallivm: Use InitializeNativeTargetDisassembler().

To initialize only native LLVM Disassembler on LLVM >= 3.1.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
12 years agoegl_dri2: make flush extension useable by drm platform
Ander Conselvan de Oliveira [Wed, 25 Jan 2012 14:24:15 +0000 (16:24 +0200)]
egl_dri2: make flush extension useable by drm platform

12 years agowayland: Stop using wl_buffer.damage
Kristian Høgsberg [Tue, 27 Mar 2012 12:09:32 +0000 (08:09 -0400)]
wayland: Stop using wl_buffer.damage

12 years agoAdd support for GL_EXT_unpack_subimage on GLES2
Neil Roberts [Wed, 21 Mar 2012 18:08:42 +0000 (18:08 +0000)]
Add support for GL_EXT_unpack_subimage on GLES2

This extension just permits GL_UNPACK_ROW_LENGTH, GL_UNPACK_SKIP_ROWS
and GL_UNPACK_SKIP_PIXELS to be passed to glPixelStore on GLES2 so it
is trivial to implement.

12 years agogles: Enable the GL_EXT_read_format_bgra extension
Benjamin Franzke [Sat, 24 Mar 2012 07:50:47 +0000 (08:50 +0100)]
gles: Enable the GL_EXT_read_format_bgra extension

Also fixes the usage of GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES,
which may be set to a BGRA format e.g. for a MESA_FORMAT_ARGB8888 fb.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>