mesa.git
10 years agonouveau: fix fence waiting logic in screen destroy
Ilia Mirkin [Thu, 6 Mar 2014 03:25:55 +0000 (22:25 -0500)]
nouveau: fix fence waiting logic in screen destroy

nouveau_fence_wait has the expectation that an external entity is
holding onto the fence being waited on, not that it is merely held onto
by the current pointer. Fixes a use-after-free in nouveau_fence_wait
when used on the screen's current fence.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75279
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
Cc: "9.2 10.0 10.1" <mesa-stable@lists.freedesktop.org>
10 years agonouveau: add valid range tracking to nouveau_buffer
Ilia Mirkin [Thu, 27 Feb 2014 06:07:51 +0000 (01:07 -0500)]
nouveau: add valid range tracking to nouveau_buffer

This logic is borrowed from the radeon code. The transfer logic will
only get called for PIPE_BUFFER resources, so it shouldn't be necessary
to worry about them becoming render targets.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
10 years agogbm: make 'devices' array static
Julien Cristau [Mon, 3 Mar 2014 16:41:56 +0000 (17:41 +0100)]
gbm: make 'devices' array static

It's only used in this one file as far as I can tell, and exporting a
symbol named 'devices' from a shared library is a recipe for trouble.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoautomake: make clean the correct git_sha1.h.tmp
Emil Velikov [Wed, 5 Mar 2014 13:04:14 +0000 (13:04 +0000)]
automake: make clean the correct git_sha1.h.tmp

When building out of tree, the file ends up dangling which
may result in a binary with the old git sha.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoradeonsi: fix freeing descriptor buffers
Christian König [Sat, 8 Mar 2014 13:52:25 +0000 (14:52 +0100)]
radeonsi: fix freeing descriptor buffers

That structure member is a pointer, so the loop with
the Elements macro only freed up the first entry.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agoradeonsi: fix leaking the bound state on destruction v2
Christian König [Fri, 7 Mar 2014 20:52:51 +0000 (21:52 +0100)]
radeonsi: fix leaking the bound state on destruction v2

v2: rebased on stale pointer fixes

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agoradeonsi: avoid stale state pointers
Christian König [Sat, 8 Mar 2014 13:18:30 +0000 (14:18 +0100)]
radeonsi: avoid stale state pointers

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agoradeonsi: avoid stale pointers in si_delete_shader_selector
Christian König [Sat, 8 Mar 2014 13:16:23 +0000 (14:16 +0100)]
radeonsi: avoid stale pointers in si_delete_shader_selector

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agoRevert "winsys/radeon: if there's VRAM-only usage, keep it"
Marek Olšák [Sat, 8 Mar 2014 15:00:25 +0000 (16:00 +0100)]
Revert "winsys/radeon: if there's VRAM-only usage, keep it"

This reverts commit 67aef6dafa29fed008ea6065c425a6a92a651be9.

It caused GPU hangs. The question is why.

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

10 years agoradeon/vce: fix memory leak
Christian König [Fri, 7 Mar 2014 17:31:40 +0000 (18:31 +0100)]
radeon/vce: fix memory leak

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agoglcpp: Do not remove spaces to preserve locations.
Sir Anthony [Wed, 5 Feb 2014 14:15:56 +0000 (20:15 +0600)]
glcpp: Do not remove spaces to preserve locations.

After preprocessing by glcpp all adjacent spaces were replaced by
single one and glsl parser received column-shifted shader source.
It negatively affected ast location set up and produced wrong error
messages for heavily-spaced shaders.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Change locations from yylloc to appropriate tokens positions.
Sir Anthony [Wed, 5 Feb 2014 15:18:11 +0000 (21:18 +0600)]
glsl: Change locations from yylloc to appropriate tokens positions.

Reviewed-by: Carl Worth <cworth@cworth.org>
10 years agoglsl: Add ast_node method to set location range.
Sir Anthony [Wed, 5 Feb 2014 15:18:10 +0000 (21:18 +0600)]
glsl: Add ast_node method to set location range.

