OSDN Git Service

android-x86/external-mesa.git
12 years agointel: Add an interface for saving/restoring the batchbuffer state.
Eric Anholt [Sat, 22 Oct 2011 02:01:17 +0000 (19:01 -0700)]
intel: Add an interface for saving/restoring the batchbuffer state.

This will be used to avoid the prepare() step in the i965 driver's
state setup.  Instead, we can just speculatively emit the primitive
into the batchbuffer, then check if the batch is too big, rollback and
flush, and replay the primitive.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
12 years agoi915: Move the always_flush_cache code to triangle emit.
Eric Anholt [Fri, 21 Oct 2011 23:32:03 +0000 (16:32 -0700)]
i915: Move the always_flush_cache code to triangle emit.

This could have broken always_flush_cache on i965, since
reserved_space doesn't reflect the size of the workaround flushes, and
we might run out of space.  This should make always_flush_cache more
useful on pre-i965, anyway (since the point is to flush around each
draw call, even within a batchbuffer).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
12 years agoglsl: Fix compilation of glsl_lexer.ll with MSVC.
Morgan Armand [Sat, 29 Oct 2011 17:37:58 +0000 (10:37 -0700)]
glsl: Fix compilation of glsl_lexer.ll with MSVC.

strtoull is not supported on msvc (as there is no C99 support).

12 years agor600g: Replace needless flush in texture upload.
Mathias Fröhlich [Tue, 26 Jul 2011 05:05:10 +0000 (07:05 +0200)]
r600g: Replace needless flush in texture upload.

Replace pipe->flush() with pipe->texture_barrier() in
the texture upload path for the staging texture.
This should be enough to get data out of the gpu
caches ready to be read for texture fetch.

12 years agor600g: remove one pointless flush
Marek Olšák [Fri, 28 Oct 2011 17:24:16 +0000 (19:24 +0200)]
r600g: remove one pointless flush

It's not useful for anything.
The rest of the patch is just a cleanup resulting
from some of the variables being no longer used.

There are no piglit regressions.

12 years agoradeon/r200: forgot one somehow
Dave Airlie [Sat, 29 Oct 2011 07:15:00 +0000 (08:15 +0100)]
radeon/r200: forgot one somehow

drops last usage.

12 years agoradeon/r200: drop remains of non-libdrm_radeon build
Dave Airlie [Sat, 29 Oct 2011 07:11:37 +0000 (08:11 +0100)]
radeon/r200: drop remains of non-libdrm_radeon build

These wrappers and associated symlinks were from the non-libdrm_radeon build.

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agomesa/st: get interpolation mode from the fragment shader.
Dave Airlie [Fri, 28 Oct 2011 16:18:15 +0000 (17:18 +0100)]
mesa/st: get interpolation mode from the fragment shader.

With the recent changes to interpolation stuff, we can now get the value
direct from the program instead of just being fail.

fixes some of the glsl-1.30 interpolation tests with softpipe

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoglx: Don't enable INTEL_swap_event unconditionally
Adam Jackson [Sat, 29 Oct 2011 00:38:32 +0000 (20:38 -0400)]
glx: Don't enable INTEL_swap_event unconditionally

DRI2 supports this now - and already enables it explicitly - but drisw
does not and should not.  Otherwise toolkits like clutter will only ever
SwapBuffers once and wait forever for an event that's not coming.

Signed-off-by: Adam Jackson <ajax@redhat.com>
12 years agoimplement WGL_ARB_create_context
Morgan Armand [Fri, 28 Oct 2011 13:42:29 +0000 (06:42 -0700)]
implement WGL_ARB_create_context

Signed-off-by: José Fonseca <jfonseca@vmware.com>
12 years agor600g: get backend mask after the context is fully set up
Marek Olšák [Fri, 28 Oct 2011 20:31:34 +0000 (22:31 +0200)]
r600g: get backend mask after the context is fully set up

12 years agoir_to_mesa: Let check_resources halt compilation
Ian Romanick [Tue, 11 Oct 2011 23:27:41 +0000 (16:27 -0700)]
ir_to_mesa: Let check_resources halt compilation

Previously check_resources could fail, but we'd still try to optimize
the shader, do device-specific code generation, etc.  In some cases,
this could explode (especially in the device-specific code
generation).  I haven't found that I could trigger this with the
current code.  When too many samplers were used with the new uniform
handling code, I observed several crashes deep down in the driver.

NOTE: This is candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41609
Cc: Eric Anholt <eric@anholt.net>
Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Use glsl_type::column_type instead of open-coding it
Ian Romanick [Sat, 22 Oct 2011 01:22:42 +0000 (18:22 -0700)]
i965: Use glsl_type::column_type instead of open-coding it

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoglsl: Clean-up spurious error message on bad structure definitions
Ian Romanick [Wed, 26 Oct 2011 00:49:07 +0000 (17:49 -0700)]
glsl: Clean-up spurious error message on bad structure definitions

Previously a shader like

int X;
struct X { int i; };

void main() { gl_Position = vec4(0.0); }

