mesa.git
10 years agoi965: Fix predicated-send-based discards with MRT.
Eric Anholt [Tue, 4 Mar 2014 23:12:40 +0000 (15:12 -0800)]
i965: Fix predicated-send-based discards with MRT.

We need the header setup to not be predicated on which pixels are
undiscarded.  I'm not sure originally if I had thought that the mask
disable implied predicate disable, or if I had just misread the mask
disable as predicate disable.  Either way, I know I had spent more time
thinking about this in the gen8 generator than the gen7 generator.

Plus, it turns out that I had mis-implemented the "the GPU will use the
predicate unless this header is present" comment, by skipping setting up
the pixel mask when the header was present.

Fixes GPU hangs in piglit glsl-fs-discard-mrt, Trine, Trine 2 and
preusmably MLL.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75207
Tested-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoconfigure: Fix bashism.
Eric Anholt [Tue, 4 Mar 2014 22:43:16 +0000 (14:43 -0800)]
configure: Fix bashism.

/bin/sh defaults to dash on debian.

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodocs: update 10.2 release notes
Andreas Boll [Wed, 5 Mar 2014 21:12:07 +0000 (22:12 +0100)]
docs: update 10.2 release notes

10 years agomesa: remove remaining uses of _glthread_GetID()
Brian Paul [Tue, 4 Mar 2014 22:24:16 +0000 (15:24 -0700)]
mesa: remove remaining uses of _glthread_GetID()

It was really only used in the radeon driver for a debug printf.
And evidently, libGL.so referenced it just to work around some sort
of linker issue.

This patch removes the two calls to the function and the function
itself.

Fixes undefined _glthread_GetID symbol in libGL reported by 'nm'.
Though, the missing symbol doesn't cause any issues on my system but
it does cause glxinfo to fail on one of our test systems.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agomesa: new init_teximage_fields_ms() function to init MS texture images
Brian Paul [Tue, 4 Mar 2014 16:11:32 +0000 (09:11 -0700)]
mesa: new init_teximage_fields_ms() function to init MS texture images

Before, it was kind of ugly to set the multisample fields with
assignments after we called _mesa_init_teximage_fields().

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoWIP: freedreno/a3xx: incorrect scissor for binning pass
Rob Clark [Wed, 5 Mar 2014 16:29:45 +0000 (11:29 -0500)]
WIP: freedreno/a3xx: incorrect scissor for binning pass

If scissor optimization is used (to avoid bringing scissored portions of
the render target into GMEM and then back out to system memory) in
combination with hw binning pass, the result would be a scissor mismatch
between binning pass and rendering pass.  This would cause rendering
bugs in some scenarios with (for example) gnome-shell.

I would have expected that simply using the correct screen-scissor
during the binning pass would be enough, but seems like there is
something else missing.  So for now disable binning pass if scissor
optimization is used.

10 years agoi965: Mark invariants in backend_visitor as constants
Topi Pohjolainen [Tue, 18 Feb 2014 20:27:42 +0000 (22:27 +0200)]
i965: Mark invariants in backend_visitor as constants

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
10 years agoi965: Merge resolving of shader program source
Topi Pohjolainen [Tue, 18 Feb 2014 20:50:13 +0000 (22:50 +0200)]
i965: Merge resolving of shader program source

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
10 years agoi965: Merge initialisation of backend_visitor
Topi Pohjolainen [Fri, 14 Feb 2014 09:54:02 +0000 (11:54 +0200)]
i965: Merge initialisation of backend_visitor

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
10 years agoi965/wm: Use resolved miptree consistently in surface setup
Topi Pohjolainen [Wed, 12 Feb 2014 12:16:59 +0000 (14:16 +0200)]
i965/wm: Use resolved miptree consistently in surface setup

Most of the logic refers to the local variable 'mt' directly but
a few cases use 'intelObj->mt' instead. These are the same for
now but will be different once stencil miptree gets used.

v2 (Ian): fixed also indentation in surrounding lines

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
10 years agoi965/vec4: Mark invariant members as constants in vec4_visitor
Topi Pohjolainen [Sat, 15 Feb 2014 08:26:09 +0000 (10:26 +0200)]
i965/vec4: Mark invariant members as constants in vec4_visitor

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
10 years agoi965: Mark sources for offset getters as constants
Topi Pohjolainen [Tue, 18 Feb 2014 17:26:27 +0000 (19:26 +0200)]
i965: Mark sources for offset getters as constants

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
10 years agodocs: Import 10.1 release notes, add news item.
Ian Romanick [Wed, 5 Mar 2014 07:31:35 +0000 (09:31 +0200)]
docs: Import 10.1 release notes, add news item.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agonv50,nvc0: add 11f_11f_10f vertex support
Ilia Mirkin [Sat, 1 Mar 2014 03:11:49 +0000 (22:11 -0500)]
nv50,nvc0: add 11f_11f_10f vertex support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agoi965: Implement ARB_stencil_texturing on Gen8+.
Kenneth Graunke [Mon, 24 Feb 2014 05:59:25 +0000 (21:59 -0800)]
i965: Implement ARB_stencil_texturing on Gen8+.

