mesa.git
9 years agoautomake: add missing egl files to the tarball
Emil Velikov [Sat, 21 Mar 2015 20:45:22 +0000 (20:45 +0000)]
automake: add missing egl files to the tarball

Namely the Haiku EGL driver backend and the SConscript for the dri2 EGL
driver backend.

Cc: Alexander von Gluck IV <kallisti5@unixzen.com>
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoglsl: Constify ir_instruction::equals
Ian Romanick [Thu, 19 Mar 2015 02:00:48 +0000 (19:00 -0700)]
glsl: Constify ir_instruction::equals

v2: Don't be lazy.  Constify the as_foo functions and use those instead
of ugly casts.  Suggested by Curro.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoglsl: Constify the as_foo functions
Ian Romanick [Tue, 24 Mar 2015 16:14:35 +0000 (09:14 -0700)]
glsl: Constify the as_foo functions

Now that they're all implemented using macros, this is trivial.

v2: Remove redundant parenthesis.  Suggested by Curro.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoglsl: Implement remaining as_foo functions with macros
Ian Romanick [Tue, 24 Mar 2015 16:02:24 +0000 (09:02 -0700)]
glsl: Implement remaining as_foo functions with macros

The downcast functions for non-leaf classes were previously implemented
"by hand."  Now they are implemented using macros based on the is_foo
functions added in the previous patch.

v2: Remove redundant parenthesis.  Suggested by Curro (on the next
patch).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoglsl: Add is_rvalue, is_dereference, and is_jump methods
Ian Romanick [Tue, 24 Mar 2015 15:55:15 +0000 (08:55 -0700)]
glsl: Add is_rvalue, is_dereference, and is_jump methods

These functions deteremine when an IR node is one of the non-leaf
classes.

v2: Adjust indentation to line up.  Suggested by Matt.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoutil/u_atomic: Ignore warnings interlocked accesses.
Jose Fonseca [Tue, 24 Mar 2015 19:56:21 +0000 (19:56 +0000)]
util/u_atomic: Ignore warnings interlocked accesses.

These are due how we implemented the atomic tests, not the atomic
implementation itself.  It's also difficult to refactor the code to
avoid the warnings due to the use of macros -- the code would be quite
hairy.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoscons: Disable MSVC warnings about inconsistent function annotation.
Jose Fonseca [Tue, 24 Mar 2015 19:50:48 +0000 (19:50 +0000)]
scons: Disable MSVC warnings about inconsistent function annotation.

Somehow, merely including any of the *intrin.h headers causes dozens of
this warnings (when compiling pretty much every source file).  MSVC does
not always complain the same -- so it's possible we're doing something
weird --, but silence these warnings in the meanwhile.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agomesa: Avoid MSVC C6334 warning in /analyze mode.
Jose Fonseca [Tue, 24 Mar 2015 19:01:46 +0000 (19:01 +0000)]
mesa: Avoid MSVC C6334 warning in /analyze mode.

MSVC's implementation of signbit(x) uses sizeof(x) with expressions to
dispatch to an internal function based on the argument's type (float,
double, etc), but that raises a flag with MSVC's own static analyzer,
and because this is an inline function in a header it causes substantial
warning spam.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoc99_math: Don't reimplement lrint and friends on MSVC 2013.
Jose Fonseca [Tue, 24 Mar 2015 13:16:24 +0000 (13:16 +0000)]
c99_math: Don't reimplement lrint and friends on MSVC 2013.

MSVC 2013 declares these functions, both for C and C++ source files.

This was caught with MSVC in analyze mode.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoscons: Don't build osmesa.
Jose Fonseca [Tue, 24 Mar 2015 20:30:03 +0000 (20:30 +0000)]
scons: Don't build osmesa.

There doesn't seem much interest on osmesa on Windows, particularly classic osmesa.

If there is indeed interest in osmesa on Windows, we should instead
integrate src/gallium/targets/osmesa into SCons.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoscons: Don't build loader on Windows.
Jose Fonseca [Tue, 24 Mar 2015 20:26:21 +0000 (20:26 +0000)]
scons: Don't build loader on Windows.

EGL was the last user.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoscons: Don't build egl on Windows.
Jose Fonseca [Tue, 24 Mar 2015 20:11:36 +0000 (20:11 +0000)]
scons: Don't build egl on Windows.

Useless, as there are no drivers for it.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoscons: Fix git_sha1.h generation fallback.
Jose Fonseca [Mon, 23 Mar 2015 10:48:31 +0000 (10:48 +0000)]
scons: Fix git_sha1.h generation fallback.

