Commit Graph

88434 Commits

Author SHA1 Message Date
Nicolai Hähnle 38c67f77ed ac/nir: use ac_build_gather_values[_extended] throughout
... and eliminate the non-ac copies. Mostly straight-forward
search & replace.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-01-13 00:39:20 +01:00
Nicolai Hähnle 2c9d26a356 ac/nir: use ac_emit_llvm_intrinsic throughout
... by straight-forward search & replace, and eliminate
emit_llvm_intrinsic.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-01-13 00:39:17 +01:00
Nicolai Hähnle fccf29373d radeonsi: remove unused si_prepare_cube_coords
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-01-13 00:39:13 +01:00
Nicolai Hähnle a0ce09b4b2 amd/common: unify cube map coordinate handling between radeonsi and radv
Code is taken from a combination of radv (for the more basic functions,
to avoid gallivm dependencies) and radeonsi (for the new and improved
derivative calculations).

v2: add 0.5 offset to tex coords only after derivative calculation

v3:
- really only touch the first three coordinates
- rebase on the removal of the 1.5 --> 0.5 offset change

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> (v2)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-01-13 00:39:10 +01:00
Nicolai Hähnle 0ee1ee5fbb radeonsi: only touch first three coordinates in si_prepare_cube_coords
Sourcing coords_arg[4] is actually never correct, since bias is handled
differently in tex_fetch_args anyway.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-01-13 00:39:07 +01:00
Nicolai Hähnle 9f590ee9d9 radeonsi: remove unused si_llvm_cube_to_2d_coords
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-01-13 00:39:03 +01:00
Nicolai Hähnle 205ad5234a radeonsi: restrict cube map derivative computations to the correct plane
As remarked by the comment in the original code, the old algorithm fails when
(tc + deriv) points at a different cube face. Instead, simply project the
derivative directly to the plane of the selected cube face.

The new code is based on exactly differentiating (using the chain rule)
the projection onto a plane corresponding to a fixed cube map face (which
is still selected in the usual way based on the texture coordinate itself).
The computations end up fairly involved, but we do save two reciprocal
computations.

Fixes GL45-CTS.texture_cube_map_array.sampling.

v2: add 0.5 offset to tex coords only after derivative calculation
v3: go back to 1.5 offset

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> (v2)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-01-13 00:38:59 +01:00
Nicolai Hähnle e01deee42f radeonsi: communicate cube map coordinates more explicitly
v2: fix compile error that snuck in during rebase

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-01-13 00:38:34 +01:00
Grazvydas Ignotas c728051131 ac/debug: move .gitignore for sid_tables.h too
b838f642 "ac/debug: Move sid_tables.h generation to common code." moved
sid_tables.h but forgot the corresponding .gitignore.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-01-13 00:37:52 +01:00
Jason Ekstrand 08eced3cfd nir/gcm: Fix a typo in a comment
Reported-by: Matt Turner <mattst88@gmail.com>
2017-01-12 14:56:55 -08:00
Jason Ekstrand 087e172179 nir/gcm: Rework the schedule late loop
This fixes a bug in code motion that occurred when the best block is the
same as the schedule early block.  In this case, because we're checking
(lca != def->parent_instr->block) at the top of the loop, we never get to
the check for loop depth so we wouldn't move it out of the loop.  This
commit reworks the loop to be a simple for loop up the dominator chain and
we place the (lca != def->parent_instr->block) check at the end of the
loop.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2017-01-12 14:56:55 -08:00
Chuck Atkins e9a4ec4bd8 glx: Add missing glproto dependency for gallium-xlib glx
Cc: mesa-stable@lists.freedesktop.org
Cc: Bruce Cherniak <bruce.cherniak@intel.com>
Signed-of-by: Chuck Atkins <chuck.atkins@kitware.com>
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2017-01-12 22:01:55 +00:00
Emil Velikov c90f921273 ac, radeonsi: automake: add missing builddir include
The generated file is correctly stored in the builddir as of earlier
commit. Yet the commit forgot to add the respective include flag thus
the compiler would error out failing to find sid_tables.h

