mesa.git
12 years agoradeonsi: initial WIP SI code
Tom Stellard [Fri, 6 Jan 2012 22:38:37 +0000 (17:38 -0500)]
radeonsi: initial WIP SI code

This commit adds initial support for acceleration
on SI chips.  egltri is starting to work.

The SI/R600 llvm backend is currently included in mesa
but that may change in the future.

The plan is to write a single gallium driver and
use gallium to support X acceleration.

This commit contains patches from:
Tom Stellard <thomas.stellard@amd.com>
Michel Dänzer <michel.daenzer@amd.com>
Alex Deucher <alexander.deucher@amd.com>
Vadim Girlin <vadimgirlin@gmail.com>

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
The following commits were squashed in:

======================================================================

radeonsi: Remove unused winsys pointer

This was removed from r600g in commit:

commit 96d882939d612fcc8332f107befec470ed4359de
Author: Marek Olšák <maraeo@gmail.com>
Date:   Fri Feb 17 01:49:49 2012 +0100

    gallium: remove unused winsys pointers in pipe_screen and pipe_context

    A winsys is already a private object of a driver.

======================================================================

radeonsi: Copy color clamping CAPs from r600

Not sure if the values of these CAPS are correct for radeonsi, but the
same changed were made to r600g in commit:

commit bc1c8369384b5e16547c5bf9728aa78f8dfd66cc
Author: Marek Olšák <maraeo@gmail.com>
Date:   Mon Jan 23 03:11:17 2012 +0100

    st/mesa: do vertex and fragment color clamping in shaders

    For ARB_color_buffer_float. Most hardware can't do it and st/mesa is
    the perfect place for a fallback.
    The exceptions are:
    - r500 (vertex clamp only)
    - nv50 (both)
    - nvc0 (both)
    - softpipe (both)

    We also have to take into account that r300 can do CLAMPED vertex colors only,
    while r600 can do UNCLAMPED vertex colors only. The difference can be expressed
    with the two new CAPs.

======================================================================

radeonsi: Remove PIPE_CAP_OUTPUT_READ

This CAP was dropped in commit:

commit 04e324008759282728a95a1394bac2c4c2a1a3f9
Author: Marek Olšák <maraeo@gmail.com>
Date:   Thu Feb 23 23:44:36 2012 +0100

    gallium: remove PIPE_SHADER_CAP_OUTPUT_READ

    r600g is the only driver which has made use of it. The reason the CAP was
    added was to fix some piglit tests when the GLSL pass lower_output_reads
    didn't exist.

    However, not removing output reads breaks the fallback for glClampColorARB,
    which assumes outputs are not readable. The fix would be non-trivial
    and my personal preference is to remove the CAP, considering that reading
    outputs is uncommon and that we can now use lower_output_reads to fix
    the issue that the CAP was supposed to workaround in the first place.

======================================================================

radeonsi: Add missing parameters to rws->buffer_get_tiling() call

This was changed in commit:

commit c0c979eebc076b95cc8d18a013ce2968fe6311ad
Author: Jerome Glisse <jglisse@redhat.com>
Date:   Mon Jan 30 17:22:13 2012 -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>
======================================================================

radeonsi: Remove PIPE_TRANSFER_MAP_PERMANENTLY

This was removed in commit:

commit 62f44f670bb0162e89fd4786af877f8da9ff607c
Author: Marek Olšák <maraeo@gmail.com>
Date:   Mon Mar 5 13:45:00 2012 +0100

    Revert "gallium: add flag PIPE_TRANSFER_MAP_PERMANENTLY"

    This reverts commit 0950086376b1c8b7fb89eda81ed7f2f06dee58bc.

    It was decided to refactor the transfer API instead of adding workarounds
    to address the performance issues.

======================================================================

radeonsi: Handle PIPE_VIDEO_CAP_PREFERED_FORMAT.

Reintroduced in commit 9d9afcb5bac2931d4b8e6d1aa571e941c5110c90.

======================================================================

radeonsi: nuke the fallback for vertex and fragment color clamping

Ported from r600g commit c2b800cf38b299c1ab1c53dc0e4ea00c7acef853.

======================================================================

radeonsi: don't expose transform_feedback2 without kernel support

Ported from r600g commit 15146fd1bcbb08e44a1cbb984440ee1a5de63d48.

======================================================================

radeonsi: Handle PIPE_CAP_GLSL_FEATURE_LEVEL.

Ported from r600g part of commit 171be755223d99f8cc5cc1bdaf8bd7b4caa04b4f.

======================================================================

radeonsi: set minimum point size to 1.0 for non-sprite non-aa points.

Ported from r600g commit f183cc9ce3ad1d043bdf8b38fd519e8f437714fc.

======================================================================

radeonsi: rework and consolidate stencilref state setting.

Ported from r600g commit a2361946e782b57f0c63587841ca41c0ea707070.

======================================================================

radeonsi: cleanup setting DB_SHADER_CONTROL.

Ported from r600g commit 3d061caaed13b646ff40754f8ebe73f3d4983c5b.

======================================================================

radeonsi: Get rid of register masks.

Ported from r600g commits
3d061caaed13b646ff40754f8ebe73f3d4983c5b..9344ab382a1765c1a7c2560e771485edf4954fe2.

======================================================================

radeonsi: get rid of r600_context_reg.

Ported from r600g commits
9344ab382a1765c1a7c2560e771485edf4954fe2..bed20f02a771f43e1c5092254705701c228cfa7f.

======================================================================

radeonsi: Fix regression from 'Get rid of register masks'.

======================================================================

radeonsi: optimize r600_resource_va.

Ported from r600g commit 669d8766ff3403938794eb80d7769347b6e52174.

======================================================================

radeonsi: remove u8,u16,u32,u64 types.

Ported from r600g commit 78293b99b23268e6698f1267aaf40647c17d95a5.

======================================================================

radeonsi: merge r600_context with r600_pipe_context.

Ported from r600g commit e4340c1908a6a3b09e1a15d5195f6da7d00494d0.

======================================================================

radeonsi: Miscellaneous context cleanups.

