mesa.git
6 years agoradv: Use correct bindings for inputRate in key generation.
Bas Nieuwenhuizen [Thu, 18 Jan 2018 14:35:11 +0000 (15:35 +0100)]
radv: Use correct bindings for inputRate in key generation.

The bindings also have an index field.

Fixes: 49d035122e "radv: Add single pipeline cache key."
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104677
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agoradv: Implement VK_ANDROID_native_buffer.
Bas Nieuwenhuizen [Thu, 4 Jan 2018 17:38:32 +0000 (18:38 +0100)]
radv: Implement VK_ANDROID_native_buffer.

Passes
  dEQP-VK.api.smoke.*
  dEQP-VK.wsi.android.*

with android-cts-7.1_r12 .

Unlike the initial anv implementation this does
use syncobjs instead of waiting on the CPU.

This is missing meson build coverage for now.

One possible todo is that linux 4.15 now has a
sycall that allows us to export amdgpu fence to
a sync_file, which allows us not to force all
fences and semaphores to use syncobjs. However,
I had trouble with my kernel crashing regularly
with NULL pointers, and I'm not sure how beneficial
it is in the first place given that intel uses
syncobjs for all fences if available.

Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Add create image flag to not use DCC/CMASK.
Bas Nieuwenhuizen [Thu, 4 Jan 2018 17:38:31 +0000 (18:38 +0100)]
radv: Add create image flag to not use DCC/CMASK.

If we import an image, we might not have space in the
buffer for CMASK, even though it is compatible.

Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Generate VK_ANDROID_native_buffer.
Bas Nieuwenhuizen [Thu, 4 Jan 2018 17:38:30 +0000 (18:38 +0100)]
radv: Generate VK_ANDROID_native_buffer.

Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Replace an assert with unreachable.
Bas Nieuwenhuizen [Wed, 17 Jan 2018 22:23:02 +0000 (23:23 +0100)]
radv: Replace an assert with unreachable.

Otherwise we get uninitialized variable warnings for es_vgpr_comp_cnt.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agoradv: Remove DCC check on CS resolve dst image.
Bas Nieuwenhuizen [Wed, 17 Jan 2018 22:21:42 +0000 (23:21 +0100)]
radv: Remove DCC check on CS resolve dst image.

Gives a warning when the assert is disabled, and not even
necessarily true.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agogallivm: support avx512 (16x32) in interleave2_half
George Kyriazis [Wed, 17 Jan 2018 00:06:34 +0000 (18:06 -0600)]
gallivm: support avx512 (16x32) in interleave2_half

lp_build_interleave2_half was not doing the right thing for avx512-style
16-wide loads.

This path is hit in the swr driver with a 16-wide vertex shader. It is
called from lp_build_transpose_aos, when doing texel fetches and the
fetched data needs to be transposed to one component per output register.

Special-case the post-load swizzle operations for avx512 16x32 (16-wide
32-bit values) so that we move the xyzw components correctly to the outputs.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agovbo: fix VBO optimization regression
Brian Paul [Wed, 17 Jan 2018 22:15:54 +0000 (15:15 -0700)]
vbo: fix VBO optimization regression

