mesa.git
8 years agovc4: Emit perf debug when we fall back to quad clears.
Eric Anholt [Mon, 26 Sep 2016 23:14:51 +0000 (16:14 -0700)]
vc4: Emit perf debug when we fall back to quad clears.

8 years agonir: Optimize out discard_ifs with a constant 0 argument.
Eric Anholt [Wed, 16 Mar 2016 01:32:19 +0000 (18:32 -0700)]
nir: Optimize out discard_ifs with a constant 0 argument.

I found this in a shader that was doing an alpha test when alpha is fixed
at 1.0.

v2: Rebase on master (now the const value is "u32" not "u").

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (v1)
8 years agogallium/radeon: Initialize pipe_resource::next to NULL
Michel Dänzer [Tue, 27 Sep 2016 09:17:12 +0000 (18:17 +0900)]
gallium/radeon: Initialize pipe_resource::next to NULL

Fixes lots of piglit tests crashing due to using uninitialized memory.

Fixes: ecd6fce2611e ("mesa/st: support lowering multi-planar YUV")
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoglsl: don't crash when dumping shaders if some come from cache
Timothy Arceri [Sun, 27 Mar 2016 05:25:12 +0000 (16:25 +1100)]
glsl: don't crash when dumping shaders if some come from cache

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: Add initial functions to implement an on-disk cache
Timothy Arceri [Tue, 27 Sep 2016 22:55:02 +0000 (08:55 +1000)]
glsl: Add initial functions to implement an on-disk cache

This code provides for an on-disk cache of objects. Objects are stored
and retrieved via names that are arbitrary 20-byte sequences,
(intended to be SHA-1 hashes of something identifying for the
content). The directory used for the cache can be specified by means
of environment variables in the following priority order:

$MESA_GLSL_CACHE_DIR
$XDG_CACHE_HOME/mesa
<user-home-directory>/.cache/mesa

By default the cache will be limited to a maximum size of 1GB. The
environment variable:

$MESA_GLSL_CACHE_MAX_SIZE

can be set (at the time of GL context creation) to choose some other
size. This variable is a number that can optionally be followed by
'K', 'M', or 'G' to select a size in kilobytes, megabytes, or
gigabytes. By default, an unadorned value will be interpreted as
gigabytes.

The cache will be entirely disabled at runtime if the variable
MESA_GLSL_CACHE_DISABLE is set at the time of GL context creation.

Many thanks to Kristian Høgsberg <krh@bitplanet.net> for the initial
implementation of code that led to this patch. In particular, the idea
of using an mmapped file, (indexed by a portion of the SHA-1), for the
efficent implementation of cache_has_key was entirely his
idea. Kristian also provided some very helpful advice in discussions
regarding various race conditions to be avoided in this code.

Signed-off-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years ago.gitignore: Ignore src/compiler/spirv2nir
Chad Versace [Tue, 27 Sep 2016 20:22:44 +0000 (13:22 -0700)]
.gitignore: Ignore src/compiler/spirv2nir

8 years agoglsl: Fix cut-and-paste bug in hierarchical visitor ir_expression::accept
Ian Romanick [Thu, 15 Sep 2016 18:11:12 +0000 (11:11 -0700)]
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>
8 years agoglsl: Add bit_xor builder
Ian Romanick [Wed, 7 Sep 2016 06:17:51 +0000 (23:17 -0700)]
glsl: Add bit_xor builder

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl/standalone: Enable GLSL 4.00 through 4.50
Ian Romanick [Thu, 15 Sep 2016 18:16:02 +0000 (11:16 -0700)]
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>
8 years agoglsl/standalone: Use API_OPENGL_CORE if the GLSL version is >= 1.40
Ian Romanick [Wed, 14 Sep 2016 20:51:19 +0000 (13:51 -0700)]
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>
8 years agoglsl: Update function parameter documentation for do_common_optimization
Ian Romanick [Wed, 14 Sep 2016 22:14:22 +0000 (15:14 -0700)]
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>
8 years agoconfigure.ac: add llvm inteljitevents component if enabled
Tim Rowley [Thu, 21 Jul 2016 23:34:37 +0000 (18:34 -0500)]
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>
8 years agoswr: replace gallium->swr format enum conversion
Tim Rowley [Tue, 20 Sep 2016 16:15:55 +0000 (11:15 -0500)]
swr: replace gallium->swr format enum conversion

