mesa.git
5 years agovirgl: Allow transfer queue entries to be found and extended.
David Riley [Wed, 24 Apr 2019 23:11:37 +0000 (16:11 -0700)]
virgl: Allow transfer queue entries to be found and extended.

Intersecting transfer queue entries allow for the possibility of
extending an existing transfer instead of creating a new one (and all
the associated mappign/unmapping).

Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agovirgl: Store mapped hw resource with transfer object.
David Riley [Wed, 1 May 2019 00:33:59 +0000 (17:33 -0700)]
virgl: Store mapped hw resource with transfer object.

Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agoiris: Fix imageBuffer and PBO download.
Kenneth Graunke [Wed, 1 May 2019 18:16:13 +0000 (11:16 -0700)]
iris: Fix imageBuffer and PBO download.

Recently we added checks to try and deny multisampled shader images.
Unfortunately, this messed up imageBuffers, which have sample_count = 0,
which are also used in PBO download, causing us hit CPU map fallbacks.

Fixes: b15f5cfd20c iris: Do not advertise multisampled image load/store.
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
5 years agor600: reset tex array override even when no view bound
Dave Airlie [Wed, 1 May 2019 04:30:10 +0000 (14:30 +1000)]
r600: reset tex array override even when no view bound

If no view is bound we still should reset the override to 0
and array mode.

This should fix misrendering in firefox WebRender since
the pbo sampler was removed.

Fixes: 1250383e36 (st/mesa: remove sampler associated with buffer texture in pbo logic)
5 years agonir: Saturating integer arithmetic is not associative
Ian Romanick [Tue, 30 Apr 2019 15:00:32 +0000 (08:00 -0700)]
nir: Saturating integer arithmetic is not associative

In 8-bits,

    iadd_sat(iadd_sat(0x7f, 0x7f), -1) =
    iadd_sat(0x7f, -1) =
    0x7e

but,

    iadd_sat(0x7f, iadd_sat(0x7f, -1)) =
    iadd_sat(0x7f, 0x7e) =
    0x7f

Fixes: 272e927d0e9 ("nir/spirv: initial handling of OpenCL.std extension opcodes")
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoutil: move #include out of #if linux
Eric Engestrom [Wed, 1 May 2019 15:25:44 +0000 (16:25 +0100)]
util: move #include out of #if linux

This #include is needed for `NULL`, which is used on all OSes, not just Linux.

Reported-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Fixes: 316964709e21286c2af5 "util: add os_read_file() helper"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
5 years agoswr/rast: Add general SWTag statistics
Alok Hota [Mon, 17 Sep 2018 19:50:47 +0000 (14:50 -0500)]
swr/rast: Add general SWTag statistics

Update Archrast parser to use stats, used with an internal tool

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
5 years agoswr/rast: Add string handling to AR event framework
Alok Hota [Fri, 7 Sep 2018 20:17:53 +0000 (15:17 -0500)]
swr/rast: Add string handling to AR event framework

For use by an internal tool

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
5 years agoswr/rast: Add initial SWTag proto definitions
Alok Hota [Tue, 4 Sep 2018 18:41:39 +0000 (13:41 -0500)]
swr/rast: Add initial SWTag proto definitions

Update gen_archrast.py to properly generate event IDs

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
5 years agoswr/rast: Cleanup and generalize gen_archrast
Alok Hota [Fri, 31 Aug 2018 17:13:56 +0000 (12:13 -0500)]
swr/rast: Cleanup and generalize gen_archrast

- Update meson.build
  - Includes current_build_dir() fix
    meson/swr: replace hard-coded path with current_build_dir()

Fixes: 93cd9905c8fbb98985ae "swr/rast: Cleanup and generalize gen_archrast"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Alok Hota <alok.hota@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
  - Clean up meson.build (remove foreach loop, replace with single call)
