mesa.git
12 years agomesa: remove redundant format/type checks in glReadPixels()
Brian Paul [Tue, 7 Feb 2012 14:42:33 +0000 (07:42 -0700)]
mesa: remove redundant format/type checks in glReadPixels()

These are done in _mesa_error_check_format_and_type().

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agomesa: remove redundant format/type checks in glGetTexImage()
Brian Paul [Tue, 7 Feb 2012 14:42:33 +0000 (07:42 -0700)]
mesa: remove redundant format/type checks in glGetTexImage()

The _mesa_error_check_format_and_type() function will catch all those
cases now.

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agomesa: new _mesa_error_check_format_and_type() function
Brian Paul [Tue, 7 Feb 2012 14:42:33 +0000 (07:42 -0700)]
mesa: new _mesa_error_check_format_and_type() function

This replaces the _mesa_is_legal_format_and_type() function.

According to the spec, some invalid format/type combinations to
glDrawPixels, ReadPixels and glTexImage should generate
GL_INVALID_ENUM but others should generate GL_INVALID_OPERATION.

With the old function we didn't make that distinction and generated
GL_INVALID_ENUM errors instead of GL_INVALID_OPERATION.  The new
function returns one of those errors or GL_NO_ERROR.

This will also let us remove some redundant format/type checks in
follow-on commit.

v2: add more checks for ARB_texture_rgb10_a2ui at the top of
_mesa_error_check_format_and_type() per Ian.

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agoscons: fix typo in package version
Dave Airlie [Tue, 7 Feb 2012 14:26:16 +0000 (14:26 +0000)]
scons: fix typo in package version

pointed out on irc by GArik_

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoradeon: only init surface manage on r600
Dave Airlie [Tue, 7 Feb 2012 14:19:28 +0000 (14:19 +0000)]
radeon: only init surface manage on r600

r300 fails to init the manager and then fails to init.

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoscons: Require same pkg-config versions as configure.
José Fonseca [Tue, 7 Feb 2012 11:17:35 +0000 (11:17 +0000)]
scons: Require same pkg-config versions as configure.

12 years agoscons: r300/r600 now depends on libdrm.
José Fonseca [Tue, 7 Feb 2012 11:16:35 +0000 (11:16 +0000)]
scons: r300/r600 now depends on libdrm.

As they now indirectly include on libdrm/radeon_surface.h.

12 years agomesa: support more format/type combos in _mesa_dump_image()
Brian Paul [Tue, 7 Feb 2012 00:56:43 +0000 (17:56 -0700)]
mesa: support more format/type combos in _mesa_dump_image()

12 years agoutil: fix typo in debug_printf_once comment
Brian Paul [Tue, 7 Feb 2012 00:56:43 +0000 (17:56 -0700)]
util: fix typo in debug_printf_once comment

12 years agor600g: add support for common surface allocator for tiling v13
Jerome Glisse [Mon, 30 Jan 2012 22:22:13 +0000 (17:22 -0500)]
r600g: add support for common surface allocator for tiling v13

Tiled surface have all kind of alignment constraint that needs to
be met. Instead of having all this code duplicated btw ddx and
mesa use common code in libdrm_radeon this also ensure that both
ddx and mesa compute those alignment in the same way.

v2 fix evergreen
v3 fix compressed texture and workaround cube texture issue by
   disabling 2D array mode for cubemap (need to check if r7xx and
   newer are also affected by the issue)
v4 fix texture array
v5 fix evergreen and newer, split surface values computation from
   mipmap tree generation so that we can get them directly from the
   ddx
v6 final fix to evergreen tile split value
v7 fix mipmap offset to avoid to use random value, use color view
   depth view to address different layer as hardware is doing some
   magic rotation depending on the layer
v8 fix COLOR_VIEW on r6xx for linear array mode, use COLOR_VIEW on
   evergreen, align bytes per pixel to a multiple of a dword
v9 fix handling of stencil on evergreen, half fix for compressed
   texture
v10 fix evergreen compressed texture proper support for stencil
    tile split. Fix stencil issue when array mode was clear by
    the kernel, always program stencil bo. On evergreen depth
    buffer bo need to be big enough to hold depth buffer + stencil
    buffer as even with stencil disabled things get written there.
v11 rebase on top of mesa, fix pitch issue with 1d surface on evergreen,
    old ddx overestimate those. Fix linear case when pitch*height < 64.
    Fix r300g.
v12 Fix linear case when pitch*height < 64 for old path, adapt to
    libdrm API change
v13 add libdrm check

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
12 years agoHave __glImageSize handle format GL_DEPTH_STENCIL_NV the same way as the server does
Jon TURNEY [Thu, 9 Sep 2010 12:43:11 +0000 (13:43 +0100)]
Have __glImageSize handle format GL_DEPTH_STENCIL_NV the same way as the server does

