mesa.git
10 years agonouveau: dup fd before passing it to device
Ilia Mirkin [Thu, 19 Jun 2014 08:25:04 +0000 (04:25 -0400)]
nouveau: dup fd before passing it to device

nouveau screens are reused for the same device node. However in the
scenario where we create screen 1, screen 2, and then delete screen 1,
the surrounding code might also close the original device node. To
protect against this, dup the fd and use the dup'd fd in the
nouveau_device. Also tell the nouveau_device that it is the owner of the
fd so that it will be closed on destruction.

Also make sure to free the nouveau_device in case of any failure.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79823
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
10 years agomesa: Don't use derived vertex state in api_arrayelt.c
Fredrik Höglund [Thu, 23 Jan 2014 17:47:44 +0000 (18:47 +0100)]
mesa: Don't use derived vertex state in api_arrayelt.c

Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agonvc0: allow VIEWPORT_INDEX and LAYER to be used as input semantics
Ilia Mirkin [Sat, 21 Jun 2014 23:25:07 +0000 (19:25 -0400)]
nvc0: allow VIEWPORT_INDEX and LAYER to be used as input semantics

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agomesa/st: handle gl_Layer input semantic
Ilia Mirkin [Sat, 21 Jun 2014 23:12:24 +0000 (19:12 -0400)]
mesa/st: handle gl_Layer input semantic

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agonv50/ir: allow gl_ViewportIndex to work on non-provoking vertices
Tobias Klausmann [Mon, 23 Jun 2014 21:01:42 +0000 (23:01 +0200)]
nv50/ir: allow gl_ViewportIndex to work on non-provoking vertices

Previously, if we had something like:

  gl_ViewportIndex = idx;
  for(int i = 0; i < gl_in.length(); i++) {
     gl_Position = gl_in[i].gl_Position;
     EmitVertex();
  }
  EndPrimitive();

The right viewport index would not be set on the primitive because the
last vertex is the provoking one. However blob drivers appear to move
the gl_ViewportIndex write into the for loop, allowing the application
to be ignorant of this detail.

While the application is technically wrong here, because the blob does
it and other drivers appear to implicitly work this way as well, we add
a buffer register that viewport index writes go into, which is then
exported before every EmitVertex() call.

This fixes the remaining piglit tests in ARB_viewport_array for nv50/nvc0.

Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agodraw: (trivial) fix clamping of viewport index
Roland Scheidegger [Mon, 23 Jun 2014 20:06:15 +0000 (22:06 +0200)]
draw: (trivial) fix clamping of viewport index

The old logic would let all negative values go through unclamped, with
potentially disastrous results (probably trying to fetch viewport values
from random memory locations). GL has undefined rendering for vp indices
outside valid range but that's a bit too undefined...
(The logic is now the same as in llvmpipe.)

CC: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agoi965: Don't emit SURFACE_STATEs for gather workarounds on Broadwell.
Kenneth Graunke [Thu, 29 May 2014 07:06:08 +0000 (00:06 -0700)]
i965: Don't emit SURFACE_STATEs for gather workarounds on Broadwell.

As far as I can tell, Broadwell doesn't need any of the SURFACE_STATE
workarounds for textureGather() bugs, so there's no need to emit
a second set of identical copies.

To keep things simple, just point the gather surface index base to the
same place as the texture surface index base.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agotargets/(vdpau|xvmc): hardlink against the installed library
Emil Velikov [Mon, 23 Jun 2014 17:30:00 +0000 (18:30 +0100)]
targets/(vdpau|xvmc): hardlink against the installed library

With commit 11e46a32aed and f9ebb1ea771 we resolved the symlink
generation required by the versioning of the library.
Although they incorrectly changed the way hardlinks are created by
linking to the ones from the build tree. If the device used for
building differs from the one set as destination linking will fail.

Reported-by: Andy Furniss <adf.lists@gmail.com>
Tested-by: Andy Furniss <adf.lists@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoi965: Allow the blorp blit between BGR and RGB
Neil Roberts [Mon, 23 Jun 2014 16:43:08 +0000 (17:43 +0100)]
i965: Allow the blorp blit between BGR and RGB

Previously the blorp blitter would only be used if the format is identical or
there is only a difference between whether there is an alpha component or not.
This patch makes it also allow the blorp blitter if the only difference is the
ordering of the RGB components (ie, RGB or BGR).

This is particularly useful since commit 61e264f4fcdba3623 because Mesa now
prefers RGB ordering for textures but the window system buffers are still
created as BGR. That means that the blorp blitter won't be used for the
(probably) common case of blitting from a texture to the window system buffer.

