mesa.git
9 years agoglsl: move array validation into its own function
Timothy Arceri [Sat, 21 Feb 2015 10:47:14 +0000 (21:47 +1100)]
glsl: move array validation into its own function

V2: return true when var->type is unsized but max access is within valid range

Reviewed-by: Mark Janes <mark.a.janes@intel.com>
9 years agoi965: Split Gen4-5 BlitFramebuffer code; prefer BLT over Meta.
Kenneth Graunke [Thu, 5 Mar 2015 02:14:31 +0000 (18:14 -0800)]
i965: Split Gen4-5 BlitFramebuffer code; prefer BLT over Meta.

A while back I switched intel_blit_framebuffer to prefer Meta over the
BLT.  This meant that Gen8 platforms would start using the 3D engine
for blits, just like we do on Gen6-7.5.

However, I hadn't considered Gen4-5 when making that change.  The BLT
engine appears to be substantially faster on 965GM than using Meta to
drive the 3D engine.  This isn't too surprising: original Gen4 doesn't
support tile offsets (that came on G45), and the level/layer fields
don't work for cubemap rendering, so for inconvenient miplevel
alignments, we end up blitting or copying data to/from temporaries
in order to render to it.  We may as well just use the blitter.

I chose to use the BLT on Gen4-5 because they use the same ring for
both 3D and BLT; Gen6+ splits it out.

Fixes regressions on 965GM due to botched tile offset code (we should
fix those properly as well, but they're longstanding bugs - for now,
put things back to the status quo).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89430
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
9 years agoilo: add more convenient intel_bo_{ref,unref}()
Chia-I Wu [Thu, 5 Mar 2015 18:03:10 +0000 (02:03 +0800)]
ilo: add more convenient intel_bo_{ref,unref}()

They both check for NULL and intel_bo_ref() returns the referenced bo.  They
replace intel_bo_{reference,unreference}().

9 years agoilo: add intel_bo_set_tiling()
Chia-I Wu [Thu, 5 Mar 2015 17:36:01 +0000 (01:36 +0800)]
ilo: add intel_bo_set_tiling()

Make intel_winsys_alloc_bo() always allocate a linear bo, and add
intel_bo_set_tiling() to set the tiling.  Document the purpose of tiling.

9 years agoilo: replace intel_tiling_mode by gen_surface_tiling
Chia-I Wu [Thu, 5 Mar 2015 15:53:16 +0000 (23:53 +0800)]
ilo: replace intel_tiling_mode by gen_surface_tiling

The former is used by the kernel driver to set up fence registers and to pass
tiling info across processes.  It lacks INTEL_TILING_W, which made our code
less expressive.

9 years agoilo: update genhw headers
Chia-I Wu [Thu, 5 Mar 2015 07:25:43 +0000 (15:25 +0800)]
ilo: update genhw headers

The main change is non-inline <enum>s are now generated as C enums.

9 years agoFix invalid extern "C" around header inclusion.
Mark Janes [Thu, 5 Mar 2015 00:37:29 +0000 (16:37 -0800)]
Fix invalid extern "C" around header inclusion.

System headers may contain C++ declarations, which cannot be given C
linkage.  For this reason, include statements should never occur
inside extern "C".

This patch moves the C linkage statements to enclose only the
declarations within a single header.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agoi965: Tell intel_get_memcpy() which direction the memcpy() is going.
Matt Turner [Wed, 4 Mar 2015 23:21:53 +0000 (15:21 -0800)]
i965: Tell intel_get_memcpy() which direction the memcpy() is going.

The SSSE3 swizzling code was written for fast uploads to the GPU and
assumed the destination was always 16-byte aligned. When we began using
this code for fast downloads as well we didn't do anything to account
for the fact that the destination pointer given by glReadPixels() or
glGetTexImage() is not guaranteed to be suitably aligned.

With SSSE3 enabled (at compile-time), some applications would crash when
an SSE aligned-store instruction tried to store to an unaligned
destination (or an assertion that the destination is aligned would
trigger).

To remedy this, tell intel_get_memcpy() whether we're uploading or
downloading so that it can select whether to assume the destination or
source is aligned, respectively.

Cc: 10.5 <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89416
Tested-by: Uriy Zhuravlev <stalkerg@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agomesa/x86: missing stdio inclusions
Mark Janes [Thu, 5 Mar 2015 18:14:16 +0000 (10:14 -0800)]
mesa/x86: missing stdio inclusions

