Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: skeggsb/Mesa
base: master
head fork: skeggsb/Mesa
compare: newlib
Checking mergeability… Don’t worry, you can still create the pull request.
This comparison is big! We’re only showing the most recent 250 commits
Commits on Mar 12, 2012
Christopher Yeleighton docs: fix up html tags in autoconf.html

Signed-off-by: Brian Paul <>
Brian Paul radeon: remove use of DD_FLATSHADE
This got missed earlier <sigh>.
Brian Paul mesa: fix _mesa_DebugMessageCallbackARB() to silence warnings
Reviewed-by: José Fonseca <>
@aphogat aphogat mesa: Fix the cause of piglit test fbo-array failure
Handle the special case of glFramebufferTextureLayer() for which we pass
teximage = 0 internally in framebuffer_texture(). This patch makes failing
piglit test fbo-array, fbo-depth-array to pass.

V4: Removed the duplicated code.
Note: This is a candidate for the stable branches.

Signed-off-by: Anuj Phogat <>
Reviewed-by: Brian Paul <>
Commits on Mar 13, 2012
@nobled nobled mesa: add back glGetnUniform*v() overflow error reporting
The error was removed in:

commit 7199096
Author: Ian Romanick <>
Date:   Tue Oct 18 16:01:49 2011 -0700

    mesa: Rewrite the way uniforms are tracked and handled

The GL_ARB_robustness spec doesn't say the implementation
should truncate the output, so just return after setting
the required error like it did before the above commit.

Also fixup an old comment and add an assert.

NOTE: This is a candidate for the 8.0 branch.
@anholt anholt glsl: Avoid extra if statements for logic and/or with no side effects.
This avoids extra if statements in the common case of just comparing
two expressions that don't involve assignments or function calls,
along with simplifying the handling of constant expressions.  Reduces
i965 instructions generated in unigine tropics and sanctuary,
yofrankie, warsow, gstreamer shaders, and the weston compositor.

shader-db results:
Total instructions: 213052 -> 212752
38/1246 programs affected (3.0%)
14309 -> 14009 instructions in affected programs (2.1% reduction)
Commits on Mar 14, 2012
Christopher Yeleighton docs: fix html in banner.html

Signed-off-by: Brian Paul <>
Tom Stellard gallium/drivers: Use automake to generate makefile fe3f98e
Tom Stellard galahad: Use non-recursive automake 26ab747
Tom Stellard identity: Use non-recursive automake 3f3f10f
Tom Stellard noop: Use non-recursive automake dc382e5
@vinsonlee vinsonlee gallivm: Fix createOProfileJITEventListener namespace with llvm-3.1.
llvm-3.1svn r152620 refactored the OProfile profiling code.
createOProfileJITEventListener was moved from the llvm namespace to the
llvm::JITEventListener namespace.

Signed-off-by: Vinson Lee <>
Reviewed-by: Brian Paul <>
@kaydenl kaydenl i965: Enable SIMD16 mode for shaders with loops on Gen6+.
The hardware supports it; there's no reason not to.

Signed-off-by: Kenneth Graunke <>
Commits on Mar 15, 2012
@anholt anholt glsl: Add support for parsing #version 140.
Reviewed-by: Kenneth Graunke <>
@anholt anholt glsl: Hook up the current GLSL 1.30 types and builtins for 1.40.
This gets a basic #version 140 shader compiling.

Reviewed-by: Kenneth Graunke <>
@anholt anholt glsl: Update builtin variables for GLSL 1.40.
Mostly this is a matter of removing variables that have been moved to
the compatibility profile.  There's one addition: gl_InstanceID is
present in the core now.

This fixes the new piglit tests for GLSL 1.40 builtin variables.

Reviewed-by: Kenneth Graunke <>
@anholt anholt glsl: Let the builtin compiler process GLSL 1.40 shaders.
This is required to put the new 1.40 builtins in place, since they
require new types.

Reviewed-by: Kenneth Graunke <>
@anholt anholt glsl: When failing to compile some builtins, print the error.
This makes the process slightly more debuggable, though it would be
nice if the build just failed immediately instead.

Reviewed-by: Kenneth Graunke <>
@anholt anholt glsl: Copy GLSL 1.30 builtin profile to GLSL 1.40.
All that's changed is the #version changing to 140.

Reviewed-by: Kenneth Graunke <>
@anholt anholt glsl: Drop ftransform() from GLSL 1.40 profile.
This is the one builtin function claimed to be dropped due to the
ARB_compatibility split.

Fixes piglit spec/GLSL-1.40/compiler/ftransform.vert

Reviewed-by: Kenneth Graunke <>
@anholt anholt glsl: Add support for integer sampler2DRect variants in GLSL 1.40.
Reviewed-by: Kenneth Graunke <>
@anholt anholt glsl: Set up generated builtin functions handling for GLSL 1.40.
Otherwise, when we go to use ir_reader on the generated code, we won't
have the types present.

Reviewed-by: Kenneth Graunke <>
@anholt anholt glsl: Add GLSL 1.40 textureSize() implementations for sampler2DRect.
By setting lod to 0 in the builtin function implementation, we avoid
needing to update all the visitors to ignore LOD in this case, when
the hardware drivers actually want to ask for LOD 0 for rectangular

Fixes piglit spec/GLSL-1.40/textureSize-*Rect.

v2: Change style of looking for substrings.

Reviewed-by: Kenneth Graunke <>
Commits on Mar 16, 2012
@anholt anholt i965: Add disasm for gen6+ UIP/JIP on BREAK/CONT/HALT.
Reviewed-by: Kenneth Graunke <>
@anholt anholt i965/fs: Jump from discard statements to the end of the program when …

