mesa.git
11 years agoradeonsi: remove constant index limitation v3
Christian König [Mon, 4 Feb 2013 16:55:32 +0000 (17:55 +0100)]
radeonsi: remove constant index limitation v3

With the llvm patches, fixing 14 piglit tests in total.

v2: increase the const limit
v3: document the const limit

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoradeonsi: support constants as TEX coordinates
Christian König [Mon, 4 Feb 2013 16:46:42 +0000 (17:46 +0100)]
radeonsi: support constants as TEX coordinates

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoglsl: Fix unsupported version error for GLSL ES 3.00, future proof for 3.30.
Paul Berry [Tue, 5 Feb 2013 23:07:26 +0000 (15:07 -0800)]
glsl: Fix unsupported version error for GLSL ES 3.00, future proof for 3.30.

When the user specifies an unsupported GLSL version,
_mesa_glsl_parse_state::process_version_directive() nicely gives them
an error message telling them which GLSL versions are supported.
Previous to this patch, the logic for determining whether a given
language version was supported was independent from the logic to
generate this error message string; as a result, we had a bug where
GLSL 3.00 would never be listed in the error message as an available
language version, even if it was really available.

To make matters worse, the code for generating the error message
string assumed that desktop GL versions were always separated by 0.10,
an assumption that will be wrong as soon as we support GLSL 3.30.

This patch fixes both problems by adding a table of supported GLSL
versions to _mesa_glsl_parse_state; this table is used both to
generate the error message and to check whether a given version is
supported.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agogallium/docs: fix typos in sample opcode descriptions
Roland Scheidegger [Tue, 12 Feb 2013 15:48:52 +0000 (16:48 +0100)]
gallium/docs: fix typos in sample opcode descriptions

11 years agonv50: fix bogus parameters when processing sample instructions
Roland Scheidegger [Tue, 12 Feb 2013 15:45:49 +0000 (16:45 +0100)]
nv50: fix bogus parameters when processing sample instructions

Discovered accidentally when changing SAMPLE_L definition.
Turns out the lod arguments were already correct for the new definition
but the compare and derivs were not.

Reviewed-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
11 years agogallium: fix tgsi SAMPLE_L opcode to use separate source for explicit lod
Roland Scheidegger [Tue, 12 Feb 2013 15:41:56 +0000 (16:41 +0100)]
gallium: fix tgsi SAMPLE_L opcode to use separate source for explicit lod

It looks like using coord.w as explicit lod value is a mistake, most likely
because some dx10 docs had it specified that way. Seems this was changed though:
http://msdn.microsoft.com/en-us/library/windows/desktop/hh447229%28v=vs.85%29.aspx
- let's just hope it doesn't depend on runtime build version or something.
Not only would this need translation (so go against the stated goal these
opcodes should be close to dx10 semantics) but it would prevent usage of this
opcode with cube arrays, which is apparently possible:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb509699%28v=vs.85%29.aspx
(Note not only does this show cube arrays using explicit lod, but also the
confusion with this opcode: it lists an explicit lod parameter value, but then
states last component of location is used as lod).
(For "true" hw drivers, only nv50 had code to handle it, and it appears the
code was already right for the new semantics, though fix up the seemingly
wrong c/d arguments while there.)

v2: fix comment, separate out other changes.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoutil: fix incorrect Z bit masking in util_clear_depth_stencil()
Brian Paul [Mon, 11 Feb 2013 23:39:42 +0000 (16:39 -0700)]
util: fix incorrect Z bit masking in util_clear_depth_stencil()

For PIPE_FORMAT_Z24_UNORM_S8_UINT, the Z bits are in the 24
least significant bits.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=60527
and http://bugs.freedesktop.org/show_bug.cgi?id=60524
and http://bugs.freedesktop.org/show_bug.cgi?id=60047

Note: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoradeon: Remove dead STANDALONE_MMIO defines
Matt Turner [Fri, 8 Feb 2013 01:21:22 +0000 (17:21 -0800)]
radeon: Remove dead STANDALONE_MMIO defines

These were, at some point in the past, used to request that Xorg's
compiler.h export a static inline xf86ReadMmio32 instead of a function
pointer. compiler.h only has this option for DEC Alpha.

But Xorg's compiler.h isn't being included by either of these two files
and the radeon driver still works on Alpha, so the definitions are dead
and not needed.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agollvmpipe: implement dual source blending
Roland Scheidegger [Tue, 12 Feb 2013 02:41:48 +0000 (03:41 +0100)]
llvmpipe: implement dual source blending

link up the fs outputs and blend inputs, and make sure the second blend source
is correctly loaded and converted (which is quite complex).
There's a slight refactoring of the monster generate_unswizzled_blend()
function where it makes sense to factor out alpha conversion (which needs
to run twice for dual source blend).
This passes piglit arb_blend_func_extended tests.

v2: remove new but ultimately not used function...

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodocs: Mark a few things done in GL3.txt.
Kenneth Graunke [Mon, 11 Feb 2013 23:55:00 +0000 (15:55 -0800)]
docs: Mark a few things done in GL3.txt.