would generate two error message:

0:2(19): error: struct `X' previously defined
0:2(20): error: incomplete declaration

The first one is the real error, and the second is spurious.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoglsl: Generate an error for array-of-array declarations
Ian Romanick [Mon, 24 Oct 2011 18:45:50 +0000 (11:45 -0700)]
glsl: Generate an error for array-of-array declarations

Other parts of the code already caught things like 'float x[4][2]'.
However, nothing caught 'float [4] x[2]'.

Fixes piglit test array-multidimensional-new-syntax.vert.

NOTE: This is candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agor300c/compiler: remove the compiler too
Marek Olšák [Fri, 28 Oct 2011 19:27:22 +0000 (21:27 +0200)]
r300c/compiler: remove the compiler too

Gallium has a fork of this.

12 years agoi965/fs: Use the actual hardware g0 register for texel offset setup.
Kenneth Graunke [Thu, 27 Oct 2011 05:41:07 +0000 (22:41 -0700)]
i965/fs: Use the actual hardware g0 register for texel offset setup.

The idea here is to set up the message header with the Sampler State
pointer which the hardware provides as part of the PS Thread Payload in
register g0.

Unfortunately, the existing code

   fs_reg(GRF, 0, BRW_REGISTER_TYPE_UD))

actually references "virtual GRF 0" rather than the hardware g0.  This
is just some arbitrary GRF temporary which will get register allocated.

So, we ended up setting up the header with garbage.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agou_format: Fix -NaN handling for packing of 10F_11F_11F_REV to match GL specs.
Eric Anholt [Wed, 26 Oct 2011 23:23:50 +0000 (16:23 -0700)]
u_format: Fix -NaN handling for packing of 10F_11F_11F_REV to match GL specs.

Fixes the remainder of piglit GL_EXT_packed_float/pack.c

Reviewed-by: Marek Ol ák <maraeo@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agou_format: Fix clamping of overflow in 10F_11F_11F_REV to match GL specs.
Eric Anholt [Wed, 26 Oct 2011 23:11:27 +0000 (16:11 -0700)]
u_format: Fix clamping of overflow in 10F_11F_11F_REV to match GL specs.

Fixes the 1000000.0 overflow cases of piglit
GL_EXT_packed_float/pack.c

Reviewed-by: Marek Ol ák <maraeo@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa: Don't do [0, 1] clamping on glGetTexImage() of packed float formats.
Eric Anholt [Wed, 26 Oct 2011 23:09:16 +0000 (16:09 -0700)]
mesa: Don't do [0, 1] clamping on glGetTexImage() of packed float formats.

From the GL_EXT_packed_float spec:

    For an RGBA color, if <type> is not one of FLOAT,
    UNSIGNED_INT_5_9_9_9_REV_EXT, or UNSIGNED_INT_10F_11F_11F_REV_EXT,
    or if the CLAMP_READ_COLOR_ARB is TRUE, or CLAMP_READ_COLOR_ARB
    is FIXED_ONLY_ARB and the selected color (or texture) buffer is
    a fixed-point buffer, each component is first clamped to [0,1].
    Then the appropriate conversion formula from table 4.7 is applied
    the component."

(but we previously resolved that the CLAMP_READ_COLOR bit is not
relevant to glGetTexImage())

This fixes most of the cases in piglit GL_EXT_packed_float/pack.

Reviewed-by: Marek Ol ák <maraeo@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agou_format: Fix bitshifting for unpacking from 10F.
Eric Anholt [Tue, 25 Oct 2011 23:53:00 +0000 (16:53 -0700)]
u_format: Fix bitshifting for unpacking from 10F.

This code was copy and pasted from the 11F unpacking, but not updated
for actually being 10 bits instead of 11.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41206
Reviewed-by: Marek Ol ák <maraeo@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agou_format: Fix bit definition of UF10_MANTISSA_BITS.
Eric Anholt [Tue, 25 Oct 2011 23:50:44 +0000 (16:50 -0700)]
u_format: Fix bit definition of UF10_MANTISSA_BITS.

This is only used in the code for packing to INF, and resulted in an
extra bit set that was set anyway, so it was harmless except for the
confusion caused.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Implement GLSL 1.30's literal integer range restrictions.
Eric Anholt [Mon, 3 Oct 2011 23:59:01 +0000 (16:59 -0700)]
glsl: Implement GLSL 1.30's literal integer range restrictions.

From page 22 (28 of PDF) of GLSL 1.30 spec:
    It is an error to provide a literal integer whose magnitude is too
    large to store in a variable of matching signed or unsigned type.

    Unsigned integers have exactly 32 bits of precision.  Signed integers
    use 32 bits, including a sign bit, in two's complement form.

Fixes piglit int-literal-too-large-0[123].frag.

v2: Take care with INT_MIN, use stroull, and make it a function.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoradeon: Remove the non-libdrm kernel memory manager support.
Eric Anholt [Fri, 14 Oct 2011 21:50:50 +0000 (14:50 -0700)]
radeon: Remove the non-libdrm kernel memory manager support.

We should have never been building this at this point.

12 years agoradeon: Insist on libdrm being present to build.
Eric Anholt [Fri, 14 Oct 2011 21:34:19 +0000 (14:34 -0700)]
radeon: Insist on libdrm being present to build.

There's no sense in building a broken driver.  Previously, there was
the potential of building a DRI1-only driver that would work for DRI1
and fail on DRI2 because the newer libdrm code wasn't present.  Now
the radeon build system should be matching intel and nouveau.

12 years agoconfigure.ac: Fix equality checks in gallium st setup.
Eric Anholt [Fri, 14 Oct 2011 21:33:00 +0000 (14:33 -0700)]
configure.ac: Fix equality checks in gallium st setup.

12 years agodri: Remove driver GenerateMipmap hooks.
Eric Anholt [Fri, 14 Oct 2011 21:11:17 +0000 (14:11 -0700)]
dri: Remove driver GenerateMipmap hooks.

Mesa sets up _mesa_meta_GenerateMipmap as the default hook, which does
this check for fallback and call the fallback itself.

12 years agoradeon: Drop some remaining DRI1 vblank support code.
Eric Anholt [Fri, 14 Oct 2011 21:04:48 +0000 (14:04 -0700)]
radeon: Drop some remaining DRI1 vblank support code.

12 years agointel: remove dead prototype for old DRI1 code.
Eric Anholt [Fri, 14 Oct 2011 20:54:44 +0000 (13:54 -0700)]
intel: remove dead prototype for old DRI1 code.

Noticed while grepping for radeon code.

12 years agoradeon: Simplify cliprects computation now that there's just 1.
Eric Anholt [Fri, 14 Oct 2011 20:52:31 +0000 (13:52 -0700)]
radeon: Simplify cliprects computation now that there's just 1.

This can probably be reduced even further by moving this logic to the
scissor state update or just removing the logic entirely, but I don't
trust myself in radeon quite that much.

12 years agoradeon: Drop the clipping in spans, now that we always have (0,0) -> (w,h).
Eric Anholt [Fri, 14 Oct 2011 20:39:38 +0000 (13:39 -0700)]
radeon: Drop the clipping in spans, now that we always have (0,0) -> (w,h).

12 years agoradeon: Drop the legacy BO manager code.
Eric Anholt [Fri, 14 Oct 2011 20:27:02 +0000 (13:27 -0700)]
radeon: Drop the legacy BO manager code.

12 years agoradeon: Drop the DRI1 zero-copy TFP code.
Eric Anholt [Fri, 14 Oct 2011 20:25:06 +0000 (13:25 -0700)]
radeon: Drop the DRI1 zero-copy TFP code.

12 years agoradeon: Drop the radeon_cs_legacy code now that we rely on kernel mm.
Eric Anholt [Fri, 14 Oct 2011 20:14:22 +0000 (13:14 -0700)]
radeon: Drop the radeon_cs_legacy code now that we rely on kernel mm.

12 years agoradeon: Drop dri2 checks now that it's always true.
Eric Anholt [Fri, 14 Oct 2011 19:49:59 +0000 (12:49 -0700)]
radeon: Drop dri2 checks now that it's always true.

This makes LOCK_HARDWARE empty, so it goes away.

12 years agoradeon: Drop the DRI1 swapbuffers implementation.
Eric Anholt [Fri, 14 Oct 2011 20:01:16 +0000 (13:01 -0700)]
radeon: Drop the DRI1 swapbuffers implementation.

12 years agoradeon: Drop the non-kernel-memory-manager support, and thus DRI1.
Eric Anholt [Fri, 14 Oct 2011 19:22:57 +0000 (12:22 -0700)]
radeon: Drop the non-kernel-memory-manager support, and thus DRI1.

It's past time, and it was going to get in the way of the renderbuffer
mapping refactor.  We dropped all the other DRI1 drivers for this
release, and I can't imagine anybody supporting DRI1 radeon classic in
a new release of Mesa.

Diff produced by treating kernel_mm as true, deleting the DRI1 paths
that produce kernel_mm false, and deleting code.

12 years agor200: Drop the non-kernel-memory-manager and DRI1 code.
Eric Anholt [Fri, 14 Oct 2011 19:26:53 +0000 (12:26 -0700)]
r200: Drop the non-kernel-memory-manager and DRI1 code.

12 years agoradeon: Unifdef RADEON_R300 and RADEON_R600.
Eric Anholt [Thu, 20 Oct 2011 22:15:34 +0000 (15:15 -0700)]
radeon: Unifdef RADEON_R300 and RADEON_R600.

12 years agodocs: Update to note that r300 and r600 have been replaced.
Eric Anholt [Thu, 20 Oct 2011 22:10:05 +0000 (15:10 -0700)]
docs: Update to note that r300 and r600 have been replaced.

12 years agor300c, r600c: Remove these DRI drivers.
Eric Anholt [Thu, 20 Oct 2011 22:06:54 +0000 (15:06 -0700)]
r300c, r600c: Remove these DRI drivers.

They have been superseded by the gallium equivalents.

Acked-by: Michel Dänzer <michel@daenzer.net>
Acked-by: Alex Deucher <alexdeucher@gmail.com>
Acked-by: Dave Airlie <airlied@gmail.com>
Acked-by: Corbin Simpson <mostawesomedude@gmail.com>
12 years agomesa: Remove build infrastructure for r300c and r600c.
Eric Anholt [Thu, 20 Oct 2011 21:55:53 +0000 (14:55 -0700)]
mesa: Remove build infrastructure for r300c and r600c.

These drivers have been superseded by the gallium equivalents.

12 years agoradeon: Delete DRI1 screen init code and thus support for !kernel_mm.
Eric Anholt [Fri, 14 Oct 2011 19:27:48 +0000 (12:27 -0700)]
radeon: Delete DRI1 screen init code and thus support for !kernel_mm.

It's past time, and it was going to get in the way of the renderbuffer
mapping refactor.  We dropped all the other DRI1 drivers for this
release, and I can't imagine anybody supporting DRI1 radeon classic in
a new release of Mesa.

Cleanup of the resulting dead code to follow.

Acked-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodri: Drop _dri_texformats that just obfuscate MESA_FORMAT names.
Eric Anholt [Fri, 14 Oct 2011 18:17:39 +0000 (11:17 -0700)]
dri: Drop _dri_texformats that just obfuscate MESA_FORMAT names.

The remaining _dri_texformats are the ones that are variable depending
on the endianness of the system.

12 years agoradeon: Use _mesa_get_format_base_format for winsys renderbuffer setup.
Eric Anholt [Fri, 14 Oct 2011 00:17:04 +0000 (17:17 -0700)]
radeon: Use _mesa_get_format_base_format for winsys renderbuffer setup.

12 years agoradeon: Remove dead swrast renderbuffer setup code.
Eric Anholt [Fri, 14 Oct 2011 00:14:11 +0000 (17:14 -0700)]
radeon: Remove dead swrast renderbuffer setup code.

This was from the stub code in the initial commit of this file.

12 years agoglsl: Remove pointless uses of glsl_type::get_base_type().
Kenneth Graunke [Tue, 25 Oct 2011 19:55:54 +0000 (12:55 -0700)]
glsl: Remove pointless uses of glsl_type::get_base_type().

These are effectively doing type->get_base_type()->base_type, which is
equivalent to type->base_type.  Just use that, as it's simpler.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agor600g: don't flush before reading query results
Marek Olšák [Fri, 28 Oct 2011 17:05:44 +0000 (19:05 +0200)]
r600g: don't flush before reading query results

Taken care of by the winsys.

12 years agor600g: only maintain the list of active queries
Marek Olšák [Fri, 28 Oct 2011 16:27:00 +0000 (18:27 +0200)]
r600g: only maintain the list of active queries

And not all existing queries. The only reason we have that list is to be able
to suspend and resume the active ones.

This reduces looping over queries when suspending and resuming.
The queries no longer have to track some of their states.

12 years agor600g: cleanup r600_query_result
Marek Olšák [Fri, 28 Oct 2011 10:44:19 +0000 (12:44 +0200)]
r600g: cleanup r600_query_result

12 years agor600g: don't flush in r600_get_backend_mask
Marek Olšák [Fri, 28 Oct 2011 10:37:54 +0000 (12:37 +0200)]
r600g: don't flush in r600_get_backend_mask

The winsys does the flush in buffer_map.

12 years agor600g: remove redundant variable r600_query::buffer_size
Marek Olšák [Fri, 28 Oct 2011 10:34:57 +0000 (12:34 +0200)]
r600g: remove redundant variable r600_query::buffer_size

12 years agor300g: remove useless code
Marek Olšák [Fri, 28 Oct 2011 15:44:02 +0000 (17:44 +0200)]
r300g: remove useless code

12 years agogallium/auxiliary/util: Solaris also has standard Unix sockets
Alan Coopersmith [Fri, 21 Oct 2011 23:17:56 +0000 (16:17 -0700)]
gallium/auxiliary/util: Solaris also has standard Unix sockets

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agor300/compiler: Fix scheduler bug causing texture corruption
Tom Stellard [Sun, 23 Oct 2011 01:30:46 +0000 (18:30 -0700)]
r300/compiler: Fix scheduler bug causing texture corruption

We weren't setting TEX_SEM_WAIT on instructions that read the value of a
TEX instruction and also wrote the same register as the TEX instruction.

This is the sequence we were miscompiling:

1: TEX temp[0], input[2].xy__, 2D[0]
...
16: src0.xyz = temp[22], src1.xyz = temp[0], src2.xyz = temp[19]
      MAD temp[0].xyz, src0.xxx, src1.xyz, src2.xxx

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

12 years agoi965/gen6+: Add support for noperspective interpolation.
Paul Berry [Sat, 22 Oct 2011 16:33:16 +0000 (09:33 -0700)]
i965/gen6+: Add support for noperspective interpolation.

This required the following changes:

- WM setup now makes the appropriate set of barycentric coordinates
  (perspective vs. noperspective) available to the fragment shader,
  based on whether the shader requires perspective interpolation,
  noperspective interpolation, both, or neither.

- The fragment shader backend now uses the appropriate set of
  barycentric coordiantes when interpolating, based on the
  interpolation mode returned by
  ir_variable::determine_interpolation_mode().

- SF setup now uses gl_fragment_program::InterpQualifier to determine
  which attributes are to be flat shaded (as opposed to the old logic,
  which only flat shaded colors).

- CLIP setup now ensures that the clipper outputs non-perspective
  barycentric coordinates when they are needed by the fragment shader.

Fixes the remaining piglit tests of interpolation qualifiers that were
failing:
- interpolation-flat-*-smooth-none
- interpolation-flat-other-flat-none
- interpolation-noperspective-*
- interpolation-smooth-gl_*Color-flat-*

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/gen6+: Rename GEN6_CLIP_BARYCENTRIC_ENABLE.
Paul Berry [Sat, 22 Oct 2011 16:33:12 +0000 (09:33 -0700)]
i965/gen6+: Rename GEN6_CLIP_BARYCENTRIC_ENABLE.

The name was misleading.  The actual effect of the bit is to cause
the clipper to emit *non-perspective* barycentric coordinate
information (which is only needed when doing noperspective
interpolation).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/fs: use determine_interpolation_mode().
Paul Berry [Fri, 21 Oct 2011 14:56:08 +0000 (07:56 -0700)]
i965/fs: use determine_interpolation_mode().

This patch changes how fs_visitor::emit_general_interpolation()
decides what kind of interpolation to do.  Previously, it used the
shade model to determine how to interpolate colors, and used smooth
interpolation on everything else.  Now it uses
ir_variable::determine_interpolation_mode(), so that it respects GLSL
1.30 interpolation qualifiers.

Fixes piglit tests interpolation-flat-*-smooth-{distance,fixed,vertex}
and interpolation-flat-other-flat-{distance,fixed,vertex}.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/gen6+: Parameterize barycentric interpolation modes.
Paul Berry [Sat, 22 Oct 2011 00:20:32 +0000 (17:20 -0700)]
i965/gen6+: Parameterize barycentric interpolation modes.

This patch modifies the fragment shader back-end so that instead of
using a single delta_x/delta_y register pair to store barycentric
coordinates, it uses an array of such register pairs, one for each
possible intepolation mode.

When setting up the WM, we intstruct it to only provide the
barycentric coordinates that are actually needed by the fragment
shader--that is computed by brw_compute_barycentric_interp_modes().
Currently this function returns just
BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC, because this is the only
interpolation mode we support.  However, that will change in a later
patch.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/fs: Fix split_virtual_grfs() when delta_xy not in a virtual register.
Paul Berry [Fri, 21 Oct 2011 21:16:25 +0000 (14:16 -0700)]
i965/fs: Fix split_virtual_grfs() when delta_xy not in a virtual register.

This patch modifies the special case in
fs_visitor::split_virtual_grfs() that prevents splitting from being
applied to the delta_x/delta_y register pair (this register pair needs
to remain contiguous so that it can be used by the PLN instruction).

When gen>=6, this register pair is in a fixed location, not a virtual
register, so it was in no danger of being split.  And
split_virtual_grfs' attempt not to split it was preventing some other
unrelated register from being split.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoglsl: add ir_variable::determine_interpolation_mode() function.
Paul Berry [Fri, 21 Oct 2011 14:55:48 +0000 (07:55 -0700)]
glsl: add ir_variable::determine_interpolation_mode() function.

This function determines how a variable should be interpolated based
both on interpolation qualifiers and the current shade model.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoglsl: Distinguish between no interpolation qualifier and 'smooth'
Paul Berry [Fri, 21 Oct 2011 14:40:37 +0000 (07:40 -0700)]
glsl: Distinguish between no interpolation qualifier and 'smooth'

Previously, we treated the 'smooth' qualifier as equivalent to no
qualifier at all.  However, this is incorrect for the built-in color
variables (gl_FrontColor, gl_BackColor, gl_FrontSecondaryColor, and
gl_BackSecondaryColor).  For those variables, if there is no qualifier
at all, interpolation should be flat if the shade model is GL_FLAT,
and smooth if the shade model is GL_SMOOTH.

To make this possible, I added a new value to the
glsl_interp_qualifier enum, INTERP_QUALIFIER_NONE.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agomesa: Expose GLSL interpolation qualifiers in gl_fragment_program.
Paul Berry [Wed, 26 Oct 2011 01:06:37 +0000 (18:06 -0700)]
mesa: Expose GLSL interpolation qualifiers in gl_fragment_program.

This patch makes GLSL interpolation qualifiers visible to drivers via
the array InterpQualifier[] in gl_fragment_program, so that they can
easily be used by driver back-ends to select the correct interpolation
mode.

Previous to this patch, the GLSL compiler was using the enum
ir_variable_interpolation to represent interpolation types.  Rather
than make a duplicate enum in core mesa to represent the same thing, I
moved the enum into mtypes.h and renamed it to be more consistent with
the other enums defined there.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agodocs: update GL3 status
Marek Olšák [Thu, 27 Oct 2011 13:29:45 +0000 (15:29 +0200)]
docs: update GL3 status

EXT_texture_array has been completed for quite a while.

Removing BindBufferBase+Range, because they're part of EXT_transform_feedback.

12 years agor600g: remove redundant variable r600_pipe_context::blit
Marek Olšák [Thu, 27 Oct 2011 10:27:34 +0000 (12:27 +0200)]
r600g: remove redundant variable r600_pipe_context::blit

12 years agomesa: initialize ARB_transform_feedback2 dispatch
Marek Olšák [Tue, 25 Oct 2011 14:30:11 +0000 (16:30 +0200)]
mesa: initialize ARB_transform_feedback2 dispatch

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agomesa: improve EXT_transform_feedback display list support
Marek Olšák [Tue, 25 Oct 2011 14:15:05 +0000 (16:15 +0200)]
mesa: improve EXT_transform_feedback display list support

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agomesa: fix GL error checking in TransformFeedbackVaryings
Marek Olšák [Mon, 24 Oct 2011 00:21:48 +0000 (02:21 +0200)]
mesa: fix GL error checking in TransformFeedbackVaryings

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agost/glx: fix mixed declarations and code, remove unused var
Brian Paul [Wed, 26 Oct 2011 16:38:29 +0000 (10:38 -0600)]
st/glx: fix mixed declarations and code, remove unused var

12 years agost/mesa: tell VBO module to always unmap buffers before drawing
Brian Paul [Tue, 25 Oct 2011 23:41:12 +0000 (17:41 -0600)]
st/mesa: tell VBO module to always unmap buffers before drawing

Without this it's possible to wind up in a draw call with the
glBegin/End VBO still in a mapped state.  This is a problem for
the SVGA3D driver and probably not good for other HW drivers.

12 years agoglsl: Rename remaining internal builtins from gl_MESA* to gl_*MESA.
Eric Anholt [Fri, 21 Oct 2011 17:45:48 +0000 (10:45 -0700)]
glsl: Rename remaining internal builtins from gl_MESA* to gl_*MESA.

This matches the usual convention for extension builtin variables.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agointel: Drop texture border support code.
Eric Anholt [Mon, 17 Oct 2011 21:53:13 +0000 (14:53 -0700)]
intel: Drop texture border support code.

Now that texture borders are gone, we never need to allocate our
textures through non-miptrees, which simplifies some irritating paths.

v2: Remove the !mt support case from intel_map_texture_image()

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agointel: Enable stripping of texture borders.
Eric Anholt [Mon, 17 Oct 2011 21:34:52 +0000 (14:34 -0700)]
intel: Enable stripping of texture borders.

This replaces software rendering of textures with the deprecated
1-pixel border (which is always bad, since mipmapping is rather broken
in swrast, and GLSL 1.30 is unsupported) with hardware rendering that
just pretends there was never a border (so you have potential seams on
apps that actually intentionally used the 1-pixel borders, but correct
rendering otherwise).

This doesn't regress any piglit tests on gen6 (since the texwrap
border/bordercolor cases already failed due to broken border color
handling), but regresses texwrap border cases on original gen4 since
those end up sampling the border color instead of the border pixels.
It's a small price to pay for not thinking about texture borders any
more.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agomesa: Apply StripTextureBorder to CopyTexImage as well.
Eric Anholt [Tue, 25 Oct 2011 19:10:21 +0000 (12:10 -0700)]
mesa: Apply StripTextureBorder to CopyTexImage as well.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agomesa: Fold gallium's texture border stripping into a core Mesa option.
Eric Anholt [Mon, 17 Oct 2011 21:30:26 +0000 (14:30 -0700)]
mesa: Fold gallium's texture border stripping into a core Mesa option.

We wanted to reuse this in the Intel driver.

v2: Move the flag to ctx->Const

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agomesa: Skip texstore for 0-sized texture data.
Eric Anholt [Tue, 25 Oct 2011 21:38:39 +0000 (14:38 -0700)]
mesa: Skip texstore for 0-sized texture data.

The intel driver (and gallium, it looks like, though it doesn't use
these texstore functions at this point) doesn't bother making storage
for textures with 0 width, height, or depth.  This avoids them having
to deal with returning a mapping for that nonexistent data.

Fixes assertion failures with an upcoming intel driver change.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agor600g: remove redundant assignment of pipe_draw_info in draw_vbo
Marek Olšák [Wed, 26 Oct 2011 13:52:32 +0000 (15:52 +0200)]
r600g: remove redundant assignment of pipe_draw_info in draw_vbo

12 years agollvmpipe: llvmpipe doesn't support pure integers yet.
Dave Airlie [Wed, 26 Oct 2011 13:50:47 +0000 (15:50 +0200)]
llvmpipe: llvmpipe doesn't support pure integers yet.

Should fix: https://bugs.freedesktop.org/show_bug.cgi?id=42240

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agor600g: cleanup draw_vbo and add comments
Marek Olšák [Wed, 26 Oct 2011 00:17:52 +0000 (02:17 +0200)]
r600g: cleanup draw_vbo and add comments

12 years agoralloc: Move declaration before code.
Vinson Lee [Wed, 26 Oct 2011 03:30:27 +0000 (20:30 -0700)]
ralloc: Move declaration before code.

Fixes build error with MSVC.

12 years agoscons: Add link_uniforms.cpp to SConscript.
Vinson Lee [Wed, 26 Oct 2011 03:19:07 +0000 (20:19 -0700)]
scons: Add link_uniforms.cpp to SConscript.

12 years agoir_to_mesa: Use uniform_field_visitor to add all struct fields to parameter list
Ian Romanick [Mon, 24 Oct 2011 19:23:50 +0000 (12:23 -0700)]
ir_to_mesa: Use uniform_field_visitor to add all struct fields to parameter list

Previously the uniform was passed as single, whole structure to
_mesa_add_parameter.  This was completely bogus and resulted in a
DataType of 0 (instead of a valid GLSL type enum).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41980
Tested-by: Brian Paul <brianp@vmware.com>
Cc: Bryan Cain <bryancain3@gmail.com>
Cc: Vinson Lee <vlee@vmware.com>
Cc: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agolinker: Add uniform_field_visitor class to process leaf fields of a uniform
Ian Romanick [Tue, 25 Oct 2011 02:37:11 +0000 (19:37 -0700)]
linker: Add uniform_field_visitor class to process leaf fields of a uniform

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoralloc: Add new [v]asprintf_rewrite_tail functions.
Kenneth Graunke [Tue, 25 Oct 2011 02:33:16 +0000 (19:33 -0700)]
ralloc: Add new [v]asprintf_rewrite_tail functions.

This can be useful if you want to create a bunch of temporary strings
with a common prefix.  For example, when iterating over uniform
structure fields, one might want to create temporary strings like
"pallete.primary", "palette.outline", and "pallette.shadow".

This could be done by overwriting the '.' with a null-byte and calling
ralloc_asprintf_append, but that incurs the cost of strlen("pallete")
every time...when this is already known.

These new functions allow you rewrite the tail of the string, given a
starting index.  If the starting index is the length of the string, this
is equivalent to appending.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agolinker: Eliminate more dead code after demoting shader inputs and outputs
Ian Romanick [Fri, 21 Oct 2011 18:21:02 +0000 (11:21 -0700)]
linker: Eliminate more dead code after demoting shader inputs and outputs

Consider the following vertex shader and fragment shader:

// vertex shader
varying vec4 v;
uniform vec4 u;

void main() { gl_Position = vec4(0.0); v = u; }

// fragment shader
void main() { gl_FragColor = vec4(0.0); }

Since the fragment shader does not use 'v', it is demoted from a
varying to a simple global variable.  Once that happens, the
assignment to 'v' is useless, and it should be removed.  In addition,
'u' is no longer active, and it should also be removed.

Performing extra dead code elimination after demoting shader inputs
and outputs takes care of this.  This elimination must occur before
assigning uniform locations, or the declaration of 'u' cannot be
removed.

This change *breaks* the piglit test getuniform-01, but that test is
already incorrect.  The test uses a vertex shader that assigns to a
user-defined varying, but it has no fragment shader.  Since Mesa does
not support ARB_separate_shader_objects (we only support the EXT
version), the linker correctly eliminates the user-defined varying.
The cascading effect is that the uniform queried by the C code of the
test is also (correctly) eliminated.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41980
Tested-by: Brian Paul <brianp@vmware.com>
Cc: Bryan Cain <bryancain3@gmail.com>
Cc: Vinson Lee <vlee@vmware.com>
Cc: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
12 years agoglsl: Add uniform_locations_assigned parameter to do_dead_code opt pass
Ian Romanick [Fri, 21 Oct 2011 18:17:39 +0000 (11:17 -0700)]
glsl: Add uniform_locations_assigned parameter to do_dead_code opt pass

Setting this flag prevents declarations of uniforms from being removed
from the IR.  Since the IR is directly used by several API functions
that query uniforms in shaders, uniform declarations cannot be removed
after the locations have been set.  However, it should still be safe
to reorder the declarations (this is not tested).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41980
Tested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Bryan Cain <bryancain3@gmail.com>
Cc: Vinson Lee <vlee@vmware.com>
Cc: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
12 years agoi965: Add more #defines for Gen6+ 3DSTATE_GS fields.
Kenneth Graunke [Mon, 24 Oct 2011 06:02:05 +0000 (23:02 -0700)]
i965: Add more #defines for Gen6+ 3DSTATE_GS fields.

These should be useful for doing transform feedback on Sandybridge.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Add new brw_context::max_gs_threads constant.
Kenneth Graunke [Mon, 24 Oct 2011 05:27:14 +0000 (22:27 -0700)]
i965: Add new brw_context::max_gs_threads constant.

These are correct to the best of my knowledge, gleaned from a variety of
internal sources.  Sadly, the Sandybridge PRM has incorrect limits.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Rename (vs|wm)_max_threads to max_(vs|wm)_threads for consistency.
Kenneth Graunke [Mon, 24 Oct 2011 05:10:03 +0000 (22:10 -0700)]
i965: Rename (vs|wm)_max_threads to max_(vs|wm)_threads for consistency.

The inconsistency between vs_max_threads and max_vs_entries was rather
annoying.  I could never seem to remember which one was reversed, which
made it harder to find quickly.  "Max __ Threads" seems more natural.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Remove "single threaded" INTEL_DEBUG mode.
Kenneth Graunke [Mon, 24 Oct 2011 04:42:27 +0000 (21:42 -0700)]
i965: Remove "single threaded" INTEL_DEBUG mode.

According to the docs for 3DSTATE_PS (Gen7+) and 3DSTATE_WM (Gen6),
there is a platform dependent value for the minimum number of pixel
shader threads.  It may also vary based on whether WIZ Hashing is on.

For example, Ivybridge requires at least 4 threads if WIZ hashing is
disabled, and 8 if it's enabled.  Programming it to use less threads is
illegal.  Sandybridge appears to have similar restrictions.

So on newer platforms, INTEL_DEBUG=sing will probably just hang the GPU.
Rather than try to patch it up for newer platforms and extend it to
support geometry shaders, just remove it as it isn't that useful anyway.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agomesa: Remove unnecessary and incorrect TexEnv parameter validation.
Kenneth Graunke [Mon, 17 Oct 2011 23:41:57 +0000 (16:41 -0700)]
mesa: Remove unnecessary and incorrect TexEnv parameter validation.

For GL_RGB_SCALE and GL_ALPHA_SCALE targets, the API wrapper code
attempts to ensure the parameter is 1.0, 2.0, or 4.0.

This is unnecessary: set_combiner_scale in texenv.c (called by
_mesa_TexEnvfv) already checks this and raises an appropriate error.

It's also incorrect: For glTexEnvx, the API validation code directly
compares the GLfixed input parameter with a floating point constant,
prior to converting fixed-point to floating point.

Fixes an issue in the OpenGL ES 1.1 conformance suite.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agost/glx: Implement texture_from_pixmap without DRI.
Stéphane Marchesin [Mon, 24 Oct 2011 19:03:16 +0000 (12:03 -0700)]
st/glx: Implement texture_from_pixmap without DRI.

Makes texture_from_pixmap work with non-DRI llvmpipe.

12 years agoi915g: Cleanup the vertex sampler interface a bit.
Stéphane Marchesin [Tue, 18 Oct 2011 17:26:04 +0000 (10:26 -0700)]
i915g: Cleanup the vertex sampler interface a bit.

12 years agoi915g: Flesh out TODO idea.
Stéphane Marchesin [Tue, 18 Oct 2011 17:25:02 +0000 (10:25 -0700)]
i915g: Flesh out TODO idea.

12 years agointel: Kill dead code in intel_miptree_copy_teximage()
Chad Versace [Mon, 24 Oct 2011 20:55:43 +0000 (13:55 -0700)]
intel: Kill dead code in intel_miptree_copy_teximage()

Kill the code paths taken when src_mt is null. It is never null, otherwise
there would be a segfault on line 4 of this function:
    GLuint width = src_mt->level[level].width;

(Some interleaved lines in the diff make the real diff non-obvious. All
I did was delete some code and then left-shifted what remained to correct
the indentation.)

Reviewed-by: Eric Anholt <eric@aholt.net>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agotgsi: Fix memory leak in out-of-memory path.
Vinson Lee [Tue, 25 Oct 2011 15:23:02 +0000 (08:23 -0700)]
tgsi: Fix memory leak in out-of-memory path.

Fixes Coverity resource leak defect.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoswrast: Fix memory leak in out-of-memory path.
Vinson Lee [Tue, 25 Oct 2011 17:08:59 +0000 (10:08 -0700)]
swrast: Fix memory leak in out-of-memory path.

Fixes Coverity resource leak defect.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoswrast: use _mesa_ffs() instead of ffs()
Brian Paul [Tue, 25 Oct 2011 17:25:55 +0000 (11:25 -0600)]
swrast: use _mesa_ffs() instead of ffs()

Fixes MSVC build.

12 years agor600g: move some code out of draw_vbo into new r600_update_derived_state
Marek Olšák [Tue, 25 Oct 2011 17:20:14 +0000 (19:20 +0200)]
r600g: move some code out of draw_vbo into new r600_update_derived_state

12 years agor600g: cleanup some magic numbers
Marek Olšák [Tue, 25 Oct 2011 15:44:55 +0000 (17:44 +0200)]
r600g: cleanup some magic numbers