mesa.git
12 years agomesa: Remove remaining FEATURE_ARB_vertex_buffer_object guards.
Mathias Fröhlich [Tue, 27 Dec 2011 09:45:46 +0000 (10:45 +0100)]
mesa: Remove remaining FEATURE_ARB_vertex_buffer_object guards.

Since commit 82b9661894315362f857192439bdcbc9db090387 and
34eae1c72a9b3a8eb0634cda52fca0208cd2f40d vbo support
is mandatory for all drivers. So, remove the remaining
FEATURE_ARB_vertex_buffer_object guards.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
12 years agomesa: Convert to use GLbitfield64 directly.
Mathias Fröhlich [Thu, 22 Dec 2011 19:12:20 +0000 (20:12 +0100)]
mesa: Convert to use GLbitfield64 directly.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmare.com>
12 years agoradeon: Convert to use GLbitfield64 directly.
Mathias Fröhlich [Thu, 22 Dec 2011 19:12:20 +0000 (20:12 +0100)]
radeon: Convert to use GLbitfield64 directly.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmare.com>
12 years agonouveau: Convert to use GLbitfield64 directly.
Mathias Fröhlich [Thu, 22 Dec 2011 19:12:20 +0000 (20:12 +0100)]
nouveau: Convert to use GLbitfield64 directly.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmare.com>
12 years agoi915: Convert to use GLbitfield64 directly.
Mathias Fröhlich [Thu, 22 Dec 2011 19:12:20 +0000 (20:12 +0100)]
i915: Convert to use GLbitfield64 directly.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmare.com>
12 years agomesa: Convert RENDERINPUTS* macros to GLbitfield64.
Mathias Fröhlich [Thu, 22 Dec 2011 19:12:20 +0000 (20:12 +0100)]
mesa: Convert RENDERINPUTS* macros to GLbitfield64.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmare.com>
12 years agoi915g: Only apply the optimization to output vars.
Stéphane Marchesin [Fri, 23 Dec 2011 02:17:54 +0000 (18:17 -0800)]
i915g: Only apply the optimization to output vars.

This is a bit overkill, but otherwise we need to rename subsequent uses, which is a future TODO.
Reported by CME.

12 years agoi965/vs: Properly clear cur_value when propagating direct copies.
Kenneth Graunke [Sat, 24 Dec 2011 04:24:46 +0000 (20:24 -0800)]
i965/vs: Properly clear cur_value when propagating direct copies.

Consider the following code:

MOV A.x, B.x
MOV B.x, C.x

After the first line, cur_value[A][0] == B, indicating that A.x's
current value came from register B.

When processing the second line, we update cur_value[B][0] to C.
However, for drect copies, we fail to reset cur_value[A][0] to NULL.
This is necessary because the value of A is no longer the value of B.

Fixes Counter-Strike: Source in Wine (where the menu rendered completely
black in DX9 mode), completely white textures in Civilization V, and the
new Piglit test glsl-vs-copy-propagation-1.shader_test.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42032
Tested-by: Matt Turner <mattst88@gmail.com>
Tested-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965/vs: Fix incorrect subscript when resetting copy propagation records.
Kenneth Graunke [Sat, 24 Dec 2011 03:57:08 +0000 (19:57 -0800)]
i965/vs: Fix incorrect subscript when resetting copy propagation records.

In this code, 'i' loops over the number of virtual GRFs, while 'j' loops
over the number of vector components (0 <= j <= 3).

It can't possibly be correct to see if bit 'i' is set in the destination
writemask, as it will have values much larger than 3.  Clearly this is
supposed to be 'j'.

Found by inspection.

Tested-by: Matt Turner <mattst88@gmail.com>
Tested-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Create mock implementation of GL_OES_EGL_image_external
Chad Versace [Thu, 22 Dec 2011 02:34:19 +0000 (18:34 -0800)]
i965: Create mock implementation of GL_OES_EGL_image_external

In Android IceCreamSandwich, SurfaceFlinger requires GL_OES_image_external
for basic compositing tasks. Without the extension, SurfaceFlinger fails
to start.

Despite the incompleteness of the extension's implementation introduced by
this patch, it is good enough to enable SurfaceFlinger and to unblock the
people who need to begin testing Mesa on IceCreamSandwich.

To enable the extension, set the environment variable
MESA_EXTENSION_OVERRIDE="+GL_OES_EGL_image_external". Ideally, Android
should set this in init.rc.

WARNING: This implementation of GL_OES_EGL_image_external is not complete.
Some of it is even incorrect. When we begin to really implement
GL_OES_EGL_image_external, much of the patch will need reverting.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
12 years agometa: Disable GL_TEXTURE_EXTERNAL_OES in meta_begin()
Chad Versace [Thu, 22 Dec 2011 02:34:18 +0000 (18:34 -0800)]
meta: Disable GL_TEXTURE_EXTERNAL_OES in meta_begin()

