mesa.git
7 years agoac/llvm: fix type of second llvm.cttz.* parameter
Nicolai Hähnle [Sat, 24 Jun 2017 15:56:38 +0000 (17:56 +0200)]
ac/llvm: fix type of second llvm.cttz.* parameter

LLVM has required an i1 here for a long time. llvm.ctlz.* was fixed in
commit edd23e06067 ("ac/llvm: fix various findMSB bugs").

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoac/shader_info: fix a comment
Nicolai Hähnle [Mon, 15 May 2017 22:04:10 +0000 (00:04 +0200)]
ac/shader_info: fix a comment

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoac: add ac_llvm_context::v8i32
Nicolai Hähnle [Thu, 8 Jun 2017 18:04:28 +0000 (20:04 +0200)]
ac: add ac_llvm_context::v8i32

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoac: add ac_llvm_context::{i,f}32_{0,1}
Nicolai Hähnle [Thu, 18 May 2017 20:02:48 +0000 (22:02 +0200)]
ac: add ac_llvm_context::{i,f}32_{0,1}

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoac: add ac_llvm_context::{i16, i64, f16, f64}
Nicolai Hähnle [Thu, 30 Mar 2017 12:10:26 +0000 (14:10 +0200)]
ac: add ac_llvm_context::{i16, i64, f16, f64}

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agonv50/ir: fix combineLd/St to update existing records as necessary
Ilia Mirkin [Sat, 24 Jun 2017 22:35:29 +0000 (18:35 -0400)]
nv50/ir: fix combineLd/St to update existing records as necessary

Previously the logic would decide that the record is kept, which
translates into keep = false in the caller, which meant that these
passes did not run.

While it's right that keep = false which means that a new record does
not need to be added, we do still have to perform the usual list
maintenance. It's easiest to do this pre-merge rather than post.

The lowering that clip/cull distance passes produce triggers this bug in
TCS (since reading outputs is done differently in other stages), but it
should be possible to achieve it with the right sequence of regular
reads/writes.

Fixes: KHR-GL45.cull_distance.functional
Fixes: generated_tests/spec/arb_tessellation_shader/execution/tes-input/tes-input-gl_ClipDistance.shader_test
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
7 years agonv50/ir: adjust overlapping logic to take fileIndex-relative offsets
Ilia Mirkin [Sat, 24 Jun 2017 21:09:20 +0000 (17:09 -0400)]
nv50/ir: adjust overlapping logic to take fileIndex-relative offsets

If the fileIndex is different, that means they are in logically
different spaces. However if there's also a relative offset, then they
could end up pointing at the same spot again.

Also add a note about potential for multiple buffers to overlap even if
they're at different file indexes. However that's potentially lowered
away by the point that this logic hits.

Not known to fix any specific application or test.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agonv50/ir: VFETCH is also considered a load for MemoryOpt
Ilia Mirkin [Sat, 24 Jun 2017 21:08:11 +0000 (17:08 -0400)]
nv50/ir: VFETCH is also considered a load for MemoryOpt

This has no effect since in practice this will only play for
memory-backed files, for which VFETCH will never happen.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agonv50,nvc0: remove IDX from bufctx immediately, to avoid conflicts with clear
Ilia Mirkin [Sat, 24 Jun 2017 17:17:08 +0000 (13:17 -0400)]
nv50,nvc0: remove IDX from bufctx immediately, to avoid conflicts with clear

The idxbuf could linger, and when a clear happened, which also uses the
3d bufctx, we could get an error trying to access it.

This fixes spurious crashes/errors in CTS tests.

Fixes: 61d8f3387d ("nv50,nvc0: clear index buffer bufctx bin unconditionally")
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
7 years agonv50/ir: fetch indirect sources BEFORE the op that uses them
Ilia Mirkin [Sat, 24 Jun 2017 16:08:52 +0000 (12:08 -0400)]
nv50/ir: fetch indirect sources BEFORE the op that uses them

All the BuildUtil helpers just insert the operation into the current BB.
So we have to take care that any fetchSrc() operations happen before the
operation whose setIndirect() it goes into.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
7 years agomesa: skip FLUSH_VERTICES() if no samplers were changed
Timothy Arceri [Thu, 22 Jun 2017 22:56:40 +0000 (08:56 +1000)]
mesa: skip FLUSH_VERTICES() if no samplers were changed

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agomesa: don't set _NEW_PROGRAM_CONSTANTS for non-bindless opaque uniforms
Timothy Arceri [Thu, 22 Jun 2017 22:44:25 +0000 (08:44 +1000)]
mesa: don't set _NEW_PROGRAM_CONSTANTS for non-bindless opaque uniforms

v2: rebase on new _mesa_flush_vertices_for_uniforms() helper

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoAndroid: add renderonly files to libmesa_gallium
Rob Herring [Mon, 26 Jun 2017 21:23:00 +0000 (16:23 -0500)]
Android: add renderonly files to libmesa_gallium

vc4 now depends on renderonly functions, but these weren't added to the
Android build resulting in the following errors:

src/gallium/drivers/vc4/vc4_resource.c:380: error: undefined reference to 'renderonly_scanout_destroy'
src/gallium/drivers/vc4/vc4_resource.c:681: error: undefined reference to 'renderonly_create_gpu_import_for_resource'
src/gallium/drivers/vc4/vc4_screen.c:625: error: undefined reference to 'renderonly_dup'
src/gallium/winsys/pl111/drm/pl111_drm_winsys.c:37: error: undefined reference to 'renderonly_create_gpu_import_for_resource'
src/gallium/winsys/pl111/drm/pl111_drm_winsys.c:37: error: undefined reference to 'renderonly_create_gpu_import_for_resource'

Fixes: 7029ec05e2c7 ("gallium: Add renderonly-based support for pl111+vc4.")
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: add KHR_no_error support for glCopyTexImage*D()
Timothy Arceri [Mon, 26 Jun 2017 03:27:17 +0000 (13:27 +1000)]
mesa: add KHR_no_error support for glCopyTexImage*D()

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa: add no error support to copyteximage()
Timothy Arceri [Mon, 26 Jun 2017 03:20:45 +0000 (13:20 +1000)]
mesa: add no error support to copyteximage()

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa: create copyteximage_err() helper and always inline copyteximage()
Timothy Arceri [Mon, 26 Jun 2017 03:14:03 +0000 (13:14 +1000)]
mesa: create copyteximage_err() helper and always inline copyteximage()

This will be useful in the following patch when we add KHR_no_error
support.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa: tidy up copyteximage()
Timothy Arceri [Mon, 26 Jun 2017 02:58:34 +0000 (12:58 +1000)]
mesa: tidy up copyteximage()

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agoi915: On Gen <= 3 there are no array textures
Ian Romanick [Sat, 3 Jun 2017 02:08:15 +0000 (19:08 -0700)]
i915: On Gen <= 3 there are no array textures

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 W-tiling
Ian Romanick [Sat, 3 Jun 2017 00:29:53 +0000 (17:29 -0700)]
i915: On Gen <= 3 there is no W-tiling

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 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>