mesa.git
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>
12 years agoi965: Don't make consumers of brw_CONT/brw_WHILE track if depth in loop.
Eric Anholt [Tue, 6 Dec 2011 20:44:41 +0000 (12:44 -0800)]
i965: Don't make consumers of brw_CONT/brw_WHILE track if depth in loop.

The codegen backends all had this same tracking, so just do it at the
EU level.

Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
12 years agoi965: Don't make consumers of brw_WHILE do pre-gen6 BREAK/CONT patching.
Eric Anholt [Tue, 6 Dec 2011 20:30:03 +0000 (12:30 -0800)]
i965: Don't make consumers of brw_WHILE do pre-gen6 BREAK/CONT patching.

The EU code itself can just do this work, since all the consumers were
duplicating it.

Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
12 years agoi965: Don't make consumers of brw_DO()/brw_WHILE() track loop start.
Eric Anholt [Tue, 6 Dec 2011 20:13:32 +0000 (12:13 -0800)]
i965: Don't make consumers of brw_DO()/brw_WHILE() track loop start.

This is a similar cleanup to what we did for brw_IF(), brw_ELSE(),
brw_ENDIF() handling.

Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
12 years agoi965: Drop unused do_insn argument from gen6_CONT().
Eric Anholt [Tue, 6 Dec 2011 20:09:58 +0000 (12:09 -0800)]
i965: Drop unused do_insn argument from gen6_CONT().

The branch distances get patched up later at the WHILE instruction.

Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
12 years agomesa: Add _NEW_RASTERIZER_DISCARD as synonym for _NEW_TRANSFORM.
Paul Berry [Wed, 21 Dec 2011 00:23:17 +0000 (16:23 -0800)]
mesa: Add _NEW_RASTERIZER_DISCARD as synonym for _NEW_TRANSFORM.

This makes it easier to keep track of which dirty bits correspond to
which pieces of context, since it makes _NEW_RASTERIZER_DISCARD
correspond with ctx->RasterDiscard.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
12 years agomesa: Move RasterDiscard to toplevel of gl_context.
Paul Berry [Wed, 21 Dec 2011 00:18:39 +0000 (16:18 -0800)]
mesa: Move RasterDiscard to toplevel of gl_context.

Previously we were storing the RasterDiscard flag (for
GL_RASTERIZER_DISCARD) in gl_context::TransformFeedback.  This was
confusing, because we use the _NEW_TRANSFORM flag (not
_NEW_TRANSFORM_FEEDBACK) to track state updates to it, and because
rasterizer discard has effects even when transform feedback is not in
use.

This patch makes RasterDiscard a toplevel element in gl_context rather
than a subfield of gl_context::TransformFeedback.

Note: We can't put RasterDiscard inside gl_context::Transform, since
all items inside gl_context::Transform need to be pieces of state that
are saved and restored using PushAttrib and PopAttrib.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
12 years agoegl/x11: Merge the right version of Frederiks change
Kristian Høgsberg [Wed, 21 Dec 2011 15:29:04 +0000 (10:29 -0500)]
egl/x11: Merge the right version of Frederiks change

Argh, I merged an older broken version of the swapbuffer change instead of
Frederiks fixed version.  This diffs gets us back to the right version.

12 years agoegl_dri2/x11: Add support for the DRI2 SwapBuffers request
Fredrik Höglund [Tue, 20 Dec 2011 16:38:45 +0000 (17:38 +0100)]
egl_dri2/x11: Add support for the DRI2 SwapBuffers request

12 years agoegl_dri2/x11: Add support for eglSwapInterval
Fredrik Höglund [Tue, 20 Dec 2011 16:17:02 +0000 (17:17 +0100)]
egl_dri2/x11: Add support for eglSwapInterval

12 years agoi965 gen6: Turn on transform feedback extension unconditionally.
Paul Berry [Mon, 19 Dec 2011 23:15:49 +0000 (15:15 -0800)]
i965 gen6: Turn on transform feedback extension unconditionally.

Previously, we only enabled transform feedback when
MESA_GL_VERSION_OVERRIDE was 3.0 or greater, since transform feedback
support was not completely finished, so it didn't make sense to
advertise support for it unless absolutely necessary.

Now that transform feedback is fully implemented on gen6, we can
enable this extension unconditionally.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965 gen6: Implement transform feedback queries.
Paul Berry [Thu, 15 Dec 2011 22:57:57 +0000 (14:57 -0800)]
i965 gen6: Implement transform feedback queries.

This patch adds software-based PRIMITIVES_GENERATED and
TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN queries that work by keeping
track of the number of primitives that are sent down the pipeline, and
adjusting as necessary to account for the way each primitive type is
tessellated.