Bugzila: https://bugs.freedesktop.org/show_bug.cgi?id=99389
Fixes: d1dc22eb46 "ac: automake: rework sid_tables.h generation"
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-01-12 22:01:55 +00:00
Bas Nieuwenhuizen 8aaca3820c radv: Call NIR passes using NIR_PASS_V.
Port of faa1edeeb7
"anv/pipeline: Call NIR passes using NIR_PASS_V"

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
2017-01-12 21:39:52 +01:00
Bas Nieuwenhuizen 65cbb993d3 radv: Call nir_lower_constant_initializers.
Port of c5d664f9dc
"anv/pipeline: Call nir_lower_constant_initializers"

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
2017-01-12 21:39:46 +01:00
Bas Nieuwenhuizen 18e70edd8c radv: Only call remove_dead_variables once.
Port of 43e0b0d4b2
"anv/pipeline: Only call remove_dead_variables once"

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
2017-01-12 21:39:41 +01:00
Axel Davy 970556292b st/nine: Protect dtors with mutex
When the flag D3DCREATE_MULTITHREAD is set, a global mutex is used
to protect nine calls.
However for performance reasons, AddRef and Release didn't hold the mutex,
and instead used atomics.

Unfortunately at item release, the item can be destroyed, and that
destruction path should be protected by a mutex (at least for
some objects).

Without this patch, it is possible an app thread is in a dtor
while another thread is making gallium nine calls. It is possible
that two threads are using the same gallium pipe, which is forbiden.
The problem has been made worse with csmt, because it can cause hang,
since nine_csmt_process is not threadsafe.

Fixes Hitman hang, and possibly others.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
2017-01-12 20:33:11 +01:00
Axel Davy 5f4359ea0e st/nine: Flush the queue at device dtor
Flush the queue to get refcounts right, and properly
release the items, instead of throwing away all pending
commands.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
2017-01-12 20:33:11 +01:00
Axel Davy 4e922c81f6 st/nine: Process pending commands on Reset
Some nine_state_* and nine_context_* functions
used for Reset() require all pending commands are
flushed.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
2017-01-12 20:33:11 +01:00
Axel Davy 6b87a2a77a st/nine: Flush pending commands if needed for surface9 changes
nine_context uses NineSurface9 fields, thus we need to flush
pending commands using the surface before changing the fields.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
2017-01-12 20:33:11 +01:00
Axel Davy f895ab8e22 st/nine: Rework CreatePipeSurface
Create both surfaces in one call.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
2017-01-12 20:33:11 +01:00
Axel Davy d43bc05e8b st/nine: Remove duplicated checks
There is no need to check on csmt_active before
calling nine_csmt_process, because the function
checks already.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
2017-01-12 20:33:11 +01:00
Masanori Kakura 9b5f5de9e9 st/nine: Don't call u_box_union_* when dirty region is empty
When dirty region is empty, u_box_union_* incorrectly expands
the new region.

This fixes broken font rendering issue in WOLF RPG Editor v2.10 games.

Signed-off-by: Masanori Kakura <kakurasan@gmail.com>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
2017-01-12 20:33:11 +01:00
Emil Velikov a5f0cdb36f winsys/etnaviv: automake: introduce Makefile.sources
... and list the public header within it.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-01-12 19:30:15 +00:00
Emil Velikov 0467700536 etnaviv: automake: include all files in the sources lists
Note: the currently mentioned etnaviv_utils.h is typo.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-01-12 19:30:09 +00:00
Emil Velikov d1dc22eb46 ac: automake: rework sid_tables.h generation
Drop $(srcdir)/ prefix analogous to before the file (and rule) movement
and move it outside of the NEED_RADEON_LLVM conditional.

Otherwise the build may fail as below.

make[3]: *** No rule to make target 'common/sid_tables.h', needed by 'distdir'.  Stop.

Fixes: b838f64237 "ac/debug: Move sid_tables.h generation to common
code."
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-01-12 19:29:28 +00:00
Emil Velikov 23dcce0c03 automake: use shared llvm libs for make distcheck
Cc: "12.0 13.0" <mesa-dev@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-01-12 19:29:22 +00:00
Emil Velikov 024b4c35bc automake: add the new drivers etnaviv and imx to make distcheck
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-01-12 19:29:20 +00:00
Christian Gmeiner e8626e3b31 imx: gallium driver for imx-drm scanout driver
Changes from V1 -> V2:
 - updated Copyright
 - added $(top_srcdir)/src/gallium/winsys to include path (suggested by Emil)
 - adapted driver to new renderonly API

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
2017-01-12 19:27:11 +00:00
The etnaviv authors c9e8b49b88 etnaviv: gallium driver for Vivante GPUs
This driver supports a wide range of Vivante IP cores like GC880,
GC1000, GC2000 and GC3000.

