mesa.git
8 years agogallium/swr: Resource management
Bruce Cherniak [Thu, 10 Mar 2016 01:30:00 +0000 (19:30 -0600)]
gallium/swr: Resource management

Better tracking of resource state and synchronization.
A follow on commit will clean up resource functions into a new
swr_resource.cpp file.

Reviewed-By: George Kyriazis <george.kyriazis@intel.com>
8 years agoconfigure.ac: require libdrm 2.4.66 for drmGetDevice
Marek Olšák [Mon, 14 Mar 2016 15:41:54 +0000 (16:41 +0100)]
configure.ac: require libdrm 2.4.66 for drmGetDevice

since 737b6ed13e8f813987b5566004f0f45e9c55f1e8
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c no longer compiles:
error: unknown type name ‘drmDevicePtr’

8 years agoi965: Remove useless IR self-destruct backend_shader method.
Francisco Jerez [Wed, 9 Mar 2016 01:23:37 +0000 (17:23 -0800)]
i965: Remove useless IR self-destruct backend_shader method.

From the point it's constructed the CFG contains the only existing
copy of the program IR, and it never becomes invalid.  Calling
backend_shader::invalidate_cfg would have destroyed the program
structure irrecoverably -- We weren't calling it at all for a good
reason.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agonv50,nvc0: Set only NEW_CP_GLOBALS upon binding
Pierre Moreau [Sun, 13 Mar 2016 21:11:30 +0000 (22:11 +0100)]
nv50,nvc0: Set only NEW_CP_GLOBALS upon binding

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agofreedreno/ir3: lower extract_byte/word
Rob Clark [Sun, 13 Mar 2016 18:03:04 +0000 (14:03 -0400)]
freedreno/ir3: lower extract_byte/word

The following commits broke things by starting to feed us unhandled
extract_u16/extract_u8 opcodes:

commit 905ff861982450831a56d112036f68a751337441
Author:     Matt Turner <mattst88@gmail.com>
AuthorDate: Wed Feb 3 14:28:31 2016 -0800
Commit:     Matt Turner <mattst88@gmail.com>
CommitDate: Fri Mar 4 11:52:34 2016 -0800

    nir: Recognize open-coded extract_u16.

commit 76289fbfa84a06ef4db8ad44ea0eb88ad0be8d5c
Author:     Matt Turner <mattst88@gmail.com>
AuthorDate: Thu Jan 21 09:09:48 2016 -0800
Commit:     Matt Turner <mattst88@gmail.com>
CommitDate: Fri Mar 4 11:52:34 2016 -0800

    nir: Recognize open-coded extract_u8.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agonv50,nvc0: handle SQRT lowering inside the driver
Ilia Mirkin [Sun, 13 Mar 2016 02:26:21 +0000 (21:26 -0500)]
nv50,nvc0: handle SQRT lowering inside the driver

First off, st/mesa lowers DSQRT incorrectly (it uses CMP to attempt to
find out whether the input is less than 0). Secondly the current
approach (x * rsq(x)) behaves poorly for x = inf - a NaN is produced
instead of inf.

Instead we switch to the less accurate rcp(rsq(x)) method - this behaves
nicely for all valid inputs. We still don't do this for DSQRT since the
RSQ/RCP ops are *really* inaccurate, and don't even have Newton-Raphson
steps right now. Eventually we should have a separate library function
for DSQRT that does it more precisely (and perhaps move this lowering to
the post-opt phase).

This fixes a number of dEQP precision tests that were expecting better
behavior for infinite inputs.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agonv50/ir: avoid folding mul + add if the mul has a dnz
Ilia Mirkin [Sun, 13 Mar 2016 01:53:34 +0000 (20:53 -0500)]
nv50/ir: avoid folding mul + add if the mul has a dnz

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agonvc0: fix blit triangle size to fully cover FB's > 8192x8192
Ilia Mirkin [Sat, 12 Mar 2016 02:26:31 +0000 (21:26 -0500)]
nvc0: fix blit triangle size to fully cover FB's > 8192x8192

The idea is that a single triangle will cover the whole area being
drawn, allowing the blit shader to do its work. However the max fb size
is 16384x16384, which means that the triangle we draw needs to be twice
that in order to cover the whole area fully. Increase the size of the
triangle to 32768x32768.

