platform/upstream/mesa.git
7 years agoi915: Remove unused fields intel_mipmap_tree::logical_(width|height|depth)0
Ian Romanick [Fri, 2 Jun 2017 23:57:45 +0000 (16:57 -0700)]
i915: Remove unused fields intel_mipmap_tree::logical_(width|height|depth)0

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
7 years agoi915: Remove unused field intel_mipmap_tree::array_spacing_lod0
Ian Romanick [Fri, 2 Jun 2017 23:56:19 +0000 (16:56 -0700)]
i915: Remove unused field intel_mipmap_tree::array_spacing_lod0

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
7 years agoi915: On Gen <= 3 there is no multisampling
Ian Romanick [Fri, 2 Jun 2017 23:42:58 +0000 (16:42 -0700)]
i915: On Gen <= 3 there is no multisampling

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
7 years agoi915: Trivial code reformatting
Ian Romanick [Fri, 2 Jun 2017 23:40:30 +0000 (16:40 -0700)]
i915: Trivial code reformatting

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
7 years agoi915,i965: Don't condition use of GLSL clear on the current API
Ian Romanick [Fri, 2 Jun 2017 23:33:35 +0000 (16:33 -0700)]
i915,i965: Don't condition use of GLSL clear on the current API

Meta always sets the API to API_OPENGL_COMPAT, so the current API
setting is irrelevant.

   text    data     bss     dec     hex filename
7154994  256860   37332 7449186  71aa62 32-bit i965_dri.so before
7154978  256860   37332 7449170  71aa52 32-bit i965_dri.so after
6788451  328056   50704 7167211  6d5ceb 64-bit i965_dri.so before
6788419  328056   50704 7167179  6d5ccb 64-bit i965_dri.so after

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
7 years agomesa: add KHR_no_error support for glCopyTex{ture}SubImage*D()
Timothy Arceri [Mon, 26 Jun 2017 02:38:24 +0000 (12:38 +1000)]
mesa: add KHR_no_error support for glCopyTex{ture}SubImage*D()

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa: add copy_texture_sub_image_no_error() helper
Timothy Arceri [Mon, 26 Jun 2017 02:38:23 +0000 (12:38 +1000)]
mesa: add copy_texture_sub_image_no_error() helper

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa: remove redundant NULL check
Timothy Arceri [Mon, 26 Jun 2017 02:38:22 +0000 (12:38 +1000)]
mesa: remove redundant NULL check

This can never be NULL in any of the entry paths.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa: create copy_texture_sub_image_err() helper
Timothy Arceri [Mon, 26 Jun 2017 02:38:21 +0000 (12:38 +1000)]
mesa: create copy_texture_sub_image_err() helper

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa: make _mesa_copy_texture_sub_image() static
Timothy Arceri [Mon, 26 Jun 2017 02:38:20 +0000 (12:38 +1000)]
mesa: make _mesa_copy_texture_sub_image() static

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa: add KHR_no_error support for gl{Compressed}TexImage*D()
Timothy Arceri [Mon, 26 Jun 2017 00:49:17 +0000 (10:49 +1000)]
mesa: add KHR_no_error support for gl{Compressed}TexImage*D()

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa: add no error support to teximage()
Timothy Arceri [Mon, 26 Jun 2017 00:49:16 +0000 (10:49 +1000)]
mesa: add no error support to teximage()

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa: create wrapper around teximage()
Timothy Arceri [Mon, 26 Jun 2017 00:49:15 +0000 (10:49 +1000)]
mesa: create wrapper around teximage()

This is used to inline KHR_no_error logic without inlining
the function into all its callers.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa: fix unused variable warning in release builds
Timothy Arceri [Sun, 25 Jun 2017 23:25:07 +0000 (09:25 +1000)]
mesa: fix unused variable warning in release builds

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agoradeonsi: don't flush and wait for CB after depth-only rendering
Marek Olšák [Sat, 24 Jun 2017 20:39:01 +0000 (22:39 +0200)]
radeonsi: don't flush and wait for CB after depth-only rendering

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoblorp: Use normalized coordinates on Gen6
Ian Romanick [Tue, 6 Jun 2017 00:34:38 +0000 (17:34 -0700)]
blorp: Use normalized coordinates on Gen6

Apparently, the sampler has some sort of precision issues for
non-normalized texture coordinates with linear filtering.  This caused
some small precision issues in scaled blits.  Work around this by using
normalized coordinates.  There is some extra work necessary because Gen6
uses TEX (instead of TXF) for some multisample resolve blits.