- Update SConscript
  - use `$SOURCES` to call `CodeGenerate` with multiple source files

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
5 years agogitlab-ci: build vulkan drivers in clang build
Eric Engestrom [Wed, 1 May 2019 11:09:26 +0000 (12:09 +0100)]
gitlab-ci: build vulkan drivers in clang build

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
5 years agosoftpipe: setup pixel_offset for all primitive types
Erik Faye-Lund [Tue, 30 Apr 2019 11:41:39 +0000 (13:41 +0200)]
softpipe: setup pixel_offset for all primitive types

If we don't update this for all primitive-types, we end up rendering
slightly offset points and lines up until the point where the first
triangle gets drawn. This is obviously not correct, and violates
OpenGL's repeatability rule.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Fixes: ca9c413647b ("softpipe: Respect gl_rasterization_rules in
       primitive setup.")
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
5 years agonir: improve convert_yuv_to_rgb
Jonathan Marek [Fri, 30 Nov 2018 02:43:12 +0000 (21:43 -0500)]
nir: improve convert_yuv_to_rgb

Use a different arrangement of constants to allow more ffma.

A vec4 backend will now use 3 fma for yuv_to_rgb. On freedreno/ir3, it is
down from 10 to 7 alu (4 fma, 3 mul, 3 add to 7 fma). Other backends
shouldn't be hurt.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
5 years agodoc: Update feature matrix
Gert Wollny [Wed, 24 Apr 2019 08:31:45 +0000 (10:31 +0200)]
doc: Update feature matrix

Since softpipe doesn't truely support multisample, I've not added softpipe
to the "Enhanced per-sample shading" even though with the advertised GLSL
level ARB_gpu_shader5 is advertised.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agosoftpipe: Increase the GLSL feature level
Gert Wollny [Wed, 24 Apr 2019 08:29:13 +0000 (10:29 +0200)]
softpipe: Increase the GLSL feature level

This will enable calls to the interpolateAt* functions, but also a bunch
of other features.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agosoftpipe: Add support for TGSI_OPCODE_INTERP_CENTROID
Gert Wollny [Wed, 24 Apr 2019 07:58:32 +0000 (09:58 +0200)]
softpipe: Add support for TGSI_OPCODE_INTERP_CENTROID

Like with interpolatAtSample this is also not really implementing the
according sampling and will only work correctly for pixels that are fully
covered, but since softpipe only supports one sample this is good enough
for now.

v2: Correct spelling (Roland Scheidegger)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agosoftpipe: Add support for TGSI_OPCODE_INTERP_OFFSET
Gert Wollny [Wed, 24 Apr 2019 07:53:56 +0000 (09:53 +0200)]
softpipe: Add support for TGSI_OPCODE_INTERP_OFFSET

Since for this opcode the offsets are given manually the function
should actually also work for non-zero offsets, but the related piglits
only ever test with offset 0. Accordingly the patch satisfies
"fs-interpolateatoffset-*".

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agosoftpipe: Add (fake) support for TGSI_OPCODE_INTERP_SAMPLE
Gert Wollny [Wed, 24 Apr 2019 07:50:01 +0000 (09:50 +0200)]
softpipe: Add (fake) support for TGSI_OPCODE_INTERP_SAMPLE

Softpipe doesn't support more than one sample, so this function
implements the interpolation at sample 0 and adds a stub to make it
possible to interpolate at other samples.

As it is this makes the piglits "fs-interpolateatsample-*" pass, but
they only ever test sample 0 anyway.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agosoftpipe: Add an per-input array for interpolator correctors to machine
Gert Wollny [Wed, 24 Apr 2019 07:35:31 +0000 (09:35 +0200)]
softpipe: Add an per-input array for interpolator correctors to machine

This adds entry points for correcting the interpolation values if the
interpolation is done by using one of the interpolateAt* functions.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agosoftpipe: Factor out evaluation of the source indices
Gert Wollny [Wed, 24 Apr 2019 07:28:46 +0000 (09:28 +0200)]
softpipe: Factor out evaluation of the source indices

We will need these for per sample interpolation as well

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agosoftpipe: evaluate cube the faces on a per sample bases
Gert Wollny [Fri, 19 Apr 2019 07:26:49 +0000 (09:26 +0200)]
softpipe: evaluate cube the faces on a per sample bases

