mesa.git
12 years agomesa: glGet: fix API check for EGL_image_external enums
Imre Deak [Mon, 10 Sep 2012 06:41:40 +0000 (09:41 +0300)]
mesa: glGet: fix API check for EGL_image_external enums

These enums are valid only in ES1 and ES2. So far they were marked valid
incorrectly, depending on the previous API mask in the enum list.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agomesa: glGet: fix indentation of print_table_stats
Imre Deak [Mon, 10 Sep 2012 06:41:39 +0000 (09:41 +0300)]
mesa: glGet: fix indentation of print_table_stats

No functional change.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agomesa: glGet: fix indentation of find_value
Imre Deak [Mon, 10 Sep 2012 06:41:38 +0000 (09:41 +0300)]
mesa: glGet: fix indentation of find_value

No functional change.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agomesa: glGet: fix indentation of _mesa_init_get_hash
Imre Deak [Mon, 10 Sep 2012 06:41:37 +0000 (09:41 +0300)]
mesa: glGet: fix indentation of _mesa_init_get_hash

No functional change.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agomesa: fix proxy texture error handling in glTexStorage()
Brian Paul [Sat, 8 Sep 2012 15:33:13 +0000 (09:33 -0600)]
mesa: fix proxy texture error handling in glTexStorage()

This is basically a follow-on to 1f5b1f98468d5e80be39e619ed15c422fbede8d3.
Basically, generate GL errors for ordinary invalid parameters for proxy
targets the same as for non-proxy targets.  Only texture size and OOM
errors should be handled specially for proxies.

Note: This is a candidate for the stable branches.

12 years agomesa: make _mesa_get_proxy_target() non-static
Brian Paul [Sat, 8 Sep 2012 15:46:14 +0000 (09:46 -0600)]
mesa: make _mesa_get_proxy_target() non-static

Needed for the next patch.

Note: This is a candidate for the stable branches.

12 years agomesa: do internal format error checking for glTexStorage()
Brian Paul [Sat, 8 Sep 2012 15:27:46 +0000 (09:27 -0600)]
mesa: do internal format error checking for glTexStorage()

Turns out we weren't doing any format checking before.  Now check
the internal format and, in particular, make sure that unsized internal
formats aren't accepted.

Note: This is a candidate for the stable branches.

12 years agomesa/msaa: Allow X and Y flips in multisampled blits.
Paul Berry [Wed, 5 Sep 2012 23:07:16 +0000 (16:07 -0700)]
mesa/msaa: Allow X and Y flips in multisampled blits.

From the GL 4.3 spec, section 18.3.1 "Blitting Pixel Rectangles":

    If SAMPLE_BUFFERS for either the read framebuffer or draw
    framebuffer is greater than zero, no copy is performed and an
    INVALID_OPERATION error is generated if the dimensions of the
    source and destination rectangles provided to BlitFramebuffer are
    not identical, or if the formats of the read and draw framebuffers
    are not identical.

It is not clear from the spec whether "dimensions" should mean both
sign and magnitude, or just magnitude.

Previously, Mesa interpreted "dimensions" as meaning both sign and
magnitude, so any multisampled blit that attempted to flip the image
in the X and/or Y direction would fail.

However, Y flips are likely to be commonplace in OpenGL applications
that have been ported from DirectX applications, as a result of the
fact that DirectX and OpenGL differ in their orientation of the Y
axis.  Furthermore, at least one commercial driver (nVidia) permits Y
filps, and L4D2 relies on them being permitted.  So it seems prudent
for Mesa to permit them.

This patch changes Mesa to allow both X and Y flips, since there is no
language in the spec to indicate that X and Y flips should be treated
differently.

NOTE: This is a candidate for stable release branches.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
12 years agoradeon/llvm: Fix operand order of V_CNDMASK in custom inserter
Tom Stellard [Wed, 5 Sep 2012 18:36:21 +0000 (14:36 -0400)]
radeon/llvm: Fix operand order of V_CNDMASK in custom inserter

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agoradeon/llvm: Assert if we try to encode an unknown register
Tom Stellard [Wed, 5 Sep 2012 18:35:47 +0000 (14:35 -0400)]
radeon/llvm: Assert if we try to encode an unknown register

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agoradeon/llvm: Add register encoding for VCC
Tom Stellard [Wed, 5 Sep 2012 18:35:21 +0000 (14:35 -0400)]
radeon/llvm: Add register encoding for VCC

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agoradeon/llvm: Ignore special registers when calculating reg count
Tom Stellard [Wed, 5 Sep 2012 18:34:03 +0000 (14:34 -0400)]
radeon/llvm: Ignore special registers when calculating reg count

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agoradeonsi: Handle position input parameter for pixel shaders v2
Tom Stellard [Thu, 6 Sep 2012 20:18:11 +0000 (16:18 -0400)]
radeonsi: Handle position input parameter for pixel shaders v2