Replace old string comparison with a mapping table.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agogallium/radeon/winsyses: reduce the number of pb_cache buckets
Nicolai Hähnle [Mon, 12 Sep 2016 14:27:41 +0000 (16:27 +0200)]
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>
8 years agowinsys/radeon: enable buffer allocation from slabs
Nicolai Hähnle [Mon, 12 Sep 2016 10:19:47 +0000 (12:19 +0200)]
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>
8 years agowinsys/radeon: add fine-grained fences for slab buffers
Nicolai Hähnle [Mon, 12 Sep 2016 09:46:12 +0000 (11:46 +0200)]
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>
8 years agowinsys/radeon: add slab buffer list
Nicolai Hähnle [Mon, 12 Sep 2016 08:52:35 +0000 (10:52 +0200)]
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>
8 years agowinsys/radeon: separate adding a buffer from updating its reloc data
Nicolai Hähnle [Fri, 9 Sep 2016 16:30:40 +0000 (18:30 +0200)]
winsys/radeon: separate adding a buffer from updating its reloc data

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agowinsys/radeon: add slab entry structures to radeon_bo
Nicolai Hähnle [Fri, 9 Sep 2016 13:21:03 +0000 (15:21 +0200)]
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>
8 years agowinsys/amdgpu: enable buffer allocation from slabs
Nicolai Hähnle [Wed, 7 Sep 2016 08:50:59 +0000 (10:50 +0200)]
winsys/amdgpu: enable buffer allocation from slabs

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agowinsys/amdgpu: add fence and buffer list logic for slab allocated buffers
Nicolai Hähnle [Thu, 8 Sep 2016 08:05:55 +0000 (10:05 +0200)]
winsys/amdgpu: add fence and buffer list logic for slab allocated buffers

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agowinsys/amdgpu: add slab entry structures to amdgpu_winsys_bo
Nicolai Hähnle [Wed, 7 Sep 2016 08:37:42 +0000 (10:37 +0200)]
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>
8 years agowinsys/amdgpu: do not synchronize unsynchronized buffers
Nicolai Hähnle [Wed, 7 Sep 2016 09:01:17 +0000 (11:01 +0200)]
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>
8 years agogallium/radeon: add RADEON_FLAG_HANDLE
Nicolai Hähnle [Fri, 9 Sep 2016 09:49:18 +0000 (11:49 +0200)]
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>
8 years agogallium/radeon: add RADEON_USAGE_SYNCHRONIZED
Nicolai Hähnle [Wed, 7 Sep 2016 08:57:56 +0000 (10:57 +0200)]
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>
8 years agogallium/pipebuffer: add pb_slab utility
Nicolai Hähnle [Tue, 6 Sep 2016 12:43:00 +0000 (14:43 +0200)]
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>
8 years agogallium/u_math: add util_logbase2_ceil
Nicolai Hähnle [Tue, 6 Sep 2016 12:41:51 +0000 (14:41 +0200)]
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>
8 years agoi915g: add dma-buf support to i915_drm_buffer_get_handle
Nicholas Bishop [Thu, 8 Sep 2016 19:55:03 +0000 (15:55 -0400)]
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>
8 years agost/dri: check pipe_screen->resource_get_handle() return value
Nicholas Bishop [Thu, 22 Sep 2016 15:04:13 +0000 (16:04 +0100)]
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>
8 years agogbm: return appropriate error when queryImage() fails
Nicholas Bishop [Thu, 8 Sep 2016 19:55:02 +0000 (15:55 -0400)]
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>
8 years agost/va Avoid VBR bitrate calculation overflow v2
Andy Furniss [Mon, 26 Sep 2016 09:44:35 +0000 (10:44 +0100)]
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
8 years agost/va: Fix vaSyncSurface with no outstanding operation
Mark Thompson [Mon, 26 Sep 2016 22:22:31 +0000 (23:22 +0100)]
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>
8 years agoglsl: remove remaining tabs in glsl_parser_extras.h
Timothy Arceri [Tue, 27 Sep 2016 02:00:51 +0000 (12:00 +1000)]
glsl: remove remaining tabs in glsl_parser_extras.h

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
8 years agost/mesa: enable ARB_ES3_2_compatibility when enough available
Ilia Mirkin [Mon, 29 Aug 2016 00:03:24 +0000 (20:03 -0400)]
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>
8 years agost/mesa: enable GL_ANDROID_extension_pack_es31a when available
Ilia Mirkin [Sun, 28 Aug 2016 19:55:44 +0000 (15:55 -0400)]
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>
8 years agoglsl: move some uniform linking code to new link_assign_uniform_storage()
Timothy Arceri [Sun, 25 Sep 2016 12:50:25 +0000 (22:50 +1000)]
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>
8 years agoglsl: move some uniform linking code to new link_setup_uniform_remap_tables()
Timothy Arceri [Sun, 25 Sep 2016 12:50:24 +0000 (22:50 +1000)]
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>
8 years agoi965: create populate key functions for tcs and tes
Timothy Arceri [Sat, 18 Jun 2016 06:18:17 +0000 (16:18 +1000)]
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>
8 years agoi965: make gs key generation helper available to shader cache
Timothy Arceri [Fri, 17 Jun 2016 12:02:43 +0000 (22:02 +1000)]
i965: make gs key generation helper available to shader cache

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: use reproducible name for lowered const arrays
Timothy Arceri [Thu, 14 Apr 2016 06:48:39 +0000 (16:48 +1000)]
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>
8 years agoi965: make vs and fs key generation helpers available to shader cache
Carl Worth [Thu, 14 Apr 2016 00:54:38 +0000 (10:54 +1000)]
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>
8 years agoglsl: Prepare standalone compiler to be able to use parameter lists
Carl Worth [Thu, 12 Mar 2015 00:31:11 +0000 (17:31 -0700)]
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>
8 years agonv50/ir: fix comments about instructions info
Samuel Pitoiset [Mon, 26 Sep 2016 19:50:26 +0000 (21:50 +0200)]
nv50/ir: fix comments about instructions info

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa/st: support lowering multi-planar YUV
Rob Clark [Wed, 31 Aug 2016 21:44:01 +0000 (17:44 -0400)]
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>
8 years agomesa/st: add nir pass to lower tex_src_plane
Rob Clark [Thu, 8 Sep 2016 18:57:25 +0000 (14:57 -0400)]
mesa/st: add nir pass to lower tex_src_plane

