Commit Graph

85113 Commits

Author SHA1 Message Date
Ian Romanick ea6ed2379d glsl: Fix cut-and-paste bug in hierarchical visitor ir_expression::accept
At this point in the code, s must be visit_continue.  If the child
returned visit_stop, visit_stop is the only correct thing to return.

Found by inspection.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-09-27 12:06:46 -07:00
Ian Romanick 7f64041cee glsl: Add bit_xor builder
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-09-27 12:06:46 -07:00
Ian Romanick 5f7f7d582b glsl/standalone: Enable GLSL 4.00 through 4.50
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-09-27 12:06:46 -07:00
Ian Romanick 798d1b8816 glsl/standalone: Use API_OPENGL_CORE if the GLSL version is >= 1.40
Otherwise extensions to 1.40 that are only for core profile won't work.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-09-27 12:06:46 -07:00
Ian Romanick afd99734db glsl: Update function parameter documentation for do_common_optimization
max_unroll_iterations was moved into options a long, long time ago.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-09-27 12:06:46 -07:00
Tim Rowley bacdd9ef4c configure.ac: add llvm inteljitevents component if enabled
Needed to successfully link llvmpipe or swr when using shared llvm libs
built with inteljitevents enabled.

v2: Make adding inteljitevents component global rather than just
llvmpipe/swr, since libgallium will have a symbol dependency.

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2016-09-27 12:56:47 -05:00
Tim Rowley 50842e8a93 swr: replace gallium->swr format enum conversion
Replace old string comparison with a mapping table.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
2016-09-27 12:55:26 -05:00
Nicolai Hähnle 4421c0fb0d gallium/radeon/winsyses: reduce the number of pb_cache buckets
Small buffers are now handled via the slabs code, so separate buckets in
pb_cache have become redundant.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-09-27 16:45:41 +02:00
Nicolai Hähnle fb827c055c winsys/radeon: enable buffer allocation from slabs
Only enable for chips with GPUVM, because older driver paths do not take the
required offset into account.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-09-27 16:45:37 +02:00
Nicolai Hähnle a1e391e39d winsys/radeon: add fine-grained fences for slab buffers
Note the logic for adding fences is somewhat different than for amdgpu,
because radeon has no scheduler and we therefore have no guarantee about
the order in which submissions from multiple threads are processed.

(Ironically, this is only an issue when "multi-threaded submission" is
disabled, because "multi-threaded submission" actually means that all
submissions happen from a single thread that happens to be separate from
the application's threads. If we only supported "multi-threaded
submission", the fence handling could be simplified by adding the fences
in that thread where everything is serialized.)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-09-27 16:45:34 +02:00
Nicolai Hähnle 0edebde9a4 winsys/radeon: add slab buffer list
Introducing radeon_bo::hash will reduce collisions between "real" buffers
and buffers from slabs.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-09-27 16:45:32 +02:00
Nicolai Hähnle cbb9c2f170 winsys/radeon: separate adding a buffer from updating its reloc data
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-09-27 16:45:29 +02:00
Nicolai Hähnle a9e8672585 winsys/radeon: add slab entry structures to radeon_bo
Already adjust the map/unmap logic accordingly.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-09-27 16:45:25 +02:00
Nicolai Hähnle ffa1c669dd winsys/amdgpu: enable buffer allocation from slabs
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-09-27 16:45:23 +02:00
Nicolai Hähnle a3832590c6 winsys/amdgpu: add fence and buffer list logic for slab allocated buffers
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-09-27 16:45:20 +02:00
Nicolai Hähnle a987e4377a winsys/amdgpu: add slab entry structures to amdgpu_winsys_bo
Already adjust amdgpu_bo_map/unmap accordingly.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-09-27 16:45:15 +02:00
Nicolai Hähnle 5af9eef719 winsys/amdgpu: do not synchronize unsynchronized buffers
When a buffer is added to a CS without the SYNCHRONIZED usage flag, we now
no longer add a dependency on the buffer's fence(s).