This doesn't cause any regressions in the FBO piglit tests on Haswell. On
Sandybridge it causes the fbo-blit-stretch test to fail but that is only
because it was failing anyway before the above commit and that commit hid the
problem.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68365
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoglsl: Silence many unused parameter warnings
Ian Romanick [Sat, 21 Jun 2014 00:27:19 +0000 (17:27 -0700)]
glsl: Silence many unused parameter warnings

In file included from ../../src/glsl/builtin_functions.cpp:61:0:
../../src/glsl/glsl_parser_extras.h:154:9: warning: unused parameter 'var' [-Wunused-parameter]

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
10 years agotargets/xvmc: correctly generate the symlinks
Emil Velikov [Mon, 23 Jun 2014 14:54:36 +0000 (15:54 +0100)]
targets/xvmc: correctly generate the symlinks

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agotargets/vdpau: correctly generate the symlinks
Emil Velikov [Mon, 23 Jun 2014 14:13:47 +0000 (15:13 +0100)]
targets/vdpau: correctly generate the symlinks

Reported-by: David Heidelberger <david.heidelberger@ixit.cz>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoi915: Fix gen2 texblend setup
Ville Syrjälä [Mon, 16 Jun 2014 17:54:32 +0000 (20:54 +0300)]
i915: Fix gen2 texblend setup

Fix an off by one in the texture unit walk during texblend
setup on gen2. This caused the last enabled texunit to be
skipped resulting in totally messed up texturing.

This is a regression introduced here:
 commit 1ad443ecdd694dd9bf3c4a5050d749fb80db6fa2
 Author: Eric Anholt <eric@anholt.net>
 Date:   Wed Apr 23 15:35:27 2014 -0700

    i915: Redo texture unit walking on i830.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
10 years agomesa: Make Geom.UsesEndPrimitive a bool instead of a GLboolean
Iago Toral Quiroga [Fri, 20 Jun 2014 08:01:40 +0000 (10:01 +0200)]
mesa: Make Geom.UsesEndPrimitive a bool instead of a GLboolean

10 years agotargets/r600/xvmc: convert to static/shared pipe-drivers
Emil Velikov [Thu, 12 Jun 2014 15:59:58 +0000 (16:59 +0100)]
targets/r600/xvmc: convert to static/shared pipe-drivers

The r600 equivalent of previous commit.

v2: Correctly include the radeon winsys/radeon_common.

Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Tested-by: Thomas Helland <thomashelland90 at gmail.com>
10 years agotargets/xvmc-nouveau: convert to static/shared pipe-drivers
Emil Velikov [Thu, 12 Jun 2014 14:54:15 +0000 (15:54 +0100)]
targets/xvmc-nouveau: convert to static/shared pipe-drivers

Similar to vdpau targets, we're going to convert the individual
target libraries into a single one.

The library can be built with the relevant pipe-drivers
statically linked in, or loaded as shared modules.
Currently we default to static.

Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Thomas Helland <thomashelland90 at gmail.com>
10 years agotargets/radeonsi/vdpau: convert to static/shared pipe-drivers
Emil Velikov [Sat, 21 Jun 2014 11:31:47 +0000 (12:31 +0100)]
targets/radeonsi/vdpau: convert to static/shared pipe-drivers

Similar to previous commits, this allows us to minimise some
of the duplication by compacting all vdpau targets into a
single library.

v2: Include the radeon winsys only when there is a user for it.
v3: Correcly include the winsys. Now with extra brown bag :\

Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Tested-by: Thomas Helland <thomashelland90 at gmail.com>
10 years agotargets/r600/vdpau: convert to static/shared pipe-drivers
Emil Velikov [Thu, 12 Jun 2014 15:57:31 +0000 (16:57 +0100)]
targets/r600/vdpau: convert to static/shared pipe-drivers

Similar to previous commit, this allows us to minimise some
of the duplication by compacting all vdpau targets into a
single library.

v2: Include the radeon winsys only when there is a user for it.
v3: Correcly include the winsys. Now with extra brown bag :\

Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Tested-by: Thomas Helland <thomashelland90 at gmail.com>
10 years agotargets/vdpau-nouveau: convert to static/shared pipe-drivers
Emil Velikov [Thu, 12 Jun 2014 14:41:29 +0000 (15:41 +0100)]
targets/vdpau-nouveau: convert to static/shared pipe-drivers

Create a single library (for the vdpau api) thus reducing
the overall size of mesa. Current commit converts
vdpau-nouveau, with upcomming commits handling the rest.

The library can be built with the relevant pipe-drivers
statically linked in, or loaded as shared modules.
Currently we default to static.

Add SPLIT_TARGETS to guard the other VL targets.

Note: symlink handling is rather ugly and will need an
update to work with BSD and other non-linux platforms.

