Commit Graph

110684 Commits

Author SHA1 Message Date
Julien Isorce 1cec049d4d radeonsi: implement resource_get_info
Re-use existing si_texture_get_offset.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110443
Signed-off-by: Julien Isorce <jisorce@oblong.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2019-04-30 17:53:12 +00:00
Julien Isorce a3c202de0a gallium: add resource_get_info to pipe_screen
Generic plumbing.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110443
Signed-off-by: Julien Isorce <jisorce@oblong.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2019-04-30 17:53:12 +00:00
Rob Clark ec6c229763 freedreno/ir3: fixes for half reg in/out
Needs to update max_half_reg, or be remapped to full reg and update
max_reg accordingly, depending on generation..

Signed-off-by: Rob Clark <robdclark@chromium.org>
2019-04-30 10:39:24 -07:00
Axel Davy ce57f4f7c4 st/nine: Check discard_delayed_release is set before allocating more
When discard_delayed_release is set (default), we allocate more buffers
and use a different buffer wait path.
Check if it is set, and use the old paths if not
(the alternative buffer wait path could still be used, but there is no
advantage to using it in this case).

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy b71c300c70 st/nine: Throttle rendering similarly for thread_submit
thread_submit's throttling depending on the number of internal
back buffers, and wasn't affected by the driver requested
throttling value.
Now it is.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy 562f5a35c8 st/nine: Optimize a bit writeonly buffers
Optimize writeonly by passing PIPE_TRANSFER_WRITE
for these buffers instead of the safer
PIPE_TRANSFER_READ_WRITE.

This seems to improve the performance of d3d8 games
using d3d8to9.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy 92117c989c st/nine: Use TGSI_SEMANTIC_GENERIC for fog
We used TGSI_SEMANTIC_FOG for fog,
however on vs/ps 3, fog is allowed to have
4 components (even on the ff pipeline according
to a wine test).
Since gallium's TGSI_SEMANTIC_FOG has only one
component, use TGSI_SEMANTIC_GENERIC instead.

Fixes:
https://github.com/iXit/Mesa-3D/issues/346

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy bade3bf615 st/nine: Enable computing const_ranges
All the pieces for constant compact are ready,
thus enable the path.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy 5c67db6889 st/nine: Handle const_ranges in nine_state
Handle slot mapping if there is one.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy 9942ba2ea3 st/nine: Cache constant buffer size
The shader constant buffer size with the
constant compaction code can vary depending
on the shader variant compiled (for example if
fog constants are required, etc).
Thus instead of using fixed size for the shader,
add in the variant cache the size required, pass it
to the context, and use this value.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy a3cdc466e7 st/nine: Propagate const_range to context
As with the constant compaction we map the constant
slots to new slots, we need to pass that information
to the context which is in charge of uploading
the constants.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy 7761cda686 st/nine: Prepare constant compaction in nine_shader
When indirect addressing is not used, we know exactly
which constants are accessed, and thus can
have them located in consecutive slots.
We thus parse again the shader with a slot map
for compaction.

The path contains the work inside nine_shader.c for this
path, but it needs some other commits to work, and thus
is not enabled yet by this commit.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:52 +02:00
Axel Davy db404507b4 st/nine: Refactor counting of constants
Track the number of slots used

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 737df40a63 st/nine: Track constant slots used
This tracking will be useful for constant compaction

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy d2cab4562c st/nine: Refactor ct_ctor
The refactoring will make it easier to parse the shader
twice for the constant compaction path.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 6f3da226e6 st/nine: Make swvp_on imply IS_VS
swvp cannot happen with ps, thus it makes
sense to force it to false with ps.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy d57d1436d3 st/nine: Refactor shader constants ureg_src computation
Put the shader constant code in one place to better change
that code in future commits.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 6d86292f8a st/nine: Manually upload vs and ps constants
In future commits we will introduce more fine-grained
uploads

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 1ddeb43537 st/nine: use helper ureg_DECL_sampler everywhere
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 3717ec4157 st/nine: Compact pixel shader key
Compact the shader key to make room for new
elements.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 2acbd977d7 st/nine: Compact nine_ff_get_projected_key
Only the first four sampler slots can be used
by ff ps < 0x14, thus the size of the key
can be reduced.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy a92a43d41d st/nine: Refactor param->rel
Refactor param->rel to enable different paths
for constants and inputs relative addressing.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 5974401a4a st/nine: Regroup param->rel tests
Regroup all the param->rel assertions into one assertion for better clarity
and better covering.
param->rel on an input can only happen with float constants for vs,
or with inputs on vs/ps 3.0.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 12654a2fda st/nine: Control shader constant inlining with drirc
Until we use async shader compilation for constant inlining,
don't enable it unless user asks for it.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 95f25bef54 st/nine: Recompile optimized shaders based on b/i consts
Boolean and Integer constants are used in d3d9 for flow control.