I didn't meant to remove the 'if not os.path.exists(filename)' statement.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agodocs: Update progress on ARB_direct_state_access.
Martin Peres [Thu, 19 Mar 2015 17:44:56 +0000 (19:44 +0200)]
docs: Update progress on ARB_direct_state_access.

v2:
- Fix the state of the Program pipelines and Query objects (Laura)

Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomain: Added entry points for NamedRenderbufferStorage/Multisample
Martin Peres [Fri, 13 Feb 2015 13:35:48 +0000 (15:35 +0200)]
main: Added entry points for NamedRenderbufferStorage/Multisample

v2: Review from Laura Ekstrand
- get rid of a change that should not have happened in this patch
- improve the error messages
- fix alignments
- fix a capitalization in a function name in an error message

v3: Review from Laura Ekstrand
- move the test for the validity of the renderbuffer to less generic
  functions
- get rid of some changes that accidentally landed in the wrong commit
- revert some alignment fixes

v3: Review from Laura Ekstrand
- check that the lookup returns a valid renderbuffer
- cosmetic changes to some error messages

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomain: Added entry point for glGetNamedRenderbufferParameteriv
Martin Peres [Fri, 13 Feb 2015 13:46:55 +0000 (15:46 +0200)]
main: Added entry point for glGetNamedRenderbufferParameteriv

v2:
- improve an error message

v3:
- move a test to less generic functions
- fix an alignment

v4:
- take the caller as a parameter instead of bool dsa
- check that the lookup returns a valid renderbuffer

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomain: Added entry point for glCreateRenderbuffers
Martin Peres [Thu, 12 Feb 2015 16:52:10 +0000 (18:52 +0200)]
main: Added entry point for glCreateRenderbuffers

v2:
- refactor bindRenderBuffer and create_render_buffers to fix an assertion

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomain: Added entry point for glCreateSamplers
Martin Peres [Thu, 12 Feb 2015 11:12:19 +0000 (13:12 +0200)]
main: Added entry point for glCreateSamplers

Because of the current way the code is architectured, there is no
functional difference between the DSA and the non-DSA path.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomain: Added entry point for glCreateProgramPipelines
Martin Peres [Wed, 11 Feb 2015 16:12:21 +0000 (18:12 +0200)]
main: Added entry point for glCreateProgramPipelines

v2:
- add spaces in an error message (Laura)

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomain: Added entry points for glGetQueryBufferObject*
Martin Peres [Mon, 16 Feb 2015 10:20:19 +0000 (12:20 +0200)]
main: Added entry points for glGetQueryBufferObject*

These entry points will be fleshed out when the GL_ARB_query_buffer_object
extension gets implemented. In the meantime, return GL_INVALID_OPERATION as
suggested by Ian.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomain: Added entry point for glCreateQueries
Martin Peres [Tue, 10 Feb 2015 15:13:06 +0000 (17:13 +0200)]
main: Added entry point for glCreateQueries

v2:
- display the name of the target instead of its id (Laura)

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomain: Added entry point for glGetTransformFeedbacki64_v
Martin Peres [Thu, 22 Jan 2015 14:55:29 +0000 (16:55 +0200)]
main: Added entry point for glGetTransformFeedbacki64_v

v2: Review from Laura Ekstrand
- use the transform feedback object lookup wrapper

v3:
- use the new name of _mesa_lookup_transform_feedback_object_err

v4: Review from Laura Ekstrand
- fix some alignement problems

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomain: Added entry point for glGetTransformFeedbacki_v
Martin Peres [Mon, 16 Feb 2015 14:13:59 +0000 (16:13 +0200)]
main: Added entry point for glGetTransformFeedbacki_v

v2: Review from Laura Ekstrand
- use the transform feedback object lookup wrapper

v3:
- use the new name of _mesa_lookup_transform_feedback_object_err

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomain: Added entry point for glGetTransformFeedbackiv
Martin Peres [Mon, 16 Feb 2015 14:13:58 +0000 (16:13 +0200)]
main: Added entry point for glGetTransformFeedbackiv

v2: Review from Laura Ekstrand
- use the transform feedback object lookup wrapper

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomain: Added entry point for glTransformFeedbackBufferRange
Martin Peres [Wed, 21 Jan 2015 10:22:11 +0000 (12:22 +0200)]
main: Added entry point for glTransformFeedbackBufferRange

v2: review from Laura Ekstrand
- use the refactored code to lookup the objects
- improve some error messages
- factor out the gl method name computation
- better handle the spec differences between the DSA and non-DSA cases
- quote the spec a little more

v3: review from Laura Ekstrand
- use the new name of _mesa_lookup_bufferobj_err
- swap the comments around the offset and size checks

v4: review from Laura Ekstrand
- add more spec quotes
- properly fix the comments around the offset and size checks