Changes from V1 -> V2:
 - added missing files to actually integrate the driver into build system.
 - adapted driver to new renderonly API

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Wladimir J. van der Laan <laanwj@gmail.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
2017-01-12 19:27:11 +00:00
Christian Gmeiner 848b49b288 gallium: add renderonly library
This a very lightweight library to add basic support for renderonly
GPUs. A kms gallium driver must specify how a renderonly_scanout
objects gets created. Also it must provide file handles to the used
kms device and the used gpu device.

This could look like:
struct renderonly ro = {
   .create_for_resource = renderonly_create_gpu_import_for_resource,
   .kms_fd = fd,
   .gpu_fd = open("/dev/dri/renderD128", O_RDWR | O_CLOEXEC)
};

The renderonly_scanout object exits for two reasons:
 - Do any special treatment for a scanout resource like importing the
   GPU resource into the scanout hw.
 - Make it easier for a gallium driver to detect if anything special
   needs to be done in flush_resource(..) like a resolve to linear.

A GPU gallium driver which gets used as renderonly GPU needs to be
aware of the renderonly library.

This library will likely break android support and hopefully will get
replaced with a better solution based on gbm2.

Changes from V1 -> V2:
 - reworked the lifecycle of renderonly object (suggested by Nicolai Hähnle)
 - killed the midlayer (suggested by Thierry Reding)
 - made the API more explicit regarding gpu and kms fd's
 - added some docs

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Alexandre Courbot <acourbot@nvidia.com>
2017-01-12 19:27:11 +00:00
Jason Ekstrand 27a1c7ffbd spirv: Handle patch decorations up-front
Once again, SPIR-V is insane... It allows you to place "patch"
decorations on structure members.  Presumably, this is so that you can
do something such as

out struct S {
   layout(location = 0) patch vec4 thing1;
   layout(location = 0) vec4 thing2;
} str;

And have your I/O "nicely" organized.  While this is a bit silly, it's
allowed and well-defined so whatever.  Where it really gets interesting
is when you have an array of struct.  SPIR-V says nothing about not
allowing you to have those qualifiers on the members of a struct that's
inside an array and GLSLang does this.  Specifically, if you have

layout(location = 0) out patch struct S {
   vec4 thing1;
   vec4 thing2;
} str[2];

then GLSLang will place the "patch" decorations on the struct members.
This is ridiculous there is no way that having some of them be patch and
some not would be well-defined given that patch and non-patch outputs
are in effectively different storage classes.  This commit moves around
the way we handle the "patch" decoration so that we can detect even the
crazy cases and handle them.

Fixes: dEQP-VK.tessellation.user_defined_io.per_patch_block_array.*

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2017-01-12 10:41:34 -08:00
Chad Versace 1e41d7f7b0 anv: Support loader interface version 3 (patch v2)
This patch implements vk_icdNegotiateLoaderICDInterfaceVersion(), which
brings us to loader interface v3.

v2:
  - Drop the pragmas. [emil]
  - Advertise v3 instead of v2. Anvil supported more than I
    thought.  [jason]
  - s/Surface/SurfaceKHR/ in comments. [emil]

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: mesa-stable@lists.freedesktop.org
Cc: Jason Ekstrand <jason@jlekstrand.net>
2017-01-12 09:42:32 -08:00
Chad Versace 98cf089849 vulkan: Update vk_icd.h to interface version 3
Import from commit f2aeefec on branch 'master'
of https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: mesa-stable@lists.freedesktop.org
2017-01-12 09:42:32 -08:00
Chad Versace c085bfcec9 vulkan: Add new cast macros for VkIcd types
We can't import the latest vk_icd.h because the new header breaks the
Mesa build. This patch defines new casting macros,
ICD_DEFINE_NONDISP_HANDLE_CASTS() and ICD_FROM_HANDLE(), which can
handle both the old and new vk_icd.h, and will prevent the build from
breaking when we update the header.

In the old vk_icd.h, types were defined as:

  typedef struct _VkIcdFoo {
    ...
  } VkIcdFoo;

Commit 6ebba1f6 in the Vulkan loader changed the above to

  typedef {
    ...
  } VkIcdFoo;

