Commit Graph

59009 Commits

Author SHA1 Message Date
Frank Henigman 49ed5991ee i965: extend fast texture upload
Extend the fast texture upload from BGRA X-tiled to include RGBA,
Alpha/Luminance, and Y-tiled.  Speed improvements, measured with
mesa demos teximage program, on 256 x 256 texture, in MB/s, on a
Sandy Bridge (Ivy is comparable):

              before  after   increase
BGRA/X-tiled   3266    4524    1.39x
BGRA/Y-tiled   1739    3971    2.28x
RGBA/X-tiled    474    4694    9.90x
RGBA/Y-tiled    477    3368    7.06x
   L/X-tiled   1268    1516    1.20x
   L/Y-tiled   1439    1581    1.10x

v2: Cosmetic changes only: reformat and reword comments, make doxygen-friendly,
    rename variables, use existing macros, add an assert.

Signed-off-by: Frank Henigman <fjhenigman@google.com>
Reviewed-and-tested-by: Chad Versace <chad.versace@linux.intel.com>
2013-10-10 18:16:41 -07:00
Alexander von Gluck IV 0fda1cb498 haiku: Fix llvmpipe and clean up softpipe tracing
* Fix LLVM library and defines
* Only enable tracing when scons build=debug

Acked-by: Brian Paul <brianp@vmware.com>
2013-10-10 19:28:23 -05:00
Alexander von Gluck IV 69508950da haiku: Remove common directory search path
* /boot/common no longer exists in Haiku as of
  a few days ago (and this is undefined)

Acked-by: Brian Paul <brianp@vmware.com>
2013-10-10 19:28:23 -05:00
Eric Anholt 8821e9d108 dri: Reference the global driver vtable once at screen init..
This is part of the prep for megadrivers, which won't allow using a single
global symbol due to the fact that there will be multiple drivers built
into the same dri.so file.  For that, we'll need screen init to take a
reference to the driver to set up this vtable.

v2: Fix two missed references to driDriverAPI.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
2013-10-10 16:34:30 -07:00
Eric Anholt ee8983becc i965: Clean up error handling for context creation.
The intel_screen.c used to be a dispatch to one of 3 driver functions, but
was down to 1, so it was kind of a waste.  In addition, it was trying to
free all of the data that might have been partially freed in the kernel
3.6 check (which comes after intelInitContext, and thus might have had
driverPrivate set and result in intelDestroyContext() doing work on the
freed data).  By moving the driverPrivate setup earlier, we can use
intelDestroyContext() consistently and avoid such problems in the future.

v2: Adjust the prototype of brwCreateContext to use the proper enum
    (fixing a compiler warning in some builds)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
2013-10-10 16:34:30 -07:00
Eric Anholt 18a8f31070 intel: Remove silly check for !bufmgr.
If bufmgr didn't get created, then screen creation failed, and we never
should have got here in the first place.  This was added by Chris Wilson
in 2010 with no explanation for why it would be needed.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-10-10 16:34:30 -07:00
Eric Anholt 083f66fdd6 dri: Move API version validation into dri/common.
i965, i915, radeon, r200, swrast, and nouveau were mostly trying to do the
same logic, except where they failed to.  Notably, swrast had code that
appeared to try to enable GLES1/2 but forgot to set api_mask (thus
preventing any gles context from being created), and the non-intel drivers
didn't support MESA_GL_VERSION_OVERRIDE.

nouveau still relies on _mesa_compute_version(), because I don't know what
its limits actually are, and gallium drivers don't declare limits up front
at all.  I think I've heard talk about doing so, though.

v2: Compat max version should be 30 (noted by Ken)
    Drop r100's custom max version check, too (noted by Emil Velikov)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-10-10 16:34:30 -07:00
Eric Anholt d81632fb1e dri: Merge drisw_util.c into dri_util.c
The only important difference was not calling drmGetVersion, and making
the swrast extension vtable.  That doesn't justify duplicating the other
330 lines of code.

