mesa.git
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>
9 years agor200: replace Elements() with ARRAY_SIZE()
Brian Paul [Sat, 28 Feb 2015 16:05:48 +0000 (09:05 -0700)]
r200: replace Elements() with ARRAY_SIZE()

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonouveau: replace Elements() with ARRAY_SIZE()
Brian Paul [Sat, 28 Feb 2015 16:05:40 +0000 (09:05 -0700)]
nouveau: replace Elements() with ARRAY_SIZE()

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoi965: replace Elements() with ARRAY_SIZE()
Brian Paul [Sat, 28 Feb 2015 16:05:29 +0000 (09:05 -0700)]
i965: replace Elements() with ARRAY_SIZE()

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoi915: replace Elements() with ARRAY_SIZE()
Brian Paul [Sat, 28 Feb 2015 16:05:24 +0000 (09:05 -0700)]
i915: replace Elements() with ARRAY_SIZE()

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agomapi: replace Elements() with ARRAY_SIZE()
Brian Paul [Sat, 28 Feb 2015 16:11:29 +0000 (09:11 -0700)]
mapi: replace Elements() with ARRAY_SIZE()

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: replace Elements() with ARRAY_SIZE()
Brian Paul [Sat, 28 Feb 2015 16:11:23 +0000 (09:11 -0700)]
glsl: replace Elements() with ARRAY_SIZE()

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agost/dri: replace Elements() with ARRAY_SIZE()
Brian Paul [Sat, 28 Feb 2015 16:11:13 +0000 (09:11 -0700)]
st/dri: replace Elements() with ARRAY_SIZE()

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agost/mesa: replace Elements() with ARRAY_SIZE()
Brian Paul [Sat, 28 Feb 2015 16:01:33 +0000 (09:01 -0700)]
st/mesa: replace Elements() with ARRAY_SIZE()

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agomesa/program: replace Elements() with ARRAY_SIZE()
Brian Paul [Sat, 28 Feb 2015 15:57:27 +0000 (08:57 -0700)]
mesa/program: replace Elements() with ARRAY_SIZE()

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agomesa/swrast: replace Elements() with ARRAY_SIZE()
Brian Paul [Sat, 28 Feb 2015 15:57:20 +0000 (08:57 -0700)]
mesa/swrast: replace Elements() with ARRAY_SIZE()

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agomesa/vbo: replace Elements() with ARRAY_SIZE()
Brian Paul [Sat, 28 Feb 2015 15:57:15 +0000 (08:57 -0700)]
mesa/vbo: replace Elements() with ARRAY_SIZE()

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agomesa/main: replace Elements() with ARRAY_SIZE()
Brian Paul [Sat, 28 Feb 2015 15:57:11 +0000 (08:57 -0700)]
mesa/main: replace Elements() with ARRAY_SIZE()

We've been using a mix of these two macros for a while now.  Let's
just use the later everywhere.  It seems to be the convention used
by other open-source projects.

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agomesa: trim down #includes in api_loopback.h
Brian Paul [Thu, 26 Feb 2015 20:06:57 +0000 (13:06 -0700)]
mesa: trim down #includes in api_loopback.h

Acked-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: trim down includes of compiler.h
Brian Paul [Thu, 26 Feb 2015 20:03:05 +0000 (13:03 -0700)]
mesa: trim down includes of compiler.h

In some cases, glheader.h is the right #include.
Also remove some instances of struct _glapi_table declarations.

Acked-by: Matt Turner <mattst88@gmail.com>
9 years agoscons: Fix HAVE___* definition.
Jose Fonseca [Fri, 27 Feb 2015 15:42:23 +0000 (15:42 +0000)]
scons: Fix HAVE___* definition.

These definitions must be moved before `cppdefines` is used to have effect.

Trivial.

9 years agoidentity: Remove.
Jose Fonseca [Fri, 27 Feb 2015 14:43:51 +0000 (14:43 +0000)]
identity: Remove.

It's unmaintained, and most likely broken: I use trace driver every now
and then, and everytime I do I need to fix it up.

It's also unused: identity_screen_create is never called.

