mesa.git
11 years agomesa: Allow glGet* queries on EXT_texture_lod_bias data in ES 3
Matt Turner [Sun, 9 Dec 2012 01:10:50 +0000 (17:10 -0800)]
mesa: Allow glGet* queries on EXT_texture_lod_bias data in ES 3

Fixes the remaining 4 texture_lod_bias failures in es3conform.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Allow glGet* queries on EXT_framebuffer_blit data in ES 3
Matt Turner [Sun, 9 Dec 2012 01:04:42 +0000 (17:04 -0800)]
mesa: Allow glGet* queries on EXT_framebuffer_blit data in ES 3

Fixes 2 framebuffer_blit es3conform tests.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Allow glGet* queries on ARB_fragment/vertex_shader data in ES 3
Matt Turner [Sun, 9 Dec 2012 01:03:44 +0000 (17:03 -0800)]
mesa: Allow glGet* queries on ARB_fragment/vertex_shader data in ES 3

Fixes uniform_buffer_object_implementation_dependent_limits in
es3conform.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Allow glGet* queries on ARB_framebuffer_object data in ES 3
Matt Turner [Sun, 9 Dec 2012 01:02:26 +0000 (17:02 -0800)]
mesa: Allow glGet* queries on ARB_framebuffer_object data in ES 3

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Allow glGet* queries on ARB_transform_feedback2 data in ES 3
Matt Turner [Sun, 9 Dec 2012 01:01:42 +0000 (17:01 -0800)]
mesa: Allow glGet* queries on ARB_transform_feedback2 data in ES 3

Fixes the transform_feedback2_init_defaults test from es3conform.

The ES 3 spec lists these as TRANSFORM_FEEDBACK_PAUSED and
TRANSFORM_FEEDBACK_ACTIVE.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Allow glGet* queries on EXT_transform_feedback data in ES 3
Matt Turner [Sun, 9 Dec 2012 01:00:57 +0000 (17:00 -0800)]
mesa: Allow glGet* queries on EXT_transform_feedback data in ES 3

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Allow glGet* queries on ARB_sync data in ES 3
Matt Turner [Sun, 9 Dec 2012 01:00:17 +0000 (17:00 -0800)]
mesa: Allow glGet* queries on ARB_sync data in ES 3

Fixes the sync_coverage_max_server_wait_timeout test in es3conform.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Allow glGet* queries of EXT_pbo data in ES 3
Matt Turner [Sun, 9 Dec 2012 00:59:37 +0000 (16:59 -0800)]
mesa: Allow glGet* queries of EXT_pbo data in ES 3

Fixes pixel_buffer_object_default_binding and gets other tests in
es3conform closer to passing.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Allow glGet* queries of select ARB_ubo data in ES 3
Matt Turner [Sun, 9 Dec 2012 00:43:54 +0000 (16:43 -0800)]
mesa: Allow glGet* queries of select ARB_ubo data in ES 3

Fixes 5 uniform_buffer_object tests in es3conform.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoAdd ES 3 handling to get.c and get_hash_generator.py
Matt Turner [Fri, 14 Dec 2012 22:22:28 +0000 (14:22 -0800)]
Add ES 3 handling to get.c and get_hash_generator.py

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglapi: Move ARB_base_instance to the correct location
Matt Turner [Wed, 28 Nov 2012 20:03:26 +0000 (12:03 -0800)]
glapi: Move ARB_base_instance to the correct location

It's #107, it shouldn't be added after the #116 comment.

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa/tests: Add ARB_ES3_compatibility enums
Matt Turner [Thu, 29 Nov 2012 20:43:39 +0000 (12:43 -0800)]
mesa/tests: Add ARB_ES3_compatibility enums

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglapi: Add enums for ARB_ES3_compatibility
Matt Turner [Wed, 28 Nov 2012 20:12:09 +0000 (12:12 -0800)]
glapi: Add enums for ARB_ES3_compatibility

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa/program: Fix both Classic and Gallium build
Quentin Glidic [Wed, 28 Nov 2012 15:33:47 +0000 (16:33 +0100)]
mesa/program: Fix both Classic and Gallium build

Follow-up for 907844107252260c646aca361191ef7f121f3d23 and
3a5ad21cd3f026579eeacc25b39513711556c7ee

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57044
Tested-by: Fabio Pedretti <fabio.ped@libero.it>
Tested-by: Brad King <brad.king@kitware.com>
11 years agoconfigure.ac: fix typo in error message
Andreas Boll [Tue, 27 Nov 2012 09:25:54 +0000 (10:25 +0100)]
configure.ac: fix typo in error message

11 years agor300g: don't set sample positions to the pixel center if MSAA is disabled
Marek Olšák [Thu, 10 Jan 2013 14:23:56 +0000 (15:23 +0100)]
r300g: don't set sample positions to the pixel center if MSAA is disabled

