Commit Graph

62373 Commits

Author SHA1 Message Date
Simone Scanzoni c3b701d63c egl-static: fix build after recent radeon winsys changes
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2014-04-13 02:37:36 +02:00
Chris Forbes b92e7f2da9 mesa: Fix typo in error message
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
2014-04-13 12:38:24 +12:00
Iago Toral Quiroga a5957f7bc5 i965: glClearBuffer() should only clear a single buffer.
glClearBuffer() is currently clearing all active draw color buffers (all
buffers that have not been set to GL_NONE when calling glDrawBuffers) instead
of only clearing the one it receives as parameter. Altough brw_clear()
receives a bit mask indicating the color buffers that should be cleared,
this mask is ignored when calling brw_blorp_clear_color().

This was breaking the 'fbo-drawbuffers-none glClearBuffer' piglit test.

The patch provides the bit mask to brw_blorp_clear_color() so it can limit
clearing to the color buffers present in the mask.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76832
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-04-13 12:28:25 +12:00
Chris Forbes 26224d3e00 i965: Add comment to explain the weird-looking shadow compares.
This always looks crazy when I stumble across it, until I remember
what the hardware is doing. Describing it ought to short-circuit
that process next time :)

V2: Fix indents to 6 spaces, not 7.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-04-13 08:51:46 +12:00
Kenneth Graunke 857f3a68ea glsl: Ignore loop-too-large heuristic if there's bad variable indexing.
Many shaders use a pattern such as:

for (int i = 0; i < NUM_LIGHTS; i++) {
   ...access a uniform array, or shader input/output array...
}

where NUM_LIGHTS is a small constant (such as 2, 4, or 8).

The expectation is that the compiler will unroll those loops, turning
the array access into constant indexing, which is more efficient, and
which may enable array splitting and other optimizations.

In many cases, our heuristic fails - either there's another tiny nested
loop inside, or the estimated number of instructions is just barely
beyond the threshold.  So, we fail to unroll the loop, leaving the
variable indexing in place.

Drivers which don't support the particular flavor of variable indexing
will call lower_variable_index_to_cond_assign(), which generates piles
and piles of immensely inefficient code.  We'd like to avoid generating
that.

This patch detects unsupported forms of variable-indexing in loops, where
the array index is a loop induction variable.  In that case, it bypasses
the loop-too-large heuristic and forces unrolling.

Improves performance in various microbenchmarks: Gl32PSBump8 by 47%,
Gl32ShMapVsm by 80%, and Gl32ShMapPcf by 27%.  No changes in shader-db.

v2: Check ir->array for being an array or matrix, rather than the
    ir_dereference_array itself.
v3: Fix and expand statistics in commit message.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-04-11 17:41:43 -07:00
Kenneth Graunke 2231db5598 glsl: Rename loop_unroll_count::fail to "nested_loop."
The "fail" flag is set if loop_unroll_count encounters a nested loop;
calling the flag "nested_loop" is a bit clearer.

The original reasoning was that count is inaccurate (too small) if there
are nested loops, as we don't do any sort of analysis on the inner loop.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-04-11 17:41:41 -07:00
Kenneth Graunke 8268a2f347 glsl: Pass gl_shader_compiler_optimizations to unroll_loops().
Loop unrolling will need to know a few more options in the future.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-04-11 17:41:39 -07:00
Kenneth Graunke da22221aa3 glsl: Drop do_common_optimization's max_unroll_iterations parameter.
Now that we pass in gl_shader_compiler_options, it makes sense to just
use options->MaxUnrollIterations, rather than passing a separate
parameter.

Half of the invocations already passed options->MaxUnrollIterations,
while the other half passed in a hardcoded value of 32.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-04-11 17:41:37 -07:00
Kenneth Graunke f00a6483e9 i965: Use EmitNoIndirect flags in lower_variable_index_to_cond_assign.
This will prevent the two from getting out of sync again.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-04-11 17:41:36 -07:00
Kenneth Graunke 320e0c5205 i965: Correct EmitNoIndirect shader compiler option flags.
These were out of sync with the flags used to control
lower_variable_index_to_cond_assign in brw_shader.cpp.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-04-11 17:41:25 -07:00
Matt Turner 509b2a6523 i965/fs: Reset reg_from when we can't coalesce.
Not setting this would prevented coalescing after a failed attempt if
the sources for both MOVs were the same.