v2:
  - Don't increment ninterp or set any of the have_* flags for
    TGSI_SEMANTIC_POSITION

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agoradeon/llvm: Coding style fixes
Tom Stellard [Thu, 6 Sep 2012 19:56:02 +0000 (15:56 -0400)]
radeon/llvm: Coding style fixes

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agoradeonsi: Move interpolation mode check into the compiler
Tom Stellard [Thu, 6 Sep 2012 19:41:59 +0000 (15:41 -0400)]
radeonsi: Move interpolation mode check into the compiler

The compiler needs to know which interpolation modes are enabled, so
it knows which values will be preloaded into the VGPRs.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agoradeonsi: Add missing interpolation mode to check for enabled modes
Tom Stellard [Fri, 7 Sep 2012 12:29:13 +0000 (08:29 -0400)]
radeonsi: Add missing interpolation mode to check for enabled modes

At least one interpolation mode must be enable, but the code that checks
this was not checking for perspective center.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agoradeonsi: Pass shader type to the compiler
Tom Stellard [Fri, 7 Sep 2012 13:12:51 +0000 (09:12 -0400)]
radeonsi: Pass shader type to the compiler

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agoradeon/llvm: Add SHADER_TYPE instruction
Tom Stellard [Fri, 7 Sep 2012 13:11:59 +0000 (09:11 -0400)]
radeon/llvm: Add SHADER_TYPE instruction

This allows the program to specify the type of shader being compiled
(e.g. PXEL, VERTEX, etc.)

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agor600g: avoid GPU doing constant preload from random address
Jerome Glisse [Fri, 7 Sep 2012 19:00:20 +0000 (15:00 -0400)]
r600g: avoid GPU doing constant preload from random address

Previous command stream might have set any of the constant buffer
and the previous address might no longer be valid thus GPU might
preload constant from random invalid address and possibly triggering
lockup.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
12 years agoradeonsi: Texture border colour fixes.
Michel Dänzer [Fri, 7 Sep 2012 14:09:08 +0000 (16:09 +0200)]
radeonsi: Texture border colour fixes.

* Handle arbitrary border colours.
* Use correct packing format for detecting special border colours.

Fixes piglit tex-border-1 and probably many other tests using border colours.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agoradeonsi: Handle NULL sampler states.
Michel Dänzer [Fri, 7 Sep 2012 15:26:15 +0000 (17:26 +0200)]
radeonsi: Handle NULL sampler states.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agoi965: Remove incorrect comment above opt_algebraic.
Kenneth Graunke [Tue, 11 Sep 2012 05:56:03 +0000 (22:56 -0700)]
i965: Remove incorrect comment above opt_algebraic.

The comment was cut-and-pasted from propagate_constants(), and had no
relation at all to opt_algebraic().

12 years agoglsl: Generate compile errors for explicit blend indices < 0 or > 1.
Kenneth Graunke [Fri, 31 Aug 2012 23:04:19 +0000 (16:04 -0700)]
glsl: Generate compile errors for explicit blend indices < 0 or > 1.

According to the GLSL 4.30 specification, this is a compile time error.
Earlier specifications don't specify a behavior, but since 0 and 1 are
the only valid indices for dual source blending, it makes sense to
generate the error.

Fixes (the fixed version of) piglit's layout-12.frag.

NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agor600g: remove unused function
Marek Olšák [Mon, 10 Sep 2012 21:58:18 +0000 (23:58 +0200)]
r600g: remove unused function

12 years agor600g: fix printf warning
Marek Olšák [Sun, 9 Sep 2012 23:28:40 +0000 (01:28 +0200)]
r600g: fix printf warning

12 years agomesa: bump version to 9.1 (devel)
Andreas Boll [Fri, 7 Sep 2012 21:49:01 +0000 (23:49 +0200)]
mesa: bump version to 9.1 (devel)

Now that branch 9.0 is created, bump the minor version in
master.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoSet OSMESA_VERSION=8.
Johannes Obermayr [Sat, 1 Sep 2012 23:35:47 +0000 (01:35 +0200)]
Set OSMESA_VERSION=8.