v2: Split the conversion into per-target basis.

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Thomas Helland <thomashelland90 at gmail.com>
10 years agoPartially revert "glsl: Add builtin define for ARB_fragment_layer_viewport"
Chris Forbes [Sun, 22 Jun 2014 11:53:59 +0000 (23:53 +1200)]
Partially revert "glsl: Add builtin define for ARB_fragment_layer_viewport"

This partially reverts commit cc18b1ec2161c846109e921d7821dfeef7a06f3a,
which dropped some unrelated code due to a fumbled rebase.

10 years agofreedreno: use util_copy_framebuffer_state()
Rob Clark [Wed, 18 Jun 2014 17:50:14 +0000 (13:50 -0400)]
freedreno: use util_copy_framebuffer_state()

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/a3xx: WFI fixes/cleanup
Rob Clark [Fri, 13 Jun 2014 21:39:59 +0000 (17:39 -0400)]
freedreno/a3xx: WFI fixes/cleanup

Blob driver seems to need WFI in some cases after CP_EVENT_WRITE,
implying that this is asynchronous and should reset needs_wfi.
Also, CP_INVALIDATE_STATE seems to need WFI.  But CP_LOAD_STATE
does not.

The blob driver also puts WFIs before writing GRAS_CL_VPORT registers.
The latter may be a work-around, as these registers should be banked/
context registers.  I haven't yet found a lockup that this averts, but
I expect viewport to change infrequently so out of paranoia I will
keep these for now.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agoglsl: Add gl_Layer and gl_ViewportIndex builtins to fragment shader
Chris Forbes [Sat, 25 Jan 2014 05:29:38 +0000 (18:29 +1300)]
glsl: Add gl_Layer and gl_ViewportIndex builtins to fragment shader

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Add builtin define for ARB_fragment_layer_viewport
Chris Forbes [Sat, 25 Jan 2014 05:24:38 +0000 (18:24 +1300)]
glsl: Add builtin define for ARB_fragment_layer_viewport

The spec doesn't actually mention adding this, but this is the usual
pattern so I'm assuming it's a spec bug.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Add extension plumbing for ARB_fragment_layer_viewport
Chris Forbes [Sat, 25 Jan 2014 05:24:18 +0000 (18:24 +1300)]
glsl: Add extension plumbing for ARB_fragment_layer_viewport

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add extension plumbing for ARB_fragment_layer_viewport
Chris Forbes [Sat, 25 Jan 2014 05:13:01 +0000 (18:13 +1300)]
mesa: Add extension plumbing for ARB_fragment_layer_viewport

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglapi: Add (empty) api section for ARB_fragment_layer_viewport
Chris Forbes [Sat, 25 Jan 2014 05:09:34 +0000 (18:09 +1300)]
glapi: Add (empty) api section for ARB_fragment_layer_viewport

This extension is purely GLSL -- there are no new GL API elements.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Save meta stencil blit programs in the context.
Kenneth Graunke [Thu, 19 Jun 2014 05:25:33 +0000 (22:25 -0700)]
i965: Save meta stencil blit programs in the context.

When the last context in a share group is destroyed, the hash table
containing all of the shader programs (ctx->Shared->ShaderObjects) is
destroyed, throwing away all of the shader programs.

Using a static variable to store program IDs ends up holding on to them
after this, so we think we still have a compiled program, when it
actually got destroyed.  _mesa_UseProgram then hits GL errors, since no
program by that ID exists.

Instead, store the program IDs in the context, so we know to recompile
if our context gets destroyed and the application creates another one.

Fixes es3conform tests when run without -minfmt (where it creates
separate contexts for testing each visual).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77865
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agoscons: avoid building any piece of i915
Emil Velikov [Thu, 19 Jun 2014 00:47:38 +0000 (01:47 +0100)]
scons: avoid building any piece of i915

Leftover from commit c21fca8bf24.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <wallbraker@gmail.com>
10 years agogallivm: Fix build after LLVM commit 211259
Aaron Watry [Sat, 21 Jun 2014 00:13:30 +0000 (19:13 -0500)]
gallivm: Fix build after LLVM commit 211259

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoglx: Don't crash on swap event for a Window (non-GLXWindow)
Daniel Manjarres [Fri, 20 Jun 2014 17:51:33 +0000 (10:51 -0700)]
glx: Don't crash on swap event for a Window (non-GLXWindow)

Prior to GLX 1.3 there was the glxMakeCurrent() function that took a
single drawable handle. The Drawable could be either a bare XID for a
Window or an XID for a glxpixmap.

GLX 1.3 added glxMakeContextCurrent that takes 2 handles: one for
reading, one for writing. Nowadays the old glxMakeCurrent call is
implemented as a call to glxMakeContextCurrent with the single handle
duplicated.