v5: review from Laura Ekstrand
- add quotes on the spec citations
- revert some changes in the printf format

v6: review from Laura Ekstrand
- remove a redondant "gl" in a method name

Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomain: Added entry point for glTransformFeedbackBufferBase
Martin Peres [Tue, 20 Jan 2015 14:30:32 +0000 (16:30 +0200)]
main: Added entry point for glTransformFeedbackBufferBase

v2: Review from Laura Ekstrand
- give more helpful error messages
- factor the lookup code for the xfb and objBuf
- replace some already-existing tabs with spaces
- add comments to explain the cases where xfb == 0 or buffer == 0
- fix the condition for binding the transform buffer or not

v3: Review from Laura Ekstrand
- rename _mesa_lookup_bufferobj_err to
  _mesa_lookup_transform_feedback_bufferobj_err and make it static to avoid a
  future conflict
- make _mesa_lookup_transform_feedback_object_err static

v4: Review from Laura Ekstrand
- add the pdf page number when quoting the spec
- rename some of the symbols to follow the public/private conventions

v5: Review from Laura Ekstrand
- properly rename some of the symbols to follow the public/private conventions
- fix some alignments
- add quotes around a spec citation
- add back a newline I accidentally deleted
- add spaces around the ternary operator usages

Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
9 years agomain: Added entry point for glCreateTransformFeedbacks
Martin Peres [Wed, 14 Jan 2015 16:17:21 +0000 (18:17 +0200)]
main: Added entry point for glCreateTransformFeedbacks

v2: Review from Laura Ekstrand
- generate the name of the gl method once
- shorten some lines to stay in the 78 chars limit

v3: Review from Fredrik Höglund <fredrik@kde.org>
- rename gl_mthd_name to func
- set EverBound in _mesa_create_transform_feedbacks in the dsa case

v4:
- rename _mesa_create_transform_feedbacks to create_transform_feedbacks and
  make it static

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomain: fix the validation of the number of samples
Martin Peres [Fri, 13 Feb 2015 16:14:15 +0000 (18:14 +0200)]
main: fix the validation of the number of samples

Maybe this should be the job of the dispatch layer.

v2:
- add the section name and pdf page number of the quote (Laura)
- OpenGL 3.0 core does not exist, get rid of "core"

Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomain: replace tabs by 8 spaces in fbobject.c
Martin Peres [Thu, 12 Feb 2015 15:54:43 +0000 (17:54 +0200)]
main: replace tabs by 8 spaces in fbobject.c

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomain: replace tabs by 8 spaces in bufferobj.c
Martin Peres [Wed, 11 Feb 2015 09:21:56 +0000 (11:21 +0200)]
main: replace tabs by 8 spaces in bufferobj.c

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomesa: Apply visibility flags to src/Makefile.am targets
Kristian Høgsberg [Tue, 24 Mar 2015 16:41:08 +0000 (09:41 -0700)]
mesa: Apply visibility flags to src/Makefile.am targets

We were building libglsl_util.la without our visibility flags and
leaking hash_table_* symbols.

Signed-off-by: Kristian Høgsberg <kristian.h.kristensen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir: Fix typo.
Matt Turner [Wed, 25 Mar 2015 02:14:18 +0000 (19:14 -0700)]
nir: Fix typo.

9 years agonir: Recognize sat(add(b2f(a), b2f(b))) as a logical OR.
Matt Turner [Wed, 18 Mar 2015 06:30:43 +0000 (23:30 -0700)]
nir: Recognize sat(add(b2f(a), b2f(b))) as a logical OR.

Transform this into b2f(or(a, b)).

instructions in affected programs:     432 -> 430 (-0.46%)
helped:                                2

Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Recognize mul(b2f(a), b2f(b)) as a logical AND.
Matt Turner [Wed, 18 Mar 2015 06:30:32 +0000 (23:30 -0700)]
nir: Recognize mul(b2f(a), b2f(b)) as a logical AND.

Transform this into b2f(and(a, b)).

total instructions in shared programs: 6205448 -> 6204391 (-0.02%)
instructions in affected programs:     284030 -> 282973 (-0.37%)
helped:                                903
HURT:                                  6

Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agoglsl: Recognize sat(add(b2f(a), b2f(b))) as a logical OR.
Matt Turner [Wed, 18 Mar 2015 17:39:38 +0000 (10:39 -0700)]
glsl: Recognize sat(add(b2f(a), b2f(b))) as a logical OR.

Transform this into b2f(or(a, b)).

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: Recognize mul(b2f(a), b2f(b)) as a logical AND.
Matt Turner [Wed, 18 Mar 2015 06:28:27 +0000 (23:28 -0700)]
glsl: Recognize mul(b2f(a), b2f(b)) as a logical AND.