Above all, it's dead weight: if identity driver had the infrastructure
for other pass-through drivers (like trace and rbug), then it would make
sense on its own right.  But as it is implemmented, it's just another
driver to (forget) to update whenever there is a gallium interface
change.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agoi965: Remove the create_raw_surface vtbl hook.
Francisco Jerez [Tue, 10 Feb 2015 13:54:55 +0000 (15:54 +0200)]
i965: Remove the create_raw_surface vtbl hook.

It's a wrapper around emit_buffer_surface_state with format=RAW, pitch=1,
rw=true and the remaining arguments ordered differently.  There's no point in
having a separate vtbl pointer for that.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965: Add missing defines for render cache messages.
Francisco Jerez [Sat, 23 Nov 2013 00:18:43 +0000 (16:18 -0800)]
i965: Add missing defines for render cache messages.

And remove duplicated definition of OWORD_DUAL_BLOCK_WRITE.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
9 years agoi965/skl: Lay out a 1D miptree horizontally
Neil Roberts [Thu, 12 Feb 2015 14:39:07 +0000 (14:39 +0000)]
i965/skl: Lay out a 1D miptree horizontally

On Gen9+ the 1D miptree is laid out with all of the mipmap levels in a
horizontal line.

Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
9 years agoi965/skl: Lay out 3D textures the same as array textures
Neil Roberts [Wed, 18 Feb 2015 18:27:45 +0000 (18:27 +0000)]
i965/skl: Lay out 3D textures the same as array textures

On Gen9+ the 3D textures use the same mipmap layout as 2D array
textures.

Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
9 years agoi965/skl: Fix the maximum thread count format for the PS
Neil Roberts [Fri, 27 Feb 2015 16:57:22 +0000 (16:57 +0000)]
i965/skl: Fix the maximum thread count format for the PS

According to the bspec for some reason the format of the maximum
number of threads field has changed from U8-2 to U8-1 for the PS.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agodraw: fix division-by-zero for empty geometry shaders
Marek Olšák [Sun, 1 Mar 2015 10:18:42 +0000 (11:18 +0100)]
draw: fix division-by-zero for empty geometry shaders

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

Reviewed-by: Dave Airlie <airlied@redhat.com>
9 years agoi965/gs: Check newly-generated GS-out VUE map against correct stage
Chris Forbes [Sat, 28 Feb 2015 06:57:20 +0000 (19:57 +1300)]
i965/gs: Check newly-generated GS-out VUE map against correct stage

Previously, we compared our new GS-out VUE map to the existing *VS*-out
VUE map, which is bogus.

This would mostly manifest as redundant dirty flagging where the GS is
in use but the VS and GS output layouts differ; but there is a scary
case where we would fail to flag a GS-out layout change if it happened
to match the VS-out layout.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Cc: "10.5, 10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88885

9 years agoi965: add GLSL_TYPE_DOUBLE switch case to silence warning
Brian Paul [Sat, 28 Feb 2015 15:43:16 +0000 (08:43 -0700)]
i965: add GLSL_TYPE_DOUBLE switch case to silence warning

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: include macros.h in stencil.h
Brian Paul [Thu, 26 Feb 2015 20:06:31 +0000 (13:06 -0700)]
mesa: include macros.h in stencil.h

Since it uses the CLAMP macro.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agomesa: move finite macro to imports.h
Brian Paul [Thu, 26 Feb 2015 20:22:36 +0000 (13:22 -0700)]
mesa: move finite macro to imports.h

Move it to the only place it's used.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agomesa: remove _NORMAPI, _NORMAPIP macros
Brian Paul [Thu, 26 Feb 2015 19:26:09 +0000 (12:26 -0700)]
mesa: remove _NORMAPI, _NORMAPIP macros

Was only used in one place.  Use equivalent _XFORMAPIP there instead.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agomesa: move FLT_MAX_EXP to c99_math.h
Brian Paul [Thu, 26 Feb 2015 18:35:10 +0000 (11:35 -0700)]
mesa: move FLT_MAX_EXP to c99_math.h

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agomesa: move ONE_DIV_SQRT_LN2 to prog_statevars.c
Brian Paul [Thu, 26 Feb 2015 18:34:23 +0000 (11:34 -0700)]
mesa: move ONE_DIV_SQRT_LN2 to prog_statevars.c

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agomesa: remove unused uninitialized_var() macro
Brian Paul [Sat, 28 Feb 2015 20:38:11 +0000 (13:38 -0700)]
mesa: remove unused uninitialized_var() macro

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: Check return value of __get_cpuid().
Matt Turner [Sat, 28 Feb 2015 18:06:26 +0000 (10:06 -0800)]
mesa: Check return value of __get_cpuid().