Several patches added include statements where required by the m64
build.  Some files are only compiled for m32, and require similar
changes.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoclover: Enable cl_khr_fp64 for devices that support doubles v4
Tom Stellard [Wed, 2 Jul 2014 19:42:43 +0000 (15:42 -0400)]
clover: Enable cl_khr_fp64 for devices that support doubles v4

v2:
  - Report correct values for CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE
    and CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE.
  - Only define cl_khr_fp64 if the extension is supported.
  - Remove trailing space from extension string.
  - Rename device query function from cl_khr_fp64() to
    has_doubles().

v3:
  - Return 0 for device::doubled_fp_confg() when doubles aren't
    supported.

v4:
  - Remove device query for double fp_config.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoxmlpool: make sure we ship options.h
Emil Velikov [Mon, 2 Mar 2015 15:58:21 +0000 (15:58 +0000)]
xmlpool: make sure we ship options.h

The header is included in ../xmlpool.h. With the latter of which used
directly in a number of places in mesa.
Note that we can also add it (alongside t_option.h) to noinst_HEADERS,
but neither solution fixes the issue that brough us here - namely:
Do not regenerate the headers, if it already exists.

Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomapi: fix *glapi dependency tracking
Emil Velikov [Mon, 2 Mar 2015 15:58:20 +0000 (15:58 +0000)]
mapi: fix *glapi dependency tracking

I.e. add {shared-,}glapi/glapi_mapi_tmp.h to the SOURCES list. Otherwise
there will be no knowledge that the file is required by others for the
build. Thus autotools won't pick it up for the distribution tarball.

v2: Don't forget about the static glapi. Spotted by Matt.

Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: drop Makefile from get_hash.h dependency list
Emil Velikov [Mon, 2 Mar 2015 15:58:19 +0000 (15:58 +0000)]
mesa: drop Makefile from get_hash.h dependency list

Not required. Additionally this had the side effect of generating the
file, despite it's existence.

Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: fix dependency tracking of generated sources
Emil Velikov [Mon, 2 Mar 2015 15:58:18 +0000 (15:58 +0000)]
mesa: fix dependency tracking of generated sources

Some of the files generated were not in the SOURCES variable, thus
although generated prior to compilation the dependency tracking was
incomplete. The latter of which resulted in the files missing from the
distribution tarball.

Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: rename format_info.c to format_info.h
Emil Velikov [Mon, 2 Mar 2015 15:58:17 +0000 (15:58 +0000)]
mesa: rename format_info.c to format_info.h

The file is auto-generated, and #included by formats.c. Let's rename it
to reflect the latter. This will also help up fix the dependency
tracking by adding it to the _SOURCES variable, without the side effect
of it being compiled (twice).

v2: Update .gitignore to reflect the rename.

Cc: "10.4, 10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa/main: update .gitignore
Emil Velikov [Mon, 2 Mar 2015 15:58:16 +0000 (15:58 +0000)]
mesa/main: update .gitignore

Drop the no longer present get_es{1,2}.c from the list.

v2: Keep the format_info.c rename hunk out of this patch.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoegl/main: remove no-longer needed definition of stdint types
Emil Velikov [Sat, 28 Feb 2015 17:14:31 +0000 (17:14 +0000)]
egl/main: remove no-longer needed definition of stdint types

All the users directly include the header, plus we have a in-tree
replacements for non C99 compilers which we already use.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoegl/drivers: include stdint.h where needed
Emil Velikov [Sat, 28 Feb 2015 17:12:40 +0000 (17:12 +0000)]
egl/drivers: include stdint.h where needed

Currently these files are including it indirectly via eglcompiler.h
The latter of which will be removed with follow up commits.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoegl/main: drop the declaration of PUBLIC keyword.
Emil Velikov [Sat, 28 Feb 2015 16:51:21 +0000 (16:51 +0000)]
egl/main: drop the declaration of PUBLIC keyword.

Should no longer be used. As many places indirectly include
eglcompiler.h keep this change separate, so that it can be easily
reverted, if needed.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoegl/main: no longer export internal function
Emil Velikov [Sat, 28 Feb 2015 17:20:01 +0000 (17:20 +0000)]
egl/main: no longer export internal function

With the split of the gallium egl module we had previously it required
access to some of the internal functions. As the only build (automake)
that did this no longer builds it we can now appropriately hide those
functions.

Cc: 10.5 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoegl/main: replace __FUNCTION__ with __func__
Emil Velikov [Sat, 28 Feb 2015 16:39:10 +0000 (16:39 +0000)]
egl/main: replace __FUNCTION__ with __func__