On earlier hardware, we had to implement math in the shader to translate
Y-tiled or untiled coordinates to W-tiled coordinates (which is what
BLORP does today in order to texture from stencil buffers).

On Broadwell, we can simply state that it's W-tiled in SURFACE_STATE,
and adjust the pitch.  This is much easier.

In the surface state code, I chose to handle the "should we sample depth
or stencil?" question separately from the setup for sampling from
stencil.  This should make it work with the BindRenderbufferTexImage
hook as well, and hopefully be reusable for GL_ARB_texture_stencil8
someday.

v2: Update docs/GL3.txt (caught by Matt).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa: Add core API support for GL_ARB_stencil_texturing (from 4.3).
Kenneth Graunke [Mon, 24 Feb 2014 05:59:24 +0000 (21:59 -0800)]
mesa: Add core API support for GL_ARB_stencil_texturing (from 4.3).

While the GL_ARB_stencil_texturing extension does not allow the creation
of stencil textures, it does allow shaders to sample stencil values
stored in packed depth/stencil textures.

Specifically, applications can call glTexParameter* with a pname of
GL_DEPTH_STENCIL_TEXTURE_MODE and value of either GL_DEPTH_COMPONENT or
GL_STENCIL_INDEX to select which component they wish to sample.  The
default value is GL_DEPTH_COMPONENT (for traditional depth sampling).

Shaders should use an unsigned integer sampler (presumably usampler2D)
to access stencil data.  Otherwise, results are undefined.  Using shadow
samplers with GL_STENCIL_INDEX selected also is undefined behavior.

This patch creates a new gl_texture_object field, StencilSampling, to
indicate that stencil should be sampled rather than depth.  (I chose to
use a boolean since I figured it would be more convenient for drivers.)
It also introduces the [Get]TexParameter code to get and set the value,
and of course the extension plumbing.

v2: Also consider textures incomplete when sampling stencil with
    non-NEAREST min/mag filters (caught by Eric Anholt).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoradeon/uvd: fix typo in documentation
Dieter Nützel [Tue, 4 Mar 2014 22:49:01 +0000 (17:49 -0500)]
radeon/uvd: fix typo in documentation

s/grap/grab/

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodri: Require libudev-dev for building DRI on Linux.
Eric Anholt [Thu, 30 Jan 2014 18:19:44 +0000 (10:19 -0800)]
dri: Require libudev-dev for building DRI on Linux.

The loader infrastructure for everything but DRI2 requires that udev be
present, so we can figure out an appropriate driver from the fd.  We don't
have a portable solution yet, but presumably it will have similar lookup
based on the device node.

It will also be even more required for krh's udev-based hwdb support,
which lets us have a loader that actually loads DRI drivers not included
in the loader's source distribution.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75212
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoclover: Use correct LLVM version in #if for DataLayout construction
Tom Stellard [Tue, 4 Mar 2014 15:22:59 +0000 (10:22 -0500)]
clover: Use correct LLVM version in #if for DataLayout construction

Spotted by Michel Dänzer.

10 years agotranslate: fix buffer overflows
Zack Rusin [Tue, 4 Mar 2014 04:09:58 +0000 (23:09 -0500)]
translate: fix buffer overflows

Because in draw we always inject position at slot 0 whenever
fragment shader would take the maximum number of inputs (32) it
meant that we had PIPE_MAX_ATTRIBS + 1 slots to translate, which
meant that we were crashing with fragment shaders that took
the maximum number of attributes as inputs. The actual max number
of attributes we need to translate thus is PIPE_MAX_ATTRIBS + 1.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Matthew McClure <mcclurem@vmware.com>
10 years agodraw/llvm: fix generation of the VS with GS present
Zack Rusin [Tue, 4 Mar 2014 03:53:51 +0000 (22:53 -0500)]
draw/llvm: fix generation of the VS with GS present

draw_current_shader_* functions return a final output when considering
both the geometry shader and the vertex shader. But when code generating
vertex shader we can not be using output slots from the geometry shader
because, obviously, those can be completely different. This fixes a
number of very non-obvious crashes.
A side-effect of this bug was that sometimes the vertex shading code
could save some random outputs as position/clip when the geometry
shader was writing them and vertex shader had different outputs at
those slots (sometimes writing garbage and sometimes something correct).

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Matthew McClure <mcclurem@vmware.com>
10 years agomesa: Allow GL_DEPTH_COMPONENT and GL_DEPTH_STENCIL combinations in glTexImage{123}D()
Anuj Phogat [Mon, 3 Mar 2014 22:40:14 +0000 (14:40 -0800)]
mesa: Allow GL_DEPTH_COMPONENT and GL_DEPTH_STENCIL combinations in glTexImage{123}D()