The optimization in change 8e4efdc895ea ("vbo: optimize some display
list drawing") missed the loopback case.  This is used when the
glBegin/End primitive doesn't have a uniform set of vertex attributes.
The new Piglit gl-1.0-dlist-materials test hits this.

So check the aligned_vertex_buffer_offset(list) value and adjust the
buffer offset accordingly.

We also need to remove the 'start == 0' assertion in the loopback
code since it no longer applies.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agomeson: ensure that xmlpool_options.h is generated for targets that need it
Dylan Baker [Thu, 18 Jan 2018 00:08:51 +0000 (16:08 -0800)]
meson: ensure that xmlpool_options.h is generated for targets that need it

Currently a couple of gallium targets race with xmlpool_options.h being
generated, don't do that.

Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agoac: fix visit_ssa_undef() for doubles
Timothy Arceri [Thu, 18 Jan 2018 01:01:33 +0000 (12:01 +1100)]
ac: fix visit_ssa_undef() for doubles

V2: use LLVMIntTypeInContext()

Fixes: f4e499ec7914 "radv: add initial non-conformant radv vulkan driver"
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoac/nir: account for view index in the user sgpr allocation.
Dave Airlie [Thu, 18 Jan 2018 02:31:40 +0000 (02:31 +0000)]
ac/nir: account for view index in the user sgpr allocation.

The view index user sgpr wasn't being accounted for properly,
this refactors out the code to decide if it's required and then
uses that info to account for it.

Fixes: 180c1b924e (ac/nir: Add shader support for multiviews.)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600: enable ARB_enhanced_layouts
Dave Airlie [Thu, 18 Jan 2018 04:09:38 +0000 (14:09 +1000)]
r600: enable ARB_enhanced_layouts

Only one piglit test fails,
sso-vs-gs-fs-array-interleave

There are 3 tests using ssbo without checking sizes failing also
but those are test bugs.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agointel: Future-proof ring names for aubinator_error_decode
Chris Wilson [Wed, 17 Jan 2018 15:41:25 +0000 (15:41 +0000)]
intel: Future-proof ring names for aubinator_error_decode

The kernel is moving to a $class$instance naming scheme in preparation
for accommodating more rings in the future in a consistent manner. It is
already using the naming scheme internally, and now we are looking at
updating some soft-ABI such as the error state to use the new naming
scheme. This of course means we need to teach aubinator_error_decode how
to map both sets of ring names onto its register maps.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michel Thierry <michel.thierry@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Michel Thierry <michel.thierry@intel.com>
6 years agoi965: Bind null render targets for shadow sampling + color.
Kenneth Graunke [Wed, 17 Jan 2018 22:16:04 +0000 (14:16 -0800)]
i965: Bind null render targets for shadow sampling + color.

Portal 2 appears to bind RGBA8888_UNORM textures to a sampler2DShadow,
and calls shadow2D() on it.  This causes undefined behavior in OpenGL.

Unfortunately, our sampler appears to hang in this scenario, which is
not acceptable.  Just give them a null surface instead, which returns
all zeroes.

Fixes GPU hangs in Portal 2 on Kabylake.

Huge thanks to Jason Ekstrand for noticing this crazy behavior while
sifting through crash dumps.

Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104487
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoanv/query: implement multiview interactions
Iago Toral Quiroga [Thu, 4 Jan 2018 02:45:56 +0000 (03:45 +0100)]
anv/query: implement multiview interactions

From the Vulkan spec with KHX extensions:

  "If queries are used while executing a render pass instance that has
   multiview enabled, the query uses N consecutive query indices
   in the query pool (starting at query) where N is the number of bits
   set in the view mask in the subpass the query is used in.

   How the numerical results of the query are distributed among the
   queries is implementation-dependent. For example, some implementations
   may write each view's results to a distinct query, while other
   implementations may write the total result to the first query and write
   zero to the other queries. However, the sum of the results in all the
   queries must accurately reflect the total result of the query summed
   over all views. Applications can sum the results from all the queries to
   compute the total result."

In our case we only really emit a single query (in the first query index)
that stores the aggregated result for all views, but we still need to manage
availability for all the other query indices involved, even if we don't
actually use them.

This is relevant when clients call vkGetQueryPoolResults and pass all N
queries to retrieve the results. In that scenario, without this patch,
we will never see queries other than the first being available since we
never emit them.

v2: we need the same treatment for timestamp queries.

v3 (Jason):
 - Better an if instead of an early return.
 - We can't write to this memory in the CPU, we should use
   MI_STORE_DATA_IMM and emit_query_availability (Jason).

v4 (Jason):
 - No need to take the value to write as parameter, just hard code it to 0.

Fixes test failures in some work-in-progress CTS multiview+query tests.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agovc5: add missing files to the tarball
Emil Velikov [Wed, 17 Jan 2018 16:34:48 +0000 (16:34 +0000)]
vc5: add missing files to the tarball

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
6 years agobroadcom: add missing headers to the tarball
Emil Velikov [Wed, 17 Jan 2018 16:27:52 +0000 (16:27 +0000)]
broadcom: add missing headers to the tarball

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoi965/screen: Allow drirc to set 'allow_rgb10_configs' again.
Mario Kleiner [Thu, 18 Jan 2018 06:16:20 +0000 (08:16 +0200)]
i965/screen: Allow drirc to set 'allow_rgb10_configs' again.

Since setup of ALLOW_RGB10_CONFIGS was moved to i965's own
brw_config_options.xml, this was hard-coded to false and
could not be overriden by drirc. Add some parsing into
i965's private screen->optionCache to enable drirc again.

Fixes: b391fb26df9f1b ("dri_util: remove ALLOW_RGB10_CONFIGS option (v2)")
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Marek Olšák <marek.olsak@amd.com>
Cc: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agoanv: return VK_ERROR_OUT_OF_DEVICE_MEMORY when surface size is out of HW limits
Samuel Iglesias Gonsálvez [Fri, 12 Jan 2018 08:41:17 +0000 (09:41 +0100)]
anv: return VK_ERROR_OUT_OF_DEVICE_MEMORY when surface size is out of HW limits

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoac: tidy up array indexing logic
Timothy Arceri [Thu, 18 Jan 2018 04:46:35 +0000 (15:46 +1100)]
ac: tidy up array indexing logic

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agomesa/st: translate SO info in glsl_to_nir() case
Rob Clark [Wed, 10 Jan 2018 02:54:14 +0000 (03:54 +0100)]
mesa/st: translate SO info in glsl_to_nir() case

This was handled for VS, but not for GS.

Fixes for gallium drivers using nir:
spec@arb_gpu_shader5@arb_gpu_shader5-xfb-streams-without-invocations
spec@arb_gpu_shader5@arb_gpu_shader5-xfb-streams*
spec@arb_transform_feedback3@arb_transform_feedback3-ext_interleaved_two_bufs_gs*
spec@ext_transform_feedback@geometry-shaders-basic
spec@ext_transform_feedback@* use_gs
spec@glsl-1.50@execution@geometry@primitive-id*
spec@glsl-1.50@execution@geometry@tri-strip-ordering-with-prim-restart gl_triangle_strip *
spec@glsl-1.50@transform-feedback-builtins
spec@glsl-1.50@transform-feedback-type-and-size

v2: don't call st_translate_program_stream_output) for TCS

v3: drop scanning patch outputs as TCS can't output xfb

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Tested-by: Karol Herbst <kherbst@redhat.com>
6 years agor600/sb: add lds related peepholes.
Dave Airlie [Wed, 10 Jan 2018 06:08:48 +0000 (06:08 +0000)]
r600/sb: add lds related peepholes.

if no destination:
a) convert _RET instructions to non _RET variants if no dst
b) set src0 to undefined if it's a READ, this should get DCE then.