If the meta flag MESA_META_TEXTURE is present, then disable the texture
target GL_TEXTURE_EXTERNAL_OES.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
12 years agomklib: tab cleanup, no functional change
Alexander von Gluck [Tue, 27 Dec 2011 16:18:18 +0000 (09:18 -0700)]
mklib: tab cleanup, no functional change

Reviewed-by: Brian Paul <brianp@vmare.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agomesa: fpclassify is available on Haiku
Alexander von Gluck [Tue, 27 Dec 2011 16:15:36 +0000 (09:15 -0700)]
mesa: fpclassify is available on Haiku

Reviewed-by: Brian Paul <brianp@vmare.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agoglu: remove BeOS define as BeOS is not longer a target platform
Alexander von Gluck [Tue, 27 Dec 2011 16:11:39 +0000 (09:11 -0700)]
glu: remove BeOS define as BeOS is not longer a target platform

Reviewed-by: Brian Paul <brianp@vmare.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agogallium: use Mesa pthread_barrier_t on Haiku, as it is incomplete under Haiku
Alexander von Gluck [Tue, 27 Dec 2011 16:02:59 +0000 (09:02 -0700)]
gallium: use Mesa pthread_barrier_t on Haiku, as it is incomplete under Haiku

Reviewed-by: Brian Paul <brianp@vmare.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agogallium/u_pack: fix l8/i8 pack color ub
Dave Airlie [Sat, 24 Dec 2011 19:30:26 +0000 (19:30 +0000)]
gallium/u_pack: fix l8/i8 pack color ub

just noticed this in passing, not sure it actually fixes any issus.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmare.com>
12 years agovbo: Clean up recalculate_input_bindings.
Mathias Fröhlich [Tue, 1 Nov 2011 10:53:46 +0000 (11:53 +0100)]
vbo: Clean up recalculate_input_bindings.

Now the gl_array_object's layout matches the one used in
recalculate_input_bindings. Make use of this and remove the
bind_array_obj function.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmare.com>
12 years agomklib: Add Haiku build support
Alexander von Gluck [Mon, 26 Dec 2011 23:23:03 +0000 (16:23 -0700)]
mklib: Add Haiku build support

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agoFix build with LLVM >= r145623.
Johannes Obermayr [Mon, 19 Dec 2011 22:11:46 +0000 (23:11 +0100)]
Fix build with LLVM >= r145623.

This is a workaround for https://bugs.freedesktop.org/show_bug.cgi?id=43861.

Actually the issue which makes -pedantic failing should be solved.

Reviewed-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agoswrast: assert _swrast_map_teximage() x, y is multiple of block size
Brian Paul [Mon, 26 Dec 2011 21:49:57 +0000 (14:49 -0700)]
swrast: assert _swrast_map_teximage() x, y is multiple of block size

12 years agoswrast: replace assertion with conditional in _swrast_map_teximage()
Brian Paul [Mon, 26 Dec 2011 21:49:57 +0000 (14:49 -0700)]
swrast: replace assertion with conditional in _swrast_map_teximage()

Just in case we ran out of memory when trying to allocate the texture
memory.

12 years agomesa: fix signed/unsigned comparison warnings
Brian Paul [Mon, 26 Dec 2011 21:45:42 +0000 (14:45 -0700)]
mesa: fix signed/unsigned comparison warnings

12 years agovbo: signal _NEW_ARRAY when transitioning between glBegin/End, glDrawArrays
Brian Paul [Mon, 26 Dec 2011 21:43:07 +0000 (14:43 -0700)]
vbo: signal _NEW_ARRAY when transitioning between glBegin/End, glDrawArrays

This fixes a regression seen with the isosurf demo when switching between
glBegin/End and glDrawArrays (do it several times).  The problem was the
driver wasn't getting _NEW_ARRAY when the arrays were subtly changed:
(vertex3f, normal3f) vs. (normal3f, vertex3f).

This patch fixes that by signaling _NEW_ARRAY whenever we transition
between glBegin/End and glDrawArrays mode and display lists.

The patch also fixes up the initialization of the map_vp_none[] array
to stop putting strange values in the last five elements of the array.

v2: remove DRAW_ELEMENTS, don't distinguish between glDrawArrays and
glDrawElements

v3: add DRAW_DISPLAY_LIST for the display list case, just to be safe.

Reviewed-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Tested-by: Mathias Froehlich <Mathias.Froehlich@web.de>
12 years agomesa: remove leftovers from color indexed rendering.
Mathias Fröhlich [Mon, 26 Dec 2011 20:45:56 +0000 (21:45 +0100)]
mesa: remove leftovers from color indexed rendering.

