Commit Graph

85350 Commits

Author SHA1 Message Date
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
Brian Paul c0d7b6073d svga: set PIPE_BIND_DEPTH_STENCIL flag for new resources when possible
When we create a depth/stencil texture, also check if we can render to
it and set the PIPE_BIND_DEPTH_STENCIL flag.  We were previously doing
this for color textures (PIPE_BIND_RENDER_TARGET).

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2016-09-23 19:54:42 -06:00
Brian Paul f942a70340 svga: don't special case caps for SVGA3D_R32_FLOAT
This may have been needed years ago during development, but not now.
Prevents some regressions after introducing the next patch.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2016-09-23 19:54:42 -06:00
Brian Paul 14639cdf8f svga: use new adjust_z_layer() helper in svga_pipe_blit.c
To handle z/layer fix-ups for blitting and copying.  Note that we weren't
doing this properly in svga_blit() before.

Also, remove redundant stex, dtex assignments.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2016-09-23 19:54:42 -06:00
Brian Paul c42000545d svga: simplify/improve the format compatibility check for region copies
The util_is_format_compatible() function didn't quite do what we wanted
for vgpu10.  This check is more flexible and allows copies between
formats such as R32G32B32A32_FLOAT and R32G32B32A32_INT.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2016-09-23 19:54:42 -06:00
Brian Paul 2ad4ba0727 svga: add const qualifier on svga_translate_format()
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2016-09-23 19:54:42 -06:00
Brian Paul 4d04696524 svga: eliminate unneeded gotos in svga_validate_surface_view()
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2016-09-23 19:54:42 -06:00
Neha Bhende 47f16f5e7f svga: disable srgb format related code from svga_blit()
With latest mesa and latest piglit tests srgb<->linear conversion
is not required as per GL4.4 rules

See commit b662c70aea.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2016-09-23 19:53:51 -06:00
Timothy Arceri 29c174a3e5 Revert "glsl: move xfb BufferStride into gl_transform_feedback_info"
This reverts commit f5a6aab403.

This broke some tests. It seems gl_transform_feedback_info gets memset
to 0 so we were losing the values in BufferStride before we used them.
2016-09-24 10:17:26 +10:00
Kenneth Graunke 943b69cddd glsl: Delete linker stuff relating to built-in functions.
Now that we generate built-in functions inline, there's no need to link
against the built-in shader, and no built-in prototypes to consider.

This lets us delete a bunch of code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by; Ian Romanick <ian.d.romanick@intel.com>
2016-09-23 16:40:40 -07:00
Kenneth Graunke f7a5c714b3 glsl: Delete ftransform support from builtin_functions.cpp.
This is now handled directly by ast_function.cpp.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by; Ian Romanick <ian.d.romanick@intel.com>
2016-09-23 16:40:40 -07:00
Kenneth Graunke b04ef3c08a glsl: Immediately inline built-ins rather than generating calls.
In the past, we imported the prototypes of built-in functions, generated
calls to those, and waited until link time to resolve the calls and
import the actual code for the built-in functions.

This severely limited our compile-time optimization opportunities: even
trivial functions like dot() were represented as function calls.  We
also had no way of reasoning about those calls; they could have been
1,000 line functions with side-effects for all we knew.

Practically all built-in functions are trivial translations to
ir_expression opcodes, so it makes sense to just generate those inline.
Since we eventually inline all functions anyway, we may as well just do
it for all built-in functions.

There's only one snag: built-in functions that refer to built-in global
variables need those remapped to the variables in the shader being
compiled, rather than the ones in the built-in shader.  Currently,
ftransform() is the only function matching those criteria, so it seemed
easier to just make it a special case.

On Skylake:

total instructions in shared programs: 12023491 -> 12024010 (0.00%)
instructions in affected programs: 77595 -> 78114 (0.67%)
helped: 97
HURT: 309

total cycles in shared programs: 137239044 -> 137295498 (0.04%)
cycles in affected programs: 16714026 -> 16770480 (0.34%)
helped: 4663
HURT: 4923

while these statistics are in the wrong direction, the number of
hurt programs is small (309 / 41282 = 0.75%), and I don't think
anything can be done about it.  A change like this significantly
alters the order in which optimizations are performed.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by; Ian Romanick <ian.d.romanick@intel.com>
2016-09-23 16:40:40 -07:00
Kenneth Graunke 1617f59bc6 glsl: Check TCS barrier restrictions at ast_to_hir time, not link time.
We want to check prior to optimization - otherwise we might fail to
detect cases where barrier() is in control flow which is always taken
(and therefore gets optimized away).

We don't currently loop unroll if there are function calls inside;
otherwise we might have a problem detecting barrier() in loops that
get unrolled as well.

Tapani's switch handling code adds a loop around switch statements, so
even with the mess of if ladders, we'll properly reject it.

Enforcing these rules at compile time makes more sense more sense than
link time.  Doing it at ast-to-hir time (rather than as an IR pass)
allows us to emit an error message with proper line numbers.
(Otherwise, I would have preferred the IR pass...)

Fixes spec/arb_tessellation_shader/compiler/barrier-switch-always.tesc.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by; Ian Romanick <ian.d.romanick@intel.com>
2016-09-23 16:40:40 -07:00
Timothy Arceri f5a6aab403 glsl: move xfb BufferStride into gl_transform_feedback_info
It makes more sense to have this here where we store the other values
from xfb qualifiers. The struct it was previously part of is now only
used to store values that come from the api.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
2016-09-24 09:18:29 +10:00