Ported from r600g commits
e4340c1908a6a3b09e1a15d5195f6da7d00494d0..621e0db71c5ddcb379171064a4f720c9cf01e888.

======================================================================

radeonsi: add a new simple API for state emission.

Ported from r600g commits
621e0db71c5ddcb379171064a4f720c9cf01e888..f661405637bba32c2cfbeecf6e2e56e414e9521e.

======================================================================

radeonsi: Also remove sbu_flags member of struct r600_reg.

Requires using sid.h instead of r600d.h for the new CP_COHER_CNTL definitions,
so some code needs to be disabled for now.

======================================================================

radeonsi: Miscellaneous simplifications.

Ported from r600g commits 38bf2763482b4f1b6d95cd51aecec75601d8b90f and
b0337b679ad4c2feae59215104cfa60b58a619d5.

======================================================================

radeonsi: Handle PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION.

Ported from commit 8b4f7b0672d663273310fffa9490ad996f5b914a.

======================================================================

radeonsi: Use a fake reloc to sleep for fences.

Ported from r600g commit 8cd03b933cf868ff867e2db4a0937005a02fd0e4.

======================================================================

radeonsi: adapt to get_query_result interface change.

Ported from r600g commit 4445e170bee23a3607ece0e010adef7058ac6a11.

12 years agost/vega: silence enum cast warnings
Dylan Noblesmith [Sun, 1 Apr 2012 19:47:07 +0000 (19:47 +0000)]
st/vega: silence enum cast warnings

clang warns on these:

stroker.c:626:19: warning: implicit conversion from enumeration
type 'VGPathCommand' to different enumeration type 'VGPathSegment'
[-Wconversion]

No change in the underlying value.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoi965: fix typo
Dylan Noblesmith [Sun, 1 Apr 2012 19:04:47 +0000 (19:04 +0000)]
i965: fix typo

Noticed by clang:

brw_wm_surface_state.c:330:30: warning: initializer overrides prior
initialization of this subobject [-Winitializer-overrides]
      [MESA_FORMAT_Z24_S8] = 0,
                             ^
brw_wm_surface_state.c:326:30: note: previous initialization is here
      [MESA_FORMAT_Z24_S8] = 0,
                             ^

No functionality change, since the array is declared static so
it was zero-initialized by default.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
12 years agomesa: fix truncated value warning
Dylan Noblesmith [Sun, 1 Apr 2012 18:59:28 +0000 (18:59 +0000)]
mesa: fix truncated value warning

Silences a clang warning:

format_pack.c:2546:30: warning: implicit conversion from 'int' to
'GLubyte' (aka 'unsigned char') changes value from 65535 to 255
[-Wconstant-conversion]
               d[i] = d[i] ? 0xffff : 0x0;
                           ~ ^~~~~~

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agomesa: don't cast away const
Dylan Noblesmith [Sun, 1 Apr 2012 18:55:23 +0000 (18:55 +0000)]
mesa: don't cast away const

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoegl-static: fix printf warning
Dylan Noblesmith [Sun, 1 Apr 2012 19:57:57 +0000 (19:57 +0000)]
egl-static: fix printf warning

Noticed by clang:

egl_st.c:57:50: warning: field precision should have type 'int',
but argument has type 'size_t' (aka 'unsigned long') [-Wformat]
      ret = util_snprintf(path, sizeof(path), "%.*s/%s" UTIL_DL_EXT,
                                               ~~^~

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agost/vega: fix uninitialized values
Dylan Noblesmith [Sun, 1 Apr 2012 19:48:21 +0000 (19:48 +0000)]
st/vega: fix uninitialized values

C still treats array arguments exactly like pointer arguments.
By sheer coincidence, this still worked fine on 64-bit
machines where 2 * sizeof(float) == sizeof(void*), but not
on 32-bit.

Noticed by clang:

text.c:76:51: warning: sizeof on array function parameter will
return size of 'const VGfloat *' (aka 'const float *') instead of
'const VGfloat [2]' [-Wsizeof-array-argument]
   memcpy(glyph->glyph_origin, glyphOrigin, sizeof(glyphOrigin));

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoegl: fix uninitialized values
Dylan Noblesmith [Sun, 1 Apr 2012 18:48:13 +0000 (18:48 +0000)]
egl: fix uninitialized values

Noticed by clang:

eglimage.c:48:28: warning: argument to 'sizeof' in 'memset' call is
the same expression as the destination; did you mean to dereference
it? [-Wsizeof-pointer-memaccess]
   memset(attrs, 0, sizeof(attrs));
          ~~~~~            ^~~~~

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoutil: fix uninitialized table
Dylan Noblesmith [Sun, 1 Apr 2012 18:35:29 +0000 (18:35 +0000)]
util: fix uninitialized table

Most of the 256 values in the 'generic_to_slot' table were supposed to
be initialized with the default value 0xff, but were left at zero
(from CALLOC_STRUCT()) instead.

Noticed by clang:

u_linkage.h:60:31: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination;
      did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
   memset(table, 0xff, sizeof(table));
          ~~~~~               ^~~~~

Also fix a signed/unsigned comparison and a comment typo here.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoutil: fix undefined behavior
Dylan Noblesmith [Sun, 1 Apr 2012 18:21:47 +0000 (18:21 +0000)]
util: fix undefined behavior

container_of() can legally return anything, even invalid addresses
that cause segfaults, when 'sample' is an uninitialized pointer.

Bug exposed by clang.

NOTE: This is a candidate for the 8.0 branch.

12 years agoir_to_mesa: Fix uninitialized member in add_uniform_to_shader.
Vinson Lee [Thu, 12 Apr 2012 06:05:44 +0000 (23:05 -0700)]
ir_to_mesa: Fix uninitialized member in add_uniform_to_shader.

Fix uninitialized scalar field defect reported by Coverity.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agowayland-drm: Implement wl_buffer.damage in old versions of Wayland
Neil Roberts [Wed, 11 Apr 2012 16:07:56 +0000 (17:07 +0100)]
wayland-drm: Implement wl_buffer.damage in old versions of Wayland

Commit 272bc48976 removed the damage implementation for the
wl_buffer_interface because that has been removed from git master of
Wayland. However this breaks building with the 0.85 branch of Wayland
because it would end up initialising the struct incorrectly.

For the time being it's quite convenient for some compositors to track
the 0.85 branch of Wayland because the protocol is stable but they
will also want to track the master branch of Mesa so that they can use
the gbm surface changes.

This patch adds a compile-time check for the version of Wayland so
that it can work with either Wayland master or the 0.85 branch.

krh: Edited to also account for API changes in 6802eaa68, which
removes the timestamp argument from wl_resource_destroy().

12 years agoRevert "i915g: Implement stipple with draw."
Stéphane Marchesin [Fri, 13 Apr 2012 01:31:10 +0000 (18:31 -0700)]
Revert "i915g: Implement stipple with draw."

This reverts commit 3cff45fdb182a1327f6b89fdc4e0ddc5d680372a.

12 years agoRevert "i915g: Remove unused poly stipple state."
Stéphane Marchesin [Fri, 13 Apr 2012 01:30:59 +0000 (18:30 -0700)]
Revert "i915g: Remove unused poly stipple state."

This reverts commit be6a02266d1a934c6eff9aaf12fc618588b2d586.

12 years agotests/glx: Point at the imported copy of gtest
Ian Romanick [Thu, 29 Mar 2012 22:31:55 +0000 (15:31 -0700)]
tests/glx: Point at the imported copy of gtest

This is just in case there's one installed on the system.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Acked-by: Eric Anholt <eric@anholt.net>
12 years agoglx: Hook up the unit tests again using the internal gtest.
Eric Anholt [Tue, 6 Mar 2012 01:01:13 +0000 (17:01 -0800)]
glx: Hook up the unit tests again using the internal gtest.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agogtest: Fix up import of gtest 1.6.0
Ian Romanick [Thu, 29 Mar 2012 22:31:27 +0000 (15:31 -0700)]
gtest: Fix up import of gtest 1.6.0

The include files were all missing.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Acked-by: Eric Anholt <eric@anholt.net>
12 years agogtest: Build as a convenience library.
Eric Anholt [Tue, 6 Mar 2012 01:01:12 +0000 (17:01 -0800)]
gtest: Build as a convenience library.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agogtest: Import sources from gtest 1.6.0.
Eric Anholt [Tue, 6 Mar 2012 01:01:11 +0000 (17:01 -0800)]
gtest: Import sources from gtest 1.6.0.

The upstream of gtest has decided that the intended usage model is for
projects to import the source and use it, which is reflected in their
recent removal of the gtest-config tool.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
12 years agocso: unreference saved vertex buffers when restoring
Marek Olšák [Tue, 10 Apr 2012 06:28:23 +0000 (08:28 +0200)]
cso: unreference saved vertex buffers when restoring

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoi965: When the kernel lacks the LLC check, assume it's present on gen >= 6.
Eric Anholt [Wed, 21 Mar 2012 21:35:14 +0000 (14:35 -0700)]
i965: When the kernel lacks the LLC check, assume it's present on gen >= 6.

The param wasn't added until drm-intel-next for 3.4, so we were
missing our various LLC fast-paths.

12 years agointel: Drop backwards compat code for not having libdrm with the LLC check.
Eric Anholt [Wed, 21 Mar 2012 21:31:53 +0000 (14:31 -0700)]
intel: Drop backwards compat code for not having libdrm with the LLC check.

12 years agoi965/fs: Avoid generating extra AND instructions on bool logic ops.
Eric Anholt [Tue, 13 Mar 2012 21:19:31 +0000 (14:19 -0700)]
i965/fs: Avoid generating extra AND instructions on bool logic ops.

By making a bool fs_reg only have a defined low bit (matching CMP
output), instead of being a full 0 or 1 value, we reduce the ANDs
generated in logic chains like:

   if (v_texcoord.x < 0.0 || v_texcoord.x > texwidth ||
       v_texcoord.y < 0.0 || v_texcoord.y > 1.0)
      discard;

My concern originally when writing this code was that we would end up
generating unnecessary ANDs on bool uniforms, so I put the ANDs right
at the point of doing the CMPs that otherwise set only the low bit.
However, in order to use a bool, we're generating some instruction
anyway (e.g. moving it so as to produce a condition code update), and
those instructions can often be turned into an AND at that point.  It
turns out in the shaders I have on hand, none of them regress in
instruction count:

Total instructions: 262649 -> 262545
39/2148 programs affected (1.8%)
14253 -> 14149 instructions in affected programs (0.7% reduction)

12 years agoi965/fs: Try to avoid generating extra MOVs to do saturates.
Eric Anholt [Sat, 10 Mar 2012 21:48:42 +0000 (13:48 -0800)]
i965/fs: Try to avoid generating extra MOVs to do saturates.

This change (before the previous two) produced a .23% +/- .11%
performance improvement in Unigine Tropics at 1024x768 on IVB.

Total instructions: 269270 -> 262649
614/2148 programs affected (28.6%)
179386 -> 172765 instructions in affected programs (3.7% reduction)

v2: Move some of the logic of finding the instruction that produced
    the result of an expression tree to a helper.

12 years agoglsl: Extend the array splitting optimization pass to matrices.
Eric Anholt [Thu, 22 Mar 2012 20:22:51 +0000 (13:22 -0700)]
glsl: Extend the array splitting optimization pass to matrices.

This should fit in well with our lower_mat_op_to_vec code: now, in
addition to having expressions on each column of a matrix, we also
split the columns to separate variables so they can be tracked
individually by the copy propagation, dead code, and other passes.

This optimizes out some more code generation in unigine and gstreamer
shaders.

Total instructions: 269342 -> 269270
14/2148 programs affected (0.7%)
2226 -> 2154 instructions in affected programs (3.2% reduction)

12 years agoglsl: Add an array splitting pass.
Eric Anholt [Sun, 3 Oct 2010 05:57:17 +0000 (22:57 -0700)]
glsl: Add an array splitting pass.

I've had this code laying around almost done for a long time.  The
idea is like opt_structure_splitting, that we've got a bunch of
transforms at the GLSL IR level that only understand scalars and
vectors, which just skip complicated dereferences.  While driver
backends may manage some optimization after they split matrices up
themselves, it would be better to bring all of our optimization to
bear on the problem.

While I wasn't expecting changes quite yet, a few programs end up
winning: a gstreamer convolution shader, and the Humus dynamic
branching demo:
Total instructions: 269430 -> 269342
3/2148 programs affected (0.1%)
1498 -> 1410 instructions in affected programs (5.9% reduction)

12 years agoglsl: Don't apply optimization passes to builtins.
Eric Anholt [Thu, 22 Mar 2012 15:58:33 +0000 (08:58 -0700)]
glsl: Don't apply optimization passes to builtins.

The builtins we have are generally optimized, having been
hand-written.  This avoids generating bad code when an optimization
pass prints debug output.

12 years agodocs: document yet another viewperf bug
Brian Paul [Wed, 11 Apr 2012 17:53:33 +0000 (11:53 -0600)]
docs: document yet another viewperf bug

12 years agomesa: add _mesa_total_texture_memory() debug function
Brian Paul [Fri, 6 Apr 2012 21:45:39 +0000 (15:45 -0600)]
mesa: add _mesa_total_texture_memory() debug function

This function can be called in gdb to find out how much memory is used
by all texture objects.

12 years agomesa: new _mesa_total_buffer_object_memory() debug function
Brian Paul [Fri, 6 Apr 2012 21:44:56 +0000 (15:44 -0600)]
mesa: new _mesa_total_buffer_object_memory() debug function

This function can be called in gdb to find out how much memory is used
by buffer objects.

12 years agomapi: Fix Android build
Chad Versace [Tue, 10 Apr 2012 22:36:07 +0000 (15:36 -0700)]
mapi: Fix Android build

The Android build was broken by
    commit ca760181b4420696c7e86aa2951d7203522ad1e8
    Author: Kristian Høgsberg <krh@bitplanet.net>
    Date:   Fri Mar 16 12:55:40 2012 -0400

    shared-glapi: Convert to automake

The offending change was that it redefined the filepaths in sources.mak
like this:
    - FOO_FILES := bar.c
    + FOO_FILES := $(TOP)/src/mapi/mapi/bar.c
This broke the build because source filepaths in Android makefiles must be
relative to the makefile.

Ideally, this could be fixed by reverting the change in sources.mak and
making shared-glapi's Makefile.am use $(addprefix $(TOP)/src/mapi/mapi,
$(FOO_FILES)). However, automake doesn't understand builtin GNU make
functions, such as addprefix. So, it seems that automake and Android can
no longer share sources.mak.