Acked-By: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/sb: use different stacks for tracking lds and queue usage.
Dave Airlie [Wed, 10 Jan 2018 05:49:16 +0000 (05:49 +0000)]
r600/sb: use different stacks for tracking lds and queue usage.

The normal ssa renumbering isn't sufficient for LDS queue access,
this uses two stacks, one for the lds queue, and one for the
lds r/w ordering.

The LDS oq values are incremented in their use in a linear
fashion.
The LDS rw values are incremented in their definitions and used
in the next lds operation to ensure reordering doesn't occur.

Acked-By: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/sb: schedule LDS ops in appropriate places.
Dave Airlie [Wed, 10 Jan 2018 04:41:02 +0000 (04:41 +0000)]
r600/sb: schedule LDS ops in appropriate places.

So LDS ops have to be SLOT_X,
and LDS OQ reads have read port restrictions so we try
and force those into only having one per slot and avoiding
bank swizzles.

Acked-By: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/sb: hit the scheduler with a big hammer to avoid lds splits.
Dave Airlie [Wed, 10 Jan 2018 04:38:07 +0000 (04:38 +0000)]
r600/sb: hit the scheduler with a big hammer to avoid lds splits.

This tries to avoid an lds queue read getting scheduled separately
from an lds ret read, the non-sb code uses the same style of hammer,
this isn't foolproof.

We can do better, but it's a bit tricky, as you have to scan ahead
and either schedule more lds oq moves and more lds reads and that
could lead to you running out of space anyways.

Acked-By: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/sb: adding lds oq tracking to the scheduler
Dave Airlie [Wed, 10 Jan 2018 04:36:37 +0000 (04:36 +0000)]
r600/sb: adding lds oq tracking to the scheduler

This adds support for tracking the lds oq read/writes
so can avoid scheduling other things in between.

This patch just adds the tracking and assert to show
problems.

Acked-By: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/sb: add gcm support to avoid clause between lds read/queue read
Dave Airlie [Wed, 10 Jan 2018 04:30:23 +0000 (04:30 +0000)]
r600/sb: add gcm support to avoid clause between lds read/queue read

You have to schedule LDS_READ_RET _, x and MOV reg, LDS_OQ_A_POP
in the same basic block/clause. This makes sure once we've issues
and MOV we don't add another block until we balance it with an
LDS read.

Acked-By: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/sb: handle lds special dest registers.
Dave Airlie [Wed, 10 Jan 2018 04:25:41 +0000 (04:25 +0000)]
r600/sb: handle lds special dest registers.

This adds lds to the geom emit handling

Acked-By: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/sb: handle LDS operations in folding.
Dave Airlie [Wed, 10 Jan 2018 04:25:20 +0000 (04:25 +0000)]
r600/sb: handle LDS operations in folding.

Don't try and fold LDS using expressions.