However, we still need to add a fence to the buffer during flush, so that
cache reclaim works correctly (and in the hypothetical case that the buffer
is later added to a CS _with_ the SYNCHRONIZED flag).

It is now possible that the submissions refererring to a buffer are no longer
linearly ordered, and so we may have to keep multiple fences around. We keep
the fences in a FIFO. It should usually stay quite short (# of contexts * 2,
for gfx + dma rings).

While we're at it, extract amdgpu_add_fence_dependency for a single buffer,
which will make adding the distinction between real buffer and slab cases
easier.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-09-27 16:45:11 +02:00
Nicolai Hähnle 6d89a40676 gallium/radeon: add RADEON_FLAG_HANDLE
When passed to winsys->buffer_create, this flag will indicate that we require
a buffer that maps 1:1 with a kernel buffer handle.

This is currently set for all textures, since textures can potentially be
exported to other processes. This is not a huge loss, since the main purpose
of this patch series is to deal with applications that allocate many small
buffers.

A hypothetical application with tons of tiny textures might still benefit
from not setting this flag, but that's not a use case I'm worried about
just now.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-09-27 16:45:05 +02:00
Nicolai Hähnle e703f71ebd gallium/radeon: add RADEON_USAGE_SYNCHRONIZED
This is really the behavior we want most of the time, but having a
SYNCHRONIZED flag instead of an UNSYNCHRONIZED one has the advantage that
OR'ing different flags together always results in stronger guarantees.

The parent BOs of sub-allocated buffers will be added unsynchronized.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-09-27 16:45:02 +02:00
Nicolai Hähnle 84f156c0cb gallium/pipebuffer: add pb_slab utility
This is a simple framework for slab allocation from buffers that fits into
the buffer management scheme of the radeon and amdgpu winsyses where bufmgrs
aren't used.

The utility knows about different sized allocations and explicitly manages
reclaim of allocations that have pending fences. It manages all the free lists
but does not actually touch buffer objects directly, relying on callbacks for
that.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-09-27 16:44:42 +02:00
Nicolai Hähnle b3ebc229dc gallium/u_math: add util_logbase2_ceil
For finding the exponent of the next power of two.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-09-27 16:44:38 +02:00
Nicholas Bishop c060f291c2 i915g: add dma-buf support to i915_drm_buffer_get_handle
The implementation of i915_drm_buffer_get_handle now handles
DRM_API_HANDLE_TYPE_FD in the same way that intel_winsys_import_handle
does, by calling drm_intel_bo_gem_create_from_prime.

Tested by successfully running Chrome's ozone_demo [1] with the
ozone-gbm backend on an Intel Pineview M machine. Without this change
it fails while trying to create a DMA-BUF.

[1] https://chromium.googlesource.com/chromium/src.git/+/master/ui/ozone/demo/ozone_demo.cc

Signed-off-by: Nicholas Bishop <nbishop@neverware.com>
[Emil Velikov: Fix coding style]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-09-27 13:37:21 +01:00
Nicholas Bishop aa560e8e63 st/dri: check pipe_screen->resource_get_handle() return value
Change dri2_query_image to check the return value of resource_get_handle
and return GL_FALSE if an error occurs.

For reference this is an example callstack that should propagate the
error back to the user:

    i915_drm_buffer_get_handle
    i915_texture_get_handle
    u_resource_get_handle_vtbl
    dri2_query_image
    gbm_dri_bo_get_fd
    gbm_bo_get_fd

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Nicholas Bishop <nbishop@neverware.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
[Emil Velikov: Split from larger patch, polish coding style, cc stable]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-09-27 13:37:21 +01:00
Nicholas Bishop 2d05ba2ca0 gbm: return appropriate error when queryImage() fails
Change gbm_dri_bo_get_fd to check the return value of queryImage and
return -1 (an invalid file descriptor) if an error occurs.