The use of the uninitialized_var() macro was to silence an uninitialized
variable warning that I assumed stemmed from gcc being unable to see
inside __get_cpuid() or understand its inline assembly.

In fact, it was because the __get_cpuid() function can fail, and not
initialize its arguments. Instead, check for failure and return early.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoi965/fs/nir: Mark fallthrough.
Matt Turner [Sat, 28 Feb 2015 18:46:33 +0000 (10:46 -0800)]
i965/fs/nir: Mark fallthrough.

9 years agoi965/fs/nir: Mark fallthrough.
Matt Turner [Sat, 28 Feb 2015 18:37:50 +0000 (10:37 -0800)]
i965/fs/nir: Mark fallthrough.

9 years agoi965: Avoid applying negate to wrong MAD source.
Matt Turner [Fri, 27 Feb 2015 18:59:17 +0000 (10:59 -0800)]
i965: Avoid applying negate to wrong MAD source.

For some given GLSL IR like (+ (neg x) (* 1.2 x)), the try_emit_mad
function would see that one of the +'s sources was a negate expression
and set mul_negate = true without confirming that it was actually a
multiply.

Cc: 10.5 <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89315
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89095
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoi965/vec4: Fix implementation of i2b.
Matt Turner [Fri, 27 Feb 2015 06:49:47 +0000 (22:49 -0800)]
i965/vec4: Fix implementation of i2b.

I broke this in commit 2881b123d. I must have misread i2b as b2i.

Cc: 10.5 <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88246
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoi965/fs/nir: Use emit_math for nir_op_fpow
Ian Romanick [Fri, 27 Feb 2015 22:17:50 +0000 (14:17 -0800)]
i965/fs/nir: Use emit_math for nir_op_fpow

It appears that all the other instructions that need it already use it.
This one just got missed.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
9 years agomapi: Don't rely on GNU void pointer arithmetic.
Matt Turner [Fri, 27 Feb 2015 19:42:43 +0000 (11:42 -0800)]
mapi: Don't rely on GNU void pointer arithmetic.

Commit 79daa510c added -Werror=pointer-arith to CFLAGS, which makes
arithmetic on void pointers an error.

See https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoRevert "configure: Leverage gcc warn options to enable safe use of C99 features where...
Kenneth Graunke [Fri, 27 Feb 2015 23:48:06 +0000 (15:48 -0800)]
Revert "configure: Leverage gcc warn options to enable safe use of C99 features where possible."

This reverts commit 79daa510c7a871a33797308a2ccb4b83a067ffbe.

I apparently hadn't done a clean build when testing this; it broke the
build for Tom, Ben, and myself.  We like the idea; let's try a v2.

9 years agoauxilary/os: correct sysctl use in os_get_total_physical_memory()
Jonathan Gray [Sun, 22 Feb 2015 08:19:25 +0000 (19:19 +1100)]
auxilary/os: correct sysctl use in os_get_total_physical_memory()

The length argument passed to sysctl was the size of the pointer
not the type.  The result of this is sysctl calls would fail on
32 bit BSD/Mac OS X.

Additionally the wrong pointer was passed as an argument to store
the result of the sysctl call.

Cc: "10.4, 10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoglsl: silence uninitialized var warning on MinGW
Brian Paul [Fri, 27 Feb 2015 20:06:06 +0000 (13:06 -0700)]
glsl: silence uninitialized var warning on MinGW

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agomesa: silence unused var warning in get_tex_rgba_uncompressed()
Brian Paul [Fri, 27 Feb 2015 20:05:42 +0000 (13:05 -0700)]
mesa: silence unused var warning in get_tex_rgba_uncompressed()

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agomesa: move declaration before code
Brian Paul [Fri, 27 Feb 2015 20:05:16 +0000 (13:05 -0700)]
mesa: move declaration before code

