profile/ivi/mesa.git
13 years agoi965: Emit texture cache flushes on gen6 along with render cache flushes.
Eric Anholt [Mon, 25 Jul 2011 18:50:27 +0000 (11:50 -0700)]
i965: Emit texture cache flushes on gen6 along with render cache flushes.

It turns out that internally the texture cache gets flushed in a
couple of cases, particularly around 2D operations mixed with 3D.  In
almost all cases one of those happens between rendering to an
FBO-attached texture and rendering from that texture.  However, as of
the next patch, glean tfbo (and the new fbo-flushing-2 test) would
manage to get stale texture values because one of those flushes didn't
occur.  The intention of this code was always to get the render cache
cleared and ready to be used from the sampler cache (and it does on <=
gen4), so this just catches gen5 up.

This patch was also tested to fix fbo-flushing on gen7.

13 years agoi965: vs optimization fix: Check val.{negate,abs} in accumulator_contains()
Paul Berry [Fri, 22 Jul 2011 21:05:52 +0000 (14:05 -0700)]
i965: vs optimization fix: Check val.{negate,abs} in accumulator_contains()

When emitting a MAC instruction in a vertex shader, brw_vs_emit()
calls accumulator_contains() to determine whether the accumulator
already contains the appropriate addend; if it does, then we can avoid
emitting an unnecessary MOV instruction.

However, accumulator_contains() wasn't checking the val.negate or
val.abs flags.  As a result, if the desired value was the negation, or
the absolute value, of what was already in the accumulator, we would
generate an incorrect shader.

Fixes piglit test vs-refract-vec4-vec4-float.

Tested on Gen5 and Gen6.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965/gen7: Fix shadow sampling in the old brw_wm_emit backend.
Kenneth Graunke [Thu, 12 May 2011 11:02:32 +0000 (04:02 -0700)]
i965/gen7: Fix shadow sampling in the old brw_wm_emit backend.

On Ivybridge, the shadow comparitor goes in the first slot, rather than
at the end.  It's not necessary to send u, v, and r.

Fixes tests texturing/texdepth and glean/fbo.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965/fs: Clear result before visiting shadow comparitor and LOD info.
Kenneth Graunke [Fri, 22 Jul 2011 04:17:10 +0000 (21:17 -0700)]
i965/fs: Clear result before visiting shadow comparitor and LOD info.