because the old definitions violated the C and C++ specs. According to
the specs, identifiers that begins with an underscore followed by an
uppercase letter are reserved. (It's pedantic, I know), See the Github
issue referenced below.

References: https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/issues/7
References: 6ebba1f630
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: mesa-stable@lists.freedesktop.org
2017-01-12 09:42:32 -08:00
George Kyriazis a61528fa33 Always defer memory free in swr_resource_destroy
Defer delete on regular resources.  This ensures that any work being done
on the resource is completed before freeing up the resource's memory.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
2017-01-12 09:10:15 -06:00
Juan A. Suarez Romero ce44501ea8 nir/i965: assert first is always less than 64
This fixes a defect detected by Coverity Scan.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
2017-01-12 15:08:05 +00:00
Samuel Pitoiset f0997e2aa8 nvc0: enable GL 4.3 on gm107+
Although, arb_shader_image_load_store-atomicity will most likely
hang your box, I think it's now quite reasonable to enable GL 4.3
on Maxwell/Pascal GPUs. I suspect that test to be wrong because
it doesn't even work on the NVIDIA blob.

I have tested a bunch of benchmarks (UE4 demos) and real games
like Shadow of Mordor and they all work fine.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2017-01-12 15:22:21 +01:00
Samuel Pitoiset 38ff9980d7 nvc0: use sched control codes for gm107 MP counters code
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
2017-01-12 15:22:15 +01:00
Samuel Pitoiset 75e6992379 nvc0: use sched control codes for gm107 blitter shader
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
2017-01-12 15:22:07 +01:00
Samuel Pitoiset 90537d6a89 nv50/ir: use sched control codes for gm107 builtins
Yes, IMUL/IMAD require dependency barriers and we should
definitely replace these instructions by XMAD but the
different flags need to be figured out. Note that XMAD only
supports 16-bits integers.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
2017-01-12 15:22:01 +01:00
Samuel Pitoiset f519c47f7d nv50/ir: improve instruction pipelining on gm107
This makes use of scheduling control codes which are very useful
for improving the instruction pipelining.

This patch will increase performance on Maxwell GPUs by, at least,
x1.5 up to x3.5 for some benchmarks.

Although this has been fairly well tested, I would not be suprised
if someone hit a corner case somewhere. That way, the scheduler
is enabled by default but it can be deactivated by using
NV50_PROG_SCHED=0.

Thanks to Scott Gray for the reverse engineering work available from
https://github.com/NervanaSystems/maxas/wiki/Control-Codes.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Pierre Moreau <pierre.morrow@free.fr>
Tested-by: Alexandre Courbot <acourbot@nvidia.com>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
2017-01-12 15:21:54 +01:00
Samuel Pitoiset 1b3b4196f0 nv50/ir: do not insert texture barriers on gm107
It's actually useless to insert those texture barriers post RA
because the current control code (ie. st 0x0) will wait for all
dependencies before issuing a new instruction.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
2017-01-12 15:21:47 +01:00
Juan A. Suarez Romero 75968a668e i965/gen7: expose OpenGL 4.2 on Haswell when supported
GL_ARB_vertex_attrib_64bit was the last piece missing.

v2: update docs (Jordan)

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2017-01-12 12:56:57 +01:00
Samuel Iglesias Gonsálvez 77077986eb i965: enable ARB_shader_precision to HSW+
v2: update docs (Jordan)

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2017-01-12 12:56:57 +01:00
Samuel Iglesias Gonsálvez 1d1ddbaa56 i965: unify the code to enable of ARB_gpu_shader_fp64 and ARB_vertex_attrib_64bit for HSW+
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2017-01-12 12:56:56 +01:00
Alejandro Piñeiro 485955be9c i965: Enable ARB_vertex_attrib_64bit for Haswell
v2: update docs (Jordan)

Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2017-01-12 12:56:56 +01:00
Juan A. Suarez Romero 6bb4255f8e i965: check for dual slot attributes on any gen
Those not supporting 64 bit input vertex attributes will have the
dual_slot value as false.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2017-01-12 12:56:56 +01:00
Juan A. Suarez Romero f51a5b51ab i965/vec4: emit correctly load_inputs for 64bit data
For dvec3 and dvec4 types, a single GRF do not have enough space to
allocate two inputs from two different vertices (SIMD4x2).

So the GRF only contains first two components for the two vertices, and
the next GRF has the remaining components.

We want to put all the components for the same vertex in the same
register. Thus, we do a shuffle to reorder the data.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2017-01-12 12:56:56 +01:00
Alejandro Piñeiro 58fdb85f0f i965/vec4: take into account doubles when creating attribute mapping
Doubles needs more that one slot per attribute. So when filling the
attribute_map we check if it is a double in order to allocate one
extra register.

Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2017-01-12 12:56:56 +01:00