but an MSAA resource is bound. This effectively makes the MSAA disable switch
not affect rasterization, but it still affects the alpha-to-one and
alpha-to-coverage states. This hardware just lacks a proper MSAA disable
switch.

This fixes graphics corruption in sauerbraten.

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

11 years agointel: Clean up confusion between logical and physical surface dimensions.
Paul Berry [Tue, 8 Jan 2013 21:30:46 +0000 (13:30 -0800)]
intel: Clean up confusion between logical and physical surface dimensions.

In most cases, the width, height, and depth of the physical surface
used by the driver to implement a texture or renderbuffer is equal to
the logical width, height, and depth exposed to the client through
functions such as glTexImage3D().  However, there are two exceptions:
cube maps (which have a physical depth of 6 but a logical depth of 1)
and multisampled renderbuffers (which have larger physical dimensions
than logical dimensions to allow multiple samples per pixel).

Previous to this patch, we accounted for the difference between
physical and logical surface dimensions at inconsistent places in the
call graph (multisampling was accounted for in
intel_miptree_create_for_renderbuffer(), and cubemaps were accounted
for in intel_miptree_create_internal()).  As a result, it wasn't
always clear, when calling a miptree creation function, whether
physical or logical dimensions were needed.  Also, we weren't
consistent about storing logical dimensions in the intel_mipmap_tree
structure (we only did so in the
intel_miptree_create_for_renderbuffer() code path, and we did not
store depth).

This patch refactors things so that intel_miptree_create_internal() is
responsible for converting logical to physical dimensions and for
storing both the physical and logical dimensions in the
intel_mipmap_tree structure.  As a result, all miptree creation
functions interpret their arguments as logical dimensions, and both
physical and logical dimensions are always available to functions that
work with intel_mipmap_trees.

In addition, it renames the fields in intel_mipmap_tree used to store
the dimensions, so that it is clear from the name whether physical or
logical dimensions are being referred to.

This should fix the following bugs:

- When creating a separate stencil surface for a depthstencil cubemap,
  we would erroneously try to convert the depth from 1 to 6 twice,
  resulting in an assertion failure.

- When creating an MCS buffer for compressed multisampling, we used
  physical dimensions instead of logical dimensions, resulting in
  wasted memory.

In addition, this should considerably simplify the implementation of
ARB_texture_multisample, because it moves the code to compute the
physical size of multisampled surfaces out of renderbuffer-only code.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agointel: Add a force_y_tiling parameter to intel_miptree_create().
Paul Berry [Tue, 8 Jan 2013 21:12:09 +0000 (13:12 -0800)]
intel: Add a force_y_tiling parameter to intel_miptree_create().

This allows intel_miptree_alloc_mcs() to force Y tiling for the MCS
buffer.  Previously we accomplished this by the hack of passing
INTEL_MSAA_LAYOUT_CMS as the msaa_layout parameter, but that parameter
is going to be going away soon.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agointel: Move compute_msaa_layout earlier in file.
Paul Berry [Tue, 8 Jan 2013 21:00:25 +0000 (13:00 -0800)]
intel: Move compute_msaa_layout earlier in file.

No functional change.  This patch moves the compute_msaa_layout()
function earlier in intel_mipmap_tree.c so that it can be used by
other functions in that file.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agor600g: Fix memory leak in r600_bytecode_add_vtx.
Vinson Lee [Wed, 9 Jan 2013 07:09:00 +0000 (08:09 +0100)]
r600g: Fix memory leak in r600_bytecode_add_vtx.

Fixes resource leak defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agor300g: optionally log MSAA resources to stderr
Marek Olšák [Wed, 9 Jan 2013 15:39:18 +0000 (16:39 +0100)]
r300g: optionally log MSAA resources to stderr

Set: RADEON_DEBUG=msaa

11 years agor300g: fix the GPU name in the renderer string
Marek Olšák [Wed, 9 Jan 2013 15:26:24 +0000 (16:26 +0100)]
r300g: fix the GPU name in the renderer string

Broken by ca474f98f2cda5cb333e9f851.

11 years agor300g: fix CS checker errors caused by emit_dsa_state
Marek Olšák [Wed, 9 Jan 2013 10:34:33 +0000 (11:34 +0100)]
r300g: fix CS checker errors caused by emit_dsa_state

size is 10 on r500 and 8 on r300

11 years agoclover: Adapt libclc's INCLUDEDIR and LIBEXECDIR to make use of the new introduced...
Johannes Obermayr [Fri, 30 Nov 2012 00:44:56 +0000 (01:44 +0100)]
clover: Adapt libclc's INCLUDEDIR and LIBEXECDIR to make use of the new introduced libclc.pc.