Reviewed-by: Carl Worth <cworth@cworth.org>
10 years agoglsl: Make ast_node location comments more informative.
Sir Anthony [Thu, 6 Feb 2014 16:00:02 +0000 (22:00 +0600)]
glsl: Make ast_node location comments more informative.

Reviewed-by: Carl Worth <cworth@cworth.org>
10 years agoglsl: Extend ast location structure to hande end token position.
Sir Anthony [Wed, 5 Feb 2014 15:18:09 +0000 (21:18 +0600)]
glsl: Extend ast location structure to hande end token position.

Reviewed-by: Carl Worth <cworth@cworth.org>
10 years agoglsl: Update lexers in glsl and glcpp to hande end position of token.
Sir Anthony [Wed, 5 Feb 2014 15:18:08 +0000 (21:18 +0600)]
glsl: Update lexers in glsl and glcpp to hande end position of token.

Reviewed-by: Carl Worth <cworth@cworth.org>
10 years agoscons: Add drivers/common/meta_generate_mipmap.c to src/mesa/SConscript.
Vinson Lee [Sat, 8 Mar 2014 07:39:29 +0000 (23:39 -0800)]
scons: Add drivers/common/meta_generate_mipmap.c to src/mesa/SConscript.

This patch fixes this SCons build error introduced with commit
70e7905608b374f65d1f4b657f8ab61808c76ef6.

build/linux-x86_64-debug/mesa/libmesa.a(driverfuncs.os): In function `_mesa_init_driver_functions':
src/mesa/drivers/common/driverfuncs.c:99: undefined reference to `_mesa_meta_GenerateMipmap'

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
10 years agometa: Support GenerateMipmaps on 1DArray textures.
Kenneth Graunke [Thu, 6 Mar 2014 09:56:53 +0000 (01:56 -0800)]
meta: Support GenerateMipmaps on 1DArray textures.

I don't know how many people care about this case, but it's easy enough
to do, so we may as well.  The tricky part is that for some reason Mesa
stores the number of array slices in Height, not Depth.

I thought the easiest way to handle that here was to make Height = 1
(the actual height), and srcDepth = srcImage->Height.  This requires
some munging when calling _mesa_prepare_mipmap_level, so I created a
wrapper that sorts it out for us.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Use srcWidth/Height/Depth rather than srcImage->Width and such.
Kenneth Graunke [Thu, 6 Mar 2014 09:47:15 +0000 (01:47 -0800)]
meta: Use srcWidth/Height/Depth rather than srcImage->Width and such.

This is equivalent for now, and will differ once we add 1DArray support.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Support GenerateMipmaps on 2DArray textures.
Kenneth Graunke [Thu, 6 Mar 2014 05:02:06 +0000 (21:02 -0800)]
meta: Support GenerateMipmaps on 2DArray textures.

This is largely a matter of looping over the number of slices/layers,
and not minifying depth (presumably that code exists for the unfinished
3D texture support).

Normally, I would have made the loop over array slices the outermost
loop.  I suspect that would make it trickier to support 3D textures
someday, though, so I didn't.  The advantage is that we would only have
one BufferData call per slice, rather than one per miplevel and slice.

However, a GenerateMipmaps microbenchmark indicates that either way is
basically just as fast.  So I'm not sure it's worth bothering.

Improves performance in a GenerateMipmaps microbenchmark by nearly 5x.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Add a 'layer' argument to bind_fbo_image().
Kenneth Graunke [Thu, 6 Mar 2014 04:55:51 +0000 (20:55 -0800)]
meta: Add a 'layer' argument to bind_fbo_image().

For array textures and 3D textures, this represents the layer to use.
Just pass 0 for now.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Refactor code for binding a texture image to the FBO.
Kenneth Graunke [Thu, 6 Mar 2014 03:19:32 +0000 (19:19 -0800)]
meta: Refactor code for binding a texture image to the FBO.