From the GLSL 1.30 spec:

     The discard keyword is only allowed within fragment shaders. It
     can be used within a fragment shader to abandon the operation on
     the current fragment. This keyword causes the fragment to be
     discarded and no updates to any buffers will occur. Control flow
     exits the shader, and subsequent implicit or explicit derivatives
     are undefined when this control flow is non-uniform (meaning
     different fragments within the primitive take different control

v2: Don't emit the final HALT if no other HALTs were emitted.

Reviewed-by: Kenneth Graunke <> (v1)
Commits on Mar 17, 2012
@jeremyhu jeremyhu darwin: config file cleanups
Set our default compiler based on what our installed XCode prefers

Signed-off-by: Jeremy Huddleston <>
@jeremyhu jeremyhu darwin: Build create_context.c
Fixes a build regression from: 588042a

Signed-off-by: Jeremy Huddleston <>
@jeremyhu jeremyhu darwin: Link against libxcb
Signed-off-by: Jeremy Huddleston <>
Brian Paul dri_util: add copyright/license blurb aec47e7
@alexhultman alexhultman docs: add info for installing dependencies on fedora
Signed-off-by: Brian Paul <>
Brian Paul st/mesa: add null pointer check in st_texture_image_map()
If we failed to allocate a memory resource for the texture we'd crash
when we tried to map it.  Now we propogate the NULL back up to the
texstore code and generate GL_OUT_OF_MEMORY.

Fixes a crash with the upcoming piglit max-texture-size test.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <>
Commits on Mar 19, 2012
@marekolsak marekolsak r600g: fix point rendering
Accidentally broken in c7eaf27.
Yuanhan Liu i915: fallback for NPOT cubemap texture
Although some hardware support NPOT cubemap, but it seems we don't know
the right layout for NPOT cubemap. Thus seems we need do fallback for
other platforms as well.

See comments inline the code for more detailed info.

v2: give a more detailed info about why we need fallback for other
    platfroms as well.


NOTE: This is a candidate for stable release branches.

Signed-off-by: Yuanhan Liu <>
Alex Deucher r600g: fix r600_get_backend_mask() for virtual addresses
I don't think we should hit this path for virtual addresses,
but just in case.

Signed-off-by: Alex Deucher <>
@krh krh shared-glapi: Convert to automake
This fixes a build problem where EGL links to, which encodes
a relative path to it's dependency.  The relative path
breaks when the linker tries to resolve it from src/egl/main instead
of src/gbm.  Typically we silently fall back to the system, which is wrong and breaks when there isn't one.

Morale of the story: don't mix mklib and libtool.
Commits on Mar 20, 2012
@anholt anholt mesa: Fold error generation into _mesa_valid_prim_mode().
We want to start emitting an INVALID_OPERATION from here for transform
feedback.  Note that this forced dlist.c to almost not use this
function, since it wants different behavior during dlist compile.
Just pull the non-TF, non-GS test out for compile, because:

1) TF doesn't matter in that case because there's no drawing.
2) I don't think we're going to see GSes and display lists in the same
   context, if we don't do GL_ARB_compatibility.

Reviewed-by: Brian Paul <>
@anholt anholt mesa: Validate the drawing primitive against the transform feedback m…

Fixes piglit GL_EXT_transform_feedback/negative-prims.

Reviewed-by: Brian Paul <>
@anholt anholt glsl: Don't include the deprecated structure types in GLSL 1.40.
Reviewed-by: Kenneth Graunke <>
Brian Paul mesa: make _mesa_reference_sampler_object() an inline function
To make the no-change case faster, as we do for the other object-reference

Reviewed-by: José Fonseca <>
Reviewed-by: Eric Anholt <>
Brian Paul mesa: use MAX3() macro for 3D texture in _mesa_test_texobj_completene…

Reviewed-by: Kenneth Graunke <>
Reviewed-by: José Fonseca <>
Reviewed-by: Eric Anholt <>
Brian Paul mesa: use switch(target) in _mesa_test_texobj_completeness()
and add missing case for GL_TEXTURE_BUFFER.

Reviewed-by: José Fonseca <>
Reviewed-by: Eric Anholt <>
Brian Paul mesa: move some code in _mesa_test_texobj_completeness()
Move the simple MaxLevel < BaseLevel test earlier to be closer to where
we error-check BaseLevel.  Also, use the local baseLevel var in more places.

Reviewed-by: José Fonseca <>
Reviewed-by: Eric Anholt <>
Brian Paul mesa: better debug message in _mesa_test_texobj_completeness()
Reviewed-by: José Fonseca <>
Reviewed-by: Eric Anholt <>
Brian Paul mesa: add comments in _mesa_test_texobj_completeness() related to the…
… spec

Reviewed-by: José Fonseca <>
Reviewed-by: Eric Anholt <>
Brian Paul mesa: use new baseImage var to simplify _mesa_test_texobj_completeness()
Reviewed-by: José Fonseca <>
Reviewed-by: Eric Anholt <>
Brian Paul mesa: rewrite/consolidate code in _mesa_test_texobj_completeness()
Merge the mipmap level checking code that was separate cases for 1D,
2D, 3D and CUBE before.

Reviewed-by: José Fonseca <>
Reviewed-by: Eric Anholt <>
Brian Paul mesa: use _mesa_dirty_texobj() function
To mark the texture object as incomplete.

Reviewed-by: José Fonseca <>
Reviewed-by: Eric Anholt <>
Brian Paul mesa: use _mesa_dirty_texobj() in glTexParameter code
Reviewed-by: José Fonseca <>
Reviewed-by: Eric Anholt <>
Brian Paul mesa: add _mesa_is_mipmap_filter() helper
Reviewed-by: José Fonseca <>
Reviewed-by: Eric Anholt <>
Brian Paul mesa: rework texture completeness testing
Instead of gl_texture_object::_Complete there are now two fields:
_BaseComplete and _MipmapComplete.  The former indicates whether the base
texture level is valid.  The later indicates whether the whole mipmap is

With sampler objects, a single texture can appear to be both complete and
incomplete at the same time.  See the GL_ARB_sampler_objects spec for more
details.  To implement this we now check if the texture is complete with
respect to a sampler state.

Another benefit of this is we no longer need to invalidate a texture's
completeness state when we change the minification/magnification filters
with glTexParameter().

Reviewed-by: José Fonseca <>
Reviewed-by: Eric Anholt <>
Brian Paul mesa: add integer texture completeness check
Per the spec, only nearest filtering is supported for integer textures.
Otherwise, the texture is incomplete.

Reviewed-by: José Fonseca <>
Reviewed-by: Eric Anholt <>
Brian Paul softpipe: set max cube texture size to 4Kx4K
The max size was 16Kx16K so a 4 byte/pixel, six-sided cube would require
6 GBytes of memory.  If mipmapped, 8 GB.  Reduce the max size to 4K to
make the total size more reasonable.

Fixes a crash with the new piglit max-texture-size test.

Reviewed-by: Yuanhan Liu <>
Brian Paul mesa: only test cube face widths in _mesa_test_texobj_completeness()
As Eric pointed out, we know the cube faces are square at this point
so we only need to test the texture widths for consistency.

Reviewed-by: Kenneth Graunke <>
@stereotype441 stereotype441 Add .deps/, .libs/, and *.la to toplevel .gitignore
To avoid redundancies, this patch also removes .deps, .libs, and *.la
from .gitignore files in subdirectories.

