mesa.git
10 years agoautomake: add -Wl,--no-undefined to all libraries
Emil Velikov [Thu, 13 Mar 2014 05:44:33 +0000 (05:44 +0000)]
automake: add -Wl,--no-undefined to all libraries

... apart from the dri drivers.
With this final change we can build mesa without fear that
the resulting libraries will have unresolved symbols.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agogallium/targets: add missing library dependencies
Emil Velikov [Thu, 27 Mar 2014 20:32:41 +0000 (20:32 +0000)]
gallium/targets: add missing library dependencies

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agopipe-loader: reorder PIPE_LIBS
Emil Velikov [Mon, 31 Mar 2014 12:05:14 +0000 (13:05 +0100)]
pipe-loader: reorder PIPE_LIBS

Reorder -lm, -lrt, -lpthreads and -ldl to be consistent with the
rest of mesa.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agopipe-loader: use PTHREAD_LIBS over -lpthread
Emil Velikov [Thu, 27 Mar 2014 20:21:52 +0000 (20:21 +0000)]
pipe-loader: use PTHREAD_LIBS over -lpthread

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agodri/i965: use CLOCK_LIBS over -lrt
Emil Velikov [Wed, 12 Mar 2014 01:49:20 +0000 (01:49 +0000)]
dri/i965: use CLOCK_LIBS over -lrt

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoautomake: consistently use -no-undefined
Emil Velikov [Thu, 13 Mar 2014 02:32:29 +0000 (02:32 +0000)]
automake: consistently use -no-undefined

Set the flag for all but the dri targets. They have missing
glapi symbols which are required for the normal operation with
the X server.

Jon, I fear that you'll need to carry the "no-undefined" hunk
locally when building the dri drivers under cygwin.

Cc: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agotargets/egl-static: move the common LDFLAGS into AM_LDFLAGS
Emil Velikov [Tue, 11 Mar 2014 16:05:53 +0000 (16:05 +0000)]
targets/egl-static: move the common LDFLAGS into AM_LDFLAGS

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agotargets/omx: do not link against the trace driver
Emil Velikov [Fri, 28 Mar 2014 12:22:44 +0000 (12:22 +0000)]
targets/omx: do not link against the trace driver

Unused due to the missing GALLIUM_TRACE define.

Requested-by: 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>
10 years agogallium/targets: explicitly include a dummy.cpp and remove all the LINK mayhem
Emil Velikov [Tue, 11 Mar 2014 15:24:07 +0000 (15:24 +0000)]
gallium/targets: explicitly include a dummy.cpp and remove all the LINK mayhem

Explicitly setting the linker variable was required for old and broken
build toolchains. At this point this should no longer be needed, and
setting the sources lists will trigger generation of the correct LINK
variables.

Explicitly include dummy.cpp to use g++ to link the static library which
in most cases is based upon C++ code.

v2: Reword commit message.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agogallium/targets: move LLVM_LIBS handling inside Automake.inc
Emil Velikov [Tue, 11 Mar 2014 13:34:53 +0000 (13:34 +0000)]
gallium/targets: move LLVM_LIBS handling inside Automake.inc

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agogallium/targets: fold LLVM_LDFLAGS inside Automake.inc
Emil Velikov [Tue, 11 Mar 2014 02:21:21 +0000 (02:21 +0000)]
gallium/targets: fold LLVM_LDFLAGS inside Automake.inc

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agotargets/omx: use GALLIUM_OMX_LINKER_FLAGS
Emil Velikov [Thu, 13 Mar 2014 02:28:21 +0000 (02:28 +0000)]
targets/omx: use GALLIUM_OMX_LINKER_FLAGS

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agotargets/omx: introduce GALLIUM_OMX_LIB_DEPS
Emil Velikov [Tue, 11 Mar 2014 02:45:23 +0000 (02:45 +0000)]
targets/omx: introduce GALLIUM_OMX_LIB_DEPS

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agotargets/pipe-loader: move LLVM_LIBS handling inside PIPE_LIBS
Emil Velikov [Tue, 11 Mar 2014 14:45:30 +0000 (14:45 +0000)]
targets/pipe-loader: move LLVM_LIBS handling inside PIPE_LIBS

This lets us have only one if HAVE_MESA_LLVM block, rather than
one for each driver.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agotargets/pipe-loader: include dummy.cpp irrespective of HAVE_MESA_LLVM
Emil Velikov [Tue, 11 Mar 2014 01:56:04 +0000 (01:56 +0000)]
targets/pipe-loader: include dummy.cpp irrespective of HAVE_MESA_LLVM

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agotargets/pipe-loader: compact duplicating LDFLAGS
Emil Velikov [Tue, 11 Mar 2014 01:52:00 +0000 (01:52 +0000)]
targets/pipe-loader: compact duplicating LDFLAGS

Every library uses the same libtool/linker flags. Compact those
into AM_LDFLAGS and append the version script to it.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agopipe-loader/swrast: add soft/llvmpipe defines
Joakim Sindholt [Tue, 11 Mar 2014 01:46:55 +0000 (01:46 +0000)]
pipe-loader/swrast: add soft/llvmpipe defines

Or it compiles them in, but pretends they don't exist

v2: Rebase (Emil)

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agotargets/xa: drop libudev references from automake build
Emil Velikov [Tue, 11 Mar 2014 00:42:48 +0000 (00:42 +0000)]
targets/xa: drop libudev references from automake build

Mesa does _not_ link against libudev. Additionally the only place
that deals with it is the loader, thus we can drop the CFLAGS.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agodri/common: LIBDRM_LIBS is not a linker/libtool flag, add it to LIBADD
Emil Velikov [Tue, 11 Mar 2014 00:19:16 +0000 (00:19 +0000)]
dri/common: LIBDRM_LIBS is not a linker/libtool flag, add it to LIBADD

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agodrivers/x11: GL_LIB_DEPS is not a linker/libtool flag, add it to LIBADD
Emil Velikov [Tue, 11 Mar 2014 00:01:33 +0000 (00:01 +0000)]
drivers/x11: GL_LIB_DEPS is not a linker/libtool flag, add it to LIBADD

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoconfigure: autodetect video state-trackers when non swrast driver is present
Emil Velikov [Thu, 13 Mar 2014 04:25:17 +0000 (04:25 +0000)]
configure: autodetect video state-trackers when non swrast driver is present