total instructions in shared programs: 1654531 -> 1650224 (-0.26%)
instructions in affected programs:     423167 -> 418860 (-1.02%)
GAINED:                                2
LOST:                                  0

Reviewed-by: Eric Anholt <eric@anholt.net>
2014-04-11 15:27:46 -07:00
Eric Anholt 7e034a8d77 i965: Fill in a bunch of gen7/hsw data cache-related disasm.
This gets us disasm of atomic ops.

v2: Fix fallthrough on pre-gen7.  (bug caught by Ilia Mirkin).

Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-04-11 13:38:53 -07:00
Eric Anholt 99442bc7b2 i965: Stop setting up a 1:1 "attrib" member in our vertex inputs.
It's just the array index, so we can just go look at the array and see
which element we are.

No significant performance difference (n=140)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-04-11 13:38:53 -07:00
Eric Anholt 9a5d19d680 i965: Skip a bunch of IB BO refcount twiddling.
Improves cairo performance on glamor by 1.64828% +/- 1.04742% (n=65).

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-04-11 13:38:52 -07:00
Eric Anholt 3f9440cfbb i965/gen7: Skip repeated NULL depth/stencil state emits.
Improves cairo performance on glamor by 2.87752% +/- 0.966977 (n=57).

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-04-11 13:38:52 -07:00
Chris Forbes fe4f373eb4 docs: Fix ubo indexing description
Ian points out that this being unrestricted was an oversight in the
spec, and is corrected in GLSL4.40.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
2014-04-12 08:31:05 +12:00
Brian Paul e5f306e3ff draw: remove unused 'start' variable in draw_stats_clipper_primitives()
It was computed, but never actually used.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-04-11 13:54:17 -06:00
Kenneth Graunke ae2a03b573 glsl: Try vectorizing when seeing a repeated assignment to a channel.
When considering assignment expressions like:

    v.x += u.x;
    v.x += u.x;

the vectorizer would incorrectly keep going, attempting to find more
instructions to vectorize.  It would overwrite the saved assignment
to point at the second one, and increment channels a second time,
resulting in try_vectorize thinking the expression was a vec2 instead of
a float.

Instead, if we see a repeated assignment to a channel, just try to
vectorize everything we've found so far.  This clears the saved state
so it will start over.

Fixes Piglit's repeated-channel-assignments.vert.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-04-11 12:39:37 -07:00
Ian Romanick 625cf8c874 glsl: Propagate explicit binding information from the AST all the way to the linker
Information about the binding was not being properly communicated from
the front-end compiler to the linker.  As a result, the linker never
knew that any UBOs had explicit bindings!

Fixes the piglit test arb_shading_language_420pack-binding-layout.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76323
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: github@socker.lepus.uberspace.de [v0]
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Cc: github@socker.lepus.uberspace.de
2014-04-11 12:26:01 -07:00
Ian Romanick 25a6656875 linker: Set binding for all elements of UBO array
Previously, a UBO like

    layout(binding=2) uniform U {
        ...
    } my_constants[4];

wouldn't get any bindings set.  The code would try to set the binding of
U, but that would fail.  It should instead set the bindings for U[0],
U[1], ...

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76323
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Cc: github@socker.lepus.uberspace.de
2014-04-11 12:26:01 -07:00
Ian Romanick cc42717b50 linker: Set block bindings based on UniformBlocks rather than UniformStorage
For blocks, gl_shader_program::UniformStorage isn't very useful.  The
names stored there are the names of the elements of the block, so
finding blocks with an instance name is hard.  There is also only one
entry in ::UniformStorage for each element of a block array, and that is
a deal breaker.