Tom Stellard:
  -Keep --with-libclc-path and mark it deprecated.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agoglsl: Don't add structure fields to the symbol table
Ian Romanick [Thu, 6 Dec 2012 22:57:01 +0000 (14:57 -0800)]
glsl: Don't add structure fields to the symbol table

I erroneously added this back in January 2011 in commit 88421589.
Looking at the commit message, I have no idea why I added it.  It only
added non-array structure fields to the symbol table, so array structure
fields are treated correctly.

Fixes piglit tests structure-and-field-have-same-name.vert and
structure-and-field-have-same-name-nested.vert.  It should also fix
WebGL conformance tests shader-with-non-reserved-words.

NOTE: This is a candidate for the stable release branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57622
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/fs: Fix struct vs. class in acp_entry definitions.
Kenneth Graunke [Tue, 8 Jan 2013 03:42:38 +0000 (19:42 -0800)]
i965/fs: Fix struct vs. class in acp_entry definitions.

11 years agor600g: implement buffer copying using CP DMA for R7xx, Evergreen, Cayman
Marek Olšák [Sat, 22 Dec 2012 18:33:47 +0000 (19:33 +0100)]
r600g: implement buffer copying using CP DMA for R7xx, Evergreen, Cayman

R6xx doesn't work - the issue seems to be with flushing (sometimes
the destination buffer contains garbage). There are no hangs, so we're good.

R7xx doesn't seem to have any alignment restriction despite our initial
thinking. Everything just works.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
11 years agost/mesa: fix possible MSVC build error v2
Marek Olšák [Tue, 8 Jan 2013 19:39:55 +0000 (20:39 +0100)]
st/mesa: fix possible MSVC build error v2

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

Using GLubyte as per Brian's suggestion.

11 years agoglsl: Pack flat "varyings" of mixed types together.
Paul Berry [Wed, 19 Dec 2012 00:37:52 +0000 (16:37 -0800)]
glsl: Pack flat "varyings" of mixed types together.

This patch enhances the varying packing code so that flat varyings of
uint, int, and float types can be packed together.

We accomplish this in lower_packed_varyings.cpp by making the type of
all flat varyings ivec4, and then using information-preserving type
conversions (e.g. ir_unop_bitcast_f2i) to convert all other types to
ints.

The varying_matches::compute_packing_class() function is updated to
reflect the fact that varying packing no longer needs to segregate
varyings of different base types.

Fixes piglit test varying-packing-mixed-types.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
v2: Split lower_packed_varyings_visitor::bitwise_assign into
pack/unpack variants.

11 years agoglsl: Prohibit structs and bools from being used as "varyings".
Paul Berry [Tue, 18 Dec 2012 23:24:39 +0000 (15:24 -0800)]
glsl: Prohibit structs and bools from being used as "varyings".

The GLSL 1.30 spec only allows vertex shader outputs and fragment
shader inputs ("varyings" in pre-GLSL-1.30 parlance) to be of type
int, uint, float, or vectors, matrices, or arrays thereof.  Bools,
bvec's, and structs are prohibited.  (Integral varyings were
prohibited prior to GLSL 1.30).

Previously, Mesa only performed this check on variables declared with
the "varying" keyword, and it always performed the check according to
the pre-GLSL-1.30 rules.  As a result, bools and structs were allowed
to slip through, provided they were declared using the new in/out
syntax.

This patch modifies the error check so that it occurs after "varying"
is converted to "in/out", and corrects it to properly account for GLSL
version.

Fixes piglit tests:
  in-bool-prohibited.frag
  in-bvec2-prohibited.frag
  in-bvec3-prohibited.frag
  in-bvec4-prohibited.frag
  in-struct-prohibited.frag
  out-bool-prohibited.vert
  out-bvec2-prohibited.vert
  out-bvec3-prohibited.vert
  out-bvec4-prohibited.vert
  out-struct-prohibited.vert

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Plumb through is_parameter to apply_type_qualifier_to_variable()
Paul Berry [Tue, 18 Dec 2012 22:49:34 +0000 (14:49 -0800)]
glsl: Plumb through is_parameter to apply_type_qualifier_to_variable()

This patch adds logic to allow the ast_to_hir function
apply_type_qualifier_to_variable() to tell whether it is acting on a
variable declaration or a function parameter.  This will allow it to
correctly interpret the meaning of "out" and "in" keywords (which have
different meanings in those two contexts).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Separate varying linking code to its own file.
Paul Berry [Mon, 17 Dec 2012 22:20:35 +0000 (14:20 -0800)]
glsl: Separate varying linking code to its own file.

linker.cpp is getting pretty big, and we're about to add even more
varying packing code, so split out the linker code that concerns
varyings to its own file.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Add ALIGN() macro to main/macros.h.
Paul Berry [Mon, 17 Dec 2012 21:48:21 +0000 (13:48 -0800)]
mesa: Add ALIGN() macro to main/macros.h.