Remove gl_light::_dli and gl_light::_sli.
Both are only used for a value previously used in
color indexed rendering. Also both variables are only used
and never written.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
12 years agomesa: remove unused _mesa_copy_materials.
Mathias Fröhlich [Mon, 26 Dec 2011 20:45:56 +0000 (21:45 +0100)]
mesa: remove unused _mesa_copy_materials.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
12 years agovl: call decode_bitstream only once
Christian König [Thu, 22 Dec 2011 14:24:46 +0000 (15:24 +0100)]
vl: call decode_bitstream only once

Submit all bitstreams at once to decode_bitstream.

Signed-off-by: Christian König <deathsimple@vodafone.de>
Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
12 years agoi965: increase the brw eu instruction store size dynamically
Yuanhan Liu [Wed, 21 Dec 2011 07:38:44 +0000 (15:38 +0800)]
i965: increase the brw eu instruction store size dynamically

Here is the final patch to enable dynamic eu instruction store size:
increase the brw eu instruction store size dynamically instead of just
allocating it statically with a constant limit. This would fix something
that 'GL_MAX_PROGRAM_INSTRUCTIONS_ARB was 16384 while the driver would
limit it to 10000'.

v2: comments from ken, do not hardcode the eu limit to (1024 * 1024)

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: call next_insn() before referencing a instruction by index
Yuanhan Liu [Wed, 21 Dec 2011 07:32:02 +0000 (15:32 +0800)]
i965: call next_insn() before referencing a instruction by index

A single next_insn may change the base address of instruction store
memory(p->store), so call it first before referencing the instruction
store pointer from an index.

This the final prepare work to enable the dynamic store size.

v2: comments from Ken, define emit_endif as bool type

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: get the jmp distance by instruction index
Yuanhan Liu [Wed, 21 Dec 2011 07:10:40 +0000 (15:10 +0800)]
i965: get the jmp distance by instruction index

If dynamic instruction store size is enabled, while after the brw_JMPI()
and before the brw_land_fwd_jump() function, the eu instruction store
base address(p->store) may change. Thus, the safe way to reference the
jmp instruction is by index instead of by the instruction address.

v2: comments from Eric, don't change the prototype of brw_JMPI

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: let the if_stack just store the instruction index
Yuanhan Liu [Wed, 21 Dec 2011 06:51:59 +0000 (14:51 +0800)]
i965: let the if_stack just store the instruction index

If dynamic instruction store size is enabled, while after
the brw_IF/ELSE() and before the brw_ENDIF() function, the
eu instruction store base address(p->store) may change.

Thus let if_stack just store the instruction index. This is
somehow more flexible and safe than store the instruction
memory address.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agor600g: fix a warning that a variable may be uninitialized
Marek Olšák [Sun, 25 Dec 2011 08:37:06 +0000 (09:37 +0100)]
r600g: fix a warning that a variable may be uninitialized

12 years agogallium: remove PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_ATTRIBS
Marek Olšák [Sat, 17 Dec 2011 20:09:30 +0000 (21:09 +0100)]
gallium: remove PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_ATTRIBS

It's the same as PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agost/mesa: use a cast wrapper function to get st_transform_feedback_object
Marek Olšák [Sun, 25 Dec 2011 08:28:22 +0000 (09:28 +0100)]
st/mesa: use a cast wrapper function to get st_transform_feedback_object

12 years agost/mesa: DrawTFB should use the vertex count from the last call of EndTFB
Marek Olšák [Sat, 17 Dec 2011 13:41:43 +0000 (14:41 +0100)]
st/mesa: DrawTFB should use the vertex count from the last call of EndTFB

From ARB_transform_feedback2:
    ... the vertex count used for the rendering operation is
    set by the previous EndTransformFeedback command.

12 years agor300g: mapping buffers for read should be unsynchronized
Marek Olšák [Sat, 24 Dec 2011 10:43:10 +0000 (11:43 +0100)]
r300g: mapping buffers for read should be unsynchronized

The GPU never uses them for write.

12 years agowinsys/radeon: move managing GEM domains back to drivers
Marek Olšák [Sat, 24 Dec 2011 07:15:40 +0000 (08:15 +0100)]
winsys/radeon: move managing GEM domains back to drivers

This partially reverts commit 363ff844753c46ac9c13866627e096b091ea81f8.

It caused severe performance drops in Nexuiz. Reported by Phoronix.

Tested by me on r300g and by IRC people on r600g.

12 years agoi965 gen6: Fix incorrect order of dwords in gen6_update_sol_indices()
Paul Berry [Fri, 23 Dec 2011 21:56:07 +0000 (13:56 -0800)]
i965 gen6: Fix incorrect order of dwords in gen6_update_sol_indices()

When updating SOL indices, we were accidentally putting the starting
index in dword 1 and the SVBI number to increment in dword 2--these
should be reversed.  Usually both of these values are zero, so we
didn't see any problem.  However, if a transform feedback operation
spans multiple batch buffers, the starting index will be nonzero.