Almost the exact same code appeared twice, and it needs to expand to
handle additional texture targets.  Refactor it to tidy up the code and
avoid duplicating more work in the future.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Use minify() in GenerateMipmaps code.
Kenneth Graunke [Thu, 6 Mar 2014 03:06:51 +0000 (19:06 -0800)]
meta: Use minify() in GenerateMipmaps code.

This is what the macro is for.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Drop redundant FBO creation code in GenerateMipmaps.
Kenneth Graunke [Thu, 6 Mar 2014 03:21:00 +0000 (19:21 -0800)]
meta: Drop redundant FBO creation code in GenerateMipmaps.

fallback_required() already creates the FBO in order to check whether we
can render to the format.  So it's guaranteed to exist.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Replace GLboolean with bool in fallback_required().
Kenneth Graunke [Thu, 6 Mar 2014 02:48:40 +0000 (18:48 -0800)]
meta: Replace GLboolean with bool in fallback_required().

This doesn't interact with the GL API, so we shouldn't use GL types.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Make _mesa_meta_check_generate_mipmap_fallback static.
Kenneth Graunke [Thu, 6 Mar 2014 02:43:23 +0000 (18:43 -0800)]
meta: Make _mesa_meta_check_generate_mipmap_fallback static.

This was only ever used in one place; there's no reason for it to be
non-static.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Split GenerateMipmap() into its own file.
Kenneth Graunke [Thu, 6 Mar 2014 02:37:57 +0000 (18:37 -0800)]
meta: Split GenerateMipmap() into its own file.

Putting the implementation of each GL function in its own file makes it
much easier not to get lost.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: De-static setup_texture_coords().
Kenneth Graunke [Thu, 6 Mar 2014 02:32:42 +0000 (18:32 -0800)]
meta: De-static setup_texture_coords().

This will be used in multiple files soon.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglapi: Add KHR_debug.xml
Timothy Arceri [Sat, 8 Mar 2014 04:45:26 +0000 (15:45 +1100)]
glapi: Add KHR_debug.xml

10 years agomesa: add missing DebugMessageControl types
Timothy Arceri [Sat, 8 Mar 2014 04:37:46 +0000 (15:37 +1100)]
mesa: add missing DebugMessageControl types

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: make ARB_debug_output functions an alias of
Timothy Arceri [Sat, 8 Mar 2014 04:35:54 +0000 (15:35 +1100)]
mesa: make ARB_debug_output functions an alias of
 KHR_debug

Also update dispatch sanity removing ARB_debug_output checks and
removing KHR_debug placeholders as the checks have already been added

V2: Make sure we exit case statements with conditional breaks rather than
just dropping through.

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agoglapi: move KHR_debug into its own file
Timothy Arceri [Sat, 8 Mar 2014 04:31:59 +0000 (15:31 +1100)]
glapi: move KHR_debug into its own file

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agoglx_pbuffer: Refactor GetDrawableAttribute
Adel Gadllah [Mon, 24 Feb 2014 19:44:41 +0000 (20:44 +0100)]
glx_pbuffer: Refactor GetDrawableAttribute

Move the pdraw != NULL check out so that they don't
have to be duplicated.

Signed-off-by: Adel Gadllah <adel.gadllah@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglx: Update glxext.h to revision 25407
Adel Gadllah [Mon, 24 Feb 2014 19:44:40 +0000 (20:44 +0100)]
glx: Update glxext.h to revision 25407

Signed-off-by: Adel Gadllah <adel.gadllah@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoradeon: Include radeon_elf_util.c in the list of LLVM_C_FILES v2
Tom Stellard [Fri, 7 Mar 2014 21:55:48 +0000 (16:55 -0500)]
radeon: Include radeon_elf_util.c in the list of LLVM_C_FILES v2

This fixes the a build breakage caused by
6974eb907600b9d0176d3158ff0fd30ac3e56a55 on build configurations where
all the following are true:

1. radeonsi is not being built
2. r600g is being built
3. opencl is disabled
4. --enable-r600-llvm-compiler is not being used
5. libelf is not installed

v2:
  - Add $(RADEON_CFLAGS) to libllvmradeon_la_CFLAGS

Tested-by: Brian Paul <brianp@vmware.com>
10 years agost/mesa: only mark framebuffer as sRGB capable if Mesa supports the format
Brian Paul [Fri, 7 Mar 2014 17:53:03 +0000 (10:53 -0700)]
st/mesa: only mark framebuffer as sRGB capable if Mesa supports the format

Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agoradeon/llvm: Factor elf parsing code out into its own function
Tom Stellard [Mon, 3 Feb 2014 20:54:02 +0000 (15:54 -0500)]
radeon/llvm: Factor elf parsing code out into its own function

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoradeon: Rename struct radeon_llvm_binary to radeon_shader_binary v2
Tom Stellard [Mon, 3 Feb 2014 18:50:09 +0000 (13:50 -0500)]
radeon: Rename struct radeon_llvm_binary to radeon_shader_binary v2

And move its definition into r600_pipe_common.h;  This struct is a just
a container for shader code and has nothing to do with LLVM.

v2:
  - Drop unrelated Makefile change

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agogallium: rename R4A4 and A4R4 formats to match their swizzle
Marek Olšák [Tue, 4 Mar 2014 11:42:37 +0000 (12:42 +0100)]
gallium: rename R4A4 and A4R4 formats to match their swizzle

Like L4A4.

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: fix the format of glEdgeFlagPointer
Marek Olšák [Mon, 3 Mar 2014 00:01:05 +0000 (01:01 +0100)]
mesa: fix the format of glEdgeFlagPointer

Softpipe expects a float in the vertex shader, which is what glEdgeFlag
generates.

This fixes piglit/gl-2.0-edgeflag.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoradeonsi: fix blit compressed texture workaround to support 2D arrays
Marek Olšák [Mon, 3 Mar 2014 18:22:56 +0000 (19:22 +0100)]
radeonsi: fix blit compressed texture workaround to support 2D arrays

We don't have a piglit test for this, but I think it's correct.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agor600g: fix blitting the last 2 mipmap levels for Evergreen
Marek Olšák [Mon, 3 Mar 2014 21:53:58 +0000 (22:53 +0100)]
r600g: fix blitting the last 2 mipmap levels for Evergreen

This fixes a lot of compressedteximage piglit tests.

R600-R700 don't have this issue.

Cc: mesa-stable@lists.freedesktop.org
10 years agor600g: fix texelFetchOffset GLSL functions
Marek Olšák [Mon, 3 Mar 2014 17:29:39 +0000 (18:29 +0100)]
r600g: fix texelFetchOffset GLSL functions

Cc: mesa-stable@lists.freedesktop.org
10 years agowinsys/radeon: if there's VRAM-only usage, keep it
Marek Olšák [Sun, 9 Feb 2014 11:37:32 +0000 (12:37 +0100)]
winsys/radeon: if there's VRAM-only usage, keep it

10 years agoradeon: Use upload manager for buffer downloads
Niels Ole Salscheider [Wed, 5 Mar 2014 08:05:36 +0000 (09:05 +0100)]
radeon: Use upload manager for buffer downloads

Using DMA for reads is much faster.

Signed-off-by: Niels Ole Salscheider <niels_ole@salscheider-online.de>
Signed-off by: Marek Olšák <marek.olsak@amd.com>

10 years agoglapi: use 'Mesa' in error messages
Brian Paul [Wed, 5 Mar 2014 23:06:00 +0000 (16:06 -0700)]
glapi: use 'Mesa' in error messages

A user would have no idea what "_glthread_" is.  This removes the
last remaining instance of the _glthread_ string in Mesa.