Acked-By: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/sb: add finalising for lds output queue special values.
Dave Airlie [Wed, 10 Jan 2018 04:22:28 +0000 (04:22 +0000)]
r600/sb: add finalising for lds output queue special values.

We need to convert these to the hw special registers.

Acked-By: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/sb: add initial support for parsing lds operations.
Dave Airlie [Wed, 10 Jan 2018 04:20:52 +0000 (04:20 +0000)]
r600/sb: add initial support for parsing lds operations.

This handles parsing the LDS ops and queue accessess.

Acked-By: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/sb: disable if conversion for hs
Dave Airlie [Wed, 10 Jan 2018 03:57:52 +0000 (03:57 +0000)]
r600/sb: disable if conversion for hs

This fixes bad interactions with the LDS special values.

Acked-By: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/sb: lds ops have no dst register.
Dave Airlie [Wed, 10 Jan 2018 03:56:37 +0000 (03:56 +0000)]
r600/sb: lds ops have no dst register.

Although these are op3s they don't have a dst reg.

Acked-By: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/sb: introduce special register values for lds support.
Dave Airlie [Wed, 10 Jan 2018 03:52:50 +0000 (03:52 +0000)]
r600/sb: introduce special register values for lds support.

For LDS read/write ordering we use the LDS_RW value, reads
will wait on previous writes.
For LDS read/read from LDS queue ordering we use the LDS_OQ
values, we define two for now, though initially we'll just
support OQA.

Also add the check for the lds oq values

Acked-By: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/sb: update last_cf if alu is the last clause
Dave Airlie [Wed, 10 Jan 2018 03:46:50 +0000 (03:46 +0000)]
r600/sb: update last_cf if alu is the last clause

It's rare to have a final alu clause on normal shaders (exports)
but tess shaders write to LDS as their output, so we see some
alu clauses, and the CF_END get put in the wrong place.

This makes sure to update last_cf correctly.

Acked-By: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/sb: start adding GDS support
Dave Airlie [Thu, 7 Dec 2017 02:14:45 +0000 (02:14 +0000)]
r600/sb: start adding GDS support

This adds support for GDS ops to sb backend.

This seems to work for atomics and tess factor writes.

Acked-By: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/sb: add tess/compute initial state registers.
Dave Airlie [Thu, 7 Dec 2017 03:31:41 +0000 (03:31 +0000)]
r600/sb: add tess/compute initial state registers.

This stops them being optimised out.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/sb: fix a bug emitting ar load from a constant.
Dave Airlie [Wed, 10 Jan 2018 03:41:57 +0000 (03:41 +0000)]
r600/sb: fix a bug emitting ar load from a constant.

Some tess shaders were doing MOVA_INT _, c0.x on cayman, and then
hitting an assert in sb_bc_finalize.cpp:translate_kcache.

This makes sure the toplevel kcache tracker gets updated,
and the clause gets fixed up.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600/shader: only emit add instruction if param has a value.
Dave Airlie [Wed, 10 Jan 2018 02:56:15 +0000 (02:56 +0000)]
r600/shader: only emit add instruction if param has a value.

Just saves a pointless a = a + 0;

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600: emit 0 gds_op for tf write.
Dave Airlie [Wed, 10 Jan 2018 02:54:33 +0000 (02:54 +0000)]
r600: emit 0 gds_op for tf write.

This field is ignored for tf writes so should be 0.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600: add support for ARB_shader_clock.
Dave Airlie [Mon, 20 Nov 2017 21:29:09 +0000 (07:29 +1000)]
r600: add support for ARB_shader_clock.

Reviewed-by: Gert Wollny <gw.fossedev@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv/ws: get rid of useless return value
Dave Airlie [Thu, 18 Jan 2018 01:37:59 +0000 (01:37 +0000)]
radv/ws: get rid of useless return value

This also used boolean, so nice to kill that.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Initialize DCC on transition from preinitialized.
Bas Nieuwenhuizen [Thu, 11 Jan 2018 12:21:50 +0000 (13:21 +0100)]
radv: Initialize DCC on transition from preinitialized.

Looks like the decompress does not handle invalid encodings well,
which happens with random memory. Of course apps should not use it
with random memory, but they are allowed to ....

Fixes: 44fcf58744 "radv: Disable DCC for GENERAL layout and compute transfer dest."
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoac: fix buffer overflow bug in 64bit SSBO loads
Timothy Arceri [Tue, 16 Jan 2018 06:45:30 +0000 (17:45 +1100)]
ac: fix buffer overflow bug in 64bit SSBO loads