Fix the build by duplicating the source lists from sources.mak into
Android.mk.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
12 years agoegl_dri2: fix aux buffer leak in drm platform
Mandeep Singh Baines [Tue, 10 Apr 2012 21:48:14 +0000 (14:48 -0700)]
egl_dri2: fix aux buffer leak in drm platform

Keep a reference to any newly allocated aux buffers to avoid
re-allocating for every st_framebuffer_validate() (i.e. leaking).

Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
12 years agoi965: Stop lying about cpp and height of a stencil buffer.
Paul Berry [Fri, 6 Apr 2012 19:14:28 +0000 (12:14 -0700)]
i965: Stop lying about cpp and height of a stencil buffer.

When using a separate stencil buffer, i965 requires that the pitch of
the buffer (in the 3DSTATE_STENCIL_BUFFER command) be specified as 2x
the actual pitch.

Previously this was accomplished by doubling the "cpp" and "pitch"
values stored in the intel_region data structure, and halving the
height.  However, this was confusing, and it led to a subtle (but
benign) bug: since a stencil buffer is W-tiled, its true height must
be aligned to a multiple of 64; we were accidentally aligning its faux
height to a multiple of 64, causing memory to be wasted.

Note that for window system stencil buffers, the DDX also doubles the
cpp and pitch values.  To facilitate fixing this DDX server bug in the
future, we fix the cpp and pitch values we receive from the X server
only if cpp has the "incorrect" value of 2.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
v2: Clarify comments about the DDX.

12 years agowayland-drm: remove wl_buffer.damage
Pekka Paalanen [Tue, 10 Apr 2012 12:35:06 +0000 (15:35 +0300)]
wayland-drm: remove wl_buffer.damage

This is a related fix for the Wayland change:

commit 83685c506e76212ae4e5cb722205d98d3b0603b9
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Mon Mar 26 16:33:24 2012 -0400

    Remove wl_buffer.damage and simplify shm implementation

Apparently, this should also fix a memory leak. When wl_buffer.damage
was removed from Wayland and Mesa was not fixed, wl_buffer.destroy ended
up in the (empty) damage function instead of calling
wl_resource_destroy().

Spotted during build as:
  CC     wayland-drm-protocol.lo
wayland-drm.c:80:2: warning: initialization from incompatible pointer type
wayland-drm.c:82:1: warning: excess elements in struct initializer
wayland-drm.c:82:1: warning: (near initialization for 'drm_buffer_interface')

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agost/mesa: Fix uninitialized members in glsl_to_tgsi_visitor constructor.
Vinson Lee [Mon, 9 Apr 2012 05:28:34 +0000 (22:28 -0700)]
st/mesa: Fix uninitialized members in glsl_to_tgsi_visitor constructor.

Fixes uninitialized member defects reported by Coverity.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agomain: Fix memory leak in _mesa_make_extension_string()
Chad Versace [Mon, 9 Apr 2012 20:59:03 +0000 (13:59 -0700)]
main: Fix memory leak in _mesa_make_extension_string()

I forgot to free the string returned by strdup().

Note: This is a candidate for the stable branches.
CC: Johannes Obermayr <johannesobermayr@gmx.de>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
12 years agor600g: check gpr count limit
Vadim Girlin [Mon, 9 Apr 2012 20:44:52 +0000 (00:44 +0400)]
r600g: check gpr count limit