It makes little sense to enable the vdpau, xvmc and omx state-trackers
as they do not make use of (don't work with) the software driver.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoconfigure: use grep in quiet mode, rather than piping stderr/stdout to /dev/null
Emil Velikov [Wed, 12 Mar 2014 02:37:55 +0000 (02:37 +0000)]
configure: use grep in quiet mode, rather than piping stderr/stdout to /dev/null

grep -q is easier to read and consistent with the rest of configure.ac.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoconfigure: error out when building gallium-osmesa without softpipe
Emil Velikov [Wed, 12 Mar 2014 00:36:21 +0000 (00:36 +0000)]
configure: error out when building gallium-osmesa without softpipe

Gallium osmesa links against the softpipe driver, thus the build
will fail if it's missing.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Matt Turner <mattst88@gmail.com>
10 years agoPartially revert "automake: allow only shared builds"
Emil Velikov [Wed, 12 Mar 2014 18:13:02 +0000 (18:13 +0000)]
Partially revert "automake: allow only shared builds"

Evidently at least static OSMesa is still used as shared one
causes substantial increase in the load time for some programs
that use it (from seconds up-to ~30min).

Rather than forcing everyone to use shared mesa, revert commit
a6efbac9fb502c4f0166e7a0680b6828e1f6926c and default to shared
build when both shared and static are disabled.

v2: Whitespace cleanup, drop silly comment.

Reported-by: Burlen Loring <burlen.loring@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoconfigure: enable dri3 only for linux
Emil Velikov [Fri, 21 Mar 2014 18:09:36 +0000 (18:09 +0000)]
configure: enable dri3 only for linux

Currently only linux can make use of dri3, so it would make sense to
enable it explicitly for the platform.
Drop a duplicated libudev check while we're at it.

v3: Properly handle dri3 and reword commit message.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76377
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agomesa: Fix format matching checks for GL_INTENSITY* internalformats.
Chris Forbes [Fri, 28 Mar 2014 23:02:55 +0000 (12:02 +1300)]
mesa: Fix format matching checks for GL_INTENSITY* internalformats.

GL_INTENSITY has never been valid as a pixel format -- to get the memcpy
pack/unpack paths, the app needs to specify GL_RED as the pixel format
(or GL_RED_INTEGER for the integer formats).

Note: This was briefly merged before, but exposed some breakage in gallium, so
was reverted. Hopefully it will stick this time.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agost: fix st_choose_matching_format to ignore intensity
Chris Forbes [Fri, 28 Mar 2014 23:02:54 +0000 (12:02 +1300)]
st: fix st_choose_matching_format to ignore intensity

_mesa_format_matches_format_and_type() returns true for
GL_RED/GL_RED_INTEGER (with an appropriate type) into an intensity
mesa_format.

We want the `red`-based format instead, regardless of the order we find
them in our walk of the mesa formats list.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agomesa: fix texstore for MESA_FORMAT_R8G8B8A8_SRGB
Chris Forbes [Sat, 29 Mar 2014 03:56:48 +0000 (16:56 +1300)]
mesa: fix texstore for MESA_FORMAT_R8G8B8A8_SRGB

The case for this was in the wrong function, and this format's store
func was not set in the table at all.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agofreedreno/a3xx/compiler: fix RECT textures
Rob Clark [Sun, 30 Mar 2014 16:06:35 +0000 (12:06 -0400)]
freedreno/a3xx/compiler: fix RECT textures

Whether or not the coords are normalized is handled in the texture
state.  But we otherwise need to treat RECT sample instructions as 2D.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/a3xx/compiler: avoid negative register ids
Rob Clark [Sat, 29 Mar 2014 18:32:38 +0000 (14:32 -0400)]
freedreno/a3xx/compiler: avoid negative register ids

In some cases, we need a register to be assigned up to three components
before the base.  Since we can't have negative register #'s, just shift
everything up.  May increase register usage for trivial shaders, but I
don't think we are shader limited in those cases.  A proper solution is
going to require a better register assignment algorithm (which is on the
TODO list), this is just a hack to get us by until then.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/a3xx: missing wfi
Rob Clark [Sat, 29 Mar 2014 15:06:49 +0000 (11:06 -0400)]
freedreno/a3xx: missing wfi

RB_FRAME_BUFFER_DIMENSION is not a banked context register, so we need
to wait for the GPU to idle before updating it.  But we'd rather not
have unnecessary WFI's, so actually keep track if we need to emit it or
not.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/a3xx: little extra debug
Rob Clark [Sat, 29 Mar 2014 15:42:01 +0000 (11:42 -0400)]
freedreno/a3xx: little extra debug

Catch things which should not happen in debug builds.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno: handle null sampler
Rob Clark [Thu, 27 Mar 2014 18:47:48 +0000 (14:47 -0400)]
freedreno: handle null sampler

This is something that XA triggers.  In some cases it will only use
SAMP[1] (composite mask) but not SAMP[0] (composite src).

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agoi965: Add Cherryview support.
Kenneth Graunke [Wed, 19 Feb 2014 00:39:11 +0000 (16:39 -0800)]
i965: Add Cherryview support.

Based on a patch by Ville Syrjälä.

As usual, these are placeholder values; actual values will come later.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Clean up "unused parameter" warnings
Ian Romanick [Thu, 27 Mar 2014 21:17:53 +0000 (14:17 -0700)]
glsl: Clean up "unused parameter" warnings

../../src/glsl/builtin_functions.cpp:72:1: warning: unused parameter 'state' [-Wunused-parameter]

../../src/glsl/ir_clone.cpp:31:1: warning: unused parameter 'ht' [-Wunused-parameter]

../../src/glsl/ir_equals.cpp:44:1: warning: unused parameter 'ir' [-Wunused-parameter]
../../src/glsl/ir_equals.cpp:50:1: warning: unused parameter 'ignore' [-Wunused-parameter]
../../src/glsl/ir_equals.cpp:68:1: warning: unused parameter 'ignore' [-Wunused-parameter]

../../src/glsl/ir_print_visitor.cpp:149:6: warning: unused parameter 'ir' [-Wunused-parameter]
../../src/glsl/ir_print_visitor.cpp:556:1: warning: unused parameter 'ir' [-Wunused-parameter]
../../src/glsl/ir_print_visitor.cpp:562:1: warning: unused parameter 'ir' [-Wunused-parameter]

../../src/glsl/link_uniforms.cpp:213:1: warning: unused parameter 'record_type' [-Wunused-parameter]

../../src/glsl/loop_analysis.cpp:225:1: warning: unused parameter 'ir' [-Wunused-parameter]

../../src/glsl/loop_unroll.cpp:73:30: warning: unused parameter 'ir' [-Wunused-parameter]
../../src/glsl/loop_unroll.cpp:79:30: warning: unused parameter 'ir' [-Wunused-parameter]
../../src/glsl/loop_unroll.cpp:85:30: warning: unused parameter 'ir' [-Wunused-parameter]

../../src/glsl/opt_copy_propagation_elements.cpp:189:1: warning: unused parameter 'ir' [-Wunused-parameter]

../../src/glsl/opt_cse.cpp:402:1: warning: unused parameter 'ir' [-Wunused-parameter]

../../src/glsl/opt_dead_code_local.cpp:117:30: warning: unused parameter 'ir' [-Wunused-parameter]

../../src/glsl/opt_redundant_jumps.cpp:53:1: warning: unused parameter 'ir' [-Wunused-parameter]

../../src/glsl/opt_vectorize.cpp:301:1: warning: unused parameter 'ir' [-Wunused-parameter]

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Clean up "unused parameter" warnings
Ian Romanick [Wed, 12 Mar 2014 23:54:17 +0000 (16:54 -0700)]
mesa: Clean up "unused parameter" warnings

program/ir_to_mesa.cpp:2008:1: warning: unused parameter 'ir' [-Wunused-parameter]
program/ir_to_mesa.cpp:2272:1: warning: unused parameter 'ir' [-Wunused-parameter]
program/ir_to_mesa.cpp:2278:1: warning: unused parameter 'ir' [-Wunused-parameter]

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa/program: Constify find_variable_storage
Ian Romanick [Mon, 3 Mar 2014 04:31:02 +0000 (06:31 +0200)]
mesa/program: Constify find_variable_storage

Also clean up an old whitespace blooper.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Move Doxygen block closing ot the correct place
Ian Romanick [Fri, 28 Feb 2014 23:29:36 +0000 (15:29 -0800)]
glsl: Move Doxygen block closing ot the correct place

This is the closing for the "\defgroup IR Intermediate representation
nodes" all the way at the top of the file.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Make sure we always compute valid index bounds before drawing.
Iago Toral Quiroga [Fri, 28 Mar 2014 07:14:02 +0000 (08:14 +0100)]
i965: Make sure we always compute valid index bounds before drawing.

When doing software rendering (i.e. rendering to the selection buffer) we need
to make sure that we have valid index bounds before calling _tnl_draw_prims(),
otherwise we can crash.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59455
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: remove {add,get}_type_ast from glsl_symbol_table
Chia-I Wu [Thu, 20 Mar 2014 07:45:12 +0000 (15:45 +0800)]
glsl: remove {add,get}_type_ast from glsl_symbol_table

They are not needed since 0da1a2cc369052643ccaea75a1722cc37652d82a.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agomesa: fix glMultiDrawArrays inside a display list
Brian Paul [Wed, 26 Mar 2014 23:08:20 +0000 (17:08 -0600)]
mesa: fix glMultiDrawArrays inside a display list

The underlying glDrawArrays() calls weren't getting compiled into
the display list.  We simply need to use the current dispatch table
so the CALL_DrawArrays() is routed to the display list save function.

This patch also fixes glMultiModeDrawArraysIBM and
glMultiModeDrawElementsIBM.

Fixes the new piglit gl-1.4-dlist-multidrawarrays test.

Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agost/mesa: overhaul texture / sample swizzle code
Brian Paul [Tue, 25 Mar 2014 17:04:40 +0000 (11:04 -0600)]
st/mesa: overhaul texture / sample swizzle code

Previously we only examined the GL_DEPTH_MODE state to determine the
sampler view swizzle for depth textures.  Now we also consider the
texture base format for color textures too.

The basic idea is if we're sampling from a RGB texture we always
want to get A=1, even if the actual hardware format might be RGBA.
We had assumed that the texture's A values were always one since that's
what Mesa's texstore code does.  But if we render to the RGBA texture,
the A values might not be 1.  Subsequent sampling didn't return the
right values.

Now we examine the user-specified texture base format vs. the actual
gallium format to determine the right swizzle.

Fixes several fbo-blending-formats, fbo-clear-formats and fbo-tex-rgbx
failures with VMware/svga driver (and possibly other drivers).
No other piglit regressions with softpipe or VMware/svga.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
10 years agost/mesa: simplify apply_depthmode()
Brian Paul [Tue, 25 Mar 2014 15:36:29 +0000 (09:36 -0600)]
st/mesa: simplify apply_depthmode()

In preparation for following changes.

I used a temporary test harness to compare the old code to the new
for all possible swizzle inputs.  No change in results.

10 years agoi965: Use intel_upload_space() for pull constant uploads.
Eric Anholt [Fri, 1 Nov 2013 01:16:45 +0000 (18:16 -0700)]
i965: Use intel_upload_space() for pull constant uploads.

This also happens to fix a leak of the current GS pull constant BO on
context destroy, by just not holding on to the pull const bos after the
surface state is generated.

No statistically significant performance difference on GLB2.7 on HSW at
1024x768 (n=40) or 320x240 (n=44), or on BYT at 320x240 (n=47).

v2: Rebase on intel_upload simplification.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Massively simplify the intel_upload implementation.
Eric Anholt [Thu, 24 Jan 2013 01:05:10 +0000 (17:05 -0800)]
i965: Massively simplify the intel_upload implementation.

The implementation kept a page-sized area for uploading data, and
uploaded chunks from that to a 64kb-sized streamed buffer.  This wasted
cache footprint (and extra state tracking to do so) when we want to just
write our data into the buffer immediately.

Instead, build it around an interface like brw_state_batch() that just
gets you a pointer to BO memory to upload your stuff immediately.

Improves OpenArena on HSW by 1.62209% +/- 0.355299% (n=61) and on BYT by
1.7916% +/- 0.415743% (n=31).

v2: Rebase on Mesa master, drop old prototypes.  Re-do performance
    comparison on a kernel that doesn't punish CPU efficiency
    improvements.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agodraw/llvm: improve debugging output a bit
Zack Rusin [Wed, 26 Mar 2014 17:36:34 +0000 (13:36 -0400)]
draw/llvm: improve debugging output a bit

it's useful to know what the llvmbuildstore arguments are going to
be before executing it because it can crash and make sure to
print out the inputs only if we're not generating a gs because
it fetches inputs differently.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agodraw/gs: reduce the size of the gs output buffer
Zack Rusin [Fri, 7 Mar 2014 18:35:45 +0000 (13:35 -0500)]
draw/gs: reduce the size of the gs output buffer

We used to overallocate the output buffer sometimes running out
of memory with applications rendering large geometries. The actual
maximum number of vertices out is simply the maximum number of
primitives in (number of gs invocations) multiplied by the maximum
number of output vertices per gs input primitive (i.e. gs invocation).

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agosvga: add work-around for Sauerbraten Z fighting issue
Brian Paul [Mon, 24 Mar 2014 23:24:01 +0000 (17:24 -0600)]
svga: add work-around for Sauerbraten Z fighting issue

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agosvga: null out query's hwbuf pointer after destroying
Brian Paul [Mon, 24 Mar 2014 23:21:34 +0000 (17:21 -0600)]
svga: null out query's hwbuf pointer after destroying

Just to be extra safe.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agosvga: add some debug_printf() calls in the query object code
Brian Paul [Mon, 24 Mar 2014 23:20:54 +0000 (17:20 -0600)]
svga: add some debug_printf() calls in the query object code

To help debug failures.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agost/mesa: add null pointer checking in query object functions
Brian Paul [Mon, 24 Mar 2014 23:17:34 +0000 (17:17 -0600)]
st/mesa: add null pointer checking in query object functions

Don't pass null query object pointers into gallium functions.
This avoids segfaulting in the VMware driver (and others?) if the
pipe_context::create_query() call fails and returns NULL.

Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agosvga: fix a comment (sampler vs. sampler_view)
Brian Paul [Mon, 24 Mar 2014 19:53:26 +0000 (13:53 -0600)]
svga: fix a comment (sampler vs. sampler_view)

10 years agomesa: fix unpack_Z32_FLOAT_X24S8() / unpack_Z32_FLOAT() mix-up
Brian Paul [Sat, 22 Mar 2014 17:23:32 +0000 (11:23 -0600)]
mesa: fix unpack_Z32_FLOAT_X24S8() / unpack_Z32_FLOAT() mix-up

And use the z32f_x24s8 helper struct in unpack_Z32_FLOAT_X24S8().
Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agomesa: fix indentation, formatting, etc in fbobject.c
Brian Paul [Sat, 22 Mar 2014 16:31:58 +0000 (10:31 -0600)]
mesa: fix indentation, formatting, etc in fbobject.c

10 years agomesa: rename format_(un)pack.c functions to match format names (pt. 7)
Brian Paul [Sat, 22 Mar 2014 18:13:20 +0000 (12:13 -0600)]
mesa: rename format_(un)pack.c functions to match format names (pt. 7)

sed commands:
s/z_Z24_S8\b/S8_UINT_Z24_UNORM/g
s/z_S8_Z24\b/Z24_UNORM_S8_UINT/g
s/z_Z16\b/Z_UNORM16/g
s/z_Z32\b/Z_UNORM32/g
s/z_Z32_FLOAT/Z_FLOAT32/g

Reviewed-by: Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agomesa: rename format_(un)pack.c functions to match format names (pt. 6)
Brian Paul [Sat, 22 Mar 2014 18:13:20 +0000 (12:13 -0600)]
mesa: rename format_(un)pack.c functions to match format names (pt. 6)

sed commands:
s/ARGB2101010_UINT\b/B10G10R10A2_UINT/g
s/ABGR2101010_UINT\b/R10G10B10A2_UINT/g

Reviewed-by: Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agomesa: rename format_(un)pack.c functions to match format names (pt. 5)
Brian Paul [Sat, 22 Mar 2014 18:13:20 +0000 (12:13 -0600)]
mesa: rename format_(un)pack.c functions to match format names (pt. 5)

sed commands:
s/SIGNED_R_UNORM8\b/R_SNORM8/g
s/SIGNED_RG88_REV\b/R8G8_SNORM/g
s/SIGNED_RGBX8888\b/X8B8G8R8_SNORM/g
s/SIGNED_A8B8G8R8_UNORM\b/A8B8G8R8_SNORM/g
s/SIGNED_R8G8B8A8_UNORM\b/R8G8B8A8_SNORM/g
s/SIGNED_R_UNORM16\b/R_SNORM16/g
s/SIGNED_R16G16_UNORM\b/R16G16_SNORM/g
s/SIGNED_RGB_16\b/RGB_SNORM16/g
s/SIGNED_RGBA_16\b/RGBA_SNORM16/g
s/SIGNED_A_UNORM8\b/A_SNORM8/g
s/SIGNED_L_UNORM8\b/L_SNORM8/g
s/SIGNED_L8A8_UNORM\b/L8A8_SNORM/g
s/SIGNED_L_UNORM8\b/I_SNORM8/g
s/SIGNED_A_UNORM16\b/A_SNORM16/g
s/SIGNED_L_UNORM16\b/L_SNORM16/g
s/SIGNED_L16A16_UNORM\b/LA_SNORM16/g
s/SIGNED_L_UNORM16\b/I_SNORM16/g
s/XBGR16161616_SNORM\b/RGBX_SNORM16/g
s/SIGNED_G8R8_UNORM\b/G8R8_SNORM/g
s/SIGNED_G16R16_UNORM\b/G16R16_SNORM/g
s/SIGNED_I_UNORM8\b/I_SNORM8/g
s/SIGNED_I_UNORM16\b/I_SNORM16/g

Reviewed-by: Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agomesa: rename format_(un)pack.c functions to match format names (pt. 4)
Brian Paul [Sat, 22 Mar 2014 18:13:20 +0000 (12:13 -0600)]
mesa: rename format_(un)pack.c functions to match format names (pt. 4)

sed commands:
s/SRGBA_UNORM8\b/A8B8G8R8_SRGB/g
s/SABGR_UNORM8\b/R8G8B8A8_SRGB/g
s/SARGB8\b/B8G8R8A8_SRGB/g
s/XBGR8888_SRGB\b/R8G8B8X8_SRGB/g
s/XRGB8888_SRGB\b/B8G8R8X8_SRGB/g
s/SL_UNORM8\b/L_SRGB8/g
s/SLA_UNORM8\b/L8A8_SRGB/g

manually changed SRGB8 -> BGR_SRGB8

Reviewed-by: Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agomesa: rename format_(un)pack.c functions to match format names (pt. 3)
Brian Paul [Sat, 22 Mar 2014 18:13:20 +0000 (12:13 -0600)]
mesa: rename format_(un)pack.c functions to match format names (pt. 3)

sed commands:
s/LUMINANCE_FLOAT32\b/L_FLOAT32/g
s/LUMINANCE_FLOAT16\b/L_FLOAT16/g
s/LUMINANCE_ALPHA_FLOAT32\b/LA_FLOAT32/g
s/LUMINANCE_ALPHA_FLOAT16\b/LA_FLOAT16/g
s/ALPHA_FLOAT32\b/A_FLOAT32/g
s/ALPHA_FLOAT16\b/A_FLOAT16/g
s/XBGR32323232_FLOAT\b/RGBX_FLOAT32/g
s/RGB9_E5_FLOAT\b/R9G9B9E5_FLOAT/g
s/R11_G11_B10_FLOAT\b/R11G11B10_FLOAT/g
s/INTENSITY_FLOAT16\b/I_FLOAT16/g
s/INTENSITY_FLOAT32\b/I_FLOAT32/g

v2: removed a few redundant/no-op substitutions

Reviewed-by: Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agomesa: rename format_(un)pack.c functions to match format names (pt. 2)
Brian Paul [Sat, 22 Mar 2014 18:13:20 +0000 (12:13 -0600)]
mesa: rename format_(un)pack.c functions to match format names (pt. 2)

sed commands:
s/ABGR2101010\b/R10G10B10A2_UNORM/g
s/XRGB2101010_UNORM\b/B10G10R10X2_UNORM/g
s/XBGR16161616_UNORM\b/RGBX_UNORM16/g
s/ABGR2101010\b/R10G10B10A2_UNORM/g
s/I8\b/I_UNORM8/g
s/I16\b/I_UNORM16/g

Reviewed-by: Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agomesa: rename format_(un)pack.c functions to match format names (pt. 1)
Brian Paul [Sat, 22 Mar 2014 18:13:20 +0000 (12:13 -0600)]
mesa: rename format_(un)pack.c functions to match format names (pt. 1)

sed commands:
s/RGBA8888\b/A8B8G8R8_UNORM/g
s/RGBA8888_REV\b/R8G8B8A8_UNORM/g
s/ARGB8888\b/B8G8R8A8_UNORM/g
s/ARGB8888_REV\b/A8R8G8B8_UNORM/g
s/RGBA8888\b/X8B8G8R8_UNORM/g
s/RGBA8888_REV\b/R8G8B8X8_UNORM/g
s/XRGB8888\b/B8G8R8X8_UNORM/g
s/XRGB8888_REV\b/X8R8G8B8_UNORM/g
s/RGB888\b/BGR_UNORM8/g
s/BGR888\b/RGB_UNORM8/g
s/RGB565\b/B5G6R5_UNORM/g
s/RGB565_REV\b/R5G6B5_UNORM/g
s/ARGB4444\b/B4G4R4A4_UNORM/g
s/ARGB4444_REV\b/A4R4G4B4_UNORM/g
s/RGBA5551\b/A1B5G5R5_UNORM/g
s/ARGB1555\b/B5G5R5A1_UNORM/g
s/ARGB1555_REV\b/A1R5G5B5_UNORM/g
s/AL44\b/L4A4_UNORM/g
s/AL88\b/L8A8_UNORM/g
s/AL88_REV\b/A8L8_UNORM/g
s/AL1616\b/L16A16_UNORM/g
s/AL1616_REV\b/A16L16_UNORM/g
s/RGB332\b/B2G3R3_UNORM/g
s/A8\b/A_UNORM8/g
s/A16\b/A_UNORM16/g
s/L8\b/L_UNORM8/g
s/L16\b/L_UNORM16/g
s/L8\b/I_UNORM8/g
s/L16\b/I_UNORM16/g
s/R8\b/R_UNORM8/g
s/GR88\b/R8G8_UNORM/g
s/RG88\b/G8R8_UNORM/g
s/R16\b/R_UNORM16/g
s/GR1616\b/R16G16_UNORM/g
s/RG1616\b/G16R16_UNORM/g
s/ARGB2101010\b/B10G10R10A2_UNORM/g

Reviewed-by: Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agollvmpipe: Fix llvmpipe_create_gs_state.
Zack Rusin [Wed, 26 Mar 2014 16:08:25 +0000 (16:08 +0000)]
llvmpipe: Fix llvmpipe_create_gs_state.

Revert unintended behaviour change from commit
b995a010e688bc4d4557e973e5e28091c378e881.

Tested-by: José Fonseca <jfonseca@vmware.com>
10 years agost/omx/dec: fix possible segfault at eos
Christian König [Fri, 14 Mar 2014 12:59:19 +0000 (13:59 +0100)]
st/omx/dec: fix possible segfault at eos

Signed-off-by: Christian König <christian.koenig@amd.com>
10 years agomapi/glapi: Use ElementTree instead of libxml2.
José Fonseca [Mon, 24 Mar 2014 15:41:08 +0000 (15:41 +0000)]
mapi/glapi: Use ElementTree instead of libxml2.

It is quite hard to meet the dependency of the libxml2 python bindings
outside Linux, and in particularly on MacOSX; whereas ElementTree is
part of Python's standard library.  ElementTree is more limited than
libxml2: no DTD verification, defaults from DTD, or XInclude support,
but none of these limitations is serious enough to justify using
libxml2.

In fact, it was easier to refactor the code to use ElementTree than to
try to get libxml2 python bindings.

In the process, gl_item_factory class was refactored so that there is
one method for each kind of object to be created, as it simplifies
things substantially.

I confirmed that precisely the same output is generated for GL/GLX/GLES.

v2: Remove m4/ax_python_module.m4 as suggested by Matt Turner.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomapi/glapi: Remove glX_doc.py.
José Fonseca [Wed, 26 Mar 2014 12:20:01 +0000 (12:20 +0000)]
mapi/glapi: Remove glX_doc.py.

As suggested by Ian Romanick, given it's no longer used.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agost/mesa: fix sampler view handling with shared textures v4
Christian König [Sun, 23 Mar 2014 16:01:38 +0000 (17:01 +0100)]
st/mesa: fix sampler view handling with shared textures v4

Release the references to the sampler views before
destroying the pipe context.

v2: remove TODO and unrelated change
v3: move to st_texture.[ch], rename callback, add comment
v4: fix rebase mess up and add further cleanups

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: "10.0 10.1" <mesa-stable@lists.freedesktop.org>
10 years agogallivm: fix no-op n:n lp_build_resize()
Roland Scheidegger [Tue, 25 Mar 2014 00:52:03 +0000 (01:52 +0100)]
gallivm: fix no-op n:n lp_build_resize()

This can get called in some circumstances if both src type and dst type
have same width (seen with float32->unorm32). While this particular case
was bogus anyway let's just fix that as it can work trivially (due to the
way it was called it actually worked anyway apart from the assert).