Now that the LOD is evaluated up front the cube faces can also be
evauate on a per sample basis instead of using the quad.

This fixes a large number of deqp gles 3 and 31 cube texture tests.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agosoftpipe: keep input lod for explicite derivatives
Gert Wollny [Fri, 19 Apr 2019 08:41:51 +0000 (10:41 +0200)]
softpipe: keep input lod for explicite derivatives

This only affects anisotropic interpolation.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agosoftpipe: tie in new code path for lod evaluation
Gert Wollny [Fri, 19 Apr 2019 07:21:54 +0000 (09:21 +0200)]
softpipe: tie in new code path for lod evaluation

This enables the use of explicit gradients.

Also remove an unused parameter when changing the interfaces.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agosoftpipe: Move selection of shadow values up and clean parameter list
Gert Wollny [Fri, 19 Apr 2019 11:29:04 +0000 (13:29 +0200)]
softpipe: Move selection of shadow values up and clean parameter list

The shadow evaluation compare parameter is stored in different locations,
depending on the texture type. Move the values to a common location free
the lod storage and to be able to reduce the number of parameters.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agosoftpipe: Pipe gather_comp through from st_tgsi_get_samples
Gert Wollny [Fri, 19 Apr 2019 07:03:51 +0000 (09:03 +0200)]
softpipe: Pipe gather_comp through from st_tgsi_get_samples

The value is stored in the lod components and this will be overwritten
when swithcing to the new code path.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agosoftpipe: Prepare handling explicit gradients
Gert Wollny [Fri, 19 Apr 2019 06:43:05 +0000 (08:43 +0200)]
softpipe: Prepare handling explicit gradients

This only adds corde that is not yet enabled.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agosoftpipe: Factor gradient evaluation out of the lambda evaluation
Gert Wollny [Fri, 19 Apr 2019 06:37:00 +0000 (08:37 +0200)]
softpipe: Factor gradient evaluation out of the lambda evaluation

this is useful when we want to use explicit gradients.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agoegl: return correct error code for a case req ver < 3 with forward-compatible
Andrii Simiklit [Thu, 11 Oct 2018 10:53:21 +0000 (13:53 +0300)]
egl: return correct error code for a case req ver < 3 with forward-compatible

The EGL_KHR_create_context spec says:
   "If an OpenGL context is requested and the values for attributes
    EGL_CONTEXT_MAJOR_VERSION_KHR and EGL_CONTEXT_MINOR_VERSION_KHR,
    when considered together with the value for attribute
    EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR, specify an OpenGL
    version and feature set that are not defined, than an
    EGL_BAD_MATCH error is generated."

This case is already correctly handled a bit below in
the same source file.
The correct handling was added by commit: 63beb3df

Reported-by: Ian Romanick <idr@freedesktop.org>
Here: https://bugzilla.freedesktop.org/show_bug.cgi?id=92552#c9
Fixes: 11cabc45b712 "egl: rework handling EGL_CONTEXT_FLAGS"
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
5 years agoradeonsi/nir: call radeonsi nir opts before the scan pass
Timothy Arceri [Thu, 25 Apr 2019 07:02:51 +0000 (17:02 +1000)]
radeonsi/nir: call radeonsi nir opts before the scan pass

Some of the opts are not called in the general optimastion loop
in the state trackers glsl -> nir conversion. We need to call
the radeonsi specific optimisation once before scanning over
the nir otherwise we can end up gathering info on code that
is later removed.

Fixes an assert in the piglit test:

./bin/varying-struct-centroid_gles3

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoradeonsi/nir: create si_nir_opts() helper
Timothy Arceri [Thu, 25 Apr 2019 07:02:50 +0000 (17:02 +1000)]
radeonsi/nir: create si_nir_opts() helper