This fixes a number of dEQP tests that were failing because a blit was
involved which would miss some of the resulting texture.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
8 years agofreedreno: OUT_RELOC vs OUT_RELOCW fixes
Rob Clark [Wed, 9 Mar 2016 09:07:51 +0000 (04:07 -0500)]
freedreno: OUT_RELOC vs OUT_RELOCW fixes

Make sure we use OUT_RELOCW() in cases where the buffer is written to.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/a4xx: hw binning
Rob Clark [Sat, 5 Mar 2016 21:53:11 +0000 (16:53 -0500)]
freedreno/a4xx: hw binning

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/a4xx: use generated headers for draw initiator
Rob Clark [Sat, 5 Mar 2016 21:50:09 +0000 (16:50 -0500)]
freedreno/a4xx: use generated headers for draw initiator

No need to open-code this.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/a4xx: remove RB_RENDER_CONTROL patching
Rob Clark [Sat, 5 Mar 2016 21:47:26 +0000 (16:47 -0500)]
freedreno/a4xx: remove RB_RENDER_CONTROL patching

Bitfields where shuffled around for the better on a4xx, so we don't need
any patching on this one.  It appears to be something we set entirely in
the gmem code so no conflict between tiling and render state like we had
in a3xx.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno: update generated headers
Rob Clark [Sat, 5 Mar 2016 21:41:21 +0000 (16:41 -0500)]
freedreno: update generated headers

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/a3xx: move where we deal w/ binning FS
Rob Clark [Sun, 13 Mar 2016 16:15:28 +0000 (12:15 -0400)]
freedreno/a3xx: move where we deal w/ binning FS

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/a4xx: move where we deal w/ binning FS
Rob Clark [Mon, 7 Mar 2016 05:52:03 +0000 (00:52 -0500)]
freedreno/a4xx: move where we deal w/ binning FS

Move where we pick dummy FS for binning pass, so the whole driver sees
the same dummy/no-op FS stage.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/a3xx: constify the shader variants
Rob Clark [Sun, 13 Mar 2016 16:09:51 +0000 (12:09 -0400)]
freedreno/a3xx: constify the shader variants

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/a4xx: constify the shader variants
Rob Clark [Mon, 7 Mar 2016 05:50:21 +0000 (00:50 -0500)]
freedreno/a4xx: constify the shader variants

Most of the driver just needs read-only access, so constify..

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/a3xx: remove duplicate mark of end of binning cmds
Rob Clark [Sun, 6 Mar 2016 03:11:26 +0000 (22:11 -0500)]
freedreno/a3xx: remove duplicate mark of end of binning cmds

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agoradeonsi: avoid crash when a sampler state is bound for a buffer texture
Nicolai Hähnle [Fri, 11 Mar 2016 16:07:38 +0000 (11:07 -0500)]
radeonsi: avoid crash when a sampler state is bound for a buffer texture

Sampler states don't really make sense with buffer textures, but they
can be set anyway, so we need to be defensive here. This bug was lurking
for a while and was finally noticed due to PBO uploads setting sampler
states.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94284
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Laurent Carlier <lordheavym@gmail.com>
Tested-by: Shawn Starr <shawn.starr@rogers.com>
8 years agoi965: Use foreach_in_list_reverse_safe() macro.
Matt Turner [Mon, 15 Feb 2016 06:28:51 +0000 (22:28 -0800)]
i965: Use foreach_in_list_reverse_safe() macro.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agonir/clone: Add support for cloning a single function_impl
Jason Ekstrand [Sat, 13 Feb 2016 04:51:50 +0000 (20:51 -0800)]
nir/clone: Add support for cloning a single function_impl

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir/validate: Better function validation
Jason Ekstrand [Sun, 14 Feb 2016 02:08:30 +0000 (18:08 -0800)]
nir/validate: Better function validation

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir/print: Better function argument printing
Jason Ekstrand [Sat, 13 Feb 2016 04:41:19 +0000 (20:41 -0800)]
nir/print: Better function argument printing

Since we aren't going to put the function parameters or the return variable
in the list of locals, it won't get a proper declaration.  This changes
nir_print to print the type along with each parameter or return variable.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir/print: Factor variable name lookup into a helper
Jason Ekstrand [Sat, 26 Dec 2015 18:26:29 +0000 (10:26 -0800)]
nir/print: Factor variable name lookup into a helper