From OpenGL 3.3 spec, page 141:
   "Textures with a base internal format of DEPTH_COMPONENT or DEPTH_STENCIL
    require either depth component data or depth/stencil component data.
    Textures with other base internal formats require RGBA component data.
    The error INVALID_OPERATION is generated if one of the base internal
    format and format is DEPTH_COMPONENT or DEPTH_STENCIL, and the other
    is neither of these values."

Fixes Khronos OpenGL CTS test failure: proxy_textures_invalid_size

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: Use clear_teximage_fields() in place of _mesa_init_teximage_fields()
Anuj Phogat [Mon, 3 Mar 2014 19:40:31 +0000 (11:40 -0800)]
mesa: Use clear_teximage_fields() in place of _mesa_init_teximage_fields()

This patch makes no functional changes to the code.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: Set initial internal format of a texture to GL_RGBA
Anuj Phogat [Sat, 22 Feb 2014 00:58:07 +0000 (16:58 -0800)]
mesa: Set initial internal format of a texture to GL_RGBA

From OpenGL 4.0 spec, page 398:
   "The initial internal format of a texel array is RGBA
    instead of 1. TEXTURE_COMPONENTS is deprecated; always
    use TEXTURE_INTERNAL_FORMAT."

Fixes Khronos OpenGL CTS test failure: proxy_textures_invalid_size

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agoscons: Build with C++11 with LLVM >= 3.5.
Vinson Lee [Sun, 2 Mar 2014 02:31:07 +0000 (18:31 -0800)]
scons: Build with C++11 with LLVM >= 3.5.

Starting with llvm-3.5svn r202574, LLVM expects C+11 mode.

commit f8bc17fadc8f170c1126328d203f0dab78960137
Author: Chandler Carruth <chandlerc@gmail.com>
Date:   Sat Mar 1 06:31:00 2014 +0000

    [C++11] Turn off compiler-based detection of R-value references, relying
    on the fact that we now build in C++11 mode with modern compilers. This
    should flush out any issues. If the build bots are happy with this, I'll
    GC all the code for coping without R-value references.

    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202574 91177308-0d34-0410-b5e6-96231b3b80d8

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
10 years agost/osmesa: check buffer size when searching for buffers
Brian Paul [Sat, 1 Mar 2014 18:16:27 +0000 (11:16 -0700)]
st/osmesa: check buffer size when searching for buffers

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75543
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agoconfigure: s/--with-llvm-shared-libs/--enable-llvm-shared-libs/
José Fonseca [Tue, 4 Mar 2014 14:07:10 +0000 (14:07 +0000)]
configure: s/--with-llvm-shared-libs/--enable-llvm-shared-libs/

`--enable-llvm-shared-libs` option was recently renamed as
`--with-llvm-shared-libs`, but several error messages still mention the
old option, causing confusing.

Trivial.

10 years agoc11/threads: Don't implement thrd_current on Windows.
José Fonseca [Mon, 3 Mar 2014 15:06:19 +0000 (15:06 +0000)]
c11/threads: Don't implement thrd_current on Windows.

GetCurrentThread() returns a pseudo-handle (a constant which only makes
sense when used within the calling thread) and not a real handle.

DuplicateHandle() will return a real handle, but it will create a new
handle every time we call.  Calling DuplicateHandle() here means we will
leak handles, which can cause serious problems.

In short, the Windows implementation of thrd_t needs a thorough make
over, and it won't be pretty.  It looks like C11 committee
over-simplified things: it would be much better to have seperate objects
for threads and thread IDs like C++11 does.

For now, just comment out the thrd_current() implementation, so we get
build errors if anybody tries to use it.

Thanks to Brian Paul for spotting and diagnosing this problem.

Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomapi/u_thread: Use GetCurrentThreadId
José Fonseca [Mon, 3 Mar 2014 14:55:41 +0000 (14:55 +0000)]
mapi/u_thread: Use GetCurrentThreadId

u_thread_self() expects thrd_current() to return a unique numeric ID
for the current thread, but this is not feasible on Windows.

Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agoc11/threads: Fix nano to milisecond conversion.
José Fonseca [Mon, 3 Mar 2014 14:53:30 +0000 (14:53 +0000)]
c11/threads: Fix nano to milisecond conversion.

Per https://gist.github.com/yohhoy/2223710/#comment-710118

Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
10 years agor600g: implement edge flags
Marek Olšák [Mon, 3 Mar 2014 01:20:45 +0000 (02:20 +0100)]
r600g: implement edge flags

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: port color buffer format conversion from radeonsi
Marek Olšák [Sun, 23 Feb 2014 17:46:43 +0000 (18:46 +0100)]
r600g: port color buffer format conversion from radeonsi

r600_translate_colorformat is rewritten to look like radeonsi.
r600_translate_colorswap is shared with radeonsi.
r600_colorformat_endian_swap is consolidated.

This adds some formats which were missing. Future "plain" formats will
automatically be supported.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agoradeonsi: move translate_colorswap to common code
Marek Olšák [Sun, 23 Feb 2014 17:44:46 +0000 (18:44 +0100)]
radeonsi: move translate_colorswap to common code