Fixes piglit test "EXT_transform_feedback/intervening-read output".

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965 gen6: Fix transform feedback of triangle strips.
Paul Berry [Fri, 23 Dec 2011 15:57:01 +0000 (07:57 -0800)]
i965 gen6: Fix transform feedback of triangle strips.

When rendering triangle strips, vertices come down the pipeline in the
order specified, even though this causes alternate triangles to have
reversed winding order.  For example, if the vertices are ABCDE, then
the GS is invoked on triangles ABC, BCD, and CDE, even though this
means that triangle BCD is in the reverse of the normal winding order.
The hardware automatically flags the triangles with reversed winding
order as _3DPRIM_TRISTRIP_REVERSE, so that face culling and two-sided
coloring can be adjusted to account for the reversed order.

In order to ensure that winding order is correct when streaming
vertices out to a transform feedback buffer, we need to alter the
ordering of BCD to BDC when the first provoking vertex convention is
in use, and to CBD when the last provoking vertex convention is in
use.

To do this, we precompute an array of indices indicating where each
vertex will be placed in the transform feedback buffer; normally this
is SVBI[0] + (0, 1, 2), indicating that vertex order should be
preserved.  When the primitive type is _3DPRIM_TRISTRIP_REVERSE, we
change this order to either SVBI[0] + (0, 2, 1) or SVBI[0] + (1, 0,
2), depending on the provoking vertex convention.

Fixes piglit tests "EXT_transform_feedback/tessellation
triangle_strip" on Gen6.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: consolidate texstore functions
Brian Paul [Sat, 24 Dec 2011 15:54:27 +0000 (08:54 -0700)]
mesa: consolidate texstore functions

The code for storing 1D, 2D and 3D tex images (whole or sub-images) was
all pretty similar.  This consolidates those six paths.

v2: rework switch statement to catch unexpected targets

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agomesa: fix _mesa_store_texsubimage2d() for GL_TEXTURE_1D_ARRAY
Brian Paul [Sat, 24 Dec 2011 15:54:27 +0000 (08:54 -0700)]
mesa: fix _mesa_store_texsubimage2d() for GL_TEXTURE_1D_ARRAY

For 1D arrays, map each slice separately.  Note that this was handled
correctly in _mesa_store_teximage2d() but not here.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agomesa: update comment for MapTextureImage()
Brian Paul [Sat, 24 Dec 2011 15:54:27 +0000 (08:54 -0700)]
mesa: update comment for MapTextureImage()

12 years agoswrast: rewrite glDrawPixels(GL_DEPTH) with zoom
Brian Paul [Sat, 24 Dec 2011 15:54:27 +0000 (08:54 -0700)]
swrast: rewrite glDrawPixels(GL_DEPTH) with zoom

This gets rid of another renderbuffer->PutRow() call and _DepthBuffer
usage.  We always work with 32-bit uint Z values now.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswrast: stop using _DepthBuffer in triangle code
Brian Paul [Sat, 24 Dec 2011 15:54:27 +0000 (08:54 -0700)]
swrast: stop using _DepthBuffer in triangle code

The only consequence is we can only use the occlusion_zless_16_triangle()
function with MESA_FORMAT_Z16.

12 years agomesa: remove gl_renderbuffer::PutRowRGB()
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
mesa: remove gl_renderbuffer::PutRowRGB()

No longer used anywhere.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswrast: stop using PutRowRGB() in triangle code
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: stop using PutRowRGB() in triangle code

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswrast: refactor/rewrite fast_draw_rgba_pixels()
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: refactor/rewrite fast_draw_rgba_pixels()

Use Map/UnmapRenderbuffer() for the special, optimized cases we care about.

Note that we're dropping some seldom-used cases in the new fast-path
code: as CI->RGB conversion and zooming.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswrast: move swrast_render_start/finish() call in drawpixels code
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: move swrast_render_start/finish() call in drawpixels code

We don't want to call these functions where we'll be using
Map/UnmapRenderbuffer().  So push them further down in the drawpixels
cases so that we can switch over to Map/UnmapRenderbuffer() step by step.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswrast: new fast_draw_depth_stencil() for glDrawPixels(GL_DEPTH_STENCIL)
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: new fast_draw_depth_stencil() for glDrawPixels(GL_DEPTH_STENCIL)

Stop using deprecated renderbuffer PutRow() function.  Note that we
aren't using Map/UnmapRenderbuffer() yet because this call is inside
a swrast_render_start/finish() pair.

v2: use _mesa_pack_uint_24_8_depth_stencil_row(), per Eric.

12 years agoswrast: remove the copy_depth_stencil_pixels() function
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: remove the copy_depth_stencil_pixels() function