There is a mismatch between the way the X server and GLX library
calculates the image size for format GL_DEPTH_STENCIL(|_NV|_EXT)

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

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
12 years agost/vdpau: use dst surface size if clip width/height is zero
Christian König [Thu, 2 Feb 2012 16:10:58 +0000 (17:10 +0100)]
st/vdpau: use dst surface size if clip width/height is zero

Just another fix for gstreamer.

Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agost/vdpau: implement vlVdpOutputSurfaceQueryCapabilities
Christian König [Thu, 2 Feb 2012 13:02:52 +0000 (14:02 +0100)]
st/vdpau: implement vlVdpOutputSurfaceQueryCapabilities

Fixing some problems with gstreamer.

Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
12 years agonv50: fix bad assertion on Elements(phi->src) in regalloc
Christoph Bumiller [Mon, 6 Feb 2012 11:15:17 +0000 (12:15 +0100)]
nv50: fix bad assertion on Elements(phi->src) in regalloc

The array is phi->src, phi->src[i] is just a pointer.

12 years agodri: Don't build libdricommon.la if we don't need it
Jon TURNEY [Thu, 2 Feb 2012 10:39:04 +0000 (10:39 +0000)]
dri: Don't build libdricommon.la if we don't need it

Refine 80aa78142d12b21dd7d4f0edc786af98a159a80f "dri: make sure to build libdricommon.la"
so we don't build libdricommon if we aren't building a dri driver which needs it (i.e.
if we are just building swrast)

In particular, this restores the ability to build the swrast dri driver without having to
have a xf86drm.h

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
12 years agovl: add VL_MAX_SURFACES define
Christian König [Wed, 25 Jan 2012 12:58:57 +0000 (13:58 +0100)]
vl: add VL_MAX_SURFACES define

Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agovl: rename VL_MAX_PLANES to VL_NUM_COMPONENTS
Christian König [Wed, 25 Jan 2012 12:34:07 +0000 (13:34 +0100)]
vl: rename VL_MAX_PLANES to VL_NUM_COMPONENTS

Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agovl: prefix size defines with VL_
Christian König [Wed, 25 Jan 2012 10:53:00 +0000 (11:53 +0100)]
vl: prefix size defines with VL_

Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agovl: remove assert on unknown video profile
Christian König [Wed, 1 Feb 2012 11:37:44 +0000 (12:37 +0100)]
vl: remove assert on unknown video profile

It's perfectly valid to ask for an unknown
profile and get unknown code as a result.

Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agost/xvmc: respect caps when creating video buffers
Christian König [Wed, 1 Feb 2012 23:07:43 +0000 (00:07 +0100)]
st/xvmc: respect caps when creating video buffers

Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agost/vdpau: use interlacing capabilities
Christian König [Wed, 1 Feb 2012 22:50:34 +0000 (23:50 +0100)]
st/vdpau: use interlacing capabilities

Recreate video buffer if need arises.

Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agost/vdpau: implement uploads to interlaced video buffers
Christian König [Mon, 30 Jan 2012 17:04:50 +0000 (18:04 +0100)]
st/vdpau: implement uploads to interlaced video buffers

Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agovl: add interlacing capabilities
Christian König [Wed, 1 Feb 2012 22:38:45 +0000 (23:38 +0100)]
vl: add interlacing capabilities

Let the driver control interlaced or progressive
format of video buffers.

Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agovl: add a simple weave deinterlacer
Christian König [Mon, 23 Jan 2012 20:28:34 +0000 (21:28 +0100)]
vl: add a simple weave deinterlacer

Well it's not so simple, since it does
deinterlacing and scaling at the same time.

Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agovl/video_buffer: fix interlaced surface ordering
Christian König [Thu, 26 Jan 2012 14:30:53 +0000 (15:30 +0100)]
vl/video_buffer: fix interlaced surface ordering

Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agovl/video_buffer: fix height of interlaced video buffers
Christian König [Mon, 30 Jan 2012 16:51:53 +0000 (17:51 +0100)]
vl/video_buffer: fix height of interlaced video buffers

Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agomesa: check_index_bounds off-by-one fix
Roland Scheidegger [Mon, 6 Feb 2012 00:04:28 +0000 (01:04 +0100)]
mesa: check_index_bounds off-by-one fix

in check_index_bounds the comparison needs to be "greater equal" since
contrary to the name _MaxElement is the count of the array (this matches
similar code in vbo_exec_DrawRangeElementsBaseVertex).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Fix xcb-dri2 link flags leaking into LIBS.
Eric Anholt [Fri, 3 Feb 2012 04:28:14 +0000 (05:28 +0100)]
mesa: Fix xcb-dri2 link flags leaking into LIBS.