This should help to prevent gpu lockups.
See https://bugs.freedesktop.org/show_bug.cgi?id=48472

NOTE: This is a candidate for the stable branches.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agoglsl: fix variable ordering in the output_read_remover
Vadim Girlin [Thu, 5 Apr 2012 01:07:03 +0000 (05:07 +0400)]
glsl: fix variable ordering in the output_read_remover

Use the hash of the variable name instead of the pointer value.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965: Add support for sampling texture buffer objects on gen7+.
Eric Anholt [Tue, 27 Mar 2012 16:37:40 +0000 (09:37 -0700)]
i965: Add support for sampling texture buffer objects on gen7+.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Add real support for texturing/rendering with MESA_FORMAT_RGBA8888_REV.
Eric Anholt [Wed, 28 Mar 2012 16:38:57 +0000 (09:38 -0700)]
i965: Add real support for texturing/rendering with MESA_FORMAT_RGBA8888_REV.

This was hacked in in one place for EGL image stuff, but the right
thing to do was just to provide the mapping from the mesa format to
the native hardware format, which includes render target support.

This turns out to be required for GL_ARB_texture_buffer_object, which
sees data in this layout.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965/gen7: Fix the /* ignored */ comment on constant surface setup.
Eric Anholt [Tue, 27 Mar 2012 21:03:26 +0000 (14:03 -0700)]
i965/gen7: Fix the /* ignored */ comment on constant surface setup.

It turns out this field *is* used, and it's the stride between samples
from the buffer.  Discovered during TBO debugging.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Add support for the GL 3.1 R/RG formats in texture buffer objects.
Eric Anholt [Tue, 27 Mar 2012 22:48:21 +0000 (15:48 -0700)]
mesa: Add support for the GL 3.1 R/RG formats in texture buffer objects.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Track a gl_format for the texture buffer format.
Eric Anholt [Tue, 27 Mar 2012 17:29:04 +0000 (10:29 -0700)]
mesa: Track a gl_format for the texture buffer format.

There was a function full of unused mappings from the GLenum to
datatype/comps, but that wasn't all the information a driver would
want, which includes the other fields that a gl_format has.  Given
that all the texture buffer formats were represented in gl_format,
just use that as our description.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Handle updating texture state for buffer textures.
Eric Anholt [Tue, 27 Mar 2012 16:51:24 +0000 (09:51 -0700)]
mesa: Handle updating texture state for buffer textures.

We have to skip some work that wants to look at texture images, since
buffer textures don't have any of that complexity.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Create the default (name==0) buffer texture.
Eric Anholt [Mon, 26 Mar 2012 23:49:23 +0000 (16:49 -0700)]
mesa: Create the default (name==0) buffer texture.

All that should be needed is that it exists.  Fixes segfaults on first
_mesa_update_context() with a samplerBuffer-using shader active but
without a particular buffer texture enabled.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoglsl: Add texelFetch(*samplerBuffer) entrypoints to GLSL 1.40.
Eric Anholt [Mon, 26 Mar 2012 21:04:48 +0000 (14:04 -0700)]
glsl: Add texelFetch(*samplerBuffer) entrypoints to GLSL 1.40.

Fix texelFetch(sampler2DRect) and textureSize(samplerBuffer)
generation to not reference a LOD at the same time because it's easier
than not fixing it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoglsl: Add support for parsing [iu]samplerBuffer types in GLSL 1.40.
Eric Anholt [Mon, 26 Mar 2012 21:13:17 +0000 (14:13 -0700)]
glsl: Add support for parsing [iu]samplerBuffer types in GLSL 1.40.

The samplerBuffer type will be undefined in !glsl 1.40, and the
keyword is marked as reserved.  The [iu]samplerBuffer types are not
marked as reserved pre-1.40, so they don't have separate tokens and
fall through to normal type handling.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Set the correct initial value of the texture buffer object format.
Eric Anholt [Tue, 20 Mar 2012 23:52:30 +0000 (16:52 -0700)]
mesa: Set the correct initial value of the texture buffer object format.

Fixes piglit GL_ARB_texture_buffer_object/get

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Set up glTexBuffer{,ARB} for display list compile.
Eric Anholt [Tue, 20 Mar 2012 23:31:21 +0000 (16:31 -0700)]
mesa: Set up glTexBuffer{,ARB} for display list compile.

We're supposed to just immediately call it.  Fixes piglit
GL_ARB_texture_buffer_object/dlist

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoglapi: regen for TBO change.
Eric Anholt [Wed, 28 Mar 2012 17:27:39 +0000 (10:27 -0700)]
glapi: regen for TBO change.

12 years agoglapi: Mark TexBuffer as an alias of TexBufferARB.
Eric Anholt [Tue, 20 Mar 2012 23:50:51 +0000 (16:50 -0700)]
glapi: Mark TexBuffer as an alias of TexBufferARB.

This is set correctly in gl.spec, but was missed in Mesa.  As a
result, only one of the two was hooked up in Mesa.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoglsl: Drop the round-trip through ast_type_specifier for many builtin types.
Eric Anholt [Fri, 30 Mar 2012 06:17:32 +0000 (23:17 -0700)]
glsl: Drop the round-trip through ast_type_specifier for many builtin types.

We have lexer recognition of a bunch of our types based on the
handling.  This code was mapping those recognized tokens to an enum
and then to a string of their name.  Just drop the enums and provide
the string directly in the parser.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoglsl: Use (const char *) in AST nodes rather than plain (char *).
Kenneth Graunke [Fri, 30 Mar 2012 06:17:31 +0000 (23:17 -0700)]
glsl: Use (const char *) in AST nodes rather than plain (char *).

Nothing actually relied on them being mutable, and there was at least
one cast which discarded const qualifiers.  The next patch would have
introduced many more.