Boolean are used for if/then/else and Integer constants
for loops.
The compilers can generate better code if these values are known
at compilation.
I haven't met so far a game that would change the values of these
constants frequently (and when they do, they set to the values used
for the previous draw call, and thus the changes get filtered out).

Thus it makes sense to inline these constants and recompile the shaders.
The commit sets a bound to the number of variants for a given shader
to avoid too many shaders to be generated.

One drawback is it means more shader compilations. It would probably
make sense to compile these shaders asynchronously or let the user
control the behaviour with an env var, but this is not done here.

The games I tested hit very few shader variants, and the performance
impact was negligible, but it could help for games with uber shaders.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy e57267a09e drirc: Add Gallium nine workaround for Rayman Legends
The game requires it to display many textures properly.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy c097ff3617 st/nine: Add drirc option to use data_internal for dynamic textures
dynamic textures seem to have predictable stride. This stride
should be the same as for a ram buffer.

It seems some game don't check the actual stride value, assuming
it to be the expected one.
Thus this workaround (protected by drirc option) is to use an intermediate
ram buffer.

Fixes Rayman Legends texture issues when enabled.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 7dcc85b46e st/nine: Support internal compressed format for volumes
Reuse the generic path to support compressed formats.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 1b0a7d0557 st/nine: Support internal compressed format for surfaces
Reuse the generic path to support compressed formats.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 22c41d2d81 st/nine: Refactor volume GetSystemMemPointer
It will make it easier to reuse in another place.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:51 +02:00
Axel Davy 85c9d92067 st/nine: Refactor surface GetSystemMemPointer
It will make it easier to reuse in another place.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:50 +02:00
Axel Davy 8ba4f73911 st/nine: rename *_conversion to *_internal
Rename these variables to a new name which will
fit new usages introduced in later commits.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:50 +02:00
Axel Davy 4a51a7c1da st/nine: Optimize volume upload with conversion
Use nine_context_box_upload instead of locking the pipe
for volume upload with format conversion.
nine_context_box_upload already handles format
conversion.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:50 +02:00
Axel Davy fac3f99377 st/nine: Optimize surface upload with conversion
Use nine_context_box_upload instead of locking the pipe
for surface upload with format conversion.
nine_context_box_upload already handles format
conversion.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:50 +02:00
Axel Davy 4ca6b1dfd1 st/nine: Fix SINCOS input
SINCOS takes an input with replicated swizzle.
the swizzle can be on any component, not just x.
Enable it to read from any component, but also
use a temporary register to avoid dst/src aliasing.

No known game is fixed by this change as it seems
the input swizzle is commonly on x for this instruction,
and src and dst don't alias.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:50 +02:00
Axel Davy f4ae483c44 st/nine: Ignore nooverwrite for systemmem
Systemmem has a specific behaviour we don't
mimick exactly.
That makes Halo feel free to use nooverwrite
with it all the time, even when reading again
at the same location.
Ignore nooverwrite to have proper synchronization.

Fixes: https://github.com/iXit/Mesa-3D/issues/348

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:50 +02:00
Axel Davy fd3a870401 st/nine: Enable modifiers on ps 1.X texcoords
For many ps 1.X instructions, we were reading the
texcoords directly, instead of through tx_src_param,
resulting in modifiers getting ignored.
Use tx_src_param for all these instructions.

