mesa.git
10 years agoegl: Restore "bogus" DRI2 invalidate event code.
Eric Anholt [Fri, 21 Jun 2013 22:34:52 +0000 (15:34 -0700)]
egl: Restore "bogus" DRI2 invalidate event code.

I had removed it in commit 1e7776ca2bc59a6978d9b933d23852d47078dfa8
because it was obviously wrong -- why do we care whether the server is a
version that emits events, if we're not watching for the server's events,
anyway?  And why would you only invalidate on a server that emits
invalidate events, when the comment said to emit invalidates if the server
*doesn't*?  Only, I missed that we otherwise don't flag that our buffers
might have changed at swap time at all, so the driver was only checking
for new buffers when triggered by the Viewport hack.  Of course you don't
expect Viewport to be called after a swap.

So, this is effectively a revert of the previous commit, except that I
dropped the check for only emitting invalidates on a new server -- we
*always* need to invalidate if we're doing a SwapBuffers.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63435
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.1 and 9.2" <mesa-stable@lists.freedesktop.org>
10 years agogallivm: use nearest rounding for float->unorm24 conversion
Roland Scheidegger [Wed, 31 Jul 2013 14:57:50 +0000 (16:57 +0200)]
gallivm: use nearest rounding for float->unorm24 conversion

Previously we were using truncation, which gives the correct result
only for numbers in [0.5-1.0] range (because there's no mantissa bits
to do any rounding there).
This is frequently hit (and probably only used there) when converting
fragment depth to depth format (d24s8 etc.) or otherwise dealing with
depth format.

v2: as spotted by Jose, get rid of extra type (src_type is already unsigned).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agomesa: fix multisampling proxy textures not being queryable
Mikko Juola [Tue, 30 Jul 2013 17:39:00 +0000 (20:39 +0300)]
mesa: fix multisampling proxy textures not being queryable

The code that checks if some texture target is valid for
glGetTexLevelParameter*() was not programmed to check for multisampling
proxy textures.  This made it impossible(?) to use the proxy textures
for their intended purpose as glGetTexLevelParameter*() would just fail
on you.

Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: mesa-stable@lists.freedesktop.org
10 years agomesa: fix proxy textures becoming immutable and unusable
Mikko Juola [Tue, 30 Jul 2013 03:36:43 +0000 (06:36 +0300)]
mesa: fix proxy textures becoming immutable and unusable

glTexStorage*() functions make textures immutable.  This carries on to
proxy textures.  Error checking in texture storage functions prevents
proxy textures from working after first time because internally, they
became immutable.

This commit makes the error checking ignore the immutability flag when
working with proxy textures.

Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: mesa-stable@lists.freedesktop.org
10 years agomesa: fix proxy textures not working with default texture binding
Mikko Juola [Tue, 30 Jul 2013 03:29:54 +0000 (06:29 +0300)]
mesa: fix proxy textures not working with default texture binding

When working with the glTexStorage*() functions, the error checking
checks that a non-default (i.e., non-zero) texture is currently bound.
However, this check made glTexStorage*() functions fail with proxy
textures when the default texture is bound. Proxy textures do not care
about the current texture bindings so for them this check should not
be done.

Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: mesa-stable@lists.freedesktop.org
10 years agomesa: fix number of mipmaps calculation for proxy textures
Mikko Juola [Tue, 30 Jul 2013 03:19:59 +0000 (06:19 +0300)]
mesa: fix number of mipmaps calculation for proxy textures

The function _mesa_get_tex_max_num_levels() is supposed to calculate
the number of mipmap levels but it was not written to handle proxy
textures, at best returning a maximum of 1 mipmap level. Because of
this, at least glTexStorage*() calls would incorrectly fail when used
with proxy textures with more than one mipmap level.

Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: mesa-stable@lists.freedesktop.org
10 years agomesa: improve free() cleanup in generate_mipmap_compressed()
Brian Paul [Fri, 26 Jul 2013 15:50:36 +0000 (09:50 -0600)]
mesa: improve free() cleanup in generate_mipmap_compressed()

Free all our temporary buffers in one place at the end of the
function.  Fixes memory leak detected by Coverity.

Note: This is a candidate for the 9.x branches
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agogallium/util: reformat, comment util_get_offset()
Brian Paul [Thu, 25 Jul 2013 17:21:50 +0000 (11:21 -0600)]
gallium/util: reformat, comment util_get_offset()

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agogallium/util: comments, var renaming in u_inlines.h
Brian Paul [Thu, 25 Jul 2013 17:17:52 +0000 (11:17 -0600)]
gallium/util: comments, var renaming in u_inlines.h

The variable 'usage' was being used for two different things.
Sometimes for PIPE_USAGE_x and other times for PIPE_TRANSFER_x.
This renames usage to access when we're talking about PIPE_TRANSFER_x
flags.  Plus, add a bunch of comments to remind us what's going on.

Also, use unsigned for PIPE_TRANSFER_x bitmask to be consistent with
other places.  And add a missing const qualifier.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agosoftpipe: use new softpipe_resource_data() accessor
Brian Paul [Thu, 25 Jul 2013 15:27:09 +0000 (09:27 -0600)]
softpipe: use new softpipe_resource_data() accessor

We should probably be using map()/unmap() when accessing resource
data, but this is a little better.

