mesa.git
10 years agoFix 'make check' in src/mapi/glapi/tests when builddir != srcdir
Jon TURNEY [Fri, 8 Nov 2013 13:22:54 +0000 (13:22 +0000)]
Fix 'make check' in src/mapi/glapi/tests when builddir != srcdir

make[5]: Entering directory `/jhbuild/build/mesa/mesa/src/mapi/glapi/tests'
  CXX      check_table.o
/jhbuild/checkout/mesa/mesa/src/mapi/glapi/tests/check_table.cpp:29:30: fatal error: glapi/glapitable.h: No such file or directory

We should look for the generated file glapi/glapitable.h in builddir, not srcdir

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
10 years agodocs: Import 10.0 release notes, add news item
Ian Romanick [Sun, 1 Dec 2013 07:41:14 +0000 (23:41 -0800)]
docs: Import 10.0 release notes, add news item

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965/gen6: Fix multisample resolve blits for luminance/intensity 32F formats.
Paul Berry [Wed, 27 Nov 2013 15:43:03 +0000 (07:43 -0800)]
i965/gen6: Fix multisample resolve blits for luminance/intensity 32F formats.

On gen6, multisamble resolve blits use the SAMPLE message to blend
together the 4 samples for each texel.  For some reason, SAMPLE
doesn't blend together the proper samples when the source format is
L32_FLOAT or I32_FLOAT, resulting in blocky artifacts.

To work around this problem, sample from the source surface using
R32_FLOAT.  This shouldn't affect rendering correctness, because when
doing these resolve blits, the destination format is R32_FLOAT, so the
channel replication done by L32_FLOAT and I32_FLOAT is unnecessary.

Fixes piglit tests on Sandy Bridge:
- spec/ARB_texture_float/multisample-formats 2 GL_ARB_texture_float
- spec/ARB_texture_float/multisample-formats 4 GL_ARB_texture_float

No piglit regressions on Sandy Bridge.

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

Cc: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Remove unused field loop_variable_state::loop.
Paul Berry [Wed, 27 Nov 2013 18:53:33 +0000 (10:53 -0800)]
glsl: Remove unused field loop_variable_state::loop.

This field was neither initialized nor used.  It was just dead memory.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Improve documentation of ir_loop counter/control fields.
Paul Berry [Wed, 27 Nov 2013 19:39:51 +0000 (11:39 -0800)]
glsl: Improve documentation of ir_loop counter/control fields.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: In ir_validate, check that ir_loop::counter always refers to a new var.
Paul Berry [Wed, 27 Nov 2013 18:12:53 +0000 (10:12 -0800)]
glsl: In ir_validate, check that ir_loop::counter always refers to a new var.

The compiler back-ends (i965's fs_visitor and brw_visitor,
ir_to_mesa_visitor, and glsl_to_tgsi_visitor) have been assuming this
for some time.  Thanks to the preceding patch, the compiler front-end
no longer breaks this assumption.

This patch adds code to validate the assumption so that if we have
future bugs, we'll be able to catch them earlier.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Fix inconsistent assumptions about ir_loop::counter.
Paul Berry [Tue, 26 Nov 2013 22:19:49 +0000 (14:19 -0800)]
glsl: Fix inconsistent assumptions about ir_loop::counter.

The compiler back-ends (i965's fs_visitor and brw_visitor,
ir_to_mesa_visitor, and glsl_to_tgsi_visitor) assume that when
ir_loop::counter is non-null, it points to a fresh ir_variable that
should be used as the loop counter (as opposed to an ir_variable that
exists elsewhere in the instruction stream).

However, previous to this patch:

(1) loop_control_visitor did not create a new variable for
    ir_loop::counter; instead it re-used the existing ir_variable.
    This caused the loop counter to be double-incremented (once
    explicitly by the body of the loop, and once implicitly by
    ir_loop::increment).

(2) ir_clone did not clone ir_loop::counter properly, resulting in the
    cloned ir_loop pointing to the source ir_loop's counter.

(3) ir_hierarchical_visitor did not visit ir_loop::counter, resulting
    in the ir_variable being missed by reparenting.

Additionally, most optimization passes (e.g. loop unrolling) assume
that the variable mentioned by ir_loop::counter is not accessed in the
body of the loop (an assumption which (1) violates).

The combination of these factors caused a perfect storm in which the
code worked properly nearly all of the time: for loops that got
unrolled, (1) would introduce a double-increment, but loop unrolling
would fail to notice it (since it assumes that ir_loop::counter is not
accessed in the body of the loop), so it would unroll the loop the
correct number of times.  For loops that didn't get unrolled, (1)
would introduce a double-increment, but then later when the IR was
cloned for linking, (2) would prevent the loop counter from being
cloned properly, so it would look to further analysis stages like an
independent variable (and hence the double-increment would stop
occurring).  At the end of linking, (3) would prevent the loop counter
from being reparented, so it would still belong to the shader object
rather than the linked program object.  Provided that the client
program didn't delete the shader object, the memory would never get
reclaimed, and so the shader would function properly.

However, for loops that didn't get unrolled, if the client program did
delete the shader object, and the memory belonging to the loop counter
got re-used, this could cause a use-after-free bug, leading to a
crash.

This patch fixes loop_control_visitor, ir_clone, and
ir_hierarchical_visitor to treat ir_loop::counter the same way the
back-ends treat it: as a freshly allocated ir_variable that needs to
be visited and cloned independently of other ir_variables.

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

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Teach ir_variable_refcount about ir_loop::counter variables.
Paul Berry [Tue, 26 Nov 2013 22:37:57 +0000 (14:37 -0800)]
glsl: Teach ir_variable_refcount about ir_loop::counter variables.

If an ir_loop has a non-null "counter" field, the variable referred to
by this field is implicitly read and written by the loop.  We need to
account for this in ir_variable_refcount, otherwise there is a danger
we will try to dead-code-eliminate the loop counter variable.

Note: at the moment the dead code elimination bug doesn't occur due to
a bug in ir_hierarchical_visitor: it doesn't visit the "counter"
field, so dead code elimination doesn't treat it as a candidate for
elimination.  But the patch to follow will fix that bug, so we need to
fix ir_variable_refcount first in order to avoid breaking dead code
elimination.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: fix mem leak of glPixelMap data in display list
Brian Paul [Fri, 29 Nov 2013 13:40:35 +0000 (06:40 -0700)]
mesa: fix mem leak of glPixelMap data in display list

And simplify save_PixelMapfv() by using the memdup() function.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: added memory-related comment in save_error()
Brian Paul [Fri, 29 Nov 2013 13:40:35 +0000 (06:40 -0700)]
mesa: added memory-related comment in save_error()

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: fix flags assignment in save_WaitSync()
Brian Paul [Fri, 29 Nov 2013 13:40:35 +0000 (06:40 -0700)]
mesa: fix flags assignment in save_WaitSync()

The flags value is a bitfield so use the union's 'bf' field, not 'e'
(enum) field.  There's no actual change in behavior here since both
fields of the union are the same size.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: remove old colortable, histogram, etc. code from dlist.c
Brian Paul [Fri, 29 Nov 2013 13:40:35 +0000 (06:40 -0700)]
mesa: remove old colortable, histogram, etc. code from dlist.c

Trying to compile any of these functions into a display list
now just generates a GL_INVALID_OPERATION error.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: have old convolution functions generate GL_INVALID_OPERATION
Brian Paul [Fri, 29 Nov 2013 13:40:35 +0000 (06:40 -0700)]
mesa: have old convolution functions generate GL_INVALID_OPERATION

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: have old glColorTable functions generate GL_INVALID_OPERATION
Brian Paul [Fri, 29 Nov 2013 13:40:35 +0000 (06:40 -0700)]
mesa: have old glColorTable functions generate GL_INVALID_OPERATION

As is done for the old histogram functions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agotrace: Dump PIPE_QUERY_* enums.
José Fonseca [Wed, 27 Nov 2013 11:43:54 +0000 (11:43 +0000)]
trace: Dump PIPE_QUERY_* enums.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agotrace: Dump query results faithfully.
José Fonseca [Wed, 27 Nov 2013 11:40:14 +0000 (11:40 +0000)]
trace: Dump query results faithfully.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agodocs: Import 9.2.4 release notes, add news item.
Carl Worth [Thu, 28 Nov 2013 08:02:31 +0000 (00:02 -0800)]
docs: Import 9.2.4 release notes, add news item.

10 years agogallium/cso: fix sampler / sampler_view counts
Roland Scheidegger [Tue, 26 Nov 2013 02:42:44 +0000 (03:42 +0100)]
gallium/cso: fix sampler / sampler_view counts

Now that it is possible to query drivers for the max sampler view it should
be safe to increase this without crashing.
Not entirely convinced this really works correctly though if state trackers
using non-linked sampler / sampler_views use this.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agogallium: new shader cap bit for the amount of sampler views
Roland Scheidegger [Tue, 26 Nov 2013 01:30:41 +0000 (02:30 +0100)]
gallium: new shader cap bit for the amount of sampler views

Ever since introducing separate sampler and sampler view max this was really
missing.
Every driver but llvmpipe reports the same number as number of samplers for
now, so nothing should break.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agogallium/drivers: support more sampler views than samplers for more drivers
Roland Scheidegger [Tue, 26 Nov 2013 01:30:13 +0000 (02:30 +0100)]
gallium/drivers: support more sampler views than samplers for more drivers

This adds support for this to more drivers, in particular for all the "special"
ones useful for debugging.
HW drivers are left alone, some should be able to support it if they want but
they may not be interested at this point.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agoi965: Properly reject __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS when __DRI2_ROBUSTNESS...
Ian Romanick [Wed, 27 Nov 2013 00:27:57 +0000 (16:27 -0800)]
i965: Properly reject __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS when __DRI2_ROBUSTNESS is not enabled

Only allow __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS in brwCreateContext if
intelInitScreen2 also enabled __DRI2_ROBUSTNESS (thereby enabling
GLX_ARB_create_context).

This fixes a regression in the piglit test
"glx/GLX_ARB_create_context/invalid flag"

v2: Remove commented debug code.  Noticed by Jordan.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reported-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.0" <mesa-stable@lists.freedesktop.org>
10 years agoRevert "drop old INTEL_DEBUG names for `perf` (fall) and `fs` (wm)"
Matt Turner [Wed, 27 Nov 2013 21:37:46 +0000 (13:37 -0800)]
Revert "drop old INTEL_DEBUG names for `perf` (fall) and `fs` (wm)"

This reverts commit 195994fe4cd851f4aed7fe32697f94c4188a96c8.

It wasn't sent to the list, Ken didn't review it, and it breaks
shader-db.

10 years agoglsl: Link glcpp with math library.
Vinson Lee [Wed, 20 Nov 2013 07:24:11 +0000 (23:24 -0800)]
glsl: Link glcpp with math library.

This patch fixes this build error with Oracle Solaris Studio.

libtool: link: /opt/solarisstudio12.3/bin/cc -g -o glcpp/glcpp glcpp.o prog_hash_table.o  ./.libs/libglcpp.a
Undefined first referenced
 symbol       in file
sqrt                                prog_hash_table.o

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Always reserve binding table space for at least one render target.
Kenneth Graunke [Tue, 26 Nov 2013 08:30:19 +0000 (00:30 -0800)]
i965: Always reserve binding table space for at least one render target.

In brw_update_renderbuffer_surfaces(), if there are no color draw
buffers, we always set up a null render target at surface index 0 so we
have something to use with the FB write marking the end of thread.

However, when we recently began computing surface indexes dynamically,
we failed to reserve space for it.  This meant that the first texture
would be assigned surface index 0, and our closing FB write would
clobber the texture.

Fixes Piglit's EXT_packed_depth_stencil/fbo-blit-d24s8 test on Gen4-5,
which regressed as of commit 4e5306453da6a1c076309e543ec92d999e02f67a
("i965/fs: Dynamically set up the WM binding table offsets.")

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70605
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Tested-by: lu hua <huax.lu@intel.com>
Cc: "10.0" mesa-stable@lists.freedesktop.org
10 years agoglsl: Initialize _mesa_glsl_parse_state::atomic_counter_offsets before using it.
Francisco Jerez [Tue, 26 Nov 2013 20:43:13 +0000 (12:43 -0800)]
glsl: Initialize _mesa_glsl_parse_state::atomic_counter_offsets before using it.

Cc: Ian Romanick <ian.d.romanick@intel.com>
Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965/fs: Fix misleading comment.
Francisco Jerez [Sat, 23 Nov 2013 00:26:53 +0000 (16:26 -0800)]
i965/fs: Fix misleading comment.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Bump number of supported atomic counter buffers.
Francisco Jerez [Sat, 23 Nov 2013 00:09:42 +0000 (16:09 -0800)]
i965: Bump number of supported atomic counter buffers.

Now that we have dynamic binding tables there's no good reason anymore
to expose so few atomic counter buffers.  Increase it to 16.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl/linker: Validate IR just before reparenting.
Paul Berry [Fri, 22 Nov 2013 20:37:22 +0000 (12:37 -0800)]
glsl/linker: Validate IR just before reparenting.

If reparent_ir() is called on invalid IR, then there's a danger that
it will fail to reparent all of the necessary nodes.  For example, if
the IR contains an ir_dereference_variable which refers to an
ir_variable that's not in the tree, that ir_variable won't get
reparented, resulting in subtle use-after-free bugs once the
non-reparented nodes are freed.  (This is exactly what happened in the
bug fixed by the previous commit).

This patch makes this kind of bug far easier to track down, by
transforming it from a use-after-free bug into an explicit IR
validation error.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Fix lowering of direct assignment in lower_clip_distance.
Paul Berry [Fri, 22 Nov 2013 20:37:22 +0000 (12:37 -0800)]
glsl: Fix lowering of direct assignment in lower_clip_distance.

In commit 065da16 (glsl: Convert lower_clip_distance_visitor to be an
ir_rvalue_visitor), we failed to notice that since
lower_clip_distance_visitor overrides visit_leave(ir_assignment *),
ir_rvalue_visitor::visit_leave(ir_assignment *) wasn't getting called.
As a result, clip distance dereferences appearing directly on the
right hand side of an assignment (not in a subexpression) weren't
getting properly lowered.  This caused an ir_dereference_variable node
to be left in the IR that referred to the old gl_ClipDistance
variable.  However, since the lowering pass replaces gl_ClipDistance
with gl_ClipDistanceMESA, this turned into a dangling pointer when the
IR got reparented.

Prior to the introduction of geometry shaders, this bug was unlikely
to arise, because (a) reading from gl_ClipDistance[i] in the fragment
shader was rare, and (b) when it happened, it was likely that it would
either appear in a subexpression, or be hoisted into a subexpression
by tree grafting.

However, in a geometry shader, we're likely to see a statement like
this, which would trigger the bug:

    gl_ClipDistance[i] = gl_in[j].gl_ClipDistance[i];

This patch causes
lower_clip_distance_visitor::visit_leave(ir_assignment *) to call the
base class visitor, so that the right hand side of the assignment is
properly lowered.

Fixes piglit test:
- spec/glsl-1.50/execution/geometry/clip-distance-itemized-copy

Cc: Ian Romanick <idr@freedesktop.org>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965/gs: Set GS prog_data to NULL if there is no GS program.
Paul Berry [Mon, 25 Nov 2013 15:49:15 +0000 (07:49 -0800)]
i965/gs: Set GS prog_data to NULL if there is no GS program.

The previous commit fixes a bug wherein we would incorrectly refer to
stale geometry shader prog_data when no geometry shader was active.

This patch reduces the likelihood of that sort of bug occurring in the
future by setting prog_data to NULL whenever there is no GS program.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/gs: Properly skip GS binding table upload when no GS active.
Paul Berry [Mon, 25 Nov 2013 16:03:24 +0000 (08:03 -0800)]
i965/gs: Properly skip GS binding table upload when no GS active.

Previously, in brw_gs_upload_binding_table(), we checked whether
brw->gs.prog_data was NULL in order to determine whether a geometry
shader was active.  This didn't work: brw->gs.prog_data starts off as
NULL, but it is set to non-NULL when a geometry shader program is
built, and then never set to NULL again.  As a result, if we called
brw_gs_upload_binding_table() while there was no geometry shader
active, but a geometry shader had previously been active, it would
refer to a stale (and possibly freed) prog_data structure.

This patch fixes the problem by modifying
brw_gs_upload_binding_table() to use the proper technique to determine
whether a geometry shader is active: by checking whether
brw->geometry_program is NULL.

This fixes the crash reported in comment 2 of bug 71870 (the incorrect
rendering remains, however).

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

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agodri: Allow __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS in driCreateContextAttribs
Ian Romanick [Wed, 20 Nov 2013 17:09:50 +0000 (09:09 -0800)]
dri: Allow __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS in driCreateContextAttribs

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reported-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "10.0" <mesa-stable@lists.freedesktop.org>
10 years agoi965: Only enable __DRI2_ROBUSTNESS if kernel support is available
Ian Romanick [Wed, 20 Nov 2013 01:01:23 +0000 (17:01 -0800)]
i965: Only enable __DRI2_ROBUSTNESS if kernel support is available

Rather than always advertising the extension but failing to create a
context with reset notifiction, just don't advertise it.  I don't know
why it didn't occur to me to do it this way in the first place.

NOTE: Kristian requested that I provide a follow-up for master that
dynamically generates the list of DRI extensions instead of selected
between two hardcoded lists.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Suggested-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Cc: "10.0" <mesa-stable@lists.freedesktop.org>
10 years agoRevert "i965: Make the driver compile until a proper libdrm can be released."
Ian Romanick [Mon, 18 Nov 2013 20:39:02 +0000 (12:39 -0800)]
Revert "i965: Make the driver compile until a proper libdrm can be released."

libdrm 2.4.48 has been released.

This reverts commit bd4596efac2b783b789392a222da909efcd0fd3b.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Bump libdrm requirement
Ian Romanick [Mon, 18 Nov 2013 20:41:15 +0000 (12:41 -0800)]
i965: Bump libdrm requirement

drm_intel_get_reset_stats is only available in libdrm-2.4.48, and
libdrm-2.4.49 contains an important bug fix in that function.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "10.0" <mesa-stable@lists.freedesktop.org>
10 years agoegl: Kill macro _EGL_DECLARE_MUTEX
Chad Versace [Fri, 11 Oct 2013 19:50:21 +0000 (12:50 -0700)]
egl: Kill macro _EGL_DECLARE_MUTEX

Replace all occurences of the macro with its expansion.

It seems that the macro intended to provide cross-platform static mutex
intialization. However, it had the same definition in all pre-processor
paths:
    #define _EGL_DECLARE_MUTEX(m) _EGLMutex m = _EGL_MUTEX_INITIALIZER

Therefore this abstraction obscured rather than helped.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoegl: Enable EGL_EXT_client_extensions
Chad Versace [Fri, 11 Oct 2013 23:04:55 +0000 (16:04 -0700)]
egl: Enable EGL_EXT_client_extensions

Insert two fields into _egl_global to hold the client extensions and
statically initialize them:
    ClientExtensions // a struct of bools
    ClientExtensionString

Post-patch, Mesa supports exactly one client extension,
EGL_EXT_client_extensions.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoradeon/compute: Unconditionally inline all functions v2
Tom Stellard [Thu, 14 Nov 2013 02:52:14 +0000 (18:52 -0800)]
radeon/compute: Unconditionally inline all functions v2

We need to do this until function calls are supported.

v2:
  - Fix loop conditional

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

CC: "10.0" <mesa-stable@lists.freedesktop.org>
10 years agoi965: Use __attribute__((flatten)) on fast tiled teximage code.
Kenneth Graunke [Sat, 23 Nov 2013 21:31:32 +0000 (13:31 -0800)]
i965: Use __attribute__((flatten)) on fast tiled teximage code.

The fast tiled texture upload code does not compile with GCC 4.8's -Og
optimization flag.

memcpy() has the always_inline attribute set.  This poses a problem,
since {x,y}tile_copy_faster calls it indirectly via {x,y}tile_copy,
and {x,y}tile_copy normally aren't inlined at -Og.

Using __attribute__((flatten)) tells GCC to inline every function call
inside the function, which I believe was the author's intent.

Fix suggested by Alexander Monakov.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Cc: mesa-stable@lists.freedesktop.org
10 years agollvmpipe: support 8bit subpixel precision
Zack Rusin [Fri, 25 Oct 2013 02:05:22 +0000 (22:05 -0400)]
llvmpipe: support 8bit subpixel precision

8 bit precision is required by d3d10 but unfortunately
requires 64 bit rasterizer. This commit implements
64 bit rasterization with full support for 8bit subpixel
precision. It's a combination of all individual commits
from the llvmpipe-rast-64 branch.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agogbm/dri: hide extension loader symbols
Maarten Lankhorst [Mon, 25 Nov 2013 12:10:55 +0000 (13:10 +0100)]
gbm/dri: hide extension loader symbols

They should not be exposed.

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
10 years agoi965: Enable ARB_draw_indirect (and ARB_multi_draw_indirect) on Gen7+
Chris Forbes [Mon, 30 Sep 2013 08:16:40 +0000 (21:16 +1300)]
i965: Enable ARB_draw_indirect (and ARB_multi_draw_indirect) on Gen7+

.. and mark them off on the extensions list as done.

V2: Enable only if pipelined register writes work.
V3: Also update relnotes

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agovbo: map indirect buffer and extract params if doing sw primitive restart
Chris Forbes [Sun, 13 Oct 2013 08:00:58 +0000 (21:00 +1300)]
vbo: map indirect buffer and extract params if doing sw primitive restart

V2: Check for mapping failure (thanks Brian)
V3: - Change error on mapping failure to OUT_OF_MEMORY (Brian)
    - Unconst; remove casting away of const.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa: pass indirect buffer to sw primitive restart
Chris Forbes [Sun, 13 Oct 2013 07:56:42 +0000 (20:56 +1300)]
mesa: pass indirect buffer to sw primitive restart

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: pass indirect buffer to primitive restart check
Chris Forbes [Sat, 21 Sep 2013 05:41:14 +0000 (17:41 +1200)]
i965: pass indirect buffer to primitive restart check

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: implement indirect drawing for Gen7
Chris Forbes [Mon, 30 Sep 2013 07:57:18 +0000 (20:57 +1300)]
i965: implement indirect drawing for Gen7

Just prior to emitting the 3DPRIMITIVE command, we load each of the
indirect registers. The values loaded are either from offsets into the
current indirect BO, or constant zero if the parameter is not used for
this draw.

Enabling use of the indirect registers is done by turning on a bit in
the first dword of the 3DPRIMITIVE command itself.

V3: - Deduplicate the common part of both indexed and nonindexed indirect
setup.
    - Just refer to the indirect bo out of the context directly.

V4: - Fix bo reference to specify the range we care about.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Add new defines for indirect draws
Chris Forbes [Mon, 30 Sep 2013 07:55:21 +0000 (20:55 +1300)]
i965: Add new defines for indirect draws

- MMIO registers for draw parameters
- New bit in 3DPRIMITIVE command to enable indirection

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agovbo: Flesh out implementation of indirect draws
Chris Forbes [Wed, 6 Nov 2013 07:03:21 +0000 (20:03 +1300)]
vbo: Flesh out implementation of indirect draws

Based on part of Patch 2 of Christoph Bumiller's ARB_draw_indirect series.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: add indirect_offset, is_indirect to _mesa_prim
Chris Forbes [Sat, 16 Nov 2013 03:38:57 +0000 (16:38 +1300)]
mesa: add indirect_offset, is_indirect to _mesa_prim

V3: Add missing cases
V4: Add indirect_offset here too

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa: Add validation helpers for new indirect draws
Chris Forbes [Wed, 6 Nov 2013 07:03:21 +0000 (20:03 +1300)]
mesa: Add validation helpers for new indirect draws

Based on part of Patch 2 of Christoph Bumiller's ARB_draw_indirect series.

V3: - Disallow primcount==0 for DrawMulti*Indirect. The spec is unclear
      on this, but it's silly. We might go back on this later if it
      turns out to be a problem.

    - Make it clear that the caller has dealt with stride==0

V4: - Allow primcount==0 again.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa: Add binding point for indirect buffer
Chris Forbes [Wed, 6 Nov 2013 07:03:21 +0000 (20:03 +1300)]
mesa: Add binding point for indirect buffer

Based on part of Patch 2 of Christoph Bumiller's ARB_draw_indirect series.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa: Add extension scaffolding for ARB_draw_indirect
Chris Forbes [Wed, 6 Nov 2013 07:03:21 +0000 (20:03 +1300)]
mesa: Add extension scaffolding for ARB_draw_indirect

We will reuse the same extension flag for ARB_multi_draw_indirect since
it can always be supported by looping.

Based on part of Patch 2 of Christoph Bumiller's ARB_draw_indirect series.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglapi: add plumbing for GL_ARB_draw_indirect and GL_ARB_multi_draw_indirect
Chris Forbes [Wed, 6 Nov 2013 07:09:46 +0000 (20:09 +1300)]
glapi: add plumbing for GL_ARB_draw_indirect and GL_ARB_multi_draw_indirect

Based on part of Patch 2 of Christoph Bumiller's ARB_draw_indirect series.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa: add indirect drawing buffer parameter to draw functions
Christoph Bumiller [Fri, 5 Apr 2013 10:12:08 +0000 (12:12 +0200)]
mesa: add indirect drawing buffer parameter to draw functions

Split from patch implementing ARB_draw_indirect.

v2: Const-qualify the struct gl_buffer_object *indirect argument.
v3: Fix up some more draw calls for new argument.
v4: Fix up rebase conflicts in i965.
v5: Undo const-qualification

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agodocs/llvmpipe: Add one other good reference.
José Fonseca [Mon, 25 Nov 2013 08:28:23 +0000 (08:28 +0000)]
docs/llvmpipe: Add one other good reference.

10 years agodocs: describe the INTEL_* envvars that do exist
Chris Forbes [Sun, 24 Nov 2013 05:12:49 +0000 (18:12 +1300)]
docs: describe the INTEL_* envvars that do exist

V2: drop description of `fall` and `wm`, which have been removed by the
previous patch; describe `stats`.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agodrop old INTEL_DEBUG names for `perf` (fall) and `fs` (wm)
Chris Forbes [Mon, 25 Nov 2013 08:13:26 +0000 (21:13 +1300)]
drop old INTEL_DEBUG names for `perf` (fall) and `fs` (wm)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: remove unused DEBUG_IOCTL
Chris Forbes [Sun, 24 Nov 2013 04:57:53 +0000 (17:57 +1300)]
i965: remove unused DEBUG_IOCTL

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoradeon: change last instance of DEBUG_IOCTL to use RADEON_IOCTL
Chris Forbes [Sun, 24 Nov 2013 04:55:39 +0000 (17:55 +1300)]
radeon: change last instance of DEBUG_IOCTL to use RADEON_IOCTL

DEBUG_IOCTL comes from i965, and is about to be removed. Both defines
have the same value (4).

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodocs: drop INTEL_* envvars which no longer exist
Chris Forbes [Sun, 24 Nov 2013 04:45:29 +0000 (17:45 +1300)]
docs: drop INTEL_* envvars which no longer exist

These were removed back in 2012.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agodocs: bump supported shading language version
Chris Forbes [Sun, 24 Nov 2013 04:44:06 +0000 (17:44 +1300)]
docs: bump supported shading language version

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agost/mesa: respect higher GLSL levels. (v2)
Dave Airlie [Tue, 22 Oct 2013 08:06:37 +0000 (09:06 +0100)]
st/mesa: respect higher GLSL levels. (v2)

Limit the max glsl version level to what the state tracker supports.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agoglsl: Improve error message when attemping assignment to unsized array
Timothy Arceri [Tue, 19 Nov 2013 21:42:19 +0000 (08:42 +1100)]
glsl: Improve error message when attemping assignment to unsized array

V2: Return after error to avoid cascading error messages and
removed redundant "to" from error message

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agointel: enable GL_AMD_vertex_shader_layer extension for gen7+
Jordan Justen [Wed, 27 Mar 2013 20:58:52 +0000 (13:58 -0700)]
intel: enable GL_AMD_vertex_shader_layer extension for gen7+

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoradeonsi: implement MSAA for CIK
Marek Olšák [Wed, 20 Nov 2013 12:48:19 +0000 (13:48 +0100)]
radeonsi: implement MSAA for CIK

There are also some changes to the printfs.

Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoradeonsi: enable 2D tiling on CIK
Marek Olšák [Wed, 20 Nov 2013 12:35:03 +0000 (13:35 +0100)]
radeonsi: enable 2D tiling on CIK

libdrm does the DRM version check and decides if 2D tiling is used.

Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agomesa: initialize gl_renderbuffer::Depth in core
Marek Olšák [Wed, 20 Nov 2013 00:47:36 +0000 (01:47 +0100)]
mesa: initialize gl_renderbuffer::Depth in core

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965/fs: Make the first pre-allocation heuristic be the post heuristic.
Eric Anholt [Tue, 19 Nov 2013 21:07:12 +0000 (13:07 -0800)]
i965/fs: Make the first pre-allocation heuristic be the post heuristic.

I recently made us try two different things that tried to reduce register
pressure so that we would be more likely to allocate successfully.  But
now that we have the logic for trying two, we can make the first thing we
try be the normal, not-prioritizing-register-pressure heuristic.

This means one less scheduling pass in the common case of that heuristic
not producing spills, plus the best schedule we know how to produce, if
that one happens to succeed.  This is important, because our register
allocation produces a lot of possibly avoidable dependencies for the
post-register-allocation schedule, despite ra_set_allocate_round_robin().

GLB2.7: 1.04127% +/- 0.732461% fps improvement (n=31)
nexuiz: No difference (n=5)
lightsmark: 0.838512% +/- 0.300147% fps improvement (n=86)
minecraft apitrace: No difference (n=15)

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agomesa: Remove the ralloc canary on release builds.
Eric Anholt [Fri, 22 Nov 2013 07:29:56 +0000 (23:29 -0800)]
mesa: Remove the ralloc canary on release builds.

The canary is basically just to give a better debugging message when you
ralloc_free() something that wasn't rallocated.  Reduces maximum memory
usage of apitrace replay of the dota2 demo by 60MB on my 64-bit system (so
half that on a real 32-bit dota2 environment).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Fix streamed state dumping/annotation after the blorp-flush change.
Eric Anholt [Wed, 20 Nov 2013 00:00:28 +0000 (16:00 -0800)]
i965: Fix streamed state dumping/annotation after the blorp-flush change.

I think I was thinking of the batch command packet cache when I pasted
this in, but this counter is only used for dumping out streamed state for
INTEL_DEBUG=batch and for putting annotations in our aub files.

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Let driconf clamp_max_samples affect context version
Chad Versace [Thu, 7 Nov 2013 03:52:11 +0000 (19:52 -0800)]
i965: Let driconf clamp_max_samples affect context version

Commit 2f89662 added the driconf option 'clamp_max_samples'.  In that
commit, the option did not alter the context version. The neglect to
alter the context version is a fatal issue for some apps.

For example, consider running Chromium with clamp_max_samples=0.
Pre-patch, Mesa creates a GL 3.0 context but clamps GL_MAX_SAMPLES to
0. This violates the GL 3.0 spec, which requires GL_MAX_SAMPLES >= 4.
The spec violation causes WebGL context creation to fail in many
scenarios because Chromium correctly assumes that a GL 3.0 context
supports at least 4 samples.

Since the driconf option was introduced largely for Chromium, the issue
really needs fixing.

This patch fixes calculation of the context version to respect the
post-clamped value of GL_MAX_SAMPLES. This in turn fixes WebGL on
Chromium when clamp_max_samples=0.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Share code between intel_quantize_num_samples and clamp_max_samples
Chad Versace [Thu, 7 Nov 2013 03:40:25 +0000 (19:40 -0800)]
i965: Share code between intel_quantize_num_samples and clamp_max_samples

clamp_max_samples() and intel_quantize_num_samples() each maintained
their own list of which MSAA modes the hardware supports. This patch
removes the duplication by making intel_quantize_num_samples() use the
same list as clamp_max_samples(), the list maintained in
brw_supported_msaa_modes().

By removing the duplication, we prevent the scenario where someone
updates one list but forgets to update the other.

Move function `brw_context.c:static brw_supported_msaa_modes()` to
`intel_screen.c:(non-static) intel_supported_msaa_modes()` and patch
intel_quantize_num_samples() to use the list returned by that function.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Terminate brw_supported_msaa_modes() list with -1, not 0
Chad Versace [Fri, 15 Nov 2013 16:21:30 +0000 (08:21 -0800)]
i965: Terminate brw_supported_msaa_modes() list with -1, not 0

This simplifies the loop logic in a subsqequent patch that refactors
intel_quantize_num_samples() to use brw_supported_msaa_modes().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agost/mesa: simplify writemask for emitting fog result
Brian Paul [Thu, 21 Nov 2013 22:07:25 +0000 (15:07 -0700)]
st/mesa: simplify writemask for emitting fog result

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agomesa: fix indentation in ffvertex_prog.c
Brian Paul [Thu, 21 Nov 2013 20:08:40 +0000 (13:08 -0700)]
mesa: fix indentation in ffvertex_prog.c

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agotgsi: Prevent emission of instructions with empty writemask.
José Fonseca [Thu, 21 Nov 2013 13:11:30 +0000 (13:11 +0000)]
tgsi: Prevent emission of instructions with empty writemask.

These degenerate instructions can often be emitted by state trackers
when the semantics of instructions don't match precisely.

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agotgsi: Rework calls to ureg_emit_insn().
José Fonseca [Thu, 21 Nov 2013 13:02:14 +0000 (13:02 +0000)]
tgsi: Rework calls to ureg_emit_insn().

Mere syntactical change.

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodocs: Add a section with recommended reading for llvmpipe development.
José Fonseca [Thu, 21 Nov 2013 17:52:50 +0000 (17:52 +0000)]
docs: Add a section with recommended reading for llvmpipe development.

Several of links the were contributed by Keith Whitwell and Roland Scheidegger.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agollvmpipe: (trivial) disable new accurate origin calculation
Roland Scheidegger [Fri, 22 Nov 2013 11:28:46 +0000 (11:28 +0000)]
llvmpipe: (trivial) disable new accurate origin calculation

It looks like there's some bugs in it...

10 years agometa: Move declaration before code.
Vinson Lee [Fri, 22 Nov 2013 04:24:05 +0000 (20:24 -0800)]
meta: Move declaration before code.

Fixes MSVC build.

meta.c(2411) : error C2143: syntax error : missing ';' before 'type'
meta.c(2411) : error C2143: syntax error : missing ')' before 'type'
meta.c(2411) : error C2065: 'layer' : undeclared identifier
meta.c(2411) : error C2059: syntax error : ')'
meta.c(2411) : error C2143: syntax error : missing ';' before '{'
meta.c(2413) : error C2065: 'layer' : undeclared identifier
meta.c(2415) : error C2065: 'layer' : undeclared identifier

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
10 years agomesa: Implement GL_FRAMEBUFFER_ATTACHMENT_LAYERED query.
Paul Berry [Wed, 20 Nov 2013 05:17:19 +0000 (21:17 -0800)]
mesa: Implement GL_FRAMEBUFFER_ATTACHMENT_LAYERED query.

From section 6.1.18 (Renderbuffer Object Queries) of the GL 3.2 spec,
under the heading "If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
is TEXTURE, then":

    If pname is FRAMEBUFFER_ATTACHMENT_LAYERED, then params will
    contain TRUE if an entire level of a three-dimesional texture,
    cube map texture, or one-or two-dimensional array texture is
    attached. Otherwise, params will contain FALSE.

Fixes piglit tests:
- spec/!OpenGL 3.2/layered-rendering/framebuffer-layered-attachments
- spec/!OpenGL 3.2/layered-rendering/framebuffertexture-defaults

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
v2: Don't include "EXT" in the error message, since this query only
makes sensen in context versions that have adopted
glGetFramebufferAttachmentParameteriv().

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Fix texture target validation for glFramebufferTexture()
Paul Berry [Wed, 20 Nov 2013 05:47:04 +0000 (21:47 -0800)]
mesa: Fix texture target validation for glFramebufferTexture()

Previously we were using the code path for validating
glFramebufferTextureLayer().  But glFramebufferTexture() allows
additional texture types.

Fixes piglit tests:
- spec/!OpenGL 3.2/layered-rendering/gl-layer-cube-map
- spec/!OpenGL 3.2/layered-rendering/framebuffertexture

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
v2: Clarify comment above framebuffer_texture().

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Fix fast clear of depth buffers.
Paul Berry [Wed, 20 Nov 2013 02:51:48 +0000 (18:51 -0800)]
i965: Fix fast clear of depth buffers.

From section 4.4.7 (Layered Framebuffers) of the GLSL 3.2 spec:

    When the Clear or ClearBuffer* commands are used to clear a
    layered framebuffer attachment, all layers of the attachment are
    cleared.

This patch fixes the fast depth clear path.

Fixes piglit test "spec/!OpenGL 3.2/layered-rendering/clear-depth".

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965: Fix blorp clear of layered framebuffers.
Paul Berry [Tue, 19 Nov 2013 20:58:02 +0000 (12:58 -0800)]
i965: Fix blorp clear of layered framebuffers.

From section 4.4.7 (Layered Framebuffers) of the GLSL 3.2 spec:

    When the Clear or ClearBuffer* commands are used to clear a
    layered framebuffer attachment, all layers of the attachment are
    cleared.

This patch fixes the blorp clear path for color buffers.

Fixes piglit test "spec/!OpenGL 3.2/layered-rendering/clear-color".

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965: refactor blorp clear code in preparation for layered clears.
Paul Berry [Tue, 19 Nov 2013 18:42:59 +0000 (10:42 -0800)]
i965: refactor blorp clear code in preparation for layered clears.

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agometa: fix meta clear of layered framebuffers
Paul Berry [Tue, 19 Nov 2013 21:31:20 +0000 (13:31 -0800)]
meta: fix meta clear of layered framebuffers

From section 4.4.7 (Layered Framebuffers) of the GLSL 3.2 spec:

    When the Clear or ClearBuffer* commands are used to clear a
    layered framebuffer attachment, all layers of the attachment are
    cleared.

This patch fixes meta clears to properly clear all layers of a layered
framebuffer attachment.  We accomplish this by adding a geometry
shader to the meta clear program which sets gl_Layer to a uniform
value.  When clearing a layered framebuffer, we execute in a loop,
setting the uniform to point to each layer in turn.

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agomesa: Track number of layers in layered framebuffers.
Paul Berry [Tue, 19 Nov 2013 23:55:51 +0000 (15:55 -0800)]
mesa: Track number of layers in layered framebuffers.

In order to properly clear layered framebuffers, we need to know how
many layers they have.  The easiest way to do this is to record it in
the gl_framebuffer struct when we check framebuffer completeness.

This patch replaces the gl_framebuffer::Layered boolean with a
gl_framebuffer::NumLayers integer, which is 0 if the framebuffer is
not layered, and equal to the number of layers otherwise.

v2: Remove gl_framebuffer::Layered and make gl_framebuffer::NumLayers
always have a defined value.  Fix factor of 6 error in the number of
layers in a cube map array.

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agonvc0: inform kernel about buffers that screen_create touches
Ben Skeggs [Fri, 22 Nov 2013 01:34:13 +0000 (11:34 +1000)]
nvc0: inform kernel about buffers that screen_create touches

Prevents a GPU page fault if somehow the uniform bo gets evicted
before the screen_create pushbuf has been submitted.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agoradeonsi/compute: Fix LDS size calculation
Tom Stellard [Thu, 22 Aug 2013 15:22:58 +0000 (11:22 -0400)]
radeonsi/compute: Fix LDS size calculation

We need to include the number of LDS bytes allocated by the state tracker.

CC: "10.0" <mesa-stable@lists.freedesktop.org>
10 years agor600g/compute: Add a work-around for flushing issues on Cayman
Tom Stellard [Wed, 20 Nov 2013 03:05:52 +0000 (22:05 -0500)]
r600g/compute: Add a work-around for flushing issues on Cayman

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
https://bugs.freedesktop.org/show_bug.cgi?id=69321

CC: "10.0" <mesa-stable@lists.freedesktop.org>
10 years agoglsl: Fix interstage uniform interface block link error detection.
Paul Berry [Fri, 15 Nov 2013 22:23:45 +0000 (14:23 -0800)]
glsl: Fix interstage uniform interface block link error detection.

Previously, we checked for interstage uniform interface block link
errors in validate_interstage_interface_blocks(), which is only called
on pairs of adjacent shader stages.  Therefore, we failed to detect
uniform interface block mismatches between non-adjacent shader stages.

Before the introduction of geometry shaders, this wasn't a problem,
because the only supported shader stages were vertex and fragment
shaders, therefore they were always adjacent.  However, now that we
allow a program to contain vertex, geometry, and fragment shaders,
that is no longer the case.

Fixes piglit test "skip-stage-uniform-block-array-size-mismatch".

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
v2: Rename validate_interstage_interface_blocks() to
validate_interstage_inout_blocks() to reflect the fact that it no
longer validates uniform blocks.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
v3: Make validate_interstage_inout_blocks() skip uniform blocks.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Fix cross-version linking between VS and GS.
Paul Berry [Wed, 20 Nov 2013 01:48:02 +0000 (17:48 -0800)]
glsl: Fix cross-version linking between VS and GS.

Previously, when attempting to link a vertex shader and a geometry
shader that use different GLSL versions, we would sometimes generate a
link error due to the implicit declaration of gl_PerVertex being
different between the two GLSL versions.

This patch fixes that problem by only requiring interface block
definitions to match when they are explicitly declared.

Fixes piglit test "shaders/version-mixing vs-gs".

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
v2: In the interface_block_definition constructor, move the assignment
to explicitly_declared after the existing if block.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Prohibit illegal mixing of redeclarations inside/outside gl_PerVertex.
Paul Berry [Thu, 14 Nov 2013 00:53:18 +0000 (16:53 -0800)]
glsl: Prohibit illegal mixing of redeclarations inside/outside gl_PerVertex.

From section 7.1 (Built-In Language Variables) of the GLSL 4.10
spec:

    Also, if a built-in interface block is redeclared, no member of
    the built-in declaration can be redeclared outside the block
    redeclaration.

We have been regarding this text as a clarification to the behaviour
established for gl_PerVertex by GLSL 1.50, so we apply it regardless
of GLSL version.

This patch enforces the rule by adding an enum to ir_variable to track
how the variable was declared: implicitly, normally, or in an
interface block.

Fixes piglit tests:
- gs-redeclares-pervertex-out-after-global-redeclaration.geom
- vs-redeclares-pervertex-out-after-global-redeclaration.vert
- gs-redeclares-pervertex-out-after-other-global-redeclaration.geom
- vs-redeclares-pervertex-out-after-other-global-redeclaration.vert
- gs-redeclares-pervertex-out-before-global-redeclaration
- vs-redeclares-pervertex-out-before-global-redeclaration

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
v2: Don't set "how_declared" redundantly in builtin_variables.cpp.
Properly clone "how_declared".

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Enable the AMD_performance_monitor extension on Gen5+.
Kenneth Graunke [Wed, 13 Nov 2013 23:42:57 +0000 (15:42 -0800)]
i965: Enable the AMD_performance_monitor extension on Gen5+.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Take "bookend" OA snapshots at the start/end of each batch.
Kenneth Graunke [Wed, 13 Nov 2013 23:36:29 +0000 (15:36 -0800)]
i965: Take "bookend" OA snapshots at the start/end of each batch.

Unfortunately, our hardware only has one set of aggregating performance
counters shared between all 3D programs, and their values are not saved
or restored by hardware contexts.  Also, at least on Sandybridge and
Ivybridge, the counters lose their values if the GPU goes to sleep.

To work around both of these problems, we have to snapshot the
performance counters at the beginning and end of each batch, similar to
how we handle query objects on platforms that don't support hardware
contexts.  I call these "bookend" snapshots.

Since there can be multiple performance monitors active at a time, we
store the bookend snapshots in a global BO, shared by all monitors.

For monitors that span multiple batches, acquiring results involves
adding up three segments:

   BeginPerfMonitor   --> End of Batch 1    ("head")
   Start of Batch 2   --> End of Batch 2
                      ...                   ("middle")
   Start of Batch N-1 --> End of Batch N-1
   Start of Batch N   --> EndPerfMonitor    ("tail")

Monitors that refer to bookend BO snapshots are considered "unresolved".
We delay resolving them (and adding up deltas to obtain the results) as
long as possible to avoid blocking on mapping monitor->oa_bo.

We can also run out of space in the bookend BO, at which point we have
to resolve all unresolved monitors.  Then we can throw away the
snapshots and begin writing at the beginning of the buffer.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Reserve batchbuffer space for a closing MI_REPORT_PERF_COUNT.
Kenneth Graunke [Tue, 22 Oct 2013 18:21:43 +0000 (11:21 -0700)]
i965: Reserve batchbuffer space for a closing MI_REPORT_PERF_COUNT.

In order to use the Observability Architecture effectively, we'll need
to take snapshots of the OA counters via MI_REPORT_PERF_COUNT at the
start and end of each batch.

Experimentation reveals that we need to flush before and after each
MI_REPORT_PERF_COUNT to get working values.  For simplicitly, I chose to
use intel_batchbuffer_emit_mi_flush(), which unfortunately expands to
triple pipe controls on Sandybridge.

We may want to start computing per-generation reserved batch space to
avoid the insanity of Sandybridge's PIPE_CONTROL cost.  That said, much
of this cost existed before I rewrote the query object support to use
hardware contexts, so it's at least not entirely new.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Add some plumbing for gathering OA results.
Kenneth Graunke [Wed, 13 Nov 2013 23:13:59 +0000 (15:13 -0800)]
i965: Add some plumbing for gathering OA results.

Currently, this only considers the monitor start and end snapshots.
This is woefully insufficient, but allows me to add a bunch of the
infrastructure now and flesh it out later.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Start and stop OA counters as necessary.
Kenneth Graunke [Sun, 3 Nov 2013 03:58:10 +0000 (20:58 -0700)]
i965: Start and stop OA counters as necessary.

We need to start OA at the beginning of each batch where monitors are
active.  OACONTROL isn't part of the hardware context, so to avoid
leaving counters enabled for other applications, we turn them off at the
end of the batch too.

We also need to start them at BeginPerfMonitor time (unless they've
already been started).  We stop them when the monitor last ends as well.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Add functions to start and stop the OA counters.
Kenneth Graunke [Wed, 13 Nov 2013 21:14:46 +0000 (13:14 -0800)]
i965: Add functions to start and stop the OA counters.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Add #defines for the OACONTROL register and fields.
Kenneth Graunke [Wed, 27 Mar 2013 21:46:05 +0000 (14:46 -0700)]
i965: Add #defines for the OACONTROL register and fields.

We'll need to write this register to start/stop performance counters.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>