To fix MinGW warning.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agometa: silence declaration after code warning on MinGW
Brian Paul [Fri, 27 Feb 2015 20:04:38 +0000 (13:04 -0700)]
meta: silence declaration after code warning on MinGW

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agometa: silence uninitialized variable warnings for MinGW
Brian Paul [Fri, 27 Feb 2015 20:04:18 +0000 (13:04 -0700)]
meta: silence uninitialized variable warnings for MinGW

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agoc99_alloca.h: fix #include for MinGW
Brian Paul [Fri, 27 Feb 2015 20:03:03 +0000 (13:03 -0700)]
c99_alloca.h: fix #include for MinGW

As with MSVC, include malloc.h but don't redefine alloca.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89364
Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agogallium/util: add debug_print_usage_enum() debug helper
Brian Paul [Fri, 27 Feb 2015 20:00:50 +0000 (13:00 -0700)]
gallium/util: add debug_print_usage_enum() debug helper

Signed-off-by: Brian Paul <brianp@vmware.com>
9 years agogallium/util: fix 'statement with no effect' warning
Brian Paul [Fri, 27 Feb 2015 19:49:29 +0000 (12:49 -0700)]
gallium/util: fix 'statement with no effect' warning

Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agoi965: Fix I/L/LA SNORM formats.
Kenneth Graunke [Thu, 26 Feb 2015 22:29:25 +0000 (14:29 -0800)]
i965: Fix I/L/LA SNORM formats.

_mesa_choose_tex_format (texformat.c) tries I8_SNORM, L8_SNORM, and
either L8A8_SNORM or A8L8_SNORM, none of which are supported by our
driver.  Failing that, it falls back to RGBX for luminance, and RGBA
intensity and luminance alpha.  So, we need to use swizzle overrrides
to obtain the correct values.

Fixes Piglit's EXT_texture_snorm/fbo-blending-formats and
fbo-clear-formats.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965/fs: Patch the instruction generating discards; don't use CMP.Z.
Kenneth Graunke [Thu, 26 Feb 2015 00:08:14 +0000 (16:08 -0800)]
i965/fs: Patch the instruction generating discards; don't use CMP.Z.

CMP.Z doesn't work on Gen4-5 because the boolean isn't guaranteed to be
0 or 0xFFFFFFFF - only the low bit is defined.

We can call emit_bool_to_cond_code to generate the condition in f0.0;
the last instruction will generate the flag value.  We can patch it to
use f0.1, and negate the condition.

Fixes discard tests on Gen4-5.

Haswell shader-db stats:
total instructions in shared programs: 5770279 -> 5769112 (-0.02%)
instructions in affected programs:     64342 -> 63175 (-1.81%)
helped:                                1069

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/fs: Introduce brw_negate_cmod().
Kenneth Graunke [Thu, 26 Feb 2015 00:07:03 +0000 (16:07 -0800)]
i965/fs: Introduce brw_negate_cmod().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomain: Fix whitespace in teximage.c.
Laura Ekstrand [Mon, 9 Feb 2015 23:39:53 +0000 (15:39 -0800)]
main: Fix whitespace in teximage.c.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoradeonsi/compute: Enable PIPE_SHADER_CAP_DOUBLES v2
Tom Stellard [Thu, 26 Feb 2015 23:25:14 +0000 (23:25 +0000)]
radeonsi/compute: Enable PIPE_SHADER_CAP_DOUBLES v2

v2:
  - Simplify ifdef

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoclover: Don't unconditionally define cl_khr_fp64
Tom Stellard [Thu, 26 Feb 2015 23:20:06 +0000 (18:20 -0500)]
clover: Don't unconditionally define cl_khr_fp64

This should be done by the frontend for devices that support this
extension.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agopipe-loader: Fix build with dri drivers enabled, and vl state trackers disabled
Tom Stellard [Wed, 25 Feb 2015 00:43:43 +0000 (19:43 -0500)]
pipe-loader: Fix build with dri drivers enabled, and vl state trackers disabled

Configure arguments:

./configure --disable-dri3 --disable-xvmc --enable-opencl
            --with-gallium-drivers=r300,r600,radeonsi
            --with-egl-platforms=drm

Build error:

make[3]: *** No rule to make target
`../../../../src/gallium/auxiliary/libgalliumvlwinsys.la', needed by
`pipe_r300.la'.  Stop.

Cc: "10.5" <mesa-stable@lists.freedestkop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.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 agonir: Use alloca instead of variable length arrays.
Jose Fonseca [Thu, 26 Feb 2015 16:37:48 +0000 (16:37 +0000)]
nir: Use alloca instead of variable length arrays.