We will make use of this in the following commit.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoswr/rast: early exit on empty triangle mask
Alok Hota [Wed, 12 Sep 2018 19:18:28 +0000 (14:18 -0500)]
swr/rast: early exit on empty triangle mask

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
5 years agoswr/rast: add guards for cpuid on Linux
Alok Hota [Wed, 12 Sep 2018 16:53:05 +0000 (11:53 -0500)]
swr/rast: add guards for cpuid on Linux

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
5 years agoswr/rast: add flat shading
Alok Hota [Wed, 12 Sep 2018 01:01:36 +0000 (20:01 -0500)]
swr/rast: add flat shading

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
5 years agoswr/rast: add SWR_STATIC_ASSERT() macro
Alok Hota [Wed, 20 Jun 2018 17:16:36 +0000 (12:16 -0500)]
swr/rast: add SWR_STATIC_ASSERT() macro

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
5 years agoswr/rast: update guardband rects at draw setup
Alok Hota [Wed, 13 Jun 2018 20:14:16 +0000 (15:14 -0500)]
swr/rast: update guardband rects at draw setup

It's dependent on other state fields

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
5 years agoswr/rast: add more llvm intrinsics
Alok Hota [Tue, 5 Jun 2018 05:16:27 +0000 (00:16 -0500)]
swr/rast: add more llvm intrinsics

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
5 years agost/va: properly set stride and offset in vlVaDeriveImage
Julien Isorce [Tue, 23 Apr 2019 21:30:06 +0000 (14:30 -0700)]
st/va: properly set stride and offset in vlVaDeriveImage

Using the new resource_get_info function.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110443
Signed-off-by: Julien Isorce <jisorce@oblong.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
5 years agoradeonsi: implement resource_get_info
Julien Isorce [Tue, 23 Apr 2019 21:28:48 +0000 (14:28 -0700)]
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>
5 years agogallium: add resource_get_info to pipe_screen
Julien Isorce [Tue, 23 Apr 2019 21:26:33 +0000 (14:26 -0700)]
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>
5 years agofreedreno/ir3: fixes for half reg in/out
Rob Clark [Mon, 29 Apr 2019 20:12:31 +0000 (13:12 -0700)]
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>
5 years agost/nine: Check discard_delayed_release is set before allocating more
Axel Davy [Sat, 27 Apr 2019 13:33:22 +0000 (15:33 +0200)]
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>
5 years agost/nine: Throttle rendering similarly for thread_submit
Axel Davy [Sat, 27 Apr 2019 13:25:35 +0000 (15:25 +0200)]
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>
5 years agost/nine: Optimize a bit writeonly buffers
Axel Davy [Wed, 24 Apr 2019 21:24:40 +0000 (23:24 +0200)]
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>
5 years agost/nine: Use TGSI_SEMANTIC_GENERIC for fog
Axel Davy [Tue, 9 Apr 2019 20:52:28 +0000 (22:52 +0200)]
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>
5 years agost/nine: Enable computing const_ranges
Axel Davy [Mon, 21 Jan 2019 21:59:24 +0000 (22:59 +0100)]
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>
5 years agost/nine: Handle const_ranges in nine_state
Axel Davy [Mon, 21 Jan 2019 21:50:01 +0000 (22:50 +0100)]
st/nine: Handle const_ranges in nine_state

Handle slot mapping if there is one.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
5 years agost/nine: Cache constant buffer size
Axel Davy [Wed, 23 Jan 2019 21:48:17 +0000 (22:48 +0100)]
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>
5 years agost/nine: Propagate const_range to context
Axel Davy [Mon, 21 Jan 2019 21:40:25 +0000 (22:40 +0100)]
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>
5 years agost/nine: Prepare constant compaction in nine_shader
Axel Davy [Sun, 20 Jan 2019 21:55:01 +0000 (22:55 +0100)]
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>
5 years agost/nine: Refactor counting of constants
Axel Davy [Sun, 20 Jan 2019 20:35:45 +0000 (21:35 +0100)]
st/nine: Refactor counting of constants

Track the number of slots used

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
5 years agost/nine: Track constant slots used
Axel Davy [Sun, 20 Jan 2019 21:05:54 +0000 (22:05 +0100)]
st/nine: Track constant slots used

