mesa.git
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>
9 years agomesa: use fi_type in vertex attribute code
Marius Predut [Wed, 25 Feb 2015 16:49:45 +0000 (09:49 -0700)]
mesa: use fi_type in vertex attribute code

For 32-bit builds, floating point operations use x86 FPU registers,
not SSE registers.  If we're actually storing an integer in a float
variable, the value might get modified when written to memory.  This
patch changes the VBO code to use the fi_type (float/int union) to
store/copy vertex attributes.

Also, this can improve performance on x86 because moving floats with
integer registers instead of FP registers is faster.

Neil Roberts review:
- include changes on all places that are storing attribute values.
- check with and without -O3 compiler flag.
Brian Paul review:
- use fi_type type instead gl_constant_value type
- fix a bunch of nit-picks.
- fix compiler warnings

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82668
Signed-off-by: Marius Predut <marius.predut@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoi965/gen8: Use HALIGN_16 if MCS is enabled for non-MSRT
Anuj Phogat [Fri, 13 Feb 2015 19:21:21 +0000 (11:21 -0800)]
i965/gen8: Use HALIGN_16 if MCS is enabled for non-MSRT

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
9 years agoi965: Pass pointer to miptree as function parameter in intel_horizontal_texture_align...
Anuj Phogat [Fri, 20 Feb 2015 20:26:36 +0000 (12:26 -0800)]
i965: Pass pointer to miptree as function parameter in intel_horizontal_texture_alignment_unit

This will be used by next patch in the series.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
9 years agoi965: Allocate texture buffer in intelTexImage
Anuj Phogat [Thu, 5 Feb 2015 20:24:57 +0000 (12:24 -0800)]
i965: Allocate texture buffer in intelTexImage

before calling _mesa_meta_pbo_TexSubImage(). This will be used in
later patches and will be required in Skylake to get the tile
resource mode of miptree before calling _mesa_meta_pbo_TexSubImage().

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
9 years agoi965: Make a function to check the conditions to use the blitter
Anuj Phogat [Fri, 13 Feb 2015 02:49:13 +0000 (18:49 -0800)]
i965: Make a function to check the conditions to use the blitter

No functional changes in the patch. Just makes the code look cleaner.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
9 years agoi965: Move the comment to the right place
Anuj Phogat [Fri, 13 Feb 2015 00:59:12 +0000 (16:59 -0800)]
i965: Move the comment to the right place

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
9 years agoi965: Fix condition to use Y tiling in blitter in intel_miptree_create()
Anuj Phogat [Tue, 17 Feb 2015 18:40:58 +0000 (10:40 -0800)]
i965: Fix condition to use Y tiling in blitter in intel_miptree_create()

Y tiling is supported in blitter on SNB+.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
9 years agometa: Pass null pointer for the pixel data to avoid unnecessary data upload
Anuj Phogat [Mon, 23 Feb 2015 18:56:14 +0000 (10:56 -0800)]
meta: Pass null pointer for the pixel data to avoid unnecessary data upload

to a temporary pbo created in _mesa_meta_pbo_GetTexSubImage().

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
9 years agometa: Fix buffer object assignment to account for both pack and unpack bo's
Anuj Phogat [Wed, 4 Feb 2015 00:56:04 +0000 (16:56 -0800)]
meta: Fix buffer object assignment to account for both pack and unpack bo's

create_texture_for_pbo() is shared by _mesa_meta_pbo_GetTexSubImage()
and _mesa_meta_pbo_TexSubImage() functions. So, we need to account
for both pack and unpack buffer objects.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
9 years agometa: Use GL_STREAM_READ for pbo created with GL_PIXEL_PACK_BUFFER
Anuj Phogat [Wed, 4 Feb 2015 00:50:57 +0000 (16:50 -0800)]
meta: Use GL_STREAM_READ for pbo created with GL_PIXEL_PACK_BUFFER

create_texture_for_pbo() is used by both _mesa_meta_pbo_GetTexSubImage()
and _mesa_meta_pbo_TexSubImage() functions with different PBO targets.
Use GL_STREAM_READ with GL_PIXEL_PACK_BUFFER and GL_STREAM_DRAW with
GL_PIXEL_UNPACK_BUFFER.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
9 years agometa: Add assertion check for ctx->Meta->SaveStackDepth
Anuj Phogat [Wed, 4 Feb 2015 01:04:45 +0000 (17:04 -0800)]
meta: Add assertion check for ctx->Meta->SaveStackDepth