Update the comment for gbm_bo_get_fd to return -1, since (apart from the
above) we've already return -1 on error.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Nicholas Bishop <nbishop@neverware.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
[Emil Velikov: Split from larger patch, polish coding style, cc stable]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-09-27 13:37:21 +01:00
Andy Furniss a599302227 st/va Avoid VBR bitrate calculation overflow v2
VBR bitrate calc needs 64 bits at high rates.

v2: use float.

Signed-off-by: Andy Furniss <adf.lists@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Cc: mesa-stable@lists.freedesktop.org
2016-09-27 14:21:45 +02:00
Mark Thompson a543f231d7 st/va: Fix vaSyncSurface with no outstanding operation
Fixes crash if the application doesn't do what the state tracker expects.

Reviewed-by: Christian König <christian.koenig@amd.com>
2016-09-27 14:21:44 +02:00
Timothy Arceri df920367bf glsl: remove remaining tabs in glsl_parser_extras.h
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-09-27 20:32:47 +10:00
Ilia Mirkin 477cc0e085 st/mesa: enable ARB_ES3_2_compatibility when enough available
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Marek Olšák <marek.olsak@amd.com>
2016-09-27 00:20:44 -04:00
Ilia Mirkin 67fbaa5873 st/mesa: enable GL_ANDROID_extension_pack_es31a when available
For now that's never since advanced blend hasn't been piped through.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Marek Olšák <marek.olsak@amd.com>
2016-09-27 00:20:41 -04:00
Timothy Arceri 63e8221574 glsl: move some uniform linking code to new link_assign_uniform_storage()
This makes link_assign_uniform_locations() easier to follow.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-09-27 11:29:05 +10:00
Timothy Arceri ab67b6afdf glsl: move some uniform linking code to new link_setup_uniform_remap_tables()
This makes link_assign_uniform_locations() easier to follow.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-09-27 11:29:05 +10:00
Timothy Arceri 856e0bd707 i965: create populate key functions for tcs and tes
These will be used by the on disk shader cache.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-09-27 11:11:15 +10:00
Timothy Arceri ec75570415 i965: make gs key generation helper available to shader cache
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-09-27 11:11:15 +10:00
Timothy Arceri 481d8ec291 glsl: use reproducible name for lowered const arrays
Otherwise we can end up with mismatching names between the cached
binary and the cached metadata.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-09-27 11:11:15 +10:00
Carl Worth 017081a3e5 i965: make vs and fs key generation helpers available to shader cache
Signed-off-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
2016-09-27 11:11:15 +10:00
Carl Worth f61669f997 glsl: Prepare standalone compiler to be able to use parameter lists
As part of the shader-cache work an upcoming change will add new
references to _mesa_add_parameter and _mesa_new_parameter_list from
the glsl code. To prepare for that, and to allow the standalone
glsl_compiler to still link, here we add mesa/program/prog_parameter.c
to the libglsl_util sources.

Then, in order to get *that* to work, we also add to stubs to
standalone_scaffolding:

	_mesa_program_state_flags
	_mesa_program_state_string

These functions aren't actually used by the two functions in
prog_parameter.c that we are actually calling. They are used in other
functions in the same file. So we don't care what the implementation
of these stubs is, (they won't be called by glsl_compiler). We just
need the stubs present so that it can link.

Signed-off-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-09-27 11:11:15 +10:00
Samuel Pitoiset f24b517858 nv50/ir: fix comments about instructions info
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
2016-09-26 21:59:37 +02:00
Rob Clark ecd6fce261 mesa/st: support lowering multi-planar YUV
Support multi-planar YUV for external EGLImage's (currently just in the
dma-buf import path) by lowering to multiple texture fetch's for each
plane and CSC in shader.

There was some discussion of alternative approaches for tracking the
additional UV or U/V planes:

  https://lists.freedesktop.org/archives/mesa-dev/2016-September/127832.html