Reviewed-by: Kenneth Graunke <>
@kaydenl kaydenl Add to toplevel .gitignore
To avoid redundancies, this patch also removes from the
other .gitignore files.

Acked-by: Eric Anholt <>
@kaydenl kaydenl Add Makefile to shared-glapi .gitignore 2097af9
@aphogat aphogat intel: Fix a case when mapping large texture fails
This patch handles a case when mapping a large texture fails
in drm_intel_gem_bo_map_gtt(). These changes avoid assertion
failure later in the driver as reported in following bugs:

Testing: No regressions in piglit quick.tests

Signed-off-by: Anuj Phogat <>
@anholt anholt intel: Drop the INTEL_STRICT_CONFORMANCE environment variable.
If you want to test the graphics driver, you want to test it under the
conditions that users will see, not some set of additional fallbacks.
If you want to test swrast, run the swrast driver (or no_rast=true)

Reviewed-by: Kenneth Graunke <>
@anholt anholt intel: Drop the INTEL_NO_BLIT debug environment variable.
This was added in the i915/i965 merge from the i915 driver, but I
don't recall it ever being used since then.

Reviewed-by: Kenneth Graunke <>
@anholt anholt i965: Drop the INTEL_FORCE_GS environment variable.
This was a debug option during gen6 transform feedback bringup (and a
similar one existed during gen4 bringup).  However, it looks like
we're done with that, and we don't anticipate it being used again,
either for geometry shaders or transform feedback.

Suggested by: Kenneth Graunke <>
@anholt anholt i965: Change the hiz-override env var to a driconf option.
The force-enable option is dropped, now that the hardware we were
concerned about has HiZ on by default.  Now, instead of doing
INTEL_HIZ=0 to test disabling hiz, you can set hiz=false.

v2: Disable separate stencil on gen6 when HIZ is turned off.
    (previously, this had to be done manually in addition).

Reviewed-by: Kenneth Graunke <> (v1)
Alex Deucher r600g: add support for TN (trinity) APUs
Note: this is a candidate for the stable branches.

Signed-off-by: Alex Deucher <>
Commits on Mar 21, 2012
@anholt anholt drirc: Add missing XML attributes that made the driconf application w…

These are used for pretty presentation of the application name in the

Tested-by: Kenneth Graunke <>
@jon-turney jon-turney mapi: Use -no-undefined libtool flag in src/mapi/shared-glapi/Makefil…

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 <>
@anholt anholt glsl: Don't require gl_Position to be written in GLSL 1.40.
Fixes piglit glsl-1.40/execution/tf-no-position.

Reviewed-by: Ian Romanick <>
Reviewed-by: Kenneth Graunke <>
Jakob Bornecrantz mesa: Include mesa ES mapi generated files
Signed-off-by: Jakob Bornecrantz <>
(cherry picked from commit 770f785a6f30e5295ababe44a8e9449ee0be640a)
Jakob Bornecrantz docs: Add 8.0.2 release notes
Signed-off-by: Jakob Bornecrantz <>
(cherry picked from commit 5f7204c3bbc070fce2f3351419a64362fe15a8c6)
Jakob Bornecrantz docs: Add 8.0.2 md5sums
Signed-off-by: Jakob Bornecrantz <>
(cherry picked from commit 0bf0ba44de0cde5e041c188b409513866b7f5ab2)
@anholt anholt intel: Bump libdrm requirement to 2.4.32.
We'll need this for AUB dumping and unsynchronized maps.

Reviewed-by: Kenneth Graunke <>
@anholt anholt intel: Ask libdrm to dump an AUB file if INTEL_DEBUG=aub.
It also asks for BMPs in the aub file at SwapBuffers time.

Reviewed-by: Yuanhan Liu <>
Reviewed-by: Kenneth Graunke <>
@anholt anholt intel: Handle devid overrides using libdrm.
Reviewed-by: Yuanhan Liu <>
Reviewed-by: Kenneth Graunke <>
@anholt anholt i965: Avoid flushing the batch for busy BOs for ARB_mbr with INVALIDA…

Unigine Tropics uses INVALIDATE_BUFFER and not UNSYNCHRONIZED to reset
the buffer object when its streaming wraps.  Don't penalize it by
flushing the batch at the wrap point, just allocate a new BO and get
to using it.

Reviewed-by: Kenneth Graunke <>
@anholt anholt intel: Drop the tracking of bo_map vs bo_map_gtt for unmapping.
drm_intel_bo_unmap() supports both in the current libdrm version.

Reviewed-by: Kenneth Graunke <>
@anholt anholt intel: Make use of the new GPU-unsynchronized map functionality in li…

Improves Unigine Tropics performance at 1024x768 by 2.06236% +/-
0.50272% (n=11).

Reviewed-by: Chris Wilson <>
Reviewed-by: Kenneth Graunke <>
Brian Paul glsl: propagate MaxUnrollIterations to the optimizer's loop unroller
Instead of the hard-coded value of 32.  Note that MaxUnrollIterations
defaults to 32 so there's no net change.  But the gallium state tracker
can override this.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Kenneth Graunke <>
Brian Paul st/mesa: set MaxUnrollIterations = 255
The default was 32 for the EmitNoLoops=0 case.  This allows the oZone3D
soft shadows test to work properly with the vmware driver.  Jose reported
that SM3 supports up to 255 loop iterations.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <>
@anholt anholt glx: Fix glXGetProcAddress() of global glX symbols post-automake conv…

When a GL LD_PRELOAD library like apitrace was used,
glXGetProcAddress() would return the preload's symbols instead of
libGL's symbol, leading to infinite recursion when the returned
function was called.  This didn't hit apitrace on most apps because
who calls glXGetProcAddress() on the global functions.

The -Bsymbolic, which was present in mklib before automake conversion,
causes the glxcmds.c:GLX_functions table to be resolved at link time,
so that LD_PRELOADs don't affect it any more.

Fixes crashes when running wine under apitrace.

Tested-by: Matt Turner <>
Tested-by: Marek Olšák <>
Commits on Mar 22, 2012
Christian König st/vdpau: add VC-1 startcode if none is found in the stream
v2: only advanced profile needs that.

Signed-off-by: Christian König <>
Christian König st/vdpau: improve frame dumping functionality a bit
Just a workaround until we get a real unit-
testing tool for VDPAU.