Transform this into b2f(and(a, b)).

total instructions in shared programs: 6190291 -> 6189225 (-0.02%)
instructions in affected programs:     267247 -> 266181 (-0.40%)
helped:                                866

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agonir: Handle mixed scalar/vector arguments to logical and/or/xor.
Matt Turner [Mon, 23 Mar 2015 23:04:41 +0000 (16:04 -0700)]
nir: Handle mixed scalar/vector arguments to logical and/or/xor.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agoglsl: Allow vector logic ops to be generated.
Matt Turner [Wed, 18 Mar 2015 06:27:38 +0000 (23:27 -0700)]
glsl: Allow vector logic ops to be generated.

They're not accessible from the source language, but optimizations are
allowed to generate them.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoconfigure.ac: move AC_MSG_RESULT reporting back into the m4 macro
Emil Velikov [Mon, 23 Mar 2015 17:49:23 +0000 (17:49 +0000)]
configure.ac: move AC_MSG_RESULT reporting back into the m4 macro

The one who does AC_MSG_CHECKING should provide the AC_MSG_RESULT.

Fixes: ced9425327b (configure: Introduce new output variable to
ax_check_python_mako_module.m4"

Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89328
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
9 years agogallium/util: Use HAVE___BUILTIN_FFS* macros.
Jonathan Gray [Tue, 17 Mar 2015 01:49:39 +0000 (12:49 +1100)]
gallium/util: Use HAVE___BUILTIN_FFS* macros.

Make use of the builtin ffs macros and split out ffsll
to a seperate block.  Needed for at least OpenBSD which
does not have ffsll in libc.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoi965: add the remaining files to the tarball
Emil Velikov [Mon, 23 Mar 2015 16:17:36 +0000 (16:17 +0000)]
i965: add the remaining files to the tarball

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: add the remaining files to the tarball
Emil Velikov [Mon, 23 Mar 2015 16:17:35 +0000 (16:17 +0000)]
glsl: add the remaining files to the tarball

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomakefile: add all headers to the tarball
Emil Velikov [Mon, 23 Mar 2015 16:17:34 +0000 (16:17 +0000)]
makefile: add all headers to the tarball

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agogbm: remove gbm_gallium_drm from the loader
Emil Velikov [Sat, 21 Mar 2015 17:45:26 +0000 (17:45 +0000)]
gbm: remove gbm_gallium_drm from the loader

No longer used as of commit 48c7461d5a0(st/gbm: remove state-tracker)

v2: Add commit message.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> (v1)
9 years agoglsl: Generate link error for non-matching gl_FragCoord redeclarations
Anuj Phogat [Thu, 5 Mar 2015 19:07:52 +0000 (11:07 -0800)]
glsl: Generate link error for non-matching gl_FragCoord redeclarations

in different fragment shaders. This also applies to a case when gl_FragCoord
is redeclared with no layout qualifiers in one fragment shader and not
declared but used in other fragment shader.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Khronos Bug#12957
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agovc4: Add a dump-the-surface-contents routine.
Eric Anholt [Tue, 13 Jan 2015 20:58:35 +0000 (09:58 +1300)]
vc4: Add a dump-the-surface-contents routine.

This has been useful once again while trying to debug stride issues
between render targets and texturing.

9 years agovc4: Allow DRI3 on simulation, as well.
Eric Anholt [Mon, 23 Mar 2015 23:15:11 +0000 (16:15 -0700)]
vc4: Allow DRI3 on simulation, as well.

The problem I'd seen before seems to be gone.

9 years agovc4: Fix pitch alignment of linear textures.
Eric Anholt [Mon, 16 Mar 2015 21:48:26 +0000 (14:48 -0700)]
vc4: Fix pitch alignment of linear textures.

Fixes some non-power-of-two texture rendering when I force ARGB8888 to
raster.

9 years agovc4: Write the alignment of level width consistently in validation.
Eric Anholt [Mon, 23 Mar 2015 23:34:24 +0000 (16:34 -0700)]
vc4: Write the alignment of level width consistently in validation.

16 / cpp happens to be the same as utile_w on the only raster format
supported (4 bytes per pixel), but simulator/hw source code generally
talks in terms of utiles.

9 years agovc4: Fix use of a bool as an enum.
Eric Anholt [Mon, 16 Mar 2015 21:14:22 +0000 (14:14 -0700)]
vc4: Fix use of a bool as an enum.

The enum compared to was 0, so it worked out, but it sure looked wrong.

9 years agovc4: Decide the HW's format before laying out the miptree.
Eric Anholt [Mon, 23 Mar 2015 23:21:25 +0000 (16:21 -0700)]
vc4: Decide the HW's format before laying out the miptree.

I'm experimenting with a workaround for raster texture misrendering on
hardware, and this lets me look at the format chosen when computing
strides.

9 years agovc4: Use our device-specific ioctls for create/mmap.
Eric Anholt [Tue, 24 Mar 2015 00:17:17 +0000 (17:17 -0700)]
vc4: Use our device-specific ioctls for create/mmap.

They don't do anything special for us, but I've been told by kernel
maintainers that relying on dumb for my acceleration-capable buffers
is not OK.

9 years agovc4: Make a new #define for making code conditional on the simulator.
Eric Anholt [Tue, 24 Mar 2015 00:26:40 +0000 (17:26 -0700)]
vc4: Make a new #define for making code conditional on the simulator.

I'd like to compile as much of the device-specific code as possible
when building for simulator, and using if (using_simulator) instead of
ifdefs helps.

9 years agovc4: Add some useful debug printfs for miptrees.
Eric Anholt [Tue, 24 Mar 2015 00:38:29 +0000 (17:38 -0700)]
vc4: Add some useful debug printfs for miptrees.

I keep rewriting these.

9 years agoglsl: avoid calling base_alignment when samplers are involved
Ilia Mirkin [Mon, 23 Mar 2015 10:32:08 +0000 (06:32 -0400)]
glsl: avoid calling base_alignment when samplers are involved

Earlier commit 53bf7c8fd2e changed the logic to always call
base_alignment on structs. 1ec715ce8b12 hacked the function to return 0
for sampler fields, but didn't handle sampler arrays. Instead of
extending the hack, avoid calling base_alignment in the first place on
non-UBO uniforms.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89726
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tapani Palli <tapani.palli@intel.com>
9 years agoRevert "nv50,nvc0: remove bogus 64_FLOAT formats"
Ilia Mirkin [Tue, 24 Mar 2015 00:53:19 +0000 (20:53 -0400)]
Revert "nv50,nvc0: remove bogus 64_FLOAT formats"

This reverts commit 20346808cf4f1ee4f320afaf18f94043fb146f2e.

The conversion is actually done since these are the *B macro variants
and no vtx format is supplied, which makes them go through the translate
module.

This restores the following piglit tests to passing:

  draw-vertices user
  gl-2.0-vertexattribpointer

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agomapi: Make private copies of name strings provided by client.
Mario Kleiner [Thu, 12 Mar 2015 22:34:12 +0000 (23:34 +0100)]
mapi: Make private copies of name strings provided by client.

glXGetProcAddress("glFoo") ends up in stub_add_dynamic() to
create dynamic stubs for dynamic functions. stub_add_dynamic()
doesn't store the caller provided name string "Foo" in a mesa
private copy, but just stores a pointer to the "glFoo" string
passed to glXGetProcAddress - a pointer into arbitrary memory
outside mesa's control.

If the caller passes some dynamically allocated/changing
memory buffer to glXGetProcAddress(), or the caller gets unmapped
from memory, e.g., some dynamically loaded application
plugin which uses OpenGL, this ends badly - with a dangling
pointer.

strdup() the name string provided by the client to avoid
this problem.

Cc: "10.3 10.4 10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoclover: Return 0 as storage size for local kernel args that are not set v2
Tom Stellard [Fri, 20 Mar 2015 22:19:43 +0000 (22:19 +0000)]
clover: Return 0 as storage size for local kernel args that are not set v2

The storage size for local kernel args can be queried before the
arguments are set by using the CL_KERNEL_LOCAL_MEM_SIZE param
of clGetKernelWorkGroupInfo().

The spec says that if local kernel arguments have not been specified,
then we should assume their size is 0.

v2:
  - Implement using c++11 member initialization.

Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Cc: 10.5 10.4 <mesa-stable@lists.freedesktop.org>
9 years agogallivm: Use MCInstrInfo in the disassembler for querying instruction info
Tom Stellard [Mon, 23 Mar 2015 14:37:24 +0000 (14:37 +0000)]
gallivm: Use MCInstrInfo in the disassembler for querying instruction info

This fixes the build since llvm r232885 and also simplifies the code.

9 years agoclover: use get_device_vendor instead of get_vendor
Giuseppe Bilotta [Sun, 22 Mar 2015 06:21:02 +0000 (07:21 +0100)]
clover: use get_device_vendor instead of get_vendor

The pipe's get_vendor method returns something more akin to a driver
vendor string in most cases, instead of the actual device vendor. Use
get_device_vendor instead, which was introduced specifically for this
purpose.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agogallium: implement get_device_vendor() for existing drivers
Giuseppe Bilotta [Sun, 22 Mar 2015 06:21:01 +0000 (07:21 +0100)]
gallium: implement get_device_vendor() for existing drivers

The only hackish ones are llvmpipe and softpipe, which currently return
the same string as for get_vendor(), while ideally they should return
the CPU vendor.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
9 years agogallium: introduce get_device_vendor() entrypoint for pipes
Giuseppe Bilotta [Sun, 22 Mar 2015 06:21:00 +0000 (07:21 +0100)]
gallium: introduce get_device_vendor() entrypoint for pipes

This will be needed by Clover to return the correct information
to CL_DEVICE_VENDOR info queries.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agogallium: remove trailing whitespace in p_screen.h
Giuseppe Bilotta [Sun, 22 Mar 2015 06:20:59 +0000 (07:20 +0100)]
gallium: remove trailing whitespace in p_screen.h

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoclover: The unit for CL_DEVICE_MEM_BASE_ADDR_ALIGN is bits not bytes
Tom Stellard [Sat, 21 Mar 2015 00:44:47 +0000 (00:44 +0000)]
clover: The unit for CL_DEVICE_MEM_BASE_ADDR_ALIGN is bits not bytes

Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoclover: Add all the mandatory 1.1 extensions to the extension string
Tom Stellard [Sat, 21 Mar 2015 00:25:34 +0000 (00:25 +0000)]
clover: Add all the mandatory 1.1 extensions to the extension string

Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoclover: Add a space at the end of CL_DEVICE_OPENCL_C_VERSION
Tom Stellard [Fri, 20 Mar 2015 23:55:58 +0000 (23:55 +0000)]
clover: Add a space at the end of CL_DEVICE_OPENCL_C_VERSION

This is required by the spec.

Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoi965/vec4: Fix handling of multiple register reads and writes in dead_code_eliminate().
Francisco Jerez [Wed, 18 Mar 2015 19:06:28 +0000 (21:06 +0200)]
i965/vec4: Fix handling of multiple register reads and writes in dead_code_eliminate().

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Calculate live intervals with subregister granularity.
Francisco Jerez [Mon, 23 Mar 2015 12:08:49 +0000 (14:08 +0200)]
i965/vec4: Calculate live intervals with subregister granularity.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Define helpers to calculate the common live interval of a range of variables.
Francisco Jerez [Wed, 18 Mar 2015 18:49:43 +0000 (20:49 +0200)]
i965/vec4: Define helpers to calculate the common live interval of a range of variables.

These will be especially useful when we start keeping track of
liveness information for each subregister.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Define helper functions to convert a register to a variable index.
Francisco Jerez [Wed, 18 Mar 2015 18:17:23 +0000 (20:17 +0200)]
i965/vec4: Define helper functions to convert a register to a variable index.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Don't lose the force_writemask_all flag during CSE.
Francisco Jerez [Thu, 19 Mar 2015 13:08:16 +0000 (15:08 +0200)]
i965/vec4: Don't lose the force_writemask_all flag during CSE.

And set it in the MOV instructions that copy the temporary to the
original destination if the generator instruction had it set.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Fix handling of multiple register reads and writes in opt_cse().
Francisco Jerez [Wed, 18 Mar 2015 17:51:01 +0000 (19:51 +0200)]
i965/vec4: Fix handling of multiple register reads and writes in opt_cse().

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Fix handling of multiple register reads and writes during copy propagation.
Francisco Jerez [Wed, 18 Mar 2015 17:46:54 +0000 (19:46 +0200)]
i965/vec4: Fix handling of multiple register reads and writes during copy propagation.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Fix handling of multiple register reads and writes in split_virtual_grfs().
Francisco Jerez [Wed, 18 Mar 2015 17:45:40 +0000 (19:45 +0200)]
i965/vec4: Fix handling of multiple register reads and writes in split_virtual_grfs().

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Fix handling of multiple register reads and writes in opt_register_coalesce().
Francisco Jerez [Wed, 18 Mar 2015 17:43:44 +0000 (19:43 +0200)]
i965/vec4: Fix handling of multiple register reads and writes in opt_register_coalesce().

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Define method to check whether a backend_reg is inside a given range.
Francisco Jerez [Wed, 18 Mar 2015 17:35:31 +0000 (19:35 +0200)]
i965: Define method to check whether a backend_reg is inside a given range.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Remove dependency of vec4_live_variables on the visitor.
Francisco Jerez [Wed, 18 Mar 2015 14:03:30 +0000 (16:03 +0200)]
i965/vec4: Remove dependency of vec4_live_variables on the visitor.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Trivial copy propagate clean-up.
Francisco Jerez [Thu, 19 Mar 2015 13:30:06 +0000 (15:30 +0200)]
i965/vec4: Trivial copy propagate clean-up.

Fix typo and punctuation in a comment, break long line and add space
before curly bracket.

Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
9 years agoi965/vec4: Add argument index and type checks to SEL saturate propagation.
Francisco Jerez [Wed, 18 Mar 2015 13:51:45 +0000 (15:51 +0200)]
i965/vec4: Add argument index and type checks to SEL saturate propagation.

SEL saturate propagation already implicitly relies on these
assumptions.

Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
9 years agoi965/vec4: Fix broken saturate mask check in copy propagation.
Francisco Jerez [Thu, 19 Mar 2015 16:25:30 +0000 (18:25 +0200)]
i965/vec4: Fix broken saturate mask check in copy propagation.

try_copy_propagate() was checking the bit of the saturate mask for the
arg-th component of the source to decide whether the whole source
should be saturated (WTF?).  We need to swizzle the original saturate
mask and check that for all enabled channels the saturate flag is
either set or unset, as we cannot saturate a subset of destination
components only.

Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
9 years agoi965/vec4: Don't lose copy propagation saturate bits for not written components.
Francisco Jerez [Wed, 18 Mar 2015 13:45:16 +0000 (15:45 +0200)]
i965/vec4: Don't lose copy propagation saturate bits for not written components.

Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
9 years agoRevert "i965/vec4: Don't lose the saturate modifier in copy propagation."
Francisco Jerez [Wed, 18 Mar 2015 13:39:03 +0000 (15:39 +0200)]
Revert "i965/vec4: Don't lose the saturate modifier in copy propagation."

This reverts commit 0dfec59a2785cf7a87ee5128889ecebe810b611b.  The
change prevented propagation of copies with the saturate flag set,
making the whole saturate mask tracking completely useless.  A proper
fix follows.

Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
9 years agoi965/vec4: Remove unused method definition.
Francisco Jerez [Wed, 18 Mar 2015 13:40:25 +0000 (15:40 +0200)]
i965/vec4: Remove unused method definition.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Some more trivial swizzle clean-up.
Francisco Jerez [Wed, 18 Mar 2015 19:19:28 +0000 (21:19 +0200)]
i965/vec4: Some more trivial swizzle clean-up.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Improve src_reg/dst_reg conversion constructors.
Francisco Jerez [Wed, 18 Mar 2015 13:27:58 +0000 (15:27 +0200)]
i965/vec4: Improve src_reg/dst_reg conversion constructors.

This simplifies the src_reg/dst_reg conversion constructors using the
swizzle utils introduced in a previous patch.  It also makes them more
useful by changing their semantics slightly: dst_reg(src_reg) used to
set the writemask to XYZW if the src_reg swizzle was anything other
than XXXX, which was almost certainly not what the caller intended if
the swizzle was non-trivial.  After this patch the same components
that are present in the swizzle will be enabled in the resulting
writemask.

src_reg(dst_reg) used to set the first components of the swizzle to
the enabled components of the writemask and then replicate the last
enabled component to fill the swizzle, which, in cases where the
writemask didn't have exactly the first n components set, would in
general not be compatible with the original dst_reg.  E.g.:

| ADD(tmp, src_reg(tmp), src_reg(1));

would *not* do what one would expect (add one to each of the enabled
components of tmp) if tmp didn't have a writemask of the described
form (e.g. YZ, YW, XZW would all fail).  This pattern actually occurs
in many different places in the VEC4 back-end, it's a wonder that it
hasn't caused piglit failures until now.  After this patch
src_reg(dst_reg) will construct a swizzle with each enabled component
at its natural position (e.g. Y at the second position, Z at the
third, and so on).  The resulting swizzle will behave like the
identity when used in any instruction with the original writemask.

I've manually verified that *none* of the callers of both conversion
constructors were relying on the previous broken semantics.  There are
no piglit regressions on any generation.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Pass argument by reference to src_reg/dst_reg conversion constructors.
Francisco Jerez [Wed, 18 Mar 2015 13:21:20 +0000 (15:21 +0200)]
i965/vec4: Pass argument by reference to src_reg/dst_reg conversion constructors.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Remove swizzle_for_size() in favour of brw_swizzle_for_size().
Francisco Jerez [Wed, 18 Mar 2015 19:18:08 +0000 (21:18 +0200)]
i965/vec4: Remove swizzle_for_size() in favour of brw_swizzle_for_size().

It could be objected that swizzle_for_size() is "faster" than
brw_swizzle_for_size().  It's not measurably better in any reasonable
CPU-bound benchmark on VLV according to the Finnish benchmarking
system (including the SynMark2 DrvShComp shader compilation
benchmark).

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Remove broken vector size deduction in setup_builtin_uniform_values().
Francisco Jerez [Wed, 18 Mar 2015 13:26:10 +0000 (15:26 +0200)]
i965/vec4: Remove broken vector size deduction in setup_builtin_uniform_values().

This seemed to be trying to deduce the number of uniform vector
components from the parameter swizzle, but the algorithm would always
give 4 as result.  Instead grab the correct number of components from
the GLSL type.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Simplify visitor handling of swizzles using the swizzle utils.
Francisco Jerez [Wed, 18 Mar 2015 19:15:05 +0000 (21:15 +0200)]
i965/vec4: Simplify visitor handling of swizzles using the swizzle utils.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Simplify opt_register_coalesce() using the swizzle utils.
Francisco Jerez [Wed, 18 Mar 2015 19:11:20 +0000 (21:11 +0200)]
i965/vec4: Simplify opt_register_coalesce() using the swizzle utils.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Simplify reswizzle() using the swizzle utils.
Francisco Jerez [Wed, 18 Mar 2015 19:09:51 +0000 (21:09 +0200)]
i965/vec4: Simplify reswizzle() using the swizzle utils.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Simplify opt_reduce_swizzle() using the swizzle utils.
Francisco Jerez [Wed, 18 Mar 2015 19:08:52 +0000 (21:08 +0200)]
i965/vec4: Simplify opt_reduce_swizzle() using the swizzle utils.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Fix signedness of backend_reg::reg_offset.
Francisco Jerez [Thu, 19 Mar 2015 14:03:57 +0000 (16:03 +0200)]
i965: Fix signedness of backend_reg::reg_offset.

And make it 16-bit so it packs nicely with the previous field.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Fix signedness of dst_reg::writemask.
Francisco Jerez [Wed, 18 Mar 2015 13:24:06 +0000 (15:24 +0200)]
i965/vec4: Fix signedness of dst_reg::writemask.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Don't use GL types in the IR data structures.
Francisco Jerez [Wed, 18 Mar 2015 13:22:52 +0000 (15:22 +0200)]
i965/vec4: Don't use GL types in the IR data structures.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Fix signedness of brw_is_single_value_swizzle() argument.
Francisco Jerez [Wed, 18 Mar 2015 12:32:37 +0000 (14:32 +0200)]
i965/vec4: Fix signedness of brw_is_single_value_swizzle() argument.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Define some useful swizzle helper functions.
Francisco Jerez [Wed, 18 Mar 2015 12:34:51 +0000 (14:34 +0200)]
i965: Define some useful swizzle helper functions.

This defines helper functions implementing some common swizzle
transformations that are usually open-coded in the compiler back-end,
causing a lot of clutter.  Some optimization passes will become almost
trivial implemented in terms of these functions (e.g.
vec4_visitor::opt_reduce_swizzle()).

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: fix names in lower_constant_arrays_to_uniforms
Tapani Pälli [Mon, 23 Mar 2015 07:12:35 +0000 (09:12 +0200)]
glsl: fix names in lower_constant_arrays_to_uniforms

Patch changes lowering pass to use unique name for each uniform
so that arrays from different stages cannot end up having same
name.

v2: instead of global counter, use pointer to achieve
    unique name (Kenneth Graunke)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89590
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Cc: 10.5 10.4 <mesa-stable@lists.freedesktop.org>
9 years agoi965/nir: Use signed integer type for booleans
Jason Ekstrand [Wed, 18 Mar 2015 02:57:59 +0000 (19:57 -0700)]
i965/nir: Use signed integer type for booleans

FS instructions with NIR on i965:
total instructions in shared programs: 2663561 -> 2619051 (-1.67%)
instructions in affected programs:     1612965 -> 1568455 (-2.76%)
helped:                                5455
HURT:                                  12

FS instructions with NIR on g4x:
total instructions in shared programs: 2352633 -> 2307908 (-1.90%)
instructions in affected programs:     1441842 -> 1397117 (-3.10%)
helped:                                5463
HURT:                                  11

FS instructions with NIR on ilk:
total instructions in shared programs: 3997305 -> 3934278 (-1.58%)
instructions in affected programs:     2189409 -> 2126382 (-2.88%)
helped:                                8969
HURT:                                  22

FS instructions with NIR on hsw (snb and ivb were similar):
total instructions in shared programs: 4109389 -> 4109242 (-0.00%)
instructions in affected programs:     109869 -> 109722 (-0.13%)
helped:                                339
HURT:                                  190

No SIMD16 programs were gained or lost on any platform

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/nir: Do boolean resolves on GEN <= 5
Jason Ekstrand [Tue, 17 Mar 2015 18:49:04 +0000 (11:49 -0700)]
i965/nir: Do boolean resolves on GEN <= 5

v2: A couple comment clean-ups from Matt

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