Reviewed-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agoi965: For fast color clears, only check the color of live channels.
Kevin Rogovin [Tue, 25 Mar 2014 06:37:16 +0000 (08:37 +0200)]
i965: For fast color clears, only check the color of live channels.

When deciding if a clear color is suitable for fast clear,
take into account if a color channel is active in the
buffer format.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Set Broadwell MOCS values everywhere it's possible.
Kenneth Graunke [Wed, 5 Mar 2014 00:30:28 +0000 (16:30 -0800)]
i965: Set Broadwell MOCS values everywhere it's possible.

This patch introduces two pre-canned MOCS values: BDW_MOCS_WB
(write-back, all caches) and BDW_MOCS_WT (write-through, all caches).

We use write-through caching for render targets, and write-back for
all other data.  (At least on Haswell, I believe write-back LLC/eLLC
didn't work for scan-out buffers, while write-through did.)

No performance analysis has been done on the impact of this patch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Eric Anholt <eric@anholt.net>
10 years agomesa: In core profile, refuse to draw unless a VAO is bound.
Kenneth Graunke [Thu, 20 Mar 2014 18:53:16 +0000 (11:53 -0700)]
mesa: In core profile, refuse to draw unless a VAO is bound.

Core profile requires a non-default VAO to be bound.  Currently, calls
to glVertexAttribPointer raise INVALID_OPERATION unless a VAO is bound,
and we never actually get any vertex data set.  Trying to draw without
any vertex data can only cause problems.  In i965, it causes a crash.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76400
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
10 years agoRevert "build: llvm libs may not be in system search path, add rpath"
Ilia Mirkin [Mon, 17 Mar 2014 13:41:15 +0000 (09:41 -0400)]
Revert "build: llvm libs may not be in system search path, add rpath"

This reverts commit d9b983519c63b9072677364a6e399d213a1855e5.

Unfortunately it seems like rpath is evaluated before LD_LIBRARY_PATH,
so this breaks e.g. steam, as well as any other user of that env var,
if the llvm path happens to be where other libs also reside.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76082
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agoRevert "mesa: Fix format matching checks for GL_INTENSITY* internalformats."
Chris Forbes [Tue, 25 Mar 2014 21:03:38 +0000 (10:03 +1300)]
Revert "mesa: Fix format matching checks for GL_INTENSITY* internalformats."

This reverts commit 40d7b5195351d3e4199e7a840615a595a6dbaefc.

10 years agomesa: move GLbitfield any_valid_stages declaration before code
Brian Paul [Tue, 25 Mar 2014 19:32:59 +0000 (13:32 -0600)]
mesa: move GLbitfield any_valid_stages declaration before code

To fix MSVC build.

10 years agoglsl: Clean up "unused parameter" warnings
Ian Romanick [Wed, 12 Mar 2014 22:32:48 +0000 (15:32 -0700)]
glsl: Clean up "unused parameter" warnings

../../src/glsl/ir_constant_expression.cpp:486:1: warning: unused parameter 'variable_context' [-Wunused-parameter]
../../src/glsl/ir_constant_expression.cpp:1633:1: warning: unused parameter 'variable_context' [-Wunused-parameter]
../../src/glsl/ir_constant_expression.cpp:1752:1: warning: unused parameter 'variable_context' [-Wunused-parameter]
../../src/glsl/ir_constant_expression.cpp:1761:1: warning: unused parameter 'variable_context' [-Wunused-parameter]
../../src/glsl/ir_constant_expression.cpp:1769:1: warning: unused parameter 'variable_context' [-Wunused-parameter]

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
10 years agoglsl: Minor clean ups in constant_referenced
Ian Romanick [Wed, 12 Mar 2014 22:30:59 +0000 (15:30 -0700)]
glsl: Minor clean ups in constant_referenced

These could probably be squashed into one of the previous commits.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
10 years agoglsl: Remove ir_dereference::constant_referenced
Ian Romanick [Wed, 12 Mar 2014 22:14:12 +0000 (15:14 -0700)]
glsl: Remove ir_dereference::constant_referenced

All of the functionality is implemented in a private function in the one
file where it is used.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
10 years agoglsl: Fold implementation of ir_dereference_array::constant_referenced into wrapper
Ian Romanick [Wed, 12 Mar 2014 22:10:59 +0000 (15:10 -0700)]
glsl: Fold implementation of ir_dereference_array::constant_referenced into wrapper

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
10 years agoglsl: Fold implementation of ir_dereference_record::constant_referenced into wrapper
Ian Romanick [Wed, 12 Mar 2014 22:01:12 +0000 (15:01 -0700)]
glsl: Fold implementation of ir_dereference_record::constant_referenced into wrapper

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
10 years agoglsl: Fold implementation of ir_dereference_variable::constant_referenced into wrapper
Ian Romanick [Wed, 12 Mar 2014 21:55:31 +0000 (14:55 -0700)]
glsl: Fold implementation of ir_dereference_variable::constant_referenced into wrapper

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
10 years agoglsl: Add wrapper function that calls ir_dereference::constant_referenced
Ian Romanick [Wed, 12 Mar 2014 21:38:42 +0000 (14:38 -0700)]
glsl: Add wrapper function that calls ir_dereference::constant_referenced

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
10 years agoglsl: Group all of the constant_referenced functions together
Ian Romanick [Wed, 12 Mar 2014 21:24:03 +0000 (14:24 -0700)]
glsl: Group all of the constant_referenced functions together

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
10 years agoi965: fix dma_buf import with non-zero offset.
Gwenole Beauchesne [Mon, 10 Mar 2014 15:55:21 +0000 (16:55 +0100)]
i965: fix dma_buf import with non-zero offset.

Fix eglCreateImage() from a packed dma_buf surface with a non-zero offset
to pixels data. In particular, this fixes support for planar YUV surfaces
when they are individually mapped on a per-plane basis, i.e. when the
OES_EGL_image_external is not used and user application wants to use its
own shader code for composition, or processing on individual plane (OCL).

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa/sso: Implement ValidateProgramPipeline
Gregory Hainaut [Sat, 29 Jun 2013 02:30:44 +0000 (19:30 -0700)]
mesa/sso: Implement ValidateProgramPipeline

Implementation note:
I don't use context for ralloc (don't know how).