This tracking will be useful for constant compaction

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
5 years agost/nine: Refactor ct_ctor
Axel Davy [Sun, 20 Jan 2019 21:05:30 +0000 (22:05 +0100)]
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>
5 years agost/nine: Make swvp_on imply IS_VS
Axel Davy [Sun, 20 Jan 2019 20:43:19 +0000 (21:43 +0100)]
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>
5 years agost/nine: Refactor shader constants ureg_src computation
Axel Davy [Sun, 20 Jan 2019 19:57:01 +0000 (20:57 +0100)]
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>
5 years agost/nine: Manually upload vs and ps constants
Axel Davy [Sun, 20 Jan 2019 19:44:17 +0000 (20:44 +0100)]
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>
5 years agost/nine: use helper ureg_DECL_sampler everywhere
Axel Davy [Sun, 20 Jan 2019 10:25:47 +0000 (11:25 +0100)]
st/nine: use helper ureg_DECL_sampler everywhere

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
5 years agost/nine: Compact pixel shader key
Axel Davy [Sun, 13 Jan 2019 21:25:46 +0000 (22:25 +0100)]
st/nine: Compact pixel shader key

Compact the shader key to make room for new
elements.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
5 years agost/nine: Compact nine_ff_get_projected_key
Axel Davy [Sun, 13 Jan 2019 21:16:35 +0000 (22:16 +0100)]
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>
5 years agost/nine: Refactor param->rel
Axel Davy [Thu, 5 Apr 2018 20:38:03 +0000 (22:38 +0200)]
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>
5 years agost/nine: Regroup param->rel tests
Axel Davy [Thu, 5 Apr 2018 20:31:27 +0000 (22:31 +0200)]
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>
5 years agost/nine: Control shader constant inlining with drirc
Axel Davy [Sat, 27 Apr 2019 16:30:02 +0000 (18:30 +0200)]
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>
5 years agost/nine: Recompile optimized shaders based on b/i consts
Axel Davy [Sun, 8 Apr 2018 15:06:00 +0000 (17:06 +0200)]
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>
5 years agodrirc: Add Gallium nine workaround for Rayman Legends
Axel Davy [Sat, 27 Apr 2019 17:18:00 +0000 (19:18 +0200)]
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>
5 years agost/nine: Add drirc option to use data_internal for dynamic textures
Axel Davy [Wed, 10 Apr 2019 21:09:08 +0000 (23:09 +0200)]
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>
5 years agost/nine: Support internal compressed format for volumes
Axel Davy [Wed, 10 Apr 2019 21:05:58 +0000 (23:05 +0200)]
st/nine: Support internal compressed format for volumes

Reuse the generic path to support compressed formats.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
5 years agost/nine: Support internal compressed format for surfaces
Axel Davy [Wed, 10 Apr 2019 21:03:06 +0000 (23:03 +0200)]
st/nine: Support internal compressed format for surfaces

Reuse the generic path to support compressed formats.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
5 years agost/nine: Refactor volume GetSystemMemPointer
Axel Davy [Wed, 10 Apr 2019 20:53:02 +0000 (22:53 +0200)]
st/nine: Refactor volume GetSystemMemPointer

It will make it easier to reuse in another place.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
5 years agost/nine: Refactor surface GetSystemMemPointer
Axel Davy [Wed, 10 Apr 2019 20:48:51 +0000 (22:48 +0200)]
st/nine: Refactor surface GetSystemMemPointer