Also translate the Y__X swizzle.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agoRevert "configure: use enable_dri_glx local variable"
Emil Velikov [Tue, 4 Mar 2014 02:13:48 +0000 (02:13 +0000)]
Revert "configure: use enable_dri_glx local variable"

This reverts commit dfe8cb48fc13587afb2d829c29432c0eacd0aba3.

Accidently pushed this commit, over 1bb23abe065(configure: disable
shared glapi when building xlib powered glx).

10 years agoconfigure: disable shared glapi when building xlib powered glx
Emil Velikov [Thu, 27 Feb 2014 18:03:15 +0000 (18:03 +0000)]
configure: disable shared glapi when building xlib powered glx

With commit 0432aa064b(configure: use shared-glapi when more than one
gl* API is used) we removed "disable shared-glapi when building without
dri" hunk.

In the good old days of classic mesa, dri and xlib-glx were mutually
exclusive thus the hunk made sense.

Currently enable-dri is used as a synonym for a range of things thus
it's more appropriate to handle xlib-glx explicitly.

Fixes a missing symbol '_glapi_Dispatch' in a xlib powered libGL,
build using the following

 ./autogen.sh --enable-xlib-glx --disable-dri --with-gallium-drivers=swrast

Cc: Brian Paul <brianp@vmware.com>
Reported-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agomesa: remove unneeded glthread.c file
Brian Paul [Sat, 1 Mar 2014 17:40:24 +0000 (10:40 -0700)]
mesa: remove unneeded glthread.c file

The _glthread_GetID() function is also defined in mapi_glapi.c

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agomesa: remove empty glthread.h file
Brian Paul [Sat, 1 Mar 2014 17:40:24 +0000 (10:40 -0700)]
mesa: remove empty glthread.h file

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agomesa: remove unused glthread/TSD macros
Brian Paul [Sat, 1 Mar 2014 17:40:24 +0000 (10:40 -0700)]
mesa: remove unused glthread/TSD macros

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agoxlib: remove unneeded context tracking code
Brian Paul [Sat, 1 Mar 2014 17:40:24 +0000 (10:40 -0700)]
xlib: remove unneeded context tracking code

This removes the only use of _glthread_Get/SetTSD(), etc.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agoxlib: simplify context handling
Brian Paul [Sat, 1 Mar 2014 17:21:08 +0000 (10:21 -0700)]
xlib: simplify context handling

Get rid of the fake_glx_context struct.  Now, an XMesaContext is the
same as a GLXContext.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agoxlib: remove unused realglx.[ch] files
Brian Paul [Sat, 1 Mar 2014 17:21:08 +0000 (10:21 -0700)]
xlib: remove unused realglx.[ch] files

At one point in time, the xlib driver could call the real GLX functions.
But that's long dead.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agomesa: remove unused _glthread_*MUTEX() macros
Brian Paul [Sat, 1 Mar 2014 17:21:07 +0000 (10:21 -0700)]
mesa: remove unused _glthread_*MUTEX() macros

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agoglsl: switch to c11 mutex functions
Brian Paul [Sat, 1 Mar 2014 17:21:07 +0000 (10:21 -0700)]
glsl: switch to c11 mutex functions

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agomesa: switch to c11 mutex functions
Brian Paul [Sat, 1 Mar 2014 17:21:07 +0000 (10:21 -0700)]
mesa: switch to c11 mutex functions

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agoxlib: switch to c11 mutex functions
Brian Paul [Sat, 1 Mar 2014 17:21:07 +0000 (10:21 -0700)]
xlib: switch to c11 mutex functions

The _glthread_LOCK/UNLOCK_MUTEX() macros are just wrappers around
the c11 mutex functions.  Let's start getting rid of those wrappers.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agomesa: update packed format layout comments
Brian Paul [Fri, 28 Feb 2014 17:53:59 +0000 (10:53 -0700)]
mesa: update packed format layout comments

Update the comments for the packed formats to accurately reflect the
layout of the bits in the pixel.  For example, for the packed format
MESA_FORMAT_R8G8B8A8, R is in the least significant position while A
is in the most-significant position of the 32-bit word.

v2: also fix MESA_FORMAT_A1B5G5R5_UNORM, per Roland.

10 years agomesa: don't define c99 math functions for MSVC >= 1800
Hans [Sat, 1 Mar 2014 18:28:18 +0000 (11:28 -0700)]
mesa: don't define c99 math functions for MSVC >= 1800

Signed-off-by: Brian Paul <brianp@vmware.com>
Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
10 years agoutil: don't define isfinite(), isnan() for MSVC >= 1800
Hans [Sat, 1 Mar 2014 18:26:09 +0000 (11:26 -0700)]
util: don't define isfinite(), isnan() for MSVC >= 1800

Signed-off-by: Brian Paul <brianp@vmware.com>
Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
10 years agomesa: don't call ctx->Driver.ClearBufferSubData() if size==0
Brian Paul [Mon, 3 Mar 2014 16:59:45 +0000 (09:59 -0700)]
mesa: don't call ctx->Driver.ClearBufferSubData() if size==0