Reviewed-by: Chia-I Wu <olv@lunarg.com>
10 years agost/mesa: add test_format_conversion() debug function
Brian Paul [Thu, 6 Mar 2014 18:45:42 +0000 (11:45 -0700)]
st/mesa: add test_format_conversion() debug function

To check that the st_mesa_format_to_pipe_format() and
st_pipe_format_to_mesa_format() functions correctly convert
all corresponding Mesa/Gallium formats.

This found that MESA_FORMAT_YCBCR_REV was missing in
st_mesa_format_to_pipe_format().  Fixed that too.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agost/mesa: add MESA_FORMAT_R8G8B8A8_SRGB in st_mesa_format_to_pipe_format()
Brian Paul [Thu, 6 Mar 2014 18:37:41 +0000 (11:37 -0700)]
st/mesa: add MESA_FORMAT_R8G8B8A8_SRGB in st_mesa_format_to_pipe_format()

v2: rename patch after rebasing on top of Jose's changes.

Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
10 years agomesa/st: Fix PIPE_FORMAT_R8G8B8A8_SRGB -> MESA_FORMAT_ conversion.
José Fonseca [Fri, 7 Mar 2014 13:35:24 +0000 (13:35 +0000)]
mesa/st: Fix PIPE_FORMAT_R8G8B8A8_SRGB -> MESA_FORMAT_ conversion.

Copy'n'past typo introduced in my
1d8e3067fd9ce72b3711fc208409ac4a7cff4e53 commit.

This fixes swapped RB channels I was seeing in my test machines.

Trivial.

10 years agost/vdpau: Add rotation v2
Kusanagi Kouichi [Fri, 7 Mar 2014 02:07:58 +0000 (11:07 +0900)]
st/vdpau: Add rotation v2

v2: add static asserts

Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agovl: Add rotation v3
Kusanagi Kouichi [Fri, 7 Mar 2014 02:07:48 +0000 (11:07 +0900)]
vl: Add rotation v3

v2: rotate in gen_rect_verts instead
v3: clear rotate in vl_compositor_clear_layers,
    update calc_drawn_area as well

Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
Signed-off-by: Christian König <christian.koenig@amd.com>
10 years agost/omx/enc: fix crash on destruction
Christian König [Sat, 1 Mar 2014 12:25:58 +0000 (13:25 +0100)]
st/omx/enc: fix crash on destruction

Signed-off-by: Christian König <christian.koenig@amd.com>
10 years agomesa: Drop unused hash_table::mem_ctx field.
Kenneth Graunke [Fri, 28 Feb 2014 21:40:12 +0000 (13:40 -0800)]
mesa: Drop unused hash_table::mem_ctx field.

It's never used, and it's equivalent to ralloc_parent(ht) if you really
need it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoclover: Fix build against LLVM SVN r203065 or newer
Michel Dänzer [Fri, 7 Mar 2014 01:49:30 +0000 (10:49 +0900)]
clover: Fix build against LLVM SVN r203065 or newer

llvm/Linker.h was moved to llvm/Linker/Linker.h.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agomesa: add MESA_FORMAT_R8G8B8A8_SRGB
Brian Paul [Thu, 6 Mar 2014 17:56:27 +0000 (10:56 -0700)]
mesa: add MESA_FORMAT_R8G8B8A8_SRGB

To match PIPE_FORMAT_R8G8B8A8_SRGB.
v2: fix component name copy&paste bugs

Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agomesa: Wrap SSE4.1 code in #ifdef __SSE4_1__.
Matt Turner [Wed, 5 Mar 2014 05:11:38 +0000 (21:11 -0800)]
mesa: Wrap SSE4.1 code in #ifdef __SSE4_1__.

Because people insist on doing things like explicitly disabling SSE 4.1.

Cc: "10.0 10.1" <mesa-stable@lists.freedesktop.org>
Tested-by: David Heidelberger <david.heidelberger@ixit.cz>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71547

10 years agoi965: Fix render-to-texture in non-FinishRenderTexture cases.
Eric Anholt [Tue, 4 Mar 2014 23:52:05 +0000 (15:52 -0800)]
i965: Fix render-to-texture in non-FinishRenderTexture cases.

