platform/upstream/mesa.git
10 years agowinsys/radeon: only add duplicate relocations for DMA if VM isn't supported
Marek Olšák [Sun, 16 Mar 2014 16:17:58 +0000 (17:17 +0100)]
winsys/radeon: only add duplicate relocations for DMA if VM isn't supported

Also rewrite the comment for it to be readable and reorder the code.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agoradeonsi: Implement DMA blit
Niels Ole Salscheider [Mon, 17 Mar 2014 17:48:06 +0000 (18:48 +0100)]
radeonsi: Implement DMA blit

This code is a slightly modified version of evergreen_dma_blit (and
evergreen_dma_copy as well as evergreen_dma_copy_tile).
It would be nice to share some of the code in the long term.

I have reused some "cik"-prefixed functions that also return the right
value for SI. I am not sure if they should be renamed.

v2: Marek> removed gfx.flush in si_dma_copy_tile

Signed-off-by: Niels Ole Salscheider <niels_ole@salscheider-online.de>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
10 years agoradeon: Move r600_need_dma_space to common code
Niels Ole Salscheider [Mon, 17 Mar 2014 17:48:05 +0000 (18:48 +0100)]
radeon: Move r600_need_dma_space to common code

Signed-off-by: Niels Ole Salscheider <niels_ole@salscheider-online.de>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
10 years agollvmpipe: Tighten check for alpha-only formats
Richard Sandiford [Wed, 19 Mar 2014 17:12:38 +0000 (17:12 +0000)]
llvmpipe: Tighten check for alpha-only formats

The AoS version of ld_build_blend_factor was assuming that if the first
channel was alpha, there were no rgb components.

Fixes glean/blendFunc on System z.  No piglit regressions on x86_64.
The shortcut is still used in tests like spec/ARB_framebuffer_object/
fbo-alpha.

Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
10 years agonouveau: don't assume libdrm include prefix
Jonathan Gray [Thu, 20 Mar 2014 03:43:29 +0000 (14:43 +1100)]
nouveau: don't assume libdrm include prefix

drm headers may be installed in a different directory

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonouveau: use DLOPEN_LIBS instead of -ldl
Jonathan Gray [Thu, 20 Mar 2014 03:45:04 +0000 (14:45 +1100)]
nouveau: use DLOPEN_LIBS instead of -ldl

libdl does not exist on many platforms which have dlopen in libc.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agoc11/threads: don't include assert.h if the assert macro is already defined
Brian Paul [Tue, 18 Mar 2014 23:25:07 +0000 (17:25 -0600)]
c11/threads: don't include assert.h if the assert macro is already defined

In the gallium code, the assert() macro could come from either the
system's assert.h file (via c11/threads.h) or from gallium's u_debug.h.
It looks like all known assert.h files unconditionally #undef assert
before defining their own version.  So the assert you get depends on
whether threads.h or u_debug.h was included last.

In the gallium code we really want to use the assert() from u_debug.h
(it behaves better on Windows).  In gallium, c11/threads.h is only
included after u_debug.h in the os_thread.h wrapper.  So Adding
an #ifndef assert test in the threads*.h files avoids using the system's
assert().

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agonouveau: there may not have been a texture if the fbo was incomplete
Ilia Mirkin [Mon, 17 Mar 2014 14:37:12 +0000 (10:37 -0400)]
nouveau: there may not have been a texture if the fbo was incomplete

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Cc: "10.0 10.1" <mesa-stable@lists.freedesktop.org>
10 years agonouveau: add forgotten GL_COMPRESSED_INTENSITY to texture format list
Ilia Mirkin [Thu, 13 Mar 2014 14:36:25 +0000 (10:36 -0400)]
nouveau: add forgotten GL_COMPRESSED_INTENSITY to texture format list

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Cc: "10.0 10.1" <mesa-stable@lists.freedesktop.org>
10 years agomesa/main: condition GL_DEPTH_STENCIL on ARB_depth_texture
Ilia Mirkin [Thu, 13 Mar 2014 11:01:15 +0000 (07:01 -0400)]
mesa/main: condition GL_DEPTH_STENCIL on ARB_depth_texture

EXT_packed_depth_stencil is supported by all drivers, but
ARB_depth_texture isn't (notably nouveau_vieux). This should avoid
passing unexpected values down to ChooseTextureFormat.

The EXT_packed_depth_stencil spec does not make any explicit references
to requiring ARB_depth_texture in order to allow textures with that
format, however if there is no dependency, ARB_depth_texture would be
practically implied by the extension.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "10.0 10.1" <mesa-stable@lists.freedesktop.org>
Note for 10.0 backport: This will produce a conflict, the solution is to
move the surrounding if as well.

10 years agoloader: add special logic to distinguish nouveau from nouveau_vieux
Ilia Mirkin [Mon, 17 Mar 2014 18:42:12 +0000 (14:42 -0400)]
loader: add special logic to distinguish nouveau from nouveau_vieux

There are a lot of different pci ids supported by nouveau, and more are
added all the time. The relevant distinguisher between drivers is the
chipset id.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agoglsl: Allow dot() on scalars, and throw out dotlike().
Matt Turner [Sun, 2 Mar 2014 18:34:45 +0000 (10:34 -0800)]
glsl: Allow dot() on scalars, and throw out dotlike().

In all uses of dotlike() we're writing generic code that operates on 1-4
component vectors. That our IR requires ir_binop_dot expressions'
operands to be 2+ component vectors is an implementation detail that's
not important when implementing built-in functions with dot(), which is
defined for scalar floats in GLSL.

Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglsl: Optimize pow(x, 2) into x * x.
Matt Turner [Fri, 28 Feb 2014 21:33:19 +0000 (13:33 -0800)]
glsl: Optimize pow(x, 2) into x * x.