Signed-off-by: Rob Clark <robdclark@gmail.com>
8 years agomesa/st: add lowering pass for YUV samplers
Rob Clark [Fri, 2 Sep 2016 14:42:22 +0000 (10:42 -0400)]
mesa/st: add lowering pass for YUV samplers

Signed-off-by: Rob Clark <robdclark@gmail.com>
8 years agoaubinator: Fix the decoding of values that span two Dwords
Sirisha Gandikota [Tue, 20 Sep 2016 22:59:28 +0000 (15:59 -0700)]
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>
8 years agonvc0: allow to force compiling programs in debug build
Samuel Pitoiset [Wed, 14 Sep 2016 18:37:12 +0000 (20:37 +0200)]
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>
8 years agonv50/ir: drop unused NVISA_XXX_CHIPSET constants
Samuel Pitoiset [Wed, 14 Sep 2016 18:37:13 +0000 (20:37 +0200)]
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>
8 years agogallium/util: make use of strtol() in debug_get_num_option()
Samuel Pitoiset [Wed, 14 Sep 2016 18:37:11 +0000 (20:37 +0200)]
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>
8 years agor600g: Add support for PK2H/UP2H
Glenn Kennard [Sun, 3 Jan 2016 22:47:18 +0000 (23:47 +0100)]
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>
8 years agoi965: stop passing stage as a function parameter
Timothy Arceri [Sun, 25 Sep 2016 12:50:28 +0000 (22:50 +1000)]
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>
8 years agoaubinator: fix resource leak
Nayan Deshmukh [Sun, 25 Sep 2016 14:12:16 +0000 (19:42 +0530)]
aubinator: fix resource leak