v2: fix the scons build (code by Emil Velikov)
v3: fix scons build with swrast-only (code by Emil Velikov)
v4: Drop the new define I added, when we already have __NOT_HAVE_DRM_H.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2013-10-10 16:34:30 -07:00
Eric Anholt 683f6daa97 dri: Add an explanatory comment for an important driver entrypoint.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-10-10 16:34:30 -07:00
Eric Anholt 7f3a131b6e dri: Remove dead comment.
The code it was referencing was removed in 2010.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-10-10 16:34:30 -07:00
Eric Anholt 36fbe66d3a i965/fs: Convert gen7 to using GRFs for texture messages.
Looking at Lightsmark's shaders, the way we used MRFs (or in gen7's
case, GRFs) was bad in a couple of ways.  One was that it prevented
compute-to-MRF for the common case of a texcoord that gets used
exactly once, but where the texcoord setup all gets emitted before the
texture calls (such as when it's a bare fragment shader input, which
gets interpolated before processing main()).  Another was that it
introduced a bunch of dependencies that constrained scheduling, and
forced waits for texture operations to be done before they are
required.  For example, we can now move the compute-to-MRF
interpolation for the second texture send down after the first send.

The downside is that this generally prevents
remove_duplicate_mrf_writes() from doing anything, whereas previously
it avoided work for the case of sampling from the same texcoord twice.
However, I suspect that most of the win that originally justified that
code was in avoiding the WAR stall on the first send, which this patch
also avoids, rather than the small cost of the extra instruction.  We
see instruction count regressions in shaders in unigine, yofrankie,
savage2, hon, and gstreamer.

Improves GLB2.7 performance by 0.633628% +/- 0.491809% (n=121/125, avg of
~66fps, outliers below 61 dropped).

Improves openarena performance by 1.01092% +/- 0.66897% (n=425).

No significant difference on Lightsmark (n=44).

v2: Squash in the fix for register unspilling for send-from-GRF, fixing a
    segfault in lightsmark.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Matt Turner <mattst88@gmail.com>
2013-10-10 15:54:16 -07:00
Eric Anholt ee21c8b1e6 i965/fs: Allocate more register classes on gen7.
For texturing from GRFs, we now have payloads of arbitrary sizes up to the
message length limit.

v2 (Kenneth Graunke): Rebase on intel_context -> brw_context change.
v3: Add some comment text.
v4: Change some magic 16s to BRW_MAX_MRF (noted by Ken).  Leave the 11,
    which is the magic "max sampler message length".  BRW_MAX_MRF sizing
    on the little int arrays is retained because I could see us needing to
    extend in the future if we move to GRFs for FB writes (those go to at
    least 12 long in a quick scan of the specs)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v2)
Acked-by: Matt Turner <mattst88@gmail.com>
2013-10-10 15:54:16 -07:00
Eric Anholt b6af650a09 i965/fs: Use per-channel interference for register_coalesce_2().
This will let us coalesce into texture-from-GRF arguments, which would
otherwise be prevented due to the live interval for the whole vgrf
extending across all the MOVs setting up the channels of the message

v2 (Kenneth Graunke): Rebase for renames.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-10-10 15:54:16 -07:00
Eric Anholt 3093085847 i965/fs: Use the new per-channel live ranges for dead code elimination.
v2 (Kenneth Graunke): Rebase on s/live_variables/live_intervals/g.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-10-10 15:54:16 -07:00
Eric Anholt b4d676d710 i965/fs: Keep a copy of the live variables class around.
Now optimization passes will be able to look at the per-channel ranges.

v2: Rebase on various optimization pass changes.
v3 (Kenneth Graunke): Rename live_variables to live_intervals; split
   introduction of invalidate_live_intervals() into a separate patch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-10-10 15:54:15 -07:00
Kenneth Graunke 3ea84beb16 i965/fs: Invalidate live intervals when compacting; don't fix them.
When compacting the list of VGRFs, we patch up the live interval ranges
(which are indexed by VGRF number).  Unfortunately, once we make
per-component data available, this will become too complicated to
maintain.  Instead, simply invalidate them.

This was pulled out of a patch by Eric Anholt.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-10-10 15:54:15 -07:00
Kenneth Graunke 939b0f2c2f i965/fs: Remove start/end aliases in compute_live_intervals().
In compute_live_intervals(), start and end are shorter names for
the virtual_grf_start and virtual_grf_end class members.