Cuts two instructions out of SynMark's Gl32VSInstancing benchmark.

Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglsl: Match whitespace changes from previous patch.
Matt Turner [Tue, 18 Mar 2014 22:40:49 +0000 (15:40 -0700)]
glsl: Match whitespace changes from previous patch.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Expose pack/unpack built-ins for ARB_gpu_shader5.
Matt Turner [Tue, 11 Mar 2014 19:36:04 +0000 (12:36 -0700)]
glsl: Expose pack/unpack built-ins for ARB_gpu_shader5.

ARB_gpu_shader5 and ES 3.0 expose different subsets of
ARB_shading_language_packing.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Drop some more dead code from the old CACHED_BATCH feature.
Eric Anholt [Thu, 13 Mar 2014 23:53:09 +0000 (16:53 -0700)]
i965: Drop some more dead code from the old CACHED_BATCH feature.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Drop special case for edgeflag thanks to Marek's change to core.
Eric Anholt [Wed, 5 Mar 2014 01:26:54 +0000 (17:26 -0800)]
i965: Drop special case for edgeflag thanks to Marek's change to core.

As of 780ce576bb1781f027797039693b98253ee4813e, we end up with R8_SSCALED
anyway.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: include stdbool.h in register_allocate.h to fix build
Brian Paul [Tue, 18 Mar 2014 17:55:50 +0000 (11:55 -0600)]
mesa: include stdbool.h in register_allocate.h to fix build

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

10 years agoi965: Enable EWA anisotropic filtering algorithm
Ian Romanick [Tue, 4 Mar 2014 09:08:05 +0000 (11:08 +0200)]
i965: Enable EWA anisotropic filtering algorithm

Volume 4, part 1 of the Ivybridge PRM says, "Generally, the EWA
approximation algorithm results in higher image quality than the legacy
algorithm."  Using a classic anisotropic filtering "tunnel" demo, it
appears that there is *no* anisotropic filtering on IVB without this bit
set.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Actually initialize simd16_unsupported and no16_msg.
Kenneth Graunke [Tue, 18 Mar 2014 17:49:10 +0000 (10:49 -0700)]
i965: Actually initialize simd16_unsupported and no16_msg.

I meant to include this fixes in v3 of commit
de7ad2c88f4ec243c95eaed22c41d0e537912e01, but accidentally pushed a
previous version.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/upload: Refactor open-coded ALIGN-like computations.
Kenneth Graunke [Mon, 3 Mar 2014 07:09:20 +0000 (23:09 -0800)]
i965/upload: Refactor open-coded ALIGN-like computations.

Sadly, we can't use actual ALIGN(), since that only supports
power-of-two values for the alignment parameter.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Fix indentation in brw_upload_indices().
Kenneth Graunke [Mon, 3 Mar 2014 00:39:56 +0000 (16:39 -0800)]
i965: Fix indentation in brw_upload_indices().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Consolidate code for setting brw->ib.start_vertex_offset.
Kenneth Graunke [Sun, 2 Mar 2014 23:02:54 +0000 (15:02 -0800)]
i965: Consolidate code for setting brw->ib.start_vertex_offset.

This was set identically in three places.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Allocate register sets at screen creation, not context creation.
Kenneth Graunke [Mon, 17 Mar 2014 20:53:44 +0000 (13:53 -0700)]
i965: Allocate register sets at screen creation, not context creation.

Register sets depend on the particular hardware generation, but don't
depend on anything in the actual OpenGL context.  Computing them is
fairly expensive, and they take up a large amount of memory.  Putting
them in the screen allows us to compute/allocate them once for all
contexts, saving both time and space.

Improves the performance of a context creation/destruction
microbenchmark by about 3x on my Haswell i7-4750HQ.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Allocate the screen using ralloc rather than calloc.
Kenneth Graunke [Mon, 17 Mar 2014 20:57:14 +0000 (13:57 -0700)]
i965: Allocate the screen using ralloc rather than calloc.

This will allow us to use the screen as a memory context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agora: Convert another bool array to bitsets.
Eric Anholt [Mon, 17 Mar 2014 21:53:08 +0000 (14:53 -0700)]
ra: Convert another bool array to bitsets.

This one saves about 2MB peak allocation in glsl-fs-algebraic-add-add-1,
with no performance difference on timing short shader-db runs (n=9/10,
warmup outlier removed).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agora: Use a bitset for storing which registers belong to a class.
Kenneth Graunke [Sat, 22 Feb 2014 03:50:15 +0000 (19:50 -0800)]
ra: Use a bitset for storing which registers belong to a class.

This should use 1/8 the memory.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Christoph Brill <egore911@gmail.com>
10 years agora: Create a reg_belongs_to_class() helper function.
Kenneth Graunke [Sat, 22 Feb 2014 03:31:44 +0000 (19:31 -0800)]
ra: Create a reg_belongs_to_class() helper function.

This is a little easier to read.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Christoph Brill <egore911@gmail.com>
10 years agora: Use bool instead of GLboolean.
Kenneth Graunke [Sat, 22 Feb 2014 03:32:24 +0000 (19:32 -0800)]
ra: Use bool instead of GLboolean.

This isn't the GL API, so there's no reason to use GLboolean.

Using bool is safer: any non-zero value is treated as "true".  When
converting a value to a GLboolean, all but the low byte is discarded,
which means that values like 256 will be incorrectly rendered as false.