Casting away const qualifiers should be avoided if at all possible.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoff_fragment_shader: Remove some dead fields.
Eric Anholt [Mon, 19 Mar 2012 23:02:06 +0000 (16:02 -0700)]
ff_fragment_shader: Remove some dead fields.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agox86-64: Don't print "Initializing x86-64 optimizations" in debug builds.
Kenneth Graunke [Mon, 2 Apr 2012 21:53:00 +0000 (14:53 -0700)]
x86-64: Don't print "Initializing x86-64 optimizations" in debug builds.

In "release" builds, Mesa would print this message if the MESA_DEBUG
variable was set.  Make it so for debug builds as well.

I build debug builds all the time, but I'm not debugging this.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoir_to_mesa: Remove pretense of support for function calls.
Kenneth Graunke [Mon, 2 Apr 2012 20:29:37 +0000 (13:29 -0700)]
ir_to_mesa: Remove pretense of support for function calls.

While ir_to_mesa contains code that attempts to support functions, I
honestly doubt it's been tested and have little confidence that it
works.

The comment in visit(ir_function *ir) doesn't inspire confidence:
/* Ignore function bodies other than main() -- we shouldn't see calls to
 * them since they should all be inlined before we get to ir_to_mesa.
 */

Furthermore, hardware drivers such as i915, i965, and (AFAICT) r200
don't support the BGNSUB/ENDSUB/CAL opcodes anyway.  Only swrast does.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Remove vestiges of function call support from the old VS backend.
Kenneth Graunke [Mon, 2 Apr 2012 21:03:08 +0000 (14:03 -0700)]
i965: Remove vestiges of function call support from the old VS backend.

This never worked.  brwProgramStringNotify also explicitly rejects
programs that use CAL and RET.  So there's no need for this to exist.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi915: set SPRITE_POINT_ENABLE bit correctly
Yuanhan Liu [Sat, 17 Mar 2012 02:48:23 +0000 (10:48 +0800)]
i915: set SPRITE_POINT_ENABLE bit correctly

When SPRITE_POINT_ENABLE bit is set, the texture coord would be
replaced, and this is only needed when we called something like
glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE).

And more,  we currently handle varying inputs as texture coord,
we would be careful when setting this bit and set it just when
needed, or you will find the value of varying input is not right
and changed.

Thus we do set SPRITE_POINT_ENABLE bit only when all enabled tex
coord units need do CoordReplace. Or fallback is needed to make
sure the rendering is right.

With handling the bit setup at i915_update_sprite_point_enable(),
we don't need the relative code at i915Enable then.

This patch would _really_ fix the webglc point-size.html test case and
of course, not regress piglit point-sprite and glean-pointSprite
testcase.

NOTE: This is a candidate for stable release branches.

v2: fallback just when all enabled tex coord units need do
    CoordReplace (Eric)
v3: move the sprite point validate code at I915InvalidateState (Eric)
v4: sprite point enable bit update based on _NEW_PROGRAM, too
    add relative _NEW-state comments to show what state is being used(Eric)

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
12 years agoglx: fix compile warnings
Yuanhan Liu [Wed, 28 Mar 2012 02:09:55 +0000 (10:09 +0800)]
glx: fix compile warnings

Fix 'set but not used' warnings; gl_version, gl_versions_profiles and
glx_extensions variables are used just only HAVE_XCB_GLX_CREATE_CONTEXT
is defined. Thus those warnings are shown when that macro isn't defined.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
12 years agost/xa: Link with -Wl,-r instead of -r.
Johannes Obermayr [Sat, 7 Apr 2012 18:31:41 +0000 (20:31 +0200)]
st/xa: Link with -Wl,-r instead of -r.

This is required to link with clang:
  /usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000400160.

12 years agotgsi: Fix conflict with fortify printf redirect in glibc.
Johannes Obermayr [Mon, 5 Mar 2012 18:37:39 +0000 (19:37 +0100)]
tgsi: Fix conflict with fortify printf redirect in glibc.

 Fixes clang error:

   tgsi/tgsi_dump.c:72:12: error: no member named '__printf_chk' in 'struct dump_ctx'
         ctx->printf( ctx, "%u", e );
         ~~~  ^
   /usr/include/bits/stdio2.h:109:3: note: expanded from macro 'printf'
     __printf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
     ^

 Idea stolen from:
   http://www.mail-archive.com/pld-cvs-commit@lists.pld-linux.org/msg210998.html

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agost/mesa: fix max_offset computation for base vertex
Brian Paul [Mon, 2 Apr 2012 18:05:16 +0000 (20:05 +0200)]
st/mesa: fix max_offset computation for base vertex

Add the maximum base vertex offset to max_index for computing the
buffer size.  Fixes a failed assertion in the u_upload_mgr.c code with
the VMware svga driver.

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

v2: incorporate Marek's suggestions.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
12 years agosvga: add missing cases for PIPE_CAP_x queries
Brian Paul [Thu, 5 Apr 2012 21:28:09 +0000 (15:28 -0600)]
svga: add missing cases for PIPE_CAP_x queries

Return 0 for features we don't support.  Added debug_printf()
warnings when we fail to handle a new PIPE_CAP_x case.  That will
alert us to interfaces changes in the future.  We don't want to
just ignore new PIPE_CAPs and possibly miss something important.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agosvga: return 1 for PIPE_CAP_VERTEX_COLOR_UNCLAMPED query
Brian Paul [Wed, 4 Apr 2012 22:04:00 +0000 (16:04 -0600)]
svga: return 1 for PIPE_CAP_VERTEX_COLOR_UNCLAMPED query

Before, we weren't clamping the vertex colors produced by ARB vertex
programs.  This could result in some rendering being too bright (in
ETQW, for example).

Also add cases for PIPE_CAP_VERTEX_COLOR_CLAMPED and
PIPE_CAP_FRAGMENT_COLOR_CLAMPED with comments to be complete.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agosvga: handle TGSI_SEMANTIC_CLIPDIST/VERTEX semantics
Brian Paul [Mon, 2 Apr 2012 18:05:50 +0000 (20:05 +0200)]
svga: handle TGSI_SEMANTIC_CLIPDIST/VERTEX semantics

We can't support these vertex attributes, but don't die in an assertion.
Issue a warning instead.

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