Now that the fs_live_intervals class has arrays named start and end
which are indexed by var, rather than VGRF, reusing the name is
confusing.  Plus, most of the code has been factored out, so using the
long names isn't as inconvenient.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-10-10 15:54:15 -07:00
Eric Anholt 398656d97e i965/fs: Track live variable ranges on a per-channel level.
This is the information we'll actually use to replace the
virtual_grf_start[]/end[] arrays.

No change in shader-db.

v2 (Kenneth Graunke): Rebase; minor comment updates.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-10-10 15:54:15 -07:00
Eric Anholt 097bf101c3 i965/fs: Factor def[]/use[] setup out to a separate function.
These blocks are about to grow some more code, and the indentation was
getting out of hand.

v2 (Kenneth Graunke): Rebase, minor typo fixes and style changes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-10-10 15:54:15 -07:00
Kenneth Graunke 4b821a97b5 i965/fs: Create a helper function for invalidating live intervals.
For now, this simply sets live_intervals_valid = false, but in the
future it will do something more sophisticated.

Based on a patch by Eric Anholt.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-10-10 15:54:15 -07:00
Eric Anholt 45ffaeccaf i965/fs: Do live variables dataflow analysis on a per-channel level.
This significantly improves our handling of VGRFs of size > 1.

Previously, we only marked VGRFs as def'd if the whole register was
written by a single instruction.  Large VGRFs which were written
piecemeal would not be considered def'd at all, even if they were
ultimately completely written.

Without being def'd, these were then marked "live in" to the basic
block, often extending the range to preceding blocks and sometimes
even the start of the program.

The new per-component tracking gives more accurate live intervals,
which makes register coalescing more effective.

In the future, this should help with texturing from GRFs on Gen7+.
A sampler message might be represented by a 2-register VGRF which
holds the texture coordinates.  If those are incoming varyings,
they'll be produced by two PLN instructions, which are piecemeal writes.

No reduction in shader-db instruction counts.  However, code which
prints the live interval ranges does show that some VGRFs now have
smaller (and more correct) live intervals.

v2: Rebase on current send-from-GRF code requiring adding extra use[]s.
v3: Rebase on live intervals fix to include defs in the end of the
    interval.
v4 (Kenneth Graunke): Rebase; split off a few preparatory patches;
    add lots of comments; minor style changes; rewrite commit message.
v5 (Eric Anholt): whitespace nit.

Written-by: Eric Anholt <eric@anholt.net> [v1-3]
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> [v4]
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net> (v4)
2013-10-10 15:54:14 -07:00
Kenneth Graunke 5af8388110 i965/fs: Rename num_vars to num_vgrfs in live interval analysis.
num_vars was shorthand for the number of virtual GRFs.  num_vgrfs is a
bit clearer.  Plus, the next patch will introduce "vars" which are
distinct from vgrfs.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-10-10 15:54:14 -07:00
Kenneth Graunke 701e9af15f i965/fs: Short-circuit a loop in live variable analysis.
This has no functional effect, but should make subsequent changes a
little simpler.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-10-10 15:54:14 -07:00
Paul Berry 8cb9cce040 glsl: Don't allow gl_PerVertex to be redeclared after it's been used.
Fixes piglit tests:
- spec/glsl-1.50/compiler/gs-redeclares-pervertex-in-after-other-usage.geom
- spec/glsl-1.50/compiler/gs-redeclares-pervertex-out-after-other-usage.geom
- spec/glsl-1.50/compiler/gs-redeclares-pervertex-out-after-usage.geom
- spec/glsl-1.50/compiler/vs-redeclares-pervertex-out-after-other-usage.vert
- spec/glsl-1.50/compiler/vs-redeclares-pervertex-out-after-usage.vert

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:27:40 -07:00
Paul Berry 84b9fa83a0 glsl: Support redeclaration of GS gl_PerVertex input.
Fixes piglit test
spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:27:38 -07:00
Paul Berry fc2330b0be glsl: Catch redeclaration of interface block instance names at compile time.
From section 4.1.9 (Arrays) of the GLSL 4.40 spec (as of revision 7):

    However, unless noted otherwise, blocks cannot be redeclared;
    an unsized array in a user-declared block cannot be sized
    through redeclaration.