Previously this macro existed in 3 separate places, some inside the
intel driver and some outside of it.  It makes more sense to have it
in main/macros.h

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Fix loop bounds detection.
Paul Berry [Tue, 8 Jan 2013 02:10:30 +0000 (18:10 -0800)]
glsl: Fix loop bounds detection.

When analyzing a loop where the loop condition is expressed in the
non-standard order (e.g. "4 > i" instead of "i < 4"), we were
reversing the condition incorrectly, leading to a loop bound that was
off by 1.

Fixes piglit tests {vs,fs}-loop-bounds-unrolled.shader_test.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agowinsys/radeon: bump the size of relocation hashlist
Marek Olšák [Tue, 8 Jan 2013 15:38:10 +0000 (16:38 +0100)]
winsys/radeon: bump the size of relocation hashlist

This should reduce the number of hash collisions in ETQW.

11 years agonvc0: catch too high GENERIC indices to prevent GRAPH traps
Christoph Bumiller [Mon, 7 Jan 2013 14:46:31 +0000 (15:46 +0100)]
nvc0: catch too high GENERIC indices to prevent GRAPH traps

11 years agonvc0: use correct resource target to select blit shader
Christoph Bumiller [Mon, 7 Jan 2013 21:12:28 +0000 (22:12 +0100)]
nvc0: use correct resource target to select blit shader

11 years agonvc0: add missing call to map edge flag in push_vbo
Christoph Bumiller [Mon, 7 Jan 2013 19:18:06 +0000 (20:18 +0100)]
nvc0: add missing call to map edge flag in push_vbo

Note: this is a candidate for the 9.0 stable branch.

11 years agonv50/ir: wrap assertion using typeid in #ifndef NDEBUG
Christoph Bumiller [Mon, 7 Jan 2013 14:50:19 +0000 (15:50 +0100)]
nv50/ir: wrap assertion using typeid in #ifndef NDEBUG

Note: this is a candidate for the 9.0 stable branch.

11 years agonvc0: fix out of bounds writes for unaligned sizes in push_data
Christoph Bumiller [Tue, 8 Jan 2013 12:46:24 +0000 (13:46 +0100)]
nvc0: fix out of bounds writes for unaligned sizes in push_data

11 years agonouveau: increase max order of suballocated buffers by 1
Christoph Bumiller [Tue, 8 Jan 2013 11:35:25 +0000 (12:35 +0100)]
nouveau: increase max order of suballocated buffers by 1

This is really a hack to make TF2 (considerably, up to 20 -> 70 fps
at low res) faster.

11 years agonouveau: improve buffer transfers
Christoph Bumiller [Tue, 8 Jan 2013 15:13:11 +0000 (16:13 +0100)]
nouveau: improve buffer transfers

Save double memcpy on uploads to VRAM in most cases.
Properly handle FLUSH_EXPLICIT.
Reallocate on DISCARD_WHOLE_RESOURCE to avoid sync.

11 years agor300g: fix assertion failure in emit_dsa_state
Marek Olšák [Tue, 8 Jan 2013 13:32:41 +0000 (14:32 +0100)]
r300g: fix assertion failure in emit_dsa_state

Broken by 8ed6b1400bc8a78f46340f41aaf2e88b24c23267.

11 years agoi965: Support GL_FIXED and packed vertex formats natively on Haswell+.
Kenneth Graunke [Fri, 4 Jan 2013 15:53:12 +0000 (07:53 -0800)]
i965: Support GL_FIXED and packed vertex formats natively on Haswell+.

Haswell and later support the GL_FIXED and 2_10_10_10_rev vertex formats
natively, and don't need shader workarounds.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Add #defines for GL_FIXED vertex formats.
Kenneth Graunke [Fri, 4 Jan 2013 15:53:11 +0000 (07:53 -0800)]
i965: Add #defines for GL_FIXED vertex formats.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Add remaining #defines for packed vertex formats.
Kenneth Graunke [Fri, 4 Jan 2013 15:53:10 +0000 (07:53 -0800)]
i965: Add remaining #defines for packed vertex formats.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Use Haswell's sample_d_c for textureGrad with shadow samplers.
Kenneth Graunke [Fri, 4 Jan 2013 15:53:09 +0000 (07:53 -0800)]
i965: Use Haswell's sample_d_c for textureGrad with shadow samplers.

The new hardware actually just supports this now.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965/fs: Remove dead code from generate_uniform_pull_constant_load_gen7.
Kenneth Graunke [Mon, 7 Jan 2013 07:35:22 +0000 (23:35 -0800)]
i965/fs: Remove dead code from generate_uniform_pull_constant_load_gen7.