The check on PROGRAM_SEPARABLE flags is also done when the pipeline
isn't bound.  It doesn't make any sense in a DSA style API.

Maybe we could replace _mesa_validate_program by
_mesa_validate_program_pipeline.  For example we could recreate a dummy
pipeline object.  However the new function checks also the
TEXTURE_IMAGE_UNIT number not sure of the impact.

V2:
Fix memory leak with ralloc_strdup
Formatting improvement

V3 (idr):
* Actually fix the leak of the InfoLog. :)
* Directly generate logs in to gl_pipeline_object::InfoLog via
  ralloc_asprintf isntead of using a temporary buffer.
* Split out from previous uber patch.
* Change spec references to include section numbers, etc.
* Fix a bug in checking that a different program isn't active in a stage
  between two stages that have the same program.  Specifically,

 if (pipe->CurrentVertexProgram->Name == pipe->CurrentGeometryProgram->Name &&
     pipe->CurrentGeometryProgram->Name != pipe->CurrentVertexProgram->Name)

should have been

 if (pipe->CurrentVertexProgram->Name == pipe->CurrentFragmentProgram->Name &&
     pipe->CurrentGeometryProgram->Name != pipe->CurrentVertexProgram->Name)

v4 (idr): Rework to use CurrentProgram array in loops.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa/sso: Add _mesa_sampler_uniforms_pipeline_are_valid
Gregory Hainaut [Sat, 29 Jun 2013 02:26:27 +0000 (19:26 -0700)]
mesa/sso: Add _mesa_sampler_uniforms_pipeline_are_valid