It will make it easier to reuse in another place.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
5 years agost/nine: rename *_conversion to *_internal
Axel Davy [Wed, 10 Apr 2019 20:38:43 +0000 (22:38 +0200)]
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>
5 years agost/nine: Optimize volume upload with conversion
Axel Davy [Wed, 10 Apr 2019 20:21:48 +0000 (22:21 +0200)]
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>
5 years agost/nine: Optimize surface upload with conversion
Axel Davy [Wed, 10 Apr 2019 20:16:54 +0000 (22:16 +0200)]
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>
5 years agost/nine: Fix SINCOS input
Axel Davy [Sat, 13 Apr 2019 10:25:57 +0000 (12:25 +0200)]
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>
5 years agost/nine: Ignore nooverwrite for systemmem
Axel Davy [Fri, 12 Apr 2019 22:39:59 +0000 (00:39 +0200)]
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>
5 years agost/nine: Enable modifiers on ps 1.X texcoords
Axel Davy [Wed, 10 Apr 2019 19:07:29 +0000 (21:07 +0200)]
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>
5 years agost/nine: Always return OK on SetSoftwareVertexProcessing
Axel Davy [Tue, 9 Apr 2019 21:57:37 +0000 (23:57 +0200)]
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>
5 years agost/nine: Finish if nooverwrite after normal mapping
Axel Davy [Wed, 24 Apr 2019 21:58:38 +0000 (23:58 +0200)]
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>
5 years agost/nine: Fix buffer/texture unbinding in nine_state_clear
Axel Davy [Thu, 4 Apr 2019 21:08:35 +0000 (23:08 +0200)]
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
0ec4e5f630ed68ece3f176b174cfd66eff023904
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>
5 years agost/nine: Upload managed buffers only at draw using them
Axel Davy [Thu, 4 Apr 2019 21:06:44 +0000 (23:06 +0200)]
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>
5 years agost/nine: Upload managed textures only at draw using them
Axel Davy [Thu, 4 Apr 2019 21:01:08 +0000 (23:01 +0200)]
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>
5 years agost/nine: Use FLT_MAX/2 for RCP clamping
Axel Davy [Fri, 22 Feb 2019 19:41:00 +0000 (20:41 +0100)]
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>
5 years agost/nine: Fix D3DWindowBuffer_release for old wine nine support
Axel Davy [Sat, 27 Apr 2019 13:45:12 +0000 (15:45 +0200)]
st/nine: Fix D3DWindowBuffer_release for old wine nine support

No-one reported bugs for that, but is seems
c442dd789066104e5e84cc90d98a7ff5cd6296cf
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>
5 years agoturnip: update to use the new features struct names
Eric Engestrom [Tue, 23 Apr 2019 12:48:39 +0000 (13:48 +0100)]
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: 90108deb277d33d19233 "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>
5 years agoradv: update to use the new features struct names
Eric Engestrom [Tue, 23 Apr 2019 12:47:10 +0000 (13:47 +0100)]
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: 90108deb277d33d19233 "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>
5 years agoanv: add support for VK_EXT_memory_budget
Eric Engestrom [Tue, 8 Jan 2019 12:45:38 +0000 (12:45 +0000)]
anv: add support for VK_EXT_memory_budget

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoutil: add os_read_file() helper
Eric Engestrom [Mon, 28 Jan 2019 15:44:12 +0000 (15:44 +0000)]
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>
5 years agoiris: Enable fast clear colors on gen11.
Rafael Antognolli [Wed, 3 Apr 2019 00:03:57 +0000 (17:03 -0700)]
iris: Enable fast clear colors on gen11.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoiris: Update the surface state clear color address when available.
Rafael Antognolli [Wed, 3 Apr 2019 00:10:26 +0000 (17:10 -0700)]
iris: Update the surface state clear color address when available.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoiris: Use the linear version of the surface format during fast clears.
Rafael Antognolli [Tue, 23 Apr 2019 22:18:01 +0000 (15:18 -0700)]
iris: Use the linear version of the surface format during fast clears.

Newer gens (> 9) will start doing the linear -> sRGB conversion of the
clear color for us, if we use a sRGB surface format. So let's make sure
that doesn't happen and keep the same semantics as before.

Even though the hardware could convert the clear color for us during
fast clear, that converted color is only used for sampling. For resolve,
the original color would be used (without the conversion). So we convert
it ourselves and the same converted color gets used for both sampling
and resolving, simplifying the whole logic.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoiris: Support sRGB fast clears even if the colorspaces differ.
Rafael Antognolli [Fri, 19 Apr 2019 00:47:36 +0000 (17:47 -0700)]
iris: Support sRGB fast clears even if the colorspaces differ.