generate_uniform_pull_constant_load_gen7() is only called on Gen7+, so
the gen < 6 code is dead.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: Drop mmx optimizations on Haiku
Alexander von Gluck IV [Sun, 6 Jan 2013 22:09:35 +0000 (16:09 -0600)]
mesa: Drop mmx optimizations on Haiku

* Prevents compatibility problems. As Haiku
  doesn't use rtasm anymore, it's kind of
  pointless.

11 years agomesa: Don't use rtasm for Haiku swrast
Alexander von Gluck IV [Sun, 6 Jan 2013 22:06:37 +0000 (16:06 -0600)]
mesa: Don't use rtasm for Haiku swrast

* We have a symbol conflict as rtasm in
  Mesa collides with rtasm in gallium.
* As us linking gallium and mesa together
  is an edge case, lets just omit the rtasm
  code from Mesa as we should be going
  llvmpipe soon :)

11 years agor600g: set the virtual address for the htile buffer
Alex Deucher [Mon, 7 Jan 2013 20:21:46 +0000 (15:21 -0500)]
r600g: set the virtual address for the htile buffer

Fixes cayman and TN with htile enabled.  Should fix:
https://bugs.freedesktop.org/show_bug.cgi?id=59089
https://bugs.freedesktop.org/show_bug.cgi?id=58667
Possibly others.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agoradeon/winsys: move radeon family/class identification to winsys
Jerome Glisse [Fri, 4 Jan 2013 21:34:52 +0000 (16:34 -0500)]
radeon/winsys: move radeon family/class identification to winsys

Upcoming async dma support rely on winsys knowing about GPU families.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agor600g/radeon/winsys: indentation cleanup
Jerome Glisse [Fri, 4 Jan 2013 16:46:13 +0000 (11:46 -0500)]
r600g/radeon/winsys: indentation cleanup

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agor600g: flush FMASK and CMASK at the end of CS
Marek Olšák [Sun, 6 Jan 2013 19:28:03 +0000 (20:28 +0100)]
r600g: flush FMASK and CMASK at the end of CS

11 years agor300g: implement MSAA
Marek Olšák [Sat, 5 Jan 2013 05:21:49 +0000 (06:21 +0100)]
r300g: implement MSAA

This is not as optimized as r600g - the MSAA compression is missing,
so r300g needs a lot of bandwidth (more than r600g to do the same thing).
However, if the bandwidth is not an issue for you, you can enjoy this
unoptimized MSAA support.
The only other missing optimization for MSAA is the fast color clear.

MSAA is enabled on r500 only, because that's the only GPU family I tested.
That said, MSAA should work on r300 and r400 as well (but you must set
RADEON_MSAA=1 to allow it, then turn MSAA on in your app or set GALLIUM_MSAA=n,
n >= 2, n <= 6)
I will enable the support by default on r300-r400 once someone (other than me)
tests those chipsets with piglit.

The supported modes are 2x, 4x, 6x.

The supported MSAA formats are RGBA8, BGRA8, and RGBA16F (r500 only).
Those 3 formats are used for all GL internal formats.

Tested with piglit. (I have ported all MSAA tests to GL2.1)

11 years agor300g: simplify DSA state, add ability to patch FG_ALPHA_FUNC while emitting
Marek Olšák [Sun, 6 Jan 2013 00:47:24 +0000 (01:47 +0100)]
r300g: simplify DSA state, add ability to patch FG_ALPHA_FUNC while emitting

Preparation for MSAA and alpha-to-coverage.

11 years agor300g/compiler: add shader emulation for the alpha_to_one state
Marek Olšák [Sat, 5 Jan 2013 23:31:55 +0000 (00:31 +0100)]
r300g/compiler: add shader emulation for the alpha_to_one state

11 years agoconfigure.ac: Remove space after indent -T flag.
Vinson Lee [Mon, 31 Dec 2012 23:19:43 +0000 (15:19 -0800)]
configure.ac: Remove space after indent -T flag.

Fixes this build error on platforms not using GNU indent.

indent: Command line: ``-T'' requires a parameter

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agointel: Fix copy-and-paste bug setting gl_constants::MaxSamples
Ian Romanick [Fri, 30 Nov 2012 22:29:49 +0000 (14:29 -0800)]
intel: Fix copy-and-paste bug setting gl_constants::MaxSamples

gl_constants::MaxSamples is an integer, so setting it to 1.0 is just
silly.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: Disallow R, RG, or RGB integer and unsigned formats in OpenGL ES 3.0
Ian Romanick [Mon, 3 Dec 2012 19:55:12 +0000 (11:55 -0800)]
mesa: Disallow R, RG, or RGB integer and unsigned formats in OpenGL ES 3.0

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: Disallow SNORM formats for renderbuffers in OpenGL ES
Ian Romanick [Tue, 4 Dec 2012 18:36:10 +0000 (10:36 -0800)]
mesa: Disallow SNORM formats for renderbuffers in OpenGL ES