Fixes the build of builtin_compiler on my 32-bit build where xcb-dri2
is in a custom prefix but the custom prefix flags weren't available.
It shouldn't have been in LIBS anyway.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agointel: check for LLC support when reading maps
Eugeni Dodonov [Wed, 1 Feb 2012 20:24:23 +0000 (18:24 -0200)]
intel: check for LLC support when reading maps

This checks for advertised LLC support by the GPU instead of relying on
the GPU generation for detection.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
12 years agointel: verify if hardware has LLC support
Eugeni Dodonov [Wed, 1 Feb 2012 20:06:53 +0000 (18:06 -0200)]
intel: verify if hardware has LLC support

Rely on libdrm HAS_LLC parameter to verify if hardware supports it. In
case the libdrm version does not supports this check, fallback to older
way of detecting it which assumed that GPUs newer than GEN6 have it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
12 years agodraw: fix fog coord export.
Dave Airlie [Sat, 28 Jan 2012 18:29:18 +0000 (18:29 +0000)]
draw: fix fog coord export.

This does what we do in the hw drivers, and only export the X.

fixes the fogcoord.dp* tests.

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agovbo: fix a building error
Chih-Wei Huang [Thu, 2 Feb 2012 12:23:57 +0000 (20:23 +0800)]
vbo: fix a building error

Signed-off-by: Marek Olšák <maraeo@gmail.com>
NOTE: This is a candidate for the 8.0 branch.

12 years agollvmpipe: Make more resilient to out-of-memory situations.
José Fonseca [Wed, 9 Nov 2011 19:29:37 +0000 (19:29 +0000)]
llvmpipe: Make more resilient to out-of-memory situations.

Most of the code was alright, but we were missing a few paths.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agollvmpipe: clear storage for newly allocated resources
Keith Whitwell [Wed, 22 Dec 2010 14:04:42 +0000 (14:04 +0000)]
llvmpipe: clear storage for newly allocated resources

Was previously being done in a state-tracker, but in a way which was
difficult for some drivers to optimize.  Push down to this level and
make it the individual drivers responsibility.

12 years agointel: FBOs with texture border are unsupported
Ian Romanick [Wed, 1 Feb 2012 17:18:13 +0000 (10:18 -0700)]
intel: FBOs with texture border are unsupported

FBOs differ from textures in a significant way.  With textures, we can
strip the border and get correct rendering except when the application
fetches texels outside [0,1].

With an FBO, the pixel at (0,0) is in the border.  The
ARB_framebuffer_object spec says:

    "If the attached image is a texture image, then the window
    coordinates (x[w], y[w]) correspond to the texel (i, j, k), from
    figure 3.10 as follows:

                           i = (x[w] - b)

                           j = (y[w] - b)

                           k = (layer - b)

    where <b> is the texture image's border width..."

Since the border doesn't exist, we can never render any pixels in the
correct location.  Just mark these FBOs FRAMEBUFFER_UNSUPPORTED.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42336

12 years agogallium/dri: Handle xserver that doesn't send needless DRI2 invalidate events
Ville Syrjala [Wed, 1 Feb 2012 03:10:04 +0000 (05:10 +0200)]
gallium/dri: Handle xserver that doesn't send needless DRI2 invalidate events

Ever since xserver commit 531869448d07e00ae241120b59f3aaaa5709d59c,
the server no longer sends invalidate events to clients, unless they
have performed a GetBuffers request since the drawable was last
invalidated.

If the drawable gets invalidated immediately after the GetBuffers
request was processed by the X server, it's possible that Xlib
will process the invalidate event while waiting for the GetBuffers
reply. So the server, thinking the client knows that the buffers
are invalid, is waiting for another GetBuffers request before
sending any more invalidate events. The client, on the other hand,
believes the buffers to be valid, and thus is expecting to receive
another invalidate event before it has to send another GetBuffers
request. The end result is that the client never again sends
a GetBuffers request.

To avoid this problem, take a snapshot of the lastStamp before
doing GetBuffers, and retry if the snapshot and the current
lastStamp no longer match after the GetBuffers reply has been
processed.

Signed-off-by: Ville Syrjälä <syrjala@sci.fi>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoglsl: Add error case for switch() with two default cases.
Eric Anholt [Mon, 30 Jan 2012 17:50:35 +0000 (09:50 -0800)]
glsl: Add error case for switch() with two default cases.