VERSION_NUMBER is not required anymore. So it will be removed.

Reviewed-by: Adam Jackson <ajax@redhat.com>
12 years agonvc0/ir: add initial code to support GK110 ISA encoding
Christoph Bumiller [Sat, 1 Sep 2012 15:26:24 +0000 (17:26 +0200)]
nvc0/ir: add initial code to support GK110 ISA encoding

12 years agoradeonsi: Float format fixups.
Michel Dänzer [Fri, 7 Sep 2012 15:41:21 +0000 (17:41 +0200)]
radeonsi: Float format fixups.

Fixes piglit spec/ARB_texture_float/fbo-generatemipmap-formats.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agoradeonsi: Handle more SNORM formats.
Michel Dänzer [Fri, 7 Sep 2012 14:35:48 +0000 (16:35 +0200)]
radeonsi: Handle more SNORM formats.

Fixes piglit spec/EXT_texture_snorm/fbo-generatemipmap-formats (except for
what seems like a random fluke).

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agoi965: Fix virtual_grf_interferes() between calculate_live_intervals() and DCE.
Eric Anholt [Thu, 6 Sep 2012 05:10:41 +0000 (22:10 -0700)]
i965: Fix virtual_grf_interferes() between calculate_live_intervals() and DCE.

This fixes the blue zombies bug in l4d2.

NOTE: This is a candidate for the 9.0 branch.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Make the param pointer arrays for the VS dynamically sized.
Eric Anholt [Mon, 27 Aug 2012 16:24:56 +0000 (09:24 -0700)]
i965: Make the param pointer arrays for the VS dynamically sized.

Saves 96MB of wasted memory in the l4d2 demo.

v2: Rebase on compare func change, change brace style.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965: Make the param pointer arrays for the WM dynamically sized.
Eric Anholt [Mon, 27 Aug 2012 04:19:05 +0000 (21:19 -0700)]
i965: Make the param pointer arrays for the WM dynamically sized.

Saves 26.5MB of wasted memory allocation in the l4d2 demo.

v2: Rebase on compare func change, fix comments.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Add functions for comparing two brw_wm/vs_prog_data structs.
Eric Anholt [Mon, 27 Aug 2012 04:19:05 +0000 (21:19 -0700)]
i965: Add functions for comparing two brw_wm/vs_prog_data structs.

Currently, this just avoids comparing all unused parts of param[] and
pull_param[], but it's a step toward getting rid of those giant statically
sized arrays.

v2: Actually use the new function instead of just looking at its
    address.  This required changing the args to const pointers.
    (review by Kenneth)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoglsl: Count builtin uniforms against uniform component limits.
Eric Anholt [Mon, 27 Aug 2012 16:48:34 +0000 (09:48 -0700)]
glsl: Count builtin uniforms against uniform component limits.

We don't fully process the builtin uniforms, but at least
num_uniform_components reflects reality now.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoradeonsi: Handle TGSI_SEMANTIC_FOG.
Michel Dänzer [Thu, 6 Sep 2012 15:53:04 +0000 (17:53 +0200)]
radeonsi: Handle TGSI_SEMANTIC_FOG.

Fixes exponential fog. The pixel shaders for linear fog seem to get
miscompiled still somehow.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
12 years agoradeon/llvm: Match fexp2 for SI.
Michel Dänzer [Tue, 21 Aug 2012 10:51:18 +0000 (12:51 +0200)]
radeon/llvm: Match fexp2 for SI.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
12 years agoglapi/glx: rename 'table' variable to 'disp_table'
Brian Paul [Thu, 6 Sep 2012 14:16:56 +0000 (08:16 -0600)]
glapi/glx: rename 'table' variable to 'disp_table'

This fixes an issue where the local 'table' variable was hiding the
function parameter name in glGetColorTable(..., void *table).

This should be OK as long as there's never a GL entrypoint that uses
'disp_table' as a parameter name.

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
12 years agoglx: move 'prime' var into #ifdef'd code block
Brian Paul [Thu, 6 Sep 2012 14:16:08 +0000 (08:16 -0600)]
glx: move 'prime' var into #ifdef'd code block

To silence unused var warning.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
12 years agoi965: Fix primitive restart on Haswell.
Kenneth Graunke [Sat, 25 Aug 2012 01:40:40 +0000 (18:40 -0700)]
i965: Fix primitive restart on Haswell.