Fixes piglit.spec.arb_framebuffer_object.fbo-blit-stretch on SNB.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68365
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
7 years agomesa/glthread: don't include pthread.h
Marek Olšák [Mon, 26 Jun 2017 20:23:15 +0000 (22:23 +0200)]
mesa/glthread: don't include pthread.h

Not needed. This fixes the Windows build.

7 years agoanv/gpu_memcpy: Rename the gpu_memcpy function
Nanley Chery [Thu, 11 May 2017 16:37:33 +0000 (09:37 -0700)]
anv/gpu_memcpy: Rename the gpu_memcpy function

A GPU memcpy function could alternatively be implemented using MI_*
commands. Provide more detail into how this one operates in case another
memcpy function is created.

v2:
- Update the commit message.
v3:
- Use 'memcpy' instead of 'cpy' (Jason Ekstrand)
- Shorten 'streamout' to 'so'

Suggested-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> (v2)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv/blorp: Provide surface states for CCS resolves
Nanley Chery [Mon, 12 Jun 2017 17:12:41 +0000 (10:12 -0700)]
anv/blorp: Provide surface states for CCS resolves

In the future, we plan on using this method to resolve images whose
surface state fast-clear value is dynamically updated during command
buffer execution. Start using it now for testing and to reduce churn
later on.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv/blorp: Add a surface-state-based CCS resolve function
Nanley Chery [Sat, 11 Mar 2017 00:31:16 +0000 (16:31 -0800)]
anv/blorp: Add a surface-state-based CCS resolve function

This will be used in the next patch.

v2:
- Omit BLORP_BATCH_NO_EMIT_DEPTH_STENCIL (Jason Ekstrand)
- Update commit message.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoblorp/clear: Add a binding-table-based CCS resolve function
Nanley Chery [Tue, 7 Mar 2017 01:37:49 +0000 (17:37 -0800)]
blorp/clear: Add a binding-table-based CCS resolve function

v2:
- Do layered resolves.
(Jason Ekstrand):
- Replace "bt" suffix with "attachment".
- Rename helper function to prepare_ccs_resolve.
- Move blorp_params_init() into helper function.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv: Adjust params of color buffer transitioning functions
Nanley Chery [Mon, 12 Jun 2017 19:58:32 +0000 (12:58 -0700)]
anv: Adjust params of color buffer transitioning functions

Splitting out these fields will make the color buffer transitioning
function simpler when it gains more features.

v2: Remove unintended blank line (Iago Toral)

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv/blorp: Remove 3D subresource transition workaround
Nanley Chery [Mon, 12 Jun 2017 19:58:32 +0000 (12:58 -0700)]
anv/blorp: Remove 3D subresource transition workaround

For 3D image subresources undergoing a layout transition via
PipelineBarrier, we increase the number of fast-cleared layers to match
the intended behaviour of KHR_maintenance1. When such subresources
undergo layout transitions between subpasses, we don't do this to avoid
failing incorrect CTS tests. Instead, unify the behaviour in both
scenarios, and wait for the CTS tests to catch up. See CL 1111 for the
test fix and Vulkan issue #849 for more information.

On SKL+, this causes 3 test failures under:
dEQP-VK.pipeline.render_to_image.3d.*

v2: Add a reference to the Vulkan issue (Iago Toral).

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> (v1)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv/cmd_buffer: Adjust the image view reloc function
Nanley Chery [Sat, 11 Mar 2017 01:24:23 +0000 (17:24 -0800)]
anv/cmd_buffer: Adjust the image view reloc function

Make the function take in an image instead of an image view. This
enables us to record relocations for surfaces states created outside of
the anv_CreateImageView path.

v2 (Jason Ekstrand):
- Use image->offset instead of surf_offset in aux_offset calculation.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv/cmd_buffer: Adjust layout transition aspect checking
Nanley Chery [Mon, 12 Jun 2017 18:26:47 +0000 (11:26 -0700)]
anv/cmd_buffer: Adjust layout transition aspect checking

Reflect the fact that an image view or subresource range with the color
aspect cannot have any other aspect.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv: Add and use color auxiliary buffer helpers
Nanley Chery [Tue, 4 Apr 2017 16:56:16 +0000 (09:56 -0700)]
anv: Add and use color auxiliary buffer helpers

v2:
- Check for aux levels in layer helper (Jason Ekstrand)
- Don't assert aux is present, return 0 if it isn't.
- Use the helpers.
v3:
- Make the helpers aspect-agnostic (Jason Ekstrand)
- Drop anv_image_has_color_aux()

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> (v2)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agointel/isl: Only create a CCS buffer if the image supports rendering
Nanley Chery [Mon, 6 Mar 2017 22:27:44 +0000 (14:27 -0800)]
intel/isl: Only create a CCS buffer if the image supports rendering