The latter is a C99 standard, and our current wrapper c99_compat.h
should handle non-compliant compilers.
Drop the c99_compat.h inclusion from eglcompiler.h altogether, as it's
no longer required.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoegl/main: replace INLINE with inline
Emil Velikov [Sat, 28 Feb 2015 16:35:22 +0000 (16:35 +0000)]
egl/main: replace INLINE with inline

Drop the custom keyword in favour of the C99 one. All the places using
it now directly include c99_compat.h which should handle things on
platforms which lack it.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agomapi: remove u_thread.h
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
mapi: remove u_thread.h

Just use c11 threads directly.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agomapi: use c11 call_once() instead of pthread_once()
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
mapi: use c11 call_once() instead of pthread_once()

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agomapi: THREADS was always defined, remove it
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
mapi: THREADS was always defined, remove it

THREADS was defined if HAVE_PTHREADS or _WIN32 was defined.  That's
always the case.  The build would die in c11/threads.h otherwise.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agomesa: remove THREADS check, printf calls in debug.c
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
mesa: remove THREADS check, printf calls in debug.c

THREADS is going away in the next commit.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agomapi: rewrite u_current_init() function without u_thread_self()
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
mapi: rewrite u_current_init() function without u_thread_self()

Remove u_thread_self() since u_thread.h is going away soon.
Create a simple thread ID abstraction which wraps WIN32 or c11 threads.
This also gets rid of the questionable casting of thrd_t to an unsigned
long.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agomapi: fix preprocessor check in u_current_destroy()
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
mapi: fix preprocessor check in u_current_destroy()

So it matches the preprocessor check around the u_current_init_tsd() code.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agomapi: remove u_macros.h
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
mapi: remove u_macros.h

Only U_STRINGIFY() is used in entry.c

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agoosmesa: include stdio.h
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
osmesa: include stdio.h

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agoxlib: include stdio.h
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
xlib: include stdio.h

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agost/osmesa: include stdio.h
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
st/osmesa: include stdio.h

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agost/xlib: include stdio.h
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
st/xlib: include stdio.h

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agost/xlib: include stdio.h
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
st/xlib: include stdio.h

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agost/mesa: include stdio.h where needed
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
st/mesa: include stdio.h where needed

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agoswrast: include stdio.h where needed
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
swrast: include stdio.h where needed

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agonouveau: include stdio.h where needed
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
nouveau: include stdio.h where needed

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agodri/common: include stdio.h where needed
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
dri/common: include stdio.h where needed

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agoglsl: include stdio.h where needed
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
glsl: include stdio.h where needed

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agomesa: include stdio.h where needed
Brian Paul [Thu, 5 Mar 2015 02:17:57 +0000 (19:17 -0700)]
mesa: include stdio.h where needed

Instead of relying on glapi.h or some other header to provide it.

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agomesa: include c11/threads.h in mtypes.h
Brian Paul [Thu, 5 Mar 2015 02:17:56 +0000 (19:17 -0700)]
mesa: include c11/threads.h in mtypes.h

Let's directly include c11/threads.h instead of relying on glapi.h
to provide it.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agometa: Fix the y offset for 1D_ARRAY in _mesa_meta_pbo_TexSubImage
Neil Roberts [Wed, 25 Feb 2015 15:33:08 +0000 (15:33 +0000)]
meta: Fix the y offset for 1D_ARRAY in _mesa_meta_pbo_TexSubImage

The yoffset needs to be interpreted as a slice offset for 1D array
textures. This patch implements that by moving the yoffset into
zoffset similar to how it moves the height into depth.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
9 years agometa: Allow GL_UN/PACK_IMAGE_HEIGHT in _mesa_meta_pbo_Get/TexSubImage
Neil Roberts [Thu, 26 Feb 2015 12:53:50 +0000 (12:53 +0000)]
meta: Allow GL_UN/PACK_IMAGE_HEIGHT in _mesa_meta_pbo_Get/TexSubImage

Now that a layered source PBO is interpreted as a single tall 2D image
it's quite easy to accept the image height packing option by just
creating an image that is tall enough to include the image padding.

I'm not sure whether the image height property should affect 1D_ARRAY
textures. My intuition and interpretation of the GL spec (which is a
bit vague) would be that it shouldn't. However the software fallback
path in Mesa uses the property for packing but not for unpacking. The
binary NVidia driver uses it for both. This patch doesn't use it for
either case so it is different from the software fallback. There is
some discussion about this here:

http://lists.freedesktop.org/archives/mesa-dev/2015-February/077925.html

This is tested by the texsubimage Piglit test with the array and pbo
arguments. Previously this test was skipping this code path because it
always sets the image height.

I've also tested it by modifying the getteximage-targets test. It
wasn't using this code path before because it was using the default
texture object so this code couldn't successfully create a frame
buffer. I also modified it to add some image padding with the image
height in the PBO.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
9 years agoRevert "common: Fix PBOs for 1D_ARRAY."
Neil Roberts [Thu, 26 Feb 2015 12:12:15 +0000 (12:12 +0000)]
Revert "common: Fix PBOs for 1D_ARRAY."

This reverts commit 546aba143d13ba3f993ead4cc30b2404abfc0202.

I think the changes to the calls to glBlitFramebuffer from this patch
are no different to what it was doing previously because it used to
set height to 1 before doing the blits. However it was introducing
some problems with the blit for layer 0 because this was no longer
special cased. It didn't fix problems with the yoffset which needs to
be interpreted as a slice offset. I think a better solution would be
to modify the original if statement to cope with the yoffset.

Conflicts:
src/mesa/drivers/common/meta_tex_subimage.c

Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoglsl: Fix GCC unused-variable warning in release build.
Vinson Lee [Wed, 4 Mar 2015 02:46:13 +0000 (18:46 -0800)]
glsl: Fix GCC unused-variable warning in release build.

  CXX      ast_array_index.lo
ast_array_index.cpp: In function ‘void update_max_array_access(ir_rvalue*, int, YYLTYPE*, _mesa_glsl_parse_state*)’:
ast_array_index.cpp:86:30: warning: unused variable ‘interface_type’ [-Wunused-variable]
             const glsl_type *interface_type =
                              ^

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
9 years agoilo: improve WA handling in rectlist path
Chia-I Wu [Wed, 4 Mar 2015 21:38:50 +0000 (14:38 -0700)]
ilo: improve WA handling in rectlist path

Add wrappers for 3DPRIMITIVE to make sure we clear current_pipe_control_dw1
and deferred_pipe_control_dw1 after it.  Add missing
gen7_wa_post_ps_and_later().

9 years agoilo: clean up Gen7.5 WAs
Chia-I Wu [Wed, 4 Mar 2015 21:09:26 +0000 (14:09 -0700)]
ilo: clean up Gen7.5 WAs

These WAs

  gen7_wa_post_3dstate_push_constant_alloc_ps()
  gen7_wa_pre_vs()
  gen7_wa_pre_3dstate_sf_depth_bias()
  first half of gen7_wa_pre_depth()
  gen7_wa_post_ps_and_later()

are Gen7-specific.  Update copy-and-pasted gen8_wa_pre_depth() also.

9 years agoclover: Fix build since llvm r231270
Tom Stellard [Wed, 4 Mar 2015 21:09:50 +0000 (13:09 -0800)]
clover: Fix build since llvm r231270

9 years agoilo: add ILO_DEBUG=hang
Chia-I Wu [Wed, 4 Mar 2015 20:07:55 +0000 (13:07 -0700)]
ilo: add ILO_DEBUG=hang

When set, detect and dump the hanging batch bufffer.

9 years agoilo: add some more winsys functions
Chia-I Wu [Wed, 4 Mar 2015 19:02:12 +0000 (12:02 -0700)]
ilo: add some more winsys functions

Add intel_winsys_get_reset_stats(), intel_winsys_import_userptr(), and
intel_bo_map_async().  The latter two are stubs, but we are not going to use
them immediately either.

9 years agoi965/fs: Don't propagate cmod to inst with different type.
Matt Turner [Fri, 27 Feb 2015 18:22:21 +0000 (10:22 -0800)]
i965/fs: Don't propagate cmod to inst with different type.

Cc: 10.5 <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89317
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agor300g: Check return value of snprintf().
Matt Turner [Wed, 4 Mar 2015 00:09:58 +0000 (16:09 -0800)]
r300g: Check return value of snprintf().

Would have at least prevented the crash the previous patch fixed.

Cc: 10.4, 10.5 <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=540970
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
9 years agor300g: Use PATH_MAX instead of limiting ourselves to 100 chars.
Matt Turner [Wed, 4 Mar 2015 00:02:40 +0000 (16:02 -0800)]
r300g: Use PATH_MAX instead of limiting ourselves to 100 chars.