Haswell moved the "Cut Index Enable" bit from the INDEX_BUFFER packet to
a new 3DSTATE_VF packet, so we need to emit that.  Also, it requires us
to specify the cut index rather than assuming it's 0xffffffff.

This adds a new Haswell-specific tracked state atom to gen7_atoms.
Normally, we would create a new generation-specific atom list, but since
there's only one difference over Ivybridge so far, I chose to simply
make it return without doing any work on non-Haswell systems.

Fixes five piglit tests:
- general/primitive-restart-DISABLE_VBO
- general/primitive-restart-VBO_COMBINED_VERTEX_AND_INDEX
- general/primitive-restart-VBO_INDEX_ONLY
- general/primitive-restart-VBO_SEPARATE_VERTEX_AND_INDEX
- general/primitive-restart-VBO_VERTEX_ONLY

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agobuild: Disable building of d3d1x
Matt Turner [Thu, 6 Sep 2012 23:17:21 +0000 (16:17 -0700)]
build: Disable building of d3d1x

It's broken and unmaintained, and I'm tired of seeing bug reports about
it.

12 years agointel: avoid undefined variable warnings in intel_screen.c
Paul Berry [Fri, 31 Aug 2012 00:22:29 +0000 (17:22 -0700)]
intel: avoid undefined variable warnings in intel_screen.c

Reviewed-by: Matt Turner <mattst88@gmail.com>
12 years agor600g: order atom emission v3
Jerome Glisse [Wed, 5 Sep 2012 19:18:24 +0000 (15:18 -0400)]
r600g: order atom emission v3

To avoid GPU lockup registers must be emited in a specific order
(no kidding ...). This patch rework atom emission so order in which
atom are emited in respect to each other is always the same. We
don't have any informations on what is the correct order so order
will need to be infered from fglrx command stream.

v2: add comment warning that atom order should not be taken lightly
v3: rebase on top of alphatest atom fix

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
12 years agor600g: fix num of dwords needed for alphatest_state atom
Jerome Glisse [Thu, 6 Sep 2012 19:09:21 +0000 (15:09 -0400)]
r600g: fix num of dwords needed for alphatest_state atom

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
12 years agomesa: Don't advertise GLES extensions in GL contexts
Chad Versace [Tue, 4 Sep 2012 17:02:43 +0000 (10:02 -0700)]
mesa: Don't advertise GLES extensions in GL contexts

glGetStringi(GL_EXTENSIONS) failed to respect the context's API, and so
returned all internally enabled GLES extensions from a GL context.
Likewise, glGetIntegerv(GL_NUM_EXTENSIONS) also failed to repsect the
context's API.

Note: This is a candidate for the 8.0 and 9.0 branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
12 years agollvmpipe: Make driver name more informative.
José Fonseca [Thu, 6 Sep 2012 09:29:04 +0000 (10:29 +0100)]
llvmpipe: Make driver name more informative.

Such as

  "llvmpipe (LLVM 3.1, 128 bits)"

or

  "llvmpipe (LLVM 3.1, 256 bits)"

when leveraging AVX 8-wide registers.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
12 years agoradeonsi: Handle more L/I/A format cases.
Michel Dänzer [Wed, 5 Sep 2012 16:24:14 +0000 (18:24 +0200)]
radeonsi: Handle more L/I/A format cases.

Fixes piglit fbo-generatemipmap-formats.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agoradeonsi: Enable whole quad mode for pixel shaders.
Michel Dänzer [Fri, 31 Aug 2012 17:04:08 +0000 (19:04 +0200)]
radeonsi: Enable whole quad mode for pixel shaders.

Fixes wrong mipmap level being sampled at some triangle edges.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
12 years agoradeon/llvm: Add intrinsic for enabling whole quad mode in SI pixel shaders.
Michel Dänzer [Wed, 29 Aug 2012 16:55:08 +0000 (18:55 +0200)]
radeon/llvm: Add intrinsic for enabling whole quad mode in SI pixel shaders.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
12 years agoradeon/llvm: SI shader vector instructions implicitly use the EXEC register.
Michel Dänzer [Fri, 31 Aug 2012 17:05:31 +0000 (19:05 +0200)]
radeon/llvm: SI shader vector instructions implicitly use the EXEC register.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
12 years agoradeon/llvm: Extend SI EXEC register support.
Michel Dänzer [Wed, 29 Aug 2012 16:52:53 +0000 (18:52 +0200)]
radeon/llvm: Extend SI EXEC register support.