We've had several problems now with FinishRenderTexture not getting called
enough, and we're ready to just give up on it ever doing what we need.  In
particular, an upcoming Steam title had rendering bugs that could be fixed
by always_flush_cache=true.

Instead of hoping Mesa core can figure out when we need to flush our
caches, just track what BOs we've rendered to in a set, and when we render
from a BO in that set, emit a flush and clear the set.

There's some overhead to keeping this set, but most of that is just
hashing the pointer -- it turns out our set never even gets very large,
because cache flushes are so common (even on cairo-gl).

No statistically significant performance difference in cairo-gl (n=100),
despite spending ~.5% CPU in these set operations.

v1: (Original patch by Eric Anholt.)
v2: (Changes by Ken Graunke.)
  - Rebase forward from May 7th 2013 -> March 4th 2014.
  - Drop the FinishRenderTexture hook entirely; after rebasing the
    patch, the hook was just an empty function.
  - Move the brw_render_cache_set_clear() call from
    intel_batchbuffer_emit_flush() to brw_emit_pipe_control_flush().
    In theory, this could catch more cases where we've flushed.
  - Consider stencil as a possible texturing source.
v3: (changes by anholt):
  - Move set_clear() back to emit_mi_flush() -- it means we can drop
    more forced flushes from the code.  In the previous location, it
    wouldn't have been called when we wanted pre-gen6.
  - Move the set clear from batch init to reset -- it should be empty at
    the start of every batch, since the kernel handled any inter-batch
    flush for us.
v4: Drop the debug code in set.c that I accidentally committed.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Dylan Baker <baker.dylan.c@gmail.com> [v2]
10 years agomesa: fix copy & paste bugs in pack_ubyte_SRGB8()
Brian Paul [Thu, 6 Mar 2014 18:24:33 +0000 (11:24 -0700)]
mesa: fix copy & paste bugs in pack_ubyte_SRGB8()

Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agomesa: fix copy & paste bugs in pack_ubyte_SARGB8()
Brian Paul [Thu, 6 Mar 2014 17:58:30 +0000 (10:58 -0700)]
mesa: fix copy & paste bugs in pack_ubyte_SARGB8()

Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agogallium/util: Fix memory leak
Aaron Watry [Tue, 4 Mar 2014 23:12:19 +0000 (17:12 -0600)]
gallium/util: Fix memory leak

Fix a leaked vertex shader in u_blitter.c

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
CC: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agost/mesa: Add R8G8B8A8_SRGB case to st_pipe_format_to_mesa_format.
José Fonseca [Thu, 6 Mar 2014 16:57:05 +0000 (16:57 +0000)]
st/mesa: Add R8G8B8A8_SRGB case to st_pipe_format_to_mesa_format.

With the recent SRGB changes all my automated OpenGL llvmpipe tests
(piglit, conform, glretrace) start asserting with the backtrace below.

I'm hoping this change will fix it.  I'm not entirely sure, as this
doesn't happen in my development machine (the bug probably depends on
the exact X visual).