The only place where the spec notes that interface blocks can be
redeclared is to allow for redeclaration of built-in interface blocks
such as gl_PerVertex.  Therefore, user-defined interface blocks can
never be redeclared.  This is a clarification of previous intent (see
Khronos bug 10659).

We were already preventing interface block redeclaration using the
same block name at compile time, but we weren't preventing interface
block redeclaration using the same instance name (and different block
names) at compile time.  And we weren't preventing an instance name
from conflicting with a previously-declared ordinary variable.

In practice the problem would be caught at link time, but only because
of a coincidence: since ast_interface_block::hir() wasn't doing any
checking to see if the instance name already existed in the shader, it
was creating a second ir_variable in the shader having the same name
but a different type.  Coincidentally, when the linker checked for
intrastage consistency of global variable declarations, it treated the
two declarations from the same shader as a conflict, so it reported a
link error.

But it seems dangerous to rely on that linker behaviour to catch
illegal redeclarations that really ought to be detected at compile
time.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:27:35 -07:00
Paul Berry 1b4a7378e9 glsl: Support redeclaration of VS and GS gl_PerVertex output.
Fixes piglit tests:
- spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs
- spec/glsl-1.50/execution/redeclare-pervertex-subset-vs

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:27:33 -07:00
Paul Berry 79f515251a glsl: Error check redeclarations of gl_PerVertex.
This patch verifies that:

- The gl_PerVertex input interface block may only be redeclared in a
  geometry shader, and that it may only be redeclared as gl_in[].

- The gl_PerVertex output interface block may only be redeclared in a
  vertex or geometry shader, and that it may only be redeclared as a
  non-array without an interface name.

- gl_PerVertex may not be redeclared as any other type of interface
  block (i.e. as a uniform interface block).

As a side-effect, the code now keeps track of what the previous
declaration of gl_PerVertex was--this will be needed in future
patches.

Fixes piglit tests:
- spec/glsl-1.50/compiler/gs-redeclares-pervertex-in-with-incorrect-name.geom
- spec/glsl-1.50/compiler/gs-redeclares-pervertex-out-as-array.geom
- spec/glsl-1.50/compiler/gs-redeclares-pervertex-out-with-instance-name.geom

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:27:31 -07:00
Paul Berry 3c83c96dcd glsl: Make it possible to disable a variable in the symbol table.
In later patches, we'll use this in order to implement the required
behaviour that after the gl_PerVertex interface block has been
redeclared, only members of the redeclared interface block may be
used.

v2: Update the function name and comment to clarify that we aren't
actually removing the variable from the symbol table, just disabling
it.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:27:27 -07:00
Paul Berry 24b9bba19b glsl: Add an ir_variable::reinit_interface_type() function.
This will be used by future patches to change an ir_variable's
interface type when the gl_PerVertex built-in interface block is
redeclared.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:27:22 -07:00
Paul Berry 3699ff4dd1 glsl: Generalize processing of variable redeclarations.
This patch modifies the get_variable_being_redeclared() function so
that it no longer relies on the ast_declaration for the variable being
redeclared.  In future patches, this will allow
get_variable_being_redeclared() to be used for processing
redeclarations of the built-in gl_PerVertex interface block.

v2: Also make get_variable_being_redeclared() static.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:27:20 -07:00
Paul Berry 78b072b2bc glsl: Don't allow invalid identifiers as struct names.
Fixes piglit test
spec/glsl-1.10/compiler/struct/struct-name-uses-gl-prefix.vert.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:27:17 -07:00
Paul Berry 9fb6f59552 glsl: Don't allow invalid identifiers as interface block instance names.
Note: we need to make an exception for the gl_PerVertex interface
block, since in geometry shaders it is allowed to be redeclared with
the instance name gl_in.  Future patches will make redeclaration of
gl_PerVertex work properly.