before using it for derefrencing.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
9 years agometa: Do power of two samples check only for samples > 0
Anuj Phogat [Mon, 1 Jan 2001 00:05:42 +0000 (16:05 -0800)]
meta: Do power of two samples check only for samples > 0

otherwise samples=0 passes the check, which is invalid.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
9 years agoglsl: Rewrite and fix min/max to saturate optimization.
Matt Turner [Tue, 24 Feb 2015 18:41:52 +0000 (10:41 -0800)]
glsl: Rewrite and fix min/max to saturate optimization.

There were some bugs, and the code was really difficult to follow. We
would optimize

   min(max(x, b), 1.0) into max(sat(x), b)

but not pay attention to the order of min/max and also do

   max(min(x, b), 1.0) into max(sat(x), b)

Corrects four shaders from Champions of Regnum that do

   min(max(x, 1), 10)

and corrects rendering of Mass Effect under VMware Workstation.

Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89180
Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agofreedreno: drop ARRAY_SIZE macro
Rob Clark [Wed, 25 Feb 2015 13:35:32 +0000 (08:35 -0500)]
freedreno: drop ARRAY_SIZE macro

Since now ARRAY_SIZE has been added to util/macros.h.  Fixes a bunch of:

  freedreno_util.h:79:0: warning: "ARRAY_SIZE" redefined
   #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
   ^
  In file included from ../../../../src/gallium/include/pipe/p_compiler.h:36:0,
                   from ../../../../src/gallium/include/pipe/p_context.h:31,
                   from freedreno_context.h:32,
                   from freedreno_context.c:29:
  ../../../../src/util/macros.h:29:0: note: this is the location of the previous definition
   #  define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
   ^

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agoi965: Don't force x-tiling for 16-bpp formats on Gen>7
Neil Roberts [Thu, 19 Feb 2015 16:09:41 +0000 (16:09 +0000)]
i965: Don't force x-tiling for 16-bpp formats on Gen>7

Sandybridge doesn't support y-tiling for surface formats with 16 or
more bpp. There was previously an override to explicitly allow this
for Gen7. However, this restriction is also removed in Gen8+ so we
should use y-tiling there too.

This is important to do for Skylake which doesn't support x-tiling for
3D surfaces.

Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
9 years agoglx: Fix returned values of GLX_RENDERER_PREFERRED_PROFILE_MESA
Andreas Boll [Tue, 24 Feb 2015 19:01:30 +0000 (20:01 +0100)]
glx: Fix returned values of GLX_RENDERER_PREFERRED_PROFILE_MESA

If the renderer supports the core profile the query returned incorrectly
0x8 as value, because it was using (1U << __DRI_API_OPENGL_CORE) for the
returned value.

The same happened with the compatibility profile. It returned 0x1
(1U << __DRI_API_OPENGL) instead of 0x2.

Internal DRI defines:
   dri_interface.h: #define __DRI_API_OPENGL       0
   dri_interface.h: #define __DRI_API_OPENGL_CORE  3

Those two bits are supposed for internal usage only and should be
translated to GLX_CONTEXT_CORE_PROFILE_BIT_ARB (0x1) for a preferred
core context profile and GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB (0x2)
for a preferred compatibility context profile.

This patch implements the above translation in the glx module.

v2: Fix the incorrect behavior in the glx module

Cc: "10.3 10.4 10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agodri/common: Update comment about driQueryRendererIntegerCommon
Andreas Boll [Mon, 9 Feb 2015 10:18:04 +0000 (11:18 +0100)]
dri/common: Update comment about driQueryRendererIntegerCommon

Since 87d3ae0b45b6b6bb50b583dafa55eb109449a005
driQueryRendererIntegerCommon handles __DRI2_RENDERER_PREFFERED_PROFILE
too.

Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: add double support for packing varyings
Ilia Mirkin [Fri, 20 Feb 2015 09:08:38 +0000 (04:08 -0500)]
glsl: add double support for packing varyings