Because of this it is allowed to use a plain-old Window ID as an
argument to glxMakeContextCurrent, although nobody really documents this
sort of thing. The manpage for the NEW call specifies the arguments as
GLXPixmaps, but the actual code accepts Window XIDs too, and handles
them correctly.

Similarly, the glxSelectEvents function can also take a bare Window XID.

The "piglit" tests all use GLXWindows and/or GLXPixmaps. You never
tested swap events with a bare Window XID. That is what my app was
doing.

The swap_events code worked with Window XIDs in mesa 7.x.y. The new code
added in versions 8, 9, and 10 assumes that all buffer swap events have
a GLXPixmap associated with them. Because of the historical quirks
above, this is not true. Swap events for bare Window XIDs do NOT have a
glxpixmap resulting in a segfault.

Any app that uses the old school glxMakeCurrent call with a Window XID
while trying to use swap_events will crash when the libs try to lookup
the nonexistent GLXPixmap associated with the incoming swap event.

I believe that the people who wrote the spec overlooked this, because
the "sbc" field comes from the OML_sync extension that is defined in
terms of glxpixmaps only.

v2 (idr): Formatting changes.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54372
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
10 years agor600g/compute: Use gallium util functions for double lists
Bruno Jiménez [Wed, 18 Jun 2014 15:01:59 +0000 (17:01 +0200)]
r600g/compute: Use gallium util functions for double lists

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g/compute: Map only against intermediate buffers
Bruno Jiménez [Wed, 18 Jun 2014 15:01:58 +0000 (17:01 +0200)]
r600g/compute: Map only against intermediate buffers

With this we can assure that mapped buffers will never change
its position when relocating the pool.

This patch should finally solve the mapping bug.

v2: Use the new is_item_in_pool util function,
    as suggested by Tom Stellard

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g/compute: Implement compute_memory_demote_item
Bruno Jiménez [Wed, 18 Jun 2014 15:01:57 +0000 (17:01 +0200)]
r600g/compute: Implement compute_memory_demote_item

This function will be used when we want to map an item
that it's already in the pool.

v2: Use temporary variables to avoid so many castings in functions,
    as suggested by Tom Stellard

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g/compute: Avoid problems when promoting items mapped for reading
Bruno Jiménez [Wed, 18 Jun 2014 15:01:56 +0000 (17:01 +0200)]
r600g/compute: Avoid problems when promoting items mapped for reading

Acording to the OpenCL spec, it is possible to have a buffer mapped
for reading and at read from it using commands or buffers.

With this we can keep the mapping (that exists against the
temporary item) and read with a kernel (from the item we have
just added to the pool) without problems.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g/compute: Only move to the pool the buffers marked for promoting
Bruno Jiménez [Wed, 18 Jun 2014 15:01:55 +0000 (17:01 +0200)]
r600g/compute: Only move to the pool the buffers marked for promoting

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g/compute: divide the item list in two
Bruno Jiménez [Wed, 18 Jun 2014 15:01:54 +0000 (17:01 +0200)]
r600g/compute: divide the item list in two

Now we will have a list with the items that are in the pool
(item_list) and the items that are outside it (unallocated_list)

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g/compute: Add statuses to the compute_memory_items
Bruno Jiménez [Wed, 18 Jun 2014 15:01:53 +0000 (17:01 +0200)]
r600g/compute: Add statuses to the compute_memory_items

These statuses will help track whether the items are mapped
or if they should be promoted to or demoted from the pool

v2: Use the new is_item_in_pool util function,
    as suggested by Tom Stellard

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g/compute: Add an util function to know if an item is in the pool
Bruno Jiménez [Wed, 18 Jun 2014 15:01:52 +0000 (17:01 +0200)]
r600g/compute: Add an util function to know if an item is in the pool

Every item that has been placed in the pool must have start_in_dw
different from -1.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600g/compute: Add an intermediate resource for OpenCL buffers
Bruno Jiménez [Wed, 18 Jun 2014 15:01:51 +0000 (17:01 +0200)]
r600g/compute: Add an intermediate resource for OpenCL buffers

This patch changes completely the way buffers are added to the
compute_memory_pool. Before this, whenever we were going to
map a buffer or write to or read from it, it would get placed
into the pool. Now, every unallocated buffer has its own
r600_resource until it is allocated in the pool.

NOTE: This patch also increase the GPU memory usage at the moment
of putting every buffer in it's place. More or less, the memory
usage is ~2x(sum of every buffer size)

v2: Cleanup