Otherwise, we have a problem when we go to print functions with arguments
because their names get added to the hash table during declaration which
happens after we print the prototype.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir: Create function parameters in function_impl_create
Jason Ekstrand [Mon, 15 Feb 2016 05:42:34 +0000 (21:42 -0800)]
nir: Create function parameters in function_impl_create

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir: Add a helper for creating a "bare" nir_function_impl
Jason Ekstrand [Wed, 28 Oct 2015 04:34:56 +0000 (21:34 -0700)]
nir: Add a helper for creating a "bare" nir_function_impl

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir: Add a new "param" variable mode for parameters and return variables
Jason Ekstrand [Fri, 12 Feb 2016 19:58:06 +0000 (11:58 -0800)]
nir: Add a new "param" variable mode for parameters and return variables

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir/glsl: Remove dead function parameter handling code
Jason Ekstrand [Fri, 12 Feb 2016 18:50:56 +0000 (10:50 -0800)]
nir/glsl: Remove dead function parameter handling code

NIR has never been used on IR where we haven't already done function
inlining so this code has been dead from the beginning.  Let's just get rid
of it for now.  We can always put it back in if we decide to use NIR for
function inlining at some point in the future.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agost/va: add HEVC main 10 profile
Boyuan Zhang [Tue, 22 Dec 2015 01:07:14 +0000 (20:07 -0500)]
st/va: add HEVC main 10 profile

Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoradeon/video: enable HEVC main 10 decode
Boyuan Zhang [Tue, 22 Dec 2015 01:06:26 +0000 (20:06 -0500)]
radeon/video: enable HEVC main 10 decode

Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoradeon/uvd: handle HEVC main 10 decode
Boyuan Zhang [Tue, 22 Dec 2015 01:05:45 +0000 (20:05 -0500)]
radeon/uvd: handle HEVC main 10 decode

Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoi965/chv: Display proper branding
Ben Widawsky [Mon, 8 Feb 2016 20:42:29 +0000 (12:42 -0800)]
i965/chv: Display proper branding

"Braswell" is a Cherryview based *thing*. It unfortunately requires extra
information to determine its marketing name. Unlike all previous products, and
hopefully all future ones, there is no unique 1:1 mapping of PCI device ID to
brand string.

I put up a fight about adding any complexity to our GL renderer string code for
a very long time. However, a wise man made a comment to me that I couldn't argue
with: if a user installs Windows on their hardware, the brand string should be
the same as what we display in Linux. The Windows driver apparently does this
check, so we should too.

Note that I did manage to find a good use for this info anyway in the compute
shader thread counts.

v2: memcpy instead of strncpy, and some minor changes (Matt)

Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com
8 years agoi965/chv: Update lower min for CS threads
Ben Widawsky [Tue, 9 Feb 2016 02:11:42 +0000 (18:11 -0800)]
i965/chv: Update lower min for CS threads

We have better information now, and 28 was not a valid thing to support. 6 EUs
per sublice with 7 threads per EU is the minimum supported config.

Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com
8 years agoi965/chv: Check that compute threads are above threshold
Ben Widawsky [Tue, 9 Feb 2016 02:00:41 +0000 (18:00 -0800)]
i965/chv: Check that compute threads are above threshold

The way we are organizing this code, the statically configured max_cs_threads
should always be the minimum value we actually support (ie. are aware of). As a
result, we can fall back to that if we get invalid numbers from the kernel (ie.
when the query succeeds, but the result is lower than expected).

I was originally planning to use an assert, but there is no reason to be so
mean.

Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com
8 years agoi965/chv: Use kernel provided info for max_cs_threads
Ben Widawsky [Tue, 9 Feb 2016 00:22:06 +0000 (16:22 -0800)]
i965/chv: Use kernel provided info for max_cs_threads

With the previous patches, the code can find out the actual number of available
compute threads. It is enabled only for Cherryview since that is the only
platform I know for a fact has shipped devices which can benefit from this.  It
seems like other platforms /might/ benefit from this because of fused
configurations which /might/ have shipped. Fallback code is still there.

v2: Some minor adjustments from Matt

Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com
8 years agoi965: Query and store GPU properties from kernel
Ben Widawsky [Mon, 8 Feb 2016 19:52:17 +0000 (11:52 -0800)]
i965: Query and store GPU properties from kernel

Certain products are not uniquely identifiable based on device id alone. The
kernel exports an interface to help deal with this. This patch merely introduces
the consumer of the interface and makes sure nothing breaks.