Done via the following vim commands:
:%s/GLboolean/bool/g
:%s/GL_TRUE/true/g
:%s/GL_FALSE/false/g
and one line of manual whitespace tidying.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agoi965: Accurately bail on SIMD16 compiles.
Kenneth Graunke [Fri, 7 Mar 2014 08:49:45 +0000 (00:49 -0800)]
i965: Accurately bail on SIMD16 compiles.

Ideally, we'd like to never even attempt the SIMD16 compile if we could
know ahead of time that it won't succeed---it's purely a waste of time.
This is especially important for state-based recompiles, which happen at
draw time.

The fragment shader compiler has a number of checks like:

   if (dispatch_width == 16)
      fail("...some reason...");

This patch introduces a new no16() function which replaces the above
pattern.  In the SIMD8 compile, it sets a "SIMD16 will never work" flag.
Then, brw_wm_fs_emit can check that flag, skip the SIMD16 compile, and
issue a helpful performance warning if INTEL_DEBUG=perf is set.  (In
SIMD16 mode, no16() calls fail(), for safety's sake.)

The great part is that this is not a heuristic---if the flag is set, we
know with 100% certainty that the SIMD16 compile would fail.  (It might
fail anyway if we run out of registers, but it's always worth trying.)

v2: Fix missing va_end in early-return case (caught by Ilia Mirkin).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz> [v1]
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Support pull parameters in SIMD16 mode.
Kenneth Graunke [Sat, 8 Mar 2014 00:10:50 +0000 (16:10 -0800)]
i965/fs: Support pull parameters in SIMD16 mode.

This is just a matter of reusing the pull/push constant information set
up by the SIMD8 compile.

This gains us 78 SIMD16 programs in shader-db.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Use a single instance of the pull_constant_loc[] array.
Kenneth Graunke [Wed, 12 Mar 2014 05:24:39 +0000 (22:24 -0700)]
i965/fs: Use a single instance of the pull_constant_loc[] array.

Now that we don't renumber uniform registers, assign_constant_locations
and move_uniform_array_access_to_pull_constants use the same names.
So, they can share a single copy of the pull_constant_loc[] array.

This simplifies the code considerably.  assign_constant_locations()
doesn't need to walk through pull_params[] to rediscover reladdr
demotions; it just has that information in pull_constant_loc[].  We also
only need to rewrite the instruction stream once, instead of twice.

Even better, we now have a single array describing the layout of
all pull parameters, which we can pass to the SIMD16 program.

This actually hurts a few shaders in Serious Sam 3, and one in KWin:
total instructions in shared programs: 1841957 -> 1842035 (0.00%)
instructions in affected programs:     1165 -> 1243 (6.70%)
Comparing dump_instructions() before and after the pull constant
transformations with and without this patch, it appears that there is
a uniform array with variable indexing (reladdr) and constant indexing
(of array element 0).  Previously, we uploaded array element 0 as both
a pull constant (for reladdr) /and/ a push constant.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Don't renumber UNIFORM registers.
Kenneth Graunke [Tue, 11 Mar 2014 21:35:27 +0000 (14:35 -0700)]
i965/fs: Don't renumber UNIFORM registers.

Previously, remove_dead_constants() would renumber the UNIFORM registers
to be sequential starting from zero, and the resulting register number
would be used directly as an index into the params[] array.

This renumbering made it difficult to collect and save information about
pull constant locations, since setup_pull_constants() and
move_uniform_array_access_to_pull_constants() used different names.

This patch generalizes setup_pull_constants() to decide whether each
uniform register should be a pull constant, push constant, or neither
(because it's unused).  Then, it stores mappings from UNIFORM register
numbers to params[] or pull_params[] indices in the push_constant_loc
and pull_constant_loc arrays.  (We already did this for pull constants.)

Then, assign_curb_setup() just needs to consult the push_constant_loc
array to get the real index into the params[] array.

This effectively folds all the remove_dead_constants() functionality
into assign_constant_locations(), while being less irritable to work
with.

v2: Add assert(remapped <= i), requested by Topi.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Split pull parameter decision making from mechanical demoting.
Kenneth Graunke [Mon, 10 Mar 2014 20:14:03 +0000 (13:14 -0700)]
i965/fs: Split pull parameter decision making from mechanical demoting.

move_uniform_array_access_to_pull_constants() and setup_pull_constants()
both have two parts:

1. Decide which UNIFORM registers to demote to pull constants, and
   assign locations.
2. Mechanically rewrite the instruction stream to pull the uniform
   value into a temporary VGRF and use that, eliminating the UNIFORM
   file access.

In order to support pull constants in SIMD16 mode, we will need to make
decisions exactly once, but rewrite both instruction streams.
Separating these two tasks will make this easier.

This patch introduces a new helper, demote_pull_constants(), which
takes care of rewriting the instruction stream, in both cases.

For the moment, a single invocation of demote_pull_constants can't
safely handle both reladdr and non-reladdr tasks, since the two callers
still use different names for uniforms due to remove_dead_constants()
remapping of things.  So, we get an ugly boolean parameter saying
which to do.  This will go away.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Record pull constant locations for all array elements.
Kenneth Graunke [Fri, 7 Mar 2014 23:45:13 +0000 (15:45 -0800)]
i965/fs: Record pull constant locations for all array elements.

When demoting a variably indexed uniform array to pull constants, we
only recorded the location for the base of the array (element 0).

Recording locations for all array elements is a trivial amount of code
and will make subsequent refactoring easier.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Save push constant location information.
Kenneth Graunke [Fri, 7 Mar 2014 10:10:14 +0000 (02:10 -0800)]
i965/fs: Save push constant location information.

Previously, both move_uniform_array_access_to_pull_constants() and
setup_pull_constants() maintained stack-local arrays with this
information.  Storing this information will allow it to be used from
multiple functions, allowing us to split and move code around.

We'll also eventually want to pass pull constant location information
to the SIMD16 compile.  Saving this information will help us do that.

Unfortunately, the two functions *cannot* share the contents of the
array just yet.  remove_dead_constants() renumbers all the UNIFORM
registers to be contiguous starting at zero, so the two functions
talk about uniforms using different names.  We can't even remap them,
since move_uniform_array_access_to_pull_constants() deletes UNIFORM
registers that are only accessed with reladdr, so remove_dead_constants
can't even see them.

This situation will improve in the next few patches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Delete dead code to fail compiles with SIMD16 pull parameters.
Kenneth Graunke [Tue, 11 Mar 2014 06:22:48 +0000 (23:22 -0700)]
i965/fs: Delete dead code to fail compiles with SIMD16 pull parameters.

The SIMD8 compile will determine whether pull parameters are necessary.
If so, it will set prog_data->nr_pull_params to a value greater than 0.

brw_wm_fs_emit checks if nr_pull_params > 0 and skips the SIMD16 compile
altogether.  So, this code should never occur.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agogallium/docs: update SLT, SGE, SFL, STR opcode docs
Brian Paul [Mon, 17 Mar 2014 21:13:55 +0000 (15:13 -0600)]
gallium/docs: update SLT, SGE, SFL, STR opcode docs

To emphasize that the result is floating point 1.0 or 0.0, to match
other opcodes like SLE and SEQ.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agoglx: Fix incorrect pdp assignment in dri2_bind_context().
Charmaine Lee [Thu, 13 Mar 2014 17:33:00 +0000 (11:33 -0600)]
glx: Fix incorrect pdp assignment in dri2_bind_context().

pdp should be set to dpyPriv->dri2Display.
Fixes blank frame failure running glretrace ClearView.

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agonvc0: Handle user mapped vertex buffer for edgeflag
Maarten Lankhorst [Tue, 18 Mar 2014 13:47:40 +0000 (14:47 +0100)]
nvc0: Handle user mapped vertex buffer for edgeflag

Handle mapping edgeflag data similar to the code around it.
This fixes a crash in piglit test gl-2.0-edgeflag.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agoclover: Fix region size error checking in some buffer transfer commands.
Francisco Jerez [Fri, 14 Mar 2014 10:31:11 +0000 (11:31 +0100)]
clover: Fix region size error checking in some buffer transfer commands.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
10 years agonv50/ir/gk110: add postfactor support for fmul
Ilia Mirkin [Sat, 15 Mar 2014 16:42:51 +0000 (12:42 -0400)]
nv50/ir/gk110: add postfactor support for fmul

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: set not modifier on first source of logic op
Ilia Mirkin [Sat, 15 Mar 2014 14:22:22 +0000 (10:22 -0400)]
nv50/ir/gk110: set not modifier on first source of logic op

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: use shl/shr instead of lshf/rshf so that c[] is supported
Ilia Mirkin [Fri, 14 Mar 2014 12:16:00 +0000 (08:16 -0400)]
nv50/ir/gk110: use shl/shr instead of lshf/rshf so that c[] is supported

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: add 64/128-bit fetch/export support
Ilia Mirkin [Fri, 14 Mar 2014 10:20:36 +0000 (06:20 -0400)]
nv50/ir/gk110: add 64/128-bit fetch/export support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: fix handling of OP_SUB for floating point ops
Ilia Mirkin [Fri, 14 Mar 2014 10:11:37 +0000 (06:11 -0400)]
nv50/ir/gk110: fix handling of OP_SUB for floating point ops

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: presin/preex2 take their source at bit 23
Ilia Mirkin [Fri, 14 Mar 2014 09:46:14 +0000 (05:46 -0400)]
nv50/ir/gk110: presin/preex2 take their source at bit 23

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: add implementations of div u32/s32
Ilia Mirkin [Wed, 12 Mar 2014 16:00:58 +0000 (12:00 -0400)]
nv50/ir/gk110: add implementations of div u32/s32

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: implement quadop
Ilia Mirkin [Wed, 12 Mar 2014 13:33:00 +0000 (09:33 -0400)]
nv50/ir/gk110: implement quadop

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: fill in mov from predicate
Ilia Mirkin [Tue, 11 Mar 2014 18:54:25 +0000 (14:54 -0400)]
nv50/ir/gk110: fill in mov from predicate

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: handle derivAll flag, fix useOffsets for non-txf
Ilia Mirkin [Tue, 11 Mar 2014 17:03:02 +0000 (13:03 -0400)]
nv50/ir/gk110: handle derivAll flag, fix useOffsets for non-txf

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: fix setting texture for txd/txf/txq
Ilia Mirkin [Tue, 11 Mar 2014 16:13:45 +0000 (12:13 -0400)]
nv50/ir/gk110: fix setting texture for txd/txf/txq

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: add texcsaa implementation
Ilia Mirkin [Tue, 11 Mar 2014 15:21:35 +0000 (11:21 -0400)]
nv50/ir/gk110: add texcsaa implementation

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: add pfetch support
Ilia Mirkin [Tue, 11 Mar 2014 14:48:15 +0000 (10:48 -0400)]
nv50/ir/gk110: add pfetch support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: add emit/restart implementations
Ilia Mirkin [Tue, 11 Mar 2014 14:25:29 +0000 (10:25 -0400)]
nv50/ir/gk110: add emit/restart implementations

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: add missing break in sched emit
Ilia Mirkin [Tue, 11 Mar 2014 13:38:38 +0000 (09:38 -0400)]
nv50/ir/gk110: add missing break in sched emit

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: implement partial txq support
Ilia Mirkin [Tue, 11 Mar 2014 12:30:49 +0000 (08:30 -0400)]
nv50/ir/gk110: implement partial txq support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: fill out texture instruction support
Ilia Mirkin [Tue, 11 Mar 2014 12:30:01 +0000 (08:30 -0400)]
nv50/ir/gk110: fill out texture instruction support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: fix control flow opcode emission, add sat flag
Ilia Mirkin [Tue, 11 Mar 2014 09:44:00 +0000 (05:44 -0400)]
nv50/ir/gk110: fix control flow opcode emission, add sat flag

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agoegl/main: Enable Linux platform extensions
Chad Versace [Thu, 23 Jan 2014 15:26:10 +0000 (07:26 -0800)]
egl/main: Enable Linux platform extensions

Enable EGL_EXT_platform_base and the Linux platform extensions layered
atop it: EGL_EXT_platform_x11, EGL_EXT_platform_wayland,
and EGL_MESA_platform_gbm.

Tested with Piglit's EGL_EXT_platform_base tests under an X11 session.
To enable running the Wayland and GBM tests, windowed Weston was running
and the kernel had render nodes enabled.

I regression tested my EGL_EXT_platform_base patch set with Piglit on
Ivybridge under X11/EGL, standalone Weston, and GBM with rendernodes. No
regressions found.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/wayland: Emit EGL_BAD_PARAMETER for eglCreatePlatformPixmapSurface
Chad Versace [Sun, 9 Feb 2014 17:13:27 +0000 (09:13 -0800)]
egl/wayland: Emit EGL_BAD_PARAMETER for eglCreatePlatformPixmapSurface

From the EGL_EXT_wayland_spec, version 3:

  It is not valid to call eglCreatePlatformPixmapSurfaceEXT with a <dpy>
  that belongs to Wayland. Any such call fails and generates
  EGL_BAD_PARAMETER.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/gbm: Emit EGL_BAD_PARAMETER for eglCreatePlatformPixmapSurface
Chad Versace [Sun, 9 Feb 2014 17:13:08 +0000 (09:13 -0800)]
egl/gbm: Emit EGL_BAD_PARAMETER for eglCreatePlatformPixmapSurface

From the EGL_MESA_platform_gbm spec, version 5:

  It is not valid to call eglCreatePlatformPixmapSurfaceEXT with a <dpy>
  that belongs to the GBM platform. Any such call fails and generates
  EGL_BAD_PARAMETER.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/main: Stop using EGLNative types internally
Chad Versace [Tue, 7 Jan 2014 22:54:51 +0000 (14:54 -0800)]
egl/main: Stop using EGLNative types internally

Internally, much of the EGL code uses EGLNativeDisplayType,
EGLNativeWindowType, and EGLPixmapType. However, the EGLNative type
often does not match the variable's actual type.

The concept of EGLNative types are a bad match for Linux, as explained
below. And the EGL platform extensions don't use EGLNative types at all.
Those extensions attempt to solve cross-platform issues by moving the
EGL API away from the EGLNative types.

The core of the problem is that eglplatform.h can define each EGLNative
type once only, but Linux supports multiple EGL platforms.

To work around the problem, Mesa's eglplatform.h contains multiple
definitions of each EGLNative type, selected by feature macros. Mesa
expects EGL clients to set the feature macro approrpiately. But the
feature macros don't work when a single codebase must be built with
support for multiple EGL platforms, *such as Mesa itself*.

When building libEGL, autotools chooses the EGLNative typedefs based on
the first element of '--with-egl-platforms'. For example,
'--with-egl-platforms=x11,drm,wayland' defines the following:

    typedef Display* EGLNativeDisplayType;
    typedef Window   EGLNativeWindowType;
    typedef Pixmap   EGLNativePixmapType;

Clearly, this doesn't work well for Wayland and GBM.  Mesa works around
the problem by casting the EGLNative types to different things in
different files.

For sanity's sake, and to prepare for the EGL platform extensions, this
patch removes from egl/main and egl/dri2 all internal use of the
EGLNative types. It replaces them with 'void*' and checks each explicit
cast with a static assertion. Also, the patch touches egl_gallium the
minimal amount to keep it compatible with eglapi.h.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl: Add STATIC_ASSERT() macro
Chad Versace [Tue, 7 Jan 2014 22:23:49 +0000 (14:23 -0800)]
egl: Add STATIC_ASSERT() macro

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglCreateImageKHR by display, not driver
Chad Versace [Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)]
egl/dri2: Dispatch eglCreateImageKHR by display, not driver

Add dri2_egl_display_vtbl::create_image, set it for each platform, and
let egl_dri2 dispatch eglCreateImageKHR to that.

To remove ambiguity, rename egl_dri2.c:dri2_create_image() to
dri2_create_image_from_dri().

This prepares for the EGL platform extensions.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2/x11: Don't clobber _EGLDriver::API
Chad Versace [Wed, 29 Jan 2014 03:38:39 +0000 (19:38 -0800)]
egl/dri2/x11: Don't clobber _EGLDriver::API

dri2_initialize_x11_swrast() does a strange thing. For some extensions
it doesn't support, it sets the corresponding functions in
_EGLDriver::API to NULL. The intention here is clear, but misplaced.

NULL or not, the function pointers never get called because their
extensions aren't supported.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglCreateWaylandBufferFromImageWL by display, not driver
Chad Versace [Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)]
egl/dri2: Dispatch eglCreateWaylandBufferFromImageWL by display, not driver

Add dri2_egl_display_vtbl::create_wayland_buffer_from_image, set it for
each platform, and let egl_dri2 dispatch
eglCreateWaylandBufferFromImageWL to that.

This prepares for the EGL platform extensions.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Consolidate eglTerminate
Chad Versace [Wed, 29 Jan 2014 02:53:56 +0000 (18:53 -0800)]
egl/dri2: Consolidate eglTerminate

egl_dri2.c:dri2_terminate() handled terminating X11 and DRM displays.
The Wayland platform implemented its own dri2_wl_terminate(), which was
nearly a copy of the common one.

To implement the EGL platform extensions, we either need to dispatch
eglTerminate per display or define a common implementation for all
platforms. This patch chooses consolidation.  It removes
dri2_wl_terminate() by folding it into the common dri2_terminate().

It was necessary to invert the `if (disp->PlatformDisplay == NULL)` and
the switch statement because, unlike DRM and X11, Wayland's terminator
performed action even when EGL didn't own the native display. In the
inversion, I replaced `disp->PlatformDisplay == NULL` with
`dri2_dpy->own_device` because the two expressions are synonymous, but
the latter's meaning is clearer.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2/x11: Set dri2_dpy->own_device
Chad Versace [Wed, 29 Jan 2014 02:52:00 +0000 (18:52 -0800)]
egl/dri2/x11: Set dri2_dpy->own_device

When the user calls eglGetDisplay(EGL_DEFAULT_DISPLAY), the Wayland and
DRM platforms set dri2_dpy->own_device=true. This patch makes the X11
platform do the same for consistency.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglPostSubBufferNV by display, not driver
Chad Versace [Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)]
egl/dri2: Dispatch eglPostSubBufferNV by display, not driver