v2: Move {RED,RG,RGB,RGBA}_SNORM changes from the previous commit to
this commit.  Based on suggestions from Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: Disallow deprecated SNORM formats for renderbuffers
Ian Romanick [Sat, 1 Dec 2012 19:06:48 +0000 (11:06 -0800)]
mesa: Disallow deprecated SNORM formats for renderbuffers

The OpenGL 3.2 core profile spec says:

    "The following base internal formats from table 3.11 are
    color-renderable: RED, RG, RGB, and RGBA. The sized internal formats
    from table 3.12 that have a color-renderable base internal format
    are also color-renderable. No other formats, including compressed
    internal formats, are color-renderable."

The OpenGL 3.2 compatibility profile spec says (only ALPHA is added):

    "The following base internal formats from table 3.16 are
    color-renderable: ALPHA, RED, RG, RGB, and RGBA. The sized internal formats
    from table 3.17 that have a color-renderable base internal format
    are also color-renderable. No other formats, including compressed
    internal formats, are color-renderable."

Table 3.12 in the core profile spec and table 3.17 in the compatibility
profile spec list SNORM formats as having a base internal format of RED,
RG, RGB, or RGBA.  From this we infer that they should also be color
renderable.

The OpenGL ES 3.0 spec says:

    "An internal format is color-renderable if it is one of the formats
    from table 3.12 noted as color-renderable or if it is unsized format
    RGBA or RGB. No other formats, including compressed internal
    formats, are color-renderable."

In the OpenGL ES 3.0 spec, none of the SNORM formats have "color-
renderable" marked in table 3.12.  The RGB I and UI formats also are not
color-renderable in ES3, but we'll save that change for another patch.

Both NVIDIA's closed-source driver (version 304.64) and AMD's
closed-source driver (Catalyst 12.6 on HD 3650) reject *all* SNORM
formats for renderbuffers in OpenGL 3.3 compatibility profiles.

v2: Move {RED,RG,RGB,RGBA}_SNORM changes from the this commit to the
next commit.  Based on suggestions from Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoutil: fix addressing bug in pipe_put_tile_z() for PIPE_FORMAT_Z32_FLOAT
Brian Paul [Thu, 3 Jan 2013 15:04:50 +0000 (08:04 -0700)]
util: fix addressing bug in pipe_put_tile_z() for PIPE_FORMAT_Z32_FLOAT

The Z32 pixel is 4 bytes so multiply x by 4, not 2.

Note: This is a candidate for the stable branches.

11 years agoutil: add get/put_tile_z() support for PIPE_FORMAT_Z32_FLOAT_S8X24_UINT
Brian Paul [Thu, 3 Jan 2013 15:02:57 +0000 (08:02 -0700)]
util: add get/put_tile_z() support for PIPE_FORMAT_Z32_FLOAT_S8X24_UINT

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

Note: This is a candidate for the stable branches.

11 years agogallivm: support more immediates in lp_build_tgsi_info()
Brian Paul [Wed, 2 Jan 2013 20:46:20 +0000 (13:46 -0700)]
gallivm: support more immediates in lp_build_tgsi_info()

Bump limit from 32 to 128.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=58545

11 years agoxlib: allow GLX_DONT_CARE for glXChooseFBConfig() attribute values
Brian Paul [Fri, 4 Jan 2013 00:31:22 +0000 (17:31 -0700)]
xlib: allow GLX_DONT_CARE for glXChooseFBConfig() attribute values

Fixes piglit glx-dont-care-mask test.

Note: This is a candidate for the stable branches.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agost/glx: allow GLX_DONT_CARE for glXChooseFBConfig() attribute values
Brian Paul [Fri, 4 Jan 2013 00:30:34 +0000 (17:30 -0700)]
st/glx: allow GLX_DONT_CARE for glXChooseFBConfig() attribute values

Fixes piglit glx-dont-care-mask test.

Note: This is a candidate for the stable branches.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoradeon/llvm: Remove backend code from Mesa
Tom Stellard [Fri, 4 Jan 2013 15:38:37 +0000 (15:38 +0000)]
radeon/llvm: Remove backend code from Mesa

This code now lives in an external tree.

For the next Mesa release fetch the code from the master branch
of this LLVM repo:
http://cgit.freedesktop.org/~tstellar/llvm/

For all subsequent Mesa releases, fetch the code from the official LLVM
project:
www.llvm.org

11 years agoSupport LLVM >= 3.2 on radeonsi and opencl.
Johannes Obermayr [Thu, 20 Dec 2012 19:56:17 +0000 (20:56 +0100)]
Support LLVM >= 3.2 on radeonsi and opencl.