Signed-off-by: Christian König <>
Christopher Yeleighton docs: fix html in bugs.html
Signed-off-by: Brian Paul <>
@nobled nobled intel: fix null dereference processing HiZ buffer
Or technically, a near-null dereference.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Chad Versace <>
Commits on Mar 23, 2012
Brian Paul mesa: set numFaces=6 for cube maps in _mesa_test_texobj_completeness()
Reviewed-by: José Fonseca <>
Brian Paul st/mesa: fix mipmap image size computation w.r.t. texture arrays
The image height or depth is the array_size for array textures.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Jakob Bornecrantz <>
Commits on Mar 24, 2012
@vinsonlee vinsonlee mesa: Fix memory leak in _mesa_get_uniform_location.
Fixes Coverity resource leak defect.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Vinson Lee <>
Reviewed-by: José Fonseca <>
Reviewed-by: Kenneth Graunke <>
Dave Airlie glx/drisw: avoid segfaults when we fail to get visual
piglit glx-tfp segfaults on llvmpipe when run vs a 16-bit radeon screen,

it now fails instead of segfaulting, much prettier.

Signed-off-by: Dave Airlie <>
Dave Airlie docs/GL3.txt: document ARB_blend_func_extended state
I've written softpipe version in my tree, + gallium/mesa/glsl changes,
however r600 currently hangs the GPU.
Commits on Mar 25, 2012
Dave Airlie makefile: add phony am--refresh target
for some reason when I configure --with-dri-drivers="" the src/mesa/drivers/dri
Makefile tries to call the am--refresh target in the toplevel Makefile,
we don't have one, and I'm not sure what it should look like.

This makes things continue on.

Signed-off-by: Dave Airlie <>
Dave Airlie glsl: initialise const force glsl extension warning in fake ctx
valgrind complained about an uninitialised value being used in
glsl_parser_extras.cpp, and this was the one it was giving out about.

Just initialise the value in the fakectx.

Signed-off-by: Dave Airlie <>
Dave Airlie glsl: fix compiling warning from gcc 4.7
ir_validate.cpp: In member function ‘virtual ir_visitor_status ir_validate::visit_leave(ir_swizzle*)’:
ir_validate.cpp:458:66: warning: narrowing conversion of ‘ir->ir_swizzle::mask.ir_swizzle_mask::x’ from ‘unsigned int’ to ‘int’ inside { } is ill-formed in C++11 [-Wnarrowing]
ir_validate.cpp:458:66: warning: narrowing conversion of ‘ir->ir_swizzle::mask.ir_swizzle_mask::y’ from ‘unsigned int’ to ‘int’ inside { } is ill-formed in C++11 [-Wnarrowing]
ir_validate.cpp:458:66: warning: narrowing conversion of ‘ir->ir_swizzle::mask.ir_swizzle_mask::z’ from ‘unsigned int’ to ‘int’ inside { } is ill-formed in C++11 [-Wnarrowing]
ir_validate.cpp:458:66: warning: narrowing conversion of ‘ir->ir_swizzle::mask.ir_swizzle_mask::w’ from ‘unsigned int’ to ‘int’ inside { } is ill-formed in C++11 [-Wnarrowing]

Signed-off-by: Dave Airlie <>
Reviewed-by: Brian Paul <>
@airlied airlied drisw: fix image stride calculation for 16-bit.
If you ran g-s in 16-bpp we'd do a bunch of memory corruption.

now it just misrenders for some other reasons.

applies to stable.

Signed-off-by: Dave Airlie <>
Reviewed-by: Brian Paul <>
@airlied airlied intel: fix TFP at 16-bpp
don't ask why I had to debug this.

tested to fix g-s and kwin at 16-bpp on Ironlake.

Signed-off-by: Dave Airlie <>
Commits on Mar 26, 2012
Christian König st/vdpau: invert interlaced buffer checks
That wasn't working as supposed.

Signed-off-by: Christian König <>
Christian König st/vdpau: clear video surface at least once
So if anything goes wrong we won't display a random image.

v2: flush before using the surface with the decoder.

Signed-off-by: Christian König <>
@kaydenl kaydenl glsl: Comment that expression flattening is used for matrix operations.
Signed-off-by: Kenneth Graunke <>
Reviewed-by: Eric Anholt <>
@kaydenl kaydenl glsl: Make ir_dereference_array constructor assert the variable exists.
Providing a NULL pointer to the ir_dereference_array() constructor seems
like a bad idea.  Currently, if provided NULL, it returns a partially
constructed value of error type.  However, none of the callers are
prepared to handle that scenario.

Code inspection shows that all callers do one of the following:
- Already NULL-check the argument prior to creating the dereference
- Already deference the argument (and thus would crash if it were NULL)
- Newly allocate the argument.

Thus, it should be safe to simply assert the value passed is not NULL.
This should also catch issues right away, rather than dying later.

Signed-off-by: Kenneth Graunke <>
Reviewed-by: Eric Anholt <>
@kaydenl kaydenl glsl: Make ir_dereference_record constructor assert the variable exists.
Providing a NULL pointer to the ir_dereference_record() constructor
seems like a bad idea.  Currently, if provided NULL, it returns a
partially constructed value of error type.  However, none of the callers
are prepared to handle that scenario.

Code inspection shows that all callers do one of the following:
- Already NULL-check the argument prior to creating the dereference
- Already deference the argument (and thus would crash if it were NULL)
- Newly allocate the argument.

Thus, it should be safe to simply assert the value passed is not NULL.
This should also catch issues right away, rather than dying later.

Signed-off-by: Kenneth Graunke <>
Reviewed-by: Eric Anholt <>
@kaydenl kaydenl glsl: Explicitly NULL-check variables before making a dereference.
The constructor currently returns a ir_dereference_variable of error
type when provided NULL, but that's about to change in the next commit.

Signed-off-by: Kenneth Graunke <>
Reviewed-by: Eric Anholt <>
@kaydenl kaydenl glsl: Make ir_dereference_variable ctor assert the variable exists.
This also seems like a bad idea.  There were too many instances for me
to thoroughly scan the code as I did with the last two patches, but a
quick scan indicated that most callers newly allocate a variable,
dereference it, or NULL-check.  In some cases, it wasn't clear that the
value would be non-NULL, but they didn't check for error_type either.

At any rate, not checking for this is a bug, and assertions will trigger
it earlier and more reliably than returning error_type.

Signed-off-by: Kenneth Graunke <>
Reviewed-by: Eric Anholt <>
Dave Airlie glapi: ARB_blend_func_extended support + regen. (v2)
This adds the xml file covering ARB_blend_func_extended.

v2: fix SRC1_ALPHA

Reviewed-by: Kenneth Graunke <>
Reviewed-by: Eric Anholt <>
Signed-off-by: Dave Airlie <>
Dave Airlie glsl: fix linker error message context for frag shader output.
A later error prints this properly, fix this case to do the same.