CovID: 1373370

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoosmesa: Unbind the current context when given a null context and buffer.
Emilio Cobos Álvarez [Fri, 23 Sep 2016 00:24:00 +0000 (18:24 -0600)]
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>
8 years agost/mesa: small optimization in swizzle_swizzle()
Brian Paul [Thu, 22 Sep 2016 22:10:02 +0000 (16:10 -0600)]
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>
8 years agost/mesa: fix swizzle issue in st_create_sampler_view_from_stobj()
Brian Paul [Thu, 22 Sep 2016 22:03:40 +0000 (16:03 -0600)]
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>
8 years agosvga: set PIPE_BIND_DEPTH_STENCIL flag for new resources when possible
Brian Paul [Tue, 20 Sep 2016 23:22:42 +0000 (17:22 -0600)]
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>
8 years agosvga: don't special case caps for SVGA3D_R32_FLOAT
Brian Paul [Thu, 22 Sep 2016 15:15:20 +0000 (09:15 -0600)]
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>
8 years agosvga: use new adjust_z_layer() helper in svga_pipe_blit.c
Brian Paul [Fri, 23 Sep 2016 14:34:11 +0000 (08:34 -0600)]
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>
8 years agosvga: simplify/improve the format compatibility check for region copies
Brian Paul [Tue, 20 Sep 2016 23:36:32 +0000 (17:36 -0600)]
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>
8 years agosvga: add const qualifier on svga_translate_format()
Brian Paul [Tue, 20 Sep 2016 23:01:20 +0000 (17:01 -0600)]
svga: add const qualifier on svga_translate_format()

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agosvga: eliminate unneeded gotos in svga_validate_surface_view()
Brian Paul [Thu, 22 Sep 2016 18:26:55 +0000 (12:26 -0600)]
svga: eliminate unneeded gotos in svga_validate_surface_view()

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agosvga: disable srgb format related code from svga_blit()
Neha Bhende [Fri, 16 Sep 2016 21:53:01 +0000 (14:53 -0700)]
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 b662c70aeab6a92751514f30719c13a6de253b40.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agoRevert "glsl: move xfb BufferStride into gl_transform_feedback_info"
Timothy Arceri [Sat, 24 Sep 2016 00:17:26 +0000 (10:17 +1000)]
Revert "glsl: move xfb BufferStride into gl_transform_feedback_info"

This reverts commit f5a6aab4031bc4754756c1773411728ad9a73381.

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.

8 years agoglsl: Delete linker stuff relating to built-in functions.
Kenneth Graunke [Wed, 12 Nov 2014 06:32:27 +0000 (22:32 -0800)]
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>

8 years agoglsl: Delete ftransform support from builtin_functions.cpp.
Kenneth Graunke [Mon, 19 Sep 2016 06:00:33 +0000 (23:00 -0700)]
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>

8 years agoglsl: Immediately inline built-ins rather than generating calls.
Kenneth Graunke [Sat, 31 May 2014 06:52:22 +0000 (23:52 -0700)]
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>

8 years agoglsl: Check TCS barrier restrictions at ast_to_hir time, not link time.
Kenneth Graunke [Wed, 21 Sep 2016 09:03:10 +0000 (02:03 -0700)]
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>