Tom Stellard:
 - Backend now has same name for all LLVM versions
 - Add missing LLVM_VERSION_INT definition

11 years agoclover: Fix build after the addition of enum pipe_flush_flags
Tom Stellard [Fri, 4 Jan 2013 15:47:53 +0000 (15:47 +0000)]
clover: Fix build after the addition of enum pipe_flush_flags

Broken since commit 598cc1f74d7ae924e84dee801b456ab7b0b22f84

11 years agor300g: don't check for vertex and index buffer bind flags
Marek Olšák [Wed, 2 Jan 2013 19:28:10 +0000 (20:28 +0100)]
r300g: don't check for vertex and index buffer bind flags

11 years agor300g/swtcl: use memcpy to emit indices
Marek Olšák [Fri, 4 Jan 2013 19:07:06 +0000 (20:07 +0100)]
r300g/swtcl: use memcpy to emit indices

11 years agor300g/swtcl: simplify vertex uploading
Marek Olšák [Fri, 4 Jan 2013 17:00:46 +0000 (18:00 +0100)]
r300g/swtcl: simplify vertex uploading

- skip the vertex buffer reallocation in flush and just use
  the unsynchronized flag to get new memory.
- remove the cruft needed to get around the issues with the vertex buffer
  reallocation in flush
- use pb_buffer instead of pipe_resource

11 years agor300g/swtcl: fix crash when setting vertex buffers
Marek Olšák [Fri, 4 Jan 2013 17:27:21 +0000 (18:27 +0100)]
r300g/swtcl: fix crash when setting vertex buffers

Broken by e73bf3b805de78299f1a652668ba4e6eab9bac94.

11 years agor300g: don't set PIPE_BIND flags for internal textures
Marek Olšák [Wed, 2 Jan 2013 19:23:57 +0000 (20:23 +0100)]
r300g: don't set PIPE_BIND flags for internal textures

11 years agoi965: Fix glCompressedTexSubImage2D offsets for ETC textures.
Paul Berry [Sat, 29 Dec 2012 19:31:37 +0000 (11:31 -0800)]
i965: Fix glCompressedTexSubImage2D offsets for ETC textures.

This patch fixes intel_miptree_unmap_etc() (which decompresses ETC
textures to linear) to pay attention to map->x and map->y when writing
to the destination image.  Previously these values were ignored,
causing the xoffset and yoffset parameters passed to
glCompressedTexSubImage2D() to be ignored.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoegl/wayland: Remove kooky flush code
Kristian Høgsberg [Fri, 14 Dec 2012 04:32:51 +0000 (23:32 -0500)]
egl/wayland: Remove kooky flush code

We used to have to jump through hoops to call glFlush at swap buffer time,
but the flush extension made that unnecessary a long time ago.

11 years agoegl/wayland: Remove confusing comment about front buffer rendering
Kristian Høgsberg [Fri, 14 Dec 2012 04:21:46 +0000 (23:21 -0500)]
egl/wayland: Remove confusing comment about front buffer rendering

11 years agoegl_dri2: Remove unused struct dri2_egl_buffer from header file
Kristian Høgsberg [Fri, 14 Dec 2012 04:20:16 +0000 (23:20 -0500)]
egl_dri2: Remove unused struct dri2_egl_buffer from header file

11 years agoegl: Add extension infrastructure for EGL_EXT_buffer_age
Kristian Høgsberg [Thu, 13 Dec 2012 20:59:24 +0000 (15:59 -0500)]
egl: Add extension infrastructure for EGL_EXT_buffer_age

11 years agoegl: Update to revision 19987 of eglext.h
Kristian Høgsberg [Fri, 14 Dec 2012 04:44:09 +0000 (23:44 -0500)]
egl: Update to revision 19987 of eglext.h

This pulls in EGL_EXT_buffer_age.

11 years agoutil: move var declaration before loop to fix MSVC error
Brian Paul [Fri, 4 Jan 2013 15:21:12 +0000 (08:21 -0700)]
util: move var declaration before loop to fix MSVC error

11 years agor600g: implement 3D transfers
Marek Olšák [Thu, 20 Dec 2012 02:45:49 +0000 (03:45 +0100)]
r600g: implement 3D transfers

That means we can map and read multiple slices with one transfer_map call.

11 years agost/mesa: fix assertion failures with 2101010 vertex formats
Marek Olšák [Thu, 20 Dec 2012 16:00:06 +0000 (17:00 +0100)]
st/mesa: fix assertion failures with 2101010 vertex formats

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: accelerate CopyTexSubImage for 1D array textures
Marek Olšák [Thu, 20 Dec 2012 15:40:33 +0000 (16:40 +0100)]
st/mesa: accelerate CopyTexSubImage for 1D array textures

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: fix CopyTexSubImage fallback for 1D array textures
Marek Olšák [Thu, 20 Dec 2012 14:15:15 +0000 (15:15 +0100)]
st/mesa: fix CopyTexSubImage fallback for 1D array textures