v3: Use temporary variables to avoid so many castings in functions,
    as suggested by Tom Stellard

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agomesa: Copy Geom.UsesEndPrimitive when cloning a geometry program.
Iago Toral Quiroga [Mon, 16 Jun 2014 15:00:15 +0000 (17:00 +0200)]
mesa: Copy Geom.UsesEndPrimitive when cloning a geometry program.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
10 years agomesa: Init Geom.UsesEndPrimitive in shader programs.
Iago Toral Quiroga [Mon, 16 Jun 2014 14:57:59 +0000 (16:57 +0200)]
mesa: Init Geom.UsesEndPrimitive in shader programs.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Optimize (v.x + v.y) + (v.z + v.w) into dot(v, 1.0).
Matt Turner [Sun, 2 Mar 2014 16:59:50 +0000 (08:59 -0800)]
glsl: Optimize (v.x + v.y) + (v.z + v.w) into dot(v, 1.0).

Cuts five instructions out of SynMark's Gl32VSInstancing benchmark.

10 years agoglsl: Pass in options to do_algebraic().
Matt Turner [Sat, 1 Mar 2014 01:49:20 +0000 (17:49 -0800)]
glsl: Pass in options to do_algebraic().

Will be used in the next commit.

Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglsl: Rebalance expression trees that are reduction operations.
Matt Turner [Sat, 1 Mar 2014 04:11:32 +0000 (20:11 -0800)]
glsl: Rebalance expression trees that are reduction operations.

The intention of this pass was to give us better instruction scheduling
opportunities, but it unexpectedly reduced some instruction counts as
well:

total instructions in shared programs: 1666639 -> 1666073 (-0.03%)
instructions in affected programs:     54612 -> 54046 (-1.04%)
(and trades 4 SIMD16 programs in SS3)

10 years agoautomake: include the libdeps in the correct order
Emil Velikov [Thu, 19 Jun 2014 21:46:25 +0000 (22:46 +0100)]
automake: include the libdeps in the correct order

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80254
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoclover: Calculate the serialized size of a module efficiently.
Francisco Jerez [Sat, 14 Jun 2014 19:03:02 +0000 (21:03 +0200)]
clover: Calculate the serialized size of a module efficiently.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoclover: Optimize module serialization for vectors of fundamental types.
Francisco Jerez [Sat, 14 Jun 2014 18:53:35 +0000 (20:53 +0200)]
clover: Optimize module serialization for vectors of fundamental types.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
10 years agogallivm: set mcpu when initializing llvm execution engine
Roland Scheidegger [Thu, 19 Jun 2014 01:27:26 +0000 (03:27 +0200)]
gallivm: set mcpu when initializing llvm execution engine

Previously llvm detected cpu features automatically when the execution engine
was created (based on host cpu). This is no longer the case, which meant llvm
was then not able to emit some of the intrinsics we used as we didn't specify
any sse attributes (only on avx supporting systems this was not a problem since
despite at least some llvm versions enabling it anyway we always set this
manually). So, instead of trying to figure out which MAttrs to set just set
MCPU.

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

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Tested-by: Vinson Lee <vlee@freedesktop.org>
10 years agoclover: Don't use llvm's global context
Tom Stellard [Tue, 17 Jun 2014 15:12:06 +0000 (08:12 -0700)]
clover: Don't use llvm's global context

An LLVMContext should only be accessed by a single and using the global
context was causing crashes in multi-threaded environments.  Now we use
a separate context for each compile.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
CC: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
10 years agoclover: Prevent Clang from printing number of errors and warnings to stderr.
Tom Stellard [Mon, 12 May 2014 20:32:29 +0000 (16:32 -0400)]
clover: Prevent Clang from printing number of errors and warnings to stderr.

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

CC: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
10 years agoradeon/llvm: Adapt to AMDGPU.rsq intrinsic change in LLVM 3.5
Michel Dänzer [Thu, 19 Jun 2014 06:53:42 +0000 (15:53 +0900)]
radeon/llvm: Adapt to AMDGPU.rsq intrinsic change in LLVM 3.5

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoconfigure: add HAVE_GALLIUM_STATIC_TARGETS
Emil Velikov [Fri, 16 May 2014 14:09:26 +0000 (15:09 +0100)]
configure: add HAVE_GALLIUM_STATIC_TARGETS

Will be used to control the linking mode of pipe-drivers
in gallium targets.

Keep this hardcoded to static, as the pipe-drivers bare
an unstable interface which we do not want to expose to
the normal user.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agotargets: use GALLIUM_PIPE_LOADER_WINSYS_LIB_DEPS
Emil Velikov [Mon, 9 Jun 2014 22:37:19 +0000 (23:37 +0100)]
targets: use GALLIUM_PIPE_LOADER_WINSYS_LIB_DEPS

Drop ~50 lines of buildsystem mayhem.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoautomake: introduce helper variable
Emil Velikov [Thu, 15 May 2014 19:08:10 +0000 (20:08 +0100)]
automake: introduce helper variable