Add 32 bit lo and hi variants, and binary encodings.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
12 years agoradeon/llvm: Remove R600InstrInfo.td from TD_FILES
Tom Stellard [Thu, 6 Sep 2012 14:05:22 +0000 (14:05 +0000)]
radeon/llvm: Remove R600InstrInfo.td from TD_FILES

Fixes build bug introduced by
cebbdd4ac23725963207bf6f8fc7101150e6065f

12 years agoradeonsi: Enable NPOT textures again.
Michel Dänzer [Wed, 5 Sep 2012 16:27:02 +0000 (18:27 +0200)]
radeonsi: Enable NPOT textures again.

Should be at least mostly working now (with the corresponding fixes in
libdrm_radeon).

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
12 years agoradeonsi: Mipmaps require memory footprint to be padded to powers of two.
Michel Dänzer [Tue, 4 Sep 2012 16:58:38 +0000 (18:58 +0200)]
radeonsi: Mipmaps require memory footprint to be padded to powers of two.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
12 years agoradeonsi: Sampler view state simplification.
Michel Dänzer [Mon, 27 Aug 2012 09:48:55 +0000 (11:48 +0200)]
radeonsi: Sampler view state simplification.

We can always use the offset and tiling mode from level 0 and restrict the
first and last mipmap level to be used in the sampler resource.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
12 years agoradeonsi: Untiled textures are linear aligned, not linear general.
Michel Dänzer [Wed, 29 Aug 2012 10:11:04 +0000 (12:11 +0200)]
radeonsi: Untiled textures are linear aligned, not linear general.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
12 years agoradeon/llvm: Cleanup makefile
Tom Stellard [Wed, 29 Aug 2012 13:01:15 +0000 (13:01 +0000)]
radeon/llvm: Cleanup makefile

Hopefully, this will fix all the parallel make problems people have
been having.

12 years agoRemove useless checks for NULL before freeing
Matt Turner [Wed, 5 Sep 2012 06:33:28 +0000 (23:33 -0700)]
Remove useless checks for NULL before freeing

Same as earlier commit, except for "FREE"

This patch has been generated by the following Coccinelle semantic
patch:

// Remove useless checks for NULL before freeing
//
// free (NULL) is a no-op, so there is no need to avoid it

@@
expression E;
@@
+ FREE (E);
+ E = NULL;
- if (unlikely (E != NULL)) {
-   FREE(E);
(
-   E = NULL;
|
-   E = 0;
)
   ...
- }

@@
expression E;
type T;
@@
+ FREE ((T) E);
+ E = NULL;
- if (unlikely (E != NULL)) {
-   FREE((T) E);
(
-   E = NULL;
|
-   E = 0;
)
   ...
- }

@@
expression E;
@@
+ FREE (E);
- if (unlikely (E != NULL)) {
-   FREE (E);
- }

@@
expression E;
type T;
@@
+ FREE ((T) E);
- if (unlikely (E != NULL)) {
-   FREE ((T) E);
- }

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoReplace another malloc/memset-0 combination with calloc
Matt Turner [Wed, 5 Sep 2012 06:12:46 +0000 (23:12 -0700)]
Replace another malloc/memset-0 combination with calloc

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoRemove useless memset after calloc
Matt Turner [Wed, 5 Sep 2012 06:10:52 +0000 (23:10 -0700)]
Remove useless memset after calloc

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoUse calloc instead of malloc/memset-0
Matt Turner [Wed, 5 Sep 2012 06:09:22 +0000 (23:09 -0700)]
Use calloc instead of malloc/memset-0

This patch has been generated by the following Coccinelle semantic
patch:

@@
expression E;
identifier I;
@@
- I = malloc(E);
+ I = calloc(1, E);
...
- memset(I, 0, sizeof *I);

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoRemove useless checks for NULL before freeing
Matt Turner [Tue, 4 Sep 2012 03:24:35 +0000 (20:24 -0700)]
Remove useless checks for NULL before freeing

This patch has been generated by the following Coccinelle semantic
patch:

// Remove useless checks for NULL before freeing
//
// free (NULL) is a no-op, so there is no need to avoid it

@@
expression E;
@@
+ free (E);
+ E = NULL;
- if (unlikely (E != NULL)) {
-   free(E);
(
-   E = NULL;
|
-   E = 0;
)
   ...
- }