It is also possible to use these values for programming GPGPU mode, and I plan
to do that as well.

The interface was introduced in libdrm 2.4.60, which is already required, so it
should all be fine.

v2: Some minor changes recommended by Matt

Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agost/mesa: check that the image unit is valid in st_bind_images
Nicolai Hähnle [Thu, 10 Mar 2016 20:15:02 +0000 (15:15 -0500)]
st/mesa: check that the image unit is valid in st_bind_images

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Lazily re-set sampler views after disabling DCC
Bas Nieuwenhuizen [Thu, 10 Mar 2016 16:57:41 +0000 (17:57 +0100)]
radeonsi: Lazily re-set sampler views after disabling DCC

Clear DCC flags if necessary when binding a new sampler view.

v2: Do not reset DCC flags of bound sampler views.
v3: Check that we have a real texture (Nicolai)

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: remove ST_NEW_MESA flag (v2)
Marek Olšák [Wed, 9 Mar 2016 16:03:12 +0000 (17:03 +0100)]
st/mesa: remove ST_NEW_MESA flag (v2)

Only used indirectly when checking dirty.st != 0

v2: also update st_cb_compute.c

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agor600g: clear compressed_depthtex/colortex_mask when binding buffer texture
Nicolai Hähnle [Fri, 11 Mar 2016 02:19:56 +0000 (21:19 -0500)]
r600g: clear compressed_depthtex/colortex_mask when binding buffer texture

Found by inspection of the source based on a bisected bug report.

This bug has been in the code for a long time, but the more recent PBO upload
feature exposed it because it leads to more uses of buffer textures.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94388
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "11.0 11.1 11.2" <mesa-stable@lists.freedesktop.org>
8 years agost/mesa: add GL_ARB_shader_atomic_counter_ops support
Ilia Mirkin [Sat, 20 Feb 2016 04:18:33 +0000 (23:18 -0500)]
st/mesa: add GL_ARB_shader_atomic_counter_ops support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agomesa: add GL_ARB_shader_atomic_counter_ops support
Ilia Mirkin [Sat, 20 Feb 2016 04:07:38 +0000 (23:07 -0500)]
mesa: add GL_ARB_shader_atomic_counter_ops support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agonvc0: add support for TGSI FMA ops
Ilia Mirkin [Wed, 9 Mar 2016 06:04:58 +0000 (01:04 -0500)]
nvc0: add support for TGSI FMA ops

This will allow the nouveau backend to not try and split up ops that are
fused in GLSL.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agoradeonsi: update compressed_colortex_masks when a cmask is created or disabled
Nicolai Hähnle [Wed, 9 Mar 2016 20:42:31 +0000 (15:42 -0500)]
radeonsi: update compressed_colortex_masks when a cmask is created or disabled

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: move si_decompress_textures to si_blit.c
Nicolai Hähnle [Mon, 8 Feb 2016 03:27:17 +0000 (22:27 -0500)]
radeonsi: move si_decompress_textures to si_blit.c

Since it is all about calling into blitter functions, it makes more
sense here. This change also reduces the size of the interfaces between
.c files.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agor600g: update compressed_colortex_masks when a cmask is created or disabled
Nicolai Hähnle [Wed, 9 Mar 2016 22:48:31 +0000 (17:48 -0500)]
r600g: update compressed_colortex_masks when a cmask is created or disabled

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: notify all contexts when cmasks are enabled/disabled
Nicolai Hähnle [Mon, 8 Feb 2016 04:33:44 +0000 (23:33 -0500)]
gallium/radeon: notify all contexts when cmasks are enabled/disabled

There is an annoying corner case that I stumbled across while looking into
piglit's arb_shader_image_load_store/execution/load-from-cleared-image.shader_test
(which can be easily adapted to demonstrate the bug without the
ARB_shader_image_load_store extension)

When we bind a texture and then clear it using glClear (by attaching it
to the current framebuffer) for the first time, we allocate a separate
cmask for the texture to do fast clear, but the corresponding bit in
compressed_colortex_mask is not set. Subsequent rendering will use
incorrect data.

Conversely, when a currently bound texture with an existing cmask is
exported leading to that cmask being disabled, the compressed_colortex_mask
bit will remain set, leading to an assertion later on in debug builds.

Since iterating through all contexts and/or remembering where every
texture is bound would be costly, and cmask enable/disable should be
rare, we will maintain a global counter to signal contexts that they
must update their compressed_colortex_masks.