Fixes piglit switch-case-duplicated.vert.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Throw an error when faced with a duplicated switch() case label.
Eric Anholt [Mon, 30 Jan 2012 16:50:14 +0000 (08:50 -0800)]
glsl: Throw an error when faced with a duplicated switch() case label.

The error message I chose matches gcc's error.  Fixes piglit
switch-case-duplicated.vert.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Add other missing error location information for switch statements.
Eric Anholt [Mon, 30 Jan 2012 17:46:09 +0000 (09:46 -0800)]
glsl: Add other missing error location information for switch statements.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Add missing location info to case labels.
Eric Anholt [Mon, 30 Jan 2012 17:41:55 +0000 (09:41 -0800)]
glsl: Add missing location info to case labels.

Otherwise, the upcoming error messages said the location was 0:0(0).

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Throw the required error when a case label is a non-constant.
Eric Anholt [Sat, 28 Jan 2012 19:43:22 +0000 (11:43 -0800)]
glsl: Throw the required error when a case label is a non-constant.

It's not quite spelled out in the spec text, but the grammar indicates
that only constant values are allowed as switch() case labels (and
only constant values make sense, anyway).

Fixes piglit glsl-1.30/compiler/switch-statement/switch-case-uniform-int.vert.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Save and restore the whole switch state for nesting.
Eric Anholt [Sat, 28 Jan 2012 19:26:02 +0000 (11:26 -0800)]
glsl: Save and restore the whole switch state for nesting.

This stuffs them all in a struct for sanity.  Fixes piglit
glsl-1.30/execution/switch/fs-uniform-nested.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agodri: Add Unigine Tropics as an app that requires the GLSL warn workaround.
Eric Anholt [Mon, 30 Jan 2012 21:30:53 +0000 (13:30 -0800)]
dri: Add Unigine Tropics as an app that requires the GLSL warn workaround.

I wasn't seeing it be needed because of the previous bug.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
12 years agodri: Fix typo in xml file that made all applications use the workaround.
Eric Anholt [Mon, 30 Jan 2012 21:29:07 +0000 (13:29 -0800)]
dri: Fix typo in xml file that made all applications use the workaround.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
12 years agomesa: Fix the error message function names for glFlushMappedBufferRange().
Eric Anholt [Mon, 30 Jan 2012 21:20:27 +0000 (13:20 -0800)]
mesa: Fix the error message function names for glFlushMappedBufferRange().

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agomesa: Fix bad-enum/no-buffer error handling for buffer object functions.
Eric Anholt [Thu, 26 Jan 2012 00:30:26 +0000 (16:30 -0800)]
mesa: Fix bad-enum/no-buffer error handling for buffer object functions.

For all the extension entrypoints using the get_buffer() helper, they
wanted the same error handling.  In some cases, the error was doing
the same error return whether target was a bad enum, or a user buffer
wasn't bound.

(Actually, GL_ARB_map_buffer_range doesn't specify the error for a zero
buffer being bound for MapBufferRange, though it does for
FlushMappedBufferRange.  This appears to be an oversight).

Fixes piglit GL_ARB_copy_buffer/negative-bound-zero.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoglsl: move array_sizing_visitor class outside of link_intrastage_shaders()
Brian Paul [Fri, 3 Feb 2012 03:10:40 +0000 (20:10 -0700)]
glsl: move array_sizing_visitor class outside of link_intrastage_shaders()

To silence warnings with gcc 4.4.x on Linux and llvm-g++ 4.2 on Mac.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agogallium/postprocess: move declarations before code
Brian Paul [Thu, 2 Feb 2012 22:14:04 +0000 (15:14 -0700)]
gallium/postprocess: move declarations before code

To fix MSVC build.

12 years agogallium/postprocess: Just to be safe, reference all buffers from outside
Lauri Kasanen [Tue, 24 Jan 2012 19:37:56 +0000 (21:37 +0200)]
gallium/postprocess: Just to be safe, reference all buffers from outside

Even though it should be safe to use them for one frame, better be sure.
Suggested by Michael Dänzer.

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

Signed-off-by: Lauri Kasanen <cand@gmx.com>
12 years agogallium/postprocess: Fix depth logic
Lauri Kasanen [Tue, 24 Jan 2012 19:37:07 +0000 (21:37 +0200)]
gallium/postprocess: Fix depth logic

This prevents a possible lapse of the depth buffer - the situation where
the app and pp have different depth buffers.

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

Signed-off-by: Lauri Kasanen <cand@gmx.com>
12 years agoglsl: Avoid ralloc_stealing a long-lived object to a short-lived parent
Carl Worth [Thu, 2 Feb 2012 19:29:51 +0000 (11:29 -0800)]
glsl: Avoid ralloc_stealing a long-lived object to a short-lived parent