Add dri2_egl_display_vtbl::post_sub_buffer, set it for each
platform, and let egl_dri2 dispatch eglPostSubBufferNV to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglSwapBuffersRegionNOK by display, not driver
Chad Versace [Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)]
egl/dri2: Dispatch eglSwapBuffersRegionNOK by display, not driver

Add dri2_egl_display_vtbl::swap_buffers_region, set it for each
platform, and let egl_dri2 dispatch eglSwapBuffersRegionNOK to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglCopyBuffers by display, not driver
Chad Versace [Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)]
egl/dri2: Dispatch eglCopyBuffers by display, not driver

Add dri2_egl_display_vtbl::copy_buffers, set it for each
platform, and let egl_dri2 dispatch eglCopyBuffers to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch API.QueryBufferAge by display, not driver
Chad Versace [Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)]
egl/dri2: Dispatch API.QueryBufferAge by display, not driver

Add dri2_egl_display_vtbl::query_buffer_age, set it for each
platform, and let egl_dri2 dispatch API.QueryBufferAge to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglDestroySurface by display, not driver
Chad Versace [Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)]
egl/dri2: Dispatch eglDestroySurface by display, not driver

Add dri2_egl_display_vtbl::destroy_surface, set it for each
platform, and let egl_dri2 dispatch eglDestroySurface to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglCreatePbufferSurface by display, not driver
Chad Versace [Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)]
egl/dri2: Dispatch eglCreatePbufferSurface by display, not driver