v2: remove attribute as per Ian's suggestion
Signed-off-by: Dave Airlie <>
Reviewed-by: Ian Romanick <>
@vinsonlee vinsonlee mesa: Fix memory leak in generate_mipmap_compressed.
Fixes Coverity resource leak defect.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Vinson Lee <>
Reviewed-by: José Fonseca <>
Reviewed-by: Kenneth Graunke <>
@nobled nobled glapi: sort ARB extensions by number
And add comments to fill in for extensions that aren't there.

Noticed the comment about "ARB extensions sorted by extension number"
didn't extend to the <xi:include> directives when it became clear
GL_ARB_texture_rg was missing, going by the error message seen here:

This makes it easier to notice in the future if an extension is missing
when it shouldn't be.

Reviewed-by: Brian Paul <>
@nobled nobled regen for "glapi: sort ARB extensions by number" a419595
@nobled nobled glapi: add ARB_texture_rg
Noticed it was missing based on the lack of a descriptive enum
name from this bug's error message:

This moves two enums out of GL3x.xml. Though since this and
GL_ARB_texture_compression_rgtc are both strict subsets of GL3,
both extensions should have had all their enums in that file
to begin with, not just two of them.

Reviewed-by: Brian Paul <>
@nobled nobled glapi: add GL_ARB_texture_compression_rgtc
Noticed this was missing when writing the "glapi: sort ARB extensions
by number" commit, which at least shows it was effective.

Reviewed-by: Brian Paul <>
@nobled nobled glapi: add GL_ARB_depth_buffer_float
Reviewed-by: Kenneth Graunke <>
@nobled nobled glapi: add GL_ARB_texture_float
And add some missing core GL 3.0 enums that came from this
extension, too.

Reviewed-by: Kenneth Graunke <>
@nobled nobled glapi: regenerate enums.c
For previous four commits:

    glapi: add GL_ARB_texture_float
    glapi: add GL_ARB_depth_buffer_float
    glapi: add GL_ARB_texture_compression_rgtc
    glapi: add ARB_texture_rg
Commits on Mar 27, 2012
@benf benf gles1: Enable GL_EXT_texture_format_BGRA8888 in APIspec
The extension is already exposed for GLES1, but the APIspec
doesnt allow the usage of GL_BGRA_EXT in glTex(Sub)Image2D.

Reviewed-by: Kenneth Graunke <>
@benf benf gles: Enable the GL_EXT_read_format_bgra extension
which may be set to a BGRA format e.g. for a MESA_FORMAT_ARGB8888 fb.

Reviewed-by: Kenneth Graunke <>
@bpeel bpeel 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.
@krh krh wayland: Stop using wl_buffer.damage 03eca9d
@anderco anderco egl_dri2: make flush extension useable by drm platform 410aa3e
@ojab ojab gallivm: Use InitializeNativeTargetDisassembler().
To initialize only native LLVM Disassembler on LLVM >= 3.1.

Signed-off-by: José Fonseca <>
@benf benf st/egl: Also remove wl_buffer_damage in wayland backend
As commit 03eca9d does for egl_dri2.
@marekolsak marekolsak r600g: enable transform feedback on everything that isn't r700
Use R700_STREAMOUT=1 if you wanna hack transform feedback on r700.
Commits on Mar 28, 2012
@marekolsak marekolsak r600g: also disable transform feedback on cayman
It's said to cause troubles there.
The env var is R600_STREAMOUT again.
@udknight udknight 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 <>
Reviewed-by: Yuanhan Liu <>
Yuanhan Liu 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:

Cc: Anuj Phogat <>
Signed-off-by: Yuanhan Liu <>
Reviewed-by: Anuj Phogat <>
@jon-turney jon-turney Use -no-undefined libtool flag in src/glx/
"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 <>
Christian König 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 <>
Brian Paul 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.
Commits on Mar 29, 2012
@anderco anderco 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().
@anderco anderco 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.
@anderco anderco egl_dri2: use gbm_surface as the native window type in drm platform 4a976b6
@vinsonlee vinsonlee gallivm: Fix method overriding in raw_debug_ostream.
Use matching type qualifers to avoid method hiding.

Signed-off-by: Vinson Lee <>
Reviewed-by: José Fonseca <>
@krh krh shared-glapi: Include from builddir 2402ce0
Commits on Mar 30, 2012
Tom Stellard 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.
@marekolsak marekolsak 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 <>
@marekolsak marekolsak gallium: adapt to get_query_result interface change
Reviewed-by: Brian Paul <>
@marekolsak marekolsak gallium/util: add helper function util_query_clear_result 452d077
@marekolsak marekolsak r300g: cleanup after get_query_result change 6d73382
@marekolsak marekolsak r600g: cleanup after get_query_result change
Finally, union r600_query_result can be removed.
@marekolsak marekolsak gallium/postprocess: document serious issue causing undefined behavior 99a192c
@kaydenl kaydenl 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 <>
@kaydenl kaydenl 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 <>
Reviewed-by: Eric Anholt <>
@kaydenl kaydenl 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 <>
Reviewed-by: Eric Anholt <>
@kaydenl kaydenl 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 <>
Reviewed-by: Eric Anholt <>
@kaydenl kaydenl 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 <>
Reviewed-by: Eric Anholt <>
@kaydenl kaydenl i965: Set "Stencil Buffer Enable" bit on Haswell.
Signed-off-by: Kenneth Graunke <>
Reviewed-by: Eric Anholt <>
@kaydenl kaydenl 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 <>
Reviewed-by: Eric Anholt <>
@kaydenl kaydenl 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

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 <>
Reviewed-by: Eric Anholt <>
@kaydenl kaydenl intel: Add some PCI IDs for Haswell.
Signed-off-by: Kenneth Graunke <>
Reviewed-by: Eugeni Dodonov <>
Reviewed-by: Eric Anholt <>
Commits on Mar 31, 2012
@vinsonlee vinsonlee 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 <>
Reviewed-by: Kenneth Graunke <>
Commits on Apr 01, 2012
Eugeni Dodonov intel: add PCI IDs for Ivy Bridge GT2 server variant
Those IDs are used by Bromolow.

