profile/ivi/mesa.git
12 years agomesa: fix glCompressedTexSubImage assertion/segfault
Brian Paul [Thu, 27 Sep 2012 12:31:25 +0000 (06:31 -0600)]
mesa: fix glCompressedTexSubImage assertion/segfault

If the destination texture image doesn't exist we'd hit an assertion
(or crash in a release build).  The piglit/s3tc-errors test hits this.
This has already been fixed in master by the error checking code
consolidation.

Note: This is a candidate for the 8.0 branch.

12 years agoscons: add new -p (prefix) options for yacc
Brian Paul [Sat, 15 Sep 2012 15:01:02 +0000 (09:01 -0600)]
scons: add new -p (prefix) options for yacc

These were recently added to the Makefiles.
(cherry picked from commit e78ebbc5f9448d459b57884d90b0a6496294c1dd)

12 years agor600g: fix EXP on Cayman
Marek Olšák [Tue, 25 Sep 2012 15:28:13 +0000 (17:28 +0200)]
r600g: fix EXP on Cayman

NOTE: This is a candidate for the stable branches.
(cherry picked from commit 96f50d0cf7bb13507f272d2f6ef9a6fca24d18e1)

12 years agor600g: fix RSQ of negative value on Cayman
Marek Olšák [Tue, 25 Sep 2012 15:20:38 +0000 (17:20 +0200)]
r600g: fix RSQ of negative value on Cayman

NOTE: This is a candidate for the stable branches.
(cherry picked from commit fd5c5384648a0d6191c19748a2d1f1148c5ee98f)

12 years agor600g: fix instance divisor on Cayman
Marek Olšák [Tue, 25 Sep 2012 14:09:24 +0000 (16:09 +0200)]
r600g: fix instance divisor on Cayman

Not sure if this is the best way to fix it.

NOTE: This is a candidate for the stable branches.
(cherry picked from commit 836325bf7edd797e02ab0717a05ca5c51aa1ac93)

12 years agometa: Use float for temporary images, not (un)signed normalized.
Kenneth Graunke [Sun, 16 Sep 2012 06:18:36 +0000 (23:18 -0700)]
meta: Use float for temporary images, not (un)signed normalized.

In commit 091eb15b694, Jordan changed get_temp_image_type() to use
_mesa_get_format_datatype() instead of returning GL_FLOAT.  That has
several possible return values: GL_FLOAT, GL_INT, GL_UNSIGNED_INT,
GL_SIGNED_NORMALIZED, and GL_UNSIGNED_NORMALIZED.

We do want to use GL_INT/GL_UNSIGNED_INT for integer formats.  However,
we want to continue using GL_FLOAT for the normalized fixed-point types.
There isn't any code in pack.c to handle GL_(UN)SIGNED_NORMALIZED.

Fixes oglconform's fboarb advanced.blit.copypix, which was regressed by
commit 091eb15b694a396f8453093575ccec2db7f14eb8.

NOTE: This is a candidate for the 9.0 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53573
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 3767b25bd3f77cede452cfbe9b66a51b352d9036)

12 years agoi965: Remove broken non-interleaved-to-interleaved upload code.
Eric Anholt [Fri, 21 Sep 2012 05:50:05 +0000 (07:50 +0200)]
i965: Remove broken non-interleaved-to-interleaved upload code.

This failed when all the uploads to occur were uniform-type vertex data (like
glColor4f being active across a DrawArrays), because it would upload 1 element
instead of 1 element per vertex.  There was no citation for how this code
helped any particular application, and it breaks ETQW, so just remove it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47170
NOTE: This is a candidate for the 9.0 and 8.0 branches.
Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 0334e8dc25d09e3254e61d5d122b4fd7bfbd627a)

12 years agometa: Don't _mesa_set_enable() invalid targets in ES 1.
Kenneth Graunke [Fri, 14 Sep 2012 09:39:52 +0000 (02:39 -0700)]
meta: Don't _mesa_set_enable() invalid targets in ES 1.

GL_TEXTURE_1D, GL_TEXTURE_3D, GL_TEXTURE_RECTANGLE, and
GL_TEXTURE_GEN_S/T/R/Q don't exist in ES 1 contexts, so any meta ops
that used _mesa_meta_begin with MESA_META_TEXTURE would trigger GL
errors.  One such operation is _mesa_meta_Clear().

On ES 1, we want to disable GL_TEXTURE_GEN_STR_OES instead.

Fixes the ES1 conformance test miplin.c, which was regressed by commit
08be1d288f216232d3974f5997b266a8dd720928.

NOTE: This is a candidate for the 9.0 branch.

v2: Also blacklist GL_TEXTURE_3D, per Brian's comment.
v3: Disable GL_TEXTURE_GEN_STR_OES, per Ian's comment.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54297
Reviewed-by: Brian Paul <brianp@vmware.com> [v1]
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 679c93ff89c71cbd3b1d24e88abd38f00b8c1f02)

12 years agobuild: Link libglapi with pthreads
Matt Turner [Wed, 19 Sep 2012 03:22:37 +0000 (20:22 -0700)]
build: Link libglapi with pthreads

NOTE: This is a candidate for the 9.0 branch.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=839060
          https://bugs.gentoo.org/show_bug.cgi?id=435152
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 9ed00075d8ea0ffaa675237e32b8611ad3064dbf)

12 years agobuild: Use AX_PTHREAD to detect pthreads
Matt Turner [Wed, 19 Sep 2012 03:21:47 +0000 (20:21 -0700)]
build: Use AX_PTHREAD to detect pthreads

NOTE: This is a candidate for the 9.0 branch.

Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 7da12426f7682ffc44ae40e31d1b5712521fbb70)

12 years agomesa: fix incorrect error for glCompressedSubTexImage
Brian Paul [Sat, 22 Sep 2012 15:30:23 +0000 (09:30 -0600)]
mesa: fix incorrect error for glCompressedSubTexImage

If a subtexture region isn't aligned to the compressed block size,
return GL_INVALID_OPERATION, not gl_INVALID_VALUE.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 1f586684d62c4f5208d1f3929d067a79ea2140ac)

12 years agoi915: Don't free the intel_context structure when intelCreateContext fails.
Ian Romanick [Thu, 27 Sep 2012 00:57:01 +0000 (17:57 -0700)]
i915: Don't free the intel_context structure when intelCreateContext fails.

intelDestroyContext will eventually be called, and it will clean things up.

NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53618
(cherry picked from commit de958de71b1450952e021af4e729c87406353db6)

12 years agoi965: Don't free the intel_context structure when intelCreateContext fails.
Ian Romanick [Fri, 31 Aug 2012 21:55:21 +0000 (14:55 -0700)]
i965: Don't free the intel_context structure when intelCreateContext fails.