Fixes failed assertion when trying to map zero-length region.

https://bugs.freedesktop.org/show_bug.cgi?id=75660
Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agosoftpipe: use 64-bit arithmetic in softpipe_resource_layout()
Brian Paul [Sat, 1 Mar 2014 19:14:15 +0000 (12:14 -0700)]
softpipe: use 64-bit arithmetic in softpipe_resource_layout()

To avoid 32-bit integer overflow for large textures.  Note: we're
already doing this in llvmpipe.

Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agoNV_vdpau_interop: fix IsSurfaceNV return type
Grigori Goronzy [Sun, 2 Mar 2014 11:57:04 +0000 (12:57 +0100)]
NV_vdpau_interop: fix IsSurfaceNV return type

The spec incorrectly used void as return type, when it should have
been GLboolean. This has now been fixed. According to Nvidia, their
implementation always used GLboolean.

Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agost/vdpau: fix possible NULL dereference
Grigori Goronzy [Sun, 2 Mar 2014 11:57:03 +0000 (12:57 +0100)]
st/vdpau: fix possible NULL dereference

Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agost/omx: always advertise all components
Christian König [Sat, 1 Mar 2014 11:31:20 +0000 (12:31 +0100)]
st/omx: always advertise all components

omx_component_library_Setup should return all entrypoints the library
implements, independent of what is available on the current hardware.

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

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
10 years agoclover: Fix building with latest llvm
Bruno Jiménez [Sun, 2 Mar 2014 21:39:02 +0000 (22:39 +0100)]
clover: Fix building with latest llvm

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoconfigure: Remove more flags from llvm-config
Bruno Jiménez [Sun, 2 Mar 2014 21:39:01 +0000 (22:39 +0100)]
configure: Remove more flags from llvm-config

This way, we are left with only the preprocessor flags and '-std=X'

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoconfigure.ac: consolidate dependencies version check
Fabio Pedretti [Sat, 1 Mar 2014 09:11:12 +0000 (10:11 +0100)]
configure.ac: consolidate dependencies version check

Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoglx/dri2: fix build failure on HURD
Julien Cristau [Sat, 1 Mar 2014 09:11:11 +0000 (10:11 +0100)]
glx/dri2: fix build failure on HURD

Patch from Debian package.

Cc: "10.0 10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agost/dri: add support for dma-buf importer (DRIimage v8)
Dave Airlie [Wed, 18 Dec 2013 00:01:27 +0000 (10:01 +1000)]
st/dri: add support for dma-buf importer (DRIimage v8)

This is just a simple implementation that stores the extra values into the DRIimage
struct and just uses the fd importer. I haven't looked into what is required
to import YUV or deal with the extra parameters.

Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agost/dri: move fourcc->format conversion to a common place
Dave Airlie [Wed, 18 Dec 2013 00:00:46 +0000 (10:00 +1000)]
st/dri: move fourcc->format conversion to a common place

Before I cut-n-paste this a 3rd time lets consolidate it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agomesa: Move MESA_GLSL=dump output to stderr.
Kenneth Graunke [Sat, 1 Mar 2014 08:11:18 +0000 (00:11 -0800)]
mesa: Move MESA_GLSL=dump output to stderr.

i965 recently moved debug printfs to use stderr, including ones which
trigger on MESA_GLSL=dump.  This resulted in scrambled output.

For drivers using ir_to_mesa, print_program was already using stderr,
yet all the code around it was using stdout.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoglsl: Fix broken LRP algebraic optimization.
Kenneth Graunke [Sat, 1 Mar 2014 07:15:49 +0000 (23:15 -0800)]
glsl: Fix broken LRP algebraic optimization.

opt_algebraic was translating lrp(x, 0, a) into add(x, -mul(x, a)).

Unfortunately, this references "x" twice, which is invalid in the IR,
leading to assertion failures in the validator.

Normally, cloning IR solves this.  However, "x" could actually be an
arbitrary expression tree, so copying it could result in huge piles
of wasted computation.  This is why we avoid reusing subexpressions.

Instead, transform it into mul(x, add(1.0, -a)), which is equivalent
but doesn't need two references to "x".

Fixes a regression since d5fa8a95621169, which isn't in any stable
branches.  Fixes 18 shaders in shader-db (bastion and yofrankie).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agofreedreno/a3xx/compiler: overflow in trans_endif
Rob Clark [Sun, 2 Mar 2014 13:48:08 +0000 (08:48 -0500)]
freedreno/a3xx/compiler: overflow in trans_endif

The logic to count number of block outputs was out of sync with the
actual array construction.  But to simplify / make things less fragile,
we can just allocate the arrays for worst case size.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/a3xx/compiler: fix for resolving PHI's
Rob Clark [Sat, 1 Mar 2014 17:06:44 +0000 (12:06 -0500)]
freedreno/a3xx/compiler: fix for resolving PHI's