Doubles are always packed, but a single double will never cross a slot
boundary -- single slots can still be wasted in some situations.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agocommon: Fix PBOs for 1D_ARRAY.
Laura Ekstrand [Thu, 19 Feb 2015 01:17:38 +0000 (17:17 -0800)]
common: Fix PBOs for 1D_ARRAY.

Corrects the way that _mesa_meta_pbo_TexSubImage and
_mesa_meta_pbo_GetTexSubImage handle 1D_ARRAY textures.  Fixes a failure in
the Piglit arb_direct_state_access/gettextureimage-targets test.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Tested-by: Laura Ekstrand <laura@jlekstrand.net>
Cc: "10.4, 10.5" <mesa-stable@lists.freedesktop.org>
9 years agocommon: Correct PBO 2D_ARRAY handling.
Laura Ekstrand [Tue, 24 Feb 2015 22:51:29 +0000 (14:51 -0800)]
common: Correct PBO 2D_ARRAY handling.

Changes PBO uploads and downloads to use a tall (height * depth) 2D texture
for blitting. This fixes the bug where 2D_ARRAY, 3D, and CUBE_MAP_ARRAY
textures are not properly uploaded and downloaded.

Removes the option to use a 2D ARRAY texture for the PBO during upload and
download.  This option didn't work because the miptree couldn't be set up
reliably.

v2: Review from Jason Ekstrand and Neil Roberts:
   -Delete the depth parameter from create_texture_for_pbo
   -Abandon the option to create a 2D ARRAY texture in create_texture_for_pbo

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Cc: "10.4, 10.5" <mesa-stable@lists.freedesktop.org>
9 years agocommon: Correct texture init for meta pbo uploads and downloads.
Laura Ekstrand [Tue, 24 Feb 2015 21:29:11 +0000 (13:29 -0800)]
common: Correct texture init for meta pbo uploads and downloads.

This moves the line setting immutability for the texture to after
_mesa_initialize_texture_object so that the initializer function will not
cancel it out. Moreover, because of the ARB_texture_view extension, immutable
textures must have NumLayers > 0, or depth will equal (0-1)=0xFFFFFFFF during
SURFACE_STATE setup, which triggers assertions.

v2: Review from Kenneth Graunke:
   - Include more explanation in the commit message.
   - Make texture setup bug fixes into a separate patch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Cc: "10.4, 10.5" <mesa-stable@lists.freedesktop.org>
9 years agomesa: remove DEG2RAD macro
Brian Paul [Tue, 24 Feb 2015 22:26:34 +0000 (15:26 -0700)]
mesa: remove DEG2RAD macro

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: remove MAX_GLUSHORT, move MAX_GLUINT
Brian Paul [Tue, 24 Feb 2015 22:23:22 +0000 (15:23 -0700)]
mesa: remove MAX_GLUSHORT, move MAX_GLUINT

The later is only used in one place in swrast.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: move signbit() macro to c99_math.h
Brian Paul [Tue, 24 Feb 2015 22:11:45 +0000 (15:11 -0700)]
mesa: move signbit() macro to c99_math.h

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: remove unused isblank() function
Brian Paul [Tue, 24 Feb 2015 22:05:47 +0000 (15:05 -0700)]
mesa: remove unused isblank() function

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglcpp: remove unneeded #include of core.h
Brian Paul [Tue, 24 Feb 2015 22:05:05 +0000 (15:05 -0700)]
glcpp: remove unneeded #include of core.h

isblank() is not used in the code.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: remove sqrtf macro
Brian Paul [Tue, 24 Feb 2015 22:03:44 +0000 (15:03 -0700)]
mesa: remove sqrtf macro

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Remove redundant discard jumps.
Kenneth Graunke [Sun, 6 Jul 2014 05:10:41 +0000 (22:10 -0700)]
i965: Remove redundant discard jumps.

With the previous optimization in place, some shaders wind up with
multiple discard jumps in a row, or jumps directly to the next
instruction.  We can remove those.

Without NIR on Haswell:
total instructions in shared programs: 5777258 -> 5775872 (-0.02%)
instructions in affected programs:     20312 -> 18926 (-6.82%)
helped:                                716

With NIR on Haswell:
total instructions in shared programs: 5773163 -> 5771785 (-0.02%)
instructions in affected programs:     21040 -> 19662 (-6.55%)
helped:                                717