This is to enable the code to build with -Werror=vla in the short term,
and enable the code to build with MSVC2013 soon after.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: restore #include stdarg.h in imports.h
Brian Paul [Thu, 26 Feb 2015 20:33:54 +0000 (13:33 -0700)]
mesa: restore #include stdarg.h in imports.h

https://bugs.freedesktop.org/show_bug.cgi?id=89345
Signed-off-by: Brian Paul <brianp@vmware.com>
9 years agoc99_math.h: add defines for M_PI, M_E, M_LOG2E
Brian Paul [Thu, 26 Feb 2015 19:31:45 +0000 (12:31 -0700)]
c99_math.h: add defines for M_PI, M_E, M_LOG2E

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89342
Signed-off-by: Brian Paul <brianp@vmware.com>
9 years agor300g/tests: Include stdio.h.
Vinson Lee [Fri, 27 Feb 2015 05:00:15 +0000 (21:00 -0800)]
r300g/tests: Include stdio.h.

Fix build error.

  CC       compiler/tests/r300_compiler_tests-radeon_compiler_regalloc_tests.o
compiler/tests/radeon_compiler_regalloc_tests.c: In function ‘test_runner_rc_regalloc’:
compiler/tests/radeon_compiler_regalloc_tests.c:57:3: error: implicit declaration of function ‘fprintf’ [-Werror=implicit-function-declaration]
   fprintf(stderr, "Failed to load program\n");
   ^

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
9 years agoradeon/compiler: include stdio.h
Brian Paul [Thu, 26 Feb 2015 19:33:16 +0000 (12:33 -0700)]
radeon/compiler: include stdio.h

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89343
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
9 years agomain: Fix target checking for CompressedTexSubImage*D.
Laura Ekstrand [Wed, 25 Feb 2015 18:34:03 +0000 (10:34 -0800)]
main: Fix target checking for CompressedTexSubImage*D.

This fixes a dEQP test failure.  In the test,
glCompressedTexSubImage2D was called with target = 0 and failed to throw
INVALID ENUM. This failure was caused by _mesa_get_current_tex_object(ctx,
target) being called before the target checking.  To remedy this, target
checking was made into its own function and called prior to
_mesa_get_current_tex_object.

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

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agomain: Fix target checking for CopyTexSubImage*D.
Laura Ekstrand [Wed, 25 Feb 2015 23:45:47 +0000 (15:45 -0800)]
main: Fix target checking for CopyTexSubImage*D.

This fixes a dEQP test failure.  In the test,
glCopyTexSubImage2D was called with target = 0 and failed to throw
INVALID ENUM. This failure was caused by _mesa_get_current_tex_object(ctx,
target) being called before the target checking.  To remedy this, target
checking was separated from the main error-checking function and
called prior to _mesa_get_current_tex_object.

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

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agoc99: in c99_math.h check that _USE_MATH_DEFINES is defined with MSVC
Brian Paul [Thu, 26 Feb 2015 17:19:37 +0000 (10:19 -0700)]
c99: in c99_math.h check that _USE_MATH_DEFINES is defined with MSVC

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agomesa: remove unused INLINE macro from compiler.h
Brian Paul [Thu, 26 Feb 2015 16:52:20 +0000 (09:52 -0700)]
mesa: remove unused INLINE macro from compiler.h

We now use 'inline' everywhere in Mesa.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agost/mesa: replace INLINE with inline
Brian Paul [Thu, 26 Feb 2015 17:03:22 +0000 (10:03 -0700)]
st/mesa: replace INLINE with inline

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoswrast: replace INLINE with inline
Brian Paul [Thu, 26 Feb 2015 16:48:50 +0000 (09:48 -0700)]
swrast: replace INLINE with inline

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoradeon: replace INLINE with inline
Brian Paul [Thu, 26 Feb 2015 16:48:44 +0000 (09:48 -0700)]
radeon: replace INLINE with inline

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agor200: replace INLINE with inline
Brian Paul [Thu, 26 Feb 2015 16:48:34 +0000 (09:48 -0700)]
r200: replace INLINE with inline

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoi915: replace INLINE with inline
Brian Paul [Thu, 26 Feb 2015 16:48:24 +0000 (09:48 -0700)]
i915: replace INLINE with inline

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoinclude,auxiliary: Remove support for MSVC older then 2008.
Jose Fonseca [Thu, 26 Feb 2015 11:47:46 +0000 (11:47 +0000)]
include,auxiliary: Remove support for MSVC older then 2008.