This is much like _mesa_sampler_uniforms_are_valid, but it operates
across an entire pipeline object.

This function differs from _mesa_sampler_uniforms_are_valid in that it
directly creates the gl_pipeline_object::InfoLog instead of writing to
some temporary buffer.

This was originally included in another patch, but it was split out by
Ian Romanick.

v2 (idr): Fix the loop bounds.  shProg isn't an array, so
ARRAY_SIZE(shProg) was 1, so only the vertex program was validated.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa/sso: Add gl_pipeline_object::InfoLog support
Gregory Hainaut [Sat, 29 Jun 2013 02:22:15 +0000 (19:22 -0700)]
mesa/sso: Add gl_pipeline_object::InfoLog support

V2 (idr):
* Keep the behavior of other info logs in Mesa: and empty info log
  reports a GL_INFO_LOG_LENGTH of zero.
* Use a NULL pointer to denote an empty info log.
* Split out from previous uber patch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa/sso: Implement GL_PROGRAM_PIPELINE_BINDING for glGet
Gregory Hainaut [Fri, 3 May 2013 17:44:14 +0000 (19:44 +0200)]
mesa/sso: Implement GL_PROGRAM_PIPELINE_BINDING for glGet

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa/sso: Implement _mesa_BindProgramPipeline
Gregory Hainaut [Fri, 3 May 2013 17:44:13 +0000 (19:44 +0200)]
mesa/sso: Implement _mesa_BindProgramPipeline