Anyway, it seems the sensible thing to do here.

   Program terminated with signal 5, Trace/breakpoint trap.
   #0  _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", file=file@entry=0x7fa324e3fc30 "src/mesa/state_tracker/st_format.c", line=line@entry=758, function=function@entry=0x7fa324e40160 <__func__.34798> "st_pipe_format_to_mesa_format") at src/gallium/auxiliary/util/u_debug.c:281
   #0  _debug_assert_fail (expr=expr@entry=0x7fa324df2ed7 "0", file=file@entry=0x7fa324e3fc30 "src/mesa/state_tracker/st_format.c", line=line@entry=758, function=function@entry=0x7fa324e40160 <__func__.34798> "st_pipe_format_to_mesa_format") at src/gallium/auxiliary/util/u_debug.c:281
   No locals.
   #1  0x00007fa3241d22b3 in st_pipe_format_to_mesa_format (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB) at src/mesa/state_tracker/st_format.c:758
           __func__ = "st_pipe_format_to_mesa_format"
   #2  0x00007fa3241c8ec5 in st_new_renderbuffer_fb (format=format@entry=PIPE_FORMAT_R8G8B8A8_SRGB, samples=0, sw=<optimised out>) at src/mesa/state_tracker/st_cb_fbo.c:295
           strb = 0x19e8420
   #3  0x00007fa32409d355 in st_framebuffer_add_renderbuffer (stfb=stfb@entry=0x19e7fa0, idx=<optimised out>) at src/mesa/state_tracker/st_manager.c:314
           rb = <optimised out>
           format = PIPE_FORMAT_R8G8B8A8_SRGB
           sw = <optimised out>
   #4  0x00007fa32409e635 in st_framebuffer_create (st=0x19e7fa0, st=0x19e7fa0, stfbi=0x19e7a30) at src/mesa/state_tracker/st_manager.c:458
           stfb = 0x19e7fa0
           mode = {rgbMode = 1 '\001', floatMode = 0 '\000', colorIndexMode = 0 '\000', doubleBufferMode = 0, stereoMode = 0, haveAccumBuffer = 0 '\000', haveDepthBuffer = 1 '\001', haveStencilBuffer = 1 '\001', redBits = 8, greenBits = 8, blueBits = 8, alphaBits = 8, redMask = 0, greenMask = 0, blueMask = 0, alphaMask = 0, rgbBits = 32, indexBits = 0, accumRedBits = 0, accumGreenBits = 0, accumBlueBits = 0, accumAlphaBits = 0, depthBits = 24, stencilBits = 8, numAuxBuffers = 0, level = 0, visualRating = 0, transparentPixel = 0, transparentRed = 0, transparentGreen = 0, transparentBlue = 0, transparentAlpha = 0, transparentIndex = 0, sampleBuffers = 0, samples = 0, maxPbufferWidth = 0, maxPbufferHeight = 0, maxPbufferPixels = 0, optimalPbufferWidth = 0, optimalPbufferHeight = 0, swapMethod = 0, bindToTextureRgb = 0, bindToTextureRgba = 0, bindToMipmapTexture = 0, bindToTextureTargets = 0, yInverted = 0, sRGBCapable = 1}
           idx = <optimised out>
   #5  st_framebuffer_reuse_or_create (st=st@entry=0x19dfce0, fb=<optimised out>, stfbi=stfbi@entry=0x19e7a30) at src/mesa/state_tracker/st_manager.c:728
   No locals.
   #6  0x00007fa32409e8cc in st_api_make_current (stapi=<optimised out>, stctxi=0x19dfce0, stdrawi=0x19e7a30, streadi=0x19e7a30) at src/mesa/state_tracker/st_manager.c:747
           st = 0x19dfce0
           stdraw = 0x640064
           stread = 0x1300000006
           ret = <optimised out>
   #7  0x00007fa324074a20 in XMesaMakeCurrent2 (c=c@entry=0x195bb00, drawBuffer=0x19e7e90, readBuffer=0x19e7e90) at src/gallium/state_trackers/glx/xlib/xm_api.c:1194
   No locals.
   #8  0x00007fa3240783c8 in glXMakeContextCurrent (dpy=0x194e900, draw=8388610, read=8388610, ctx=0x195bac0) at src/gallium/state_trackers/glx/xlib/glx_api.c:1177
           drawBuffer = <optimised out>
           readBuffer = <optimised out>
           xmctx = 0x195bb00
           glxCtx = 0x195bac0
           firsttime = 0 '\000'
           no_rast = 0 '\000'
   #9  0x00007fa32407852f in glXMakeCurrent (dpy=<optimised out>, drawable=<optimised out>, ctx=<optimised out>) at src/gallium/state_trackers/glx/xlib/glx_api.c:1211
   No locals.