Reviewed-by: Kenneth Graunke <>
Signed-off-by: Eugeni Dodonov <>
@mslusarz mslusarz targets/{xvmc,vdpau,va}: remove all objects on make clean 68e4c83
@marekolsak marekolsak r600g: optimize r600_resource_va
Avoid calling get_radeon_bo and inline it.
@marekolsak marekolsak r600g: determine in advance if hw has vertex cache bc95152
@marekolsak marekolsak r600g: unduplicate code for PS partial flush 42bc0b9
Commits on Apr 02, 2012
@kaydenl kaydenl 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 <>
Reviewed-by: Eric Anholt <>
@kaydenl kaydenl 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 <>
Reviewed-by: Ian Romanick <>
@kaydenl kaydenl 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 <>
Reviewed-by: Eric Anholt <>
Reviewed-by: Ian Romanick <>
@kaydenl kaydenl 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 <>
Reviewed-by: Ian Romanick <>
@kaydenl kaydenl 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

Signed-off-by: Kenneth Graunke <>
Reviewed-by: Eric Anholt <>
Reviewed-by: Ian Romanick <>
@kaydenl kaydenl 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 <>
Reviewed-by: Eric Anholt <>
Reviewed-by: Ian Romanick <>
@kaydenl kaydenl 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 <>
Reviewed-by: Eric Anholt <>
Reviewed-by: Ian Romanick <>
@kaydenl kaydenl 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 <>
Reviewed-by: Eric Anholt <>
Reviewed-by: Ian Romanick <>
@kaydenl kaydenl 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 <>
Reviewed-by: Eric Anholt <>
Reviewed-by: Ian Romanick <>
@kaydenl kaydenl 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 <>
Reviewed-by: Eric Anholt <>
Reviewed-by: Ian Romanick <>
Commits on Apr 03, 2012
@vinsonlee vinsonlee 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 <>
Reviewed-by: Brian Paul <>
@jrfonseca jrfonseca gallivm: Simplify/reorder minimax helper. d312b22
James Benton 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

Signed-off-by: José Fonseca <>
@marekolsak marekolsak r600g: remove dead code in r600_update_derived_state 7f2156c
Christian König st/vdpau: fix deadlock in PresentationQueueQuerySurfaceStatus
Signed-off-by: Christian König <>
@vinsonlee vinsonlee 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 <>
Reviewed-by: Brian Paul <>
@marekolsak marekolsak u_blitter: don't use user buffers 900be21
@benf benf st/egl: Update to the new wl_shm_pool interface 9ba3cec
Commits on Apr 04, 2012
@marekolsak marekolsak r300g/swtcl: don't print an error when getting ClipVertex
Draw can do it just fine.
@marekolsak marekolsak r300g/swtcl: don't enter u_vbuf_mgr da21230
@marekolsak marekolsak r300g: initialize state & render functions before creating u_vbuf & u…
@marekolsak marekolsak r300g/swtcl: don't expose shader subroutine support
RET in the main function doesn't work. This should be fixed in Draw, but meh.
@marekolsak marekolsak r300g/swtcl: fix polygon offset c3481f3
@marekolsak marekolsak r300g/swtcl: initialize some Draw options ba86e03
@marekolsak marekolsak r300g/swtcl: fix crash when back color is present in vertex shader
The shader transformation code sometimes produced invalid TGSI.
@Oxalin Oxalin st/xvmc: fix library installation dir

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

Signed-off-by: Christian König <>
@marekolsak marekolsak 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 <>
@marekolsak marekolsak 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 <>
@marekolsak marekolsak r600g: rework state emission of constant buffers
Framerate in ipers:
  before: 43.6 FPS
  after:  46.6 FPS

Reviewed-by: Alex Deucher <>
@marekolsak marekolsak r600g: remove dead code after the rework
Reviewed-by: Alex Deucher <>
@marekolsak marekolsak r600g: invalidate caches at the beginning of CS
Reviewed-by: Alex Deucher <>
@marekolsak marekolsak r600g: handle DISCARD_WHOLE_RESOURCE for buffers
This should prevent stalls and therefore increase perfomance in some cases.

Reviewed-by: Alex Deucher <>
@marekolsak marekolsak r600g: inline r600_upload_const_buffer e9abb2c
@marekolsak marekolsak r600g: inline r600_upload_index_buffer 34e53ad
Commits on Apr 05, 2012
@Oxalin Oxalin xatracker: fix the build of a 32bit lib on a 64bit os
we were missing cflags.

Signed-off-by: Zack Rusin <>
James Benton gallivm: Updated lp_build_polynomial to compute odd and even terms se…
…parately to decrease data dependency for faster runtime.

Signed-off-by: José Fonseca <>
James Benton 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 <>
Commits on Apr 06, 2012
@kaydenl kaydenl 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 <>
Reviewed-by: Ian Romanick <>
Brian Paul gallium/docs: fix typos 0cd6800
Brian Paul 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.

Brian Paul 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 <>
Brian Paul 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 <>
Brian Paul 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.


v2: incorporate Marek's suggestions.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Marek Olšák <>
Commits on Apr 07, 2012
@jobermayr jobermayr 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:

Reviewed-by: Brian Paul <>
@jobermayr jobermayr 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.
Commits on Apr 09, 2012
Yuanhan Liu 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 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

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

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 <>
@kaydenl kaydenl 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 <>
Reviewed-by: Eric Anholt <>
@kaydenl kaydenl 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

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 <>
Reviewed-by: Eric Anholt <>
@kaydenl kaydenl 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 <>
Reviewed-by: Eric Anholt <>
@anholt anholt ff_fragment_shader: Remove some dead fields.
Reviewed-by: Brian Paul <>
@kaydenl kaydenl 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 <>
Reviewed-by: Ian Romanick <>
@anholt anholt 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 <>
Reviewed-by: Kenneth Graunke <>
@anholt anholt 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 <>
Reviewed-by: Kenneth Graunke <>
@anholt anholt glapi: regen for TBO change. 62bdb18
@anholt anholt mesa: Set up glTexBuffer{,ARB} for display list compile.
We're supposed to just immediately call it.  Fixes piglit

Reviewed-by: Brian Paul <>
Reviewed-by: Kenneth Graunke <>
@anholt anholt mesa: Set the correct initial value of the texture buffer object format.
Fixes piglit GL_ARB_texture_buffer_object/get

Reviewed-by: Brian Paul <>
Reviewed-by: Kenneth Graunke <>
@anholt anholt 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 <>
@anholt anholt 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 <>
@anholt anholt 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 <>
@anholt anholt mesa: Handle updating texture state for buffer textures.
We have to skip some work that wants to look at texture images, since
buffer textures don't have any of that complexity.

Reviewed-by: Dave Airlie <>
Reviewed-by: Brian Paul <>
Reviewed-by: Kenneth Graunke <>
@anholt anholt mesa: Track a gl_format for the texture buffer format.
There was a function full of unused mappings from the GLenum to
datatype/comps, but that wasn't all the information a driver would
want, which includes the other fields that a gl_format has.  Given
that all the texture buffer formats were represented in gl_format,
just use that as our description.