This patch introduces the global counter, and subsequent patches will
do the mask update.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoi965: Set a proper _BaseFormat for window system renderbuffers in ES.
Kenneth Graunke [Wed, 9 Mar 2016 04:00:06 +0000 (20:00 -0800)]
i965: Set a proper _BaseFormat for window system renderbuffers in ES.

intel_alloc_private_renderbuffer_storage did:

   rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat);

Unfortunately, internalFormat was usually an unsized format (such as
GL_DEPTH_COMPONENT).  In OpenGL ES, _mesa_base_fbo_format() refuses to
accept unsized formats, and returns 0 rather than a real base format.

This meant that we ended up with a completely bogus rb->_BaseFormat for
window system buffers on OpenGL ES.  All other renderbuffer allocation
functions in intel_fbo.c instead use the mesa_format, and do:

   rb->_BaseFormat = _mesa_get_format_base_format(...);

We can do likewise, using rb->Format.  This appears to work just fine.

dEQP-GLES3.functional.state_query.fbo.framebuffer_attachment_x_size_initial
failed, as it tried to perform a GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE query
on the window system depth buffer.  That query relies on a proper
rb->_BaseFormat being set, so it broke because rb->_BaseFormat was 0 due
to the above bug.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94458
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoglcpp: Fix locations when encounting "#<NEWLINE>".
Kenneth Graunke [Wed, 9 Mar 2016 03:03:11 +0000 (19:03 -0800)]
glcpp: Fix locations when encounting "#<NEWLINE>".

We were failing to reset our location tracking when encountering a
NEWLINE in the <HASH> state.  Rip the code from the <*>{NEWLINE} rule,
which handles this properly.

Also, update 146-version-first-hash.c to have proper expectations.
When I introduced the test, I didn't verify that the line/column
numbers were correct, and it turns out they varied based on the type
of newline ending.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94447
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agogallium/swr: remove use of BYTE from swr driver
Tim Rowley [Tue, 8 Mar 2016 17:22:54 +0000 (11:22 -0600)]
gallium/swr: remove use of BYTE from swr driver

Remove use of a win32-style type leaked from the swr rasterizer.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agonvc0: expose SM35 perf counters to AMD_performance_monitor
Samuel Pitoiset [Wed, 9 Mar 2016 22:58:09 +0000 (23:58 +0100)]
nvc0: expose SM35 perf counters to AMD_performance_monitor

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: add driver metrics for SM35 (GK110)
Samuel Pitoiset [Wed, 9 Mar 2016 22:59:05 +0000 (23:59 +0100)]
nvc0: add driver metrics for SM35 (GK110)

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: add MP performance counters for SM35 (GK110)
Samuel Pitoiset [Wed, 9 Mar 2016 22:05:35 +0000 (23:05 +0100)]
nvc0: add MP performance counters for SM35 (GK110)

Because compute support is not enabled by default for these chipsets,
NVF0_COMPUTE=1 needs to be used, along with GALLIUM_HUD to enable
performance counters.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: explode config of Kepler hardware SM events
Samuel Pitoiset [Wed, 9 Mar 2016 21:22:45 +0000 (22:22 +0100)]
nvc0: explode config of Kepler hardware SM events

This is really verbose but most of the configuration will be reused
for SM35 (GK110).

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: rework the driver metrics infrastructure
Samuel Pitoiset [Wed, 9 Mar 2016 22:24:39 +0000 (23:24 +0100)]
nvc0: rework the driver metrics infrastructure

This follows the same design as MP perf counters.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: rework the MP counters infrastructure
Samuel Pitoiset [Wed, 9 Mar 2016 20:13:22 +0000 (21:13 +0100)]
nvc0: rework the MP counters infrastructure

This mainly improves how we define the different list of queries.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoegl: clean up typedef madness in the backend API
Marek Olšák [Thu, 3 Mar 2016 13:21:49 +0000 (14:21 +0100)]
egl: clean up typedef madness in the backend API

let's use the dd.h format

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoglsl: report correct number of allowed vertex inputs and fragment outputs
Iago Toral Quiroga [Wed, 9 Mar 2016 10:48:25 +0000 (11:48 +0100)]
glsl: report correct number of allowed vertex inputs and fragment outputs

Before we would always report 16 for both and we would only fail if either
one exceeded 16. Now we fail if the maximum for each is exceeded, even if
it is smaller than 16 and we report the correct maximum.