Test become green in piglit:

The updated ext_transform_feedback-api-errors:useprogstage_noactive useprogstage_active bind_pipeline
arb_separate_shader_object-GetProgramPipelineiv
arb_separate_shader_object-IsProgramPipeline

For the moment I reuse Driver.UseProgram but I guess it will be better
to create a UseProgramStages functions. Opinion is welcome

V2: formatting & rename

V3 (idr):
* Change spec references to core OpenGL versions instead of issues in the
  extension spec.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa/sso: Implement _mesa_UseProgramStages
Gregory Hainaut [Sat, 29 Jun 2013 00:59:55 +0000 (17:59 -0700)]
mesa/sso: Implement _mesa_UseProgramStages

Now arb_separate_shader_object-GetProgramPipelineiv should pass.

V3 (idr):
* Change spec references to core OpenGL versions instead of issues in
  the extension spec.
* Split out from previous uber patch.

v4 (idr): Use _mesa_has_geometry_shaders in _mesa_UseProgramStages to
detect availability of geometry shaders.

v5 (idr): Whitespace cleanup, use _mesa_lookup_shader_program_err
instead of open-coding it again, and update some comments at the end of
_mesa_UseProgramStages.  All suggested by Eric.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa/sso: Add gl_pipeline_object parameter to _mesa_use_shader_program
Gregory Hainaut [Sat, 29 Jun 2013 00:18:35 +0000 (17:18 -0700)]
mesa/sso: Add gl_pipeline_object parameter to _mesa_use_shader_program