v2: assert that the resource is not a display target, per Jose.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agosoftpipe: don't ignore pipe_constant_buffer::buffer_offset
Brian Paul [Thu, 25 Jul 2013 15:13:47 +0000 (09:13 -0600)]
softpipe: don't ignore pipe_constant_buffer::buffer_offset

This was never a problem since the Mesa state tracker always gives
us a user-space constant buffer with buffer_offset=0.  But if another
state tracker ever gave us a "HW" constant buffer with non-zero
buffer_offset we'd mis-render.

Also, use the correct buffer size.  And move an assertion to the
top of the function.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agogallium/docs: clarify definition of PIPE_CAP_USER_CONSTANT_BUFFERS, etc
Brian Paul [Thu, 25 Jul 2013 15:15:52 +0000 (09:15 -0600)]
gallium/docs: clarify definition of PIPE_CAP_USER_CONSTANT_BUFFERS, etc

The cap means _can_ accept user-space constant buffers; it doesn't
mean _only_ accepts user-space constant buffers.

v2: also update the PIPE_CAP_USER_VERTEX_BUFFERS and
PIPE_CAP_USER_INDEX_BUFFERS descriptions as well.  Per Jose.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agoi965/vs: Put lod parameter in the correct place for Gen4
Chris Forbes [Tue, 30 Jul 2013 04:03:58 +0000 (16:03 +1200)]
i965/vs: Put lod parameter in the correct place for Gen4

This was never visible before due to the bogus sampler state pointer.
Fixes remaining vertex texturing breakage on Gen4.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
10 years agoi965/vs: set up sampler state pointer for Gen4/5.
Chris Forbes [Mon, 29 Jul 2013 18:12:24 +0000 (06:12 +1200)]
i965/vs: set up sampler state pointer for Gen4/5.

Fixes broken filter and lod selection for vertex texturing.
(txs/txf only worked properly because they ignore the sampler state
completely)

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
10 years agost/dri: add a new driconf option disable_shader_bit_encoding for Unigine
Marek Olšák [Tue, 30 Jul 2013 20:29:27 +0000 (22:29 +0200)]
st/dri: add a new driconf option disable_shader_bit_encoding for Unigine

Now Unigine Heaven 3.0 finally works with r600g.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agost/mesa: fix opcode translation for ARB_shader_bit_encoding functions
Marek Olšák [Tue, 30 Jul 2013 20:29:25 +0000 (22:29 +0200)]
st/mesa: fix opcode translation for ARB_shader_bit_encoding functions

We treat the opcodes as MOVs, but we should at least change the type
of the expression, which later affects which TGSI opcode is chosen.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa,glsl,st/dri: add a new driconf option force_glsl_version for Unigine
Marek Olšák [Tue, 30 Jul 2013 20:29:24 +0000 (22:29 +0200)]
mesa,glsl,st/dri: add a new driconf option force_glsl_version for Unigine

See documentation in mtypes.h.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: add MESA_GLSL debug flag to dump shaders on compile error
Marek Olšák [Tue, 30 Jul 2013 20:29:23 +0000 (22:29 +0200)]
mesa: add MESA_GLSL debug flag to dump shaders on compile error

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agodriconf: enable app-specific workarounds for all drivers
Marek Olšák [Tue, 30 Jul 2013 20:29:22 +0000 (22:29 +0200)]
driconf: enable app-specific workarounds for all drivers

They were only enabled for i965.

Note that drirc must be installed in /etc.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agost/dri: remove driOptionCache from dri_context in favor of dri_screen
Marek Olšák [Tue, 30 Jul 2013 20:29:21 +0000 (22:29 +0200)]
st/dri: remove driOptionCache from dri_context in favor of dri_screen

There is no reason to have this duplicated.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agost/dri: move enabling postprocessing to dri_screen
Marek Olšák [Tue, 30 Jul 2013 20:29:20 +0000 (22:29 +0200)]
st/dri: move enabling postprocessing to dri_screen

The driconf options are global.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agost/dri: remove more unused driconf options
Marek Olšák [Tue, 30 Jul 2013 20:29:19 +0000 (22:29 +0200)]
st/dri: remove more unused driconf options

vblank_mode is read by dri_util.c and falls under the "dri2" driver name,
which is not connected to the actual Mesa/Gallium driver in any way.

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agost/dri: implement the driconf option force_s3tc_enable properly
Marek Olšák [Tue, 30 Jul 2013 20:29:18 +0000 (22:29 +0200)]
st/dri: implement the driconf option force_s3tc_enable properly

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodriconf: remove the unused option allow_large_textures
Marek Olšák [Tue, 30 Jul 2013 20:29:17 +0000 (22:29 +0200)]
driconf: remove the unused option allow_large_textures

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agost/dri: support the driconf option disable_blend_func_extended
Marek Olšák [Tue, 30 Jul 2013 20:29:16 +0000 (22:29 +0200)]
st/dri: support the driconf option disable_blend_func_extended

This is needed for Unigine.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agost/osmesa: initialize disable_glsl_line_continuations
Marek Olšák [Tue, 30 Jul 2013 20:29:15 +0000 (22:29 +0200)]
st/osmesa: initialize disable_glsl_line_continuations

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agogallium/postprocessing: convert blits to pipe->blit
Marek Olšák [Tue, 30 Jul 2013 20:29:14 +0000 (22:29 +0200)]
gallium/postprocessing: convert blits to pipe->blit