Using ::UniformBlocks is what _mesa_GetUniformBlockIndex does.  I
contemplated sharing code between set_block_binding and
_mesa_GetUniformBlockIndex, but building the stand-alone compiler and
the unit tests make this hard.  I plan to return to this effort shortly.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76323
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Cc: github@socker.lepus.uberspace.de
2014-04-11 12:26:01 -07:00
Ian Romanick 157391a41b linker: Clean up "unused parameter" warnings
../../src/glsl/link_uniform_initializers.cpp:87:1: warning: unused parameter 'mem_ctx' [-Wunused-parameter]
../../src/glsl/link_uniform_initializers.cpp:87:1: warning: unused parameter 'type' [-Wunused-parameter]
../../src/glsl/link_uniform_initializers.cpp:127:1: warning: unused parameter 'mem_ctx' [-Wunused-parameter]
../../src/glsl/link_uniform_initializers.cpp:127:1: warning: unused parameter 'type' [-Wunused-parameter]

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76323
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Cc: github@socker.lepus.uberspace.de
2014-04-11 12:26:01 -07:00
Ian Romanick 943b2d52bf linker: Fold set_uniform_binding into call site
In the next patch, we'll see that using
gl_shader_program::UniformStorage is not correct for uniform blocks.
That means we can't use ::UniformStorage to select between the sampler
path and the block path.  Instead we want to just use the type of the
variable.  That's never passed to set_uniform_binding, and it's easier
to just remove the function (especially for later patches in the series)
than to add another parameter.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76323
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Cc: github@socker.lepus.uberspace.de
2014-04-11 12:26:01 -07:00
Ian Romanick 881c52f13f linker: Various trivial clean-ups in set_sampler_binding
- Remove the spurious block left from the previous commit and re-indent.

- Constify elements.

- Make the spec reference in the code look like other spec references in
  the compiler.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76323
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Cc: github@socker.lepus.uberspace.de
2014-04-11 12:26:01 -07:00
Ian Romanick 6e2f63b69e linker: Split set_uniform_binding into separate functions for blocks and samplers
The two code paths are quite different, and there are some problems in
the handling of uniform blocks.  Future changes will cause these paths
to diverge further.  Ultimately, selecting between the two functions
will happen at the set_uniform_binding call site, and
set_uniform_binding will be deleted.

NOTE: This patch just moves code around.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76323
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Cc: github@socker.lepus.uberspace.de
2014-04-11 12:26:01 -07:00
Heinrich Janzing c8e7568f97 softpipe: fix shadow sampling
And remove nonsensical approximation of linear interpolation behavior
for shadow samplers.

Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
2014-04-11 11:47:32 -06:00
Brian Paul 86b8843e9c softpipe: add PIPE_CAP_MIN/MAX_TEXTURE_GATHER_OFFSET query cases
To silence compiler warnings.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-04-11 11:47:31 -06:00
Brian Paul f61edd509b mesa: use _mesa_get_srgb_format_linear() in sRGB texstore functions
Instead of switch statements.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-04-11 11:47:31 -06:00
Brian Paul c5631b341e swrast: use macros to initialize texfetch_funcs[] table
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-04-11 11:47:31 -06:00
Brian Paul 4da1efb370 swrast: fix more fetch_texel function names
These were missed/typo'd in the previous patch series:
s/R8G8B8A/R8G8B8A8/
s/rgba_16/RGBA_UNORM16/
s/rgba_uint/RGBA_UINT/
s/rgba_int/RGBA_SINT/

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-04-11 11:47:31 -06:00
José Fonseca 9d36a8d4d2 egl-static: Fix missing radeon_surface.h includes.
Fixes

  fatal error: radeon_surface.h: No such file or directory

when libdrm is not present, or non-Linux OSes.

Trivial.
2014-04-11 16:46:02 +01:00
Knut Andre Tidemann 5ac3435a47 gallium/radeon: fix missing winsys include in pipe-loader.
The commit 3b0b44f7de introduced a build
error:

error: dereferencing pointer to incomplete type

This patch fixes this issue in all the affected files.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
2014-04-11 19:22:17 -04:00
Christian König 68bba1801e st/omx/enc: separate input buffer private and task structure
Keep tasks as linked list, this way we can associate
more than one encoding task with each buffer.