When built with Gentoo's package manager, the Mesa source directory
exists seven directories deep. The path to the .test file is too long
and is silently truncated, leading to a crash. Just use PATH_MAX.

Cc: 10.4, 10.5 <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=540970
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
9 years agoglx/tests: add -I src/ to fix make check
Brian Paul [Wed, 4 Mar 2015 17:03:09 +0000 (10:03 -0700)]
glx/tests: add -I src/ to fix make check

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoi965: Fix uint64_t overflow in intel_client_wait_sync()
Kristian Høgsberg [Tue, 3 Mar 2015 00:19:52 +0000 (16:19 -0800)]
i965: Fix uint64_t overflow in intel_client_wait_sync()

DRM_IOCTL_I915_GEM_WAIT takes an int64_t for the timeout value but
GL_ARB_sync takes an uint64_t.  Further, the ioctl used to wait
indefinitely when passed a negative timeout, but it's been broken and
now returns immediately in that case.  Thus, if an application passes
UINT64_MAX to wait forever, we overflow to -1LL and return immediately.
Work around this mess by clamping the wait timeout to INT64_MAX.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoegl: Take alpha bits into account when selecting GBM formats
Daniel Stone [Mon, 2 Mar 2015 13:52:59 +0000 (13:52 +0000)]
egl: Take alpha bits into account when selecting GBM formats

This fixes piglit when using PIGLIT_PLATFORM=gbm

Tom Stellard:
  - Fix ARGB2101010 format

Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agofreedreno/ir3: fix old compiler after f6b2e8af742
Rob Clark [Wed, 4 Mar 2015 16:36:32 +0000 (11:36 -0500)]
freedreno/ir3: fix old compiler after f6b2e8af742