@@
expression E;
type T;
@@
+ free ((T) E);
+ E = NULL;
- if (unlikely (E != NULL)) {
-   free((T) E);
(
-   E = NULL;
|
-   E = 0;
)
   ...
- }

@@
expression E;
@@
+ free (E);
- if (unlikely (E != NULL)) {
-   free (E);
- }

@@
expression E;
type T;
@@
+ free ((T) E);
- if (unlikely (E != NULL)) {
-   free ((T) E);
- }

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoglX_proto_send.py: Don't cast the return value of malloc
Matt Turner [Wed, 5 Sep 2012 05:57:48 +0000 (22:57 -0700)]
glX_proto_send.py: Don't cast the return value of malloc

12 years agoDon't cast the return value of malloc/realloc
Matt Turner [Tue, 4 Sep 2012 02:44:00 +0000 (19:44 -0700)]
Don't cast the return value of malloc/realloc

This patch has been generated by the following Coccinelle semantic
patch:

// Don't cast the return value of malloc/realloc.
//
// Casting the return value of malloc/realloc only stands to hide
// errors.

@@
type T;
expression E1, E2;
@@
- (T)
(
_mesa_align_calloc(E1, E2)
|
_mesa_align_malloc(E1, E2)
|
calloc(E1, E2)
|
malloc(E1)
|
realloc(E1, E2)
)

12 years agoglX_proto_send.py: Remove deprecated Xmalloc/Xfree calls
Matt Turner [Mon, 3 Sep 2012 21:19:43 +0000 (14:19 -0700)]
glX_proto_send.py: Remove deprecated Xmalloc/Xfree calls

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoRemove Xcalloc/Xmalloc/Xfree calls
Matt Turner [Wed, 5 Sep 2012 05:52:36 +0000 (22:52 -0700)]
Remove Xcalloc/Xmalloc/Xfree calls

These calls allowed Xlib to use a custom memory allocator, but Xlib has
used the standard C library functions since at least its initial import
into git in 2003. It seems unlikely that it will grow a custom memory
allocator. The functions now just add extra overhead. Replacing them
will make future Coccinelle patches simpler.

This patch has been generated by the following Coccinelle semantic
patch:

// Remove Xcalloc/Xmalloc/Xfree calls

@@ expression E1, E2; @@
- Xcalloc (E1, E2)
+ calloc (E1, E2)

@@ expression E; @@
- Xmalloc (E)
+ malloc (E)

@@ expression E; @@
- Xfree (E)
+ free (E)

@@ expression E; @@
- XFree (E)
+ free (E)

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoUse the correct macro _WIN32 for Windows.
Vinson Lee [Wed, 5 Sep 2012 05:53:42 +0000 (22:53 -0700)]
Use the correct macro _WIN32 for Windows.

The correct predefined macro for Windows is _WIN32, not WIN32 or
__WIN32__.  _WIN32 is defined for 32-bit and 64-bit version of Windows
by both MSVC and MinGW compilers.

http://sourceforge.net/p/predef/wiki/OperatingSystems
http://msdn.microsoft.com/en-us/library/b0084kay.aspx

This patch also fixes a MinGW automake build error.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agomesa: remove #undef CONST in get.c
Brian Paul [Thu, 6 Sep 2012 02:26:28 +0000 (20:26 -0600)]
mesa: remove #undef CONST in get.c

Reviewed-by: Matt Turner <mattst88@gmail.com>
12 years agomesa: remove now unused CONST macro
Brian Paul [Thu, 6 Sep 2012 02:26:28 +0000 (20:26 -0600)]
mesa: remove now unused CONST macro

Reviewed-by: Matt Turner <mattst88@gmail.com>
12 years agomesa: s/CONST/const/ in a comment
Brian Paul [Thu, 6 Sep 2012 02:26:28 +0000 (20:26 -0600)]
mesa: s/CONST/const/ in a comment

Reviewed-by: Matt Turner <mattst88@gmail.com>
12 years agomesa: s/CONST/const/ in math/ files
Brian Paul [Thu, 6 Sep 2012 02:26:28 +0000 (20:26 -0600)]
mesa: s/CONST/const/ in math/ files

The CONST macro hack will go away soon.

Reviewed-by: Matt Turner <mattst88@gmail.com>
12 years agoradeon/llvm: Fix operand ordering for V_CNDMASK_B32
Tom Stellard [Wed, 5 Sep 2012 15:30:16 +0000 (11:30 -0400)]
radeon/llvm: Fix operand ordering for V_CNDMASK_B32

This fixes several hundred piglit tests.