8 years agoglsl: move xfb BufferStride into gl_transform_feedback_info
Timothy Arceri [Fri, 23 Sep 2016 03:05:20 +0000 (13:05 +1000)]
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>
8 years agoRevert "mapi: export all GLES 3.2 functions in libGLESv2.so"
Dylan Baker [Fri, 23 Sep 2016 19:10:08 +0000 (12:10 -0700)]
Revert "mapi: export all GLES 3.2 functions in libGLESv2.so"

This reverts commit e66a2b879b73bf48800fec7353dafe8fc693ecdb.

Which breaks the scons build in an interesting way, particularly when
BlendBarrier and PrimitiveBoundingBox are added to static_data.py's
functions list. This seems to be related to the fact that the unsuffixed
names are only in GLES3.2, but Desktop GL only has suffixed versions.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
8 years agoi965: Enable EGL_KHR_gl_texture_3D_image
Adam Jackson [Wed, 21 Sep 2016 13:13:36 +0000 (09:13 -0400)]
i965: Enable EGL_KHR_gl_texture_3D_image

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
8 years agoi915: Enable EGL_KHR_gl_texture_3D_image
Adam Jackson [Wed, 21 Sep 2016 13:11:26 +0000 (09:11 -0400)]
i915: Enable EGL_KHR_gl_texture_3D_image

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
8 years agoanv: Check for VK_WHOLE_SIZE in anv_CmdFillBuffer
Nicolas Koch [Tue, 20 Sep 2016 15:37:36 +0000 (17:37 +0200)]
anv: Check for VK_WHOLE_SIZE in anv_CmdFillBuffer

From the Vulkan spec:

   Size is the number of bytes to fill, and must be either a multiple of 4,
   or VK_WHOLE_SIZE to fill the range from offset to the end of the buffer.
   If VK_WHOLE_SIZE is used and the remaining size of the buffer is not a
   multiple of 4, then the nearest smaller multiple is used.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv: get rid of duplicated values from gen_device_info
Lionel Landwerlin [Thu, 22 Sep 2016 22:04:25 +0000 (01:04 +0300)]
anv: get rid of duplicated values from gen_device_info

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: get rid of duplicated values from gen_device_info
Lionel Landwerlin [Thu, 22 Sep 2016 21:41:23 +0000 (00:41 +0300)]
i965: get rid of duplicated values from gen_device_info

Now that we have gen_device_info mutable, we can update its values and drop
all copies we had in brw_context.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agointel/i965: make gen_device_info mutable
Lionel Landwerlin [Thu, 22 Sep 2016 11:58:11 +0000 (14:58 +0300)]
intel/i965: make gen_device_info mutable

Make gen_device_info a mutable structure so we can update the fields that
can be refined by querying the kernel (like subslices and EU numbers).

This patch does not make any functional change, it just makes
gen_get_device_info() fill a structure rather than returning a const
pointer.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agogallium: remove unused PIPE_CC_GCC_VERSION
Timothy Arceri [Wed, 7 Sep 2016 04:28:19 +0000 (14:28 +1000)]
gallium: remove unused PIPE_CC_GCC_VERSION

Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
8 years agoutil: remove Sun C Compiler support
Timothy Arceri [Wed, 7 Sep 2016 04:28:20 +0000 (14:28 +1000)]
util: remove Sun C Compiler support

Support for this compiler was dropped in 51564f04b77e6

Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
8 years agost/mesa: turn on OES_viewport_array when dependencies are met
Ilia Mirkin [Fri, 16 Sep 2016 19:43:31 +0000 (15:43 -0400)]
st/mesa: turn on OES_viewport_array when dependencies are met

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa: add implementations for new float depth functions
Ilia Mirkin [Fri, 16 Sep 2016 17:52:18 +0000 (13:52 -0400)]
mesa: add implementations for new float depth functions

This just up-converts them to doubles. Not great, but this is what all
the other variants also do.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agomesa: move ARB_viewport_array params to a GLES 3.1-accessible section
Ilia Mirkin [Fri, 16 Sep 2016 17:43:30 +0000 (13:43 -0400)]
mesa: move ARB_viewport_array params to a GLES 3.1-accessible section