12 years agogallium/docs: fix typos
Brian Paul [Fri, 30 Mar 2012 15:41:42 +0000 (09:41 -0600)]
gallium/docs: fix typos

12 years agoi965: Actually upload sampler state pointers for the VS unit on Gen6.
Kenneth Graunke [Wed, 4 Apr 2012 23:48:21 +0000 (16:48 -0700)]
i965: Actually upload sampler state pointers for the VS unit on Gen6.

We already program all the sampler state correctly, we just didn't give
the GPU a pointer to it for the VS stage.  Thus, any texturing other
than texelFetch() wouldn't work.

Fixes piglit test vs-textureLod-miplevels and 99 of oglconform's
glsl-bif-tex subtests.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agogallivm: Updated lp_build_log2_approx to use a more accurate polynomial.
James Benton [Thu, 5 Apr 2012 19:34:11 +0000 (20:34 +0100)]
gallivm: Updated lp_build_log2_approx to use a more accurate polynomial.

Tested with lp_test_arit with 100% passes and piglit tests with 100%
pass for log but some tests still fail for pow.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
12 years agogallivm: Updated lp_build_polynomial to compute odd and even terms separately to...
James Benton [Thu, 5 Apr 2012 19:32:51 +0000 (20:32 +0100)]
gallivm: Updated lp_build_polynomial to compute odd and even terms separately to decrease data dependency for faster runtime.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
12 years agoxatracker: fix the build of a 32bit lib on a 64bit os
Alexandre Demers [Thu, 5 Apr 2012 04:18:25 +0000 (00:18 -0400)]
xatracker: fix the build of a 32bit lib on a 64bit os

we were missing cflags.

Signed-off-by: Zack Rusin <zackr@vmware.com>
12 years agor600g: inline r600_upload_index_buffer
Marek Olšák [Mon, 2 Apr 2012 01:01:01 +0000 (03:01 +0200)]
r600g: inline r600_upload_index_buffer

12 years agor600g: inline r600_upload_const_buffer
Marek Olšák [Mon, 2 Apr 2012 00:45:27 +0000 (02:45 +0200)]
r600g: inline r600_upload_const_buffer

12 years agor600g: handle DISCARD_WHOLE_RESOURCE for buffers
Marek Olšák [Mon, 2 Apr 2012 04:08:58 +0000 (06:08 +0200)]
r600g: handle DISCARD_WHOLE_RESOURCE for buffers

This should prevent stalls and therefore increase perfomance in some cases.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: invalidate caches at the beginning of CS
Marek Olšák [Mon, 2 Apr 2012 03:01:20 +0000 (05:01 +0200)]
r600g: invalidate caches at the beginning of CS

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: remove dead code after the rework
Marek Olšák [Sun, 1 Apr 2012 22:33:52 +0000 (00:33 +0200)]
r600g: remove dead code after the rework

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: rework state emission of constant buffers
Marek Olšák [Sun, 1 Apr 2012 20:03:15 +0000 (22:03 +0200)]
r600g: rework state emission of constant buffers

Framerate in ipers:
  before: 43.6 FPS
  after:  46.6 FPS

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: rework state emission of vertex buffers
Marek Olšák [Fri, 30 Mar 2012 21:52:45 +0000 (23:52 +0200)]
r600g: rework state emission of vertex buffers

This reduces a little of CPU overhead.
The idea is to translate pipe vertex buffers directly into the CS
and not using any intermediate representations.

Framerate in Torcs:
  before: 32.2
  after:  34.6

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: kill off the fallback for crazy src_offset values
Marek Olšák [Fri, 30 Mar 2012 21:39:55 +0000 (23:39 +0200)]
r600g: kill off the fallback for crazy src_offset values

st/mesa doesn't allow src_offset to be greater than stride and the maximum
stride r600 supports is 2047.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agost/xvmc: fix library installation dir
Alexandre Demers [Wed, 4 Apr 2012 08:54:56 +0000 (10:54 +0200)]
st/xvmc: fix library installation dir

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

v2: some reordering and while at it also fix the
    comment in Makefile.xvmc

Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agor300g/swtcl: fix crash when back color is present in vertex shader
Marek Olšák [Wed, 4 Apr 2012 01:55:42 +0000 (03:55 +0200)]
r300g/swtcl: fix crash when back color is present in vertex shader

The shader transformation code sometimes produced invalid TGSI.

12 years agor300g/swtcl: initialize some Draw options
Marek Olšák [Wed, 4 Apr 2012 00:07:55 +0000 (02:07 +0200)]
r300g/swtcl: initialize some Draw options

12 years agor300g/swtcl: fix polygon offset
Marek Olšák [Tue, 3 Apr 2012 23:46:31 +0000 (01:46 +0200)]
r300g/swtcl: fix polygon offset

12 years agor300g/swtcl: don't expose shader subroutine support
Marek Olšák [Tue, 3 Apr 2012 21:00:18 +0000 (23:00 +0200)]
r300g/swtcl: don't expose shader subroutine support

RET in the main function doesn't work. This should be fixed in Draw, but meh.

12 years agor300g: initialize state & render functions before creating u_vbuf & u_blitter
Marek Olšák [Tue, 3 Apr 2012 20:12:35 +0000 (22:12 +0200)]
r300g: initialize state & render functions before creating u_vbuf & u_blitter

12 years agor300g/swtcl: don't enter u_vbuf_mgr
Marek Olšák [Sat, 31 Mar 2012 20:17:19 +0000 (22:17 +0200)]
r300g/swtcl: don't enter u_vbuf_mgr

12 years agor300g/swtcl: don't print an error when getting ClipVertex
Marek Olšák [Tue, 3 Apr 2012 20:37:30 +0000 (22:37 +0200)]
r300g/swtcl: don't print an error when getting ClipVertex

Draw can do it just fine.

12 years agost/egl: Update to the new wl_shm_pool interface
Benjamin Franzke [Tue, 3 Apr 2012 18:20:49 +0000 (20:20 +0200)]
st/egl: Update to the new wl_shm_pool interface