- gallium_pipe_loader_winsys_libs

Will be used in upcomming commits to reduce duplication
in the build.

v2: Drop the megadriver/static_target variables.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agotarget-helpers: add dd_configuration(), dd_driver_name()
Emil Velikov [Sat, 17 May 2014 23:20:47 +0000 (00:20 +0100)]
target-helpers: add dd_configuration(), dd_driver_name()

Add a couple of helpers to be used by the dri targets when
built with static pipe-drivers. Both functions provide
functionality required by the dri state-tracker.

With this patch ilo, nouveau and r300 gain support for
throttle dri configuration.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agotarget-helpers: add dd_create_screen() helper
Emil Velikov [Wed, 14 May 2014 17:50:15 +0000 (18:50 +0100)]
target-helpers: add dd_create_screen() helper

Will be used by gallium targets that statically link the
pipe-drivers in the final library. Provides identical
functionality to device_descriptor.create_screan.

v2:
 - Don't sw_screen_wrap the i915/svga screen.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agotarget-helpers: add a note about debug wrappers
Emil Velikov [Wed, 14 May 2014 17:48:49 +0000 (18:48 +0100)]
target-helpers: add a note about debug wrappers

If memory serves me right, at least one debug wrapper does
not return the base screen on failure.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agotargets/pipe-loader: add driver specific drm_configuration
Emil Velikov [Sat, 17 May 2014 17:53:36 +0000 (18:53 +0100)]
targets/pipe-loader: add driver specific drm_configuration

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agopipe-loader: add pipe_loader_ops::configuration()
Emil Velikov [Sat, 17 May 2014 14:31:32 +0000 (15:31 +0100)]
pipe-loader: add pipe_loader_ops::configuration()

Required for the dri state-tracker. Will be used to retrieve
driver specific configuration parameters:
 - share_fd (dmabuf) capability
 - throttle

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agopipe-loader: note that we leak pipe_loader_drm_device->base->driver_name
Emil Velikov [Sat, 17 May 2014 14:04:59 +0000 (15:04 +0100)]
pipe-loader: note that we leak pipe_loader_drm_device->base->driver_name

The string is malloc'd (strdup) in loader_get_driver_for_fd().

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoautomake: stop building i915-sw and drop explicit linking to softpipe
Emil Velikov [Wed, 18 Jun 2014 23:28:49 +0000 (00:28 +0100)]
automake: stop building i915-sw and drop explicit linking to softpipe

Unused and possibly broken. Will be completely removed in
upcomming commits.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agonv30: hack to avoid errors on unexpected color/zeta combinations
Ilia Mirkin [Wed, 18 Jun 2014 03:28:56 +0000 (23:28 -0400)]
nv30: hack to avoid errors on unexpected color/zeta combinations

This is just a hack, it should be possible to create a temporary zeta
surface and render to that instead. However that's more complicated and
this avoids the render being entirely broken and errors being reported
by the card.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agonv30: tidy screen caps, add missing ones
Ilia Mirkin [Wed, 18 Jun 2014 03:21:34 +0000 (23:21 -0400)]
nv30: tidy screen caps, add missing ones

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv30: avoid dangling references to deleted contexts
Ilia Mirkin [Wed, 18 Jun 2014 02:32:03 +0000 (22:32 -0400)]
nv30: avoid dangling references to deleted contexts

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agonv30: plug some memory leaks on screen destroy and shader compile
Ilia Mirkin [Wed, 18 Jun 2014 02:22:56 +0000 (22:22 -0400)]
nv30: plug some memory leaks on screen destroy and shader compile

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agonv50: organize screen caps
Ilia Mirkin [Mon, 16 Jun 2014 07:25:44 +0000 (03:25 -0400)]
nv50: organize screen caps

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0: organize screen caps
Ilia Mirkin [Mon, 16 Jun 2014 07:16:51 +0000 (03:16 -0400)]
nvc0: organize screen caps

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0: remove vport_int hack and instead use the usual state validation
Ilia Mirkin [Sun, 15 Jun 2014 21:05:35 +0000 (17:05 -0400)]
nvc0: remove vport_int hack and instead use the usual state validation

Commit ad4dc772 fixed an issue with the viewport not being restored
correctly. However it's rather hackish and confusing. Instead just mark
the viewport dirty and let the viewport validation take care of it.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agor300g: don't advertize PIPE_FORMAT_B10G10R10X2_UNORM on < r500
David Heidelberger [Wed, 18 Jun 2014 20:52:41 +0000 (22:52 +0200)]
r300g: don't advertize PIPE_FORMAT_B10G10R10X2_UNORM on < r500

Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
10 years agoradeonsi: implement ARB_texture_query_lod
Marek Olšák [Mon, 16 Jun 2014 14:53:42 +0000 (16:53 +0200)]
radeonsi: implement ARB_texture_query_lod

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoradeonsi: pass ARB_conservative_depth parameters to the hardware
Marek Olšák [Sat, 14 Jun 2014 15:58:30 +0000 (17:58 +0200)]
radeonsi: pass ARB_conservative_depth parameters to the hardware

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agogallium: implement ARB_texture_query_levels
Marek Olšák [Sat, 14 Jun 2014 01:19:26 +0000 (03:19 +0200)]
gallium: implement ARB_texture_query_levels