Reviewed-by: Brian Paul <>
Reviewed-by: Kenneth Graunke <>
@anholt anholt mesa: Add support for the GL 3.1 R/RG formats in texture buffer objects.
Reviewed-by: Brian Paul <>
Reviewed-by: Kenneth Graunke <>
@anholt anholt i965/gen7: Fix the /* ignored */ comment on constant surface setup.
It turns out this field *is* used, and it's the stride between samples
from the buffer.  Discovered during TBO debugging.

Reviewed-by: Kenneth Graunke <>
@anholt anholt i965: Add real support for texturing/rendering with MESA_FORMAT_RGBA8…

This was hacked in in one place for EGL image stuff, but the right
thing to do was just to provide the mapping from the mesa format to
the native hardware format, which includes render target support.

This turns out to be required for GL_ARB_texture_buffer_object, which
sees data in this layout.

Reviewed-by: Kenneth Graunke <>
@anholt anholt i965: Add support for sampling texture buffer objects on gen7+.
Reviewed-by: Kenneth Graunke <>
@VadimGirlin VadimGirlin glsl: fix variable ordering in the output_read_remover
Use the hash of the variable name instead of the pointer value.

Signed-off-by: Vadim Girlin <>
Reviewed-by: Ian Romanick <>
@VadimGirlin VadimGirlin r600g: check gpr count limit
This should help to prevent gpu lockups.

NOTE: This is a candidate for the stable branches.

Signed-off-by: Vadim Girlin <>
Reviewed-by: Alex Deucher <>
Commits on Apr 10, 2012
@chadversary chadversary main: Fix memory leak in _mesa_make_extension_string()
I forgot to free the string returned by strdup().

Note: This is a candidate for the stable branches.
CC: Johannes Obermayr <>
Reviewed-by: Ian Romanick <>
Signed-off-by: Chad Versace <>
@vinsonlee vinsonlee st/mesa: Fix uninitialized members in glsl_to_tgsi_visitor constructor.
Fixes uninitialized member defects reported by Coverity.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Vinson Lee <>
Reviewed-by: Brian Paul <>
@ppaalanen ppaalanen wayland-drm: remove wl_buffer.damage
This is a related fix for the Wayland change:

commit 83685c506e76212ae4e5cb722205d98d3b0603b9
Author: Kristian Høgsberg <>
Date:   Mon Mar 26 16:33:24 2012 -0400

    Remove wl_buffer.damage and simplify shm implementation

Apparently, this should also fix a memory leak. When wl_buffer.damage
was removed from Wayland and Mesa was not fixed, wl_buffer.destroy ended
up in the (empty) damage function instead of calling

Spotted during build as:
  CC     wayland-drm-protocol.lo
wayland-drm.c:80:2: warning: initialization from incompatible pointer type
wayland-drm.c:82:1: warning: excess elements in struct initializer
wayland-drm.c:82:1: warning: (near initialization for 'drm_buffer_interface')

Signed-off-by: Pekka Paalanen <>
@stereotype441 stereotype441 i965: Stop lying about cpp and height of a stencil buffer.
When using a separate stencil buffer, i965 requires that the pitch of
the buffer (in the 3DSTATE_STENCIL_BUFFER command) be specified as 2x
the actual pitch.

Previously this was accomplished by doubling the "cpp" and "pitch"
values stored in the intel_region data structure, and halving the
height.  However, this was confusing, and it led to a subtle (but
benign) bug: since a stencil buffer is W-tiled, its true height must
be aligned to a multiple of 64; we were accidentally aligning its faux
height to a multiple of 64, causing memory to be wasted.

Note that for window system stencil buffers, the DDX also doubles the
cpp and pitch values.  To facilitate fixing this DDX server bug in the
future, we fix the cpp and pitch values we receive from the X server
only if cpp has the "incorrect" value of 2.

Acked-by: Kenneth Graunke <>
Reviewed-by: Chad Versace <>

v2: Clarify comments about the DDX.
Mandeep Singh Baines egl_dri2: fix aux buffer leak in drm platform
Keep a reference to any newly allocated aux buffers to avoid
re-allocating for every st_framebuffer_validate() (i.e. leaking).

Signed-off-by: Mandeep Singh Baines <>
Signed-off-by: Kristian Høgsberg <>
Commits on Apr 11, 2012
@chadversary chadversary mapi: Fix Android build
The Android build was broken by
    commit ca76018
    Author: Kristian Høgsberg <>
    Date:   Fri Mar 16 12:55:40 2012 -0400

    shared-glapi: Convert to automake

The offending change was that it redefined the filepaths in sources.mak
like this:
    - FOO_FILES := bar.c
    + FOO_FILES := $(TOP)/src/mapi/mapi/bar.c
This broke the build because source filepaths in Android makefiles must be
relative to the makefile.

Ideally, this could be fixed by reverting the change in sources.mak and
making shared-glapi's use $(addprefix $(TOP)/src/mapi/mapi,
$(FOO_FILES)). However, automake doesn't understand builtin GNU make
functions, such as addprefix. So, it seems that automake and Android can
no longer share sources.mak.

Fix the build by duplicating the source lists from sources.mak into

Signed-off-by: Chad Versace <>
Brian Paul mesa: new _mesa_total_buffer_object_memory() debug function
This function can be called in gdb to find out how much memory is used
by buffer objects.
Brian Paul mesa: add _mesa_total_texture_memory() debug function
This function can be called in gdb to find out how much memory is used
by all texture objects.
Brian Paul docs: document yet another viewperf bug 0fd4165
Commits on Apr 12, 2012
@anholt anholt glsl: Don't apply optimization passes to builtins.
The builtins we have are generally optimized, having been
hand-written.  This avoids generating bad code when an optimization
pass prints debug output.
@anholt anholt glsl: Add an array splitting pass.
I've had this code laying around almost done for a long time.  The
idea is like opt_structure_splitting, that we've got a bunch of
transforms at the GLSL IR level that only understand scalars and
vectors, which just skip complicated dereferences.  While driver
backends may manage some optimization after they split matrices up
themselves, it would be better to bring all of our optimization to
bear on the problem.

While I wasn't expecting changes quite yet, a few programs end up
winning: a gstreamer convolution shader, and the Humus dynamic
branching demo:
Total instructions: 269430 -> 269342
3/2148 programs affected (0.1%)
1498 -> 1410 instructions in affected programs (5.9% reduction)
@anholt anholt glsl: Extend the array splitting optimization pass to matrices.
This should fit in well with our lower_mat_op_to_vec code: now, in
addition to having expressions on each column of a matrix, we also
split the columns to separate variables so they can be tracked
individually by the copy propagation, dead code, and other passes.