Add dri2_egl_display_vtbl::create_pbuffer_surface, set it for each
platform, and let egl_dri2 dispatch eglCreatePbufferSurface to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglCreatePixmapSurface by display, not driver
Chad Versace [Wed, 29 Jan 2014 00:45:07 +0000 (16:45 -0800)]
egl/dri2: Dispatch eglCreatePixmapSurface by display, not driver

Add dri2_egl_display_vtbl::create_pbuffer_surface, set it for each
platform, and let egl_dri2 dispatch eglCreatePixmapSurface to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglCreateWindowSurface by display, not driver
Chad Versace [Wed, 29 Jan 2014 00:39:09 +0000 (16:39 -0800)]
egl/dri2: Dispatch eglCreateWindowSurface by display, not driver

Add dri2_egl_display_vtbl::create_window_surface, set it for each
platform, and let egl_dri2 dispatch eglCreateWindowSurface to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglSwapBuffersWithDamage by display, not driver
Chad Versace [Wed, 29 Jan 2014 00:26:44 +0000 (16:26 -0800)]
egl/dri2: Dispatch eglSwapBuffersWithDamage by display, not driver

Add dri2_egl_display_vtbl::swap_buffers_with_damage, set it for each
platform, and let egl_dri2 dispatch eglSwapBuffersWithDamageEXT to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglSwapBuffers by display, not driver
Chad Versace [Wed, 29 Jan 2014 00:21:21 +0000 (16:21 -0800)]
egl/dri2: Dispatch eglSwapBuffers  by display, not driver