In commit 6ecee54a9aecc120cb68b02f7e14dcac86b9eca2 a call to
talloc_reference was replaced with a call to talloc_steal. This was in
preparation for moving to ralloc which doesn't support reference
counting.

The justification for talloc_steal within token_list_append in that
commit is that the tokens are being copied already. But the copies are
shallow, so this does not work.

Fortunately, the lifetime of these tokens is easy to understand. A
token list for "replacements" is created and stored in a hash table
when a function-like macro is defined. This list will live until the
macro is #undefed (if ever).

Meanwhile, a shallow copy of the list is created when the macro is
used and the list expanded. This copy is short-lived, so is unsuitable
as a new parent.

So we can just let the original, longer-lived owner continue to own
the underlying objects and things will work.

This fixes bug #45082:

"ralloc.c:78: get_header: Assertion `info->canary == 0x5A1106'
failed." when using a macro in GLSL
https://bugs.freedesktop.org/show_bug.cgi?id=45082

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
NOTE: This is a candidate for stable release branches.

12 years agoglsl: Add glcpp tests for a macro used twice
Carl Worth [Thu, 2 Feb 2012 19:27:55 +0000 (11:27 -0800)]
glsl: Add glcpp tests for a macro used twice

This test cases exposes a bug as described in this bug report:

"ralloc.c:78: get_header: Assertion `info->canary == 0x5A1106'
failed." when using a macro in GLSL
https://bugs.freedesktop.org/show_bug.cgi?id=45082

Clearly, some memory is getting (incorrectly) freed on the first macro
invocation, leading to problems with the second macro invocation.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoglcpp: Fix so that trailing punctuation does not prevent macro expansion
Carl Worth [Sat, 21 Jan 2012 17:24:11 +0000 (09:24 -0800)]
glcpp: Fix so that trailing punctuation does not prevent macro expansion

The trick here is that flex always chooses the rule that matches the most
text. So with a input text of "two:" which we want to be lexed as an
IDENTIFIER token "two" followed by an OTHER token ":" the previous OTHER
rule would match longer as a single token of "two:" which we don't want.

We prevent this by forcing the OTHER pattern to never match any
characters that appear in other constructs, (no letters, numbers, #,
_, whitespace, nor any punctuation that appear in CPP operators).

Fixes bug #44764:

GLSL preprocessor doesn't replace defines ending with ":"
https://bugs.freedesktop.org/show_bug.cgi?id=44764

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
NOTE: This is a candidate for stable release branches.

12 years agoglcpp: Add new test showing bug where a trailing ':' prevents macro expansion
Carl Worth [Sat, 21 Jan 2012 17:22:24 +0000 (09:22 -0800)]
glcpp: Add new test showing bug where a trailing ':' prevents macro expansion

This demonstrates a bug that was recently triggered in piglit.

Here is the original bug report (containing a test case almost identical
to this one):

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

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Fix copy-and-paste error in _mesa_pack_rgba_span_float
Ian Romanick [Thu, 2 Feb 2012 05:46:31 +0000 (22:46 -0700)]
mesa: Fix copy-and-paste error in _mesa_pack_rgba_span_float

GL_RG_INTEGER only has two components, not three.  I'll be surprised
if anyone ever tries to glReadPixels(..., GL_SHORT, GL_RG_INTEGER,
...).  This was found by inspection.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Fix copy-and-paste bug in do_row_3D
Ian Romanick [Wed, 1 Feb 2012 21:19:35 +0000 (14:19 -0700)]
mesa: Fix copy-and-paste bug in do_row_3D

Several of the half-float cases used 4 as the texel size when it
should have been some smaller value.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43324
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43325

12 years agomesa: Convert colors if span ChanType and renderbuffer data type don't match
Ian Romanick [Tue, 31 Jan 2012 18:29:06 +0000 (11:29 -0700)]
mesa: Convert colors if span ChanType and renderbuffer data type don't match

This is a partial revert of f9874fe.  It turns out that the types
don't always match.  Specifically, this can happen when doing
glCopyPixels from a float FBO to a RGBA8 FBO.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45429
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agomesa: Set the gl_array_object::ARBsemantics flag at the right time
Ian Romanick [Tue, 31 Jan 2012 16:00:48 +0000 (09:00 -0700)]
mesa: Set the gl_array_object::ARBsemantics flag at the right time

With 0963990 the flag was only set when Bind created the object.  In
all cases where ::ARBsemantics could be true, this path never
happened.  Instead, add a _Used flag to track whether a VAO has ever
been bound.  On the first Bind, set the _Used flag, and set the
ARBsemantics flag to the correct value.

NOTE: This is a candidate for release branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45423