12 years agoradeon/llvm: Use correct float->int conversion opcode on SI.
Tom Stellard [Wed, 5 Sep 2012 15:28:31 +0000 (11:28 -0400)]
radeon/llvm: Use correct float->int conversion opcode on SI.

V_CVT_I32_F32 converts floats to signed integers, but we were using
V_CVT_F32_I32 which convertes signed integers to float.

12 years agoconfigure.ac: Don't link gallium drivers with libdricore
Tom Stellard [Tue, 4 Sep 2012 13:37:02 +0000 (09:37 -0400)]
configure.ac: Don't link gallium drivers with libdricore

Reviewed-by: Matt Turner <mattst88@gmail.com>
12 years agoi965/blorp: Fix incorrect indentation.
Paul Berry [Thu, 30 Aug 2012 18:03:33 +0000 (11:03 -0700)]
i965/blorp: Fix incorrect indentation.

12 years agomapi: Add shared-glapi-test to .gitignore
Paul Berry [Thu, 30 Aug 2012 19:15:29 +0000 (12:15 -0700)]
mapi: Add shared-glapi-test to .gitignore

12 years agomesa: fix per-level max texture size error checking
Brian Paul [Wed, 5 Sep 2012 02:17:15 +0000 (20:17 -0600)]
mesa: fix per-level max texture size error checking

This is a long-standing omission in Mesa's texture image size checking.
We need to take the mipmap level into consideration when checking if the
width, height and depth are too large.

Fixes the new piglit max-texture-size-level test.
Thanks to Stéphane Marchesin for finding this problem.

Note: This is a candidate for the stable branches.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agoi965: Don't use brw->fragment_program in the old brw_wm_pass2.c.
Kenneth Graunke [Sat, 1 Sep 2012 05:50:26 +0000 (22:50 -0700)]
i965: Don't use brw->fragment_program in the old brw_wm_pass2.c.

According to Eric, this shouldn't matter since we don't do precompiles
using the old backend.  In other words, brw->fragment_program (the
currently active program) should equal c->fp (the program currently
being compiled).

However, it's just not a good idea to access brw->fragment_program
directly in compiler code.  It's totally illegal in the new backend, so
let's just not do it here either.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reported-by: Paul Berry <stereotype441@gmail.com>
12 years agoradeon/llvm: Fix lowering of SI_V_CNDLT
Tom Stellard [Tue, 4 Sep 2012 15:20:01 +0000 (11:20 -0400)]
radeon/llvm: Fix lowering of SI_V_CNDLT

SREG_LIT_0 is a scalar register, so it can only be used in the
first argument of vector instructoins.

12 years agoradeon/llvm: Fix encoding of V_CNDMASK_B32
Tom Stellard [Fri, 31 Aug 2012 20:11:38 +0000 (16:11 -0400)]
radeon/llvm: Fix encoding of V_CNDMASK_B32

The CodeEmitter was not setting the VGPR bit for src0, because the
instruction definition had the VCC register in the src0 slot, instead of
the actual src0 register.  This has been fixed by moving the VCC
register to the end of the operand list.

12 years agomesa: fix DIFFERENT_SIGNS() function
Brian Paul [Tue, 4 Sep 2012 16:02:20 +0000 (10:02 -0600)]
mesa: fix DIFFERENT_SIGNS() function

Looks like converting this to a macro, returning bool, caused us to
lose the high (31st) bit result.  Fixes piglit fbo-1d test.  Strange
that none of the other tests I ran caught this.

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

Tested-by: Vinson Lee <vlee@freedesktop.org>
12 years agoradeon/llvm: do not convert f32 operand of select_cc node
Vincent Lejeune [Tue, 4 Sep 2012 15:28:26 +0000 (17:28 +0200)]
radeon/llvm: do not convert f32 operand of select_cc node

v2:-use camel coding style

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
12 years agoradeon/llvm: custom lowering for FP_TO_UINT when dst is i1 (bool)
Vincent Lejeune [Tue, 4 Sep 2012 15:29:48 +0000 (17:29 +0200)]
radeon/llvm: custom lowering for FP_TO_UINT when dst is i1 (bool)