v2: Omit the commit message.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agointel/isl: Limit CCS to one level and layer on gen7
Nanley Chery [Mon, 24 Apr 2017 17:20:27 +0000 (10:20 -0700)]
intel/isl: Limit CCS to one level and layer on gen7

v2 (Jason Ekstrand):
- Remove Vulkan-specific terminology from the commit title.
- Replace '== 7' with '<= 7' to hint that this is a new feature on BDW+.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> (v1)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agointel/blorp: Check for layer fast-clear restriction
Nanley Chery [Thu, 11 May 2017 17:51:25 +0000 (10:51 -0700)]
intel/blorp: Check for layer fast-clear restriction

v2: Update commit title (Jason Ekstrand)

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> (v1)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agointel/blorp: Assert levels and layers are in range
Nanley Chery [Thu, 11 May 2017 17:58:18 +0000 (10:58 -0700)]
intel/blorp: Assert levels and layers are in range

v2 (Jason Ekstrand):
- Update commit title.
- Check aux level and layer as well.
v3 (Jason Ekstrand):
- Move the non-aux layer check.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> (v1)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoetnaviv: only flush resource to self if no scanout buffer exists
Lucas Stach [Mon, 26 Jun 2017 10:25:08 +0000 (12:25 +0200)]
etnaviv: only flush resource to self if no scanout buffer exists

Currently a resource flush may trigger a self resolve, even if a scanout buffer
exists, but is up to date. If a scanout buffer exists we only ever want to
flush the resource to the scanout buffer. This fixes a performance regression.

Fixes: dda956340ce9 (etnaviv: resolve tile status when flushing resource)
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
7 years agoetnaviv: add support for snorm textures
Christian Gmeiner [Wed, 21 Jun 2017 20:36:48 +0000 (22:36 +0200)]
etnaviv: add support for snorm textures

Based on a patch from Wladimir J. van der Laan and untested due
to lack of hardware. Binary blob emits those formats if GPU supports
HALTI1 (faked with ibvivhook).

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
7 years agoetnaviv: add R8G8 texture support
Christian Gmeiner [Wed, 21 Jun 2017 20:36:47 +0000 (22:36 +0200)]
etnaviv: add R8G8 texture support

Passes texwrap GL_ARB_texture_rg piglit (with faked full texture rg support).

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
7 years agoetnaviv: add support for swizzled texture formats
Christian Gmeiner [Fri, 16 Jun 2017 15:02:29 +0000 (17:02 +0200)]
etnaviv: add support for swizzled texture formats

Passes all ext_texture_swizzle piglits.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-By: Wladimir J. van der Laan <laanwj@gmail.com>
7 years agoetnaviv: add support for extended texture formats
Christian Gmeiner [Wed, 21 Jun 2017 20:36:45 +0000 (22:36 +0200)]
etnaviv: add support for extended texture formats

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
7 years agoglapi: Fix -Wduplicate-decl-specifier due to double-const
Chad Versace [Thu, 22 Jun 2017 22:12:29 +0000 (15:12 -0700)]
glapi: Fix -Wduplicate-decl-specifier due to double-const

Fix all lines in src/mesa/main/marshal_generated.c that declare
double-const variables. Below is all such lines, with duplicates
removed:

   $ grep 'const const' marshal_generated.c | sort -u
   const const GLboolean * pointer = cmd->pointer;
   const const GLvoid * indices = cmd->indices;
   const const GLvoid * pointer = cmd->pointer;

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoanv: use Mesa's u_atomic.h header
Eric Engestrom [Mon, 26 Jun 2017 11:14:49 +0000 (12:14 +0100)]
anv: use Mesa's u_atomic.h header

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoradv: use Mesa's u_atomic.h header
Eric Engestrom [Mon, 26 Jun 2017 11:14:37 +0000 (12:14 +0100)]
radv: use Mesa's u_atomic.h header

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoswr: set an explicit clear_rect if scissor is not enabled.
Bruce Cherniak [Mon, 26 Jun 2017 15:26:26 +0000 (10:26 -0500)]
swr: set an explicit clear_rect if scissor is not enabled.

Fix regression of "no rendering" on simple apps like glxgears by
setting an explicit full surface clear_rect when scissor is not
enabled.