12 years agomesa: Add unpack_uint_z_row support for floating-point depth buffers
Ian Romanick [Wed, 18 Jan 2012 19:56:12 +0000 (11:56 -0800)]
mesa: Add unpack_uint_z_row support for floating-point depth buffers

This is a hack, and it will result in incorrect rendering.  However,
it does eliminate spurious warnings in several piglit CopyPixels tests
that involve floating-point depth buffers.

The real solution is to add a zf field to SWspan to store float Z
values.  When a float depth buffer is involved, swrast should also
populate the zf field.  I'll consider this post-8.0 work.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoRevert "Fix underlinking in libOSMesa since commit adefee5 "Always build shared glapi""
Brian Paul [Thu, 2 Feb 2012 15:14:35 +0000 (08:14 -0700)]
Revert "Fix underlinking in libOSMesa since commit adefee5 "Always build shared glapi""

This reverts commit 4e5a8937d1a1bfb2a3bd067ed01e036728675fc2.
... to fix build with --enable-osmesa

12 years agodraw: Avoid NULL pointer dereference when binding NULL fragment shaders.
José Fonseca [Thu, 2 Feb 2012 13:19:56 +0000 (13:19 +0000)]
draw: Avoid NULL pointer dereference when binding NULL fragment shaders.

Now that the draw module avoids flushing, it may flush precisely when
binding a NULL shader, so care must be taken when restoring the original
fragment shader.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agomapi/glapi: Never use a generic no-op entry-point on Windows.
José Fonseca [Thu, 2 Feb 2012 10:44:10 +0000 (10:44 +0000)]
mapi/glapi: Never use a generic no-op entry-point on Windows.

When GLAPIENTRY is __stdcall (ie Windows), the stack is popped by the
callee making the number/type of arguments significant, therefore
using a generic no-op causes stack corruption for many entry-points.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agogallivm: Fix LLVM-2.7 build.
ojab [Wed, 1 Feb 2012 06:00:10 +0000 (10:00 +0400)]
gallivm: Fix LLVM-2.7 build.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
Tested-by: Vinson Lee <vlee@freedesktop.org>
12 years agogallivm: Remove MSVC RT hack.
José Fonseca [Wed, 1 Feb 2012 14:38:28 +0000 (14:38 +0000)]
gallivm: Remove MSVC RT hack.

The hack never worked reliably, and docs/llvmpipe.html is quite clear on
the requirement of matching CRT when building LLVM and Mesa already.

12 years agomesa: fix maximum allowed proxy texture size condition
Anuj Phogat [Thu, 26 Jan 2012 03:05:45 +0000 (19:05 -0800)]
mesa: fix maximum allowed proxy texture size condition

width, height parameter in glTexImage2D() includes: texture image
width + 2 * border (if any). So when doing the texture size check
in _mesa_test_proxy_teximage() width and height should not exceed
maximum supported size for target texture type.
i.e. 1 << (ctx->Const.MaxTextureLevels - 1)

Texture border is anyway stripped out before it is given to intel
or gallium drivers.

This patch fixes Intel oglconform test case: max_values
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44970

Note: This is a candidate for mesa 8.0 branch.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
12 years agosvga: fix a crash happening before setting fragment shaders.
Zack Rusin [Wed, 1 Feb 2012 04:12:22 +0000 (23:12 -0500)]
svga: fix a crash happening before setting fragment shaders.

In certain situations API's will call pipe->clear which doesn't
require fragment shader, but then we'd try to verify the pipeline
and assume fragment shader was always set. This was leading to
crash when API would just call simple clear's before anything else.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agost-api: fix typos, whitespace, line wrapping
Brian Paul [Wed, 1 Feb 2012 21:02:35 +0000 (14:02 -0700)]
st-api: fix typos, whitespace, line wrapping

12 years agovbo: fix node_attrsz[] usage in vbo_bind_vertex_list()
Brian Paul [Wed, 1 Feb 2012 15:42:48 +0000 (08:42 -0700)]
vbo: fix node_attrsz[] usage in vbo_bind_vertex_list()

The node_attrsz[] array is initially copied from the node->attrsz[]
array but some values get rewritten.  Thereafter, we need to use the
node_attrsz[] values.

Fixes a bug when replaying a display list that uses generic vertex
array[16] (at least).

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agonv50: add assertions missed in earlier nv50 commit
Brian Paul [Wed, 1 Feb 2012 15:20:05 +0000 (08:20 -0700)]
nv50: add assertions missed in earlier nv50 commit