This optimizes out some more code generation in unigine and gstreamer

Total instructions: 269342 -> 269270
14/2148 programs affected (0.7%)
2226 -> 2154 instructions in affected programs (3.2% reduction)
@anholt anholt i965/fs: Try to avoid generating extra MOVs to do saturates.
This change (before the previous two) produced a .23% +/- .11%
performance improvement in Unigine Tropics at 1024x768 on IVB.

Total instructions: 269270 -> 262649
614/2148 programs affected (28.6%)
179386 -> 172765 instructions in affected programs (3.7% reduction)

v2: Move some of the logic of finding the instruction that produced
    the result of an expression tree to a helper.
@anholt anholt i965/fs: Avoid generating extra AND instructions on bool logic ops.
By making a bool fs_reg only have a defined low bit (matching CMP
output), instead of being a full 0 or 1 value, we reduce the ANDs
generated in logic chains like:

   if (v_texcoord.x < 0.0 || v_texcoord.x > texwidth ||
       v_texcoord.y < 0.0 || v_texcoord.y > 1.0)

My concern originally when writing this code was that we would end up
generating unnecessary ANDs on bool uniforms, so I put the ANDs right
at the point of doing the CMPs that otherwise set only the low bit.
However, in order to use a bool, we're generating some instruction
anyway (e.g. moving it so as to produce a condition code update), and
those instructions can often be turned into an AND at that point.  It
turns out in the shaders I have on hand, none of them regress in
instruction count:

Total instructions: 262649 -> 262545
39/2148 programs affected (1.8%)
14253 -> 14149 instructions in affected programs (0.7% reduction)
@anholt anholt intel: Drop backwards compat code for not having libdrm with the LLC …
@anholt anholt i965: When the kernel lacks the LLC check, assume it's present on gen…
… >= 6.

The param wasn't added until drm-intel-next for 3.4, so we were
missing our various LLC fast-paths.
@marekolsak marekolsak cso: unreference saved vertex buffers when restoring
Reviewed-by: Brian Paul <>
Commits on Apr 13, 2012
@anholt anholt gtest: Import sources from gtest 1.6.0.
The upstream of gtest has decided that the intended usage model is for
projects to import the source and use it, which is reflected in their
recent removal of the gtest-config tool.

Reviewed-by: Ian Romanick <>
Reviewed-by: Chad Versace <>
@anholt anholt gtest: Build as a convenience library.
Reviewed-by: Ian Romanick <>
Ian Romanick gtest: Fix up import of gtest 1.6.0
The include files were all missing.

Signed-off-by: Ian Romanick <>
Reviewed-by: Chad Versace <>
Acked-by: Eric Anholt <>
@anholt anholt glx: Hook up the unit tests again using the internal gtest.
Reviewed-by: Ian Romanick <>
Ian Romanick tests/glx: Point at the imported copy of gtest
This is just in case there's one installed on the system.

Signed-off-by: Ian Romanick <>
Reviewed-by: Chad Versace <>
Acked-by: Eric Anholt <>
Stéphane Marchesin Revert "i915g: Remove unused poly stipple state."
This reverts commit be6a022.
Stéphane Marchesin Revert "i915g: Implement stipple with draw."
This reverts commit 3cff45f.
@bpeel bpeel wayland-drm: Implement wl_buffer.damage in old versions of Wayland
Commit 272bc48 removed the damage implementation for the
wl_buffer_interface because that has been removed from git master of
Wayland. However this breaks building with the 0.85 branch of Wayland
because it would end up initialising the struct incorrectly.

For the time being it's quite convenient for some compositors to track
the 0.85 branch of Wayland because the protocol is stable but they
will also want to track the master branch of Mesa so that they can use
the gbm surface changes.

This patch adds a compile-time check for the version of Wayland so
that it can work with either Wayland master or the 0.85 branch.

krh: Edited to also account for API changes in 6802eaa68, which
removes the timestamp argument from wl_resource_destroy().
@vinsonlee vinsonlee ir_to_mesa: Fix uninitialized member in add_uniform_to_shader.
Fix uninitialized scalar field defect reported by Coverity.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Vinson Lee <>
Reviewed-by: Brian Paul <>
Ben Skeggs nouveau/vieux: switch to libdrm_nouveau-2.0 7e99c2b
Ben Skeggs nouveau: rework and simplify nv04/nv05 driver a bit
TEXTURED_TRIANGLE and MULTITEX_TRIANGLE are both a bit special in that if
you use any other graph object in the meantime they'll forget their state
and spew a lovely METHOD_CNT error at you when you try to draw.

The pre-newlib driver has a flush_notify() hook which does this state
re-emit, and a number of random workarounds like extra flushes and state
dirtying after various operations to solve this issue.

I'm taking a slightly different approach to things instead, which has the
nice side-effect of removing the divergent code-paths for ttri/mtri, the
flush/dirty workarounds and the need for flush_notify.  Also gives a few
FPS boost in OA, yay.
Ben Skeggs nvfx: completely remove this driver (GeForce FX/6/7)
This driver hasn't been maintained properly for a very long time, and for
many very good reasons.  It's horrible.

A new driver supporting these chipsets will appear with the commits that
port vieux/nv50/nvc0 to libdrm_nouveau-2.0.

Signed-off-by: Ben Skeggs <>
Christoph Bumiller nouveau: remove automatic buffer migration heuristics 72e6d87
Christoph Bumiller nvc0: remove obsolete nvc0_push2.c
Slower version of nvc0_push.c, was only used to ascertain that
bugs were not the new version's fault.
Christoph Bumiller nouveau: switch to libdrm_nouveau-2.0 9ccdab4
Ben Skeggs nv30: import new driver for GeForce FX/6/7 chipsets, and Quadro variants
The primary motivation for this rewrite was to have a maintainable driver
going forward, as nvfx was quite horrible in a lot of ways.

The driver is heavily based on the design of the nv50/nvc0 3d drivers we
already have, and uses the same common buffer/fence code.  It also passes
a HEAP more piglit tests than nvfx did, supports a couple more features,
and a few more to come still probably.

The CPU footprint of this driver is far far less than nvfx, and translates
into far greater framerates in a lot of applications (unless you're using
a CPU that's way way newer than the GPUs of these generations....)

Basically, we once again have a maintained driver for these chipsets \o/

Feel free to report bugs now!