This is needed for GL_OES_viewport_array.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agomesa: add GL_OES_viewport_array to the extension string
Ilia Mirkin [Fri, 16 Sep 2016 17:53:03 +0000 (13:53 -0400)]
mesa: add GL_OES_viewport_array to the extension string

The expectation is that drivers will set this based on
OES_geometry_shader and ARB_viewport_array support. This is a separate
enable on the same reasoning as for OES_texture_cube_map_array.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agoglsl: add OES_viewport_array enables and use them to expose gl_ViewportIndex
Ilia Mirkin [Fri, 16 Sep 2016 17:59:27 +0000 (13:59 -0400)]
glsl: add OES_viewport_array enables and use them to expose gl_ViewportIndex

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agomesa: add new entrypoints for GL_OES_viewport_array
Ilia Mirkin [Fri, 16 Sep 2016 17:38:36 +0000 (13:38 -0400)]
mesa: add new entrypoints for GL_OES_viewport_array

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agomapi: export all GLES 3.2 functions in libGLESv2.so
Dylan Baker [Thu, 22 Sep 2016 18:30:42 +0000 (11:30 -0700)]
mapi: export all GLES 3.2 functions in libGLESv2.so

See commit 5921f372c89a68fac6ddefc009442721d9df4db2 for the rational of
this commit.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agomapi: sort static_data.py functions
Dylan Baker [Thu, 22 Sep 2016 18:38:28 +0000 (11:38 -0700)]
mapi: sort static_data.py functions

Sorted by vim's builtin "sort i" (keeping the sorting case insensitive)

v2:
 - uses case insensitive sorting (Ken)

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agomapi: retab static_data.py to be consistent
Dylan Baker [Thu, 22 Sep 2016 17:58:45 +0000 (10:58 -0700)]
mapi: retab static_data.py to be consistent

This file currently uses a mixture of 3 and 4 space indent. I have
changed it all to 4 space indent, matching the settings in
$ROOT/.editorconfig.

This was generated with sed:
sed -i -e 's@^   "@    "@g'

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agospirv: fix AtomicLoad/Store on images
Lionel Landwerlin [Mon, 19 Sep 2016 16:14:18 +0000 (17:14 +0100)]
spirv: fix AtomicLoad/Store on images

OpAtomicLoad/Store should have pointer to images just like the rest of the
atomic operators. These couple of lines were poorly copied from the
ssbo/shared_vars cases (the only ones currently tests by the CTS).

Fixes 2afb950161f8 ("spirv/nir: Add support for OpAtomicLoad/Store")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir: Allow opt_peephole_sel to be more aggressive in flattening IFs.
Eric Anholt [Wed, 7 Sep 2016 02:45:51 +0000 (19:45 -0700)]
nir: Allow opt_peephole_sel to be more aggressive in flattening IFs.

VC4 was running into a major performance regression from enabling control
flow in the glmark2 conditionals test, because of short if statements
containing an ffract.

This pass seems like it was was trying to ensure that we only flattened
IFs that should be entirely a win by guaranteeing that there would be
fewer bcsels than there were MOVs otherwise.  However, if the number of
ALU ops is small, we can avoid the overhead of branching (which itself
costs cycles) and still get a win, even if it means moving real
instructions out of the THEN/ELSE blocks.

For now, just turn on aggressive flattening on vc4.  i965 will need some
tuning to avoid regressions.  It does looks like this may be useful to
replace freedreno code.

Improves glmark2 -b conditionals:fragment-steps=5:vertex-steps=0 from 47
fps to 95 fps on vc4.

vc4 shader-db:
total instructions in shared programs: 101282 -> 99543 (-1.72%)
instructions in affected programs:     17365 -> 15626 (-10.01%)
total uniforms in shared programs: 31295 -> 31172 (-0.39%)
uniforms in affected programs:     3580 -> 3457 (-3.44%)
total estimated cycles in shared programs: 225182 -> 223746 (-0.64%)
estimated cycles in affected programs:     26085 -> 24649 (-5.51%)