Also, expand the size of to_assign[] to 32. There is code at the top
of the function handling max_index up to 32, so this just makes the
code more consistent.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agonouveau: Fix clang reserved-user-defined-literal error.
Vinson Lee [Wed, 9 Mar 2016 08:53:02 +0000 (00:53 -0800)]
nouveau: Fix clang reserved-user-defined-literal error.

  CXX      codegen/nv50_ir.lo
In file included from codegen/nv50_ir.cpp:28:
./nouveau_debug.h:19:30: error: invalid suffix on literal; C++11 requires a space between literal and identifier
      [-Wreserved-user-defined-literal]
   fprintf(stderr, "%s:%d - "fmt, __FUNCTION__, __LINE__, ##args)
                             ^

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agomesa: Make glGetInteger64v convert float/doubles to 32-bit integers.
Kenneth Graunke [Wed, 9 Mar 2016 04:45:26 +0000 (20:45 -0800)]
mesa: Make glGetInteger64v convert float/doubles to 32-bit integers.

According to the GL 4.4 core specification, section 2.2.2 ("Data
Conversions For State Query Commands"):

"If a command returning integer data is called, such as GetIntegerv or
 GetInteger64v, a boolean value of TRUE or FALSE is interpreted as one
 or zero, respectively. A floating-point value is rounded to the nearest
 integer, unless the value is an RGBA color component, a DepthRange
 value, or a depth buffer clear value. In these cases, the query command
 converts the floating-point value to an integer according to the INT
 entry of table 18.2; a value not in [−1, 1] converts to an undefined
 value."

The INT entry of table 18.2 shows that b = 32, meaning the expectation
is to convert it to a 32-bit integer value.

Fixes:
dEQP-GLES3.functional.state_query.floats.blend_color_getinteger64
dEQP-GLES3.functional.state_query.floats.color_clear_value_getinteger64
dEQP-GLES3.functional.state_query.floats.depth_clear_value_getinteger64

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94456
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agogallium/radeon: use explicit drm_major, drm_minor check
Emil Velikov [Tue, 8 Mar 2016 10:55:19 +0000 (10:55 +0000)]
gallium/radeon: use explicit drm_major, drm_minor check

Just like everywhere else in the radeon codebase.

v2: Don't forget about drm_major == 3 (Alex)

Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoegl/x11: check the return value of xcb_dri2_get_buffers_reply()
Emil Velikov [Sat, 5 Mar 2016 21:25:44 +0000 (21:25 +0000)]
egl/x11: check the return value of xcb_dri2_get_buffers_reply()

... before using it. The function can return NULL, which we should check
prior to refererencing it in the next function(s).

Cc: Fabian Vogt <fvogt@suse.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93667
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
8 years agogallium: do not wrap header inclusion in
Emil Velikov [Wed, 25 Nov 2015 20:43:03 +0000 (20:43 +0000)]
gallium: do not wrap header inclusion in

Add one missing extern C guard within include/pipe/p_video_enums.h, and
remove the wrapping throughout gallium.

On Haiku one could even use the gallium debug_printf() although
that's another topic.

v2: Leave dbghelp.h as is (Jose)

Cc: Jose Fonseca <jfonseca@vmware.com>
Cc: Brian Paul <brianp@vmware.com>
Cc: Alexander von Gluck IV <kallisti5@unixzen.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agoopencl: fix .gitignore for .install-gallium-links
Dieter Nützel [Sun, 6 Mar 2016 19:37:57 +0000 (20:37 +0100)]
opencl: fix .gitignore for .install-gallium-links

Fixes: 0b6157e9713 "install-gallium-links: port changes from install-lib-links"
v2: move this to the top level .gitignore and added Fixes:
    like Emil Velikov <emil.l.velikov@gmail.com> suggested

Signed-off-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoegl: remove remnants of MESA_drm_display
Emil Velikov [Wed, 10 Feb 2016 12:21:31 +0000 (12:21 +0000)]
egl: remove remnants of MESA_drm_display

Last set in st/egl, unused in mesa-demos and superseded by
EGL_KHR_platform_gbm.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agoegl: remove final pieces of KHR_vg_parent_image
Emil Velikov [Wed, 10 Feb 2016 12:21:30 +0000 (12:21 +0000)]
egl: remove final pieces of KHR_vg_parent_image

Similar to previous commit - unused/unset for a long time.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agoglapi: remove the final function offset tags
Emil Velikov [Tue, 24 Nov 2015 22:16:54 +0000 (22:16 +0000)]
glapi: remove the final function offset tags

A commit earlier this year reworked out python scripts to use a separate
file for these. Followed by removing support from the parser, and
removing all of the offset tags.

Seems like we either missed a few, or people added them by mistake.
Either way let's nuke the ones that are still around.

Cc: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agowinsys/amdgpu/addrlib: do not wrap header inclusion in extern "C"
Emil Velikov [Tue, 24 Nov 2015 16:29:28 +0000 (16:29 +0000)]
winsys/amdgpu/addrlib: do not wrap header inclusion in extern "C"

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agomesa/main: do not wrap header inclusion in extern "C"
Emil Velikov [Tue, 24 Nov 2015 16:29:26 +0000 (16:29 +0000)]
mesa/main: do not wrap header inclusion in extern "C"

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoi915: limit extern "C" hack only for libdrm headers
Emil Velikov [Tue, 24 Nov 2015 16:29:23 +0000 (16:29 +0000)]
i915: limit extern "C" hack only for libdrm headers

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoxmesa: do not wrap header inclusion in extern "C"
Emil Velikov [Tue, 24 Nov 2015 16:29:22 +0000 (16:29 +0000)]
xmesa: do not wrap header inclusion in extern "C"

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoutil/sha: do not wrap header inclusion in extern "C"
Emil Velikov [Tue, 24 Nov 2015 16:29:21 +0000 (16:29 +0000)]
util/sha: do not wrap header inclusion in extern "C"

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoegl/wayland: do not wrap header inclusion in extern "C"
Emil Velikov [Tue, 24 Nov 2015 16:29:19 +0000 (16:29 +0000)]
egl/wayland: do not wrap header inclusion in extern "C"

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agogbm: do not wrap header inclusion in extern "C"
Emil Velikov [Tue, 24 Nov 2015 16:29:18 +0000 (16:29 +0000)]
gbm: do not wrap header inclusion in extern "C"

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agost/mesa: shader image atoms must be before framebuffer update
Nicolai Hähnle [Tue, 16 Feb 2016 03:49:58 +0000 (22:49 -0500)]
st/mesa: shader image atoms must be before framebuffer update

The reason is that the shader image atoms call st_finalize_texture, which
may set ST_NEW_FRAMEBUFFER.

This fixes an assertion triggered by a subtest of piglit's
arb_shader_image_load_store-invalid.

v2: add comment explaining order constraints (suggested by Ilia)

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallivm: special case TGSI_OPCODE_STORE
Nicolai Hähnle [Tue, 9 Feb 2016 18:02:34 +0000 (13:02 -0500)]
gallivm: special case TGSI_OPCODE_STORE

This instruction has the resource (buffer or image) as a destination to
represent the writemask for SSBO writes. However, this is obviously not
a "real" destination for the purpose of emitting LLVM IR.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agotgsi: set correct output mode for RESQ
Nicolai Hähnle [Sun, 7 Feb 2016 01:34:20 +0000 (20:34 -0500)]
tgsi: set correct output mode for RESQ

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium: add CAPs returning PCI device location
Marek Olšák [Mon, 29 Feb 2016 19:22:37 +0000 (20:22 +0100)]
gallium: add CAPs returning PCI device location

Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agowinsys/amdgpu: get PCI info
Marek Olšák [Mon, 22 Feb 2016 21:58:18 +0000 (22:58 +0100)]
winsys/amdgpu: get PCI info

This will be queried by the OpenCL stack using an interop call.

I have tested that the values match lspci.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: set amdgpu metadata before exporting a texture
Marek Olšák [Thu, 25 Feb 2016 21:32:26 +0000 (22:32 +0100)]
radeonsi: set amdgpu metadata before exporting a texture

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: extract the texture descriptor computation into its own function
Nicolai Hähnle [Sat, 6 Feb 2016 22:34:04 +0000 (17:34 -0500)]
radeonsi: extract the texture descriptor computation into its own function

This will allow this code to be re-used for shader images.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: extract the buffer descriptor computation into its own function
Nicolai Hähnle [Sat, 6 Feb 2016 22:08:12 +0000 (17:08 -0500)]
radeonsi: extract the buffer descriptor computation into its own function

This will allow it to be re-used for shader image descriptors.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: remove resource field from si_sampler_view
Nicolai Hähnle [Sat, 6 Feb 2016 21:21:52 +0000 (16:21 -0500)]
radeonsi: remove resource field from si_sampler_view

view->resource is redundant with view->base.texture, so get rid of it.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: accept pipe_resource in si_sampler_view_add_buffer
Marek Olšák [Fri, 26 Feb 2016 12:28:31 +0000 (13:28 +0100)]
radeonsi: accept pipe_resource in si_sampler_view_add_buffer

and rename .._buffers -> .._buffer

Based loosely on Nicolai's patch. This will make it easier to cherry-pick
Nicolai's patches from his image support branch.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: disable DCC on handle export if expecting write access
Marek Olšák [Wed, 24 Feb 2016 21:04:47 +0000 (22:04 +0100)]
radeonsi: disable DCC on handle export if expecting write access

This should be okay except that sampler views and images are not re-set.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: add DCC decompression (v2)
Bas Nieuwenhuizen [Tue, 20 Oct 2015 22:10:41 +0000 (00:10 +0200)]
radeonsi: add DCC decompression (v2)

This is currently not needed but will be necessary when we have
features that do not work with DCC enabled, such as image stores
and sharing non-scanout surfaces.

v2: Marek: rebase, remove decompression from si_flush_resource (not needed)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: allocate DCC in the same backing buffer as the texture
Marek Olšák [Sun, 21 Feb 2016 21:49:38 +0000 (22:49 +0100)]
radeonsi: allocate DCC in the same backing buffer as the texture

To allow sharing textures with DCC enabled.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: disable CMASK on handle export if sharing doesn't allow it (v2)
Marek Olšák [Wed, 24 Feb 2016 21:04:47 +0000 (22:04 +0100)]
gallium/radeon: disable CMASK on handle export if sharing doesn't allow it (v2)

v2: remove the list of all contexts

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: eliminate fast color clear before sharing
Marek Olšák [Tue, 1 Mar 2016 20:50:25 +0000 (21:50 +0100)]
gallium/radeon: eliminate fast color clear before sharing

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: don't use fast color clear if sharing doesn't allow it
Marek Olšák [Wed, 24 Feb 2016 20:36:19 +0000 (21:36 +0100)]
gallium/radeon: don't use fast color clear if sharing doesn't allow it

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: disallow handle export for MSAA & depth textures
Marek Olšák [Wed, 24 Feb 2016 19:17:50 +0000 (20:17 +0100)]
gallium/radeon: disallow handle export for MSAA & depth textures

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: remember that texture_from_handle was called and its flags
Marek Olšák [Wed, 24 Feb 2016 23:23:21 +0000 (00:23 +0100)]
gallium/radeon: remember that texture_from_handle was called and its flags

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: check that handle usage doesn't change for a resource
Marek Olšák [Wed, 24 Feb 2016 19:04:31 +0000 (20:04 +0100)]
gallium/radeon: check that handle usage doesn't change for a resource

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: disallow reallocation of shared buffers
Marek Olšák [Wed, 24 Feb 2016 22:45:33 +0000 (23:45 +0100)]
gallium/radeon: disallow reallocation of shared buffers

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: if we can't discard a whole resource, discard the range instead
Marek Olšák [Thu, 25 Feb 2016 22:42:59 +0000 (23:42 +0100)]
gallium/radeon: if we can't discard a whole resource, discard the range instead

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: buffer valid range tracking only works with unshared buffers
Marek Olšák [Wed, 24 Feb 2016 16:36:52 +0000 (17:36 +0100)]
gallium/radeon: buffer valid range tracking only works with unshared buffers

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: don't set texture metadata for buffers
Marek Olšák [Wed, 24 Feb 2016 16:33:28 +0000 (17:33 +0100)]
gallium/radeon: don't set texture metadata for buffers

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: set texture metadata only once
Marek Olšák [Wed, 24 Feb 2016 16:32:53 +0000 (17:32 +0100)]
gallium/radeon: set texture metadata only once

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: clean up r600_texture_get_handle
Marek Olšák [Wed, 24 Feb 2016 16:30:09 +0000 (17:30 +0100)]
gallium/radeon: clean up r600_texture_get_handle

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: move code initializing texture metadata to its own function
Marek Olšák [Wed, 24 Feb 2016 16:03:11 +0000 (17:03 +0100)]
gallium/radeon: move code initializing texture metadata to its own function

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>