- We should use a 3D transfer of size Width x 1 x NumLayers.
- We should use layer_stride instead of stride.
  (even though they are likely to be equal with 1D array textures)

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: fix GetTexImage for compressed 2D array textures
Marek Olšák [Thu, 20 Dec 2012 02:54:33 +0000 (03:54 +0100)]
st/mesa: fix GetTexImage for compressed 2D array textures

This uses a 3D blit to decompress the texture and then a 3D transfer
to read it.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/util: remove unused helper util_create_rgba_texture
Marek Olšák [Thu, 20 Dec 2012 01:33:45 +0000 (02:33 +0100)]
gallium/util: remove unused helper util_create_rgba_texture

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: try to find the format matching format+type in decompressed_with_blit
Marek Olšák [Thu, 20 Dec 2012 01:09:56 +0000 (02:09 +0100)]
st/mesa: try to find the format matching format+type in decompressed_with_blit

There was the fast path based on _mesa_format_matches_format_and_type
for GetTexImage, but it never worked, because the Mesa format we were testing
there was always compressed. Further testing showed that the fast path
had been completely broken.

In this commit, the somewhat limited helper util_create_rgba_texture is
no longer used and instead, custom code for the texture creation is added,
which tries to find the best matching RGBA8 format, so that we can hit
the fast path *always* if the read format is a variant of RGBA8 and supported
by the driver.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: fix GetTexImage for compressed cubemaps
Marek Olšák [Thu, 20 Dec 2012 00:41:57 +0000 (01:41 +0100)]
st/mesa: fix GetTexImage for compressed cubemaps

I'll deal with 2D arrays later.

NOTE: This is a candidate for the stable branches.

11 years agogallium/u_blitter: implement 3D blitting
Marek Olšák [Thu, 20 Dec 2012 02:43:57 +0000 (03:43 +0100)]
gallium/u_blitter: implement 3D blitting

Scaling and flipping in the Z direction isn't allowed yet.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/u_blitter: fix blitting TEXTURE_CUBE_ARRAY with a non-zero cube index
Marek Olšák [Thu, 20 Dec 2012 12:08:00 +0000 (13:08 +0100)]
gallium/u_blitter: fix blitting TEXTURE_CUBE_ARRAY with a non-zero cube index

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/u_blitter: minor simplification
Marek Olšák [Thu, 20 Dec 2012 02:42:11 +0000 (03:42 +0100)]
gallium/u_blitter: minor simplification

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/u_blitter: unify some parameters into a dstbox parameter in blit_generic
Marek Olšák [Wed, 19 Dec 2012 22:06:51 +0000 (23:06 +0100)]
gallium/u_blitter: unify some parameters into a dstbox parameter in blit_generic

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/u_blitter: remove useless parameter from blitter_default_dst_texture
Marek Olšák [Wed, 19 Dec 2012 21:25:22 +0000 (22:25 +0100)]
gallium/u_blitter: remove useless parameter from blitter_default_dst_texture

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/util: complete implementation of util_dump_transfer
Marek Olšák [Thu, 20 Dec 2012 14:07:35 +0000 (15:07 +0100)]
gallium/util: complete implementation of util_dump_transfer

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: allow TEXTURE_CUBE_MAP_ARRAY in GetTexImage
Marek Olšák [Thu, 20 Dec 2012 02:57:39 +0000 (03:57 +0100)]
mesa: allow TEXTURE_CUBE_MAP_ARRAY in GetTexImage

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/radeon: send the END_OF_FRAME flag to the DRM
Marek Olšák [Fri, 21 Dec 2012 16:15:56 +0000 (17:15 +0100)]
gallium/radeon: send the END_OF_FRAME flag to the DRM

11 years agogallium: extend pipe_context::flush for it to accept an END_OF_FRAME flag
Marek Olšák [Fri, 21 Dec 2012 16:03:22 +0000 (17:03 +0100)]
gallium: extend pipe_context::flush for it to accept an END_OF_FRAME flag

Usage with pipe_context:
  pipe->flush(pipe, NULL, PIPE_FLUSH_END_OF_FRAME);

Usage with st_context_iface:
  st->flush(st, ST_FLUSH_END_OF_FRAME, NULL);

The flag is only a hint for drivers. Radeon will use it for buffer eviction
heuristics in the kernel (e.g. for queries like how many frames have passed
since a buffer was used).

The flag is currently only generated by st/dri on SwapBuffers.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
11 years agoradeonsi: fix int->bool conversion in fence_signalled
Marek Olšák [Fri, 4 Jan 2013 11:40:33 +0000 (12:40 +0100)]
radeonsi: fix int->bool conversion in fence_signalled