They all seemed worse than pipe_resource::next

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-09-26 15:29:17 -04:00
Rob Clark e0ec1c3134 mesa/st: add nir pass to lower tex_src_plane
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-09-26 15:29:17 -04:00
Rob Clark c2a60cacd4 mesa/st: add lowering pass for YUV samplers
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-09-26 15:29:17 -04:00
Sirisha Gandikota 8e3e9d74b5 aubinator: Fix the decoding of values that span two Dwords
Fixed the way the values that span two Dwords are decoded.
Based on the start and end indices of the field, the Dwords
are fetched and decoded accordingly.

v2: rename dw to qw in gen_field_iterator_next
and remove extra white space (Anuj)

v3: change all instances of dw to qw (Anuj)

Earlier, 64-bit fields (such as most pointers on Gen8+)
weren't decoded correctly.  gen_field_iterator_next seemed
to walk one DWord at a time, sets v.dw, and then passes it
to field(). So, even though field() takes a uint64_t, we're
passing it a uint32_t (which gets promoted, so the top 32
bits will always be zero). This seems pretty bogus... (Ken)

Signed-off-by: Sirisha Gandikota <Sirisha.Gandikota@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-09-26 11:18:52 -07:00
Samuel Pitoiset ac859d68f4 nvc0: allow to force compiling programs in debug build
This adds a new envvar called NV50_PROG_CHIPSET which allows to
compile shaders with a different target, especially useful for
shader-db.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2016-09-26 19:39:04 +02:00
Samuel Pitoiset e05042b367 nv50/ir: drop unused NVISA_XXX_CHIPSET constants
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2016-09-26 19:39:04 +02:00
Samuel Pitoiset be0535b8c7 gallium/util: make use of strtol() in debug_get_num_option()
This allows to use hexadecimal numbers which are automatically
detected by strtol() when the base is 0.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Tested-by: Brian Paul <brianp@vmware.com>
2016-09-26 19:39:04 +02:00
Glenn Kennard 5da24242b3 r600g: Add support for PK2H/UP2H
Based off of Ilia's original patch, but with output values replicated so
that it matches the TGSI semantics.

Signed-off-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2016-09-26 17:08:49 +02:00
Timothy Arceri eb2dc04127 i965: stop passing stage as a function parameter
We already pass the shader so we can just get the stage from this.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2016-09-26 09:59:24 +10:00
Nayan Deshmukh b3827819aa aubinator: fix resource leak
CovID: 1373370

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-09-25 12:32:48 -07:00
Emilio Cobos Álvarez cb7c2c9d65 osmesa: Unbind the current context when given a null context and buffer.
This is needed to be consistent with other drivers.

Signed-off-by: Emilio Cobos Álvarez <me@emiliocobos.me>
Reviewed-by: Brian Paul <brianp@vmware.com>
2016-09-23 19:55:50 -06:00
Brian Paul 07d1f8faf9 st/mesa: small optimization in swizzle_swizzle()
Usually, there's no user-specified texture swizzle so we can optimize
the swizzle_swizzle() function and skip the loop/switch.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2016-09-23 19:54:42 -06:00
Brian Paul 1cdc232e1a st/mesa: fix swizzle issue in st_create_sampler_view_from_stobj()
Some demos, like Heaven, were creating and destroying a large number
of sampler views because of a swizzle issue.

Basically, we compute the sampler view's swizzle by examining the
texture format, user swizzle, depth mode, etc.  Later, during validation
we recompute that swizzle (in case something like depth mode changes)
and see if it matches the view's swizzle.

In the case of PIPE_FORMAT_RGTC2_UNORM, get_texture_format_swizzle
returned SWIZZLE_XYZW but the u_sampler_view_default_template() function
was setting the sampler view's swizzle to SWIZZLE_XY01.  This mismatch
caused the validation step to always "fail" so we'd destroy the old
sampler view and create a new one.

By removing the conditional, the sampler view's swizzle and the computed
texture swizzle match and validation "passes".  When creating a new sampler
view, we always want to use the texture swizzle which we just computed.

Fixes VMware issue 1733389.

Cc: mesa-stable@lists.freedesktop.org

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2016-09-23 19:54:42 -06:00