Fixes: https://github.com/iXit/Mesa-3D/issues/337

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:50 +02:00
Axel Davy 1fc0714039 st/nine: Always return OK on SetSoftwareVertexProcessing
This would need more tests to know exactly
if INVALIDCALL can be returned in some
situations.
It seems some games expect D3D_OK,
even when noop and illegal.

Fixes:
https://github.com/iXit/Mesa-3D/issues/302
https://github.com/iXit/Mesa-3D/issues/338

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:50 +02:00
Axel Davy d9a4025fa3 st/nine: Finish if nooverwrite after normal mapping
d3d's nooverwrite and gallium's unsynchronized
have different semantics.
Indeed nooverwrite says the applications won't
write to locations needed by previous draws,
which is less strong than unsynchronized which
won't synchronize previous writes.

Thus in case app is locking without discard/nooverwrite,
then using nooverwrite, we need to add a
synchronization.

Fixes: https://github.com/iXit/wine-nine-standalone/issues/29

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:50 +02:00
Axel Davy e502c4d892 st/nine: Fix buffer/texture unbinding in nine_state_clear
Previously nine_state_clear was not using
NineBindBufferToDevice and NineBindTextureToDevice
to unbind buffers and textures (but used nine_bind)

This was resulting in an uncorrect bind count for these
resources.

Combined with
0ec4e5f630
Some buffers were scheduled to be uploaded directly
after they were locked (because the bind count incorrectly
assumed they were needed for the next draw call),
which resulted in uploads before the data was written.

To simplify a bit the code (and because I needed to
add a pointer to device),
remove the stateblock usage from nine_state_clear and
rename to nine_device_state_clear.

Fixes:
https://github.com/iXit/Mesa-3D/issues/345

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:50 +02:00
Axel Davy bb3b8f8e01 st/nine: Upload managed buffers only at draw using them
When a draw call is emited, buffers in the
device->update_buffers list are uploaded.

This patch removes buffers from the list if they
are not bound anymore.

Behaviour found studying:
https://github.com/iXit/Mesa-3D/issues/345

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:50 +02:00
Axel Davy 5df96995ef st/nine: Upload managed textures only at draw using them
When a draw call is emited, textures in the
device->update_textures list are uploaded.

This patch removes textures from the list if they
are not bound anymore.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:50 +02:00
Axel Davy 394420ebb3 st/nine: Use FLT_MAX/2 for RCP clamping
This seems to fix Rayman (which adds things
to the RCP result, and thus gets an Inf),
while not having regressions.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:49 +02:00
Axel Davy 64a45ba7f8 st/nine: Fix D3DWindowBuffer_release for old wine nine support
No-one reported bugs for that, but is seems
c442dd7890
and previous commits used APIs not defined until
nine minor version 3.
This patch should prevent crash in this case.

Also turn off the resize feature in this case,
as we won't prevent a buffer leak anymore.

Cc: "19.0" mesa-stable@lists.freedesktop.org
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-04-30 19:18:49 +02:00
Eric Engestrom 0cff98c8a0 turnip: update to use the new features struct names
These were updated in version 1.1.106 of vulkan.h to make more sense
with the extension names.  We may as well keep with the times.

See also: 90108deb27 "anv: Update to use the new features struct names"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
2019-04-30 16:55:38 +01:00
Eric Engestrom 941b2f4dcd radv: update to use the new features struct names
These were updated in version 1.1.106 of vulkan.h to make more sense
with the extension names.  We may as well keep with the times.

See also: 90108deb27 "anv: Update to use the new features struct names"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2019-04-30 16:55:18 +01:00
Eric Engestrom b80930a6fe anv: add support for VK_EXT_memory_budget
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2019-04-30 15:40:33 +00:00
Eric Engestrom 316964709e util: add os_read_file() helper
readN() taken from igt.
os_read_file() inspired by igt_sysfs_get()

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2019-04-30 15:40:33 +00:00
Rafael Antognolli 2fae99bcbd iris: Enable fast clear colors on gen11.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-04-30 08:31:44 -07:00
Rafael Antognolli cf3cadacdf iris: Update the surface state clear color address when available.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-04-30 08:31:44 -07:00