Hopefully glCopyPixels(GL_DEPTH_STENCIL) will be handled by the
fast copy function.  Otherwise, just do the copy with separate
depth + stencil copies.  That's effectively what the removed code
did anyway.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswrast: stop using depth/stencil wrappers in CopyPixels code
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: stop using depth/stencil wrappers in CopyPixels code

The functions that read depth/stencil values understand all (packed)
depth/stencil buffer formats now so there's no reason to use the
wrappers.

Also, improve the format checks in fast_copy_pixels() to catch mismatched
depth/stencil cases.

v2: fix the test for combined depth+stencil buffers, per Eric.

12 years agoswrast: remove needless assignment in draw_depth_stencil_pixels()
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: remove needless assignment in draw_depth_stencil_pixels()

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswast: replace renderbuffer->GetPointer() with _swrast_pixel_address()
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swast: replace renderbuffer->GetPointer() with _swrast_pixel_address()

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswrast: use _swrast_pixel_address() helper function
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: use _swrast_pixel_address() helper function

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswrast: rewrite stencil test code
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: rewrite stencil test code

Stop using the deprecated renderbuffer Get/Put Row/Values functions.
Consolidate code paths, etc.  The file is nearly half the size it used
to be!

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswrast: remove dead code in s_stencil.c
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: remove dead code in s_stencil.c

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswrast: rewrite _swrast_read_stencil_span()
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: rewrite _swrast_read_stencil_span()

Use format pack/unpack functions instead of deprecated renderbuffer
GetRow/PutRow functions.

v2: use get_stencil_address(), s/destVals/newVals/

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswrast: rewrite _swrast_read_depth_span_float()
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: rewrite _swrast_read_depth_span_float()

Stop using the deprecated renderbuffer GetRow() function.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agomesa: rewrite _swrast_depth_bounds_test()
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
mesa: rewrite _swrast_depth_bounds_test()

Stop using the deprecated renderbuffer functions.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswrast: rewrite depth-testing code
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: rewrite depth-testing code

Consolidate code, stop using the deprecateted renderbuffer Put/Get
Row/Values() functions.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswrast: stop using _swrast_get_values() in z/depth code
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: stop using _swrast_get_values() in z/depth code

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswrast: stop using _swrast_get_values() in stencil code
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: stop using _swrast_get_values() in stencil code

That function will go a way in the future.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswrast: do fast_copy_pixels() with Map/UnmapRenderbuffer()
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: do fast_copy_pixels() with Map/UnmapRenderbuffer()

v2: use memmove() instead of memcpy() in case of overlap

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswrast: replace GetRow() call with _mesa_unpack_ubyte_stencil_row()
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: replace GetRow() call with _mesa_unpack_ubyte_stencil_row()

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agomesa: remove gl_renderbufer::PutMonoRow() and PutMonoValues()
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
mesa: remove gl_renderbufer::PutMonoRow() and PutMonoValues()

The former was only used for clearing buffers.  The later wasn't used
anywhere!  Remove them and all implementations of those functions.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoswrast: rewrite color buffer clearing to use Map/UnmapRenderbuffer()
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
swrast: rewrite color buffer clearing to use Map/UnmapRenderbuffer()

v2: use _mesa_pack_colormask() helper and fix incorrect masking arithmetic

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agomesa: add _mesa_pack_colormask()
Brian Paul [Sat, 24 Dec 2011 15:54:26 +0000 (08:54 -0700)]
mesa: add _mesa_pack_colormask()

For generating bit-wise colormasks for arbitrary pixel formats.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agomesa: add _mesa_get_format_max_bits()
Brian Paul [Sat, 24 Dec 2011 15:54:25 +0000 (08:54 -0700)]
mesa: add _mesa_get_format_max_bits()

Returns max bits per channel for the given format.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agoswrast: do depth/stencil clearing with Map/UnmapRenderbuffer()
Brian Paul [Sat, 24 Dec 2011 15:54:25 +0000 (08:54 -0700)]
swrast: do depth/stencil clearing with Map/UnmapRenderbuffer()

Another step toward getting rid of the renderbuffer PutRow/etc functions.

v2: fix assorted depth/stencil clear bugs found by Eric

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agomesa: split get_tex_rgba() into compressed/uncompressed versions
Brian Paul [Sat, 24 Dec 2011 15:54:25 +0000 (08:54 -0700)]
mesa: split get_tex_rgba() into compressed/uncompressed versions

This just splits one big function into two smaller ones for better
readability.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agomesa: fix comments in getteximage_error_check()
Brian Paul [Sat, 24 Dec 2011 15:00:06 +0000 (08:00 -0700)]
mesa: fix comments in getteximage_error_check()

12 years agomesa: move the format and type check before select_tex_image()
Jian Zhao [Sat, 24 Dec 2011 14:58:12 +0000 (07:58 -0700)]
mesa: move the format and type check before select_tex_image()