We were disabling fast clears if the view format had a different
colorspace than the resource format (sRGB vs linear or vice-versa). But
we actually support them if we use the view format to decide if we
should encode the clear color into sRGB colorspace.

Also add a missing linear -> sRGB surface format conversion (we don't
want the clear color to be encoded to sRGB again during resolve).

v2: Do not track sRGB colorspace during fast clears (Nanley).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoegl: fixup autotools-specific wording
Eric Engestrom [Wed, 24 Apr 2019 12:21:18 +0000 (13:21 +0100)]
egl: fixup autotools-specific wording

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
5 years agodocs: haiku can be built using meson
Eric Engestrom [Wed, 24 Apr 2019 12:19:24 +0000 (13:19 +0100)]
docs: haiku can be built using meson

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
5 years agodocs: use past tense when talking about autotools
Eric Engestrom [Wed, 24 Apr 2019 12:19:51 +0000 (13:19 +0100)]
docs: use past tense when talking about autotools

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
5 years agodocs: replace autotools intructions with meson equivalent
Eric Engestrom [Wed, 24 Apr 2019 12:16:57 +0000 (13:16 +0100)]
docs: replace autotools intructions with meson equivalent

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
5 years agodocs: drop autotools python information
Eric Engestrom [Wed, 24 Apr 2019 12:18:12 +0000 (13:18 +0100)]
docs: drop autotools python information

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
5 years agodocs: remove unsupported GL function name mangling
Eric Engestrom [Wed, 24 Apr 2019 11:39:30 +0000 (12:39 +0100)]
docs: remove unsupported GL function name mangling

This was only supported in autotools, which has since been deleted.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
5 years agomesa: Add missing display list support for GL_FOG_COORDINATE_SOURCE
Ian Romanick [Sat, 27 Apr 2019 06:50:47 +0000 (23:50 -0700)]
mesa: Add missing display list support for GL_FOG_COORDINATE_SOURCE

Fixes: fe5d67d95f3 ("Implement EXT_fog_coord and EXT_secondary_color.")
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Cc: Brian Paul <brianp@vmware.com>
5 years agodocs: document MESA_GLSL=errors keyword
Alejandro Piñeiro [Thu, 18 Apr 2019 13:58:35 +0000 (15:58 +0200)]
docs: document MESA_GLSL=errors keyword

Added with commit 0161691f3518, still checked on shaderapi.c
_mesa_get_shader_flag method.

Fixes: 0161691f3518db310411 "mesa: add GLSL_REPORT_ERRORS debug flag"
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agowinsys/svga/drm: Include sys/types.h
Khem Raj [Mon, 25 Feb 2019 20:06:47 +0000 (20:06 +0000)]
winsys/svga/drm: Include sys/types.h

vmw_screen.h uses dev_t which is defines in sys/types.h
this header is required to be included for getting dev_t
definition. This issue happens on musl C library, it is hidden
on glibc since sys/types.h is included through another
system headers

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoRevert "meson: drop GLESv1 .so version back to 1.0.0"
Ross Burton [Mon, 25 Feb 2019 20:06:48 +0000 (20:06 +0000)]
Revert "meson: drop GLESv1 .so version back to 1.0.0"

This patch claimed that the autotools build generates libGLESv1_CM.so.1.0.0, but
it doesn't:

es1api_libGLESv1_CM_la_LDFLAGS = \
        -no-undefined \
        -version-number 1:1 \
        $(GC_SECTIONS) \
        $(LD_NO_UNDEFINED)

Revert commit cc15460e182148292be877bec5a8a61cec57377d to ensure that the
autotools and meson builds produce the same libraries.

Fixes: cc15460e182148292be8 "meson: drop GLESv1 .so version back to 1.0.0"
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
5 years agoanv: enable descriptor indexing capabilities
Juan A. Suarez Romero [Mon, 29 Apr 2019 15:10:24 +0000 (17:10 +0200)]
anv: enable descriptor indexing capabilities

This enables the remaining capabilities in SPV_EXT_descriptor_indexing.

Fixes: 6e230d7607f "anv: Implement VK_EXT_descriptor_indexing"
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>