12 years agobuild: Note that we don't support srcdir != builddir
Colin Walters [Sat, 14 Jan 2012 14:16:20 +0000 (09:16 -0500)]
build: Note that we don't support srcdir != builddir

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agonv50: use larger arrays to silence warnings and fix buffer overflows
Brian Paul [Tue, 31 Jan 2012 14:01:53 +0000 (07:01 -0700)]
nv50: use larger arrays to silence warnings and fix buffer overflows

The warnings were:
nv50_pc_regalloc.c: In function ‘pass_generate_phi_movs’:
nv50_pc_regalloc.c:423:41: warning: array subscript is above array bounds
codegen/nv50_ir_peephole.cpp: In member function ‘bool nv50_ir::MemoryOpt::replaceStFromSt(nv50_ir::Instruction*, nv50_ir::MemoryOpt::Record*)’:
codegen/nv50_ir_peephole.cpp:1475:18: warning: array subscript is above array bounds
codegen/nv50_ir_peephole.cpp:1475:18: warning: array subscript is above array bounds
codegen/nv50_ir_peephole.cpp:1475:18: warning: array subscript is above array bounds
codegen/nv50_ir_peephole.cpp:1475:18: warning: array subscript is above array bounds

And add some assertions to catch this sooner in debug builds.

12 years agomesa: reference shared state in glPushAttrib(GL_TEXTURE_BIT)
Brian Paul [Wed, 1 Feb 2012 01:24:07 +0000 (18:24 -0700)]
mesa: reference shared state in glPushAttrib(GL_TEXTURE_BIT)

This fixes a dangling texture object pointer bug hit via wglShareLists().
When we push the GL_TEXTURE_BIT state we may push references to the default
texture objects which are owned by the gl_shared_state object.  We don't
want to accidentally delete that shared state while the attribute stack
references shared objects.  So keep a reference to it.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agomesa: use new _mesa_reference_shared_state() function
Brian Paul [Wed, 1 Feb 2012 01:23:03 +0000 (18:23 -0700)]
mesa: use new _mesa_reference_shared_state() function

This cleans up the reference counting of shared context state.
The next patch will use this to fix an actual bug.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agomesa: remove stray comment in PopAttrib() code
Brian Paul [Tue, 31 Jan 2012 19:33:38 +0000 (12:33 -0700)]
mesa: remove stray comment in PopAttrib() code

12 years agoRevert "automake: src/mesa/drivers/osmesa"
Matt Turner [Wed, 1 Feb 2012 02:34:42 +0000 (21:34 -0500)]
Revert "automake: src/mesa/drivers/osmesa"

This reverts commit 275ac7e5c1fd6c1847a428192fe259e50690fced.

12 years agoRevert "automake: src/glsl and src/glsl/glcpp"
Matt Turner [Wed, 1 Feb 2012 02:33:59 +0000 (21:33 -0500)]
Revert "automake: src/glsl and src/glsl/glcpp"

This reverts commit 9947656168d09f9019600fccc42ca8e0de49b83a.

12 years agoRevert "src/glsl/glcpp: wire up glcpp-test to make check"
Matt Turner [Wed, 1 Feb 2012 02:33:21 +0000 (21:33 -0500)]
Revert "src/glsl/glcpp: wire up glcpp-test to make check"

This reverts commit 2bb9f9e1fda61fceb9284cbb4619d7e60e39f190.

12 years agoRevert "Make sure libGL.so links with libglsl"
Matt Turner [Wed, 1 Feb 2012 02:33:07 +0000 (21:33 -0500)]
Revert "Make sure libGL.so links with libglsl"

This reverts commit f53e7e981ef35ab64a084c8da6c67bd2d230fe33.

12 years agoRevert "glsl: Fix optimization tests after converting src/glsl to automake."
Matt Turner [Wed, 1 Feb 2012 02:32:33 +0000 (21:32 -0500)]
Revert "glsl: Fix optimization tests after converting src/glsl to automake."

This reverts commit ffe376d5a74dee837dc1a421de29ae551087630f.

12 years agor600g: shorten expressions accessing family and chip_class
Marek Olšák [Tue, 31 Jan 2012 06:47:41 +0000 (07:47 +0100)]
r600g: shorten expressions accessing family and chip_class

12 years agor300g: don't use pipe_context::winsys
Marek Olšák [Tue, 31 Jan 2012 06:44:22 +0000 (07:44 +0100)]
r300g: don't use pipe_context::winsys

12 years agor600g: remove unused variable num_dest_buffers
Marek Olšák [Tue, 31 Jan 2012 06:32:31 +0000 (07:32 +0100)]
r600g: remove unused variable num_dest_buffers

12 years agor600g: use the new code for streamout flush as well
Marek Olšák [Mon, 30 Jan 2012 08:29:40 +0000 (09:29 +0100)]
r600g: use the new code for streamout flush as well