Fixes piglit test
spec/glsl-1.50/compiler/interface-block-instance-name-uses-gl-prefix.vert.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:27:15 -07:00
Paul Berry 9b5b0320b6 glsl: Don't allow invalid identifier names in struct/interface fields.
Note: we need to make an exception for the gl_PerVertex interface
block, since built-in variables are allowed to be redeclared inside
it.  Future patches will make redeclaration of gl_PerVertex work
properly.

Fixes piglit tests:
- spec/glsl-1.50/compiler/interface-block-array-elem-uses-gl-prefix.vert
- spec/glsl-1.50/compiler/named-interface-block-elem-uses-gl-prefix.vert
- spec/glsl-1.50/compiler/unnamed-interface-block-elem-uses-gl-prefix.vert

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:27:12 -07:00
Paul Berry f2dd3a04ce glsl: Don't allow invalid identifiers as interface block names.
Note: we need to make an exception for the gl_PerVertex interface
block, since this is allowed to be redeclared.  Future patches will
make redeclaration of gl_PerVertex work properly.

Fixes piglit test
spec/glsl-1.50/compiler/interface-block-name-uses-gl-prefix.vert.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:27:10 -07:00
Paul Berry 9bb60a155f glsl: Don't allow unnamed interface blocks to redeclare variables.
Note: some limited amount of redeclaration is actually allowed,
provided the shader is redeclaring the built-in gl_PerVertex interface
block.  Support for this will be added in future patches.

Fixes piglit tests
spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-{block-elem,global}.vert.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:27:08 -07:00
Paul Berry 1838df97a2 glsl: Refactor code to check that identifier names are valid.
GLSL reserves identifiers beginning with "gl_" or containing "__", but
we haven't been consistent about enforcing this rule.  This patch
makes a new function to check whether identifier names are valid.  In
the process it closes a loophole where we would previously allow
function argument names to contain "__".

v2: Rename check_valid_identifier() -> validate_identifier().  Add
curly braces in validate_identifier().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:27:05 -07:00
Paul Berry 6a157f2e33 glsl: Account for location field when comparing interface blocks.
In commit e2660770731b018411fbe1620cacddaf8dff5287 (glsl: Keep track
of location for interface block fields), I neglected to update
glsl_type::record_key_compare to account for the fact that interface
types now contain location information.  As a result, interface types
that differ only by their location information would not be properly
distinguished.

At the moment this is not a problem, because the only interface block
in which location information != -1 is gl_PerVertex, and gl_PerVertex
is always created in the same way.  However, in the patches that
follow, we'll be adding new ways to create gl_PerVertex (by
redeclaring it), so we'll need location information to be handled
properly.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:27:03 -07:00
Paul Berry 5a234d92af glsl: Construct gl_PerVertex interfaces for GS and VS outputs.
Although these interfaces can't be accessed directly by GLSL (since
they don't have an instance name), they will be necessary in order to
allow redeclarations of gl_PerVertex.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:27:00 -07:00
Paul Berry fb41f2c531 glsl: Refactor code for creating gl_PerVertex interface block.
Currently, we create just a single gl_PerVertex interface block for
geometry shader inputs.  In later patches, we'll also need to create
an interface block for geometry and vertex shader outputs.  Moving the
code into its own class will make reuse easier.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:26:58 -07:00
Paul Berry d2e66b953e glsl: Fix block name of built-in gl_PerVertex interface block.
Previously, we erroneously used the name "gl_in" for both the block
name and the instance name.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:26:56 -07:00
Paul Berry 192d05f277 glsl: Construct gl_in with a location of -1.
We use a location of -1 for variables which don't have their own
assigned locations--this includes ir_variables which represent named
interface blocks.  Technically the location assigned to gl_in doesn't
matter, since gl_in is only accessed via its members (which have their
own locations).  But it's nice to be consistent.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-10 14:26:53 -07:00
Christian König 8bc7673ef8 radeon/winsys: fix handling in radeon_drm_cs_flush v2
Calling radeon_drm_cs_flush from multiple threads might cause deadlocks,
fix this by immediately signaling the semaphore after waiting for it.

This is a candidate for the stable branch(es).