The extension is always supported if GLSL 1.30 is supported.

Softpipe and llvmpipe support is also added (trivial).
Radeon and nouveau support is already done.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agost/mesa: set sampler_view::last_level correctly
Marek Olšák [Sat, 14 Jun 2014 00:49:11 +0000 (02:49 +0200)]
st/mesa: set sampler_view::last_level correctly

It was set to pipe_resource::last_level and _MaxLevel was embedded in max_lod,
that's why it worked for ordinary texturing. However, min_lod doesn't have
any effect on texelFetch and textureQueryLevels, so we must still set
last_level correctly.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agost/mesa: handle array textures in st_texture_image_copy
Dave Airlie [Sat, 14 Jun 2014 01:04:22 +0000 (03:04 +0200)]
st/mesa: handle array textures in st_texture_image_copy

Marek: also handle cube arrays

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agoradeonsi: cosmetic changes in si_shader.c
Marek Olšák [Fri, 6 Jun 2014 01:04:21 +0000 (03:04 +0200)]
radeonsi: cosmetic changes in si_shader.c

reviewed by Michel Dänzer

10 years agoradeonsi: implement ARB_texture_gather and Gather functions from GLSL 4.00
Marek Olšák [Fri, 6 Jun 2014 01:00:18 +0000 (03:00 +0200)]
radeonsi: implement ARB_texture_gather and Gather functions from GLSL 4.00

All ARB_texture_gather and gather-related ARB_gpu_shader5 piglit tests pass.

reviewed by Michel Dänzer

10 years agost/mesa: fix geometry shader max texture limit in state validation
Marek Olšák [Thu, 9 May 2013 11:33:11 +0000 (13:33 +0200)]
st/mesa: fix geometry shader max texture limit in state validation

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agor600g: fix the max vertex shader input limit
Marek Olšák [Thu, 2 May 2013 03:24:27 +0000 (05:24 +0200)]
r600g: fix the max vertex shader input limit

10 years agometa: Respect the driver's maximum number of draw buffers
Ian Romanick [Tue, 17 Jun 2014 18:14:17 +0000 (11:14 -0700)]
meta: Respect the driver's maximum number of draw buffers

Commit c1c1cf5f9 added infrastructure for saving and restoring draw
buffer state.  However, it universially used MAX_DRAW_BUFFERS, but many
drivers support far fewer than that at limit.  For example, the radeon
and i915 drivers only support 1.  Using MAX_DRAW_BUFFERS causes meta to
generate GL errors.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80115
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Kenneth Graunke <kenneth@whitecape.org> [on Broadwell]
Tested-by: jpsinthemix@verizon.net
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agogallivm: fix SCALED -> NORM conversions
Roland Scheidegger [Tue, 17 Jun 2014 23:34:49 +0000 (01:34 +0200)]
gallivm: fix SCALED -> NORM conversions

Such conversions (which are most likely rather pointless in practice) were
resulting in shifts with negative shift counts and shifts with counts the same
as the bit width. This was always undefined in llvm, the code generated was
rather horrendous but happened to work.
So make sure such shifts are filtered out and replaced with something that
works (the generated code is still just as horrendous as before).

This fixes lp_test_format, https://bugs.freedesktop.org/show_bug.cgi?id=73846.

v2: prettify by using build context shift helpers.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agomesa: Remove glClear optimization based on drawable size
Kristian Høgsberg [Mon, 12 May 2014 22:46:11 +0000 (15:46 -0700)]
mesa: Remove glClear optimization based on drawable size

A drawable size of 0x0 means that we don't have buffers for a drawable yet,
not that we have a zero-sized buffer.  Core mesa shouldn't be optimizing out
drawing based on buffer size, since the draw call could be what triggers
the driver to go and get buffers.  As discussed in the referenced bug report,
the optimization was added as part of a scatter-shot attempt to fix a
different problem.  There's no other example in mesa core of using the
buffer size in this way.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74005
Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: In emit_texenv() type mismatch was forced with typecast
Juha-Pekka Heikkila [Mon, 24 Feb 2014 07:42:17 +0000 (09:42 +0200)]
mesa: In emit_texenv() type mismatch was forced with typecast