Move the format and type check before select_tex_image, or it will fail to
report the mismatch error if the teximage is null.

Reported-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Jian Zhao <jian.j.zhao@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agovl: Fix inverted logic in vlc checks
Maarten Lankhorst [Sat, 24 Dec 2011 11:33:30 +0000 (12:33 +0100)]
vl: Fix inverted logic in vlc checks

Reported-by: Andy Furniss <andyqos@ukfsn.org>
Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
12 years agoegl,glx,wgl: Fixes stapi->createContext usage
Alexandre Demers [Sat, 24 Dec 2011 11:06:19 +0000 (11:06 +0000)]
egl,glx,wgl: Fixes stapi->createContext usage

Fixed the build failure, fixed a warning where attributs and error arguments had
been
inverted and fixed another call that was missing an argument.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
12 years agoi965/gen7: Fix feedback for flat-shaded tristrips versus provoking vertex.
Eric Anholt [Fri, 23 Dec 2011 00:23:46 +0000 (16:23 -0800)]
i965/gen7: Fix feedback for flat-shaded tristrips versus provoking vertex.

Fixes piglit tesselation triangle_strip flat_last.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoi965/gen7: Add support for transform feedback.
Eric Anholt [Mon, 10 Oct 2011 23:55:54 +0000 (16:55 -0700)]
i965/gen7: Add support for transform feedback.

Fixes almost all of the transform feedback piglit tests.  Remaining
are a few tests related to tesselation for
quads/trifans/tristrips/polygons with flat shading.

v2: Incorporate Paul's feedback (squash with previous, state flag note,
    static assert, update FINISHME)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoi965/gen7: Move SOL stage disable to gen7_sol_state.c
Eric Anholt [Mon, 10 Oct 2011 20:50:41 +0000 (13:50 -0700)]
i965/gen7: Move SOL stage disable to gen7_sol_state.c

We'll be growing more code in here as we actually enable the unit.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoi965/gen7: Add register definitions for GL_EXT_transform_feedback.
Eric Anholt [Fri, 7 Oct 2011 06:24:10 +0000 (23:24 -0700)]
i965/gen7: Add register definitions for GL_EXT_transform_feedback.

v2: Make the buffer enable bitfield take an index argument.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoi965/gen7: Make primitives_written counting work.
Eric Anholt [Thu, 22 Dec 2011 18:50:21 +0000 (10:50 -0800)]
i965/gen7: Make primitives_written counting work.

The code was relying on gs.prog_data's copy of the
number-of-verts-per-prim, which segfaulted on gen7 since it doesn't
make a GS program.  We can easily calculate that value right here.

v2: Fix svbi_0_starting_index regression.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965/gen7: Enable EXT_transform_feedback extension under 3.0 override.
Eric Anholt [Fri, 30 Sep 2011 06:16:30 +0000 (23:16 -0700)]
i965/gen7: Enable EXT_transform_feedback extension under 3.0 override.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoglsl: remove old autogen.sh
Matt Turner [Sat, 24 Dec 2011 00:21:06 +0000 (19:21 -0500)]
glsl: remove old autogen.sh

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965 Gen6+: Invalidate VF address-based cache on flush
Paul Berry [Thu, 22 Dec 2011 19:58:51 +0000 (11:58 -0800)]
i965 Gen6+: Invalidate VF address-based cache on flush

Although there is not much documentation of this fact, there are in
fact two separate VF caches:

- an "index-based" cache (described in the Sandy Bridge PRM, vol 2
  part 1, section 2.1.2 "Vertex Cache").  This cache stores URB
  handles of vertex shader outputs; its purpose is to avoid redundant
  invocations of the vertex shader when drawing in random access mode
  (e.g. glDrawElements()), and the same vertex index is specified
  multiple times.  It is automatically invalidated between
  3D_PRIMITIVE commands and between instances within a single
  3D_PRIMITIVE command.

- an "address-based" cache (mentioned briefly in vol 2 part 1, section
  1.7.4 "PIPE_CONTROL Command").  This cache stores the data read from
  vertex buffers; its purpose is to avoid redundant memory accesses
  when doing instanced drawing or when multiple 3D_PRIMITIVE commands
  access the same vertex data.  It needs to be manually invalidated
  whenever new data is written to a buffer that is used for vertex
  data.

Previous to this patch, it was not necessary for Mesa to explicitly
invalidate the address-based cache, because there were no reasonable
use cases in which the GPU would write to a vertex data buffer during
a batch, and inter-batch flushing was taken care of by the kernel.