Partially fixes: https://bugs.freedesktop.org/show_bug.cgi?id=70123

v2: some fixes on commit message

Signed-off-by: Christian König <christian.koenig@amd.com>
2013-10-10 11:50:38 +02:00
José Fonseca a922d3413f util: Fix MinGW build.
_GNU_SOURCE appears to not be used reliably.  Use _MSC_VER instead so
that MSVC alone is affected.
2013-10-09 21:17:53 -07:00
José Fonseca 1aef0ef277 llvmpipe: We don't use the draw pipeline for offset_point/line.
Unless the polygon fill mode is different from PIPE_POLYGON_MODE_FILL,
so checking the the polygon mode is sufficient.

Testing done: no regression in polygon-mode-offset
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2013-10-09 21:09:07 -07:00
Roland Scheidegger 9b3dbaf396 gallivm: kill old per-quad face selection code
Not used since ages, and it wouldn't work at all with explicit derivatives now
(not that it did before as it ignored them but now the code would just use
the derivs pre-projected which would be quite random numbers).

v2: also get rid of 3 helper functions no longer used.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-10-10 04:32:57 +02:00
Roland Scheidegger 47d0613eb7 gallivm: handle explicit derivatives for cubemaps
They need some special handling. Quite complicated.
Additionally, use the same code for implicit derivatives too if no_rho_approx
and no_quad_lod is set, because it seems while generally it should be ok
to use per quad lod for implicit derivatives there's at least some test which
insists that in case of cubemaps the shared lod value MUST come from a pixel
inside the primitive (due to the derivatives becoming different if a different
larger major axis is chosen).

v2: based on Brian's feedback, clean up code a bit.
And use sign bit of major axis instead of pre-select s/t/r sign for coord
mirroring (which should be the same in the end, saves 2 ands).
Also fix two bugs with select/mirror of derivatives, the minor axes need to
use major axis sign as well (instead of major derivative axis sign), and
don't mistakenly use absolute values of major derivative and inverse major
values.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-10-10 04:32:57 +02:00
Roland Scheidegger ce1d8634aa gallivm: ignore rho approximation for cube maps
There's two reasons for this:
1) even when ignoring rho approximation for cube maps, the result is still
not correct, but it's better as the max error at edges is now sqrt(2) instead
of 2 (which was a full mip level), same as it is for ordinary 2d maps when
doing rho approximations (so the error actually goes from factor 2 at edges and
sqrt(2) completely inside a face to sqrt(2) at edges and 0 inside a face).
2) I want to repurpose rho_no_approx for cubemaps for fully correct cubemap
derivatives (so don't need yet another debug var).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-10-10 04:32:57 +02:00
Paul Berry 15e05b999b glsl: Modify array_sizing_visitor to handle unnamed interface blocks.
We were already setting the array size of unsized arrays that appeared
inside unnamed interface blocks, but we weren't updating
ir_variable::interface_type to reflect the new array size, causing
bogus link errors.

This patch causes array_sizing_visitor to keep track of all the
unnamed interface types it sees, and the ir_variables corresponding to
each one.  After the visitor runs, a new function,
fixup_unnamed_interface_types(), adjusts each unnamed interface type
to correctly correspond with the array sizes in the ir_variables.

Fixes piglit tests:
- spec/glsl-1.50/execution/unsized-in-unnamed-interface-block-gs
- spec/glsl-1.50/execution/unsized-in-unnamed-interface-block-multiple

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-10-09 16:49:48 -07:00
Paul Berry 45e46b2e37 glsl: Update call_link_visitor to update max_ifc_array_access.
When multiple shaders of the same type access an interface block
containing an unsized array, we need to set the array size based on
the maximum array element accessed across all the shaders.  This is
similar to what we already do with unsized arrays occurring outside of
interface blocks.

Note: one corner case is not yet addressed by these patches: the case
where one compilation unit defines an interface block containing
unsized arrays and another compilation unit defines the same interface
block containing sized arrays.

Fixes piglit test:
- spec/glsl-1.50/execution/unsized-in-named-interface-block-multiple

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-10-09 16:49:46 -07:00