A value may be assigned on only one side of an if/else.  In this case we
can simply substitute a mov.f32f32.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/lowering: two-sided-color
Rob Clark [Sun, 23 Feb 2014 19:40:41 +0000 (14:40 -0500)]
freedreno/lowering: two-sided-color

Add option to generate fragment shader to emulate two sided color.
Additional inputs are added to shader for BCOLOR's (on corresponding to
each COLOR input).  CMP instructions are used to select whether to use
COLOR or BCOLOR.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/a3xx/compiler: add SSG
Rob Clark [Wed, 26 Feb 2014 19:34:05 +0000 (14:34 -0500)]
freedreno/a3xx/compiler: add SSG

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/a3xx: fix gl_PointSize
Rob Clark [Wed, 26 Feb 2014 17:15:25 +0000 (12:15 -0500)]
freedreno/a3xx: fix gl_PointSize

If vertex writes pointsize, there are a few extra bits we need to turn
on in the cmdstream here and there.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno: resync generated headers
Rob Clark [Wed, 26 Feb 2014 17:04:11 +0000 (12:04 -0500)]
freedreno: resync generated headers

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/a3xx: binning-pass vertex shader variant
Rob Clark [Sat, 22 Feb 2014 15:47:27 +0000 (10:47 -0500)]
freedreno/a3xx: binning-pass vertex shader variant

Now that we have the infrastructure for shader variants, add support to
generate an optimized shader for hw binning pass (with varyings/outputs
other than position/pointsize removed).  This exposes the possibility
that the shader uses fewer constants than what is bound, so we have to
take care to not emit consts beyond what the shader uses, lest we
provoke the wrath of the HLSQ lockup!

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/a3xx: add support for frag coord/face
Rob Clark [Tue, 25 Feb 2014 13:51:30 +0000 (08:51 -0500)]
freedreno/a3xx: add support for frag coord/face

Fixes anything that tries to use gl_FrontFacing/gl_FragCoord.  Also,
face support is needed to emulate two sided color.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/a3xx: fix for unused inputs
Rob Clark [Tue, 25 Feb 2014 13:02:28 +0000 (08:02 -0500)]
freedreno/a3xx: fix for unused inputs

An unused input might not have a register assigned.  We don't want bogus
regid to result in impossibly high max_reg..

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agoi965: Validate (and resolve) all the bound textures.
Chris Forbes [Sat, 22 Feb 2014 05:09:31 +0000 (18:09 +1300)]
i965: Validate (and resolve) all the bound textures.

BRW_MAX_TEX_UNIT is the static limit on the number of textures we
support per-stage, not in total.

Core's `Unit` array is sized by MAX_COMBINED_TEXTURE_IMAGE_UNITS, which
is significantly larger, and across the various shader stages, up to
ctx->Const.MaxCombinedTextureImageUnits elements of it may be actually
used.

Fixes invisible bad behavior in piglit's max-samplers test (although
this escalated to an assertion failure on HSW with texture_view, since
non-immutable textures only have _Format set by validation.)

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Cc: "9.2 10.0 10.1" <mesa-stable@lists.freedesktop.org>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Widen sampler key bitfields for 32 samplers
Chris Forbes [Wed, 26 Feb 2014 18:28:05 +0000 (07:28 +1300)]
i965: Widen sampler key bitfields for 32 samplers

Previously the `high` 16 samplers on Haswell+ would not get sampler
workarounds applied.

Don't bother widening YUV fields, since they're ignored and going away
soon anyway.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agodri/i9*5: correctly calculate the amount of system memory
Emil Velikov [Sat, 22 Feb 2014 03:04:02 +0000 (03:04 +0000)]
dri/i9*5: correctly calculate the amount of system memory

The variable name states megabytes, while we calculate the amount in
kilobytes. Correct this by dividing with the correct amount.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Cc: "10.0 10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agogallium/util: add missing u_math include
Ilia Mirkin [Thu, 27 Feb 2014 06:07:30 +0000 (01:07 -0500)]
gallium/util: add missing u_math include

This is needed for MIN2/MAX2

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agomesa: add unpacking code for MESA_FORMAT_Z32_FLOAT_S8X24_UINT
Brian Paul [Fri, 28 Feb 2014 14:55:04 +0000 (07:55 -0700)]
mesa: add unpacking code for MESA_FORMAT_Z32_FLOAT_S8X24_UINT

Fixes glGetTexImage() when converting from MESA_FORMAT_Z32_FLOAT_S8X24_UINT
to GL_UNSIGNED_INT_24_8.  Hit by the piglit
ext_packed_depth_stencil-getteximage test.

Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglx/apple: Fixed glx context memory leak in case of failure.
Siavash Eliasi [Mon, 10 Feb 2014 09:58:16 +0000 (13:28 +0330)]
glx/apple: Fixed glx context memory leak in case of failure.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Jeremy Huddleston Sequoia: <jeremyhu@apple.com>
10 years agogbm/dri: Fixed buffer object memory leak in case of failure.
Siavash Eliasi [Mon, 10 Feb 2014 09:58:15 +0000 (13:28 +0330)]
gbm/dri: Fixed buffer object memory leak in case of failure.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agor300g/tests: Added missing fclose for FILE resource.
Siavash Eliasi [Mon, 10 Feb 2014 09:58:14 +0000 (13:28 +0330)]
r300g/tests: Added missing fclose for FILE resource.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoi915: Allocate the sys_buffer using _mesa_align_malloc
Ian Romanick [Wed, 26 Feb 2014 20:48:56 +0000 (12:48 -0800)]
i915: Allocate the sys_buffer using _mesa_align_malloc