Commit 53c89c67f33639afef951e178f93f4e29acc5d53 ("i965: Avoid generating
MOVs for assignments of expressions.") added the line "this->result =
reg_undef" all over the code.  Unfortunately, since Eric developed his
patch before I landed Ivybridge support, he missed adding it to
fs_visitor::emit_texture_gen7() after rebasing.

Furthermore, since I developed TXD support before Eric's patch, I
neglected to add it to the gradient handling when I rebased.

Neglecting to set this causes the visitor to use this->result as storage
rather than generating a new temporary.  These missing statements
resulted in the same register being used to store several different
values.

Fixes the following piglit tests on Ivybridge:
- glsl-fs-shadow2dproj.shader_test
- glsl-fs-shadow2dproj-bias.shader_test

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agovdpau: enable mpeg1 hw decoding, using the exact same code path as mpeg2
Emeric [Mon, 18 Jul 2011 15:17:25 +0000 (15:17 +0000)]
vdpau: enable mpeg1 hw decoding, using the exact same code path as mpeg2

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

Signed-off-by: Christian König <deathsimple@vodafone.de>
13 years agogallium: change formats merged with pipe-video to type "other"
Christian König [Mon, 25 Jul 2011 00:58:31 +0000 (02:58 +0200)]
gallium: change formats merged with pipe-video to type "other"

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

13 years agoconfigure: Move gbm before egl in SRC_DIRS
Benjamin Franzke [Mon, 25 Jul 2011 07:37:02 +0000 (09:37 +0200)]
configure: Move gbm before egl in SRC_DIRS

egl_dri2 built into libEGL depends on libgbm.

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

13 years agog3dvl: remove unused vs output from create_ref_vert_shader
Christian König [Sun, 24 Jul 2011 23:32:39 +0000 (01:32 +0200)]
g3dvl: remove unused vs output from create_ref_vert_shader

The position of the quad vertex is calculated in calc_position,
so we don't need the output here any more.

13 years agor600g: use file_max instead of file_count to determine reg offset
Christian König [Sun, 24 Jul 2011 17:11:34 +0000 (19:11 +0200)]
r600g: use file_max instead of file_count to determine reg offset

Otherwise shaders with skipped inputs/outputs doesn't work correctly.

Signed-off-by: Christian König <deathsimple@vodafone.de>
13 years agogallium/softpipe: Don't clobber dest color/alpha before masking.
Younes Manton [Fri, 22 Jul 2011 00:10:34 +0000 (20:10 -0400)]
gallium/softpipe: Don't clobber dest color/alpha before masking.

The blend_quad function clobbers the actual render target color/alpha
values while applying the destination blend factor, which results in
restoring the wrong value during the masking stage for write-disabled
channels.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoglsl: Compare vector indices in blocks
Ian Romanick [Tue, 19 Jul 2011 01:51:25 +0000 (18:51 -0700)]
glsl: Compare vector indices in blocks

Just like the non-constant array index lowering pass, compare all N
indices at once.  For accesses to a vec4, this saves 3 comparison
instructions on a vector architecture.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoglsl: Factor out code that generates block of index comparisons
Ian Romanick [Tue, 19 Jul 2011 01:48:39 +0000 (18:48 -0700)]
glsl: Factor out code that generates block of index comparisons

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoglsl: Treat ir_dereference_array of non-var as a constant for lowering
Ian Romanick [Mon, 18 Jul 2011 23:25:33 +0000 (16:25 -0700)]
glsl: Treat ir_dereference_array of non-var as a constant for lowering

Previously the code would just look at deref->array->type to see if it
was a constant.  This isn't good enough because deref->array might be
another ir_dereference_array... of a constant.  As a result,
deref->array->type wouldn't be a constant, but
deref->variable_referenced() would return NULL.  The unchecked NULL
pointer would shortly lead to a segfault.

Instead just look at the return of deref->variable_referenced().  If
it's NULL, assume that either a constant or some other form of
anonymous temporary storage is being dereferenced.

This is a bit hinkey because most drivers treat constant arrays as
uniforms, but the lowering pass treats them as temporaries.  This
keeps the behavior of the old code, so this change isn't making things
worse.

Fixes i965 piglit:

    vs-temp-array-mat[234]-index-col-rd
    vs-temp-array-mat[234]-index-col-row-rd
    vs-uniform-array-mat[234]-index-col-rd
    vs-uniform-array-mat[234]-index-col-row-rd

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: When emitting a src/dst read of an output, keep the swizzle and neg
Ian Romanick [Thu, 21 Jul 2011 01:07:50 +0000 (18:07 -0700)]
i965: When emitting a src/dst read of an output, keep the swizzle and neg

Fixes i965 piglit vs-varying-array-mat[234]-row-rd.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: When emitting a src/dst write of an output, keep the write mask
Ian Romanick [Wed, 20 Jul 2011 23:04:17 +0000 (16:04 -0700)]
i965: When emitting a src/dst write of an output, keep the write mask

Fixes i965 piglit:

    vs-varying-array-mat[234]-col-row-wr
    vs-varying-array-mat[234]-index-col-row-wr
    vs-varying-array-mat[234]-index-row-wr
    vs-varying-array-mat[234]-row-wr
    vs-varying-mat[234]-col-row-wr
    vs-varying-mat[234]-row-wr

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoprog_optimize: Set unused regs to PROGRAM_UNDEFINED after CMP->MOV conversion
Ian Romanick [Thu, 21 Jul 2011 01:02:17 +0000 (18:02 -0700)]
prog_optimize: Set unused regs to PROGRAM_UNDEFINED after CMP->MOV conversion

Leaving the unused registers with other values caused assertion
failures and other problems in places that blindly iterate over all
sources.

brw_vs_emit.c:1381: get_src_reg: Assertion `c->regs[file][index].nr !=
0' failed.

Fixes i965 piglit:

    vs-uniform-array-mat[234]-col-row-rd
    vs-uniform-array-mat[234]-index-col-row-rd
    vs-uniform-array-mat[234]-index-row-rd
    vs-uniform-mat[234]-col-row-rd

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoir_to_mesa: Copy reladdr in src_reg(dst_reg) constructor
Ian Romanick [Mon, 18 Jul 2011 06:35:26 +0000 (23:35 -0700)]
ir_to_mesa: Copy reladdr in src_reg(dst_reg) constructor

Fixes i965 piglit:

    vs-temp-array-mat[234]-col-row-wr
    vs-temp-array-mat[234]-index-col-row-wr
    vs-temp-array-mat[234]-index-row-wr
    vs-temp-mat[234]-col-row-wr

Fixes swrast piglit:

    fs-temp-array-mat[234]-col-row-wr
    fs-temp-array-mat[234]-index-col-row-wr
    fs-temp-array-mat[234]-index-row-wr
    fs-temp-mat[234]-col-row-wr
    vs-temp-array-mat[234]-col-row-wr
    vs-temp-array-mat[234]-index-col-row-wr
    vs-temp-array-mat[234]-index-row-wr
    vs-temp-mat[234]-col-row-wr

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoir_to_mesa: Add each relative address to the previous
Ian Romanick [Mon, 18 Jul 2011 06:15:54 +0000 (23:15 -0700)]
ir_to_mesa: Add each relative address to the previous

This fixes many cases of accessing arrays of matrices using
non-constant indices at each level.

Fixes i965 piglit:

    vs-temp-array-mat[234]-index-col-rd
    vs-temp-array-mat[234]-index-col-row-rd
    vs-temp-array-mat[234]-index-col-wr
    vs-uniform-array-mat[234]-index-col-rd

Fixes swrast piglit:

    fs-temp-array-mat[234]-index-col-rd
    fs-temp-array-mat[234]-index-col-row-rd
    fs-temp-array-mat[234]-index-col-wr
    fs-uniform-array-mat[234]-index-col-rd
    fs-uniform-array-mat[234]-index-col-row-rd
    fs-varying-array-mat[234]-index-col-rd
    fs-varying-array-mat[234]-index-col-row-rd
    vs-temp-array-mat[234]-index-col-rd
    vs-temp-array-mat[234]-index-col-row-rd
    vs-temp-array-mat[234]-index-col-wr
    vs-uniform-array-mat[234]-index-col-rd
    vs-uniform-array-mat[234]-index-col-row-rd
    vs-varying-array-mat[234]-index-col-rd
    vs-varying-array-mat[234]-index-col-row-rd
    vs-varying-array-mat[234]-index-col-wr

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoglsl: When lowering non-constant vector indexing, respect existing conditions
Ian Romanick [Mon, 18 Jul 2011 00:35:00 +0000 (17:35 -0700)]
glsl: When lowering non-constant vector indexing, respect existing conditions

If the non-constant index was in the LHS of an assignment, any
existing condititon on that assignment would be lost.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoglsl: When lowering non-constant array indexing, respect existing conditions
Ian Romanick [Mon, 18 Jul 2011 00:33:26 +0000 (17:33 -0700)]
glsl: When lowering non-constant array indexing, respect existing conditions

If the non-constant index was in the LHS of an assignment, any
existing condititon on that assignment would be lost.

Fixes i965 piglit:

    fs-temp-array-mat[234]-col-row-wr
    fs-temp-array-mat[234]-index-col-row-wr
    fs-temp-array-mat[234]-index-col-wr
    fs-temp-array-mat[234]-index-row-wr
    vs-varying-array-mat[234]-index-col-wr

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoglsl: Rework lowering of non-constant array indexing
Ian Romanick [Mon, 18 Jul 2011 19:18:19 +0000 (12:18 -0700)]
glsl: Rework lowering of non-constant array indexing

The previous implementation could easily get tricked if the LHS of an
assignment included a non-constant index that was "inside" another
dereference.  For example:

    mat4 m[2];
    m[0][i] = vec4(0.0);

Due to the way it tracked whether the array was being assigned, it
would think that the non-constant index was in an r-value.  The new
code fixes that by tracking l-values and r-values differently.  The
index is also replaced by cloning the IR and replacing the index
variable instead of the odd way it was done before.

v2: Apply some simplifications suggested by Eric Anholt.  Making
assignment_generator::rvalue be ir_dereference instead of ir_rvalue
simplified the code a bit.

Fixes i965 piglit fs-temp-array-mat[234]-index-wr and
vs-varying-array-mat[234]-index-wr.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34691
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoglsl: Split out part of variable_index_to_cond_assign_visitor::needs_lowering
Ian Romanick [Mon, 18 Jul 2011 17:07:24 +0000 (10:07 -0700)]
glsl: Split out part of variable_index_to_cond_assign_visitor::needs_lowering

Other code will soon need to know if an array needs lowering based
exclusively on the storage mode.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoglsl: Move is_array_or_matrix outside visitor class
Ian Romanick [Mon, 18 Jul 2011 16:51:34 +0000 (09:51 -0700)]
glsl: Move is_array_or_matrix outside visitor class

There's no reason for it to be there, and another class that may not
have access to the visitor will need it soon.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agogallivm: Add a note about log2 computation and denormalized numbers.
José Fonseca [Wed, 20 Jul 2011 21:53:59 +0000 (14:53 -0700)]
gallivm: Add a note about log2 computation and denormalized numbers.

13 years agogallivm: Fix lp_build_exp2 order 4-5 polynomial coefficients and bump order.
José Fonseca [Wed, 20 Jul 2011 21:53:08 +0000 (14:53 -0700)]
gallivm: Fix lp_build_exp2 order 4-5 polynomial coefficients and bump order.

Not sure how I computed these, but they were wrong (which explains why
bumping the polynomial order before never improved precision).

This allows to pass the EXP test cases of PSPrecision/VSPrecision DCTs.

13 years agogallivm: Increase lp_build_rsqrt() precision.
José Fonseca [Wed, 20 Jul 2011 21:41:17 +0000 (14:41 -0700)]
gallivm: Increase lp_build_rsqrt() precision.

Add an iteration step, which makes rqsqrt precision go from 12bits to
24, and fixes RSQ/NRM test case of PSPrecision/VSPrevision DCTs.

There are no uses of this function outside shader translation.

13 years agogallivm: Update minimax comments.
José Fonseca [Wed, 20 Jul 2011 21:34:46 +0000 (14:34 -0700)]
gallivm: Update minimax comments.

13 years agogallivm: Fix lp_build_exp/lp_build_log.
José Fonseca [Tue, 19 Jul 2011 22:58:09 +0000 (15:58 -0700)]
gallivm: Fix lp_build_exp/lp_build_log.

Never used so far -- we only used the base 2 variants -- which is why
it went unnoticed so far.

13 years agollvmpipe: Unit tests for arithmetic functions.
José Fonseca [Wed, 20 Jul 2011 21:39:23 +0000 (14:39 -0700)]
llvmpipe: Unit tests for arithmetic functions.

Conflicts:

src/gallium/drivers/llvmpipe/SConscript

13 years agoutil: Store alpha value too.
José Fonseca [Tue, 19 Jul 2011 22:58:21 +0000 (15:58 -0700)]
util: Store alpha value too.

13 years agoglsl: Add standalone_scaffolding.cpp to SConscript.
Vinson Lee [Fri, 22 Jul 2011 17:38:05 +0000 (10:38 -0700)]
glsl: Add standalone_scaffolding.cpp to SConscript.

13 years agoglsl: Add unit tests for lower_jumps.cpp
Paul Berry [Tue, 5 Jul 2011 18:52:06 +0000 (11:52 -0700)]
glsl: Add unit tests for lower_jumps.cpp

These tests invoke do_lower_jumps() in isolation (using the glsl_test
executable) and verify that it transforms the IR in the expected way.

The unit tests may be run from the top level directory using "make
check".

For reference, I've also checked in the Python script
create_test_cases.py, which was used to generate these tests.  It is
not necessary to run this script in order to run the tests.

Acked-by: Chad Versace <chad@chad-versace.us>
13 years agoglsl: Create a standalone executable for testing optimization passes.
Paul Berry [Wed, 29 Jun 2011 19:30:04 +0000 (12:30 -0700)]
glsl: Create a standalone executable for testing optimization passes.

This patch adds a new build artifact, glsl_test, which can be used for
testing optimization passes in isolation.

I'm hoping that we will be able to add other useful standalone tests
to this executable in the future.  Accordingly, it is built in a
modular fashion: the main() function uses its first argument to
determine which test function to invoke, removes that argument from
argv[], and then calls that function to interpret the rest of the
command line arguments and perform the test.  Currently the only test
function is "optpass", which tests optimization passes.

13 years agoglsl: Move functions into standalone_scaffolding.cpp for later reuse.
Paul Berry [Thu, 7 Jul 2011 21:01:40 +0000 (14:01 -0700)]
glsl: Move functions into standalone_scaffolding.cpp for later reuse.

This patch moves the following functions from main.cpp (the main cpp
file for the standalone executable that is used to create the built-in
functions) to standalone_scaffolding.cpp, so that they can be re-used
in other standalone executables:

- initialize_context()*
- _mesa_new_shader()
- _mesa_reference_shader()

*initialize_context contained some code that was specific to main.cpp,
so it was split into two functions: initialize_context() (which
remains in main.cpp), and initialize_context_from_defaults() (which is
in standalone_scaffolding.cpp).

13 years agomesa: Add an ifndef guard around the definition of the INLINE macro
Paul Berry [Thu, 7 Jul 2011 20:03:45 +0000 (13:03 -0700)]
mesa: Add an ifndef guard around the definition of the INLINE macro

Several Mesa headers redundantly define the INLINE macro.  Adding this
guard prevents the compiler from complaining about macro redefinition.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agoRevert "g3dvl: Preserve previously rendered components for MC output."
Younes Manton [Thu, 21 Jul 2011 17:53:34 +0000 (13:53 -0400)]
Revert "g3dvl: Preserve previously rendered components for MC output."

This reverts commit b56daf71d2f63d044d4c53ab49c6f87e02991a28.

The bug is actually in softpipe's blend and writemask interaction.

13 years agoconfigure.ac: check for libdrm_radeon only when building classic
Marek Olšák [Thu, 21 Jul 2011 20:31:24 +0000 (22:31 +0200)]
configure.ac: check for libdrm_radeon only when building classic

13 years agoMerge branch 'gallium-polygon-stipple'
Brian Paul [Thu, 21 Jul 2011 16:38:21 +0000 (10:38 -0600)]
Merge branch 'gallium-polygon-stipple'

13 years agosoftpipe: use the polygon stipple utility module
Brian Paul [Thu, 21 Jul 2011 15:55:22 +0000 (09:55 -0600)]
softpipe: use the polygon stipple utility module

This is an alternative to the draw module's polygon stipple stage.
The softpipe implementation here is just a test.  The advantange of
using the new polygon stipple utility module (with other drivers)
is we can avoid software vertex processing in the draw module and
get much better performance.
Polygon stipple doesn't require special vertex processing like
the other draw module stage.

13 years agosoftpipe: implement fragment shader variants
Brian Paul [Thu, 21 Jul 2011 15:55:22 +0000 (09:55 -0600)]
softpipe: implement fragment shader variants

We'll need shader variants to accomodate the new polygon stipple utility.

13 years agoutil: assorted updates to polygon stipple helper
Brian Paul [Thu, 21 Jul 2011 15:55:22 +0000 (09:55 -0600)]
util: assorted updates to polygon stipple helper

13 years agosoftpipe: use tgsi_shader_info fields for fragcoord origin, center, etc.
Brian Paul [Thu, 21 Jul 2011 15:55:22 +0000 (09:55 -0600)]
softpipe: use tgsi_shader_info fields for fragcoord origin, center, etc.

13 years agotgsi: add info fields for fragcoord origin, center, etc
Brian Paul [Thu, 21 Jul 2011 15:55:22 +0000 (09:55 -0600)]
tgsi: add info fields for fragcoord origin, center, etc

13 years agosoftpipe: remove obsolete comment
Brian Paul [Thu, 21 Jul 2011 15:55:22 +0000 (09:55 -0600)]
softpipe: remove obsolete comment

13 years agosoftpipe: rename a function
Brian Paul [Thu, 21 Jul 2011 15:55:22 +0000 (09:55 -0600)]
softpipe: rename a function

13 years agoMerge branch 'remove-copyteximage-hook'
Brian Paul [Thu, 21 Jul 2011 14:46:02 +0000 (08:46 -0600)]
Merge branch 'remove-copyteximage-hook'

13 years agou_vbuf_mgr: restore buffer offsets
Chia-I Wu [Wed, 20 Jul 2011 10:52:33 +0000 (18:52 +0800)]
u_vbuf_mgr: restore buffer offsets

u_vbuf_upload_buffers modifies the buffer offsets.  If they are not
restored, and any of the vertex formats is not supported natively, the
next u_vbuf_mgr_draw_begin call will translate the vertex buffers with
incorrect buffer offsets.

13 years agomesa: GLES2 should return different error enums for invalid fbo queries
Marek Olšák [Tue, 19 Jul 2011 01:05:07 +0000 (03:05 +0200)]
mesa: GLES2 should return different error enums for invalid fbo queries

ES 2.0.25 page 127 says:

  If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is NONE, then
  querying any other pname will generate INVALID_ENUM.

See also:
b9e9df78a03edb35472c2e231aef4747e09db792

NOTE: This is a candidate for the 7.10 and 7.11 branches.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agonouveau: hook up video decoding with nouveau_context
Christoph Bumiller [Thu, 21 Jul 2011 08:39:41 +0000 (10:39 +0200)]
nouveau: hook up video decoding with nouveau_context

This doesn't include nvfx since its context struct is not derived
from common nouveau_context (yet).

13 years agoglsl: Add ir_function_detect_recursion.cpp to SConscript.
Vinson Lee [Thu, 21 Jul 2011 03:16:27 +0000 (20:16 -0700)]
glsl: Add ir_function_detect_recursion.cpp to SConscript.

13 years agoglsl: Reject shaders that contain static recursion
Ian Romanick [Mon, 11 Jul 2011 17:46:01 +0000 (10:46 -0700)]
glsl: Reject shaders that contain static recursion

The GLSL 1.20 and later specs say:

    "Recursion is not allowed, not even statically. Static recursion is
    present if the static function call graph of the program contains
    cycles."

Recursion is detected and rejected both a compile-time and at
link-time.  The complie-time check happens to detect some cases that
may be removed by various optimization passes.  The spec doesn't seem
to allow this, but other vendors (e.g., NVIDIA) appear to only check
at link-time after all optimizations.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33885
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoglsl: Make prototype_string publicly available
Ian Romanick [Fri, 8 Jul 2011 17:34:38 +0000 (10:34 -0700)]
glsl: Make prototype_string publicly available

Also clarify the documentation for one of the parameters.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agog3dvl: remove unused vertex shader inputs
Marek Olšák [Fri, 15 Jul 2011 18:16:20 +0000 (20:16 +0200)]
g3dvl: remove unused vertex shader inputs

See also comments in the code.

13 years agoi965: Apply a homebrew workaround for GPU hang in OGLC api-texcoord.
Eric Anholt [Tue, 19 Jul 2011 22:06:15 +0000 (15:06 -0700)]
i965: Apply a homebrew workaround for GPU hang in OGLC api-texcoord.

The behavior of flushes in the hardware is a maze of twisty passages,
and strangely the VS constants appear to be loaded during a pipeline
flush instead of at the time of the packet emit according to the
simulator.  On moving the STATE_BASE_ADDRESS packet to where it really
needed to live (in order for data loads by other packets to be
correct), we sometimes no longer got a flush between those packets
where we apparently needed it.  This replicates the flushes implied by
a STATE_BASE_ADDRESS update, fixing the GPU hangs in OGLC and the
"engine" demo.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=36821
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=39257
Tested-by: Keith Packard <keithp@keithp.com> (bzflag and etracer fixed)
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965: Enable the PIPE_CONTROL workaround workaround out of paranoia.
Eric Anholt [Tue, 19 Jul 2011 00:17:03 +0000 (17:17 -0700)]
i965: Enable the PIPE_CONTROL workaround workaround out of paranoia.

There's scary stuff going on in PIPE_CONTROL internals, and if the
BSpec says to do this to make PIPE_CONTROL work, I'll go ahead and do
it because we'll probably never be able to debug it after the fact.

v2: Use stall at scoreboard instead of depth stall, as noted by Ken.

13 years agoi965: Avoid kernel BUG_ON if we happen to wait on the pipe_control w/a BO.
Eric Anholt [Mon, 18 Jul 2011 22:25:10 +0000 (15:25 -0700)]
i965: Avoid kernel BUG_ON if we happen to wait on the pipe_control w/a BO.

For this and occlusion queries, we're trying to avoid setting
I915_GEM_DOMAIN_RENDER for the write domain, because the data written
is definitely not going through the render cache, but we do need to
tell the kernel that the object has been written.  However, with using
I915_GEM_DOMAIN_GTT, the kernel on retiring the batchbuffer sees that
the w/a BO has a write domain of GTT, and puts it on the flushing
list.  If something tries to wait for that BO to finish rendering
(such as the AUB dumper reading the contents of BOs), we get into
wait_request (since obj->active) but with a 0 seqno (since the object
is on the flushing list, not actually on a ringbuffer), and BUG_ONs.

To avoid the kernel bug (which I'm hoping to delete soon anyway), just
use I915_GEM_DOMAIN_INSTRUCTION like occlusion queries do.  This
doesn't result in more flushing, because we invalidate INSTRUCTION on
every batchbuffer now that we're state streaming, anyway.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agointel: Use the GLSL-based meta clear when available.
Eric Anholt [Sun, 17 Jul 2011 21:55:10 +0000 (14:55 -0700)]
intel: Use the GLSL-based meta clear when available.

Improves firefox-talos-gfx performance under GL when 3D clears are
enabled:
[  0]       gl-before     firefox-talos-gfx   20.193   20.251   0.27%    3/3
[  0]       gl-after      firefox-talos-gfx   18.013   18.040   0.19%    3/3

13 years agometa: Add a GLSL-based _mesa_meta_Clear() variant.
Eric Anholt [Sun, 17 Jul 2011 21:53:16 +0000 (14:53 -0700)]
meta: Add a GLSL-based _mesa_meta_Clear() variant.

This cuts out a large portion of the overhead of glClear() from
resetting the texenv state and recomputing the fixed function
programs.  It also means less use of fixed function internally in our
GLES2 drivers, which is rather bogus.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agog3dvl: Preserve previously rendered components for MC output.
Younes Manton [Wed, 20 Jul 2011 17:49:56 +0000 (13:49 -0400)]
g3dvl: Preserve previously rendered components for MC output.

Fixes xvmc-softpipe MC entrypoint, amongst others.

13 years agog3dvl: Init/clean pipe fully when a shader-based decoder isn't used.
Younes Manton [Wed, 20 Jul 2011 17:43:24 +0000 (13:43 -0400)]
g3dvl: Init/clean pipe fully when a shader-based decoder isn't used.

Fixes VDPAU CSC-only mode.

13 years agoglsl: Avoid massive ralloc_strndup overhead in S-Expression parsing.
Kenneth Graunke [Fri, 15 Jul 2011 09:27:49 +0000 (02:27 -0700)]
glsl: Avoid massive ralloc_strndup overhead in S-Expression parsing.

When parsing S-Expressions, we need to store nul-terminated strings for
Symbol nodes.  Prior to this patch, we called ralloc_strndup each time
we constructed a new s_symbol.  It turns out that this is obscenely
expensive.

Instead, copy the whole buffer before parsing and overwrite it to
contain \0 bytes at the appropriate locations.  Since atoms are
separated by whitespace, (), or ;, we can safely overwrite the character
after a Symbol.  While much of the buffer may be unused, copying the
whole buffer is simple and guaranteed to provide enough space.

Prior to this, running piglit-run.py -t glsl tests/quick.tests with GLSL
1.30 enabled took just over 10 minutes on my machine.  Now it takes 5.

NOTE: This is a candidate for stable release branches (because it will
      make running comparison tests so much less irritating.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: remove depend files from tarballs
Brian Paul [Wed, 20 Jul 2011 03:11:53 +0000 (21:11 -0600)]
mesa: remove depend files from tarballs

13 years agoglsl: silence warning in linker.cpp
Brian Paul [Wed, 20 Jul 2011 03:10:25 +0000 (21:10 -0600)]
glsl: silence warning in linker.cpp

13 years agost/mesa: get rid of redundant clipping code in st_copy_texsubimage()
Brian Paul [Wed, 20 Jul 2011 02:03:05 +0000 (20:03 -0600)]
st/mesa: get rid of redundant clipping code in st_copy_texsubimage()

13 years agomesa: remove unused dd_function_table::CopyTexImage1D/2D() hooks
Brian Paul [Wed, 20 Jul 2011 02:03:05 +0000 (20:03 -0600)]
mesa: remove unused dd_function_table::CopyTexImage1D/2D() hooks

13 years agometa: remove _mesa_meta_CopyTexImage1D/2D()
Brian Paul [Wed, 20 Jul 2011 02:03:05 +0000 (20:03 -0600)]
meta: remove _mesa_meta_CopyTexImage1D/2D()

13 years agost/mesa: remove st_CopyTexImage1D/2D()
Brian Paul [Wed, 20 Jul 2011 02:03:05 +0000 (20:03 -0600)]
st/mesa: remove st_CopyTexImage1D/2D()

13 years agoradeon: remove radeonCopyTexImage2D()
Brian Paul [Wed, 20 Jul 2011 02:03:05 +0000 (20:03 -0600)]
radeon: remove radeonCopyTexImage2D()

13 years agointel: remove intelCopyTexImage1D/2D()
Brian Paul [Wed, 20 Jul 2011 02:03:05 +0000 (20:03 -0600)]
intel: remove intelCopyTexImage1D/2D()

13 years agomesa: remove comments referring to Driver.TexImage1D/2D
Brian Paul [Wed, 20 Jul 2011 02:03:05 +0000 (20:03 -0600)]
mesa: remove comments referring to Driver.TexImage1D/2D

13 years agomesa: stop using ctx->Driver.CopyTexImage1D/2D() hooks
Brian Paul [Wed, 20 Jul 2011 02:03:05 +0000 (20:03 -0600)]
mesa: stop using ctx->Driver.CopyTexImage1D/2D() hooks

13 years agoMake it possible to use gbm with c++
Jørgen Lind [Tue, 19 Jul 2011 20:52:20 +0000 (22:52 +0200)]
Make it possible to use gbm with c++

NOTE: This is a candiate for 7.11

13 years agost/mesa: fix the texture format in st_context_teximage
Fredrik Höglund [Tue, 19 Jul 2011 21:25:32 +0000 (15:25 -0600)]
st/mesa: fix the texture format in st_context_teximage

Commit 1a339b6c71ebab6e1a64f05b2e133022d3bbcd15 made
st_ChooseTextureFormat map GL_RGBA with type GL_UNSIGNED_BYTE
to PIPE_FORMAT_A8B8G8R8_UNORM.

The image format for ARGB pixmaps is PIPE_FORMAT_B8G8R8A8_UNORM
however. This mismatch caused the texture to be recreated in
st_finalize_texture.

NOTE: This is a candidate for the 7.11 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=39209
Signed-off-by: Fredrik Höglund <fredrik@kde.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agomesa: update, shorten some comments in dd.h
Brian Paul [Tue, 19 Jul 2011 21:24:47 +0000 (15:24 -0600)]
mesa: update, shorten some comments in dd.h

13 years agoglx: Avoid calling __glXInitialize() in driReleaseDrawables().
Henri Verbeet [Sun, 17 Jul 2011 22:42:27 +0000 (00:42 +0200)]
glx: Avoid calling __glXInitialize() in driReleaseDrawables().

This fixes a regression introduced by commit
a26121f37530619610a78a5fbe5ef87e44047fda (fd.o bug #39219).

Since the __glXInitialize() call should be unnecessary anyway, this is
probably a nicer fix for the original problem too.

NOTE: This is a candidate for the 7.10 and 7.11 branches.

Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: padfoot@exemail.com.au
13 years agointel: Fix stencil buffer to be W tiled
Chad Versace [Mon, 18 Jul 2011 07:37:45 +0000 (00:37 -0700)]
intel: Fix stencil buffer to be W tiled

Until now, the stencil buffer was allocated as a Y tiled buffer, because
in several locations the PRM states that it is. However, it is actually
W tiled. From the PRM, 2011 Sandy Bridge, Volume 1, Part 2, Section
4.5.2.1 W-Major Format:
    W-Major Tile Format is used for separate stencil.

The GTT is incapable of W fencing, so we allocate the stencil buffer with
I915_TILING_NONE and decode the tile's layout in software.

This fix touches the following portions of code:
    - In intel_allocate_renderbuffer_storage(), allocate the stencil
      buffer with I915_TILING_NONE.
    - In intel_verify_dri2_has_hiz(), verify that the stencil buffer is
      not tiled.
    - In the stencil buffer's span functions, the tile's layout must be
      decoded in software.

This commit mutually depends on the xf86-video-intel commit
    dri: Do not tile stencil buffer
    Author: Chad Versace <chad@chad-versace.us>
    Date:   Mon Jul 18 00:38:00 2011 -0700

On Gen6 with separate stencil enabled, fixes the following Piglit tests:
    bugs/fdo23670-drawpix_stencil
    general/stencil-drawpixels
    spec/EXT_framebuffer_object/fbo-stencil-GL_STENCIL_INDEX16-copypixels
    spec/EXT_framebuffer_object/fbo-stencil-GL_STENCIL_INDEX16-drawpixels
    spec/EXT_framebuffer_object/fbo-stencil-GL_STENCIL_INDEX16-readpixels
    spec/EXT_framebuffer_object/fbo-stencil-GL_STENCIL_INDEX1-copypixels
    spec/EXT_framebuffer_object/fbo-stencil-GL_STENCIL_INDEX1-drawpixels
    spec/EXT_framebuffer_object/fbo-stencil-GL_STENCIL_INDEX1-readpixels
    spec/EXT_framebuffer_object/fbo-stencil-GL_STENCIL_INDEX4-copypixels
    spec/EXT_framebuffer_object/fbo-stencil-GL_STENCIL_INDEX4-drawpixels
    spec/EXT_framebuffer_object/fbo-stencil-GL_STENCIL_INDEX4-readpixels
    spec/EXT_framebuffer_object/fbo-stencil-GL_STENCIL_INDEX8-copypixels
    spec/EXT_framebuffer_object/fbo-stencil-GL_STENCIL_INDEX8-drawpixels
    spec/EXT_framebuffer_object/fbo-stencil-GL_STENCIL_INDEX8-readpixels
    spec/EXT_packed_depth_stencil/fbo-stencil-GL_DEPTH24_STENCIL8-copypixels
    spec/EXT_packed_depth_stencil/fbo-stencil-GL_DEPTH24_STENCIL8-readpixels
    spec/EXT_packed_depth_stencil/readpixels-24_8

Note: This is a candidate for the 7.11 branch.

Signed-off-by: Chad Versace <chad@chad-versace.us>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965: Fix regression in 29a911c50e4443dfebef0a2e32c39b64992fa3cc.
Eric Anholt [Tue, 19 Jul 2011 19:20:14 +0000 (12:20 -0700)]
i965: Fix regression in 29a911c50e4443dfebef0a2e32c39b64992fa3cc.

The previous define was the full 32-bit header, while the new define
was just the top 16 bits.

13 years agollvmpipe: include LLVM version number in name string
Brian Paul [Tue, 19 Jul 2011 14:42:46 +0000 (08:42 -0600)]
llvmpipe: include LLVM version number in name string

13 years agollvmpipe: fix build with LLVM 3.0svn
Tobias Droste [Sat, 16 Jul 2011 17:40:47 +0000 (19:40 +0200)]
llvmpipe: fix build with LLVM 3.0svn

LLVM 3.0svn introduced a new type system. It defines a new way to create
named structs and removes the (now not needed) LLVMInvalidateStructLayout
function.  See revision 134829 of LLVM.

Signed-off-by: Tobias Droste <tdroste@gmx.de>
Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agoconfigure.ac: Check for the respective libdrm_* when building gallium drivers
Emil Velikov [Thu, 14 Jul 2011 22:07:19 +0000 (23:07 +0100)]
configure.ac: Check for the respective libdrm_* when building gallium drivers

In a rare case of building gallium only, we need to
check if the required packages are available

libdrm_[intel|nouveau] - gallium[i915 i965|nouveau]

v2: r300g and r600g do not need libdrm_radeon

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Marek Olšák <maraeo@gmail.com>
13 years agoxvmc-softpipe: remove LLVM_LIBS
Marek Olšák [Mon, 18 Jul 2011 21:20:53 +0000 (23:20 +0200)]
xvmc-softpipe: remove LLVM_LIBS

this is added conditionally in Makefile.xmvc

Spotted by Chris Rankin.

13 years agoi965: Rename CMD_VF_STATISTICS_(965|GM45) to include "3DSTATE".
Kenneth Graunke [Wed, 13 Jul 2011 09:32:43 +0000 (02:32 -0700)]
i965: Rename CMD_VF_STATISTICS_(965|GM45) to include "3DSTATE".

Including the full "3DSTATE_VF_STATISTICS" should make it easier to
cross-reference the code and documentation.

Also, move the 965/GM45 suffix to the beginning for consistency with
newer #defines.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965: Rename CMD_VERTEX_(BUFFER|ELEMENT) to 3DSTATE_VERTEX_...S.
Kenneth Graunke [Wed, 13 Jul 2011 06:08:01 +0000 (23:08 -0700)]
i965: Rename CMD_VERTEX_(BUFFER|ELEMENT) to 3DSTATE_VERTEX_...S.

This makes our code use the same names as the documentation.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965: Rename 3DSTATE_DRAWRECT_INFO_I965 to 3DSTATE_DRAWING_RECTANGLE.
Kenneth Graunke [Wed, 13 Jul 2011 09:23:30 +0000 (02:23 -0700)]
i965: Rename 3DSTATE_DRAWRECT_INFO_I965 to 3DSTATE_DRAWING_RECTANGLE.

The documentation uses 3DSTATE_DRAWING_RECTANGLE, and we already had it
defined in brw_defines.h; we were simply using an old #define from
intel_reg.h.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi915: Simplify intel_wpos_* with a helper function.
Eric Anholt [Wed, 13 Jul 2011 17:57:58 +0000 (10:57 -0700)]
i915: Simplify intel_wpos_* with a helper function.

13 years agoi915: Include gl_FragCoord.w data, not just xyz.
Eric Anholt [Wed, 13 Jul 2011 17:56:37 +0000 (10:56 -0700)]
i915: Include gl_FragCoord.w data, not just xyz.

Fixes piglit fragcoord_w test.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34323

13 years agoi915: Add support for HW rendering with no color draw buffer.
Eric Anholt [Tue, 12 Jul 2011 17:20:53 +0000 (10:20 -0700)]
i915: Add support for HW rendering with no color draw buffer.

This is useful for shadow map generation.  Tested with glsl-bug-22603,
which rendered the depth textures with fallbacks before.

Acked-by: Chad Versace <chad@chad-versace.us>
13 years agoi915: Fix incorrect depth scaling when enabling/disabling depth buffers.
Eric Anholt [Tue, 12 Jul 2011 20:47:21 +0000 (13:47 -0700)]
i915: Fix incorrect depth scaling when enabling/disabling depth buffers.

We were updating our new viewport using the old buffers' _WindowMap.m.
We can do less math and avoid using that deprecated matrix by just
folding the viewport calculation right in to the driver.

Fixes piglit fbo-depthtex.

13 years agoi915: Make stencil test for no-stencil handling match depth test.
Eric Anholt [Tue, 12 Jul 2011 17:57:51 +0000 (10:57 -0700)]
i915: Make stencil test for no-stencil handling match depth test.

i915_update_draw_buffers() already handles the fallback bit for
missing stencil region, so here we just need to handle whether the GL
thinks we have stencil data or not (and disable the test if so).

13 years agoi915: Disable the depth test whenever we don't have a depth buffer.
Eric Anholt [Tue, 12 Jul 2011 17:48:40 +0000 (10:48 -0700)]
i915: Disable the depth test whenever we don't have a depth buffer.

We were disabling it once at the moment we changed draw buffers, but
later enabling of depth test could turn it back on.  Fixes
fbo-nodepth-test.

Note that ctx->DrawBuffer has to be checked because during context
create we get called while it's still unset.  However, we know we'll
get an intel_draw_buffer() after that, so it's safe to make a silly
choice at this point.

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

13 years agoi915: Remove i965 paths from i915_update_drawbuffer() and i830's too.
Eric Anholt [Tue, 12 Jul 2011 17:03:41 +0000 (10:03 -0700)]
i915: Remove i965 paths from i915_update_drawbuffer() and i830's too.

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agoi965: Remove i915 paths from brw_update_draw_buffers().
Eric Anholt [Tue, 12 Jul 2011 16:52:04 +0000 (09:52 -0700)]
i965: Remove i915 paths from brw_update_draw_buffers().

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agoi965: Remove unused region calculations in brw_update_draw_buffer().
Eric Anholt [Tue, 12 Jul 2011 16:49:23 +0000 (09:49 -0700)]
i965: Remove unused region calculations in brw_update_draw_buffer().

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agoi965: Remove empty brw_set_draw_region.
Eric Anholt [Tue, 12 Jul 2011 16:48:08 +0000 (09:48 -0700)]
i965: Remove empty brw_set_draw_region.

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agoi965: Remove FALLBACK() from brw_update_draw_region().
Eric Anholt [Tue, 12 Jul 2011 16:47:38 +0000 (09:47 -0700)]
i965: Remove FALLBACK() from brw_update_draw_region().

The 965 driver doesn't use these for deciding on fallbacks.

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agointel: Move intel_draw_buffers() code into each driver.
Eric Anholt [Tue, 12 Jul 2011 16:43:22 +0000 (09:43 -0700)]
intel: Move intel_draw_buffers() code into each driver.

The illusion of shared code here wasn't fooling anybody.  It was
tempting to keep i830 and i915 still shared, but I think I actually
want to make them diverge shortly.

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agointel: Clarify the depthRb == stencilRb logic.
Eric Anholt [Tue, 12 Jul 2011 17:01:32 +0000 (10:01 -0700)]
intel: Clarify the depthRb == stencilRb logic.

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agointel: Use the post-execution batchbuffer contents for dumping.
Eric Anholt [Tue, 12 Jul 2011 19:19:21 +0000 (12:19 -0700)]
intel: Use the post-execution batchbuffer contents for dumping.

We were missing out on all the relocation changes by dumping what we
subdata()ed in instead of what's there after the kernel finished with
it.

13 years agoglsl: Ensure that sampler declarations are always uniform or "in" parameters.
Paul Berry [Tue, 12 Jul 2011 19:03:02 +0000 (12:03 -0700)]
glsl: Ensure that sampler declarations are always uniform or "in" parameters.

This brings us into compliance with page 17 (page 22 of the PDF) of
the GLSL 1.20 spec:

    "[Sampler types] can only be declared as function parameters or
    uniform variables (see Section 4.3.5 "Uniform"). ... [Samplers]
    cannot be used as out or inout function parameters."

The spec isn't explicit about whether this rule applies to
structs/arrays containing shaders, but the intent seems to be to
ensure that it can always be determined at compile time which sampler
is being used in each texture lookup.  So to avoid creating a
loophole, the rule needs to apply to structs/arrays containing shaders
as well.

Fixes piglit tests spec/glsl-1.10/compiler/samplers/*.frag, and fixes
bug 38987.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38987
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl: Move type_contains_sampler() into glsl_type for later reuse.
Paul Berry [Mon, 11 Jul 2011 23:44:13 +0000 (16:44 -0700)]
glsl: Move type_contains_sampler() into glsl_type for later reuse.

The new location, as a member function of glsl_type, is more
consistent with queries like is_sampler(), is_boolean(), is_float(),
etc.  Placing the function inside glsl_type also makes it available to
any code that uses glsl_types.