However, with transform feedback, there is now a reasonable use case:
vertex data is written to a buffer using transform feedback, and then
that data is immediately re-used as vertex input in the next drawing
operation.  To make this use case work, we need to flush the
address-based VF cache between transform feedback and the next draw
operation.  Since we are already calling
intel_batchbuffer_emit_mi_flush() when transform feedback completes,
and intel_batchbuffer_emit_mi_flush() is intended to invalidate all
caches, it seems reasonable to add VF cache invalidation to this
function.

As with commit 63cf7fad13fc9cfdd2ae7b031426f79107000300 (i965: Flush
pipeline on EndTransformFeedback), this is not an ideal solution.  It
would be preferable to only invalidate the VF cache if the next draw
call was about to consume data generated by a previous draw call in
the same batch.  However, since we don't have the necessary dependency
tracking infrastructure to figure that out right now, we have to
overzealously invalidate the cache.

Fixes Piglit test "EXT_transform_feedback/immediate-reuse".

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965 gen6: Resend binding table pointer after updating SOL bindings.
Paul Berry [Thu, 22 Dec 2011 19:57:41 +0000 (11:57 -0800)]
i965 gen6: Resend binding table pointer after updating SOL bindings.

After creating new binding table entries for transform feedback, we
need to set the dirty flag BRW_NEW_SURFACES, so that a new binding
table pointer will be sent to the hardware.  Otherwise the new binding
table entries will not take effect.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Rename BRW_NEW_WM_SURFACES to BRW_NEW_SURFACES.
Paul Berry [Thu, 22 Dec 2011 21:39:30 +0000 (13:39 -0800)]
i965: Rename BRW_NEW_WM_SURFACES to BRW_NEW_SURFACES.

The surface states tracked by BRW_NEW_WM_SURFACES are no longer used
for just WM.  They are also used for vertex texturing and transform
feedback.  To avoid confusion, this patch renames BRW_NEW_WM_SURFACES
to BRW_NEW_SURFACES.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Don't use BRW_DEPTHFORMAT_D24_UNORM_X8_UINT on Gen4.
Kenneth Graunke [Tue, 20 Dec 2011 23:26:21 +0000 (15:26 -0800)]
i965: Don't use BRW_DEPTHFORMAT_D24_UNORM_X8_UINT on Gen4.

X8 depth formats weren't supported until Ironlake (Gen 5).

Fixes GPU hangs introduced in d84a180417d1eabd680554970f1eaaa93abcd41e.
One example test case was "fbo-missing-attachment-blit from".

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agomesa: Pause transform feedback during meta ops.
Paul Berry [Wed, 21 Dec 2011 19:08:51 +0000 (11:08 -0800)]
mesa: Pause transform feedback during meta ops.

Fixes piglit tests "EXT_transform_feedback/generatemipmap buffer" and
"EXT_transform_feedback/generatemipmap prims_written" on i965 Gen6.

Reviewed-by: Brian Paul <brianp@vmare.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965 gen6: Implement transform feedback pause/resume functionality.
Paul Berry [Wed, 21 Dec 2011 19:04:21 +0000 (11:04 -0800)]
i965 gen6: Implement transform feedback pause/resume functionality.

Although i965 gen6 does not yet support ARB_transform_feedback2 or
NV_transform_feedback2, it needs to support pause/resume functionality
so that meta-ops will work correctly.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Disable certain error checks when transform feedback is paused
Paul Berry [Wed, 21 Dec 2011 19:03:11 +0000 (11:03 -0800)]
mesa: Disable certain error checks when transform feedback is paused

When transform feedback is paused, it is legal to change programs or
to perform drawing operations using a drawing mode that doesn't match
the transform feedback mode.

Reviewed-by: Brian Paul <brianp@vmare.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Ensure that Paused is reset to false on EndTransformFeedback.
Paul Berry [Wed, 21 Dec 2011 19:02:50 +0000 (11:02 -0800)]
mesa: Ensure that Paused is reset to false on EndTransformFeedback.

If a client calls BeginTransformFeedback(), then
PauseTransformFeedback(), then EndTransformFeedback(), we need to make
sure that the transform feedback object is not left in a "paused"
state, otherwise the next call to BeginTransformFeedback() will leave
transform feedback paused.

Reviewed-by: Brian Paul <brianp@vmare.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Save and restore GL_RASTERIZER_DISCARD state during meta ops.
Paul Berry [Wed, 21 Dec 2011 18:13:40 +0000 (10:13 -0800)]
mesa: Save and restore GL_RASTERIZER_DISCARD state during meta ops.

During meta-operations (such as _mesa_meta_GenerateMipmap()), we need
to be able to draw even if GL_RASTERIZER_DISCARD is enabled.  This
patch causes _mesa_meta_begin() to save the state of
GL_RASTERIZER_DISCARD and disable it (so that drawing can be done
during the meta-op), and causes _mesa_meta_end() to restore it.

Fixes piglit test "EXT_transform_feedback/generatemipmap discard" on
i965 Gen6.