PP saves current states to cso_context and then util_blit_pixels does
the same. cso_context doesn't like that and the original state is not
correctly restored.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agogallium/postprocessing: fix shader parsing
Marek Olšák [Tue, 30 Jul 2013 20:29:12 +0000 (22:29 +0200)]
gallium/postprocessing: fix shader parsing

tokens was converted to a pointer, which made the Elements macro return 1.

Broken by e87fc11cac696881469a57955af2ac7b4929a2c7.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodocs/GL3: clarify core vs compatibility extension support
Marek Olšák [Tue, 30 Jul 2013 20:29:11 +0000 (22:29 +0200)]
docs/GL3: clarify core vs compatibility extension support

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: default texture buffer format should be R8 in the core profile
Marek Olšák [Tue, 30 Jul 2013 20:29:10 +0000 (22:29 +0200)]
mesa: default texture buffer format should be R8 in the core profile

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
v2: Since we don't expose the extension in the compatibility profile,
    the "if (API == CORE) .. else .." statement is removed.

10 years agomesa: default DEPTH_TEXTURE_MODE should be RED in the core profile
Marek Olšák [Tue, 30 Jul 2013 20:29:08 +0000 (22:29 +0200)]
mesa: default DEPTH_TEXTURE_MODE should be RED in the core profile

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agost/mesa: expose EXT_framebuffer_multisample_blit_scaled if MSAA is supported
Marek Olšák [Tue, 30 Jul 2013 20:29:06 +0000 (22:29 +0200)]
st/mesa: expose EXT_framebuffer_multisample_blit_scaled if MSAA is supported

Surprisingly all drivers supporting MSAA can already do this (r300g and r600g
for sure) and I think Christoph wanted to have this feature for his Nouveau
drivers anyway.

10 years agost/mesa: fix sRGB renderbuffers without EXT_framebuffer_sRGB support
Marek Olšák [Tue, 30 Jul 2013 20:29:04 +0000 (22:29 +0200)]
st/mesa: fix sRGB renderbuffers without EXT_framebuffer_sRGB support

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

Cc: mesa-stable@lists.freedesktop.org
10 years agoRevert "r300g: Give CLIP_DISABLE another try"
Marek Olšák [Tue, 30 Jul 2013 20:29:00 +0000 (22:29 +0200)]
Revert "r300g: Give CLIP_DISABLE another try"

This reverts commit e866bd1adea2c3b4971ad68e69c644752f2ab7b6.

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

Cc: mesa-stable@lists.freedesktop.org
10 years agoget-pick-list.sh: Include commits mentionining "CC: mesa-stable..." in pick list
Carl Worth [Tue, 30 Jul 2013 19:36:37 +0000 (12:36 -0700)]
get-pick-list.sh: Include commits mentionining "CC: mesa-stable..." in pick list

We recently adopted a new convention that patches can be nominated for the
stable branch by including a line in the commit message as follows:

CC: mesa-stable@lists.freedesktop.org
This is a convenient syntax as "git send-email" will notice this line and
automatically copy the resulting patch email to the mesa-stable mailing list.