Add dri2_egl_display_vtbl::swap_buffers, set it for each platform, and
let egl_dri2 dispatch eglSwapBuffers to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglSwapInterval by display, not driver
Chad Versace [Tue, 28 Jan 2014 20:34:19 +0000 (12:34 -0800)]
egl/dri2: Dispatch eglSwapInterval by display, not driver

Add dri2_egl_display_vtbl::swap_interval, set it for each platform, and
let egl_dri2 dispatch eglSwapInterval to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/wl,x11: Call dri2_swap_interval() statically
Chad Versace [Tue, 28 Jan 2014 00:42:10 +0000 (16:42 -0800)]
egl/wl,x11: Call dri2_swap_interval() statically

Don't call it through the driver dispatch table. Just call it
statically.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Put platform func names into proper namespaces
Chad Versace [Tue, 28 Jan 2014 20:47:38 +0000 (12:47 -0800)]
egl/dri2: Put platform func names into proper namespaces

Each of the egl_dri2 platforms (except Android) prefix their function
names with "dri2", not "dri2_${platform}". This means many function
names have three separate definitions in the egl_dri2 directory: one in
each of platform_drm.c, platform_wayland.c, and platform_x11.c. For
example, each of the three files defines dri2_create_window_surface().

The name collisions make it difficult to review patches for correctness
("Is this patch hunk calling a platform_x11 function or a global
egl_dri2 function?"), complicate debugging, and confuse code navigation
tools.

For each function in platform_x11.c prefixed with 'dri2', this patch
changes its prefix to 'dri2_x11'. Likewise for platform_drm.c and
'dri2_drm'; and platform_wayland.c and 'dri2_wl'.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Move dri2_egl_display virtual funcs to vtbl
Chad Versace [Tue, 28 Jan 2014 19:41:46 +0000 (11:41 -0800)]
egl/dri2: Move dri2_egl_display virtual funcs to vtbl

dri2_egl_display has only one virtual function, 'authenticate'.  Define
dri2_egl_display::vtbl and move 'authenticate' there.

This prepares for the EGL platform extensions, which will add many
more virtual functions to dri2_egl_display.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl: Update to revision 24567 of eglext.h
Chad Versace [Tue, 7 Jan 2014 20:23:06 +0000 (12:23 -0800)]
egl: Update to revision 24567 of eglext.h

This pulls in EGL_EXT_platform_base, EGL_EXT_platform_wayland,
EGL_EXT_platform_x11, and EGL_MESA_platform_gbm.

This patch has a lot of churn because Khronos recently changed its
method of generating headers. Khronos now generates it headers from XML.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agowinsys/radeon: Store GPU virtual memory addresses of BOs in a hash table
Michel Dänzer [Thu, 13 Mar 2014 01:25:10 +0000 (10:25 +0900)]
winsys/radeon: Store GPU virtual memory addresses of BOs in a hash table

This allows retrieving the existing BO and incrementing its reference count,
instead of creating a separate winsys representation for it, when the kernel
reports that the BO was already assigned a virtual memory address.

This fixes problems with XWayland using radeonsi and the
xf86-video-wlglamor driver, which calls GEM flink outside of the radeon
winsys code and creates BOs from the flinked names using the same DRM file
descriptor.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agotargets/dri-ilo: make the driver installable
Chia-I Wu [Sat, 15 Mar 2014 15:18:35 +0000 (23:18 +0800)]
targets/dri-ilo: make the driver installable

install-gallium-links.mk fails to create the compat link for ilo_dri.so
because it looks for dri_LTLIBRARIES instead of noinst_LTLIBRARIES.  Fix this
by switching to dri_LTLIBRARIES (and make the driver installable).

Since pci_id_driver_map.h and the DDX both tell libGL.so to look for "i965",
ilo_dri.so will never be loaded even enabled and installed.  The change should
not create any more confusion.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agomesa: mark GL_RGB9_E5 as not color-renderable
Marek Olšák [Sun, 9 Mar 2014 13:18:45 +0000 (14:18 +0100)]
mesa: mark GL_RGB9_E5 as not color-renderable

The GL 4.4 spec says it's not color-renderable and not accepted
by RenderBufferStorage. The EXT_texture_shared_exponent spec says
it's not color-renderable but it's accepted by RenderBufferStorageEXT.
This seems to be a bug in the extension spec.

Let's do what GL 4.4 says.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoradeonsi/compute: Fix memory leak
Aaron Watry [Wed, 12 Mar 2014 18:26:10 +0000 (13:26 -0500)]
radeonsi/compute: Fix memory leak

Free shader buffer object for all kernels when deleting compute state.

Signed-off-by: Aaron Watry <awatry@gmail.com>
10 years agost/mesa: remove _NEW_POLYGON dependency from vertex shader
Marek Olšák [Tue, 4 Mar 2014 00:45:48 +0000 (01:45 +0100)]
st/mesa: remove _NEW_POLYGON dependency from vertex shader

We can just check the polygon mode when updating the edge flag state.
Also, we can just flag ST_NEW_VERTEX_PROGRAM directly, which makes
ST_NEW_EDGEFLAGS_DATA useless.

10 years agost/mesa: implement zero-stride edge flag by culling primitives
Marek Olšák [Tue, 4 Mar 2014 00:11:49 +0000 (01:11 +0100)]
st/mesa: implement zero-stride edge flag by culling primitives

This was unimplemented.

10 years agost/mesa: fix per-vertex edge flags and GLSL support (v2)
Marek Olšák [Mon, 3 Mar 2014 00:04:22 +0000 (01:04 +0100)]
st/mesa: fix per-vertex edge flags and GLSL support (v2)

This fixes piglit/gl-2.0-edgeflag.

v2: use StrideB to recognize per-vertex edge flags

Cc: mesa-stable@lists.freedesktop.org
10 years agoi965/fs: Invalidate live intervals when demoting uniforms to pull params.
Kenneth Graunke [Tue, 11 Mar 2014 06:55:21 +0000 (23:55 -0700)]
i965/fs: Invalidate live intervals when demoting uniforms to pull params.

Normally, nothing uses live intervals at this point, so this isn't
necessary.  However, dump_instructions() calculates them and uses them
to show register pressure.  So, calling dump_instructions() in this area
of the code would segfault due to the arrays being the wrong size.

This is not a candidate for stable branches because it only serves to
fix internal debugging code that you manually have to invoke by altering
the source code or using gdb.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965/fs: Print "+reladdr" on variably-indexed uniform arrays.
Kenneth Graunke [Tue, 11 Mar 2014 07:11:42 +0000 (00:11 -0700)]
i965/fs: Print "+reladdr" on variably-indexed uniform arrays.

Previously, dump_instruction() would print output such as:
   {  2}    3: mov vgrf1:F, u0:F
   {  3}    4: mov vgrf7:F, u0:F
   {  4}    5: mov vgrf8:F, u0:F
which looked like either a scalar access or perhaps a constant-indexed
access of element 0, when it was really a variable index.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Fix register types in dump_instructions(), again.
Kenneth Graunke [Tue, 11 Mar 2014 07:04:35 +0000 (00:04 -0700)]
i965: Fix register types in dump_instructions(), again.

In commit e57d77280efcbfd6579a88f071426653287ef833, I fixed this for
destinations in the Vec4 backend, and sources in the scalar backend.
But not both types in both backends.

To prevent this mess from continuing, make the reg_encoding table
static, so only the disassembler can use it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965/fs: Fix register comparisons in saturate propagation.
Kenneth Graunke [Wed, 12 Mar 2014 00:11:36 +0000 (17:11 -0700)]
i965/fs: Fix register comparisons in saturate propagation.

opt_saturate_propagation_local compares scan_inst->dst.reg/reg_offset
with inst->src[0].reg/reg_offset, and ensures that scan_inst->dst.file
is GRF.  But nothing ensured that inst->src[0].file was GRF.

In the following program, this resulted in u1:F matching vgrf1:UW,
and a saturate being incorrectly propagated from instruction 8 to
instruction 1.

{  1}    0: add vgrf0:UW, hw_reg1+8:UW, hw_reg0:V
{  1}    1: add vgrf1:UW, hw_reg1+10:UW, hw_reg0:V
{  1}    2: linterp vgrf6:F, hw_reg2:F, hw_reg3:F, hw_reg0:F
{  2}    3: linterp vgrf27:F, hw_reg2:F, hw_reg3:F, hw_reg0+16:F
{  4}    4: mov vgrf10+0.0:F, vgrf6:F
{  3}    5: mov vgrf10+1.0:F, vgrf27:F
{  6}    6: tex vgrf8+0.0:F, vgrf10+0.0:F
{  5}    7: mov vgrf32:F, u1:F
{  5}    8: mov.sat vgrf12:F, u1:F

From shader-db:
   total instructions in shared programs: 1841932 -> 1841957 (0.00%)
   instructions in affected programs:     5823 -> 5848 (0.43%)
I inspected two of the 25 hurt shaders, and concluded that they were
both hitting this bug, and not legitimately optimized.

This fixes bugs in Left 4 Dead 2 and Team Fortress 2, possibly among
others.  The optimization pass didn't exist in 10.0, so this is only
a candidate for 10.1.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Improve debug output and variable names for opt_dead_code_local.
Eric Anholt [Thu, 6 Mar 2014 07:03:42 +0000 (23:03 -0800)]
glsl: Improve debug output and variable names for opt_dead_code_local.

I know this code has confused others, and it confused me 3 years later,
too.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
10 years agoi965: Add support for GL_ARB_buffer_storage.
Eric Anholt [Tue, 25 Feb 2014 22:25:46 +0000 (14:25 -0800)]
i965: Add support for GL_ARB_buffer_storage.

It turns out we can allow COHERENT storage/mappings all the time,
regardless of LLC vs non-LLC.  It just means never using temporary
mappings to avoid GPU stalls, and on non-LLC we have to use the GTT intead
of CPU mappings.  If we were to use CPU maps on non-LLC (which might be
useful if apps end up using buffer_storage on PBO reads, to avoid WC read
slowness), those would be PERSISTENT but not COHERENT, but doing that
would require us driving the clflushes from userspace somehow.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Always use CPU mappings for BOs on LLC platforms.
Eric Anholt [Thu, 27 Feb 2014 18:05:39 +0000 (10:05 -0800)]
i965: Always use CPU mappings for BOs on LLC platforms.

It looks like there's no big difference for write-only workloads, but
using a CPU map means that if they happen to read without having set the
MAP_READ_BIT, they get 100x the performance for those reads.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Drop the system-memory temporary allocations for flush explicit.
Eric Anholt [Tue, 25 Feb 2014 19:50:44 +0000 (11:50 -0800)]
i965: Drop the system-memory temporary allocations for flush explicit.

While in expected usage patterns nobody will ever hit this path, doubling
our bandwidth used seems like a waste, and it cost us extra code too.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Switch mapping modes for non-explicit-flush blit-temporary maps.
Eric Anholt [Tue, 25 Feb 2014 20:15:31 +0000 (12:15 -0800)]
i965: Switch mapping modes for non-explicit-flush blit-temporary maps.

On LLC, it should always be better to use a cached mapping than the GTT.
On non-LLC, it seems pretty silly to try to optimize read performance for
the INVALIDATE_RANGE_BIT case.  This will make the buffer_storage logic
easier.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>