v2:-wrap line at 80 characters

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
12 years agoradeon/llvm: support setcc on f32
Vincent Lejeune [Tue, 4 Sep 2012 15:04:28 +0000 (17:04 +0200)]
radeon/llvm: support setcc on f32

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
12 years agoradon/llvm: br_cc f32 now lowered without cast
Vincent Lejeune [Tue, 4 Sep 2012 15:04:27 +0000 (17:04 +0200)]
radon/llvm: br_cc f32 now lowered without cast

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
12 years agoradeon/llvm: swap wrong OPCODE_IS_*_ZERO_* opcode and use
Vincent Lejeune [Tue, 4 Sep 2012 14:49:25 +0000 (16:49 +0200)]
radeon/llvm: swap wrong OPCODE_IS_*_ZERO_* opcode and use

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
12 years agowinsys/radeon: create only one winsys for each fd
Christian König [Thu, 30 Aug 2012 08:26:48 +0000 (10:26 +0200)]
winsys/radeon: create only one winsys for each fd

Fixing problems with GLAMOR.

Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agoradeonsi: stop big offsets from hanging the GPU v2
Christian König [Wed, 29 Aug 2012 08:48:01 +0000 (10:48 +0200)]
radeonsi: stop big offsets from hanging the GPU v2

v2: rebased of radeon/llvm fix.

Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agoradeonsi: adjust PIPE_SHADER_CAP_MAX_CONSTS
Christian König [Fri, 31 Aug 2012 11:59:14 +0000 (13:59 +0200)]
radeonsi: adjust PIPE_SHADER_CAP_MAX_CONSTS

So it matches what we really can do.

Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agoradeon/llvm: fix SelectADDR8BitOffset
Christian König [Fri, 31 Aug 2012 11:49:06 +0000 (13:49 +0200)]
radeon/llvm: fix SelectADDR8BitOffset

The offset is unsigned, not signed.

Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agogallivm,llvmpipe: Use 4-wide vectors on AMD Bulldozer.
José Fonseca [Fri, 31 Aug 2012 16:01:50 +0000 (17:01 +0100)]
gallivm,llvmpipe: Use 4-wide vectors on AMD Bulldozer.

8-wide vectors is slower.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
12 years agomesa: add missing return statements after recording errors
Brian Paul [Mon, 3 Sep 2012 14:12:04 +0000 (08:12 -0600)]
mesa: add missing return statements after recording errors

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
12 years agomesa: remove more null pointer checks before free() calls
Brian Paul [Mon, 3 Sep 2012 14:12:04 +0000 (08:12 -0600)]
mesa: remove more null pointer checks before free() calls

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
12 years agomesa: remove null pointer checks before free() calls
Brian Paul [Mon, 3 Sep 2012 14:12:04 +0000 (08:12 -0600)]
mesa: remove null pointer checks before free() calls

Since free(NULL) is fine.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
12 years agomesa: remove SQRTF, use sqrtf. Convert INV_SQRT() to inline function.
Brian Paul [Mon, 3 Sep 2012 18:19:15 +0000 (12:19 -0600)]
mesa: remove SQRTF, use sqrtf. Convert INV_SQRT() to inline function.

We were already defining sqrtf where we don't have the C99 version.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
12 years agor600g: adjust QUANT_MODE for higher precision
Vadim Girlin [Mon, 3 Sep 2012 20:18:13 +0000 (00:18 +0400)]
r600g: adjust QUANT_MODE for higher precision

Use 1/256 for R6xx/7xx, 1/4096 for evergreen, instead of default 1/16.

Helps to pass some piglit tests (fbo, multisample).

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agoutil: Add cpuid for Solaris Studio.
Vinson Lee [Sat, 1 Sep 2012 06:30:35 +0000 (23:30 -0700)]
util: Add cpuid for Solaris Studio.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agometa: Don't save and restore fog state when there is no fog state
Ian Romanick [Fri, 31 Aug 2012 22:26:27 +0000 (15:26 -0700)]
meta: Don't save and restore fog state when there is no fog state

I wonder if the better solution is to have _mesa_meta_GenerateMipmap not
use MESA_META_ALL for the GLSL path.  Even on compatibility profiles
there is no reason to save and restore fog on this path.

NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Lu Hua <huax.lu@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54295

12 years agomesa: remove accidentally committed __SUNPRO_C sqrtf() code
Brian Paul [Mon, 3 Sep 2012 14:03:05 +0000 (08:03 -0600)]
mesa: remove accidentally committed __SUNPRO_C sqrtf() code

12 years agoradeonsi: disable array-textures for now
Christian König [Wed, 29 Aug 2012 11:41:47 +0000 (13:41 +0200)]
radeonsi: disable array-textures for now

Signed-off-by: Christian König <deathsimple@vodafone.de>