MSVC 2008 (shipped with Windows SDK 7.0.7600) is the oldest we
need to support.  At least on llvmpipe, gallium/auxiliary, and util
modules.  For the remaining modules (particular all OpenGL specific
code) can be built with MSVC 2013.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agomesa: don't include stdint.h in compiler.h
Brian Paul [Wed, 25 Feb 2015 01:00:37 +0000 (18:00 -0700)]
mesa: don't include stdint.h in compiler.h

Not needed.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agomesa: don't include math.h in compiler.h
Brian Paul [Wed, 25 Feb 2015 00:56:45 +0000 (17:56 -0700)]
mesa: don't include math.h in compiler.h

Not needed by anything in that header.  Include math.h or c99_math.h
where needed instead.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agomesa: trim down #includes in compiler.h
Brian Paul [Wed, 25 Feb 2015 00:48:31 +0000 (17:48 -0700)]
mesa: trim down #includes in compiler.h

Don't include stuff we don't need.  Fix a few #includes elsewhere to
keep thing building.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agor300g: remove dependency on compiler.h
Brian Paul [Wed, 25 Feb 2015 00:47:00 +0000 (17:47 -0700)]
r300g: remove dependency on compiler.h

It only needs typical stdio.h and stdlib.h functions.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agomesa: don't include limits.h in compiler.h
Brian Paul [Wed, 25 Feb 2015 00:05:48 +0000 (17:05 -0700)]
mesa: don't include limits.h in compiler.h

Not needed.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agomesa: don't include float.h in compiler.h
Brian Paul [Wed, 25 Feb 2015 00:03:47 +0000 (17:03 -0700)]
mesa: don't include float.h in compiler.h

Not needed.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agomesa: only include ctype.h where it's used
Brian Paul [Tue, 24 Feb 2015 23:56:54 +0000 (16:56 -0700)]
mesa: only include ctype.h where it's used

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agomesa: include stdarg.h only where it's used
Brian Paul [Tue, 24 Feb 2015 23:55:53 +0000 (16:55 -0700)]
mesa: include stdarg.h only where it's used

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agomesa: remove M_PI, M_E, M_LOG2E macro definitions
Brian Paul [Tue, 24 Feb 2015 23:44:53 +0000 (16:44 -0700)]
mesa: remove M_PI, M_E, M_LOG2E macro definitions

Should be defined in math.h.  If not, we can add them to c99_math.h

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agoglsl: #include c99_math.h instead of core.h
Brian Paul [Tue, 24 Feb 2015 23:42:43 +0000 (16:42 -0700)]
glsl: #include c99_math.h instead of core.h

We only need the M_LOG2E definition.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agogallium: whitespace, comment formatting fixes in p_defines.h
Brian Paul [Thu, 26 Feb 2015 00:04:05 +0000 (17:04 -0700)]
gallium: whitespace, comment formatting fixes in p_defines.h

Just to keep things consistent.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agoutil: add debug_print_bind_flags() debug helper
Brian Paul [Wed, 25 Feb 2015 23:59:54 +0000 (16:59 -0700)]
util: add debug_print_bind_flags() debug helper

Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agogallium: renumber PIPE_BIND_ flags
Brian Paul [Wed, 25 Feb 2015 23:58:43 +0000 (16:58 -0700)]
gallium: renumber PIPE_BIND_ flags

Note that PIPE_BIND_COMMAND_ARGS_BUFFER and PIPE_BIND_LINEAR were both
bit 21 before.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
9 years agometa: In pbo_{Get,}TexSubImage don't repeatedly rebind the source tex
Neil Roberts [Wed, 25 Feb 2015 15:10:01 +0000 (15:10 +0000)]
meta: In pbo_{Get,}TexSubImage don't repeatedly rebind the source tex

A layered PBO image is now interpreted as a single tall 2D image so
the z argument in _mesa_meta_bind_fbo_image is ignored. Therefore this
was just redundantly rebinding the same image repeatedly.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>