Acked-by: Brian Paul <brianp@vmware.com>
10 years agoglapi: remove u_mutex wrapper code, use c99 thread mutexes directly
Brian Paul [Wed, 5 Mar 2014 23:06:00 +0000 (16:06 -0700)]
glapi: remove u_mutex wrapper code, use c99 thread mutexes directly

v2: fix initializer mistake spotted by Chia-I Wu.

Reviewed-by: Chia-I Wu <olv@lunarg.com>
10 years agoglapi: rename u_current dispatch table functions
Brian Paul [Wed, 5 Mar 2014 14:47:41 +0000 (07:47 -0700)]
glapi: rename u_current dispatch table functions

Put "table" in the names to make things more understandable.

Reviewed-by: Chia-I Wu <olv@lunarg.com>
10 years agoglapi: replace 'user' with 'context' in u_current.[ch] code
Brian Paul [Wed, 5 Mar 2014 14:47:41 +0000 (07:47 -0700)]
glapi: replace 'user' with 'context' in u_current.[ch] code

To make the functions more understandable.

Reviewed-by: Chia-I Wu <olv@lunarg.com>
10 years agoglsl: fix compiler warnings in link_uniforms.cpp
Brian Paul [Wed, 5 Mar 2014 23:39:59 +0000 (16:39 -0700)]
glsl: fix compiler warnings in link_uniforms.cpp

With a non-debug build, gcc has two complaints:
1. 'found' var not used.  Silence with '(void) found;'
2. 'id' not initialized.  It's assigned by the UniformHash->get()
   call, actually.  But init it to zero to silence gcc.

Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agomesa/st: only compare the one scissor
Ilia Mirkin [Thu, 6 Mar 2014 03:34:27 +0000 (22:34 -0500)]
mesa/st: only compare the one scissor

sizeof(scissor) returns the size of the full array rather than a single
element. Fix it to consider just the one element.

Fixes: 0705fa35 ("st/mesa: add support for GL_ARB_viewport_array (v0.2)")
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
10 years agost/mesa: make winsys fbo sRGB-capable when supported
Chia-I Wu [Mon, 3 Mar 2014 04:44:43 +0000 (12:44 +0800)]
st/mesa: make winsys fbo sRGB-capable when supported

The texture formats of winsys fbo are always linear becase the st manager
(st/dri for example) could not know the colorspace used.  But it does not mean
that we cannot make the fbo sRGB-capable.  By

 - setting rb->Visual.sRGBCapable to GL_TRUE when the pipe driver supports the
   format in sRGB colorspace,
 - giving rb an sRGB internal format, and
 - updating code to check rb->Format instead of strb->texture->format,

we should be good.

Fixed bug 75226 for at least llvmpipe and ilo, with no piglit regression.

v2: do not set rb->Visual.sRGBCapable for GLES contexts to avoid surprises

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

Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agost/mesa: add mappings for MESA_FORMAT_B8G8R8X8_SRGB
Chia-I Wu [Tue, 4 Mar 2014 04:52:07 +0000 (12:52 +0800)]
st/mesa: add mappings for MESA_FORMAT_B8G8R8X8_SRGB

The format is mapped to PIPE_FORMAT_B8G8R8X8_SRGB.

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: add MESA_FORMAT_B8G8R8X8_SRGB
Chia-I Wu [Tue, 4 Mar 2014 04:18:52 +0000 (12:18 +0800)]
mesa: add MESA_FORMAT_B8G8R8X8_SRGB

The format is needed to represent an RGB-only winsys framebuffer that is
sRGB-capable.

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: fix packing/unpacking for MESA_FORMAT_A4R4G4B4_UNORM
Brian Paul [Tue, 4 Mar 2014 16:10:00 +0000 (09:10 -0700)]
mesa: fix packing/unpacking for MESA_FORMAT_A4R4G4B4_UNORM

Spotted by Chia-I Wu.
v2: also fix unpack_ubyte_ARGB4444_REV()

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
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>