Type mismatch caused random memory to be copied when casted
memory area was smaller than expected type.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoradeon/uvd: disable VC-1 simple/main on UVD 2.x
Grigori Goronzy [Wed, 4 Jun 2014 16:54:38 +0000 (18:54 +0200)]
radeon/uvd: disable VC-1 simple/main on UVD 2.x

It's about as broken as on later UVD revisions.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66452
Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agoradeonsi: add sampling of 4:2:2 subsampled textures
Grigori Goronzy [Wed, 4 Jun 2014 16:54:37 +0000 (18:54 +0200)]
radeonsi: add sampling of 4:2:2 subsampled textures

This makes 4:2:2 video surfaces work in VDPAU.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agoutil/u_format: move utility function from r600g
Grigori Goronzy [Wed, 4 Jun 2014 16:54:36 +0000 (18:54 +0200)]
util/u_format: move utility function from r600g

We need this for radeonsi, and it might be useful for other drivers,
too.

10 years agoradeon/vce: set number of cpbs based on level
Leo Liu [Thu, 12 Jun 2014 16:48:05 +0000 (12:48 -0400)]
radeon/vce: set number of cpbs based on level

v2: add error check for cpb size 0

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agoradeon/vce: implement h264 level support
Leo Liu [Thu, 12 Jun 2014 16:27:31 +0000 (12:27 -0400)]
radeon/vce: implement h264 level support

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agost/omx/enc: implement h264 level support
Leo Liu [Thu, 12 Jun 2014 16:27:30 +0000 (12:27 -0400)]
st/omx/enc: implement h264 level support

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agovl: add level interface
Leo Liu [Thu, 12 Jun 2014 16:27:29 +0000 (12:27 -0400)]
vl: add level interface

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agost/st/omx: fix switch-case indentation in vid_enc.c
Leo Liu [Thu, 12 Jun 2014 16:27:28 +0000 (12:27 -0400)]
st/st/omx: fix switch-case indentation in vid_enc.c

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agoglx: Add an error message when a direct renderer's createScreen() routine fails
Jon TURNEY [Sat, 10 May 2014 10:04:44 +0000 (11:04 +0100)]
glx: Add an error message when a direct renderer's createScreen() routine fails
because no matching fbConfigs or visuals could be found.

Nearly all the error cases in *createScreen() issue an error message to diagnose
the failure to initialize before branching to handle_error.  The few remaining
error cases which don't should probably do the same.

(At the moment, it seems this can be triggered in drisw with an X server which
reports definite values for MAX_PBUFFFER_(WIDTH|HEIGHT|SIZE), because those
attributes are checked for an exact match against 0.)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/vec4: unit test for copy propagation and writemask
Chia-I Wu [Mon, 14 Apr 2014 13:52:34 +0000 (21:52 +0800)]
i965/vec4: unit test for copy propagation and writemask

This unit test demonstrates a subtle bug fixed by
4ddf51db6af36736d5d42c1043eeea86e47459ce.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/vec4/gs: Silence warning about unused 'success' in release build.
Matt Turner [Sun, 15 Jun 2014 05:53:16 +0000 (22:53 -0700)]
i965/vec4/gs: Silence warning about unused 'success' in release build.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965/disasm: Mark three_source_reg_encoding[] static.
Matt Turner [Sun, 15 Jun 2014 05:52:08 +0000 (22:52 -0700)]
i965/disasm: Mark three_source_reg_encoding[] static.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965/blorp: Remove unused 'brw' member.
Matt Turner [Sun, 15 Jun 2014 05:51:29 +0000 (22:51 -0700)]
i965/blorp: Remove unused 'brw' member.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965/blorp: Mark branch unreachable to silence uninitialized var warning.
Matt Turner [Sun, 15 Jun 2014 06:21:24 +0000 (23:21 -0700)]
i965/blorp: Mark branch unreachable to silence uninitialized var warning.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Silence warning about unused brw in release builds.
Matt Turner [Sun, 15 Jun 2014 05:52:35 +0000 (22:52 -0700)]
i965: Silence warning about unused brw in release builds.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Mark backend_instruction and bblock_t as structs.
Matt Turner [Sun, 15 Jun 2014 05:53:40 +0000 (22:53 -0700)]
i965: Mark backend_instruction and bblock_t as structs.

They have to be marked as structs for C code elsewhere. bblock_t is
already defined as a struct, and all of backend_instruction's fields are
public anyway.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Use standard SSE intrinsics instead of gcc built-ins.
Matt Turner [Sun, 15 Jun 2014 05:31:33 +0000 (22:31 -0700)]
i965: Use standard SSE intrinsics instead of gcc built-ins.

Let's this file compile with clang.

Reviewed-by: Frank Henigman <fjhenigman@google.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>