v2: Use the CFG rather than the old instructions list.  Presumably
    the placeholder halt will be in the last basic block.

v3: Make sure placeholder_halt->prev isn't the head sentinel (caught
    twice 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>
9 years agoglsl: Optimize "if (cond) discard;" to a conditional discard.
Kenneth Graunke [Thu, 23 Oct 2014 03:48:21 +0000 (20:48 -0700)]
glsl: Optimize "if (cond) discard;" to a conditional discard.

st_glsl_to_tgsi and ir_to_mesa have handled conditional discards for a
long time; the previous patch added that capability to i965.

i965 (Haswell) shader-db stats:

Without NIR:
total instructions in shared programs: 5792133 -> 5776360 (-0.27%)
instructions in affected programs:     737585 -> 721812 (-2.14%)
helped:                                6300
HURT:                                  68
GAINED:                                2

With NIR:
total instructions in shared programs: 5787538 -> 5769569 (-0.31%)
instructions in affected programs:     767843 -> 749874 (-2.34%)
helped:                                6522
HURT:                                  35
GAINED:                                6

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoi965/fs: Handle conditional discards.
Kenneth Graunke [Tue, 19 Aug 2014 22:22:43 +0000 (15:22 -0700)]
i965/fs: Handle conditional discards.

The discard condition tells us which channels we want killed.  We want
to invert that condition to get the channels that should survive (remain
live) in f0.1.  Emit a CMP to negate it.

Nothing generates these today, but that will change shortly.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agonir: Introduce nir_intrinsic_discard_if.
Kenneth Graunke [Tue, 24 Feb 2015 07:47:00 +0000 (23:47 -0800)]
nir: Introduce nir_intrinsic_discard_if.

This is a conditional discard, which takes a boolean source.

Note that we don't generate ir_discard::condition today, so this
shouldn't break drivers (since none implement this intrinsic yet).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoglsl: Delete dead discard conditions in constant folding.
Kenneth Graunke [Tue, 24 Feb 2015 09:00:22 +0000 (01:00 -0800)]
glsl: Delete dead discard conditions in constant folding.

opt_constant_folding() already detects conditional assignments where the
condition is constant, and either deletes the assignment or the
condition.

Make it handle discards in the same fashion.

Spotted happening in the wild in Tropico 5 shaders.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoglsl: Handle conditional discards in lower_discard_flow().
Kenneth Graunke [Tue, 24 Feb 2015 07:12:39 +0000 (23:12 -0800)]
glsl: Handle conditional discards in lower_discard_flow().

This pass wasn't prepared to handle conditional discards.

Instead of initializing the "discarded" temporary to "true", set it to
the condition.  Then, refer to the variable for the condition, to avoid
duplicating the expression tree.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoglsl: Make ir_rvalue_visitor visit ir_discard::condition.
Kenneth Graunke [Tue, 24 Feb 2015 06:00:34 +0000 (22:00 -0800)]
glsl: Make ir_rvalue_visitor visit ir_discard::condition.

This was forgotten.

I omitted the NULL check since we don't check ir_assignment::condition
either.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoglsl: Make ir_validate check the type of ir_discard::condition.
Kenneth Graunke [Tue, 24 Feb 2015 06:56:47 +0000 (22:56 -0800)]
glsl: Make ir_validate check the type of ir_discard::condition.

Copy and pasted from the ir_if::condition handling, plus a NULL check.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoRevert "i965/fs: Remove force_writemask_all assertion for execsize < 8."
Matt Turner [Tue, 24 Feb 2015 20:11:21 +0000 (12:11 -0800)]
Revert "i965/fs: Remove force_writemask_all assertion for execsize < 8."

This reverts commit 0d8f27eab7b7e8b7a16e76aabd3f6a0ab4880497.

"This doesn't seem to be necessary." <- I was wrong!

Tested-by: Markus Wick <markus@selfnet.de>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoi965/fs: Emit MOV(1) instructions with force_writemask_all.
Matt Turner [Tue, 24 Feb 2015 20:03:37 +0000 (12:03 -0800)]
i965/fs: Emit MOV(1) instructions with force_writemask_all.

Fixes rendering with Dolphin.