This regressed with commit 00173d91 "st/mesa: don't set 16
scissors and 16 viewports if they're unused" due to an assumption
that a default scissor rect is always set, which was the case prior
to this optimization.

Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr/rast: adjust std::string usage to fix build
Tim Rowley [Mon, 26 Jun 2017 13:57:38 +0000 (08:57 -0500)]
swr/rast: adjust std::string usage to fix build

Some combinations of c++ compilers and standard libraries had problems
with the string::replace code we were using previously.

This should fix the travis-ci system.

Tested-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agotravis: add missing libs: xdamage + xfixes
Eric Engestrom [Thu, 22 Jun 2017 18:14:20 +0000 (19:14 +0100)]
travis: add missing libs: xdamage + xfixes

> configure: error: Package requirements (x11 xext xdamage >= 1.1 xfixes
> x11-xcb xcb xcb-glx >= 1.8.1 xcb-dri2 >= 1.8) were not met:
> No package 'xdamage' found
> No package 'xfixes' found

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradeonsi: support indirect indexing in INTERP_* opcodes
Nicolai Hähnle [Fri, 16 Jun 2017 18:50:56 +0000 (20:50 +0200)]
radeonsi: support indirect indexing in INTERP_* opcodes

The hardware doesn't support it, so we just interpolate all array elements
and then use indirect indexing on the resulting vector.

Clearly, this is not very efficient. There is an argument to be had for
adding if/else, or perhaps even pulling the data out of LDS directly.
Both don't really seem worth the effort, considering that it seems nobody
actually uses this feature.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoegl_dri2: swrastGetDrawableInfo: set *x, *y [v2]
Ben Crocker [Thu, 22 Jun 2017 19:14:51 +0000 (15:14 -0400)]
egl_dri2: swrastGetDrawableInfo: set *x, *y [v2]

In swrastGetDrawableInfo, set *x and *y, not just *w and *h;
this fixes a crash later in drisw_update_tex_buffer when the
(formerly) uninitialized x and y values are used to construct
an address in a call to llvmpipe_transfer_map.

Fixes crash in Piglit test
"spec@egl 1.4@eglcreatepbuffersurface and then glclear"
(<piglit dir>/bin/egl-create-pbuffer-surface -auto)
that occurred intermittently, e.g. when the uninitialized x and y in
drisw_update_tex_buffer just happened to contain absurd non-zero values.