Here we extend the regular expression in the get-pick-list.sh script to also
notice this pattern, (as well as the traditional "NOTE: This patch is a
candidate..." form.

10 years agoglsl: Remove redundant writes to prog->LinkStatus
Paul Berry [Sat, 27 Jul 2013 22:37:15 +0000 (15:37 -0700)]
glsl: Remove redundant writes to prog->LinkStatus

The linker_error() function sets prog->LinkStatus to false.  There's
no reason for the caller of linker_error() to also do so.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Improve error message for interstage interface block mismatch.
Paul Berry [Sat, 27 Jul 2013 22:24:46 +0000 (15:24 -0700)]
glsl: Improve error message for interstage interface block mismatch.

We're now emitting this error from a point where we have easy access
to the name of the block that failed to match, so go ahead and include
that in the error message, as we do for intrastage interface block
mismatches.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Use a consistent technique for tracking link success/failure.
Paul Berry [Sat, 27 Jul 2013 18:08:31 +0000 (11:08 -0700)]
glsl: Use a consistent technique for tracking link success/failure.

This patch changes link_shaders() so that it sets prog->LinkStatus to
true when it starts, and then relies on linker_error() to set it to
false if a link failure occurs.

Previously, link_shaders() would set prog->LinkStatus to true halfway
through its execution; as a result, linker functions that executed
during the first half of link_shaders() would have to do their own
success/failure tracking; if they didn't, then calling linker_error()
would add an error message to the log, but not cause the link to fail.
Since it wasn't always obvious from looking at a linker function
whether it was called before or after link_shaders() set
prog->LinkStatus to true, this carried a high risk of bugs.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Add error message for intrastage interface block mismatch.
Paul Berry [Sat, 27 Jul 2013 21:58:43 +0000 (14:58 -0700)]
glsl: Add error message for intrastage interface block mismatch.

Previously we failed to link (which is correct), but we did not output
an error message, which could have been confusing for users.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Remove bogus check on return value of link_uniform_blocks().
Paul Berry [Sat, 27 Jul 2013 22:07:08 +0000 (15:07 -0700)]
glsl: Remove bogus check on return value of link_uniform_blocks().

A comment in link_intrastage_shaders(), and an if-test that followed
it, seemed to indicate that link_uniform_blocks() would return a
negative value in the event of an error.  But this is not the
case--all error checking has already been performed by
validate_intrastage_interface_blocks(), and link_uniform_blocks() can
only return unsigned values.

So get rid of the if-test and change the return type of
link_intrastage_shaders() to clarify that it can only return unsigned
values.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agor600g/compute: Added missing address space checking of kernel parameters
Jonathan Charest [Mon, 22 Jul 2013 13:24:56 +0000 (09:24 -0400)]
r600g/compute: Added missing address space checking of kernel parameters

To have non-static buffers in local memory, it is necessary to pass them
as arguments to the kernel.

For r600, the correct lds size must be set to the SQ_LDS_ALLOC register.
The correct size is the clover size plus the size reported by the
compiler.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoclover: Added missing address space checking of kernel parameters v2
Jonathan Charest [Wed, 24 Jul 2013 13:29:49 +0000 (09:29 -0400)]
clover: Added missing address space checking of kernel parameters v2

Here is an updated patch with no line wrapping and respecting 80-column limit (for my changes).

v2: Tom Stellard
  - Create global arguments for constant buffers so we don't break
    r600g.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agomesa: Remove broken assertion about enabled texture targets.
Kenneth Graunke [Thu, 25 Jul 2013 21:47:58 +0000 (14:47 -0700)]
mesa: Remove broken assertion about enabled texture targets.

For GLSL programs, enabledTargets can have more than one bit set.  For
example, a shader that uses sampler2D and samplerCube uniforms will have
both TEXTURE_2D_BIT and TEXTURE_CUBE_BIT set.

The code that sets _ReallyEnabled already handles this, selecting the
"highest priority" texture target.  We should simply use that.

Fixes new Piglit test incomplete-textures-of-multiple-types.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=62698
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agobuild: unify mesa version by using a VERSION file
Emil Velikov [Thu, 25 Jul 2013 22:45:45 +0000 (23:45 +0100)]
build: unify mesa version by using a VERSION file

Rather than having to keep track of all the build systems and their respecitve
definition of the mesa version, use a single top file VERSION. Every build
system is responsible for reading/parsing the file and using it

v2:
* remove useless bulletpoint from the documentation, suggested by Matt
* "Androing is Linux. Use '/' in stead of '\'", spotted by Chad V
* use cleaner code to get the version in scons, suggested by Chad V

v3:
* ensure leading and trailing whitespace characters are stripped while parsing
* android: handle GNU shell commands approapriately

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoi965: Don't create a swrast context on ES2+.
Kenneth Graunke [Thu, 25 Jul 2013 18:31:20 +0000 (11:31 -0700)]
i965: Don't create a swrast context on ES2+.

We already skip this for API_OPENGL_CORE; ES2+ is very similar.
The primary user of the swrast context is GL_SELECT and GL_FEEDBACK,
which have never existed in ES.

This saves approximately 18MB of memory in GLBenchmark 2.7 Egypt (ES2).
No regressions in es3conform on Ivybridge.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoglsl: Remove shader stage checking for extension handling.
Kenneth Graunke [Mon, 29 Jul 2013 17:40:51 +0000 (10:40 -0700)]
glsl: Remove shader stage checking for extension handling.

Certain extensions only add functionality to particular shader stages.
(For example, ARB_draw_instanced only adds variables to the vertex
shader stage.)

Previously, we only allowed such extensions to be enabled in the shader
stages where they're useful.  However, I've never found any text which
mandates that behavior; in my opinion, you should be able to turn on
extensions in any shader stage, even if they have no effect.

Fixes Piglit tests glslparsertest/glsl2/draw_buffers-05.vert and
ARB_draw_instanced/preprocessor/feature-macro-enabled.frag.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29185
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Expose OES_surfaceless_context.
Matt Turner [Fri, 26 Jul 2013 23:36:20 +0000 (16:36 -0700)]
mesa: Expose OES_surfaceless_context.

EGL_KHR_surfaceless_context extension allows contexts to be made current
without a default winsys fbo. This extension specifies what ES 1.1 and
2.0 should do (the ES 3.0 spec already does).

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Return GL_FRAMEBUFFER_UNDEFINED if the winsys fbo is incomplete.
Matt Turner [Fri, 26 Jul 2013 23:36:19 +0000 (16:36 -0700)]
mesa: Return GL_FRAMEBUFFER_UNDEFINED if the winsys fbo is incomplete.

Specified by ARB_framebuffer_object, GL 3.0, and ES 3.0.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agogles3: Update gl3.h to 2013-02-12.
Matt Turner [Fri, 26 Jul 2013 23:33:11 +0000 (16:33 -0700)]
gles3: Update gl3.h to 2013-02-12.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agogles2: Update gl2ext.h to revision 22161.
Matt Turner [Fri, 26 Jul 2013 23:33:10 +0000 (16:33 -0700)]
gles2: Update gl2ext.h to revision 22161.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agogles2: Update gl2.h to revision 20555.
Matt Turner [Fri, 26 Jul 2013 23:33:09 +0000 (16:33 -0700)]
gles2: Update gl2.h to revision 20555.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agogles: Update glext.h to revision 20798.
Matt Turner [Fri, 26 Jul 2013 23:33:08 +0000 (16:33 -0700)]
gles: Update glext.h to revision 20798.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agogallivm: (trivial) git rid of assertion in float->uint conversion code
Roland Scheidegger [Mon, 29 Jul 2013 11:23:56 +0000 (13:23 +0200)]
gallivm: (trivial) git rid of assertion in float->uint conversion code

Commit 8c3d3622d9ce2fd2a8f46084ab8153d708fa5b09 introduced a new assertion,
but since it causes lp_test_conv failures remove it again and let's hope
we don't really hit bugs caused by the potentially bogus code (it is possible
the assert() caught some cases which work correctly too).