Tested-by: Markus Wick <markus@selfnet.de>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoi965/fs: Optimize (gl_FrontFacing ? x : y) where x and y are ±1.0.
Matt Turner [Mon, 22 Dec 2014 03:50:03 +0000 (19:50 -0800)]
i965/fs: Optimize (gl_FrontFacing ? x : y) where x and y are ±1.0.

total instructions in shared programs: 5695356 -> 5689775 (-0.10%)
instructions in affected programs:     486231 -> 480650 (-1.15%)
helped:                                2604
LOST:                                  1

9 years agoi965/fs/nir: Optimize integer multiply by a 16-bit constant.
Matt Turner [Sun, 15 Feb 2015 22:03:09 +0000 (14:03 -0800)]
i965/fs/nir: Optimize integer multiply by a 16-bit constant.

Gen8+ support was just broken, since MUL now consumes 32-bits from both
sources. Fixes 986 piglit tests on my BDW.

total instructions in shared programs: 7753873 -> 7753522 (-0.00%)
instructions in affected programs:     28164 -> 27813 (-1.25%)
helped:                                77
GAINED:                                47

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoi965/fs/nir: Optimize (gl_FrontFacing ? x : y) where x and y are ±1.0.
Matt Turner [Sun, 15 Feb 2015 21:45:04 +0000 (13:45 -0800)]
i965/fs/nir: Optimize (gl_FrontFacing ? x : y) where x and y are ±1.0.

total instructions in shared programs: 7756214 -> 7753873 (-0.03%)
instructions in affected programs:     455452 -> 453111 (-0.51%)
helped:                                2333

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agonir/register: Add a parent_instr field
Jason Ekstrand [Fri, 30 Jan 2015 05:45:53 +0000 (21:45 -0800)]
nir/register: Add a parent_instr field

This adds a parent_instr field similar to the one for ssa_def.  The
difference here is that the parent_instr field on a nir_register can be
NULL if the register does not have a unique definition or if that
definition does not dominate all its uses.  We set this field in the
out-of-SSA pass so that backends can get SSA-like information even after
they have gone out of SSA.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agost/mesa: remove unused/broken function st_print_shaders
Marek Olšák [Sat, 21 Feb 2015 22:20:05 +0000 (23:20 +0100)]
st/mesa: remove unused/broken function st_print_shaders

Reviewed-by: Dave Airlie <airlied@redhat.com>
9 years agost/mesa: remove struct qualifier from st_src_reg parameter
Brian Paul [Tue, 24 Feb 2015 16:59:30 +0000 (09:59 -0700)]
st/mesa: remove struct qualifier from st_src_reg parameter

It's a class.  Silences MSVC warning.

9 years agomesa: remove INV_SQRTF() macro
Brian Paul [Tue, 24 Feb 2015 16:39:51 +0000 (09:39 -0700)]
mesa: remove INV_SQRTF() macro

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: remove ceilf, floorf macros
Brian Paul [Tue, 24 Feb 2015 16:33:41 +0000 (09:33 -0700)]
mesa: remove ceilf, floorf macros

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: remove expf macro
Brian Paul [Tue, 24 Feb 2015 16:32:27 +0000 (09:32 -0700)]
mesa: remove expf macro

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: remove logf macro
Brian Paul [Tue, 24 Feb 2015 16:31:34 +0000 (09:31 -0700)]
mesa: remove logf macro

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: remove powf macro
Brian Paul [Tue, 24 Feb 2015 16:26:41 +0000 (09:26 -0700)]
mesa: remove powf macro

Use the wrapper in c99_math.h if needed.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: remove unused exp2f, log2f, truncf wrappers
Brian Paul [Tue, 24 Feb 2015 16:24:27 +0000 (09:24 -0700)]
mesa: remove unused exp2f, log2f, truncf wrappers

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: remove unused acosf, asinf, atan2f, etc. macros
Brian Paul [Tue, 24 Feb 2015 16:20:12 +0000 (09:20 -0700)]
mesa: remove unused acosf, asinf, atan2f, etc. macros

Not used anywhere.  If any of these are needed, they should be added
to c99_math.h

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: replace FABSF with fabsf
Brian Paul [Tue, 24 Feb 2015 16:08:50 +0000 (09:08 -0700)]
mesa: replace FABSF with fabsf

Reviewed-by: Matt Turner <mattst88@gmail.com>