Reviewed-by: Brian Paul <brianp@vmare.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agodri2: Add createContextAttribs entry point for DRISW version 3
Ian Romanick [Thu, 1 Dec 2011 21:56:38 +0000 (13:56 -0800)]
dri2: Add createContextAttribs entry point for DRISW version 3

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agodri2: Add createContextAttribs entry point for DRI2 version 3
Ian Romanick [Wed, 30 Nov 2011 20:16:19 +0000 (12:16 -0800)]
dri2: Add createContextAttribs entry point for DRI2 version 3

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agost-api: Have context_create explain why creation failed
Ian Romanick [Tue, 13 Dec 2011 23:46:20 +0000 (15:46 -0800)]
st-api: Have context_create explain why creation failed

This won't be used in the client-side libGL, but the xserver has to
generate a different protocol error depending on the reason context
creation failed.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Chia-I Wu <olv@lunarg.com>
12 years agost-api: Clean-up OpenGL profile handling
Ian Romanick [Thu, 1 Dec 2011 22:24:55 +0000 (14:24 -0800)]
st-api: Clean-up OpenGL profile handling

There seems to have been two different ways to communicate the
profile.  There were flags and there were profiles.  I've opted to
remove the profile flags and use ST_PROFILE_DEFAULT (compatibility
profile) and ST_PROFILE_OPENGL_CORE (core profile) consistently
instead.

Also change the values of the ST_CONTEXT_FLAG_DEBUG and
ST_CONTEXT_FLAG_FORWARD_COMPATIBLE flags to match the WGL and GLX
values.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Chia-I Wu <olv@lunarg.com>
12 years agoglx: Propagate the glXIsDirect protocol error back to the application
Ian Romanick [Thu, 8 Dec 2011 00:13:02 +0000 (16:13 -0800)]
glx: Propagate the glXIsDirect protocol error back to the application

If the server returned BadContext, the error would just get droped on
the floor.

Fixes the piglit test glx-import-context-single-process

NOTE: This is a candidate for the 7.11 branch, but it also requires
the previous patch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglx: Deliver an xlib style error to the application from an XCB error
Ian Romanick [Mon, 12 Dec 2011 17:54:25 +0000 (09:54 -0800)]
glx: Deliver an xlib style error to the application from an XCB error

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agovl: improve vlc functions and handling
Maarten Lankhorst [Tue, 20 Dec 2011 11:43:23 +0000 (12:43 +0100)]
vl: improve vlc functions and handling

Only initialize vlc in MPEG2 decoding once for all slices,
add more sanity checks to vlc decoding functions, support
multiple vlc input buffer, improve documentation of the
vlc functions.

v2: also implement multiple inputs for the vlc functions
v3: some bug fixes for buffer size and alignment corner cases
v4: rework of the patch, some more improvements

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agonouveau: Fix bugs in nouveau_video_buffer
Maarten Lankhorst [Mon, 19 Dec 2011 09:06:58 +0000 (10:06 +0100)]
nouveau: Fix bugs in nouveau_video_buffer

Double free and array overflow, even if only 2 members are
used the last one needs to be set to NULL explicitly.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com
12 years agogallivm: Close a memory leak
Lauri Kasanen [Thu, 22 Dec 2011 19:34:39 +0000 (21:34 +0200)]
gallivm: Close a memory leak

Hi all

This fixes a memory leak of 32 bytes on exit.

From 924f8fdccb41b011f372bc57252005bcdb096105 Mon Sep 17 00:00:00 2001
From: Lauri Kasanen <curaga@operamail.com>
Date: Thu, 22 Dec 2011 21:28:33 +0200
Subject: [PATCH] gallivm: Close a memory leak

As reported by "valgrind --leak-check=full glxgears".

Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
12 years agosoftpipe: try and use back color for a slot if color fails.
Dave Airlie [Mon, 19 Dec 2011 15:54:03 +0000 (15:54 +0000)]
softpipe: try and use back color for a slot if color fails.

In the case where a front and back output are specified, the draw code will
copy the back output into the front color slot and everything is happy.

However if no front is specified then the draw code will do a bad copy (separate patch), but also the frag shader won't pick up the color as there there is
no write to COLOR from the vertex shader just BCOLOR.

This patch fixes that problem so if it can't find a vertex shader output
for the front color slot, it will go and lookup and use one for the back color
slot.

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoformat_unpack: add 8/16 rgba/rgb types.
Dave Airlie [Sun, 27 Nov 2011 20:54:34 +0000 (20:54 +0000)]
format_unpack: add 8/16 rgba/rgb types.

fixing these makes piglit fbo-integer pass on softpipe.

modified to re-order things, haven't addressed Eric's concerns,
can't find anything in spec that mentions sign extensions, it does say
integers aren't clamped or modified.

Signed-off-by: Dave Airlie <airlied@redhat.com>