Extend use_shader_program to support a different target. Allow to reuse the
function to update the pipeline state. Note I bypass the flush when target
isn't current. Maybe it would be better to create a new UseProgramStages
driver function

This was originally included in another patch, but it was split out by
Ian Romanick.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa/sso: Update meta to save and restore SSO state.
Gregory Hainaut [Fri, 3 May 2013 17:44:11 +0000 (19:44 +0200)]
meta/sso: Update meta to save and restore SSO state.

save and restore _Shader/Pipeline binding point. Rational we don't want any
conflict when the program will be unattached.

V2: formatting improvement

V3 (idr):
* Build fix.  The original patch added calls to _mesa_use_shader_program
  with 4 parameters, but the fourth parameter isn't added to that
  function until a much later patch.  Just drop that parameter for now.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa/sso: rename Shader to the pointer _Shader
Gregory Hainaut [Fri, 3 May 2013 17:44:10 +0000 (19:44 +0200)]
mesa/sso: rename Shader to the pointer _Shader

Basically a sed but shaderapi.c and get.c.
get.c => GL_CURRENT_PROGAM always refer to the "old" UseProgram behavior
shaderapi.c => the old api stil update the Shader object directly

V2: formatting improvement

V3 (idr):
* Rebase fixes after a block of code was moved from ir_to_mesa.cpp to
  shaderapi.c.