v2: Update shader-db output.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
8 years agodocs: Mark ES 3.2 "all done" for i965/gen9+.
Kenneth Graunke [Wed, 21 Sep 2016 18:51:43 +0000 (11:51 -0700)]
docs: Mark ES 3.2 "all done" for i965/gen9+.

8 years agodocs: Add ES 3.2 to release notes.
Kenneth Graunke [Wed, 21 Sep 2016 18:49:24 +0000 (11:49 -0700)]
docs: Add ES 3.2 to release notes.

8 years agogallium/util: add comment on util_is_format_compatible()
Brian Paul [Tue, 20 Sep 2016 22:05:48 +0000 (16:05 -0600)]
gallium/util: add comment on util_is_format_compatible()

From reading the code, it's not obvious what is src/dest compatible.
The list of a->b copy-compatible formats comes from Jose's original
check-in message, with some format name updates.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agosvga: minor simplification in svga_validate_surface_view()
Brian Paul [Fri, 16 Sep 2016 21:22:51 +0000 (15:22 -0600)]
svga: minor simplification in svga_validate_surface_view()

Get rid of unneeded local var.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agosvga: remove disable_shader debug variable
Brian Paul [Mon, 19 Sep 2016 22:34:17 +0000 (16:34 -0600)]
svga: remove disable_shader debug variable

Never used, AFAIK.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agoi965: Enable ES 3.2 on Skylake.
Kenneth Graunke [Wed, 21 Sep 2016 03:33:54 +0000 (20:33 -0700)]
i965: Enable ES 3.2 on Skylake.

It's already advertised because the version.c extension checks are
fulfilled, but we didn't actually claim support, so trying to create
a ES 3.2 context would fail.

It's all done, and the CTS results look good, so let's turn it on.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agonir/spirv/glsl450: Add support for the InterpolateAt opcodes
Jason Ekstrand [Wed, 14 Sep 2016 04:10:13 +0000 (21:10 -0700)]
nir/spirv/glsl450: Add support for the InterpolateAt opcodes

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agonir/spirv: Claim support for SampleRateShading
Jason Ekstrand [Wed, 14 Sep 2016 04:09:28 +0000 (21:09 -0700)]
nir/spirv: Claim support for SampleRateShading

We already support all of the decorations that require this capability.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agonir/spirv: Bring back the spirv2nir helper binary
Jason Ekstrand [Fri, 16 Sep 2016 02:47:49 +0000 (19:47 -0700)]
nir/spirv: Bring back the spirv2nir helper binary

This was something that I wrote in the early days of the spirv_to_nir code
but deleted once we had a real driver.  However, in the absence of a
shader_runner equivalent, it's extremely useful for debugging the
spirv_to_nir code so let's bring it back.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: implement querying __DRI_IMAGE_ATTRIB_OFFSET.
Chuanbo Weng [Tue, 13 Sep 2016 17:07:18 +0000 (01:07 +0800)]
i965: implement querying __DRI_IMAGE_ATTRIB_OFFSET.

Implement querying this attribute in intelImageExtension and bump
version of intelImageExtension.

Signed-off-by: Chuanbo Weng <chuanbo.weng@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoegl: return corresponding offset of EGLImage instead of 0.
Chuanbo Weng [Tue, 13 Sep 2016 17:07:10 +0000 (01:07 +0800)]
egl: return corresponding offset of EGLImage instead of 0.

The offset should not always be 0. For example, if EGLImage is
created from a 2D texture with EGL_GL_TEXTURE_LEVEL=1, then the
offset should be the actual start of miplevel 1 in bo.

v2: Add version check of __DRIimageExtension implementation
(Suggested by Axel Davy).

v3: Don't add version check of __DRIimageExtension implementation.
Set the offset only when queryImage() succeeds. (Suggested by Emil
Velikov)

Signed-off-by: Chuanbo Weng <chuanbo.weng@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
[Emil Velikov: coding style fixes]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>