10 years agonvc0: force use of correct firmware file
Maarten Lankhorst [Sun, 28 Jul 2013 10:06:57 +0000 (12:06 +0200)]
nvc0: force use of correct firmware file

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agoglsl: Less const for glsl_type convenience accessors
Ian Romanick [Fri, 26 Jul 2013 20:37:29 +0000 (13:37 -0700)]
glsl: Less const for glsl_type convenience accessors

The second 'const' says that the pointer itself is constant.  This in
unenforcible in C++, so GCC emits a warning (see) below for each of
these functions in every file that includes glsl_types.h.  It's a lot of
warning spam.

../../../src/glsl/glsl_types.h:176:58: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
10 years agoglsl: Disallow auxiliary storage qualifiers on FS outputs.
Kenneth Graunke [Sat, 27 Jul 2013 04:18:56 +0000 (21:18 -0700)]
glsl: Disallow auxiliary storage qualifiers on FS outputs.

This has always been an error; we just forgot to check for it.

Fixes Piglit's no-aux-qual-on-fs-output.frag.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67333
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
10 years agoglsl: Classify "layout" like other identifiers.
Kenneth Graunke [Fri, 26 Jul 2013 19:31:06 +0000 (12:31 -0700)]
glsl: Classify "layout" like other identifiers.

When "layout" isn't being lexed as LAYOUT_TOK, we should treat it like
an ordinary identifier.  This means we need to classify it to determine
whether we should return IDENTIFIER, TYPE_IDENTIFIER, or NEW_IDENTIFIER.

Fixes the WebGL conformance test "shader-with-non-reserved-words."

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64087
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
10 years agoglsl: Be consistent about '\n', '.', and capitalization in errors/warnings.
Paul Berry [Fri, 26 Jul 2013 02:56:43 +0000 (19:56 -0700)]
glsl: Be consistent about '\n', '.', and capitalization in errors/warnings.

The majority of calls to _mesa_glsl_error(), _mesa_glsl_warning(), and
_mesa_glsl_parse_state::check_version() use a message that begins with
a lower case letter and ends without a period.  This patch makes all
messages follow that convention.

Also, error/warning messages shouldn't end in '\n', since
_mesa_glsl_msg() automatically adds '\n' at the end of the message.

Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agogallivm: fix float->SNORM conversion
Roland Scheidegger [Sat, 27 Jul 2013 01:53:00 +0000 (03:53 +0200)]
gallivm: fix float->SNORM conversion