12 years agor600g: rename r600_reg::flush_flags -> sbu_flags
Marek Olšák [Mon, 30 Jan 2012 08:12:33 +0000 (09:12 +0100)]
r600g: rename r600_reg::flush_flags -> sbu_flags

There is no other use for that.

12 years agor600g: fix computation of how many dwords is needed for a flush at the end of CS
Marek Olšák [Mon, 30 Jan 2012 08:11:01 +0000 (09:11 +0100)]
r600g: fix computation of how many dwords is needed for a flush at the end of CS

12 years agor600g: remove unused r600_reg::flush_mask
Marek Olšák [Mon, 30 Jan 2012 08:02:30 +0000 (09:02 +0100)]
r600g: remove unused r600_reg::flush_mask

12 years agor600g: remove more dead code
Marek Olšák [Mon, 30 Jan 2012 07:54:01 +0000 (08:54 +0100)]
r600g: remove more dead code

12 years agor600g: remove dead code for tracking relocations
Marek Olšák [Mon, 30 Jan 2012 07:39:32 +0000 (08:39 +0100)]
r600g: remove dead code for tracking relocations

12 years agor600g: remove unused flush code
Marek Olšák [Mon, 30 Jan 2012 07:34:13 +0000 (08:34 +0100)]
r600g: remove unused flush code

12 years agor600g: rework cache flushing
Marek Olšák [Mon, 30 Jan 2012 05:21:07 +0000 (06:21 +0100)]
r600g: rework cache flushing

This also significantly improves the RV670 flush by using the CB1 flush
*always* and also DEST_BASE_0_ENA, which appears to magically fix some tests.
I am not entirely sure, but it's possible that RV670 flushing is fixed
completely.

v2: fix cayman by flushing texture cache instead of vertex cache

Thanks to Dave Airlie for testing Cayman.

12 years agor600g: add a new simple API for state emission
Marek Olšák [Mon, 30 Jan 2012 00:23:14 +0000 (01:23 +0100)]
r600g: add a new simple API for state emission

12 years agor600g: remove redundant pm4 and pm4_cdwords in r600_context
Marek Olšák [Mon, 30 Jan 2012 03:08:15 +0000 (04:08 +0100)]
r600g: remove redundant pm4 and pm4_cdwords in r600_context

These only mirrored radeon_winsys_cs.

12 years agor600g: consolidate some context_draw code
Marek Olšák [Mon, 30 Jan 2012 01:00:51 +0000 (02:00 +0100)]
r600g: consolidate some context_draw code

12 years agor600g: remove the now-useless internal flush callback
Marek Olšák [Sun, 29 Jan 2012 22:40:23 +0000 (23:40 +0100)]
r600g: remove the now-useless internal flush callback

12 years agor600g: don't initialize the screen and winsys pointer twice
Marek Olšák [Sun, 29 Jan 2012 22:35:10 +0000 (23:35 +0100)]
r600g: don't initialize the screen and winsys pointer twice

12 years agor600g: merge r600_context with r600_pipe_context
Marek Olšák [Sun, 29 Jan 2012 22:25:42 +0000 (23:25 +0100)]
r600g: merge r600_context with r600_pipe_context

The split made no sense.

12 years agor600g: remove u8,u16,u32,u64 types
Marek Olšák [Sun, 29 Jan 2012 22:13:39 +0000 (23:13 +0100)]
r600g: remove u8,u16,u32,u64 types

12 years agoglsl: Fix optimization tests after converting src/glsl to automake.
Paul Berry [Tue, 31 Jan 2012 02:53:09 +0000 (18:53 -0800)]
glsl: Fix optimization tests after converting src/glsl to automake.

Commit 99476561 (automake: src/glsl and src/glsl/glcpp) changed the
build system so that src/glsl/glsl_test is not built by default.  This
inadvertently broke "make check", since the tests in
src/glsl/tests/lower_jumps (which are run by "make check") rely on
glsl_test.

This patch ensures that "make check" builds glsl_test before running
any tests.

Reviewed-by: Matt Turner <mattst88@gmail.com>
12 years agoMake sure libGL.so links with libglsl
Matt Turner [Tue, 31 Jan 2012 16:54:24 +0000 (11:54 -0500)]
Make sure libGL.so links with libglsl

Can't link against *.la files if we're not using libtool to link.

Fixes undefined symbol: _ZN23ir_hierarchical_visitor5visitEP11ir_variable

12 years agovl: fix some missing prototypes error
Christian König [Tue, 31 Jan 2012 13:49:07 +0000 (14:49 +0100)]
vl: fix some missing prototypes error

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45444
Signed-off-by: Christian König <deathsimple@vodafone.de>