* Trivial reformatting.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa/sso: replace Shader binding point with _Shader
Gregory Hainaut [Fri, 28 Jun 2013 21:33:54 +0000 (14:33 -0700)]
mesa/sso: replace Shader binding point with _Shader

To avoid NULL pointer check a default pipeline object is installed in
_Shader when no program is current

The spec say that UseProgram/UseShaderProgramEXT/ActiveProgramEXT got an
higher priority over the pipeline object. When default program is
uninstall, the pipeline is used if any was bound.

Note: A careful rename need to be done now...

V2: formating improvement

V3 (idr):
* Build fix.  The original patch added calls to _mesa_use_shader_program
  with 4 parameters, but the fourth parameter isn't added to that
  function until a much later patch.  Just drop that parameter for now.
* Trivial reformatting.
* Updated comment of gl_context::_Shader

v4 (idr): Reformat spec quotations to look like spec quotations.  Update
comments describing what gl_context::_Shader can point to.  Bot
suggested by Eric.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agollvmpipe: Simplify vertex and geometry shaders.
José Fonseca [Fri, 14 Mar 2014 17:01:05 +0000 (17:01 +0000)]
llvmpipe: Simplify vertex and geometry shaders.

Eliminate lp_vertex_shader, as it added nothing over draw_vertex_shader.

Simplify lp_geometry_shader, as most of the incoming state is unneeded.
(We could also just use draw_geometry_shader if we were willing to peek
inside the structure.)

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
10 years agodraw: Duplicate TGSI tokens in draw_pipe_pstipple module.
José Fonseca [Fri, 14 Mar 2014 16:57:34 +0000 (16:57 +0000)]
draw: Duplicate TGSI tokens in draw_pipe_pstipple module.

As done in draw_pipe_aaline and draw_pipe_aapoint modules.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
Cc: "10.0 10.1" <mesa-stable@lists.freedesktop.org>
10 years agohaiku: Fix build through scons corrections and viewport fixes
Alexander von Gluck IV [Wed, 19 Mar 2014 00:58:01 +0000 (00:58 +0000)]
haiku: Fix build through scons corrections and viewport fixes

* Add HAVE_PTHREAD, we do have pthread support wrappers now for
  non-native Haiku threaded applications.
* Viewport changed behavior recently breaking the build.
  We fix this by looking at the gl_context ViewportArray
  (Thanks Brian for the idea)

Acked-by: Brian Paul <brianp@vmware.com>
10 years agoi965: For color clears, only disable writes to components that exist.
Kenneth Graunke [Fri, 21 Mar 2014 10:47:16 +0000 (03:47 -0700)]
i965: For color clears, only disable writes to components that exist.

The SIMD16 replicated FB write message only works if we don't need the
color calculator to mask our framebuffer writes.  Previously, we bailed
on it if color_mask wasn't <true, true, true, true>.  However, this was
needlessly strict for formats with fewer than four components - only the
components that actually exist matter.

WebGL Aquarium attempts to clear a BGRX texture with the ColorMask set
to <true, true, true, false>.  This will work perfectly fine with the
replicated data message; we just bailed unnecessarily.

Improves performance of WebGL Aquarium on Iris Pro (at 1920x1080) by
abound 50%, and Bay Trail (at 1366x768) by over 70% (using Chrome 24).

v2: Use _mesa_format_has_color_component() to properly handle ALPHA
    formats (and generally be less fragile).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Dylan Baker <baker.dylan.c@gmail.com>
10 years agomesa: Skip clearing color buffers when color writes are disabled.
Kenneth Graunke [Fri, 21 Mar 2014 22:58:02 +0000 (15:58 -0700)]
mesa: Skip clearing color buffers when color writes are disabled.

WebGL Aquarium in Chrome 24 actually hits this.

v2: Move to core Mesa (wisely suggested by Ian); only consider
    components which actually exist.

v3: Use _mesa_format_has_color_component to determine whether components
    actually exist, fixing alpha format handling.

v4: Add a comment, as requested by Brian.  No actual code changes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Dylan Baker <baker.dylan.c@gmail.com>
10 years agomesa: Introduce a _mesa_format_has_color_component() helper.
Kenneth Graunke [Mon, 24 Mar 2014 08:16:57 +0000 (01:16 -0700)]
mesa: Introduce a _mesa_format_has_color_component() helper.

When considering color write masks, we often want to know whether an
RGBA component actually contains any meaningful data.  This function
provides an easy way to answer that question, and handles luminance,
intensity, and alpha formats correctly.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Dylan Baker <baker.dylan.c@gmail.com>
10 years agoi965: Fix compiler warning about signed/unsigned.
Eric Anholt [Mon, 24 Mar 2014 18:16:38 +0000 (11:16 -0700)]
i965: Fix compiler warning about signed/unsigned.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/gen8: Change the winsys MSAA blits from blorp to meta.
Eric Anholt [Thu, 13 Feb 2014 19:03:49 +0000 (11:03 -0800)]
i965/gen8: Change the winsys MSAA blits from blorp to meta.

This gets us equivalent code paths on BDW and pre-BDW, except for stencil
(where we don't have MSAA stencil resolve code yet)

Improves MSAA-forced citybench by 7.94496% +/- 2.38429% (n=16).  Reduces
DRI2 MSAA glxgears performance by -12.3559% +/- 1.52845% (n=9).

v2: Move the new meta code to brw_meta_updownsample.c, name it
    brw_meta_updownsample(), add a comment about
    intel_rb_storage_first_mt_slice(), and rename that function and move
    the RB generation into it (review ideas by Ken).
v3: Fix 2 src vs dst pasteos in previous change.
v4: Skip this path pre-gen8 for now, until we can analyze the glxgears
    performance delta some more.

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