Just like the UNORM case we need to use round to nearest, not trunc.
(There's also another problem, we're using the formula for SNORM->float
which will produce a value below -1.0 for the most negative value which
according to both OpenGL and d3d10 would need clamping. However, no actual
failures have been observed due to that hence keep cheating on that.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agoutil: don't flush overflowing values to infinity in half-float conversion
Roland Scheidegger [Sat, 27 Jul 2013 01:45:30 +0000 (03:45 +0200)]
util: don't flush overflowing values to infinity in half-float conversion

I am not able to find _any_ rounding behavior specified for OpenGL for
float to half-float conversions. However, it is specified for fp11/fp10
which suggests round to next finite value but round-to-zero would also
be allowed, but finite values must not be flushed to infinity in either
case.
Hence I believe it makes sense to do the same for half-floats too.
We could probably also use round-to-zero consistently, which is in fact
required by d3d10 (but it doesn't seem to matter much).
Does not match the mesa core function doing the same though (which is
saying it was built to match intel gpus which I don't believe for a
second as it would cause failures in d3d10, moreover the PRM (for
ivy bridge, not listed in older manuals) while not specifying rounding
behavior clearly states finite numbers are never flushed to infinity).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agotgsi: handle texel swizzles correctly for d3d10-style sample opcodes
Roland Scheidegger [Fri, 26 Jul 2013 19:39:27 +0000 (21:39 +0200)]
tgsi: handle texel swizzles correctly for d3d10-style sample opcodes

Same as for gallivm (though these don't quite work correctly in softpipe,
so untested).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agogallivm: handle texel swizzles correctly for d3d10-style sample opcodes
Roland Scheidegger [Sat, 27 Jul 2013 14:36:25 +0000 (16:36 +0200)]
gallivm: handle texel swizzles correctly for d3d10-style sample opcodes

unlike OpenGL, the texel swizzle is embedded in the instruction, so honor
that.
(Technically we now execute both the sampler_view swizzle and the
per-instruction swizzle but this should be quite ok.)

v2: add documentation note as it's not obvious.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agodocs: Mark ARB_vertex_attrib_binding as started.
Kenneth Graunke [Sat, 27 Jul 2013 06:46:55 +0000 (23:46 -0700)]
docs: Mark ARB_vertex_attrib_binding as started.

Fredrik Höglund has a partial implementation in his git tree.

10 years agomesa: Disable GL_EXT_framebuffer_object in core profiles and OpenGL 3.1
Ian Romanick [Thu, 18 Jul 2013 23:48:49 +0000 (16:48 -0700)]
mesa: Disable GL_EXT_framebuffer_object in core profiles and OpenGL 3.1

GL_EXT_framebuffer_object differs from GL_ARB_framebuffer_object in ways
that we can't and don't implement in core profiles.  Exposing it is a
lie, so we shouldn't do that.

It's possible the some other GL_EXT_framebuffer_* extensions should be
disabled, but it's not quite so clear cut.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agodocs: Mark GL_ARB_shading_language_420pack as done.
Matt Turner [Sat, 27 Jul 2013 05:17:02 +0000 (22:17 -0700)]
docs: Mark GL_ARB_shading_language_420pack as done.

10 years agodocs: Mark off 420pack
Chris Forbes [Sat, 27 Jul 2013 09:29:01 +0000 (21:29 +1200)]
docs: Mark off 420pack

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
10 years agoglsl: disable ARB_texture_cube_map_array_enable keywords for glsl es
Tapani Pälli [Fri, 26 Jul 2013 07:21:56 +0000 (10:21 +0300)]
glsl: disable ARB_texture_cube_map_array_enable keywords for glsl es

Patch fixes a crash with Webgl 'shader-with-non-reserved-words'
conformance test by ignoring desktop extension keywords on GLSL ES.

v2: fix reserved and allowed desktop glsl versions (Chris)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64087
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/vs: Fix flaky texture swizzling
Chris Forbes [Tue, 23 Jul 2013 19:21:22 +0000 (07:21 +1200)]
i965/vs: Fix flaky texture swizzling

If any component used the ZERO or ONE swizzle, its corresponding member
in the `swizzle` array would never be initialized. We *mostly* got away
with this, except when that memory happened to contain a value that
clobbered another channel when combined using BRW_SWIZZLE4().

NOTE: This is a candidate for stable branches.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agost/clover: Allow double precision operations
Niels Ole Salscheider [Tue, 2 Jul 2013 08:44:37 +0000 (10:44 +0200)]
st/clover: Allow double precision operations

Pass "cl_khr_fp64" preprocessor definition to clang

Signed-off-by: Niels Ole Salscheider <niels_ole@salscheider-online.de>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agogallium/vl: add prime support
Dave Airlie [Thu, 25 Jul 2013 03:31:26 +0000 (13:31 +1000)]
gallium/vl: add prime support

This fixes the dri2 opening to check if DRI_PRIME is set,
and picks the correct drm device path to open, this along
with a change to libvdpau allows vdpauinfo to work at least,

Martin Peres tested with nouveau, and there seems to be a
further issue with final displaying, it only works sometimes,
but this patch is at least necessary to help debug further.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Christian König <christian.koenig@amd.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67283
Tested-by: Armin K. <krejzi@email.com>
10 years agoRevert "i965: Delete pre-DRI2.3 viewport hacks."
Kenneth Graunke [Thu, 25 Jul 2013 22:11:13 +0000 (15:11 -0700)]
Revert "i965: Delete pre-DRI2.3 viewport hacks."

This reverts commit c9db037dc999eadbcaa8816c814e6ec1776d1a40.

Eric believes that the viewport hacks are still necessary for EGL;
invalidate events aren't hooked up properly.

This commit caused a regression where EFL applications wouldn't show
anything other than window decorations; GLBenchmark also showed issues.

The revert had conflicts due to the intel_context/brw_context merge.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66606
Cc: mesa-stable@lists.freedesktop.org
10 years agomesa: Bump version to 9.3.0-devel.
Kenneth Graunke [Thu, 25 Jul 2013 20:33:02 +0000 (13:33 -0700)]
mesa: Bump version to 9.3.0-devel.

This should have been done when making the 9.2 branch, but was missed.

10 years agodocs: Remove <em> obfuscation on public mailing list addresses.
Kenneth Graunke [Thu, 25 Jul 2013 18:42:38 +0000 (11:42 -0700)]
docs: Remove <em> obfuscation on public mailing list addresses.

Wrapping every character of an email address in <em> looks bizarre, and
makes it impossible to read the text.  Apparently Brian did this in 2003
to try and obfuscate email addresses and avoid spam.

Of course, mesa-*@lists.freedesktop.org are public mailing lists and
trivial to find on the internet.  So obfuscation buys us nothing
(assuming the <em> technique even works at all, which I doubt).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
LOLed-at-by: Matt Turner :)
10 years agoxa: bump major version
Rob Clark [Wed, 5 Jun 2013 20:16:27 +0000 (16:16 -0400)]
xa: bump major version

Bump major version, as the change to require explicit
xa_context_flush(), the addition of the handle-type parameter to
xa_surface_handle(), and change of surface to ref/unref will require a
minor change in DDX.

10 years agoxa: move surface to ref/unref api
Jerome Glisse [Thu, 7 Mar 2013 22:03:04 +0000 (17:03 -0500)]
xa: move surface to ref/unref api

This make ddx life easier.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agoxa: let ddx handle flush
Jerome Glisse [Wed, 6 Mar 2013 22:39:29 +0000 (17:39 -0500)]
xa: let ddx handle flush

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
10 years agoxa: export a common context flush function
Jerome Glisse [Mon, 4 Mar 2013 17:26:18 +0000 (12:26 -0500)]
xa: export a common context flush function

First step before moving flushing inside the ddx.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
10 years agoxa: add handle type parameter to get handle
Jerome Glisse [Wed, 27 Feb 2013 15:49:35 +0000 (10:49 -0500)]
xa: add handle type parameter to get handle

Allow to retrieve non shared handle.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
10 years agoxa: add xa_surface_from_handle()
Rob Clark [Sun, 12 May 2013 20:00:35 +0000 (16:00 -0400)]
xa: add xa_surface_from_handle()

For freedreno DDX, we have to create the scanout GEM bo in a special way
(until we have our own KMS/DRM kernel driver.. and even then for
phones/tablets you probably need to use the android drivers if you don't
want to port the lcd panel driver support).  The easiest way to handle
this is let the DDX create the scanout bo, and then create the xa
surface from that.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agogallivm: Remove NoFramePointerElimNonLeaf for LLVM >= 3.4.
Vinson Lee [Thu, 25 Jul 2013 06:28:27 +0000 (23:28 -0700)]
gallivm: Remove NoFramePointerElimNonLeaf for LLVM >= 3.4.

TargetOptions::NoFramePointerElimNonLeaf was removed in LLVM 3.4
r187093.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agoglsl: Handle empty if statement encountered during loop analysis.
Paul Berry [Wed, 24 Jul 2013 15:04:44 +0000 (08:04 -0700)]
glsl: Handle empty if statement encountered during loop analysis.

The is_loop_terminator() function was asserting that the following
kind of if statement could never occur:

    if (...) { } else { }

(presumably based on the assumption that such an if statement would be
eliminated by previous optimization stages).  But that isn't the
case--it's possible that previous optimization stages might simplify
more complex code down to this empty if statement, in which case it
won't be eliminated until the next time through the optimization loop.

So is_loop_terminator() needs to handle it.  Fortunately it's easy to
handle--it's not a loop terminator because it does nothing.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64330
CC: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Initialize inout_offset parameter to brw_search_cache().
Paul Berry [Wed, 24 Jul 2013 16:24:51 +0000 (09:24 -0700)]
i965: Initialize inout_offset parameter to brw_search_cache().

Two callers of brw_search_cache() weren't initializing that function's
inout_offset parameter: brw_blorp_const_color_params::get_wm_prog()
and brw_blorp_const_color_params::get_wm_prog().

That's a benign problem, since the only effect of not initializing
inout_offset prior to calling brw_search_cache() is that the bit
corresponding to cache_id in brw->state.dirty.cache may not be set
reliably.  This is ok, since the cache_id's used by
brw_blorp_const_color_params::get_wm_prog() and
brw_blorp_blit_params::get_wm_prog() (BRW_BLORP_CONST_COLOR_PROG and
BRW_BLORP_BLIT_PROG, respectively) correspond to dirty bits that are
not used.

However, failing to initialize this parameter causes valgrind to
complain.  So let's go ahead and fix it to reduce valgrind noise.

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

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: don't rename variables in interface block arrays.
Paul Berry [Mon, 22 Jul 2013 22:49:48 +0000 (15:49 -0700)]
glsl: don't rename variables in interface block arrays.

The linker matches up variables in interface blocks according to their
block name and variable name.  When support for interface block arrays
was added in commit d6863acb, we renamed variables appearing in
interface blocks so that their name included the array size.  For
example, in a block like this:

out foo {
   float bar
} baz[3];

The variable "bar" would get renamed to "bar[3]".

This is unnecessary, and leads to problems in supporting geometry
shaders, since geometry shaders require vertex shader outputs which
are non-arrays to be linked up to geometry shader inputs which are
arrays.

This patch makes the behaviour of interface block arrays the same as
simple non-array interface blocks; in both cases, the variables
contained within them are not renamed.

Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agodraw: fix vertex id computation
Zack Rusin [Tue, 23 Jul 2013 05:29:30 +0000 (01:29 -0400)]
draw: fix vertex id computation

vertex id has to be unaffected by the start index (i.e. when calling
draw arrays with start_index = 5, the first vertex_id has to still
be 0, not 5) and it has to be equal to the index when performing
indexed rendering (in which case it has to be unaffected by the
index bias). This fixes our behavior.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agodraw: cleanup and fix instance id computation
Zack Rusin [Tue, 23 Jul 2013 05:16:55 +0000 (01:16 -0400)]
draw: cleanup and fix instance id computation

The instance id system value always starts at 0, even if the
specified start instance is larger than 0. Instead of implicitly
setting instance id to instance id plus start instance and then
having to subtract instance id when computing the buffer offsets
lets just set instance id to the proper instance id. This fixes
instance id computation and cleansup buffer offset computation.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agogallivm: Remove dead code in lp_build_compare_ext.
Vinson Lee [Sun, 21 Jul 2013 07:04:36 +0000 (00:04 -0700)]
gallivm: Remove dead code in lp_build_compare_ext.

There are earlier returns for PIPE_FUNC_NEVER and PIPE_FUNC_ALWAYS. The
switch value of 'func' cannot be either of those values.

Fixes "Logically dead code" defects reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agomesa: implement mipmap generation for compressed 2D array textures
Brian Paul [Tue, 16 Jul 2013 12:04:32 +0000 (06:04 -0600)]
mesa: implement mipmap generation for compressed 2D array textures

We weren't looping over all the slices in the array.  The updated
code should also correctly handle 3D compressed textures too, whenever
we have that feature.

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

NOTE: This is a candidate for the 9.x branches
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agometa: handle 2D texture arrays in decompress_texture_image()
Brian Paul [Tue, 16 Jul 2013 12:27:33 +0000 (06:27 -0600)]
meta: handle 2D texture arrays in decompress_texture_image()

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

NOTE: This is a candidate for the 9.x branches.
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agomesa: handle 2D texture arrays in get_tex_rgba_compressed()
Brian Paul [Mon, 15 Jul 2013 16:23:49 +0000 (10:23 -0600)]
mesa: handle 2D texture arrays in get_tex_rgba_compressed()

If we call glGetTexImage() for a compressed 2D texture array we need
to loop over all the slices.

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

NOTE: This is a candidate for the 9.x branches.
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agonv50,nvc0: s/uint16/uint32 for constant buffer offset
Christoph Bumiller [Wed, 24 Jul 2013 18:41:31 +0000 (20:41 +0200)]
nv50,nvc0: s/uint16/uint32 for constant buffer offset

Looks like a thinko, "Hey, constant buffers can be at most 64 KiB
in size, offset can't be larger." But it can, of course.

I think piglit lacks a test for UBO and BindBufferRange that
tests if it actually works.

10 years agodraw: always call util_cpu_detect() in draw context creation.
Roland Scheidegger [Tue, 23 Jul 2013 23:38:50 +0000 (01:38 +0200)]
draw: always call util_cpu_detect() in draw context creation.

Since disabling denorms in draw_vbo() we require the util_cpu_caps to be
initialized there. Hence add another util_cpu_detect() call in
draw_create_context() which should ensure this.
(There is another call in draw_get_option_use_llvm() which only gets called
with x86 (not x86_64) but calling it always there wouldn't help since it most
likely wouldn't get called when compiling without llvm, so leave it alone
there.)
This fixes https://bugs.freedesktop.org/show_bug.cgi?id=66806.
(Because util_cpu_caps wasn't initialized when first calling util_fpstate_get()
hence it returning zero, but it would later get initialized by rtasm translate
code hence when draw call returned it unmasked all exceptions by calling
util_fpstate_set(). This was happening only with DRAW_USE_LLVM=0 or not
compiling with llvm, otherwise the llvm init code was calling it on time too.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
Tested-by: Vinson Lee <vlee@freedesktop.org>
10 years agomesa: fix rgtc snorm decoding
Roland Scheidegger [Mon, 22 Jul 2013 19:02:56 +0000 (21:02 +0200)]
mesa: fix rgtc snorm decoding

The codeword must be unsigned (otherwise will shift in 1's from above when
merging low/high parts so some texels decode wrong).
This also affects gallium's util/u_format_rgtc.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
10 years agogallium/util: Fix detection of AVX cpu caps
Andre Heider [Tue, 23 Jul 2013 17:08:45 +0000 (19:08 +0200)]
gallium/util: Fix detection of AVX cpu caps

For AVX it's not sufficient to only rely on the cpuid flags. If the CPU
supports these extensions, but the OS doesn't, issuing these insns will
trigger an undefined opcode exception.

In addition to the AVX cpuid bit we also need to:
* test cpuid for OSXSAVE support
* XGETBV to check if the OS saves/restores AVX regs on context switches

See "Detecting Availability and Support" at
http://software.intel.com/en-us/articles/introduction-to-intel-advanced-vector-extensions

Signed-off-by: Andre Heider <a.heider@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agodocs: Add items for GL4.4
Chris Forbes [Mon, 22 Jul 2013 21:17:47 +0000 (09:17 +1200)]
docs: Add items for GL4.4

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoclover: Respect kernel argument alignment restrictions.
Francisco Jerez [Sat, 20 Jul 2013 23:14:54 +0000 (01:14 +0200)]
clover: Respect kernel argument alignment restrictions.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoclover: Extend kernel arguments for differing host and device data types.
Francisco Jerez [Mon, 22 Jul 2013 21:08:46 +0000 (23:08 +0200)]
clover: Extend kernel arguments for differing host and device data types.

Loosely based on a similar patch by Tom Stellard.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoclover: Byte-swap kernel arguments when host and device endianness differ.
Francisco Jerez [Sat, 20 Jul 2013 23:06:13 +0000 (01:06 +0200)]
clover: Byte-swap kernel arguments when host and device endianness differ.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoclover: Add kernel argument fields to allow differing host/target data types.
Francisco Jerez [Sat, 20 Jul 2013 22:49:54 +0000 (00:49 +0200)]
clover: Add kernel argument fields to allow differing host/target data types.

Loosely based on a similar patch by Tom Stellard.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoclover: Pass corresponding module::argument to kernel::argument::bind().
Francisco Jerez [Sat, 20 Jul 2013 22:43:18 +0000 (00:43 +0200)]
clover: Pass corresponding module::argument to kernel::argument::bind().

And remove size information from most kernel::argument derived
classes, it's no longer going to be necessary.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoclover: Return correct value for CL_DEVICE_ENDIAN_LITTLE
Tom Stellard [Wed, 10 Jul 2013 04:21:40 +0000 (21:21 -0700)]
clover: Return correct value for CL_DEVICE_ENDIAN_LITTLE

Query the driver using PIPE_CAP_ENDIANNESS rather than always returning
true.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Francisco Jerez <currojerez@riseup.net>