This squashes two commits from master:

    i965: Don't free the intel_context structure when intelCreateContext fails.

    intelDestroyContext will eventually be called, and it will clean things
    up.  The call to brwInitVtbl is moved earlier so that
    intelDestroyContext can call the device-specific destructor.  This also
    makes the code look more like the i915 code.

    NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54301
    (cherry picked from commit 87f26214d6bdeb439b30615ec53c293c5141cf11)

And:

    i965: brwInitVtbl needs to know the chipset generation

    Fixes major regressions since de958de.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit e87c63f2889fcbeb5a8bbd91eda1333d7ed44bf2)

The second commit message should have read 'since 87f2621', of course.

12 years agointel: Don't call intelDestroyContext if there is no context to destroy
Ian Romanick [Fri, 28 Sep 2012 15:29:12 +0000 (08:29 -0700)]
intel: Don't call intelDestroyContext if there is no context to destroy

Some error paths in the device-specific context creation functions can exit
before the deintel_context structure is allocated.

NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53618
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54301
(cherry picked from commit 22897c74979aa02facdd5cd729db8dadf86924f5)

12 years agodri_util: Use calloc to allocate __DRIcontext
Ian Romanick [Wed, 26 Sep 2012 18:08:11 +0000 (11:08 -0700)]
dri_util: Use calloc to allocate __DRIcontext

The __DRIcontext contains some pointers, and some drivers check for them to be
NULL in some failure paths.  Instead of sprinkling NULL assignments across the
various drivers, just zero out the whole thing.

NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Lu Hua <huax.lu@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53618
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54301
(cherry picked from commit f93cb0bebb10e3e3e5df099be51021b211650356)

12 years agoi965/blorp: Add support for blits between SRGB and linear formats (fixed).
Kenneth Graunke [Tue, 11 Sep 2012 23:20:43 +0000 (16:20 -0700)]
i965/blorp: Add support for blits between SRGB and linear formats (fixed).

This is a squash of 2 commits from master.
The first commit is:

i965/blorp: Add support for blits between SRGB and linear formats.

Fixes colorspace issues in L4D2 when multisampling is enabled (the
scene was far too dark, but the flashlight area was way too bright).

The nVidia and AMD binary drivers both allow this kind of blit.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit e2249e8c4d06a85d6389ba1689e15d7e29aa4dff)

The second commit is:

i965/blorp: Fix sRGB MSAA resolves.

Commit e2249e8c4d06a85d6389ba1689e15d7e29aa4dff (i965/blorp: Add
support for blits between SRGB and linear formats) changed blorp to
always configure surface states for in linear format (even if the
underlying surface is sRGB).  This allowed sRGB-to-linear and
linear-to-sRGB blits to occur without causing the image to be
inappropriately brightened or darkened.

However, it broke sRGB MSAA resolves, since they rely on the
destination buffer format being sRGB in order to ensure that samples
are averaged together in sRGB-correct fashion.

This patch fixes the problem by instead configuring the source buffer
to use the *same* format as the destination buffer.  This ensures that
the image won't be brightened or darkened, but preserves proper sRGB
averaging.

Fixes piglit tests "EXT_framebuffer_multisample/accuracy srgb".

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

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 124b214f094fa63ff1ddb7e9f0a1c2e0ba8214fb)

12 years agoi965: Don't spill "smeared" registers.
Paul Berry [Wed, 19 Sep 2012 20:28:00 +0000 (13:28 -0700)]
i965: Don't spill "smeared" registers.

Fixes an assertion failure when compiling certain shaders that need both
pull constants and register spilling:

brw_eu_emit.c:204: validate_reg: Assertion `execsize >= width' failed.

NOTE: This is a candidate for the 8.0 release branch.

Signed-off-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit ab5ce2789fe9e5f2789ee22fdb02bcfed42a7125)

12 years agoi965/blorp: Increase Y alignment for multisampled stencil blits.
Paul Berry [Wed, 12 Sep 2012 18:13:49 +0000 (11:13 -0700)]
i965/blorp: Increase Y alignment for multisampled stencil blits.

This patch is a band-aid fix for a bug in commit 5fd67fa (i965/blorp:
Reduce alignment restrictions for stencil blits), which causes
multisampled stencil blits to work incorrectly on Sandy Bridge.

When blitting to or from a normal stencil buffer, we have to use a
coordinate transformation that swizzles coordinates to account for the
fact that stencil buffers use W tiling, but the most similar tiling
format available for textures and render targets is Y tiling.  The
differences between W and Y tiling cause pixels to be scrambled within
a block of size 8x4 (width x height) as measured relative to a W tile,
or 16x2 as measured relative to a Y tile.  So in order to make sure
that pixels at the edges of the blit aren't lost, we need to align the
rendering rectangle (and the buffer sizes) to multiples of the 8x4
block size.  This alignment happens in the brw_blorp_blit_params
constructor, whereas the determination of how to swizzle the
coordinates happens during code generation, in the
brw_blorp_blit_program class.

When blitting to or from a multisampled stencil buffer, the coordinate
swizzling is more complex, because it has to account for the
interleaving pattern of samples, which uses 4x4 blocks for 4x MSAA and
8x4 blocks for 8x MSAA.  The end result is that if multisampling is in
use, the 16x2 block size (relative so a Y tile) needs to be expanded
to 16x4, and the corresponding size relative to a W tile expands to
8x8.

The problem doesn't affect Ivy Bridge severely enough to crop up in
Piglit tests because on Ivy Bridge we have to disable multisampling
when blitting *to* a multisampled stencil buffer (the blorp compiler
generates code to compensate for the fact that multisampling is
disabled).  However I suspect a bug is still present because we don't
disable multisampling when blitting *from* a multisampled stencil
buffer.

This patch fixes the problem by doubling the vertical alignment
requirement when blitting to or from a multisampled stencil buffer,
and multisampling has not been disabled.

In the long run I would like to rework the brw_blorp_blit_params
constructor--it's difficult to follow and has had several subtle bugs
like this one.  However this band-aid fix should be suitable for
cherry-picking to release branches.

Fixes Piglit tests "unaligned-blit {2,4} stencil {msaa,upsample}" on
Sandy Bridge.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit a33ce665a5827c598b85bb04d94b33e6a5e41c28)

12 years agoi965/blorp: Fix offsets and width/height for stencil blits.
Paul Berry [Thu, 30 Aug 2012 15:01:54 +0000 (08:01 -0700)]
i965/blorp: Fix offsets and width/height for stencil blits.

Fixes piglit test "framebuffer-blit-levels draw stencil".

Acked-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 1a5d4f7cb2367c7863b28efbd78e9169114baf42)

12 years agoi965/blorp: Reduce alignment restrictions for stencil blits.
Paul Berry [Wed, 29 Aug 2012 21:26:48 +0000 (14:26 -0700)]
i965/blorp: Reduce alignment restrictions for stencil blits.

Previously, we aligned all stencil blit operations to multiples of the
size of a tile, since stencil buffers use W-tiling, and blorp has to
approximate this by configuring the 3D pipeline for Y-tiling and
swizzling coordinates.

However, this was unnecessarily conservative; it turns out that the
differences between W-tiling and Y-tiling are confined to 32-byte
sub-tiles within the 4k tiling pattern; the layout of these 32-byte
sub-tiles within the larger 4k tile is the same (8 sub-tiles across by
16 sub-tiles down, in column-major order).  Therefore we only need to
align stencil blit operations to multiples of the sub-tile size.

Note: although the performance improvement of this change is probably
quite small, the fact that W-tiling and Y-tiling formats only differ
within 32-byte sub-tiles will be essential in a future patch to ensure
that stencil blits work correctly between parts of the miptree other
than level/layer 0.  Making this change provides handy documentation
(and validation) of this fact.

Acked-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 5fd67fac14d7f35c311eb5c671be8d4ae9b2ea37)

12 years agoi965/blorp: don't reduce stencil alignment restrictions when multisampling.
Paul Berry [Wed, 29 Aug 2012 22:11:49 +0000 (15:11 -0700)]
i965/blorp: don't reduce stencil alignment restrictions when multisampling.

When blitting to a stencil buffer, we need to align the rectangle we
send down the rendering pipeline, to account for the fact that the
stencil buffer uses a W-tiled layout, but we are configuring its
surface state as Y-tiled.

Previously, when the stencil buffer was multisampled, we assumed that
we could reduce the amount of alignment that was necessary, since each
pixel occupies a block of 2x2 or 4x2 samples in the stencil buffer.
That would have been correct if the coordinates we were adjusting were
measured in pixels.  However, the conversion from pixel coordinates to
coordinates within the interleaved buffer has already been done;
therefore the full alignment restriction applies.

Note: the reason this mistake wasn't previously uncovered by piglit
tests is because it is being masked by another mistake: the blorp
engine is using overly conservative alignment restrictions when doing
stencil blits.  The overly conservative alignment restrictions will be
removed in the patch that follows.  Doing this fix now will prevent
the subsequent patch from introducing regressions.

Acked-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 1a75063d5f829547b75b60ae64bddf3905b4cb8f)

12 years agointel: Add map_stencil_as_y_tiled to intel_region_get_aligned_offset.
Paul Berry [Thu, 30 Aug 2012 18:16:44 +0000 (11:16 -0700)]
intel: Add map_stencil_as_y_tiled to intel_region_get_aligned_offset.

This patch modifies intel_region_get_aligned_offset() to make the
appropriate calculation when the blorp engine sets up a W-tiled
stencil buffer using a Y-tiled SURFACE_STATE.

Acked-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit b760c9913dcff848a2aa0e60abeb48e596ae8fee)

12 years agointel: Add map_stencil_as_y_tiled to intel_region_get_tile_masks.
Paul Berry [Thu, 30 Aug 2012 17:57:03 +0000 (10:57 -0700)]
intel: Add map_stencil_as_y_tiled to intel_region_get_tile_masks.

When the blorp engine is performing a blit from one stencil buffer to
another, it sets up the surface state for these buffers as Y-tiled, so
it needs to be able to force intel_region_get_tile_masks() to return
the appropriate masks for a Y-tiled region.

Acked-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 50dec7fc2d5ba813aaa822596d124098a22db301)

12 years agoi965/blorp: Account for offsets when emitting SURFACE_STATE.
Paul Berry [Wed, 29 Aug 2012 23:04:15 +0000 (16:04 -0700)]
i965/blorp: Account for offsets when emitting SURFACE_STATE.

Fixes piglit tests "framebuffer-blit-levels {read,draw} depth".

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit f04f219906e40a6647a10fd9c1928509fe25fb84)

12 years agoi965/blorp: Thread level and layer through brw_blorp_blit_miptrees().
Paul Berry [Thu, 16 Aug 2012 17:06:08 +0000 (10:06 -0700)]
i965/blorp: Thread level and layer through brw_blorp_blit_miptrees().

Previously, when performing a blit using the blorp engine, we failed
to account for the level and layer of the source and destination.  As
a result, all blits would occur between miplevel 0 and layer 0 of the
corresponding textures, regardless of which level/layer was bound to
the framebuffer.

This patch passes the correct level and layer through
brw_blorp_miptrees() into the brw_blorp_blit_params data structure.

Further patches in the series will adapt
gen{6,7}_blorp_emit_surface_state to make use of these parameters.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 3123f0621561549c4566248100661ef77cab2834)

12 years agoi965/blorp: store x and y offsets in brw_blorp_mip_info.
Paul Berry [Wed, 29 Aug 2012 19:16:06 +0000 (12:16 -0700)]
i965/blorp: store x and y offsets in brw_blorp_mip_info.

Currently, gen{6,7}_blorp_emit_surface_state assumes that the src and
dst surfaces are mapped to miplevel 0 and layer 0 (thus no surface
offset is required).  This is a bug, since the user might try to blit
to and from levels/layers other than 0.

To fix this bug, it will not be sufficient to have
gen6_{6,7}_blorp_emit_surface_state look up the surface offset at the
time they set up the surface state, since these offsets will need to
be tweaked when blitting stencil buffers (due to the fact that stencil
buffer blits have to swizzle between W and Y tiling formats).

So, to pave the way for the bug fix, this patch causes the x and y
offsets to be computed during blit setup and stored in
brw_blorp_mip_info.

As a result of this change, brw_blorp_mip_info doesn't need to store
the level and layer anymore.

For consistency, this patch makes a similar change to the handling of
depth buffers when doing HiZ operations.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit c130ce7b2b26b4b67d4bf2b6dd1044a200efe25d)

12 years agoi965/blorp: store surface width/height in brw_blorp_mip_info.
Paul Berry [Wed, 29 Aug 2012 18:51:14 +0000 (11:51 -0700)]
i965/blorp: store surface width/height in brw_blorp_mip_info.

Previously, gen{6,7}_blorp_emit_surface_state would look up the width
and height of the surface at the time they set up the surface state,
and then tweak it if necessary (it's necessary when a W-tiled surface
is being mapped as Y-tiled).  With this patch, we look up the width
and height when setting up the blit, and store them in
brw_blorp_mip_info.  This allows us to do the necessary tweak in the
brw_blorp_blit_params constructor (where it makes more sense).  It
also reduces the need to keep track of level and layer in
brw_blorp_mip_info, so that a future patch can eliminate them
entirely.

For consistency, this patch makes a similar change to the handling of
depth buffers when doing HiZ operations.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 09b0fa8499d8035fa31ccb2b550056305fbd149b)

12 years agoi965/blorp: Change gl_renderbuffer* params to intel_renderbuffer*.
Paul Berry [Wed, 15 Aug 2012 21:51:56 +0000 (14:51 -0700)]
i965/blorp: Change gl_renderbuffer* params to intel_renderbuffer*.

This makes it more convenient for blorp functions to get access to
Intel-specific data inside the renderbuffer objects.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit e14b1288ef5b5b6091facaecd42e86f0a8157f28)

12 years agoi965/blorp: Clarify why width/height must be adjusted for Gen6 IMS surfaces.
Paul Berry [Wed, 29 Aug 2012 19:04:30 +0000 (12:04 -0700)]
i965/blorp: Clarify why width/height must be adjusted for Gen6 IMS surfaces.

Also add a clarifying comment for why the width/height doesn't need
adjustment for Gen7.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 32c7b2769cbe80ff56d1c73c4f9b62f13f577c8d)

12 years agoi965/gen6+: Adjust stencil buffer size after computing miptree layout.
Paul Berry [Tue, 4 Sep 2012 14:57:37 +0000 (07:57 -0700)]
i965/gen6+: Adjust stencil buffer size after computing miptree layout.

Since Gen6+ stencil buffers use W-tiling (a tiling arrangement which
drm and the kernel are not aware of) we need to round up the width and
height of a stencil buffer to multiples of the W-tile size (64x64)
before allocating a stencil buffer.  Previously, we rounded up the
size of the base miplevel, and then computed the miptree layout based
on the rounded up size.  This was incorrect, because it meant that the
total size of the miptree would not be properly W-tile aligned, and
therefore we would not always allocate enough pages.

(Note: even though the GL API doesn't allow creation of mipmapped
stencil textures, it does allow mipmapping of a combined depth/stencil
texture, and on Gen6+, a combined depth/stencil texture is internally
implemented as a pair of separate depth and stencil buffers.)

For example, on Sandy Bridge, when allocating a mipmapped stencil
texture of size 128x128, we would first round up to the nearest
multiple of 64x64 (causing no change to the size), and then compute
the miptree layout (whose size worked out to 128x196).  Then we would
request an allocation of 128*196 bytes (6.125 pages), causing 7 pages
to be allocated to the texture.  However, the texture needs 8 pages,
since each W-tile occupies a page, and it takes 2 W-tiles to cover a
width of 128 and 4 W-tiles to cover a height of 196.

This patch changes the order of operations so that the miptree layout
is computed first and then the total size of the miptree is rounded up
to be W-tile aligned.

NOTE: This is a candidate for the 8.0 release branch.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit bde833c9d014ad8aebfab0d2285184d7e6d5896d)

12 years agomesa: Don't set uniform dispatch pointers for many things in ES2 or core
Ian Romanick [Wed, 5 Sep 2012 21:15:30 +0000 (14:15 -0700)]
mesa: Don't set uniform dispatch pointers for many things in ES2 or core

NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 6c01a0e770432eda0e29dbd7278a94efc688a6d3)

12 years agomesa: Don't set shaderapi dispatch pointers for many things in ES2 or core
Ian Romanick [Wed, 5 Sep 2012 21:14:13 +0000 (14:14 -0700)]
mesa: Don't set shaderapi dispatch pointers for many things in ES2 or core

v2: Allow GL_ARB_shader_objects functions in core profile because we
still expose the extension string there.  Don't allow
glBindFragDataLocation in GLES3 because it's not part of that API.
Based (mostly) on review comments from Eric Anholt.

NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit be66cf950e01d217b5341f8e56676dc5bf81ca47)

12 years agomesa: Don't set vtxfmt dispatch pointers for many things in ES2 or core
Ian Romanick [Wed, 5 Sep 2012 21:11:33 +0000 (14:11 -0700)]
mesa: Don't set vtxfmt dispatch pointers for many things in ES2 or core

NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit aa0f588e2d4c160879699180f0e7f4d3e52b55b9)

12 years agomesa: Don't set loopback dispatch pointers for most things in ES2 or core
Ian Romanick [Wed, 5 Sep 2012 21:10:23 +0000 (14:10 -0700)]
mesa: Don't set loopback dispatch pointers for most things in ES2 or core

NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit a13c07f7528c74fc433a7227777351110087b89d)

12 years agomesa: Pass GL context to _mesa_create_save_table
Ian Romanick [Wed, 5 Sep 2012 15:12:18 +0000 (08:12 -0700)]
mesa: Pass GL context to _mesa_create_save_table

This isn't used by this patch, but it will be necessary for several
follow-on patches.  Separating this out will make it easier to reorder
patches later.

NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 3ef9e43865f38e9c8c5681768645513ce26e0488)

12 years agomesa: Don't set dispatch pointer for glTexStorage in ES2
Ian Romanick [Wed, 5 Sep 2012 21:07:50 +0000 (14:07 -0700)]
mesa: Don't set dispatch pointer for glTexStorage in ES2

NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit ee77061277b640d78befb43c26a3ffbe227e9244)

12 years agomesa: Don't set dispatch pointer for glGetProgramivARB in ES2
Ian Romanick [Wed, 5 Sep 2012 21:06:18 +0000 (14:06 -0700)]
mesa: Don't set dispatch pointer for glGetProgramivARB in ES2

This function is not the same as glGetProgramiv.

NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 7f7268d385cc1435264b8d3111e1596b2dae9183)

12 years agomesa: Don't set dispatch pointer for glResizeBuffersMESA in ES2
Ian Romanick [Wed, 5 Sep 2012 21:04:13 +0000 (14:04 -0700)]
mesa: Don't set dispatch pointer for glResizeBuffersMESA in ES2

NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit a83b01371e60356d2ed69c131bf9e0a0daba59a4)

12 years agomesa: Don't set dispatch pointers for glPointParameter[if][v] in ES2
Ian Romanick [Wed, 5 Sep 2012 21:01:42 +0000 (14:01 -0700)]
mesa: Don't set dispatch pointers for glPointParameter[if][v] in ES2

NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 1c0a44aaf5c095ca261d1ce11bb8a67dbbce54a2)

12 years agomesa: Don't set dispatch pointers for glClearDepth or glDepthRange in ES2
Ian Romanick [Wed, 5 Sep 2012 21:00:40 +0000 (14:00 -0700)]
mesa: Don't set dispatch pointers for glClearDepth or glDepthRange in ES2

NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 2a3a68e4c7b15860ac9398c5a56c0d6762573633)

12 years agomesa: Don't set dispatch pointer for glGetBufferSubData in ES2
Ian Romanick [Wed, 5 Sep 2012 15:48:32 +0000 (08:48 -0700)]
mesa: Don't set dispatch pointer for glGetBufferSubData in ES2

NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 11927bfc4a43aefbac5af35aae34d5cdf5d9e6bb)

12 years agomesa: Don't set dispatch pointer for glGetDoublev in ES2
Ian Romanick [Wed, 5 Sep 2012 15:21:04 +0000 (08:21 -0700)]
mesa: Don't set dispatch pointer for glGetDoublev in ES2

NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 850412b8ab272b9616da9a0df29e424b07bddde9)

12 years agomesa: Don't set dispatch pointer for glPointSize in ES2
Ian Romanick [Wed, 5 Sep 2012 15:16:23 +0000 (08:16 -0700)]
mesa: Don't set dispatch pointer for glPointSize in ES2

NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit aa129b0833052f613a6ec570aef092733769ee0e)

12 years agogles2: Alias glReadBufferNV with desktop glReadBuffer
Ian Romanick [Thu, 2 Aug 2012 05:09:08 +0000 (22:09 -0700)]
gles2: Alias glReadBufferNV with desktop glReadBuffer

NOTE: This is a candidate for the 9.0 branch

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: Kristian Høgsberg <krh@bitplanet.net>
(cherry picked from commit 23ff634c9c2eff744b5ddae7d1ba02bc1ef19ac5)

12 years agomesa: Allow glGetTexParameter of GL_TEXTURE_SRGB_DECODE_EXT
Ian Romanick [Tue, 18 Sep 2012 13:19:18 +0000 (15:19 +0200)]
mesa: Allow glGetTexParameter of GL_TEXTURE_SRGB_DECODE_EXT

This was already (correctly) supported for glGetSamplerParameter paths.

NOTE: This is a candidate for stable branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit ae3023e9675a033ff66b9bb14598aa1f02530d7f)

12 years agomesa: fix dropped && in glGetStringi()
Chris Forbes [Sun, 16 Sep 2012 07:54:11 +0000 (19:54 +1200)]
mesa: fix dropped && in glGetStringi()

This fixes glGetStringi(GL_EXTENSIONS,.. for core contexts. Previously,
all extension names returned would be NULL.

NOTE: This is a candidate for release branches.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit d30a7d2eb4b6d853bfa90169341334f2b2a643d5)

12 years agoupgrade glext.h to version 85
Brian Paul [Mon, 24 Sep 2012 14:06:56 +0000 (08:06 -0600)]
upgrade glext.h to version 85

NOTE: This is a candidate for the stable branches.
(cherry picked from commit 68060cfb2bbf890a3932c8d25382261a83f393af)

12 years agotargets/xorg-i915: Rename driver to i915_drv.so.
Matt Turner [Mon, 24 Sep 2012 16:56:38 +0000 (09:56 -0700)]
targets/xorg-i915: Rename driver to i915_drv.so.

modesetting_drv.so is undescriptive and collides with
xf86-video-modesetting.

Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
12 years agomesa: Ignore SRGB when determining compatible resolve formats.
Kenneth Graunke [Tue, 4 Sep 2012 18:29:30 +0000 (11:29 -0700)]
mesa: Ignore SRGB when determining compatible resolve formats.

MSAA resolves and other blit-like operations ignore SRGB state anyway,
so we should be able to safely allow resolves between compatible
SRGB/linear formats like SRGBA8 and RGBA8888.

This matches the behavior of the nVidia and AMD binary drivers.

Fixes completely black rendering when using multisampling in L4D2.

NOTE: This is a candidate for the 9.0 branch.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit c96828ecb46b5aee3121a018be365b738c35cbdc)

12 years agomesa: Don't override S3TC internalFormat if data is pre-compressed.
Kenneth Graunke [Wed, 19 Sep 2012 19:01:14 +0000 (12:01 -0700)]
mesa: Don't override S3TC internalFormat if data is pre-compressed.

Commit 42723d88d intended to override an S3TC internalFormat to a
generic compressed format when the application requested online
compression of uncompressed data.  Unfortunately, it also broke
pre-compressed textures when libtxc_dxtn isn't installed but the
extensions are forced on.

Both glCompressedTexImage2D() and glTexImage2D() call teximage(), which
calls _mesa_choose_texture_format(), hitting this override code.  If we
have actual S3TC source data, we can't treat it as any other format, and
need to avoid the override.

Since glCompressedTexImage2D() passes in a format of GL_NONE (which is
illegal for glTexImage), we can use that to detect the pre-compressed
case and avoid the overrides.

Fixes a regression since 42723d88d370a7599398cc1c2349aeb951ba1c57.

NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-and-tested-by: Jordan Justen <jordan.l.justen@intel.com>
(cherry picked from commit 328961d95586931a17fe81ba816d362e8389c105)

12 years agometa: Don't _mesa_set_enable() invalid targets in ES 1.
Kenneth Graunke [Fri, 14 Sep 2012 09:39:52 +0000 (02:39 -0700)]
meta: Don't _mesa_set_enable() invalid targets in ES 1.

GL_TEXTURE_1D, GL_TEXTURE_3D, GL_TEXTURE_RECTANGLE, and GL_TEXTURE_GEN_*
don't exist in ES 1 contexts, so any meta ops that used _mesa_meta_begin
with MESA_META_TEXTURE would trigger GL errors.  One such operation is
_mesa_meta_Clear().

Fixes the ES1 conformance test miplin.c, which was regressed by commit
08be1d288f216232d3974f5997b266a8dd720928.

NOTE: This is a candidate for the 9.0 branch.

v2: Also blacklist GL_TEXTURE_3D, per Brian's comments.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54297
Cc: Ian Romanick <idr@freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agodarwin: do not create double-buffered offscreen pixel formats
Jonas Maebe [Sun, 9 Sep 2012 22:44:15 +0000 (00:44 +0200)]
darwin: do not create double-buffered offscreen pixel formats

http://xquartz.macosforge.org/trac/ticket/536

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 5fdf1f784bf449d7ce9839506fa23c5357696c4c)

12 years agowinsys/radeon: fix relocs caching
Vadim Girlin [Wed, 19 Sep 2012 00:48:16 +0000 (04:48 +0400)]
winsys/radeon: fix relocs caching

Don't cache pointers to elements of reallocatable array.
In some circumstances it caused false cache hits resulting in incorrect
command stream and gpu lockup.

Note: This is a candidate for the stable branches.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
(cherry picked from commit 9aa8bac98b823e8783bc3a06a6e5b23fbf8d87fb)

12 years agodraw: fix non-indexed draw calls if there's an index buffer
Marek Olšák [Fri, 14 Sep 2012 15:03:25 +0000 (17:03 +0200)]
draw: fix non-indexed draw calls if there's an index buffer

pipe_draw_info::indexed determines if it should be indexed and not
the presence of an index buffer.

This fixes crashes in r300g.

NOTE: This is a candidate for the stable branches.

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 2988fa940e1d8a4531fddff4d554eec1e6e04474)

12 years agor600g: set QUANT_MODE on Cayman too
Marek Olšák [Tue, 18 Sep 2012 23:29:17 +0000 (01:29 +0200)]
r600g: set QUANT_MODE on Cayman too

This fixes piglit/fbo-blit-stretched.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit bfe489c76b6fd58bc4d8cc7f7a3859ff3dc1782e)

12 years agor600g: do not require MSAA renderbuffer support if not asked for
Marek Olšák [Sat, 8 Sep 2012 13:50:30 +0000 (15:50 +0200)]
r600g: do not require MSAA renderbuffer support if not asked for

to allow stencil-only sampler-only formats (like X24S8)

NOTE: This is a candidate for the stable branches.
(cherry picked from commit df5e2c058f73b72909fa99a2a189f5877525e3bf)

12 years agogallium/u_blitter: fix stencil-only blits
Marek Olšák [Sat, 8 Sep 2012 13:30:24 +0000 (15:30 +0200)]
gallium/u_blitter: fix stencil-only blits

NOTE: This is a candidate for the stable branches.
(cherry picked from commit 61706915a3b5644faf7a5e67f47c9c593620bf8c)

12 years agor300g: fix colormask with non-BGRA formats
Marek Olšák [Fri, 14 Sep 2012 03:34:23 +0000 (05:34 +0200)]
r300g: fix colormask with non-BGRA formats

NOTE: This is a candidate for the stable branches.
(cherry picked from commit 1e51d368eb5360378218217ff35731896f48512f)

12 years agor600g: don't use a staging resource for large transfers
Marek Olšák [Thu, 13 Sep 2012 18:20:46 +0000 (20:20 +0200)]
r600g: don't use a staging resource for large transfers

It kills performance if the resource is linear.
(cherry picked from commit e386972f5bcb59a37489ea627030315bf8961fd4)

12 years agodocs: fix some issues in relnotes
Andreas Boll [Sat, 1 Sep 2012 09:18:19 +0000 (11:18 +0200)]
docs: fix some issues in relnotes

improve markup
fix link to relnotes-9.0
add missing relnotes links
(cherry picked from commit 6fb8aeb2c5c64418795691261176c158c1a20e00)

12 years agodocs/devinfo: fix typo
Andreas Boll [Wed, 19 Sep 2012 10:10:32 +0000 (12:10 +0200)]
docs/devinfo: fix typo
(cherry picked from commit abb1c847ac9d9fa14ba6f786a205446957d45827)

12 years agobuild: Don't list glproto and dri2proto in pkg-config file
Matt Turner [Wed, 12 Sep 2012 00:08:17 +0000 (17:08 -0700)]
build: Don't list glproto and dri2proto in pkg-config file

No files provided by glproto or dri2proto are needed for building
something with Mesa.

Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=342393
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
12 years agomesa/glsl: rename preprocess to glcpp_preprocess
Dave Airlie [Fri, 14 Sep 2012 00:13:01 +0000 (10:13 +1000)]
mesa/glsl: rename preprocess to glcpp_preprocess

This symbol with dricore escapes into the namespace, its too generic,
we should prefix it with something just to be nice.

Should be applied to stable + 9.0

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 88b0790b1ae8864d4ec6196b3939498bbffdbb5f)

12 years agoglcpp: fix abuse of yylex
Dave Airlie [Fri, 14 Sep 2012 09:59:54 +0000 (19:59 +1000)]
glcpp: fix abuse of yylex

So glcpp tried to workaround yylex its own way, but failed,
do it properly.

This fixes another crash found after fixing the first crash.

this is a candidate for 9.0 and stable branches

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 53d46bc787318ccf9911fdd1d5fe99ee4db7f41a)

12 years agomesa: use a prefix for the program lex
Dave Airlie [Fri, 14 Sep 2012 00:05:53 +0000 (10:05 +1000)]
mesa: use a prefix for the program lex

This avoids us making a global yylex symbol which will interfere will
all sorts of apps.

with libdricore which can't do symbol visibility currently we pollute
the namespace with this.

This is a candidate for 9.0 & stable branches.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit cc943c8470b38a1f13d2493f293a153f75754caa)

12 years agomklib: clean up abi flags for x86 targets
Mike Frysinger [Tue, 11 Sep 2012 05:57:25 +0000 (01:57 -0400)]
mklib: clean up abi flags for x86 targets

The current code is duplicated in two places and relies on `uname` to
detect the flags.  This is no good for cross-compiling, and the current
logic uses -m64 for the x32 ABI which breaks things.

Unify the code in one place, avoid `uname` completely, and add support
for the new x32 ABI.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agor600g: reduce quant mode on evergreen+
Alex Deucher [Thu, 13 Sep 2012 21:25:42 +0000 (17:25 -0400)]
r600g: reduce quant mode on evergreen+

Seems to have an affect on the allowable range of
values.  Set evergreen+ to 1/256 to match 6xx/7xx.

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

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit b33d7eaa5e77b5367584fe183c46f8c3d9a06760)

12 years agoi965: Fix out-of-order sampler unit usage in ARB fragment programs.
Kenneth Graunke [Wed, 12 Sep 2012 05:14:59 +0000 (22:14 -0700)]
i965: Fix out-of-order sampler unit usage in ARB fragment programs.

ARB fragment programs use texture unit numbers directly, unlike GLSL
which has an extra indirection.  If a fragment program only uses one
texture assigned to GL_TEXTURE1, SamplersUsed will only contain a single
bit, which would make us only upload a single surface/sampler state
entry.  However, it needs to be the second entry.

Using _mesa_fls() instead of _mesa_bitcount() solves this.  For ARB
programs, this makes num_samplers the ID of the highest texture unit
used.  Since GLSL uses consecutive integers assigned by the linker,
_mesa_fls() should give the same result as _mesa_bitcount()..

Fixes a regression since 85e8e9e000732908b259a7e2cbc1724a1be2d447,
which caused GPU hangs in ETQW (and probably others), as well as
breaking piglit test fp-fragment-position.

v2: Add a comment, as suggested by Matt.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54098
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54179
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Tested-by: meng <mengmeng.meng@intel.com>
(cherry picked from commit 28f4be9eb91b12a2c6b1db6660cca71a98c486ec)

12 years agomesa: Add a _mesa_fls() function to find the last bit set in a word.
Kenneth Graunke [Wed, 12 Sep 2012 05:14:58 +0000 (22:14 -0700)]
mesa: Add a _mesa_fls() function to find the last bit set in a word.

ffs() finds the least significant bit set; _mesa_fls() finds the /most/
significant bit.

v2: Make it an inline function in imports.h, per Brian's suggestion.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 0fc163408e6b9521d545daba19f70631011d5752)

12 years agor600g: adjust QUANT_MODE for higher precision
Vadim Girlin [Mon, 3 Sep 2012 20:18:13 +0000 (00:18 +0400)]
r600g: adjust QUANT_MODE for higher precision

Use 1/256 for R6xx/7xx, 1/4096 for evergreen, instead of default 1/16.

Helps to pass some piglit tests (fbo, multisample).

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit f44bda17f515c411071ca8744ebd96039d9c583b)

12 years agomesa: don't wait in _mesa_ClientWaitSync if timeout is 0
Vadim Girlin [Fri, 31 Aug 2012 21:02:24 +0000 (01:02 +0400)]
mesa: don't wait in _mesa_ClientWaitSync if timeout is 0

From ARB_sync spec:

    If the value of <timeout> is zero, then ClientWaitSync does not
    block, but simply tests the current state of <sync>. TIMEOUT_EXPIRED
    will be returned in this case if <sync> is not signaled, even though
    no actual wait was performed.

Fixes random fails of the arb_sync-timeout-zero piglit test on r600g.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit b05a1fc156c4776d97d6ff3dcce71e6e34bac21d)

12 years agomesa: fix proxy texture error handling in glTexStorage()
Brian Paul [Sat, 8 Sep 2012 15:33:13 +0000 (09:33 -0600)]
mesa: fix proxy texture error handling in glTexStorage()

This is basically a follow-on to 1f5b1f98468d5e80be39e619ed15c422fbede8d3.
Basically, generate GL errors for ordinary invalid parameters for proxy
targets the same as for non-proxy targets.  Only texture size and OOM
errors should be handled specially for proxies.

Note: This is a candidate for the stable branches.
(cherry picked from commit 35c75f6777c177a59df8a87adf0777403113ce74)

12 years agomesa: make _mesa_get_proxy_target() non-static
Brian Paul [Sat, 8 Sep 2012 15:46:14 +0000 (09:46 -0600)]
mesa: make _mesa_get_proxy_target() non-static

Needed for the next patch.

Note: This is a candidate for the stable branches.
(cherry picked from commit d17440dcaa42ac4c19dad1be7d4c7199395135a9)

12 years agomesa: do internal format error checking for glTexStorage()
Brian Paul [Sat, 8 Sep 2012 15:27:46 +0000 (09:27 -0600)]
mesa: do internal format error checking for glTexStorage()

Turns out we weren't doing any format checking before.  Now check
the internal format and, in particular, make sure that unsized internal
formats aren't accepted.

Note: This is a candidate for the stable branches.
(cherry picked from commit 2e4fc54977977e674ee77294e6632a24e594d17f)

12 years agomesa/msaa: Allow X and Y flips in multisampled blits.
Paul Berry [Wed, 5 Sep 2012 23:07:16 +0000 (16:07 -0700)]
mesa/msaa: Allow X and Y flips in multisampled blits.

From the GL 4.3 spec, section 18.3.1 "Blitting Pixel Rectangles":

    If SAMPLE_BUFFERS for either the read framebuffer or draw
    framebuffer is greater than zero, no copy is performed and an
    INVALID_OPERATION error is generated if the dimensions of the
    source and destination rectangles provided to BlitFramebuffer are
    not identical, or if the formats of the read and draw framebuffers
    are not identical.

It is not clear from the spec whether "dimensions" should mean both
sign and magnitude, or just magnitude.

Previously, Mesa interpreted "dimensions" as meaning both sign and
magnitude, so any multisampled blit that attempted to flip the image
in the X and/or Y direction would fail.

However, Y flips are likely to be commonplace in OpenGL applications
that have been ported from DirectX applications, as a result of the
fact that DirectX and OpenGL differ in their orientation of the Y
axis.  Furthermore, at least one commercial driver (nVidia) permits Y
filps, and L4D2 relies on them being permitted.  So it seems prudent
for Mesa to permit them.

This patch changes Mesa to allow both X and Y flips, since there is no
language in the spec to indicate that X and Y flips should be treated
differently.

NOTE: This is a candidate for stable release branches.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit 5d5f0f349135786cdd76b6004f38b12e50d7f8f9)

12 years agoglsl: Generate compile errors for explicit blend indices < 0 or > 1.
Kenneth Graunke [Fri, 31 Aug 2012 23:04:19 +0000 (16:04 -0700)]
glsl: Generate compile errors for explicit blend indices < 0 or > 1.

According to the GLSL 4.30 specification, this is a compile time error.
Earlier specifications don't specify a behavior, but since 0 and 1 are
the only valid indices for dual source blending, it makes sense to
generate the error.

Fixes (the fixed version of) piglit's layout-12.frag.

NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
(cherry picked from commit 354f2cb5c7330a7d43cf0b177daf758d2aa31e0a)

12 years agoi965: Fix virtual_grf_interferes() between calculate_live_intervals() and DCE.
Eric Anholt [Thu, 6 Sep 2012 05:10:41 +0000 (22:10 -0700)]
i965: Fix virtual_grf_interferes() between calculate_live_intervals() and DCE.

This fixes the blue zombies bug in l4d2.

NOTE: This is a candidate for the 9.0 branch.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 39aca5076fa0e31d418b481167063933f5f7b74f)

12 years agoglapi/glx: rename 'table' variable to 'disp_table'
Brian Paul [Thu, 6 Sep 2012 14:16:56 +0000 (08:16 -0600)]
glapi/glx: rename 'table' variable to 'disp_table'

This fixes an issue where the local 'table' variable was hiding the
function parameter name in glGetColorTable(..., void *table).

This should be OK as long as there's never a GL entrypoint that uses
'disp_table' as a parameter name.

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 043f66204b1a190e18747c3befa8826c82dd87a7)

12 years agomesa: fix per-level max texture size error checking
Brian Paul [Wed, 5 Sep 2012 02:17:15 +0000 (20:17 -0600)]
mesa: fix per-level max texture size error checking

This is a long-standing omission in Mesa's texture image size checking.
We need to take the mipmap level into consideration when checking if the
width, height and depth are too large.

Fixes the new piglit max-texture-size-level test.
Thanks to Stéphane Marchesin for finding this problem.

Note: This is a candidate for the stable branches.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
(cherry picked from commit 771e7b6d884bb4294a89f276a904d90b28efb90a)

12 years agost/mesa: s/CALLOC/calloc/ to fix allocation bug
Brian Paul [Thu, 30 Aug 2012 22:12:53 +0000 (16:12 -0600)]
st/mesa: s/CALLOC/calloc/ to fix allocation bug

The CALLOC() macro only takes one argument so this was being treated
as a comma expression.  Simply use calloc() instead.

A follow-on patch will replace all CALLOC() calls with calloc().

NOTE: This is a candidate for the 8.0 and 9.0 branches.
(cherry picked from commit 43ed822a50db6b980041ddf91c16c7f8fccc4092)

12 years agoSet OSMESA_VERSION=8.
Johannes Obermayr [Sat, 1 Sep 2012 23:35:47 +0000 (01:35 +0200)]
Set OSMESA_VERSION=8.

VERSION_NUMBER is not required anymore. So it will be removed.

Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 10a96f4a4d3d3166fa6907d4b302e01ece5ccd7e)

12 years agor600g: fix num of dwords needed for alphatest_state atom
Jerome Glisse [Thu, 6 Sep 2012 19:09:21 +0000 (15:09 -0400)]
r600g: fix num of dwords needed for alphatest_state atom

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
12 years agomesa: Don't advertise GLES extensions in GL contexts
Chad Versace [Tue, 4 Sep 2012 17:02:43 +0000 (10:02 -0700)]
mesa: Don't advertise GLES extensions in GL contexts

glGetStringi(GL_EXTENSIONS) failed to respect the context's API, and so
returned all internally enabled GLES extensions from a GL context.
Likewise, glGetIntegerv(GL_NUM_EXTENSIONS) also failed to repsect the
context's API.

Note: This is a candidate for the 8.0 and 9.0 branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit f29a4b0157c6a7a31d2a2991a431b4211d01d162)

12 years agoandroid: do not expose single buffered eglconfigs
Tapani Pälli [Mon, 13 Aug 2012 13:47:52 +0000 (16:47 +0300)]
android: do not expose single buffered eglconfigs

On Android we want to add only double buffered configs for visuals.
Earlier implementation set the SurfaceType as 0 for single buffered
configs but driver still exposed these configs that were not compatible
with any egl surface type.  This caused Khronos conformance test runs to
fail on Android. This patch fixes the issue by skipping single buffered
configs earlier and not exposing them.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit d58ca43b809593314907694e744780ab9b28d590)

12 years agoandroid: fix liblog API changes
Tapani Pälli [Mon, 13 Aug 2012 06:03:06 +0000 (09:03 +0300)]
android: fix liblog API changes

android logging macros changed their name in JellyBean.

Signed-off-by: Bruce E. Robertson <bruce.e.robertson@intel.com>
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 29d394b9ba4d7a23524fc6fba6da6e043085744b)

12 years agoxmlconfig: use __progname when building for Android
Tapani Pälli [Tue, 5 Jun 2012 13:04:14 +0000 (16:04 +0300)]
xmlconfig: use __progname when building for Android

__progname symbol and strrchr are available with bionic.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 4d02b018f456c447e2c24ebd1460c27d6e5fb385)

12 years agometa: Don't save and restore fog state when there is no fog state
Ian Romanick [Fri, 31 Aug 2012 22:26:27 +0000 (15:26 -0700)]
meta: Don't save and restore fog state when there is no fog state

I wonder if the better solution is to have _mesa_meta_GenerateMipmap not
use MESA_META_ALL for the GLSL path.  Even on compatibility profiles
there is no reason to save and restore fog on this path.

NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Lu Hua <huax.lu@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54295
(cherry picked from commit 51b069e7aa81cdc8f38db71554ae3dd12ce0a6c4)

12 years agoi965/fs: Don't use brw->fragment_program in calculate_urb_setup().
Kenneth Graunke [Fri, 31 Aug 2012 08:00:15 +0000 (01:00 -0700)]
i965/fs: Don't use brw->fragment_program in calculate_urb_setup().

Reading brw->fragment_program is nonsensical in compiler code: it
contains the currently active program (if any), not the one currently
being compiled.  Attempting to access it may either lead to crashes
(null pointer dereference if no program is active) or wrong results.

Fixes piglit regressions since 9ef710575b914ddfc8e9a162d98ad554c1c217f7
on pre-Sandybridge hardware.  The actual bug was created in commit
7b1fbc688999fd568e65211d79d7678562061594.

NOTE: This is a candidate for the 8.0 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54183
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
(cherry picked from commit 4d9abd96cc177cade79b64544096eb45bf8313a2)

12 years agobuild: Remove left over echo from GLU removal
Matt Turner [Fri, 31 Aug 2012 22:11:11 +0000 (15:11 -0700)]
build: Remove left over echo from GLU removal

12 years agoRemove libGLU
Matt Turner [Thu, 23 Aug 2012 23:39:20 +0000 (16:39 -0700)]
Remove libGLU

It's been moved to its own repository, found at
http://cgit.freedesktop.org/mesa/glu/

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agodri: Rework planar image interface
Jakob Bornecrantz [Fri, 31 Aug 2012 17:48:26 +0000 (19:48 +0200)]
dri: Rework planar image interface

As discussed with Kristian on #wayland. Pushes the decision of components into
the dri driver giving it greater freedom to allow t to implement YUV samplers
in hardware, and which mode to use.

This interface will also allow drivers like SVGA to implement YUV surfaces
without the need to sub-allocate and instead send 3 seperate buffers for each
channel, currently not implemented.

I have tested these changes on Gallium Svga. Scott tested them on both intel
and Gallium Radeon. Kristan and Pekka tested them on intel.

v2: Fix typo in dri2_from_planar.
v3: Merge in intel changes.

(cherry picked from commit 6a7dea93fa70d670a5954e47a47075a2703209d4)

Tested-by: Scott Moreau <oreaus@gmail.com>
Tested-by: Pekka Paalanen <ppaalanen@gmail.com>
Tested-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
12 years agowinsys/radeon: disable virtual memory on Cayman
Marek Olšák [Thu, 30 Aug 2012 14:36:21 +0000 (16:36 +0200)]
winsys/radeon: disable virtual memory on Cayman

It hangs.

12 years agoscons: Remove leftover print statement.
Vinson Lee [Fri, 31 Aug 2012 15:23:28 +0000 (08:23 -0700)]
scons: Remove leftover print statement.

Remove print statement left over from commit
c57fb034b19156e06e2ec25d9b06a0e174d861c9.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
(cherry picked from commit f3bb6bd9b37d58ec16aac09d41546bd4702ecab8)

12 years agodocs: update relnotes-9.0
Andreas Boll [Fri, 31 Aug 2012 14:53:25 +0000 (16:53 +0200)]
docs: update relnotes-9.0

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agomesa: also bump version in Makefile.am and configure.ac to 9.0
Andreas Boll [Fri, 31 Aug 2012 14:43:56 +0000 (16:43 +0200)]
mesa: also bump version in Makefile.am and configure.ac to 9.0

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agoscons: Add default libraries to Solaris build.
Vinson Lee [Thu, 30 Aug 2012 06:16:44 +0000 (23:16 -0700)]
scons: Add default libraries to Solaris build.

Fixes SCons build on Solaris.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54293
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agodocs: Add some missing features to 9.0 release notes and GL3.txt
Ian Romanick [Thu, 30 Aug 2012 22:22:37 +0000 (15:22 -0700)]
docs: Add some missing features to 9.0 release notes and GL3.txt

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agomesa: Bump version to 9.0
Ian Romanick [Thu, 30 Aug 2012 20:55:02 +0000 (13:55 -0700)]
mesa: Bump version to 9.0

Now that OpenGL 3.1 is supported by at least one driver, follow
tradition and bump the major version number.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agor600g: enable transform feedback on Cayman
Marek Olšák [Thu, 30 Aug 2012 14:33:36 +0000 (16:33 +0200)]
r600g: enable transform feedback on Cayman

There doesn't seem to be anything wrong with it.

12 years agor600g: implement MSAA for Cayman
Marek Olšák [Thu, 30 Aug 2012 03:38:02 +0000 (05:38 +0200)]
r600g: implement MSAA for Cayman

Everything works except for blitting MSAA colorbuffers, which isn't
so trivial on Cayman. It's a rarely-used feature anyway.