Signed-off-by: Christian König <christian.koenig@amd.com>
2014-04-11 11:35:03 +02:00
Christian König 7806dbeb70 radeon/vce: implement B-frame support
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
2014-04-11 11:35:03 +02:00
Christian König a56fa0e83b radeon/vce: add proper CPB backtrack
Remember what frames we encoded at which position.

Signed-off-by: Christian König <christian.koenig@amd.com>
2014-04-11 11:35:03 +02:00
Christian König d7d41ce133 vl: add interface for H264 B-frame encoding
Signed-off-by: Christian König <christian.koenig@amd.com>
2014-04-11 11:35:03 +02:00
Christian König ee4439c562 radeon/vce: remove RVCE_NUM_CPB_EXTRA_FRAMES
Doesn't seems to be needed any more.

Signed-off-by: Christian König <christian.koenig@amd.com>
2014-04-11 11:35:02 +02:00
Chris Forbes ce57c8e925 docs/relnotes: Fix consistency, add i965 to ARB_buffer_storage.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
2014-04-11 21:20:13 +12:00
Kenneth Graunke 227049098b i965: Fix missing _NEW_SCISSOR in Broadwell SF_CLIP_VIEWPORT state.
The _Xmin/_Xmax/_Ymin/_Ymax values need to be guarded by _NEW_SCISSOR.

Fixes Piglit's scissor-many, and rendering in GNOME Shell.
Hopefully fixes similar issues with Unity and ChromeOS.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75879
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: James Ausmus <james.ausmus@intel.com>
Tested-by: Timo Aaltonen <tjaalton@ubuntu.com>
2014-04-10 23:38:10 -07:00
Ilia Mirkin 31640f4c38 mesa/st: set min/max texture gather offset to driver-reported value
It was always getting set to -8/7 unconditionally.  Use the
driver-reported value instead.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-04-10 20:42:48 -04:00
Ilia Mirkin c2f9ad5289 gallium: add a way to query min/max texture gather offsets
Defaults to providing the same offsets as MIN/MAX_TEXEL_OFFSET. For
nvc0, the offset can be -32/31.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-04-10 20:42:36 -04:00
Marek Olšák 8291f6d5c5 configure.ac: require libdrm_radeon 2.4.53
We need latest radeon_drm.h.
2014-04-10 21:24:50 +02:00
Marek Olšák 3b0b44f7de winsys/radeon: fix a race condition in initialization of radeon_winsys::screen
Create the screen in the winsys while the mutex is locked.
This also results in a nice code cleanup!

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2014-04-10 20:50:17 +02:00
Marek Olšák ac330d4130 winsys/radeon: fix a race condition between winsys_create and winsys_destroy
This also hides the reference count from drivers.

v2: update the reference count while the mutex is locked in winsys_create

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2014-04-10 20:50:17 +02:00
Marek Olšák 7c57b01564 winsys/radeon: fix a race condition between 2 calls to radeon_winsys_create
This fixes random crashes of: piglit/glx-multithread-shader-compile.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2014-04-10 20:50:17 +02:00
Marek Olšák b5ebfc33b8 winsys/radeon: remove unused radeon_info variables, move backend_map
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2014-04-10 20:50:17 +02:00
Marek Olšák 9b8449ae90 winsys/radeon: unify radeon_bo::flink and radeon_bo::name
Both contained the GEM flink name.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2014-04-10 20:50:17 +02:00
Marek Olšák 34564c8753 winsys/radeon: remove definitions already present in radeon_drm.h
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2014-04-10 20:50:17 +02:00
Marek Olšák e3e05c6db9 winsys/radeon: handle squared micro tiling from GEM_GET_TILING
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2014-04-10 20:50:17 +02:00
Marek Olšák 38858207a1 gallium/u_gen_mipmap: rewrite using pipe->blit (v2)
This replaces u_gen_mipmap with an extremely simple implementation based
on pipe->blit. st/mesa is also cleaned up.

Pros:
- less code
- correct mipmap generation for NPOT 3D textures (u_blitter uses a better
  formula)
- queries are not affected by mipmap generation if drivers disable them

v2: add "first_layer", "last_layer" parameters, drop "face"
v2.1: add format
v2.2: document the format parameter
2014-04-10 20:50:16 +02:00