v2: Initialize in case if function succeeds or fails, just like *w/*h.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Ben Crocker <bcrocker@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl: fold _eglError() + return EGL_FALSE
Emil Velikov [Tue, 20 Jun 2017 14:40:28 +0000 (15:40 +0100)]
egl: fold _eglError() + return EGL_FALSE

The function _eglError() already explicitly returns EGL_FALSE,
explicitly to simplify the callers. Make use of it.

While EGL_FALSE is numerically identical to false, NULL, EGL_NO_FOO,
storage is not the same so we cannot use it for "everything".

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoegl: drop _eglInitImage() return type
Emil Velikov [Tue, 20 Jun 2017 14:22:39 +0000 (15:22 +0100)]
egl: drop _eglInitImage() return type

Function cannot fail and always returns true.

v2: Inline the one line function in the header

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoglsl: do not call link_xfb_stride_layout_qualifiers() for fragment shaders
Juan A. Suarez Romero [Thu, 22 Jun 2017 10:47:57 +0000 (12:47 +0200)]
glsl: do not call link_xfb_stride_layout_qualifiers() for fragment shaders

xfb only applies to the latest stage before the fragment shader, so
there is no need to invoke it in the fragment shader.

Fixes:
KHR-GL45.enhanced_layouts.xfb_stride_of_empty_list
KHR-GL45.enhanced_layouts.xfb_stride_of_empty_list_and_api

v2: do reset only if shaders provide an explicit stride

v3: do not call link_xfb_stride_layout_qualifiers() for fragment shaders
(Timothy)

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agor600g: fix crash when file in R600_TRACE doesn't exist
Constantine Charlamov [Sat, 24 Jun 2017 12:52:05 +0000 (15:52 +0300)]
r600g: fix crash when file in R600_TRACE doesn't exist

…and print error in such case. Which probably is not a rare event btw
because fopen doesn't expand ~ to $HOME.

Also get rid of unused "bool ret" variable.

Signed-off-by: Constantine Kharlamov <Hi-Angel@yandex.ru>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agor600g: take into account offset to system inputs at tgsi_interp_egcm()
Constantine Charlamov [Sat, 24 Jun 2017 14:06:48 +0000 (17:06 +0300)]
r600g: take into account offset to system inputs at tgsi_interp_egcm()

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=100785

v2: I was too much twiddling whether to initialize nsys_inputs at the beginning of shader initialization or for allocation of system values, and by the time I decided to go with the first one, I forgot to change it back.

Signed-off-by: Constantine Kharlamov <Hi-Angel@yandex.ru>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agor600g: get rid of trailing whitespace
Constantine Charlamov [Sat, 24 Jun 2017 12:52:03 +0000 (15:52 +0300)]
r600g: get rid of trailing whitespace

Signed-off-by: Constantine Kharlamov <Hi-Angel@yandex.ru>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agor600/asm: add support for other GDS operations.
Dave Airlie [Wed, 6 Apr 2016 23:36:26 +0000 (00:36 +0100)]
r600/asm: add support for other GDS operations.

This adds support for the GDS operations needed to do atomic
counters.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agor600: don't merge GDS into VTX
Dave Airlie [Thu, 7 Apr 2016 03:47:32 +0000 (04:47 +0100)]
r600: don't merge GDS into VTX

We don't want vtx/tex instructions ending up in GDS sections.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agor600: for memory instructions dump index gpr for read indirects also.
Dave Airlie [Thu, 31 Mar 2016 06:13:35 +0000 (16:13 +1000)]
r600: for memory instructions dump index gpr for read indirects also.

This just makes sure we can see the index gpr in the asm dumps.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agor600: add support for vertex fetches via texture cache
Dave Airlie [Thu, 31 Mar 2016 05:49:55 +0000 (15:49 +1000)]
r600: add support for vertex fetches via texture cache

On evergreen we can route vertex fetches via the texture cache,
and this is required for some images support. So add support
to the asm builder for it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agor600: route indirect address register correctly for vtx fetches.
Dave Airlie [Thu, 31 Mar 2016 05:46:30 +0000 (15:46 +1000)]
r600: route indirect address register correctly for vtx fetches.

This was found during writing the images code, we need to
make sure we route the correct index register.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/meta: don't need vertex info for resolve shader.
Dave Airlie [Wed, 14 Jun 2017 22:46:44 +0000 (23:46 +0100)]
radv/meta: don't need vertex info for resolve shader.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agodrirc: whitelist glthread for a few games
Marek Olšák [Wed, 21 Jun 2017 23:26:54 +0000 (01:26 +0200)]
drirc: whitelist glthread for a few games

Performance deltas:
    Alien Isolation: +17% (it varies depending on the location)
    Borderlands 2: +50% (it varies depending on the location)
    BioShock Infinite: +76% (benchmark)
    Civilization 6: +20% (benchmark)

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa/glthread: decrease the batch size for better perf scaling
Marek Olšák [Wed, 21 Jun 2017 20:32:20 +0000 (22:32 +0200)]
mesa/glthread: decrease the batch size for better perf scaling

This is the key to better performance.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agogallium/hud: add glthread counters
Marek Olšák [Wed, 21 Jun 2017 19:32:35 +0000 (21:32 +0200)]
gallium/hud: add glthread counters

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agogallium/hud: add API-thread-busy for monitoring the thread load
Marek Olšák [Wed, 21 Jun 2017 19:12:26 +0000 (21:12 +0200)]
gallium/hud: add API-thread-busy for monitoring the thread load

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agogallium/hud: add hud_pane::hud pointer
Marek Olšák [Wed, 21 Jun 2017 19:10:27 +0000 (21:10 +0200)]
gallium/hud: add hud_pane::hud pointer

for later use

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa/glthread: add glthread "perf" counters and pass them to gallium HUD
Marek Olšák [Wed, 21 Jun 2017 18:45:38 +0000 (20:45 +0200)]
mesa/glthread: add glthread "perf" counters and pass them to gallium HUD

for HUD integration in following commits. This valuable profiling data
will allow us to see on the HUD how well glthread is able to utilize
parallelism. This is better than benchmarking, because you can see
exactly what's happening and you don't have to be CPU-bound.

u_threaded_context has the same counters.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agogallium/hud: move struct hud_context to hud_private.h
Marek Olšák [Wed, 21 Jun 2017 18:34:30 +0000 (20:34 +0200)]
gallium/hud: move struct hud_context to hud_private.h

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agogallium/hud: rename API-thread-busy to main-thread-busy
Marek Olšák [Wed, 21 Jun 2017 17:54:45 +0000 (19:54 +0200)]
gallium/hud: rename API-thread-busy to main-thread-busy

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa/glthread: switch to u_queue and redesign the batch management
Marek Olšák [Wed, 21 Jun 2017 11:53:23 +0000 (13:53 +0200)]
mesa/glthread: switch to u_queue and redesign the batch management

This mirrors exactly how u_threaded_context works.
If you understand this, you also understand u_threaded_context.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agomesa/glthread: remove HAVE_PTHREAD guards
Marek Olšák [Wed, 21 Jun 2017 10:24:33 +0000 (12:24 +0200)]
mesa/glthread: remove HAVE_PTHREAD guards

we are switching to util_queue.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoutil: move pipe_thread_is_self from gallium to src/util
Marek Olšák [Wed, 21 Jun 2017 12:11:13 +0000 (14:11 +0200)]
util: move pipe_thread_is_self from gallium to src/util

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoradv: Remove unused args of radv_image_view_init.
Bas Nieuwenhuizen [Sun, 25 Jun 2017 20:25:47 +0000 (22:25 +0200)]
radv: Remove unused args of radv_image_view_init.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Use correct image layout for blit based copies.
Bas Nieuwenhuizen [Sat, 24 Jun 2017 18:23:44 +0000 (20:23 +0200)]
radv: Use correct image layout for blit based copies.

v2: Don't pass layout to image view usage mask.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Fixes: 0628580eff6 "radv: Specify semantics of HTILE layout helpers."

7 years agomesa/marshal: add custom marshalling for glNamedBuffer(Sub)Data
Grigori Goronzy [Sat, 24 Jun 2017 16:59:55 +0000 (18:59 +0200)]
mesa/marshal: add custom marshalling for glNamedBuffer(Sub)Data

These entry points are used by Alien Isolation and caused
synchronization with glthread. The async marshalling implementation
is similar to glBuffer(Sub)Data. However unlike Buffer(Sub)Data
we don't need to worry about EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD,
as this isn't applicable to these DSA variants.

Results in an approximately 6x drop in glthread synchronizations and a
~30% FPS jump in Alien Isolation (Medium preset, Athlon 860K, RX 480).

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoradv: handle primitive id input into fragment shader with no geom shader
Dave Airlie [Tue, 20 Jun 2017 03:21:04 +0000 (13:21 +1000)]
radv: handle primitive id input into fragment shader with no geom shader

Fixes:
dEQP-VK.pipeline.framebuffer_attachment.no_attachments
dEQP-VK.pipeline.framebuffer_attachment.no_attachments_ms

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: compile fragment shader first.
Dave Airlie [Tue, 20 Jun 2017 02:50:04 +0000 (12:50 +1000)]
radv: compile fragment shader first.

This reorders things as we need something from the fs for the vs key.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: set prim_id for geometry shaders
Dave Airlie [Tue, 20 Jun 2017 04:03:10 +0000 (14:03 +1000)]
radv: set prim_id for geometry shaders

Noticed in passing.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: set use_prim_id for tess shaders correctly.
Dave Airlie [Tue, 20 Jun 2017 03:59:33 +0000 (13:59 +1000)]
radv: set use_prim_id for tess shaders correctly.

Just noticed in passing.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agonv50/ir: Properly fold constants in SPLIT operation
Pierre Moreau [Mon, 12 Jun 2017 20:53:52 +0000 (22:53 +0200)]
nv50/ir: Properly fold constants in SPLIT operation

Fixes: b7d9677d ("nv50/ir: constant fold OP_SPLIT")
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agoradeonsi/gfx9: don't overallocate shader binaries
Marek Olšák [Tue, 20 Jun 2017 17:34:03 +0000 (19:34 +0200)]
radeonsi/gfx9: don't overallocate shader binaries

It's not needed. The hw doesn't fetch ahead over page boundaries.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/dri2: implement image offset query
Lucas Stach [Fri, 23 Jun 2017 15:36:37 +0000 (17:36 +0200)]
st/dri2: implement image offset query

This trivially adds support for the image offset query, which is needed
for the zwp_linux_dmabuf based EGL platform wayland implementation.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agomesa: only flush vertices when the viewport is different
Samuel Pitoiset [Thu, 22 Jun 2017 13:03:20 +0000 (15:03 +0200)]
mesa: only flush vertices when the viewport is different

This prevents glViewport() and friends to always flush and
trigger _NEW_VIEWPORT.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: remove useless comments in the viewport code path
Samuel Pitoiset [Thu, 22 Jun 2017 13:01:12 +0000 (15:01 +0200)]
mesa: remove useless comments in the viewport code path

No need to explain why calling a driver callback is needed.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agollvmpipe: initialize default fb correctly in setup
Roland Scheidegger [Fri, 23 Jun 2017 17:40:18 +0000 (19:40 +0200)]
llvmpipe: initialize default fb correctly in setup

If lp_setup_bind_framebuffer() is never called, then setup fb x1/y1 was not
correctly initialized. This can happen if there's never a fb set - both
cso and llvmpipe would consider setting this with no cbufs and no zsbuf a
redundant change and therefore it would never get set.
We rely on this setup fb rect being initialized correctly for the tri intersect
tests, throwing away tris which don't intersect. Not initializing it meant
we'd then say it intersected, and we'd try to bin that despite that we have
no actual tiles to bin it to, leading to assertion failures (pretty harmless
since tile 0/0 always exists nevertheless as tiles are statically allocated,
albeit that should change at some point).
(Note probably not an issue with gl state tracker)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
7 years agoi965/miptree: Rework aux enabling
Jason Ekstrand [Fri, 16 Jun 2017 05:58:49 +0000 (22:58 -0700)]
i965/miptree: Rework aux enabling

This commit replaces the complex and confusing set of disable flags with
two fairly straightforward fields which describe the intended auxiliary
surface usage and whether or not the miptree supports fast clears.
Right now, supports_fast_clear can be entirely derived from aux_usage
but that will not always be the case.

This commit makes functional changes.  One of these changes is that it
re-enables multisampled fast-clears which were accidentally disabled in
cec30a666930ddb8476a9452a89364a24979ff62 around a year ago.  Fixing this
improves the SynMark v7 DeferredAA test by around ~3% on some gen9
hardware.  This commit also gets us closer to enabling CCS_E for
window-system buffers which are Y-tiled.

Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Clamp clear colors to the representable range
Jason Ekstrand [Fri, 16 Jun 2017 07:13:45 +0000 (00:13 -0700)]
i965: Clamp clear colors to the representable range

Starting with Sky Lake, we can clear to arbitrary floats or integers.
Unfortunately, the hardware isn't particularly smart when it comes
sampling from that clear color.  If the clear color is out of range for
the surface format, it will happily return whatever we put in the
surface state packet unmodified.  In order to avoid returning bogus
values for surfaces with a limited range, we need to do some clamping.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoi965: Don't bother with HiZ in renderbuffer_move_to_temp
Jason Ekstrand [Fri, 16 Jun 2017 04:18:31 +0000 (21:18 -0700)]
i965: Don't bother with HiZ in renderbuffer_move_to_temp

This function is only used on gen4-5 which don't support HiZ.

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoi965/miptree: Rename the non_msrt_mcs functions to _ccs
Jason Ekstrand [Fri, 16 Jun 2017 04:02:20 +0000 (21:02 -0700)]
i965/miptree: Rename the non_msrt_mcs functions to _ccs

While we're here, we also make the two support checks static since there
are no users outside intel_mipmap_tree.c.

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoi965/miptree: Delete the layered rendering resolve
Jason Ekstrand [Fri, 16 Jun 2017 05:17:13 +0000 (22:17 -0700)]
i965/miptree: Delete the layered rendering resolve

We never fast-clear more than the base slice (LOD 0, layer 0) anyway, so
layered rendering without a resolve is always perfectly safe.  Should
this ever change in the future, we'll have to put some sort of resolve
back in but we can cross that bridge when we come to it.

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv/cnl: Don't write to Cache Mode Register 1 on gen10+
Anuj Phogat [Wed, 14 Jun 2017 00:01:16 +0000 (17:01 -0700)]
anv/cnl: Don't write to Cache Mode Register 1 on gen10+

For PartialResolveDisableInVC field recommendation is to
always set this to 0 and that's the default value of the bit.
So, we have nothing left to write to CACHE_MODE_1.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/cnl: Don't write to Cache Mode Register 1 on gen10+
Anuj Phogat [Tue, 13 Jun 2017 21:22:06 +0000 (14:22 -0700)]
i965/cnl: Don't write to Cache Mode Register 1 on gen10+

With below optimizations gone in gen10+ we have nothing left out to
write to CACHE_MODE_1:
Float Blend Optimization Enable: This bit have been removed in gen10+
Partial Resolve Disable in VC: Recommendation is to always set this
field to 0 in gen10+ and that's the default value of the bit.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoradeonsi: unreference vertex buffers when destroying the context
Marek Olšák [Wed, 21 Jun 2017 16:39:41 +0000 (18:39 +0200)]
radeonsi: unreference vertex buffers when destroying the context

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agodrirc: Add glsl_correct_derivatives_after_discard for The Witcher 2
Edmondo Tommasina [Wed, 21 Jun 2017 20:40:37 +0000 (22:40 +0200)]
drirc: Add glsl_correct_derivatives_after_discard for The Witcher 2

This fixes the long-standing problem with black transitions in The Wicher 2.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98238

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: implement the workaround for Rocket League - postponed TGSI kill
Marek Olšák [Tue, 20 Jun 2017 20:55:56 +0000 (22:55 +0200)]
radeonsi: implement the workaround for Rocket League - postponed TGSI kill

Do KILL at the end of shaders so as not to break WQM.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100070

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: pass create_screen flags to r600_common_screen_init
Marek Olšák [Tue, 20 Jun 2017 22:38:06 +0000 (00:38 +0200)]
gallium/radeon: pass create_screen flags to r600_common_screen_init

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/dri: add a drirc workaround for Rocket League
Marek Olšák [Tue, 20 Jun 2017 20:44:53 +0000 (22:44 +0200)]
st/dri: add a drirc workaround for Rocket League

This needs to be passed to gallium drivers.

No game fix is planned at this time.

The addition of glsl_correct_derivatives_after_discard is
generally a good thing for mesa compatibility with the broader GL
driver ecosystem.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100070

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/dri: get drirc options before creating pipe_screen
Marek Olšák [Tue, 20 Jun 2017 22:34:12 +0000 (00:34 +0200)]
st/dri: get drirc options before creating pipe_screen

dri_init_options_get_screen_flags will return the flags for create_screen().

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium: allow passing 'unsigned flags' to create_screen()
Marek Olšák [Tue, 20 Jun 2017 22:30:21 +0000 (00:30 +0200)]
gallium: allow passing 'unsigned flags' to create_screen()

for drirc options

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: don't flush vertices in glClientActiveTexture
Marek Olšák [Tue, 20 Jun 2017 00:23:56 +0000 (02:23 +0200)]
mesa: don't flush vertices in glClientActiveTexture

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agomesa: don't flag _NEW_ARRAY for GL_PRIMITIVE_RESTART_NV
Marek Olšák [Tue, 20 Jun 2017 00:20:52 +0000 (02:20 +0200)]
mesa: don't flag _NEW_ARRAY for GL_PRIMITIVE_RESTART_NV

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agollvmpipe:fix using 32bit rasterization mistakenly, causing overflows
Roland Scheidegger [Fri, 23 Jun 2017 17:35:50 +0000 (19:35 +0200)]
llvmpipe:fix using 32bit rasterization mistakenly, causing overflows

We use the bounding box (triangle extents) to figure out if 32bit rasterization
could potentially overflow. However, we used the bounding box which already got
rounded up to 0 for negative coords for this, which is incorrect, leading to
overflows and hence bogus rendering in some of our private use.

It might be possible to simplify this somehow (we're now using 3 different
boxes for binning) but I don't quite see how.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
7 years agollvmpipe: fill in debug vertex info for tri rasterization
Roland Scheidegger [Fri, 23 Jun 2017 02:57:57 +0000 (04:57 +0200)]
llvmpipe: fill in debug vertex info for tri rasterization

This is pretty useful for debugging rasterization issues, so turn it on
based on DEBUG (the actual existence of the fields is also conditionalized
on DEBUG, lines fill it out the same too).

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
7 years agoRevert "radeonsi: don't emit partial flushes at the end of IBs (v2)"
Marek Olšák [Fri, 23 Jun 2017 17:02:32 +0000 (19:02 +0200)]
Revert "radeonsi: don't emit partial flushes at the end of IBs (v2)"

This reverts commit c9040dc9e75c81024f88f3f1bab821ad2bc73db3.

People have reported it causes corruption on VI, and I see GPU hangs
on GFX9.

7 years agomesa: remove spurious flush in _mesa_Viewport()
Samuel Pitoiset [Thu, 22 Jun 2017 12:55:24 +0000 (14:55 +0200)]
mesa: remove spurious flush in _mesa_Viewport()

I don't think this is actually required, if the viewport
values are different from the ones stored in the context, we
already flush and trigger _NEW_VIEWPORT in
set_viewport_no_notify().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agomesa: remove spurious flush in _mesa_DepthRange()
Samuel Pitoiset [Thu, 22 Jun 2017 11:55:05 +0000 (13:55 +0200)]
mesa: remove spurious flush in _mesa_DepthRange()

I don't think this is actually required, if the depth range
values are different from the ones stored in the context, we
already flush and trigger _NEW_VIEWPORT in
set_depth_range_no_notify().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>