If first_driver_param is left as zero (calloc'd struct), the result is
c0 getting clobbered.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agogallivm: init MM = NULL to silence warning
Brian Paul [Tue, 3 Mar 2015 20:20:56 +0000 (13:20 -0700)]
gallivm: init MM = NULL to silence warning

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agomapi: remove u_compiler.h
Brian Paul [Wed, 4 Mar 2015 00:15:05 +0000 (17:15 -0700)]
mapi: remove u_compiler.h

Just include c99_compat.h or util/macros.h where needed.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agomapi: use util/macros.h instead of locally defined macros
Brian Paul [Tue, 3 Mar 2015 16:11:35 +0000 (09:11 -0700)]
mapi: use util/macros.h instead of locally defined macros

The next step is to get rid of u_compiler.h completely.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agomapi: replace INLINE with inline
Brian Paul [Tue, 3 Mar 2015 16:08:22 +0000 (09:08 -0700)]
mapi: replace INLINE with inline

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agomesa: consolidate PUBLIC macro definition
Brian Paul [Tue, 3 Mar 2015 16:01:03 +0000 (09:01 -0700)]
mesa: consolidate PUBLIC macro definition

Define the macro in src/util/macros.h rather than in two different
places.  Note that USED isn't actually used anywhere at this time.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agost/xlib: include p_compiler.h to get PUBLIC definition
Brian Paul [Tue, 3 Mar 2015 16:18:36 +0000 (09:18 -0700)]
st/xlib: include p_compiler.h to get PUBLIC definition

To prevent build break with following changes.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agomapi: remove unneeded ARRAY_SIZE #define
Brian Paul [Tue, 3 Mar 2015 16:40:40 +0000 (09:40 -0700)]
mapi: remove unneeded ARRAY_SIZE #define

include util/macros.h instead.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agoglx: use ARRAY_SIZE from macros.h
Brian Paul [Tue, 3 Mar 2015 16:51:19 +0000 (09:51 -0700)]
glx: use ARRAY_SIZE from macros.h

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agoscons: Update for the fact that we require GCC 4.2
Jose Fonseca [Wed, 4 Mar 2015 13:56:35 +0000 (13:56 +0000)]
scons: Update for the fact that we require GCC 4.2

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agosvga: Set MSVC2013 compat flags.
Jose Fonseca [Wed, 4 Mar 2015 14:25:54 +0000 (14:25 +0000)]
svga: Set MSVC2013 compat flags.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agosoftpipe,trace: Set MSVC 2008 compat flags.
Jose Fonseca [Wed, 4 Mar 2015 14:25:39 +0000 (14:25 +0000)]
softpipe,trace: Set MSVC 2008 compat flags.

Although we don't deploy these, we need to use them for debugging.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoscons: Use -Werror MSVC compatibility flags per-directory.
Jose Fonseca [Wed, 4 Mar 2015 14:23:52 +0000 (14:23 +0000)]
scons: Use -Werror MSVC compatibility flags per-directory.

Matching what we already do with autotools builds.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agost/vega: Remove.
Jose Fonseca [Tue, 3 Mar 2015 16:58:21 +0000 (16:58 +0000)]
st/vega: Remove.

OpenVG API seems to have dwindled away.  The code
would still be interesting if we wanted to implement NV_path_rendering
but given the trend of the next gen graphics APIs, it seems
unlikely that this becomes ARB or core.

v2: Remove a few "openvg" references left, per Emil Velikov.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
v3: Update release notes.

9 years agost/egl: Remove.
Jose Fonseca [Tue, 3 Mar 2015 16:01:22 +0000 (16:01 +0000)]
st/egl: Remove.

Largely superseeded by src/egl, and
WGL/GLX_EXT_create_context_es_profile extensions.

Note this will break Android.mk with gallium drivers -- somebody
familiar with that build infrastructure will need to update it to use
gallium drivers through egl_dri2.

v2: Remove the _EGL_BUILT_IN_DRIVER_GALLIUM define from
src/egl/main/Android.mk; and update the src/egl/main/Sconscript to
create a SharedLibrary, add versioning, create symlink - copy the bits
from egl-static, per Emil Velikov.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
v3: Disallow undefined symbols in libEGL.so.  Update release notes

9 years agowindows/gdi: Remove.
Jose Fonseca [Tue, 3 Mar 2015 14:52:15 +0000 (14:52 +0000)]
windows/gdi: Remove.

This classic driver is so far behind Gallium softpipe/llvmpipe based
one, that's hard to imagine ever being useful.

v2: Drop drivers/windows from src/mesa/Makefile.am:EXTRA_DIST per Emil
Velikov.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
v3: Update release notes.

9 years agonir: Use helper macros for dealing with VLAs.
Jose Fonseca [Fri, 27 Feb 2015 15:32:24 +0000 (15:32 +0000)]
nir: Use helper macros for dealing with VLAs.

v2:
- Single statement, by using memset return value as suggested by Ian
Romanick.
- No internal declaration, as suggested by Jason Ekstrand.
- Move macros to a header.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agogallium/auxiliary/indices: fix start param
Marc-Andre Lureau [Fri, 27 Feb 2015 18:40:19 +0000 (19:40 +0100)]
gallium/auxiliary/indices: fix start param

Since commit 28f3f8d, indices generator take a start parameter. However, some
index values have been left to start at 0.

This fixes the glean/fbo test with the virgl driver, and copytexsubimage
with freedreno.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
9 years agoscons: Define _DEFAULT_SOURCE.
Vinson Lee [Sun, 1 Mar 2015 08:41:48 +0000 (00:41 -0800)]
scons: Define _DEFAULT_SOURCE.

Fix GCC cpp warnings with glibc >= 2.19.

/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agointel: fix EGLImage renderbuffer _BaseFormat
Frank Henigman [Thu, 19 Feb 2015 23:09:20 +0000 (15:09 -0800)]
intel: fix EGLImage renderbuffer _BaseFormat

Correctly set _BaseFormat field when creating a gl_renderbuffer
with EGLImage storage.

Change-Id: I8c9f7302d18b617f54fa68304d8ffee087ed8a77
Signed-off-by: Frank Henigman <fjhenigman@google.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agofreedreno/a4xx: re-enable int (conditional on glsl130)
Rob Clark [Fri, 27 Feb 2015 00:37:31 +0000 (19:37 -0500)]
freedreno/a4xx: re-enable int (conditional on glsl130)

Re-enable integer, now that we can handle flat varyings.  Still, ofc,
conditional on FD_MESA_DEBUG=glsl130, until we can deprecate _old
compiler..

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agofreedreno/ir3: handle flat bypass for a4xx
Rob Clark [Wed, 25 Feb 2015 18:54:25 +0000 (13:54 -0500)]
freedreno/ir3: handle flat bypass for a4xx

We may not need this for later a4xx patchlevels, but we do at least need
this for patchlevel 0.  Bypass bary.f for fetching varyings when flat
shading is needed (rather than configure via cmdstream).  This requires
a special dummy bary.f w/ (ei) flag to signal to scheduler when all
varyings are consumed.  And requires shader variants based on rasterizer
flatshade state to handle TGSI_INTERPOLATE_COLOR.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agofreedreno/ir3: add support for memory (cat6) instructions
Rob Clark [Thu, 26 Feb 2015 20:13:10 +0000 (15:13 -0500)]
freedreno/ir3: add support for memory (cat6) instructions

Scheduled basically the same as texture (cat5) instructions, using (sy)
flag for synchronization.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agofreedreno/ir3: fix up cat6 instruction encodings
Rob Clark [Thu, 26 Feb 2015 18:35:31 +0000 (13:35 -0500)]
freedreno/ir3: fix up cat6 instruction encodings

I think there is at least one more sub-encoding, but these two should be
enough to cover the common load/store instructions.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agotgsi/lowering: don't forget interp for BCOLOR inputs
Rob Clark [Fri, 27 Feb 2015 14:02:48 +0000 (09:02 -0500)]
tgsi/lowering: don't forget interp for BCOLOR inputs

To lower two sided color, tgsi_lowering creates additional BCOLOR inputs
(matching up to the BCOLOR outputs on the vert shader).  These inputs
should copy the interpolation state of their matching COLOR input.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agofreedreno/a3xx,a4xx: silence some warnings
Rob Clark [Fri, 27 Feb 2015 02:06:02 +0000 (21:06 -0500)]
freedreno/a3xx,a4xx: silence some warnings

  fd3_emit.c: In function ‘fd3_emit_vertex_bufs’:
  fd3_emit.c:377:11: warning: unused variable ‘semantic’ [-Wunused-variable]
     uint8_t semantic = sem2name(vp->inputs[i].semantic);

and

  fd4_emit.c: In function ‘fd4_emit_vertex_bufs’:
  fd4_emit.c:304:11: warning: unused variable ‘semantic’ [-Wunused-variable]
     uint8_t semantic = sem2name(vp->inputs[i].semantic);

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agoc99_alloca.h: add case for __sun
Brian Paul [Tue, 3 Mar 2015 15:09:21 +0000 (08:09 -0700)]
c99_alloca.h: add case for __sun

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
9 years agoconfigure: Leverage gcc warn options to enable safe use of C99 features where possible.
Jose Fonseca [Thu, 26 Feb 2015 16:46:48 +0000 (16:46 +0000)]
configure: Leverage gcc warn options to enable safe use of C99 features where possible.

The main objective of this change is to enable Linux developers to use
more of C99 throughout Mesa, with confidence that the portions that need
to be built with MSVC -- and only those portions --, stay portable.

This is achieved by using the appropriate -Werror= options only on the
places they need to be used.

Unfortunately we still need MSVC 2008 on a few portions of the code
(namely llvmpipe and its dependencies).  I hope to eventually eliminate
this so that we can use C99 everywhere, but there are technical/logistic
challenges (specifically, newer Windows SDKs no longer bundle MSVC,
instead require a full installation of Visual Studio, and that has
hindered adoption of newer MSVC versions on our build processes.)
Thankfully we have more directy control over our OpenGL driver, which is
why we're now able to migrate to MSVC 2013 for most of the tree.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Fix assertion in brw_reg_type_letters
Ben Widawsky [Fri, 28 Nov 2014 22:28:19 +0000 (14:28 -0800)]
i965: Fix assertion in brw_reg_type_letters

While using various debugging features (optimization debug, instruction dumping,
etc) this function is called in order to get a readable letter for the type of
unit.

On GEN8, two new units were added, the Qword and the Unsigned Qword (Q, and UQ
respectively). The existing assertion tries to determine that the argument
passed in is within the correct boundary, however, it was using UQ as the upper
limit instead of Q.

To my knowledge you can only hit this case with the branch I am currently
working on, so it doesn't fix any known issues.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Rename some PIPE_CONTROL flags
Ben Widawsky [Fri, 27 Feb 2015 07:01:33 +0000 (23:01 -0800)]
i965: Rename some PIPE_CONTROL flags

I'm not really sure of the origins of the existing flag names. Modern docs have
some slightly different names. Having the correct names makes it easier to
determine if existing PIPE_CONTROL flag settings are correct, as well as making
adding new PIPE_CONTROLs easier.

This originally came up while I was trying to implement workarounds and spotted
some things called, "flush" which should have been called "invalidate."

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs: Don't use backend_visitor::instructions after creating the CFG.
Matt Turner [Tue, 13 Jan 2015 23:35:57 +0000 (15:35 -0800)]
i965/fs: Don't use backend_visitor::instructions after creating the CFG.

This is a fix for a regression introduced in commit a9f8296d ("i965/fs:
Preserve the CFG in a few more places.").

The errata this code works around is described in a comment before the function:

   "[DevBW, DevCL] Errata: A destination register from a send can not be
    used as a destination register until after it has been sourced by an
    instruction with a different destination register.

The framebuffer write's sources must be in message registers, which SEND
instructions cannot have as a destination. There's no way for this
errata to affect anything at the end of the program. Just remove the
code.

Cc: 10.4, 10.5 <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84613
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomain/base_tex_format: Properly handle STENCIL_INDEX1/4/16
Jason Ekstrand [Fri, 27 Feb 2015 23:53:11 +0000 (18:53 -0500)]
main/base_tex_format: Properly handle STENCIL_INDEX1/4/16

This takes "fbo-stencil blit GL_STENCIL_INDEX1/4/16" from crash to pass on
BDW.

Cc: 10.5 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agometa/TexSubImage: Stash everything other than PIXEL_TRANSFER/store in meta_begin
Jason Ekstrand [Fri, 27 Feb 2015 20:29:03 +0000 (12:29 -0800)]
meta/TexSubImage: Stash everything other than PIXEL_TRANSFER/store in meta_begin

Previously, there were bugs where if the app set a scissor it could affect
the area of the texture that was downloaded.  There was also potential that
the framebuffer SRGB state could affect downloads.  This ensures that those
will get saved/restored and can't affect the texture download.

Cc: 10.5 <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89292
Reviewed-by: Neil Roberts <neil@linux.intel.com>
9 years agoi915: Remove hand-rolled memcpy implementation.
Matt Turner [Sat, 21 Feb 2015 04:32:14 +0000 (20:32 -0800)]
i915: Remove hand-rolled memcpy implementation.

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoi965: Remove hand-rolled memcpy implementation.
Matt Turner [Sat, 21 Feb 2015 04:28:52 +0000 (20:28 -0800)]
i965: Remove hand-rolled memcpy implementation.

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoi965: Consider scratch writes to have side effects.
Matt Turner [Sat, 28 Feb 2015 21:36:21 +0000 (13:36 -0800)]
i965: Consider scratch writes to have side effects.

We could do better by tracking scratch reads and writes.

Cc: 10.5 <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88793
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agomesa: Correct backwards NULL check.
Matt Turner [Sat, 28 Feb 2015 19:14:02 +0000 (11:14 -0800)]
mesa: Correct backwards NULL check.

Cc: "10.4, 10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agomesa: Free memory allocated for luminance in readpixels.
Matt Turner [Sat, 28 Feb 2015 19:08:17 +0000 (11:08 -0800)]
mesa: Free memory allocated for luminance in readpixels.

Cc: "10.4, 10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agomesa: Indent break statements and add a missing one.
Matt Turner [Sat, 28 Feb 2015 19:00:51 +0000 (11:00 -0800)]
mesa: Indent break statements and add a missing one.

Always indenting break statements makes spotting missing ones easier.

Cc: "10.4, 10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoc99_alloca.h: Include stdlib.h on all non-Windows.
Vinson Lee [Sun, 1 Mar 2015 20:52:00 +0000 (13:52 -0700)]
c99_alloca.h: Include stdlib.h on all non-Windows.

Fix build on FreeBSD.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89364
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Tested-by: Brian Paul <brianp@vmware.com>
9 years agomesa: remove extra definition of ARRAY_SIZE in src/mesa/main/macros.h
Brian Paul [Sat, 28 Feb 2015 20:33:11 +0000 (13:33 -0700)]
mesa: remove extra definition of ARRAY_SIZE in src/mesa/main/macros.h

Already defined in src/util/macros.h

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: remove the Elements() macro definition
Brian Paul [Sat, 28 Feb 2015 16:11:43 +0000 (09:11 -0700)]
mesa: remove the Elements() macro definition

No longer used.

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoutil: replace Elements() with ARRAY_SIZE()
Brian Paul [Sat, 28 Feb 2015 20:28:06 +0000 (13:28 -0700)]
util: replace Elements() with ARRAY_SIZE()

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoradeon: replace Elements() with ARRAY_SIZE()
Brian Paul [Sat, 28 Feb 2015 16:05:54 +0000 (09:05 -0700)]
radeon: replace Elements() with ARRAY_SIZE()

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>