11 years agoi965: Add missing dirty bits to INTEL_DEBUG=state arrays.
Kenneth Graunke [Sun, 6 Jan 2013 01:16:41 +0000 (17:16 -0800)]
i965: Add missing dirty bits to INTEL_DEBUG=state arrays.

These are more recent additions, and no one remembered to update the
INTEL_DEBUG=state code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Reorganize brw_bits to match the order in brw_context.h.
Kenneth Graunke [Sun, 6 Jan 2013 01:14:59 +0000 (17:14 -0800)]
i965: Reorganize brw_bits to match the order in brw_context.h.

This reorders the "brw_bits" array in brw_state_upload.c to match the
order of the #defines in brw_context.h.

Otherwise, it's really hard to see if any are missing.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Use BRW_NEW_CONTEXT for gen7_disable rather than BRW_NEW_BATCH.
Kenneth Graunke [Sun, 6 Jan 2013 01:20:01 +0000 (17:20 -0800)]
i965: Use BRW_NEW_CONTEXT for gen7_disable rather than BRW_NEW_BATCH.

These don't need to be re-disabled on every batch if we're using
hardware contexts.  (If we're not, this is equivalent.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agor600g: make sure async blit is done 8 * pitch at a time v2
Jerome Glisse [Wed, 6 Feb 2013 20:03:17 +0000 (15:03 -0500)]
r600g: make sure async blit is done 8 * pitch at a time v2

The blit must be aligned on 8 horizontal block.

v2: no need to align the reminder

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agowinsys/radeon: fix bo with virtual address referencing mismatch
Martin Andersson [Sat, 2 Feb 2013 16:55:07 +0000 (17:55 +0100)]
winsys/radeon: fix bo with virtual address referencing mismatch

If the same context try to flink and open the object, use the
same bo struct instead of opening a new gem handle for the object.
This way we avoid avoid having 2 different handle pointing to the
same kernel object which can latter lead to trouble with virtual
address.

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

Signed-off-by: Martin Andersson <g02maran@gmail.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
11 years agovbo: Merge GL_QUADS drawing requests in display lists.
Eric Anholt [Fri, 1 Feb 2013 03:49:21 +0000 (14:49 +1100)]
vbo: Merge GL_QUADS drawing requests in display lists.

minecraft apparently has its piles of display lists each contain 6
instances of glBegin(GL_QUADS)/verts/glEnd(), which appear in the
compiled list as 6 prims of 4 verts each in one draw call.  We can
reduce driver overhead even more by making that one prim of 24 verts.

Improves minecraft performance by 1.6% +/- .25% (n=446)

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agovbo: Print display list debug using printf() like dlist.c does.
Eric Anholt [Fri, 1 Feb 2013 01:10:18 +0000 (12:10 +1100)]
vbo: Print display list debug using printf() like dlist.c does.

Otherwise, the stderr and stdout debug end up interleaved wrong
when I pipe them to a file.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoi965: Remove some stale comments about the brw_constant_buffer atom.
Eric Anholt [Thu, 24 Jan 2013 01:59:12 +0000 (17:59 -0800)]
i965: Remove some stale comments about the brw_constant_buffer atom.

These have been wrong since f428255bde93a452a7cdd48fba21839c99beb6cb
back in 2009!

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Simplify VS push constant upload code since removal of old path.
Eric Anholt [Thu, 24 Jan 2013 00:00:29 +0000 (16:00 -0800)]
i965: Simplify VS push constant upload code since removal of old path.

We used to have clip planes optionally included in the push constants,
resulting in a variable amount of data uploaded, but no more.  This also
means less wasted space in the batch for our push constants.

v2: Update _NEW_TRANSFORM state bit information.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
11 years agoi965: Add perf debug for a corner case.
Eric Anholt [Wed, 23 Jan 2013 23:26:36 +0000 (15:26 -0800)]
i965: Add perf debug for a corner case.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Fix access mode of index buffer rebase.
Eric Anholt [Wed, 23 Jan 2013 23:23:43 +0000 (15:23 -0800)]
i965: Fix access mode of index buffer rebase.

It doesn't matter with our current implementation of MapBufferRange,
but it was wrong -- the result pointer is read by intel_upload_data().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Fix indentation of index buffer rebase code.
Eric Anholt [Wed, 23 Jan 2013 23:22:57 +0000 (15:22 -0800)]
i965: Fix indentation of index buffer rebase code.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: fix GetTexImage if mesa format and internal format don't match
Marek Olšák [Wed, 6 Feb 2013 21:39:53 +0000 (22:39 +0100)]
mesa: fix GetTexImage if mesa format and internal format don't match

Tested with softpipe only exposing RGBA formats.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: don't use memcpy fast path for GetTexImage if base format is different
Marek Olšák [Wed, 6 Feb 2013 21:33:55 +0000 (22:33 +0100)]
mesa: don't use memcpy fast path for GetTexImage if base format is different

The Mesa format can be RGBA8888_REV, the format/type can be
GL_RGBA/GL_UNSIGNED_BYTE, but the actual texture internal format can be
LUMINANCE_ALPHA, INTENSITY, etc. Therefore we should look at the base
internal format as well.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: don't use _mesa_base_tex_format for format parameter of GetTexImage
Marek Olšák [Wed, 6 Feb 2013 21:31:44 +0000 (22:31 +0100)]
mesa: don't use _mesa_base_tex_format for format parameter of GetTexImage

_mesa_base_tex_format doesn't accept GL_BGR and GL_ABGR_EXT, etc.

v2: add a (now hopefully complete) helper function to deal with this

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: adjust usage of swapBytes/littleEndian in format_matches_format_and_type
Marek Olšák [Tue, 29 Jan 2013 19:58:55 +0000 (20:58 +0100)]
mesa: adjust usage of swapBytes/littleEndian in format_matches_format_and_type

- swapBytes has no effect on 8-bit single-component formats
- GL_SHORT is in host byte order, so checking for littleEndian is unnecessary,
  I decided to make the change for single-component formats only

Based on suggestions from Michel Dänzer.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agomesa: remove per-format memcpy codepaths from texstore functions
Marek Olšák [Mon, 28 Jan 2013 20:47:47 +0000 (21:47 +0100)]
mesa: remove per-format memcpy codepaths from texstore functions

It's obsoleted by the common function _mesa_texstore_memcpy.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: implement common texstore memcpy function for all formats
Marek Olšák [Mon, 28 Jan 2013 20:18:02 +0000 (21:18 +0100)]
mesa: implement common texstore memcpy function for all formats

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: fill in Z32_FLOAT_X24S8 in _mesa_format_matches_format_and_type
Marek Olšák [Mon, 28 Jan 2013 20:13:18 +0000 (21:13 +0100)]
mesa: fill in Z32_FLOAT_X24S8 in _mesa_format_matches_format_and_type

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: fill in signed cases and RGBA16 in _mesa_format_matches_format_and_type
Marek Olšák [Mon, 28 Jan 2013 20:11:46 +0000 (21:11 +0100)]
mesa: fill in signed cases and RGBA16 in _mesa_format_matches_format_and_type

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agomesa: fill in INT/UINT format cases in _mesa_format_matches_format_and_type
Marek Olšák [Mon, 28 Jan 2013 20:08:35 +0000 (21:08 +0100)]
mesa: fill in INT/UINT format cases in _mesa_format_matches_format_and_type

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agomesa: fill in YCBCR cases in _mesa_format_matches_format_and_type
Marek Olšák [Mon, 28 Jan 2013 20:06:11 +0000 (21:06 +0100)]
mesa: fill in YCBCR cases in _mesa_format_matches_format_and_type

based on the texstore code

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agomesa: fill in SRGB cases in _mesa_format_matches_format_and_type
Marek Olšák [Mon, 28 Jan 2013 20:02:46 +0000 (21:02 +0100)]
mesa: fill in SRGB cases in _mesa_format_matches_format_and_type

Texstore takes the same codepath as the corresponding linear formats.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agollvmpipe: fix vertex_header mask store in big-endian
Adhemerval Zanella [Sun, 20 Jan 2013 17:42:16 +0000 (11:42 -0600)]
llvmpipe: fix vertex_header mask store in big-endian

This patch fixes the vertex_header mask bitfield store in big-endian
architectures by bit-swap the fields accordingly.

Reviewed-by: Adam Jackson <ajax@redhat.com>
11 years agollvmpipe: remove lp_swizzled_cbuf
Adhemerval Zanella [Mon, 21 Jan 2013 11:19:31 +0000 (05:19 -0600)]
llvmpipe: remove lp_swizzled_cbuf

Ununsed since 75da95c5.

Reviewed-by: Adam Jackson <ajax@redhat.com>
11 years agodocs: document removal of makedepend build dependency
Andreas Boll [Mon, 11 Feb 2013 09:38:11 +0000 (10:38 +0100)]
docs: document removal of makedepend build dependency

Build dependency removed with
424f2008814ed9047628c40ccd4258a8a9fd8299

Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agodocs: update making a new mesa release info
Andreas Boll [Wed, 30 Jan 2013 21:35:58 +0000 (22:35 +0100)]
docs: update making a new mesa release info

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodocs: use proper title for index.html
Andreas Boll [Wed, 30 Jan 2013 21:35:54 +0000 (22:35 +0100)]
docs: use proper title for index.html

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodocs: mention some other supported APIs
Andreas Boll [Wed, 30 Jan 2013 21:35:51 +0000 (22:35 +0100)]
docs: mention some other supported APIs

v2: add ES3

Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
11 years agodocs: update sourcetree
Andreas Boll [Wed, 30 Jan 2013 21:35:43 +0000 (22:35 +0100)]
docs: update sourcetree

glsl directory is located in src and not in src/egl

v2: remove ppc, move glapi from src/mesa to src/mapi

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodocs: replace CVS with git
Andreas Boll [Wed, 30 Jan 2013 21:35:35 +0000 (22:35 +0100)]
docs: replace CVS with git

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoconfigure.ac: Do not check for rt on Mac OS X.
Vinson Lee [Sun, 27 Jan 2013 06:50:05 +0000 (22:50 -0800)]
configure.ac: Do not check for rt on Mac OS X.

There is no rt library on Mac OS X.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58872
Acked-by: Matt Turner <mattst88@gmail.com>
11 years agointel: Do not expose OES_compressed_ETC1_RGB8_texture or ARB_texture_rgb10_a2ui pre...
Ian Romanick [Sat, 9 Feb 2013 02:03:33 +0000 (18:03 -0800)]
intel: Do not expose OES_compressed_ETC1_RGB8_texture or ARB_texture_rgb10_a2ui pre-GEN4

Older hardware cannot do ARB_texture_rgb10_a2ui, and the translation
code for OES_compressed_ETC1_RGB8_texture was never implemented in the
i915 driver.

NOTE: This is a candidate for all stable branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agosoftpipe: clean up lod computation
Roland Scheidegger [Sat, 9 Feb 2013 02:42:17 +0000 (18:42 -0800)]
softpipe: clean up lod computation

This should handle the new lod_zero modifier more correctly.
The runtime-conditional is a bit more complex however we now also do
scalar lod computation when appropriate which should more than make up for it.
The refactoring should also fix an issue with explicit lods
(lod clamp wasn't applied to them).
Also, always pass lod as the 5th element from tgsi executor, which simplifies
things (get rid of annoying conditionals later).

v2: based on Brian's feedback, use switch in a couple of places, fix up
some function parameter names, fix up comments.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agosoftpipe: try to beat new dx10-style sample opcodes into shape
Roland Scheidegger [Wed, 6 Feb 2013 02:48:55 +0000 (18:48 -0800)]
softpipe: try to beat new dx10-style sample opcodes into shape

There were several bugs how this was handled, most opcodes wouldn't even
have fetched the right arguments.
Also, the tex "target" is coming from the sampler view, hence it cannot
have information about shadow comparisons - fortunately this is not only
sampler state but also needs to have matching instruction, so just use this
instead to identify shadow comparisons.
Still untested (compiles...).
Note that sample_i and sviewinfo are still busted (just assert).
(The problem is that the interface for doing the opengl-equivalent functions
txf and txq is tied to the specific the sampler itself but these opcodes
have no sampler associated with them. Oops...)
Also, even the other sample instructions will not work correctly since
they always operate on samplers which include the texture state. Fixing
this wouldn't be that difficult but most likely make softpipe quite a bit
slower when using the OpenGL tex opcodes (as the samplers have pre-baked
function calls in the sampler state depending on texture state and that stuff
would need to be evaluated at runtime), so leave it for now.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: fix up size queries for dx10 sviewinfo opcode
Roland Scheidegger [Tue, 5 Feb 2013 21:37:57 +0000 (13:37 -0800)]
gallivm: fix up size queries for dx10 sviewinfo opcode

Need to calculate the number of mip levels (if it would be worthwile could
store it in dynamic state).
While here, the query code also used chan 2 for the lod value.
This worked with mesa state tracker but it seems safer to use chan 0.
Still passes piglit textureSize (with some handwaving), though the non-GL
parts are (largely) untested.

v2: clarify and expect the sviewinfo opcode to return ints, not floats,
just like the OpenGL textureSize (dx10 supports dst modifiers with resinfo).
Also simplify some code.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: hook up dx10 sampling opcodes
Roland Scheidegger [Fri, 1 Feb 2013 22:44:59 +0000 (14:44 -0800)]
gallivm: hook up dx10 sampling opcodes

They are similar to old-style tex opcodes but with separate sampler and
texture units (and other arguments in different places).
Also adjust the debug tgsi dump code.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agointel: Ensure variable intel is used in i915 builds.
Vinson Lee [Fri, 8 Feb 2013 06:19:20 +0000 (22:19 -0800)]
intel: Ensure variable intel is used in i915 builds.

Fixes unused pointer value defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Ensure glsl_type constructors initialize gl_type.
Vinson Lee [Fri, 8 Feb 2013 06:46:43 +0000 (22:46 -0800)]
glsl: Ensure glsl_type constructors initialize gl_type.

Fixes uninitialized scalar field defects reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agowinsys/radeon: improve debuging printing
Jerome Glisse [Sat, 9 Feb 2013 01:28:06 +0000 (20:28 -0500)]
winsys/radeon: improve debuging printing

Make sure one can identify virtual address failure from allocation
failure.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agosoftpipe: get rid of tgsi_sampler_control param in img_filter
Roland Scheidegger [Wed, 6 Feb 2013 03:18:58 +0000 (19:18 -0800)]
softpipe: get rid of tgsi_sampler_control param in img_filter

None of the filters used it (why would they). Maybe that param
was just there because some of the lines were considered to be
too short...

Reviewed-by: Dave Airlie <airlied@redhat.com>
11 years agosoftpipe: fix using optimized filter function
Roland Scheidegger [Wed, 6 Feb 2013 17:29:55 +0000 (09:29 -0800)]
softpipe: fix using optimized filter function

This optimized filter (when using repeat wrap modes,
linear min/mag/mip filters, pot textures) only applies to 2d textures,
but nothing prevented it from being used for other textures (likely
leading to very bogus sample results).

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: fix typo in lp_build_mul_norm
Roland Scheidegger [Fri, 1 Feb 2013 16:34:36 +0000 (08:34 -0800)]
gallivm: fix typo in lp_build_mul_norm

The signed case didn't do what the comment indicated. Should increase rounding
precision (at the expense of performance since the former code was effectively
a no-op).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: first steps of adding dual source blend support
Roland Scheidegger [Thu, 7 Feb 2013 20:54:41 +0000 (12:54 -0800)]
llvmpipe: first steps of adding dual source blend support

This adds support of the additional blending factors to the blend function
itself, and also enables testing of it in lp_test_blend (which passes).
Still need to add the glue code of linking fs shader outputs to blend inputs
in llvmpipe, and probably need to add special handling if destination doesn't
include alpha (which lp_test_blend doesn't test).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agollvmpipe: refactoring of visibility counter handling
Roland Scheidegger [Wed, 6 Feb 2013 21:09:46 +0000 (13:09 -0800)]
llvmpipe: refactoring of visibility counter handling

There can be other per-thread data than just vis_counter, so pass a struct
around instead (some of our non-public code uses this already and this
difference is a major cause of merge pain).

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoxorg: fix exa finish access
Jerome Glisse [Fri, 8 Feb 2013 23:57:42 +0000 (18:57 -0500)]
xorg: fix exa finish access

The exa core will already set the pointer to NULL prior calling
the callback function. So don't bail out in the callback if it's
already NULL.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agoegl-wayland: Make sure we allocate a back buffer even if nothing was rendered
Kristian Høgsberg [Wed, 6 Feb 2013 20:41:54 +0000 (15:41 -0500)]
egl-wayland: Make sure we allocate a back buffer even if nothing was rendered

At eglSwapBuffer time, we blindly assume we have a back buffer, but the
back buffer only gets allocated when somebody tries to render something.

NOTE: This is a candidate for the 9.0 and 9.1 branches.

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

11 years agoConsolidate some redundant definitions of ARRAY_SIZE() macro.
Paul Berry [Wed, 6 Feb 2013 17:50:22 +0000 (09:50 -0800)]
Consolidate some redundant definitions of ARRAY_SIZE() macro.

Previous to this patch, there were 13 identical definitions of this
macro in Mesa source.  That's ridiculous.  This patch consolidates 6
of them to a single definition in src/mesa/main/macros.h.

Unfortunately, I wasn't able to eliminate the remaining definitions,
since they occur in places that don't include src/mesa/main/macros.h:

- include/pci_ids/pci_id_driver_map.h
- src/egl/drivers/dri2/egl_dri2.h
- src/egl/main/egldefines.h
- src/gbm/main/backend.c
- src/gbm/main/gbm.c
- src/glx/glxclient.h
- src/mapi/mapi/stub.c

I'm open to suggestions as to how to deal with the remaining redundancy.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agointel/pre-gen6: Disable EXT_framebuffer_multisample.
Paul Berry [Mon, 28 Jan 2013 19:13:07 +0000 (11:13 -0800)]
intel/pre-gen6: Disable EXT_framebuffer_multisample.

Previously, the i965 driver enabled EXT_framebuffer_multisample even
on pre-gen6 chipsets.  However, since we don't support multisampling
on these chips, we set GL_MAX_SAMPLES=1 (the minimum allowed by
EXT_framebuffer_multisample), and if the client ever requested a
multisample buffer, we quietly supplied them with a single-sampled
buffer instead.

After some discussion on the mailing list (see thread
"ext_framebuffer_multisample: check for num_samples<=1"), it's clear
that this was the wrong approach.  The correct approach is to only
expose EXT_framebuffer_multisample when we truly support
multisampling; that frees us to set a sensible value of
GL_MAX_SAMPLES=0 on other chipsets, so that we never have to deal with
a client requesting a multisample buffer when multisampling isn't
supported.

This change causes the following piglit tests to be skipped on
chipsets prior to Gen6:

- "ARB_framebuffer_sRGB/blit {renderbuffer,texture}
  {linear,linear_to_srgb,srgb,srgb_to_linear}
  {downsample,msaa,upsample} {disabled,enabled}"
- EXT_framebuffer_multisample/blit-mismatched-formats
- EXT_framebuffer_multisample/blit-mismatched-sizes
- EXT_framebuffer_multisample/dlist
- EXT_framebuffer_multisample/interpolation 0 *
- EXT_framebuffer_multisample/minmax
- EXT_framebuffer_multisample/negative-copypixels
- EXT_framebuffer_multisample/negative-copyteximage
- EXT_framebuffer_multisample/negative-max-samples
- EXT_framebuffer_multisample/negative-mismatched-samples
- EXT_framebuffer_multisample/negative-readpixels
- EXT_framebuffer_multisample/renderbuffer-samples
- EXT_framebuffer_multisample/renderbufferstorage-samples
- EXT_framebuffer_multisample/samples

This is expected, since the above tests exercise MSAA functionality,
and shouldn't be run on systems prior to Gen6.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoglsl: Initialize all tfeedback_candidate_generator member variables.
Vinson Lee [Wed, 6 Feb 2013 06:53:20 +0000 (22:53 -0800)]
glsl: Initialize all tfeedback_candidate_generator member variables.

Fixes uninitialized pointer field defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agonv30: Fix memory leak.
Vinson Lee [Sun, 3 Feb 2013 04:35:29 +0000 (20:35 -0800)]
nv30: Fix memory leak.

Fixes resource leak defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoglsl: Change loop_analysis to not look like a resource leak
Ian Romanick [Tue, 10 Jul 2012 23:26:33 +0000 (16:26 -0700)]
glsl: Change loop_analysis to not look like a resource leak

Previously the loop_state was allocated in the loop_analysis
constructor, but not freed in the (nonexistent) destructor.  Moving
the allocation of the loop_state makes this code appear less sketchy.

Either way, there is no actual leak.  The loop_state is freed by the
single caller of analyze_loop_variables.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: Dave Airlie <airlied@freedesktop.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57753

11 years agomesa: Don't check (offset + size <= bufObj->Size) in BindBufferRange.
Paul Berry [Fri, 8 Feb 2013 01:54:59 +0000 (17:54 -0800)]
mesa: Don't check (offset + size <= bufObj->Size) in BindBufferRange.

In the documentation for BindBufferRange, OpenGL specs from 3.0
through 4.1 contain this language:

    "The error INVALID_VALUE is generated if size is less than or
    equal to zero or if offset + size is greater than the value of
    BUFFER_SIZE."

This text was dropped from OpenGL 4.2, and it does not appear in the
GLES 3.0 spec.

Presumably the reason for the change is because come clients change
the size of the buffer after calling BindBufferRange.  We don't want
to generate an error at the time of the BindBufferRange call just
because the old size of the buffer was too small, when the buffer is
about to be resized.

Since this is a deliberate relaxation of error conditions in order to
allow clients to work, it seems sensible to apply it to all versions
of GL, not just GL 4.2 and above.

(Note that there is no danger of this change allowing a client to
access data beyond the end of a buffer.  We already have code to
ensure that that doesn't happen in the case where the client shrinks
the buffer after calling BindBufferRange).

Eliminates a spurious error message in the gles3 conformance test
"transform_feedback_offset_size".

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoi965: Set UniformBufferOffsetAlignment to sizeof(vec4)
Ian Romanick [Fri, 8 Feb 2013 03:21:36 +0000 (19:21 -0800)]
i965: Set UniformBufferOffsetAlignment to sizeof(vec4)

This matches the behavior of the Windows driver, but a bspec reference
should would be nice.

NOTE: This is a candidate for the 9.0 and 9.1 branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Allow glGet* queries of MAX_VARYING_COMPONENTS in ES 3
Matt Turner [Fri, 8 Feb 2013 00:37:06 +0000 (16:37 -0800)]
mesa: Allow glGet* queries of MAX_VARYING_COMPONENTS in ES 3

Should have been done in d9948e49 but I missed it because
MAX_VARYING_FLOATS doesn't appear in the ES 3 spec, but is the same
value as MAX_VARYING_COMPONENTS.

NOTE: Candidate for the 9.1 branch
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agogbm: Remember to init format on gbm_dri_bo_create.
Daniel van Vugt [Thu, 7 Feb 2013 05:09:58 +0000 (13:09 +0800)]
gbm: Remember to init format on gbm_dri_bo_create.

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

11 years agoglx: Centralize the code for context flushing.
Eric Anholt [Fri, 28 Dec 2012 19:28:38 +0000 (11:28 -0800)]
glx: Centralize the code for context flushing.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agoglx: Add a little comment about what dri2FlushFrontBuffer() does.
Eric Anholt [Fri, 28 Dec 2012 20:13:07 +0000 (12:13 -0800)]
glx: Add a little comment about what dri2FlushFrontBuffer() does.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agoradeonsi: Handle scaled and integer formats for samplers and vertex elements.
Michel Dänzer [Tue, 5 Feb 2013 16:24:51 +0000 (17:24 +0100)]
radeonsi: Handle scaled and integer formats for samplers and vertex elements.

Also, add assertions to stress that render targets don't support scaled
formats.

20 more little piglits.

11 years agoradeonsi: Don't advertise PIPE_FORMAT_L8A8_SRGB support.
Michel Dänzer [Tue, 5 Feb 2013 16:30:56 +0000 (17:30 +0100)]
radeonsi: Don't advertise PIPE_FORMAT_L8A8_SRGB support.

The hardware can't do it.

11 years agoradeonsi: Remove incorrect (and dead) assignment in tex_fetch_args().
Michel Dänzer [Wed, 6 Feb 2013 16:14:26 +0000 (17:14 +0100)]
radeonsi: Remove incorrect (and dead) assignment in tex_fetch_args().

The proper return type is assigned at the end of the function.

11 years agoradeonsi: Use unique names for referring to texture sampling intrinsics.
Michel Dänzer [Wed, 6 Feb 2013 14:43:10 +0000 (15:43 +0100)]
radeonsi: Use unique names for referring to texture sampling intrinsics.

Append the overloaded vector type used for passing in the addressing
parameters.

Without this, LLVM uses the same function signature for all those types,
which cannot work.

Fixes problems e.g. with FlightGear and Red Eclipse.

11 years agor300g: put textures with usage=staging in GTT and make them linear
Marek Olšák [Thu, 7 Feb 2013 03:29:42 +0000 (04:29 +0100)]
r300g: put textures with usage=staging in GTT and make them linear

11 years agor600g: fix slice tile max for compressed texture and async dma
Jerome Glisse [Wed, 6 Feb 2013 18:54:02 +0000 (13:54 -0500)]
r600g: fix slice tile max for compressed texture and async dma

Was using the pixel size instead of the number of block for the slice
tile max computation which resulted in dma writing at wrong address.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agoradeonsi: use new RGBX formats
Marek Olšák [Fri, 25 Jan 2013 23:28:17 +0000 (00:28 +0100)]
radeonsi: use new RGBX formats

11 years agor300g: fix blending and alpha-test with RGBX16F and enable MSAA for it
Marek Olšák [Fri, 1 Feb 2013 20:45:15 +0000 (21:45 +0100)]
r300g: fix blending and alpha-test with RGBX16F and enable MSAA for it

11 years agor300g: use new RGBX formats
Marek Olšák [Fri, 25 Jan 2013 23:27:27 +0000 (00:27 +0100)]
r300g: use new RGBX formats

11 years agor600g: use new RGBX formats
Marek Olšák [Fri, 25 Jan 2013 23:28:00 +0000 (00:28 +0100)]
r600g: use new RGBX formats

11 years agost/mesa: use new RGBX formats
Marek Olšák [Fri, 25 Jan 2013 23:26:50 +0000 (00:26 +0100)]
st/mesa: use new RGBX formats

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: add RGBX formats for existing GL RGB texture formats
Marek Olšák [Mon, 28 Jan 2013 15:33:10 +0000 (16:33 +0100)]
mesa: add RGBX formats for existing GL RGB texture formats

v2: fix compilation of swrast

11 years agogallium: add RGBX formats for existing GL RGB texture formats
Marek Olšák [Sat, 19 Jan 2013 14:48:00 +0000 (15:48 +0100)]
gallium: add RGBX formats for existing GL RGB texture formats

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoi965/blorp: Support blits between ARGB and XRGB formats.
Kenneth Graunke [Tue, 29 Jan 2013 06:26:31 +0000 (22:26 -0800)]
i965/blorp: Support blits between ARGB and XRGB formats.

Now that we have support for overriding alpha to 1.0, we can handle
blitting between these formats in either direction.

For now, we only support two XRGB formats: MESA_FORMAT_XRGB8888 and
MESA_FORMAT_RGBX8888_REV.  Most places only appear to worry about the
former, so ignore the latter for now.  We can always add it later.

NOTE: This is a candidate for the 9.1 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Martin Steigerwald <martin@lichtvoll.de>
11 years agoi965/blorp: Support overriding destination alpha to 1.0.
Kenneth Graunke [Tue, 29 Jan 2013 06:03:18 +0000 (22:03 -0800)]
i965/blorp: Support overriding destination alpha to 1.0.

Currently, Blorp requires the source and destination formats to be
equal.  However, we'd really like to be able to blit between XRGB and
ARGB formats; our BLT engine paths have supported this for a long time.

For ARGB -> XRGB, nothing needs to occur: the missing alpha is already
interpreted as 1.0.  For XRGB -> ARGB, we need to smash the alpha
channel to 1.0 when writing the destination colors.  This is fairly
straightforward with blending.

For now, this code is never used, as the source and destination formats
still must be equal.  The next patch will relax that restriction.

NOTE: This is a candidate for the 9.1 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Martin Steigerwald <martin@lichtvoll.de>
11 years agoi965: Implement CopyTexSubImage2D via BLORP (and use it by default).
Kenneth Graunke [Wed, 16 Jan 2013 06:17:23 +0000 (22:17 -0800)]
i965: Implement CopyTexSubImage2D via BLORP (and use it by default).

The BLT engine has many limitations.  Currently, it can only blit
X-tiled buffers (since we don't have a kernel API to whack the BLT
tiling mode register), which means all depth/stencil operations get
punted to meta code, which can be very CPU-intensive.

Even if we used the BLT engine, it can't blit between buffers with
different tiling modes, such as an X-tiled non-MSAA ARGB8888 texture
and a Y-tiled CMS ARGB8888 renderbuffer.  This is a fundamental
limitation, and the only way around that is to use BLORP.

Previously, BLORP only handled BlitFramebuffer.  This patch adds an
additional frontend for doing CopyTexSubImage.  It also makes it the
default.  This is partly to increase testing and avoid hiding bugs,
and partly because the BLORP path can already handle more cases.  With
trivial extensions, it should be able to handle everything the BLT can.

This helps PlaneShift massively, which tries to CopyTexSubImage2D
between depth buffers whenever a player casts a spell.  Since these
are Y-tiled, we hit meta and software ReadPixels paths, eating 99% CPU
while delivering ~1 FPS.  This is particularly bad in an MMO setting
because people cast spells all the time.

It also helps Xonotic in 4X MSAA mode.  At default power management
settings, I measured a 6.35138% +/- 0.672548% performance boost (n=5).
(This data is from v1 of the patch.)

No Piglit regressions on Ivybridge (v3) or Sandybridge (v2).

v2: Create a fake intel_renderbuffer to wrap the destination texture
    image and then reuse do_blorp_blit rather than reimplementing most
    of it.  Remove unnecessary clipping code and conditional rendering
    check.

v3: Reuse formats_match() to centralize checks; delete temporary
    renderbuffers.  Reorganize the code.

v4: Actually copy stencil when dealing with separate stencil buffers but
    packed depth/stencil formats.  Tested by a new Piglit test.

NOTE: This is a candidate for the 9.1 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com> [v4]
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v3]
Reviewed-and-tested-by: Carl Worth <cworth@cworth.org> [v2]
Tested-by: Martin Steigerwald <martin@lichtvoll.de> [v3]
11 years agomesa: Put extern "C" guards in renderbuffer.h.
Kenneth Graunke [Tue, 29 Jan 2013 06:56:35 +0000 (22:56 -0800)]
mesa: Put extern "C" guards in renderbuffer.h.

I need to use this from C++ code.

NOTE: This is a candidate for the 9.1 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agollvmpipe: remove extraneous const qualifier
Brian Paul [Wed, 6 Feb 2013 16:16:58 +0000 (09:16 -0700)]
llvmpipe: remove extraneous const qualifier

11 years agogallium/util: remove duplicated function util_format_is_rgb_no_alpha
Marek Olšák [Fri, 25 Jan 2013 20:21:22 +0000 (21:21 +0100)]
gallium/util: remove duplicated function util_format_is_rgb_no_alpha

It only checks if alpha is present, so it's the same as util_format_has_alpha.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: get rid of GET_CURRENT_CONTEXT in st_choose_format
Marek Olšák [Thu, 24 Jan 2013 20:14:30 +0000 (21:14 +0100)]
st/mesa: get rid of GET_CURRENT_CONTEXT in st_choose_format

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: adjust texture format selection to try the closest base format first
Marek Olšák [Sat, 19 Jan 2013 13:11:08 +0000 (14:11 +0100)]
st/mesa: adjust texture format selection to try the closest base format first

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: put RGBX8 and RGBA8 in the default format lists
Marek Olšák [Thu, 24 Jan 2013 19:54:02 +0000 (20:54 +0100)]
st/mesa: put RGBX8 and RGBA8 in the default format lists

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: add the rest of RGB8 format/type combos to exact_format_mapping tables
Marek Olšák [Thu, 24 Jan 2013 19:33:29 +0000 (20:33 +0100)]
st/mesa: add the rest of RGB8 format/type combos to exact_format_mapping tables

These formats were added a few months after these tables were committed.
No idea why we have the table though. AFAIK, texstore always takes the slow path
for GL_RGBn.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: fixup inconsistent naming of RG16 formats
Marek Olšák [Thu, 24 Jan 2013 20:06:50 +0000 (21:06 +0100)]
mesa: fixup inconsistent naming of RG16 formats

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agor600g: report correct control flow depth
Marek Olšák [Thu, 31 Jan 2013 18:39:41 +0000 (19:39 +0100)]
r600g: report correct control flow depth

11 years agoglsl: fix incorrect comment about do_common_optimization
Marek Olšák [Thu, 31 Jan 2013 22:29:53 +0000 (23:29 +0100)]
glsl: fix incorrect comment about do_common_optimization

11 years agost/mesa: emit saturates in the vertex shader if Shader Model 3.0 is supported
Marek Olšák [Thu, 31 Jan 2013 21:30:44 +0000 (22:30 +0100)]
st/mesa: emit saturates in the vertex shader if Shader Model 3.0 is supported

v2: change the requirement from GLSL 1.30 to SM 3.0 (R500 can do this)

11 years agost/mesa: advertise ARB_shading_language_packing for GLSL >= 1.30
Marek Olšák [Thu, 31 Jan 2013 22:52:14 +0000 (23:52 +0100)]
st/mesa: advertise ARB_shading_language_packing for GLSL >= 1.30

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: do most of GLSL lowering outside of the optimization do-while loop
Marek Olšák [Thu, 31 Jan 2013 18:44:57 +0000 (19:44 +0100)]
st/mesa: do most of GLSL lowering outside of the optimization do-while loop

based on the intel driver

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: remove dead code depending on EmitCondCodes
Marek Olšák [Thu, 31 Jan 2013 18:43:50 +0000 (19:43 +0100)]
st/mesa: remove dead code depending on EmitCondCodes

EmitCondCodes is always false.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agor300g: try to use color varyings for texcoords if max texcoord limit is exceeded
Marek Olšák [Sat, 2 Feb 2013 05:20:25 +0000 (06:20 +0100)]
r300g: try to use color varyings for texcoords if max texcoord limit is exceeded

+35 piglits

11 years agor300/compiler: copy-propagate saturate mode when possible
Marek Olšák [Sun, 3 Feb 2013 15:54:59 +0000 (16:54 +0100)]
r300/compiler: copy-propagate saturate mode when possible

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>