Fixes: 441ee1e65b04 "radv/ac: Implement Float64 SSBO loads"
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoac: fix nir_intrinsic_get_buffer_size for radeonsi
Timothy Arceri [Tue, 16 Jan 2018 07:02:37 +0000 (18:02 +1100)]
ac: fix nir_intrinsic_get_buffer_size for radeonsi

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoi965: Pass brw_growing_bo to grow_buffer().
Kenneth Graunke [Mon, 8 Jan 2018 06:40:13 +0000 (22:40 -0800)]
i965: Pass brw_growing_bo to grow_buffer().

Cleaner.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
6 years agoi965: Make a helper for recreating growing buffers.
Kenneth Graunke [Sun, 7 Jan 2018 04:34:35 +0000 (20:34 -0800)]
i965: Make a helper for recreating growing buffers.

Now that we have two of these, we're duplicating a bunch of this logic.
The next commit will add more logic, which would make the duplication
seem worse.

This ends up setting EXEC_OBJECT_CAPTURE on the batch, which isn't
necessary (it's already captured), but it should be harmless.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
6 years agoi965: Replace cpu_map pointers with a "use_shadow_copy" boolean.
Kenneth Graunke [Fri, 5 Jan 2018 19:44:50 +0000 (11:44 -0800)]
i965: Replace cpu_map pointers with a "use_shadow_copy" boolean.

Having a boolean for "we're using malloc'd shadow copies for all
buffers" is cleaner than having a cpu_map pointer for each.  It was
okay when we had one buffer, but this is more obvious.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
6 years agointel/fs: Optimize and simplify the copy propagation dataflow logic.
Francisco Jerez [Mon, 18 Dec 2017 23:22:04 +0000 (15:22 -0800)]
intel/fs: Optimize and simplify the copy propagation dataflow logic.

Previously the dataflow propagation algorithm would calculate the ACP
live-in and -out sets in a two-pass fixed-point algorithm.  The first
pass would update the live-out sets of all basic blocks of the program
based on their live-in sets, while the second pass would update the
live-in sets based on the live-out sets.  This is incredibly
inefficient in the typical case where the CFG of the program is
approximately acyclic, because it can take up to 2*n passes for an ACP
entry introduced at the top of the program to reach the bottom (where
n is the number of basic blocks in the program), until which point the
algorithm won't be able to reach a fixed point.

The same effect can be achieved in a single pass by computing the
live-in and -out sets in lock-step, because that makes sure that
processing of any basic block will pick up the updated live-out sets
of the lexically preceding blocks.  This gives the dataflow
propagation algorithm effectively O(n) run-time instead of O(n^2) in
the acyclic case.

The time spent in dataflow propagation is reduced by 30x in the
GLES31.functional.ssbo.layout.random.all_shared_buffer.5 dEQP
test-case on my CHV system (the improvement is likely to be of the
same order of magnitude on other platforms).  This more than reverses
an apparent run-time regression in this test-case from my previous
copy-propagation undefined-value handling patch, which was ultimately
caused by the additional work introduced in that commit to account for
undefined values being multiplied by a huge quadratic factor.

According to Chad this test was failing on CHV due to a 30s time-out
imposed by the Android CTS (this was the case regardless of my
undefined-value handling patch, even though my patch substantially
exacerbated the issue).  On my CHV system this patch reduces the
overall run-time of the test by approximately 12x, getting us to
around 13s, well below the time-out.

v2: Initialize live-out set to the universal set to avoid rather
    pessimistic dataflow estimation in shaders with cycles (Addresses
    performance regression reported by Eero in GpuTest Piano).
    Performance numbers given above still apply.  No shader-db changes
    with respect to master.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104271
Reported-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agogallium: remove PIPE_CAP_USER_CONSTANT_BUFFERS
Marek Olšák [Wed, 10 Jan 2018 19:03:54 +0000 (20:03 +0100)]
gallium: remove PIPE_CAP_USER_CONSTANT_BUFFERS

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agost/mesa: assume that user constant buffers are always supported
Marek Olšák [Wed, 10 Jan 2018 19:03:28 +0000 (20:03 +0100)]
st/mesa: assume that user constant buffers are always supported

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agonine: assume that user constant buffers are always supported
Marek Olšák [Wed, 10 Jan 2018 19:02:48 +0000 (20:02 +0100)]
nine: assume that user constant buffers are always supported

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agogallium: remove PIPE_CAP_TEXTURE_SHADOW_MAP
Marek Olšák [Wed, 10 Jan 2018 12:45:33 +0000 (13:45 +0100)]
gallium: remove PIPE_CAP_TEXTURE_SHADOW_MAP

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agost/mesa: expose ARB_sync unconditionally
Marek Olšák [Tue, 9 Jan 2018 14:48:52 +0000 (15:48 +0100)]
st/mesa: expose ARB_sync unconditionally

All drivers support it.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agogallium: remove PIPE_CAP_TWO_SIDED_STENCIL
Marek Olšák [Wed, 10 Jan 2018 12:40:55 +0000 (13:40 +0100)]
gallium: remove PIPE_CAP_TWO_SIDED_STENCIL

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoglsl: remove unneeded extern "C" {} bracketing around Mesa includes
Brian Paul [Wed, 17 Jan 2018 04:58:58 +0000 (21:58 -0700)]
glsl: remove unneeded extern "C" {} bracketing around Mesa includes

The two headers already have the right extern "C" annotations.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agomesa: move gl_external_samplers() to program.[ch]
Brian Paul [Wed, 17 Jan 2018 04:53:29 +0000 (21:53 -0700)]
mesa: move gl_external_samplers() to program.[ch]

The function is only called from a couple places.  It doesn't make
sense to have it in mtypes.h

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agost/mesa: include util/bitscan.h in st_glsl_to_tgsi_temprename.cpp
Brian Paul [Wed, 17 Jan 2018 04:57:57 +0000 (21:57 -0700)]
st/mesa: include util/bitscan.h in st_glsl_to_tgsi_temprename.cpp

And use "" instead of <> for including Mesa headers, as we do elsewhere.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoglsl: include util/bitscan.h in serialize.cpp
Brian Paul [Wed, 17 Jan 2018 04:52:22 +0000 (21:52 -0700)]
glsl: include util/bitscan.h in serialize.cpp

Instead of relying on indirect inclusion of the header.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoutil: include string.h in u_dynarray.h
Brian Paul [Wed, 17 Jan 2018 04:49:09 +0000 (21:49 -0700)]
util: include string.h in u_dynarray.h

To get memset() prototype.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agomesa: remove unneeded #includes of main/compiler.h
Brian Paul [Wed, 17 Jan 2018 04:44:43 +0000 (21:44 -0700)]
mesa: remove unneeded #includes of main/compiler.h

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agost/mesa: remove unneeded #includes of main/compiler.h
Brian Paul [Wed, 17 Jan 2018 04:44:17 +0000 (21:44 -0700)]
st/mesa: remove unneeded #includes of main/compiler.h

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agost/mesa: include main/compiler.h in st_cb_queryobj.c
Brian Paul [Wed, 17 Jan 2018 05:14:20 +0000 (22:14 -0700)]
st/mesa: include main/compiler.h in st_cb_queryobj.c

To get CPU_TO_LE32() macro.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agomesa: include util/macros.h in format_fallback.c
Brian Paul [Wed, 17 Jan 2018 05:13:41 +0000 (22:13 -0700)]
mesa: include util/macros.h in format_fallback.c

To get definition of unreachable() macro.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agomesa: include compiler.h in disk_cache.c
Brian Paul [Wed, 17 Jan 2018 05:12:49 +0000 (22:12 -0700)]
mesa: include compiler.h in disk_cache.c

Instead of indirect inclusion to get CPU_TO_LE32() macro.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agomesa/program: change validate_inputs() local var 'inputs' to GLbitfield64
Brian Paul [Tue, 16 Jan 2018 15:40:36 +0000 (08:40 -0700)]
mesa/program: change validate_inputs() local var 'inputs' to GLbitfield64

Both state->prog->info.inputs_read and state->InputsBound are GLbitfield64
so it seems that the OR of those values should be of the same type.
I'm not sure this fixes any actual issues though.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agovbo: reindent vbo_attrib.h to use 3 spaces
Brian Paul [Wed, 17 Jan 2018 03:22:56 +0000 (20:22 -0700)]
vbo: reindent vbo_attrib.h to use 3 spaces

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agovbo: whitespace, formatting fixes in vbo_exec_api.c
Brian Paul [Tue, 16 Jan 2018 21:46:54 +0000 (14:46 -0700)]
vbo: whitespace, formatting fixes in vbo_exec_api.c

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agovbo: add assertions, comments in vbo_exec_api.c
Brian Paul [Tue, 16 Jan 2018 21:28:01 +0000 (14:28 -0700)]
vbo: add assertions, comments in vbo_exec_api.c

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agovbo: whitespace, formatting fixes in vbo_exec_draw.c
Brian Paul [Tue, 16 Jan 2018 16:34:30 +0000 (09:34 -0700)]
vbo: whitespace, formatting fixes in vbo_exec_draw.c

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agovbo: use inputs_read var to simplify code
Brian Paul [Tue, 16 Jan 2018 16:31:01 +0000 (09:31 -0700)]
vbo: use inputs_read var to simplify code

v2: add some const qualifiers, per Ian.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agovbo: whitespace, formatting fixes in vbo_split_copy.c
Brian Paul [Mon, 15 Jan 2018 21:53:47 +0000 (14:53 -0700)]
vbo: whitespace, formatting fixes in vbo_split_copy.c

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agovbo: use a new local 'array' variable in bind_vertex_list() loop
Brian Paul [Mon, 15 Jan 2018 21:48:07 +0000 (14:48 -0700)]
vbo: use a new local 'array' variable in bind_vertex_list() loop

Make the code a bit more concise.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agovbo: remove unneeded #includes in vbo_context.c
Brian Paul [Mon, 15 Jan 2018 21:44:39 +0000 (14:44 -0700)]
vbo: remove unneeded #includes in vbo_context.c

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agovbo: whitespace, formatting fixes in vbo_context.c
Brian Paul [Mon, 15 Jan 2018 21:41:18 +0000 (14:41 -0700)]
vbo: whitespace, formatting fixes in vbo_context.c

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agovbo: change vbo_context attribute map arrays to GLubyte
Brian Paul [Mon, 15 Jan 2018 21:37:04 +0000 (14:37 -0700)]
vbo: change vbo_context attribute map arrays to GLubyte

The values will never be larger than VBO_ATTRIB_MAX (currently 44).

v2: add STATIC_ASSERT to be sure VBO_ATTRIB_MAX can fit in ubyte,
per Emil.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agovbo: lift common code out of switch cases
Brian Paul [Mon, 15 Jan 2018 21:34:53 +0000 (14:34 -0700)]
vbo: lift common code out of switch cases

Both switch cases began with the same code.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agovbo: optimize some display list drawing (v2)
Brian Paul [Fri, 12 Jan 2018 20:18:25 +0000 (13:18 -0700)]
vbo: optimize some display list drawing (v2)

The vbo_save_vertex_list structure records one or more glBegin/End
primitives which all have the same vertex format.

To draw these primitives, we setup the vertex array state, then
issue the drawing command.  Before, the 'start' vertex was typically
zero and we used the vertex array pointer to indicate where the
vertex data starts.

This patch checks if the vertex buffer offset is an exact multiple of
the vertex size.  If so, that means we can use zero-based vertex array
pointers and use the draw's start value to indicate where the vertex
data starts.

This means a series of display list drawing commands may have
identical vertex array state.  This will get filtered out by the
Gallium CSO module so we can issue a tight series of drawing commands
without state changes to the device.

Note that this also works for a series of glCallList commands (not
just one list that contains multiple glBegin/End pairs).

No Piglit or conform changes.

v2: minor fixes suggested by Ian.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agovbo: rewrite some code in playback_copy_to_current()
Brian Paul [Fri, 12 Jan 2018 20:17:10 +0000 (13:17 -0700)]
vbo: rewrite some code in playback_copy_to_current()

I think this is a little easier to understand.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agovbo: add some comments in vbo_save_api.c
Brian Paul [Fri, 12 Jan 2018 17:28:14 +0000 (10:28 -0700)]
vbo: add some comments in vbo_save_api.c

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agovbo: rename some functions in vbo_save_api.c
Brian Paul [Fri, 12 Jan 2018 17:21:48 +0000 (10:21 -0700)]
vbo: rename some functions in vbo_save_api.c

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agovbo: rename some functions in vbo_save_draw.c
Brian Paul [Fri, 12 Jan 2018 17:16:40 +0000 (10:16 -0700)]
vbo: rename some functions in vbo_save_draw.c

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agovbo: add comment that vbo_save_vertex_list::buffer_offset is in bytes
Brian Paul [Fri, 12 Jan 2018 16:57:29 +0000 (09:57 -0700)]
vbo: add comment that vbo_save_vertex_list::buffer_offset is in bytes

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agovbo: minor code simplification in _save_compile_vertex_list()
Brian Paul [Fri, 12 Jan 2018 16:56:42 +0000 (09:56 -0700)]
vbo: minor code simplification in _save_compile_vertex_list()

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agovbo: rename prim to prims
Brian Paul [Fri, 12 Jan 2018 16:52:05 +0000 (09:52 -0700)]
vbo: rename prim to prims

Using a plural name makes it easier to see that this is an array and
not a pointer to a single object.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agovbo: removed unused ctx parameter for alloc_prim_store()
Brian Paul [Fri, 12 Jan 2018 16:48:17 +0000 (09:48 -0700)]
vbo: removed unused ctx parameter for alloc_prim_store()

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agovbo: rename vbo_save_context::buffer to buffer_map
Brian Paul [Fri, 12 Jan 2018 16:30:42 +0000 (09:30 -0700)]
vbo: rename vbo_save_context::buffer to buffer_map

And move the field and improve comments.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agovbo: remove unused vbo_save_context::count field
Brian Paul [Fri, 12 Jan 2018 16:28:37 +0000 (09:28 -0700)]
vbo: remove unused vbo_save_context::count field

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agovbo: s/GLuint/GLbitfield/ for vbo_save_context::replay_flags
Brian Paul [Fri, 12 Jan 2018 16:27:16 +0000 (09:27 -0700)]
vbo: s/GLuint/GLbitfield/ for vbo_save_context::replay_flags

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agovbo: rename vbo_save_vertex_list::count to vertex_count
Brian Paul [Fri, 12 Jan 2018 16:23:37 +0000 (09:23 -0700)]
vbo: rename vbo_save_vertex_list::count to vertex_count

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agovbo: rename vbo_save_vertex_store::buffer to buffer_map
Brian Paul [Fri, 12 Jan 2018 16:18:32 +0000 (09:18 -0700)]
vbo: rename vbo_save_vertex_store::buffer to buffer_map

To match other parts of the VBO code and make things easier to understand.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agovbo: rename vbo_save_primitive_store::buffer to prims
Brian Paul [Fri, 12 Jan 2018 16:12:35 +0000 (09:12 -0700)]
vbo: rename vbo_save_primitive_store::buffer to prims

A little easier to understand.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agovbo: whitespace fixes in vbo_save.h
Brian Paul [Fri, 12 Jan 2018 16:07:05 +0000 (09:07 -0700)]
vbo: whitespace fixes in vbo_save.h

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agovbo: whitespace fixes in vbo_save_draw.c
Brian Paul [Thu, 11 Jan 2018 23:18:38 +0000 (16:18 -0700)]
vbo: whitespace fixes in vbo_save_draw.c

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agosvga: add num-commands-per-draw HUD query
Brian Paul [Thu, 11 Jan 2018 18:17:45 +0000 (11:17 -0700)]
svga: add num-commands-per-draw HUD query

This query shows the ratio of total commands vs. drawing commands sent
to the vgpu device.  This gives some idea of how many state changes
are sent per draw call.  The closer the ratio is to 1.0, the better.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
6 years agogallium/hud: Fix support for PIPE_DRIVER_QUERY_TYPE_FLOAT
Brian Paul [Thu, 11 Jan 2018 18:11:04 +0000 (11:11 -0700)]
gallium/hud: Fix support for PIPE_DRIVER_QUERY_TYPE_FLOAT

Evidently, nobody has used PIPE_DRIVER_QUERY_TYPE_FLOAT up to this
point.  Adding a driver query of this type which returns the query
value in pipe_query_result::f resulted in garbage output in the HUD.

The problem is the pipe_query_result::f field was being accessed as
through the u64 field and being added to the query_info::results_cumulative
field.  This patch checks for PIPE_DRIVER_QUERY_TYPE_FLOAT in a few
places and scales the float by 1000 before converting to uint64_t.

Also, add some comments to explain the query_info::result_index field.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agogallium/hud: remove uint64_t casts in sensor query_sti_load() function
Brian Paul [Thu, 11 Jan 2018 16:57:50 +0000 (09:57 -0700)]
gallium/hud: remove uint64_t casts in sensor query_sti_load() function

The hud_graph_add_value() function takes a double value, so just pass
the current/critical values as-is since they're doubles.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agogallium/hud: compute cpu load, percent with doubles
Brian Paul [Thu, 11 Jan 2018 16:56:12 +0000 (09:56 -0700)]
gallium/hud: compute cpu load, percent with doubles

The hud_graph_add_value() function takes a double precision value,
so compute it that way.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agogallium/hud: s/unsigned/enum pipe_query_type/
Brian Paul [Thu, 11 Jan 2018 16:50:42 +0000 (09:50 -0700)]
gallium/hud: s/unsigned/enum pipe_query_type/

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agomeson: Set with_dri from with_gallium when DRI glx is explicitly configured
Jon Turney [Mon, 15 Jan 2018 19:39:46 +0000 (19:39 +0000)]
meson: Set with_dri from with_gallium when DRI glx is explicitly configured

Set with_dri from with_gallium when DRI GLX is explicitly configured, as
well as when DRI GLX is chosen automatically.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>