Though it won't matter on Linux, use _mesa_align_free to release it.
Since i965 doesn't have sys_buffer, I overlooked this in the
GL_ARB_map_buffer_alignment work a few months ago.  Fixes i915 (and
presumably i830) regressions in ARB_map_buffer_range tests and the
failure in arb_map_buffer_alignment-sanity_test.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74960
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi915: Only allow 8 vertex texture units
Ian Romanick [Wed, 26 Feb 2014 20:32:29 +0000 (12:32 -0800)]
i915: Only allow 8 vertex texture units

There's no reason to have more vertex texture units than fragment
texture units on this hardware.  Since increasing the default maximum
number of texture units from 16 to 32, this has triggered some segfault
in i915 driver.  There's probably some array or bitfield that isn't
properly sized now.  This really papers over the bug, but I don't think
I'll lose any sleep over that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74071
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Assert array index on access to vec4_visitor's arrays.
Petri Latvala [Thu, 27 Feb 2014 14:15:05 +0000 (16:15 +0200)]
i965: Assert array index on access to vec4_visitor's arrays.

v2: vec4_visitor::pack_uniform_registers(): Use correct comparison in the
  assert, this->uniforms is already adjusted. Compare the actual value used to
  index uniform_size and uniform_vector_size instead.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Allocate vec4_visitor's uniform_size and uniform_vector_size arrays dynamically.
Petri Latvala [Thu, 27 Feb 2014 14:15:04 +0000 (16:15 +0200)]
i965: Allocate vec4_visitor's uniform_size and uniform_vector_size arrays dynamically.

v2: Don't add function parameters, pass the required size in
prog_data->nr_params.

v3:
- Use the name uniform_array_size instead of uniform_param_count.
- Round up when dividing param_count by 4.
- Use MAX2() instead of taking the maximum by hand.
- Don't crash if prog_data passed to vec4_visitor constructor is NULL

v4: Rebase for current master

v5 (idr): Trivial whitespace change.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71254
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agogbm: export gbm_device_is_format_supported
Marek Chalupa [Thu, 27 Feb 2014 08:23:21 +0000 (09:23 +0100)]
gbm: export gbm_device_is_format_supported

Probably depending on compiler settings, the definition can be hidden,
so undefined reference error can be encountred during linking.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75528
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoconfigure: use enable_dri_glx local variable
Emil Velikov [Thu, 27 Feb 2014 18:20:53 +0000 (18:20 +0000)]
configure: use enable_dri_glx local variable

GLX can be either dri or xlib based, while enable_dri is
used in a variety of contexts.

With enable_dri_glx the context is clearly visible.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoconfigure: enable the drm pipe-loader for non swrast drivers
Emil Velikov [Mon, 24 Feb 2014 22:58:13 +0000 (22:58 +0000)]
configure: enable the drm pipe-loader for non swrast drivers

All hardware drivers including the virtual vmwgfx require
the drm pipe-loader in order to be properly loaded by xa,
gbm and opencl.

Note this does _not_ add support for the above three it only
allows the pipe driver to be loaded by the library.

Eg. GBM will now properly open the pipe-i915 driver, should
one be working on the such hardware.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75453
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoconfigure: error out when building xa only with swrast
Emil Velikov [Mon, 24 Feb 2014 22:58:10 +0000 (22:58 +0000)]
configure: error out when building xa only with swrast

Building to provide accelration using swrast does not make
sense.

Note: update your build script to explicitly mention svga
in the gallium drivers list, if you are building the vmwgfx
xa library.

v2: Update error message to provide more clarify, add an example.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoconfigure: avoid setting variables as empty strings
Emil Velikov [Mon, 24 Feb 2014 22:58:07 +0000 (22:58 +0000)]
configure: avoid setting variables as empty strings

Recent patch converted our logic to use test -n and test -z.
An emptry string variable (empty_str="") return true for both
thus making the check unreliable.

Fix this by correctly setting the variable when applicable.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoconfigure: avoid constantly building megadrivers 'core'
Emil Velikov [Mon, 24 Feb 2014 22:57:59 +0000 (22:57 +0000)]
configure: avoid constantly building megadrivers 'core'

The issue is caused by a thinko that an empty string will be
considered of zero length by 'test'. This is not the case,
thus we were building the 'core' of megadrivers even when no
classic drivers were built.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agor600g/compute: PIPE_CAP_COMPUTE should be false for pre-evergreen GPUs
Tom Stellard [Mon, 24 Feb 2014 21:51:05 +0000 (16:51 -0500)]
r600g/compute: PIPE_CAP_COMPUTE should be false for pre-evergreen GPUs