In the long run we'll want to replace this with a hardware-based
implementation, because the software approach won't work with geometry
shaders or primitive restart.  However, at the moment, we don't have
the necessary kernel support to implement a hardware-based query (we
would need the kernel to save GPU registers when context switching, so
that drawing performed by another process doesn't get counted).

Fixes Piglit tests EXT_transform_feedback/query-primitives_generated-*
and EXT_transform_feedback/query-primitives-written-*.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Convert if/else to switch statements in brw_queryobj.c
Paul Berry [Mon, 19 Dec 2011 19:53:52 +0000 (11:53 -0800)]
i965: Convert if/else to switch statements in brw_queryobj.c

Previously, i965 only supported two query types: GL_TIME_ELAPSED_EXT
and GL_SAMPLES_PASSED_ARB, and it distinguished between the two using
if/else statements that compared query->Base.Target to
GL_TIME_ELAPSED_EXT.

This patch changes the if/else statements to switch statements so that
we can add more query types without having to have a chain of
else-ifs.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965 gen6: Ensure correct transform feedback indices on new batch.
Paul Berry [Mon, 19 Dec 2011 20:59:04 +0000 (12:59 -0800)]
i965 gen6: Ensure correct transform feedback indices on new batch.

We don't currently have kernel support for saving GPU registers on a
context switch, so if multiple processes are performing transform
feedback at the same time, their SVBI registers will interfere with
each other.  To avoid this situation, we keep a software shadow of the
state of the SVBI 0 register (which is the only register we use), and
re-upload it on every new batch.

The function that updates the shadow state of SVBI 0 is called
brw_update_primitive_count, since it will also be used to update the
counters for the PRIMITIVES_GENERATED and
TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN queries.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Add a function to query whether a meta-op is in progress.
Paul Berry [Mon, 19 Dec 2011 22:28:32 +0000 (14:28 -0800)]
mesa: Add a function to query whether a meta-op is in progress.

This is needed by i965 to ensure that transform feedback counters are
not incremented during meta-ops.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Add count_tessellated_primitives() function.
Paul Berry [Mon, 19 Dec 2011 19:47:14 +0000 (11:47 -0800)]
mesa: Add count_tessellated_primitives() function.

This function computes the number of primitives that will be generated
when the given drawing operation is performed.  It accounts for the
tessellation that is performed on line strips, line loops, triangle
strips, triangle fans, quads, quad strips, and polygons, so it is
suitable for implementing the primitive counters needed by transform
feedback.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Remove unnecessary FLUSH_VERTICES in bind_buffer_range
Paul Berry [Fri, 16 Dec 2011 21:55:37 +0000 (13:55 -0800)]
mesa: Remove unnecessary FLUSH_VERTICES in bind_buffer_range

It isn't necessary to call FLUSH_VERTICES from bind_buffer_range,
because transform feedback buffers are not allowed to be changed when
transform feedback is active.

Thanks to Marek Olšák for pointing out this bug.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
12 years agoi965 gen6: Implement rasterizer discard.
Paul Berry [Wed, 14 Dec 2011 18:44:49 +0000 (10:44 -0800)]
i965 gen6: Implement rasterizer discard.

This patch enables rasterizer discard functionality (a part of
transform feedback) in Gen6, by generating an alternate GS program
when rasterizer discard is active.  Instead of forwarding vertices
down the pipeline, the alternate GS program uses a URB Write message
to deallocate the URB entry that was allocated by FF sync and
terminate the thread.

Note: parts of the Sandy Bridge PRM seem to imply that we could do
this more efficiently, by clearing the GEN6_GS_RENDERING_ENABLE bit,
and not allocating a URB entry at all.  However, it's not clear how we
are supposed to terminate the thread if we do that.  Volume 2 part 1,
section 4.5.4, says "GS threads must terminate by sending a URB_WRITE
message with the EOT and Complete bits set.", and my experiments so
far confirm that.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Implement bounds checking for transform feedback output.
Kenneth Graunke [Wed, 14 Dec 2011 06:53:53 +0000 (22:53 -0800)]
i965: Implement bounds checking for transform feedback output.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoi965: Flush pipeline on EndTransformFeedback.
Paul Berry [Sat, 10 Dec 2011 00:40:32 +0000 (16:40 -0800)]
i965: Flush pipeline on EndTransformFeedback.

A common use case for transform feedback is to perform one draw
operation that writes transform feedback output to a buffer, followed
by a second draw operation that consumes that buffer as vertex input.
Since vertex input is consumed at an earlier pipeline stage than
writing transform feedback output, we need to flush the pipeline to
ensure that the transform feedback output is completely written before
the data is consumed.

In an ideal world, we would do some dependency tracking, so that we
would only flush the pipeline 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 that sort of dependency tracking
infrastructure right now, we just unconditionally flush the buffer
every time glEndTransformFeedback() is called.  This will cause a
performance hit compared to the ideal case (since we will sometimes
flush the pipeline unnecessarily), but fortunately the performance hit
will be confined to circumstances where transform feedback is in use.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965 gen6+: Make intel_batchbuffer_emit_mi_flush() actually flush.
Paul Berry [Sat, 10 Dec 2011 00:39:10 +0000 (16:39 -0800)]
i965 gen6+: Make intel_batchbuffer_emit_mi_flush() actually flush.

Previous to this patch, the function intel_batchbuffer_emit_mi_flush()
was a bit of a misnomer.  On Gen4+, when not using the blit engine, it
didn't actually flush the pipeline--it simply generated a PIPE_CONTROL
command with the necessary bits set to flush GPU caches.  This was
usually sufficient, since in most situations where
intel_batchbuffer_emit_mi_flush() was called, all we really care about
was ensuring cache coherency.

However, with the advent of OpenGL 3.0, there are two cases in which
data output by one stage of the pipeline might be consumed, in a later
draw operation, by an earlier stage of the pipeline:

(a) When using textures in the vertex shader.

(b) When using drawing with a vertex buffer that was previously
    generated using transform feedback.

This patch addresses case (a) by changing
intel_batchbuffer_emit_mi_flush() so that on Gen6+, it sets the
PIPE_CONTROL_CS_STALL bit (this forces the pipeline to actually
flush).  (Case (b) will be addressed by the next patch in the series).

This is not an ideal solution--in a perfect world, the driver would
have some buffer dependency tracking so that we would only have to
flush the pipeline in the two cases above.  Until that dependency
tracking is implemented, however, it seems prudent to have
intel_batchbuffer_emit_mi_flush() actually flush the pipeline, so that
we get correct rendering, at the expense of a (hopefully small)
performance hit.

The change is only applied to Gen6+, since at the moment only Gen6+
supports the OpenGL 3.0 features that make a full pipeline flush
necessary.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965 gen6: Turn on transform feedback extension.
Paul Berry [Sun, 13 Nov 2011 00:25:22 +0000 (16:25 -0800)]
i965 gen6: Turn on transform feedback extension.

This patch advertises support for EXT_transform_feedback on Intel
Gen6.

Since transform feedback support is not completely finished yet, for
now we only advertise support for it when MESA_GL_VERSION_OVERRIDE is
3.0 or greater (since transform feedback is required by GL version
3.0).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965 gen6: Initial implementation of transform feedback.
Paul Berry [Mon, 28 Nov 2011 14:55:01 +0000 (06:55 -0800)]
i965 gen6: Initial implementation of transform feedback.

This patch adds basic transform feedback capability for Gen6 hardware.
This consists of several related pieces of functionality:

(1) In gen6_sol.c, we set up binding table entries for use by
transform feedback.  We use one binding table entry per transform
feedback varying (this allows us to avoid doing pointer arithmetic in
the shader, since we can set up the binding table entries with the
appropriate offsets and surface pitches to place each varying at the
correct address).

(2) In brw_context.c, we advertise the hardware capabilities, which
are as follows:

   MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 64
   MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS        4
   MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS    16

OpenGL 3.0 requires these values to be at least 64, 4, and 4,
respectively.  The reason we advertise a larger value than required
for MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS is that we have already
set aside 64 binding table entries, so we might as well make them all
available in both separate attribs and interleaved modes.

(3) We set aside a single SVBI ("streamed vertex buffer index") for
use by transform feedback.  The hardware supports four independent
SVBI's, but we only need one, since vertices are added to all
transform feedback buffers at the same rate.  Note: at the moment this
index is reset to 0 only when the driver is initialized.  It needs to
be reset to 0 whenever BeginTransformFeedback() is called, and
otherwise preserved.

(4) In brw_gs_emit.c and brw_gs.c, we modify the geometry shader
program to output transform feedback data as a side effect.

(5) In gen6_gs_state.c, we configure the geometry shader stage to
handle the SVBI pointer correctly.

Note: ordering of vertices is not yet correct for triangle strips
(alternate triangles are improperly oriented).  This will be addressed
in a future patch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965 gs: Move vue_map to brw_gs_compile.
Paul Berry [Wed, 7 Dec 2011 15:14:56 +0000 (07:14 -0800)]
i965 gs: Move vue_map to brw_gs_compile.

This patch stores the geometry shader VUE map from a local variable in
compile_gs_prog() to a field in the brw_gs_compile struct, so that it
will be available while compiling the geometry shader.  This is
necessary in order to support transform feedback on Gen6, because the
Gen6 geometry shader code that supports transform feedback needs to be
able to inspect the VUE map in order to find the correct vertex data
to output.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965 gen6+: Use 1-wide null operands for IF instructions
Paul Berry [Mon, 5 Dec 2011 21:52:16 +0000 (13:52 -0800)]
i965 gen6+: Use 1-wide null operands for IF instructions

The Sandy Bridge PRM, volume 4, part 2, section 5.3.10 ("5.3.10
Register Region Restrictions") contains the following restriction on
the execution size and operand width of instructions:

   "3. ExecSize must be equal to or greater than Width."

When emitting an IF instruction in single program flow mode on Gen6+,
we use an ExecSize of 1, therefore the Width of each operand must also
be 1.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Fix off-by-one error in transform feedback size check.
Paul Berry [Thu, 8 Dec 2011 19:23:22 +0000 (11:23 -0800)]
mesa: Fix off-by-one error in transform feedback size check.

In _mesa_BindBufferRange(), we need to verify that the offset and size
specified by the client do not exceed the size of the underlying
buffer.  We were accidentally doing this check using ">=" rather than
">", so we were generating a bogus error if the client specified an
offset and size that fit exactly in the underlying buffer.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Record transform feedback strides/offsets in linker output.
Paul Berry [Tue, 6 Dec 2011 22:16:59 +0000 (14:16 -0800)]
mesa: Record transform feedback strides/offsets in linker output.

This patch adds two new fields to the gl_transform_feedback_info
struct:

- BufferStride records the total number of components (per vertex)
  that transform feedback is being instructed to store in each buffer.

- Outputs[i].DstOffset records the offset within the interleaved
  structure of each transform feedback output.

These values are needed by the i965 gen6 and r600g back-ends, so it
seems better to have the linker provide them rather than force each
back-end to compute them independently.

Also, DstOffset helps pave the way for supporting
ARB_transform_feedback3, which allows the transform feedback output to
contain holes between attributes by specifying
gl_SkipComponents{1,2,3,4} as the varying name.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
12 years agoFix compilation on cygwin after commit 762c9766c93697af8d7fbaa729aed118789dbe8e
Jon TURNEY [Mon, 19 Dec 2011 17:42:02 +0000 (17:42 +0000)]
Fix compilation on cygwin after commit 762c9766c93697af8d7fbaa729aed118789dbe8e

Fix compilation on cygwin after commit 762c9766c93697af8d7fbaa729aed118789dbe8e
"Use VERT_ATTRIB_* indexed array in gl_array_object" added the first non-driver
use of ffsll(), which exposes the fact that this isn't provided on cygwin.

Found by tinderbox, see [1]

[1] http://tinderbox.freedesktop.org/builds/2011-11-30-0017/logs/libGL/#build

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoxvmc: Remove unused variable
Maarten Lankhorst [Tue, 20 Dec 2011 11:32:37 +0000 (12:32 +0100)]
xvmc: Remove unused variable

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agovl: Remove unused declaration
Maarten Lankhorst [Tue, 20 Dec 2011 11:36:18 +0000 (12:36 +0100)]
vl: Remove unused declaration

csc is not used for rgba and gives a warning.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agovl: Use pipe clear_render_target instead of util_clear_render_target
Maarten Lankhorst [Mon, 19 Dec 2011 15:42:49 +0000 (16:42 +0100)]
vl: Use pipe clear_render_target instead of util_clear_render_target

Mapping to software and uploading again clearing is killing performance.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agomesa: fix a leak in _mesa_delete_texture_image()
Pekka Paalanen [Fri, 16 Dec 2011 14:10:47 +0000 (16:10 +0200)]
mesa: fix a leak in _mesa_delete_texture_image()

Valgrind complains about a definitely lost block allocated in
intelNewTextureImage(). This leak was apparently created by
6e0f9001fe3fb191c2928bd09aa9e9d05ddf4ea9, "mesa: move
gl_texture_image::Data, RowStride, ImageOffsets to swrast", as it
removes the free() from _mesa_delete_texture_image().

Put the free() back, fixes a Valgrind error.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agost/egl: error check and clamp coordinates in eglPostSubBufferNV
Chia-I Wu [Tue, 20 Dec 2011 09:18:56 +0000 (17:18 +0800)]
st/egl: error check and clamp coordinates in eglPostSubBufferNV

EGL_BAD_PARAMETER should be returned when any of the coordinates is negative.

12 years agoegl_dri2/x11: error check coordinates in eglPostSubBufferNV
Chia-I Wu [Tue, 20 Dec 2011 09:25:22 +0000 (17:25 +0800)]
egl_dri2/x11: error check coordinates in eglPostSubBufferNV

EGL_BAD_PARAMETER should be returned when any of the coordinates is negative.

12 years agost/egl: Add support for EGL_NV_post_sub_buffer
Fredrik Höglund [Wed, 14 Dec 2011 20:24:11 +0000 (21:24 +0100)]
st/egl: Add support for EGL_NV_post_sub_buffer

Signed-off-by: Fredrik Höglund <fredrik@kde.org>
[olv: remove #ifdef checks]

12 years agoegl_dri2/x11: Add support for EGL_NV_post_sub_buffer
Fredrik Höglund [Wed, 14 Dec 2011 20:24:10 +0000 (21:24 +0100)]
egl_dri2/x11: Add support for EGL_NV_post_sub_buffer

Signed-off-by: Fredrik Höglund <fredrik@kde.org>
12 years agoegl: add EGL_NV_post_sub_buffer
Fredrik Höglund [Wed, 14 Dec 2011 20:24:09 +0000 (21:24 +0100)]
egl: add EGL_NV_post_sub_buffer

v2: Handle EGL_POST_SUB_BUFFER_SUPPORTED_NV in
    _eglParseSurfaceAttribList()

Signed-off-by: Fredrik Höglund <fredrik@kde.org>
[olv: remove #ifdef checks]

12 years agoegl: KHR_reusable_sync entrypoints are missing from eglGetProcAddress
Chia-I Wu [Tue, 20 Dec 2011 08:42:11 +0000 (16:42 +0800)]
egl: KHR_reusable_sync entrypoints are missing from eglGetProcAddress

12 years agoegl: remove #ifdef's for official extensions
Chia-I Wu [Tue, 20 Dec 2011 08:28:20 +0000 (16:28 +0800)]
egl: remove #ifdef's for official extensions

There is no point in having them when we distribute eglext.h.

As for unofficial extensions, there is a chance that we might remove some of
them evetually.  Keeping the #ifdef's for now should make that easier.

12 years agoegl: remove EGL_ANDROID_swap_rectangle
Chia-I Wu [Tue, 20 Dec 2011 08:19:08 +0000 (16:19 +0800)]
egl: remove EGL_ANDROID_swap_rectangle

We never support this unofficial extension, and it has been removed from
Android recently.  There is no point in keeping it.

12 years agoegl: update headers
Chia-I Wu [Thu, 15 Dec 2011 07:20:01 +0000 (15:20 +0800)]
egl: update headers

Update to revision 15052.

EGL_MESA_drm_image is now official.  But apparently we have our own extension
to it and we need this in eglmesaext.h:

  #ifdef EGL_MESA_drm_image
  /* Mesa's extension to EGL_MESA_drm_image... */
  #ifndef EGL_DRM_BUFFER_USE_CURSOR_MESA
  #define EGL_DRM_BUFFER_USE_CURSOR_MESA 0x0004
  #endif
  #endif

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoegl: move unofficial extensions to eglmesaext.h
Chia-I Wu [Mon, 19 Dec 2011 09:37:30 +0000 (17:37 +0800)]
egl: move unofficial extensions to eglmesaext.h

As suggested by Ian in

  http://lists.freedesktop.org/archives/mesa-dev/2011-December/016035.html

Note that eglext.h has to include eglmesaext.h at the end instead of the
beginning because some extensions in eglmesaext.h depend on the official
extensions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi915g: Add unsupported caps.
Stéphane Marchesin [Thu, 15 Dec 2011 20:55:18 +0000 (12:55 -0800)]
i915g: Add unsupported caps.

12 years agoi915g: Turn an assert into a debug message, print more debug info for missing depth...
Stéphane Marchesin [Fri, 16 Dec 2011 00:19:46 +0000 (16:19 -0800)]
i915g: Turn an assert into a debug message, print more debug info for missing depth swz.

Also fix indentation a bit.

12 years agoi915g: Make the pipe_sampler_state struct non const and get rid of useless memcpy.
Stéphane Marchesin [Thu, 15 Dec 2011 20:59:58 +0000 (12:59 -0800)]
i915g: Make the pipe_sampler_state struct non const and get rid of useless memcpy.

12 years agoi915g: Implement KILP.
Stéphane Marchesin [Thu, 15 Dec 2011 20:31:36 +0000 (12:31 -0800)]
i915g: Implement KILP.

12 years agoi915g: Add two unsupported caps.
Stéphane Marchesin [Thu, 15 Dec 2011 19:10:32 +0000 (11:10 -0800)]
i915g: Add two unsupported caps.

12 years agoi915g: Put the templates at the beggining of the structures.
Stéphane Marchesin [Thu, 15 Dec 2011 18:59:26 +0000 (10:59 -0800)]
i915g: Put the templates at the beggining of the structures.

Seriously. This fixes fragment-and-vertex-texturing in piglit and probably
a boatload of other stuff.

12 years agoi965: Advertise our vertex shader texture units.
Kenneth Graunke [Fri, 28 Oct 2011 04:57:48 +0000 (21:57 -0700)]
i965: Advertise our vertex shader texture units.

Previously, we advertised 0 VS texture units.  Now that we have proper
support for using the sampling engine in the VS, we can advertise 16,
which is conveniently the number required for OpenGL 3.0.

v2: Enable on Gen4.  I hacked up my tests to not use flat ivec varyings
    and they pass.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965/vs: Implement EXT_texture_swizzle support for VS texturing.
Kenneth Graunke [Wed, 7 Dec 2011 11:20:53 +0000 (03:20 -0800)]
i965/vs: Implement EXT_texture_swizzle support for VS texturing.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965/vs: Add texture related data to brw_vs_prog_key.
Kenneth Graunke [Wed, 7 Dec 2011 11:13:50 +0000 (03:13 -0800)]
i965/vs: Add texture related data to brw_vs_prog_key.

Now that this is all factored out, it's trivial to do.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965/fs: Only set brw_wm_prog_key data for samplers used by the WM.
Kenneth Graunke [Thu, 8 Dec 2011 20:15:59 +0000 (12:15 -0800)]
i965/fs: Only set brw_wm_prog_key data for samplers used by the WM.

This should avoid state-dependent FS recompiles when samplers that are
only used by the VS change.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965/fs: Factor out texturing related data from brw_wm_prog_key.
Kenneth Graunke [Tue, 6 Dec 2011 23:36:21 +0000 (15:36 -0800)]
i965/fs: Factor out texturing related data from brw_wm_prog_key.

The idea is to reuse this for the VS and (in the future) GS as well.

v2: Include yuvtex data since we're not dropping GL_MESA_ycbycr.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net> [v1]
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965/vs: Add support for texel offsets.
Kenneth Graunke [Sat, 12 Nov 2011 10:21:44 +0000 (02:21 -0800)]
i965/vs: Add support for texel offsets.

The visit() half computes the values to put in the header based on the
IR and simply stuffs that in the vec4_instruction; the emit() half uses
this to set up the message header.  This works out well since emit() can
use brw_reg directly and access individual DWords without kludgery.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965/fs: Factor out texture offset bitfield computation.
Kenneth Graunke [Wed, 26 Oct 2011 20:51:28 +0000 (13:51 -0700)]
i965/fs: Factor out texture offset bitfield computation.

We'll want to reuse this for the VS, and it's complex enough that I'd
rather not cut and paste it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965/vs: Implement vec4_visitor::visit(ir_texture *).
Kenneth Graunke [Wed, 26 Oct 2011 21:00:52 +0000 (14:00 -0700)]
i965/vs: Implement vec4_visitor::visit(ir_texture *).

This translates the GLSL compiler's IR into vec4_instruction IR,
generating code to load coordinates, LOD info, shadow comparitors, and
so on into the appropriate message registers.

It turns out that the SIMD4x2 parameters are identical on Gen 5-7, and
the Gen4 code is similar enough that, unlike in the FS, it's easy enough
to support all generations in a single function.

v2: Load zeros for missing coordinates (fixing vs-texelFetch-sampler1D
and 2D on G45), and fix G45 message length for shadow comparisons.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965/vs: Implement vec4_visitor::generate_tex().
Kenneth Graunke [Wed, 26 Oct 2011 20:53:11 +0000 (13:53 -0700)]
i965/vs: Implement vec4_visitor::generate_tex().

This is the part that takes the vec4_instruction IR and turns it into
actual Gen ISA.

v2: Add Gen4 messages, don't retype m0 to UW.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965: Add missing SIMD4x2 sample_l_c message #defines.
Kenneth Graunke [Thu, 15 Dec 2011 00:18:42 +0000 (16:18 -0800)]
i965: Add missing SIMD4x2 sample_l_c message #defines.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965: Don't minify depth when setting up cube map miptrees on Gen4.
Kenneth Graunke [Thu, 15 Dec 2011 21:43:00 +0000 (13:43 -0800)]
i965: Don't minify depth when setting up cube map miptrees on Gen4.

Prior to Ironlake, cube maps were stored as 3D textures.  In recent
refactoring, we removed a separate "layers" parameter in favor of using
depth.  Unfortunately, depth was getting minified, which is only correct
for actual 3D textures.

Fixes piglit tests:
- bugs/crash-cubemap-order
- fbo/fbo-cubemap
- texturing/cubemap

Also changes texturing/cubemap npot from abort to fail.

This hasn't seen a full test run since Piglit on Mesa master hangs
GM45 a lot.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoglx: Remove GLX_USE_APPLEGL cruft in extension string handling
Ian Romanick [Wed, 30 Nov 2011 18:55:54 +0000 (10:55 -0800)]
glx: Remove GLX_USE_APPLEGL cruft in extension string handling

All of the extensions require that both libGL and either the server or
the direct rendering driver (or both) enable the extension before it's
advertised.  It seems safe to assume that none of the other components
on OS X will enable these extensions, so all the #ifdef blocks here
just clutter the code.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoglx: GLX 1.4 does not require GLX_INTEL_swap_event
Ian Romanick [Wed, 30 Nov 2011 19:00:00 +0000 (11:00 -0800)]
glx: GLX 1.4 does not require GLX_INTEL_swap_event

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoglx: Remove some extensions that are not, and never will be, supported
Ian Romanick [Wed, 30 Nov 2011 18:53:59 +0000 (10:53 -0800)]
glx: Remove some extensions that are not, and never will be, supported

There are a few unsupported extensions (e.g., the ATI and NV float
extensions) that are still in the list.  There is some small chance
that these may be supported some day.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoglx: Explicitly reject servers that only support GLX 1.0
Ian Romanick [Tue, 29 Nov 2011 02:31:21 +0000 (18:31 -0800)]
glx: Explicitly reject servers that only support GLX 1.0

__glXInitialize calls AllocAndFetchScreenConfigs.
AllocAndFetchScreenConfigs unconditionally sends a glXQuerySeverString
request to the server.  This request is only supported with GLX 1.1 or
later, so we were already implicitly incompatible with GLX 1.0
servers.  How many more similar bugs lurk in the code that nobody has
noticed in years?

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoglx: Initialize share_xid in CreateContext
Ian Romanick [Thu, 8 Dec 2011 23:03:19 +0000 (15:03 -0800)]
glx: Initialize share_xid in CreateContext

Previously the share_xid was only set in the glXImportContextEXT path,
and it was left set to None in all of the other create-context paths.

Fixes the piglit test glx-query-context-info-ext.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoglx: Make parameter types for __glXSendError match protocol types
Ian Romanick [Mon, 12 Dec 2011 17:48:29 +0000 (09:48 -0800)]
glx: Make parameter types for __glXSendError match protocol types

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoglx: Make __glXSendError available in non-Apple builds
Ian Romanick [Thu, 8 Dec 2011 00:12:21 +0000 (16:12 -0800)]
glx: Make __glXSendError available in non-Apple builds

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoglx: Send DestroyContext protocol at the correct times
Ian Romanick [Wed, 7 Dec 2011 21:31:27 +0000 (13:31 -0800)]
glx: Send DestroyContext protocol at the correct times

Send the DestroyContext protocol immediately when glXDestroyContext is
called, and never call it when glXFreeContextEXT is called.  In both
cases, either destroy the client-side structures or, if the context is
current, set xid to None so that the client-side structures will be
destroyed later.

I believe this restores the behavior of the original SGI code.  See
src/glx/x11 around commit 5df82c8.  The spec doesn't say anything
about glXDestroyContext not really destroying imported contexts (it
acts like glXFreeContextEXT instead), but that's what the original
code did.  Note that glXFreeContextEXT on a non-imported context does
not destroy it either.

Fixes the piglit test glx-free-context.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoglx: Don't segfault if glXGetContextIDEXT is pased a NULL context
Ian Romanick [Wed, 7 Dec 2011 19:37:01 +0000 (11:37 -0800)]
glx: Don't segfault if glXGetContextIDEXT is pased a NULL context

Fixes the piglit test glx-get-context-id.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoglx: Fix handling of property list received from the server in glXImportContextEXT
Ian Romanick [Wed, 7 Dec 2011 19:15:14 +0000 (11:15 -0800)]
glx: Fix handling of property list received from the server in glXImportContextEXT

The primary problem was that the number of reply bytes read is clamped
to sizeof(propList), but the loop that processes the properties tries
to examine all of the properties sent by the server.  If the server
sends 47,000 properties, we only read 3 but process all 47,000.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoglx: Don't segfault if xcb_glx_is_direct_reply returns NULL
Ian Romanick [Wed, 7 Dec 2011 01:15:26 +0000 (17:15 -0800)]
glx: Don't segfault if xcb_glx_is_direct_reply returns NULL

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoglx: Don't create a shared context if the other context isn't the same kind
Ian Romanick [Tue, 6 Dec 2011 20:19:39 +0000 (12:19 -0800)]
glx: Don't create a shared context if the other context isn't the same kind

Each of the DRI, DRI2, and DRISW backends contain code like the
following in their create-context routine:

   if (shareList) {
      pcp_shared = (struct dri2_context *) shareList;
      shared = pcp_shared->driContext;
   }

This assumes that the glx_context *shareList is actually the correct
derived type.  However, if shareList was created as an
indirect-rendering context, it will not be the expected type.  As a
result, shared will contain garbage.  This garbage will be passed to
the driver, and the driver will probably segfault.  This can be
observed with the following GLX code:

    ctx0 = glXCreateContext(dpy, visinfo, NULL, False);
    ctx1 = glXCreateContext(dpy, visinfo, ctx0, True);

Create-context is the only case where this occurs.  All other cases
where a context is passed to the backend, it is the 'this' pointer
(i.e., we got to the backend by call something from ctx->vtable).

To work around this, check that the shareList->vtable->destroy method
is the same as the destroy method of the expected type.  We could also
check that shareList->vtable matches the vtable or by adding a "tag"
to glx_context to identify the derived type.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Add support for GL_ARB_depth_buffer_float under 3.0 override.
Eric Anholt [Fri, 18 Nov 2011 01:19:12 +0000 (17:19 -0800)]
i965: Add support for GL_ARB_depth_buffer_float under 3.0 override.

This is not exposed generally yet because some of the swrast paths hit
in piglit (drawpixels, copypixels, blit) aren't yet converted to
MapRenderbuffer.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Add separate stencil/HiZ setup for MESA_FORMAT_Z32_FLOAT_X24S8.
Eric Anholt [Wed, 7 Dec 2011 22:49:45 +0000 (14:49 -0800)]
i965: Add separate stencil/HiZ setup for MESA_FORMAT_Z32_FLOAT_X24S8.

This is a little more unusual than the separate MESA_FORMAT_S8_Z24
support, because in addition to storing the real stencil data in a
MESA_FORMAT_S8 miptree, we also make the Z miptree be
MESA_FORMAT_Z32_FLOAT instead of the requested format.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Use the miptree format for texture surface format choice.
Eric Anholt [Tue, 13 Dec 2011 20:40:09 +0000 (12:40 -0800)]
i965: Use the miptree format for texture surface format choice.

With separate stencil GL_DEPTH32F_STENCIL8, the miptree will have a
really different format (MESA_FORMAT_Z32_FLOAT) from the teximage
(MESA_FORMAT_Z32_FLOAT_X24S8).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Add support for mapping Z32_FLOAT_X24S8 fake packed depth/stencil.
Eric Anholt [Sat, 3 Dec 2011 00:00:10 +0000 (16:00 -0800)]
i965: Add support for mapping Z32_FLOAT_X24S8 fake packed depth/stencil.

The format handling here is tricky, because we're not actually
generating a Z32_FLOAT_X24S8 miptree, so we're guessing the format
that GL wants based on seeing Z32_FLOAT with a separate stencil.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agointel: Stop creating the wrapped depth irb.
Eric Anholt [Thu, 8 Dec 2011 16:33:28 +0000 (08:33 -0800)]
intel: Stop creating the wrapped depth irb.

All the operations were just trying to get at irb->wrapped_depth->mt,
which is the same as irb->mt now.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Properly demote the depth mt format for fake packed depth/stencil.
Eric Anholt [Thu, 15 Dec 2011 01:16:07 +0000 (17:16 -0800)]
i965: Properly demote the depth mt format for fake packed depth/stencil.

gen7 only supports the non-packed formats, even if you associate a
real separate stencil buffer -- otherwise it's as if the depth test
always fails.

This requires a little bit of care in the match_texture_image case,
since the miptree format no longer matches the texture image format.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agointel: Reuse intel_miptree_match_image().
Eric Anholt [Thu, 15 Dec 2011 04:43:06 +0000 (20:43 -0800)]
intel: Reuse intel_miptree_match_image().

This little bit of logic was duplicated, which isn't much, but I was
going to need to duplicate a bit of additional logic in the next
commit.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agointel: Stop creating the wrapped stencil irb.
Eric Anholt [Wed, 7 Dec 2011 23:02:02 +0000 (15:02 -0800)]
intel: Stop creating the wrapped stencil irb.

There were only two places it was really used at this point, which was
in the batchbuffer emit of the separate stencil packets for gen6/7.
Just write in the ->stencil_mt reference in those two places and ditch
all this flailing around with allocation and refcounts.

v2: Fix separate stencil on gen7.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agotgsi: update documents with some info on texture lookup
Dave Airlie [Mon, 19 Dec 2011 16:40:05 +0000 (16:40 +0000)]
tgsi: update documents with some info on texture lookup

this mentions which channels are used for slice and depth comparison values.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agosoftpipe: fix shadow1d tests.
Dave Airlie [Mon, 19 Dec 2011 11:51:39 +0000 (11:51 +0000)]
softpipe: fix shadow1d tests.

This fixes the piglit glsl-1.10 shadow1D related tests.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agosoftpipe: fix shadow 2d texture array sampling
Dave Airlie [Mon, 19 Dec 2011 10:34:20 +0000 (10:34 +0000)]
softpipe: fix shadow 2d texture array sampling

The 4th texcoord is used in this case for the comparison.

This fixes piglit glsl-fs-shadow2DArray* on softpipe.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agogallium/draw: fix two side handling
Dave Airlie [Mon, 19 Dec 2011 15:57:50 +0000 (15:57 +0000)]
gallium/draw: fix two side handling

The code didn't handle the case where front wasn't specified in the vertex
shader outputs, but back was.

In that case we were doing a copy from back to non-existant front,
this code checks we have existant front/backs and only does the copy when
they both exist.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>