12 years agou_blitter: don't use user buffers
Marek Olšák [Tue, 3 Apr 2012 17:58:48 +0000 (19:58 +0200)]
u_blitter: don't use user buffers

12 years agogallivm: Pass in a MCInstrInfo to createMCInstPrinter on llvm-3.1.
Vinson Lee [Tue, 3 Apr 2012 05:14:15 +0000 (22:14 -0700)]
gallivm: Pass in a MCInstrInfo to createMCInstPrinter on llvm-3.1.

llvm-3.1svn r153860 makes MCInstrInfo available to the MCInstPrinter.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agost/vdpau: fix deadlock in PresentationQueueQuerySurfaceStatus
Christian König [Thu, 29 Mar 2012 13:53:28 +0000 (15:53 +0200)]
st/vdpau: fix deadlock in PresentationQueueQuerySurfaceStatus

Signed-off-by: Christian König <deathsimple@vodafone.de>
12 years agor600g: remove dead code in r600_update_derived_state
Marek Olšák [Tue, 3 Apr 2012 15:09:47 +0000 (17:09 +0200)]
r600g: remove dead code in r600_update_derived_state

12 years agogallivm: Maximum loop iterations
James Benton [Mon, 2 Apr 2012 15:29:34 +0000 (16:29 +0100)]
gallivm: Maximum loop iterations

Limits maximum loop iterations in a TGSI shader to prevent infinite
loops from occurring, any iteration in any loop counts towards this
limit

Signed-off-by: José Fonseca <jfonseca@vmware.com>
12 years agogallivm: Simplify/reorder minimax helper.
José Fonseca [Tue, 3 Apr 2012 08:10:53 +0000 (09:10 +0100)]
gallivm: Simplify/reorder minimax helper.

12 years agoswrast: Fix memory leaks in blit_linear.
Vinson Lee [Sun, 1 Apr 2012 06:11:42 +0000 (23:11 -0700)]
swrast: Fix memory leaks in blit_linear.

Fixes Coverity resource leak defects.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoglsl: Demote 'type' from ir_instruction to ir_rvalue and ir_variable.
Kenneth Graunke [Wed, 21 Sep 2011 00:58:45 +0000 (17:58 -0700)]
glsl: Demote 'type' from ir_instruction to ir_rvalue and ir_variable.

Variables have types, expression trees have types, but statements don't.
Rather than have a nonsensical field that stays NULL in the base class,
just move it to where it makes sense.

Fix up a few places that lazily used ir_instruction even though they
actually knew the particular subclass.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Remove ir_call::get_callee() and set_callee().
Kenneth Graunke [Wed, 21 Sep 2011 01:08:11 +0000 (18:08 -0700)]
glsl: Remove ir_call::get_callee() and set_callee().

Previously, set_callee() performed some assertions about the type of the
ir_call; protecting the bare pointer ensured these checks would be run.

However, ir_call no longer has a type, so the getter and setter methods
don't actually do anything useful.  Remove them in favor of accessing
callee directly, as is done with most other fields in our IR.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Convert ir_call to be a statement rather than a value.
Kenneth Graunke [Tue, 20 Mar 2012 22:56:37 +0000 (15:56 -0700)]
glsl: Convert ir_call to be a statement rather than a value.

Aside from ir_call, our IR is cleanly split into two classes:
- Statements (typeless; used for side effects, control flow)
- Values (deeply nestable, pure, typed expression trees)

Unfortunately, ir_call confused all this:
- For void functions, we placed ir_call directly in the instruction
  stream, treating it as an untyped statement.  Yet, it was a subclass
  of ir_rvalue, and no other ir_rvalue could be used in this way.
- For functions with a return value, ir_call could be placed in
  arbitrary expression trees.  While this fit naturally with the source
  language, it meant that expressions might not be pure, making it
  difficult to transform and optimize them.  To combat this, we always
  emitted ir_call directly in the RHS of an ir_assignment, only using
  a temporary variable in expression trees.  Many passes relied on this
  assumption; the acos and atan built-ins violated it.

This patch makes ir_call a statement (ir_instruction) rather than a
value (ir_rvalue).  Non-void calls now take a ir_dereference of a
variable, and store the return value there---effectively a call and
assignment rolled into one.  They cannot be embedded in expressions.

All expression trees are now pure, without exception.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Split out ir_reader's ability to read ir_dereference_variables.
Kenneth Graunke [Thu, 22 Sep 2011 21:29:53 +0000 (14:29 -0700)]
glsl: Split out ir_reader's ability to read ir_dereference_variables.

Most of the time, we just want to read an ir_dereference, so there's no
need to have these in separate functions.  However, the next patch will
want to read an ir_dereference_variable directly.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Move constant expression handling from calls to signatures.
Kenneth Graunke [Tue, 20 Sep 2011 07:14:05 +0000 (00:14 -0700)]
glsl: Move constant expression handling from calls to signatures.

When translating a call from AST to HIR, we need to decide whether it
can be evaluated to a constant before emitting any code (namely, the
temporary declaration, assignment, and call.)

Soon, ir_call will become a statement taking a dereference of where to
store the return value, rather than an rvalue to be used on the RHS of
an assignment.  It will be more convenient to try evaluation before
creating a call.  ir_function_signature seems like a reasonable place.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Use ir_rvalue to represent generic error_type values.
Kenneth Graunke [Thu, 22 Sep 2011 22:04:56 +0000 (15:04 -0700)]
glsl: Use ir_rvalue to represent generic error_type values.

Currently, ir_call can be used as either a statement (for void
functions) or a value (for non-void functions).  This is rather awkward,
as it's the only class that can be used in both forms.

A number of places use ir_call::get_error_instruction() to construct a
generic value of error_type.  If ir_call is to become a statement, it
can no longer serve this purpose.

Unfortunately, none of our classes are particularly well suited for
this, and creating a new one would be rather aggrandizing.  So, this
patch introduces ir_rvalue::error_value(), a static method that creates
an instance of the base class, ir_rvalue.  This has the nice property
that you can't accidentally try and access uninitialized fields (as it
doesn't have any).  The downside is that the base class is no longer
abstract.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>