This prevents clover from using unsupported devices.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
CC: "10.0 10.1" <mesa-stable@lists.freedesktop.org>
10 years agoglsl: Don't vectorize horizontal expressions.
Matt Turner [Sun, 23 Feb 2014 00:35:15 +0000 (16:35 -0800)]
glsl: Don't vectorize horizontal expressions.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75224

10 years agoglsl: Add is_horizontal() method to ir_expression.
Matt Turner [Sun, 23 Feb 2014 00:35:14 +0000 (16:35 -0800)]
glsl: Add is_horizontal() method to ir_expression.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agoglsl: Optimize lrp(x, 0, a) into x - (x * a).
Matt Turner [Mon, 24 Feb 2014 23:00:45 +0000 (15:00 -0800)]
glsl: Optimize lrp(x, 0, a) into x - (x * a).

Helps one program in shader-db:

instructions in affected programs:     96 -> 92 (-4.17%)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Optimize lrp(0, y, a) into y * a.
Matt Turner [Mon, 24 Feb 2014 23:00:44 +0000 (15:00 -0800)]
glsl: Optimize lrp(0, y, a) into y * a.

Helps two programs in shader-db:

instructions in affected programs:     254 -> 234 (-7.87%)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: do depth/stencil format conversion in glGetTexImage
Brian Paul [Thu, 27 Feb 2014 15:36:13 +0000 (08:36 -0700)]
mesa: do depth/stencil format conversion in glGetTexImage

glGetTexImage(GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8) was just
using memcpy() instead of _mesa_unpack_uint_24_8_depth_stencil_row()
to convert texels from the hardware format to the GL format.

Fixes issue reported by David Meng at Intel.  The new piglit
ext_packed_depth_stencil-getteximage test checks for this bug.

Also, add some format/type assertions.  We don't yet handle the
GL_FLOAT_32_UNSIGNED_INT_24_8_REV type.  That should be fixed in
a follow-on patch.

Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
10 years agomesa: fix depth/stencil comments in formats.h
Brian Paul [Thu, 27 Feb 2014 16:11:51 +0000 (09:11 -0700)]
mesa: fix depth/stencil comments in formats.h

10 years agowinsys/svga: Avoid calling drm getparam for max surface size on older kernels
Thomas Hellstrom [Thu, 20 Feb 2014 13:32:07 +0000 (14:32 +0100)]
winsys/svga: Avoid calling drm getparam for max surface size on older kernels

This avoids the kernel driver spewing out errors about the param not being
supported.

Also correct the max surface size used when the kernel does not support the
query.

Reported-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agometa: Drop ctx->API checks.
Kenneth Graunke [Thu, 27 Feb 2014 01:40:43 +0000 (17:40 -0800)]
meta: Drop ctx->API checks.

API is always API_OPENGL_COMPAT (since commit 4e4a537ad55f61a25,
"meta: Push into desktop GL mode when doing meta operations."),
so most of these checks do nothing.

We could instead check save->API to only bother setting/restoring
relevant GL state, but I'm not sure saving a few _mesa_set_enable
calls is worth the complexity.  My understanding is the point of
the ctx->API guards was to avoid raising GL errors.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agometa: Restore API at the end of _mesa_meta_end(), not the start.
Kenneth Graunke [Thu, 27 Feb 2014 06:19:33 +0000 (22:19 -0800)]
meta: Restore API at the end of _mesa_meta_end(), not the start.

In _mesa_meta_begin(), we switch to API_OPENGL_COMPAT, then munge a lot
of state (including some that doesn't exist in the actual API - like
PolygonStipple in API_OPENGL_CORE).

It seems reasonable that in _mesa_meta_end(), we should restore it,
then switch back to the original API.  This at least makes it symmetric.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoutil/u_format: don't crash in util_format_translate if we can't do translation
Roland Scheidegger [Thu, 27 Feb 2014 16:35:08 +0000 (17:35 +0100)]
util/u_format: don't crash in util_format_translate if we can't do translation

Some formats can't be handled - in particular cannot handle ints/uints formats,
which lack the pack_rgba_float/unpack_rgba_float functions. Instead of trying
to call these (and crash) return an error (I'm not sure yet if we should try
to translate such formats too here might not make much sense).

v2: suggested by Jose, use separate checks for pack/unpack of rgba_8unorm and
rgba_float functions (right now if one exists the other should as well).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agoi965: Convert VUE map generation checks to if rather than switch.
Kenneth Graunke [Tue, 25 Feb 2014 20:21:41 +0000 (12:21 -0800)]
i965: Convert VUE map generation checks to if rather than switch.

There are currently only two VUE map layouts: one for Gen4-5, and one
for everything else.  We keep having to add new "case N+1" labels for
every new hardware generation, and so far it's always been the same.

This patch makes it so we only have to do work in the case where
something actually changes.

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