Commit Graph

37121 Commits

Author SHA1 Message Date
Kenneth Graunke f36794d1f0 iris: Fix backface stencil write condition
A bit too much search and replace here.
2019-03-10 14:52:53 -07:00
Alyssa Rosenzweig ea2cd73625 panfrost/drm: Cast pointer to u64 to fix warning
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
2019-03-10 19:16:56 +00:00
Tomeu Vizoso 756f7b9989 panfrost: Add backend targeting the DRM driver
This backend interacts with the new DRM driver for Midgard GPUs which is
currently in development.

When using this backend, Panfrost has roughly on-par functionality as
when using the non-DRM driver from Arm.

Alyssa Rosenzweig: To do so, we implement additional routines for
runtime GPU version detection and fencing. We cleanup some duplicate
code interfering with the new driver. We fix a long-standing memory leak
which is aggravated on the new driver. Finally, we implement BO
import/export in a way compatible with the new driver. These changes are
squashed to preserve bisectability given the hard-to-track ABI shifts in
the nondrm module

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
2019-03-10 19:09:23 +00:00
Tomeu Vizoso d4dc79df72 panfrost: Add gem_handle to panfrost_memory and panfrost_bo
It will be used by the DRM backend to store GEM handles from the kernel.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
2019-03-10 18:56:56 +00:00
Rob Clark 941adcef03 freedreno/a6xx: more bcolor fixes
Non-zero offset wasn't working, which breaks a bunch of
dEQP-GLES31.functional.texture.border_clamp.formats.* when doing sharded
deqp runs (because order of tests changes, resulting in different
texture state bound.. deqp doesn't really clean up it's gl state between
tests very well)

Previously, if additional textures were bound, due to using too small of
a bcolor_entry size, the last 32bytes of the bcolor_entry would be
overwritten.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2019-03-10 11:40:06 -04:00
Eric Engestrom e6ba67dd65 panfrost: move #include to fix compilation
In standalone.h, the struct gl_context type is not declared by #includ'ing
mtypes.h:

In file included from src/gallium/drivers/panfrost/midgard/cmdline.c:24:
src/compiler/glsl/standalone.h:46:14: warning: ‘struct gl_context’ declared inside parameter list will not be visible outside of this definition or declaration
       struct gl_context *ctx);
              ^~~~~~~~~~

This causes the following compilation failure:

src/gallium/drivers/panfrost/midgard/cmdline.c: In function ‘compile_shader’:
src/gallium/drivers/panfrost/midgard/cmdline.c:58:61: error: passing argument 4 of ‘standalone_compile_shader’ from incompatible pointer type [-Werror=incompatible-pointer-types]
         prog = standalone_compile_shader(&options, 2, argv, &local_ctx);
                                                             ^~~~~~~~~~
In file included from src/gallium/drivers/panfrost/midgard/cmdline.c:24:
src/compiler/glsl/standalone.h:43:28: note: expected ‘struct gl_context *’ but argument is of type ‘struct gl_context *’
 struct gl_shader_program * standalone_compile_shader(
                            ^~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: e67e072637 "panfrost: Implement Midgard shader toolchain"
Cc: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
2019-03-09 22:37:40 +00:00
Eric Engestrom d4d29c0455 panfrost: fix tgsi_to_nir() call
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=109945
Fixes: 7da251fc72 "panfrost: Check in sources for command stream"
Cc: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
2019-03-09 22:06:19 +00:00
Axel Davy 5475434fa6 Revert "d3dadapter9: Support software renderer on any DRI device"
This reverts commit 0d08476593.

It makes gitlab's travis fail. Revert until patch is fixed.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
2019-03-09 14:29:43 +01:00
Axel Davy 597b5e27fa st/nine: Change a few advertised caps
Most hw on the native platform advertise these
caps this way.

D3DCAPS_READ_SCANLINE: We don't really have hardware
support for that, but many games don't even check the
flag, and expect GetRasterStatus to work, which is
why we emulated it with a timer (like wine). So we
may as well advertise the cap.
D3DCURSORCAPS_LOWRES: I don't know what is the status
of this on X11, but I don't know of any dx9 game
running at height < 400 either.
D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE: The cap should
correspond to what the current generation of hw is doing.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
2019-03-09 13:57:49 +01:00
Axel Davy 0d3c37e2f9 st/nine: Do not advertise CANMANAGERESOURCE
It doesn't seem the main vendors advertise it.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
2019-03-09 13:57:49 +01:00
Axel Davy a8583e75d6 st/nine: Do not advertise support for D15S1 and D24X4S4
The former is supported on Matrox cards but no other hw.
The latter isn't supported anywhere.

It is fine to not advertise them as supported,
and it could prevent apps to trigger weird rendering paths.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-03-09 13:57:49 +01:00
Patrick Rudolph 0d08476593 d3dadapter9: Support software renderer on any DRI device
If D3D_ALWAYS_SOFTWARE is set for debugging purposes,
run on any DRI enabled platform.
Instead of probing for a compatible gallium driver (which might
fail if there's none) always use the KMS DRI software renderer.

Allows to run nine on i915 when D3D_ALWAYS_SOFTWARE=1.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <davyaxel0@gmail.com>
2019-03-09 13:57:49 +01:00
Axel Davy f7b9c09c7c st/nine: Disable depth write when nothing gets updated
I do not see any perf impact on radeonsi, but it
seems iris needs this.
It seems something sensible to do.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Andre Heider <a.heider@gmail.com>
2019-03-09 13:57:49 +01:00
Elie Tournier d7b3196976 virgl: Return an error if we use fp64 on top of GLES
Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: <Gurchetan Singh gurchetansingh@chromium.org>
2019-03-09 11:33:20 +01:00
Elie Tournier 1f1514e1aa virgl: Set PIPE_CAP_DOUBLES when running on GLES This is a lie but no known app use fp64.
Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: <Gurchetan Singh gurchetansingh@chromium.org>
2019-03-09 11:33:14 +01:00
Elie Tournier 8ad1e86bb0 virgl: Add a caps to advertise GLES backend
Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: <Gurchetan Singh gurchetansingh@chromium.org>
2019-03-09 11:32:30 +01:00
Rob Clark 53083e4fbc freedreno/ir3: fix ir3_cmdline harder
Fixes: 45271702ec freedreno: fix ir3_cmdline build
Fixes: 7530d4abfc glsl/freedreno/panfrost: pass gl_context to the standalone compiler
Signed-off-by: Rob Clark <robdclark@gmail.com>
2019-03-08 18:44:57 -05:00
Eric Anholt fafead7b62 st/dri: Set the PIPE_BIND_SHARED flag on create_image_with_modifiers.
With createImage(), the caller was expected to set a SHARED flag if they
needed the ability to get a GEM handle.  DRI3, wayland, and gbm all set
it, EGL_MESA_drm_image passes it through, and surfaceless doesn't need it
because there's no way to request a handle.

With the new createImageWithModifiers() DRI method to replace it, the
expectation is that you'll always be able to share the buffer, so the flag
is unnecessary in its arguments.  However, we do need to tell gallium
about this expectation.

Without this, kmscube's modifiers path using
gbm_bo_create_with_modifiers(&modifier, 1) instead of
gbm_bo_create(SCANOUT | SHARED) will call the driver's resource_create()
function wtih PIPE_BIND_SHARED unset, so the driver (particularly
renderonly drivers) may allocate in such a way that it can't return an
answer from gbm_bo_get_handle().  I used to have a hack in v3d using
count==1 && modifier==LINEAR to indicate that you wanted SHARED anyway,
but that was dropped recently.

Fixes: 59527a36e9 ("v3d: Restructure RO allocations using
resource_from_handle.")
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
2019-03-08 15:33:35 -08:00
Kenneth Graunke 9d1334d2a0 iris: Use copy_region and staging resources to avoid transfer stalls
This is similar to intel_miptree_map_blit and intel_buffer_object.c's
temporary blits in i965.

Improves performance of DiRT Rally by 20-25% by eliminating stalls.

Breaks piglit's spec/arb_shader_image_load_store/host-mem-barrier,
by using the GPU to do uploads, exposing a st/mesa issue where it
doesn't give us memory_barrier() calls.  This is a pre-existing issue
and will be fixed by a later patch (currently out for review).
2019-03-08 13:29:39 -08:00
Sagar Ghuge bca28deb46 iris: Track last VS URB entry size
Return immediately if last VS URB entry size is good enough for BLORP
operation

v2: Fix comments (Caio)

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Suggested-by: Kenneth Graunke<kenneth@whitecape.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-03-08 10:01:39 -08:00
Sagar Ghuge d0a8fba69a iris: Refactor code to share 3DSTATE_URB_* packet
v2: 1) Set IRIS_DIRTY_URB bit (Caio)
    2) Get rid of unnecessary function (Caio)

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Suggested-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-03-08 10:01:39 -08:00
Eric Engestrom 598f10eacc r600: cast pointer to expected type
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
2019-03-08 16:24:06 +00:00
Brian Paul 2c387819f4 pipebuffer: s/PB_ALL_USAGE_FLAGS/PB_USAGE_ALL/
To fix build failure.  I guess my meson configuration has assertions
disabled for some reason.

Trivial fix.
2019-03-08 08:07:24 -07:00
Brian Paul d4381cf593 svga: remove SVGA_RELOC_READ flag in SVGA3D_BindGBSurface()
This fixes a rendering issue where UBO updates aren't always picked
up by drawing calls.  This issue effected the Webots robotics
simulator.  VMware bug 2175527.

Testing Done: Webots replay, piglit, misc Linux games

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2019-03-08 07:40:35 -07:00
Brian Paul 07e8a31e49 svga: refactor draw_vgpu10() function
The draw_vgpu10() function was huge.  Move the code for preparing the
vertex buffers and the index buffer into separate functions.

Reviewed-by: Neha Bhende <bhenden@vmware.com>
2019-03-08 07:40:35 -07:00
Brian Paul 76a10fc89e winsys/svga: use new pb_usage_flags enum type
And add a comment that we're implicitly converting PIPE_TRANSFER_
flags to PB_USAGE_ flags in one place.  And statically assert that
the enum values match.

Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2019-03-08 07:40:35 -07:00
Brian Paul b5f2b0d6b6 pipebuffer: whitespace fixes in pb_buffer.h
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2019-03-08 07:40:35 -07:00
Brian Paul b286e74df6 pipebuffer: use new pb_usage_flags enum type
Use a new enum type instead of 'unsigned' to make things a bit more
understandable.

Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2019-03-08 07:40:35 -07:00
Charmaine Lee daf567f797 svga: add svga shader type in the shader variant
With this patch, the svga shader type will be saved in the shader variant,
and there is no need to pass in the shader type to the define/destroy
variant functions.

Reviewed-by: Brian Paul <brianp@vmware.com>
2019-03-08 07:40:34 -07:00
Brian Paul ac6b33a50d gallium/util: add some const qualifiers in u_bitmask.c
And add/update comments.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2019-03-08 07:40:34 -07:00
Brian Paul b5a3a90c0c gallium/util: whitespace cleanups in u_bitmask.[ch]
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2019-03-08 07:40:34 -07:00
Chris Wilson 04ddff1aa4 iris: Wire up EGL_IMG_context_priority
Add the missing PIPE_CAP_CONTEXT_PRIORITY_MASK and parsing of the context
construction flags.

Testcase: piglit/egl-context-priority

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-03-07 20:27:10 -08:00
Kenneth Graunke 2993088500 iris: Export a copy_region helper that doesn't flush
I'll want to use this for transfer maps, which already do their own
flushing.  This lets us avoid a double flush, and also gives us more
control over the batch which is selected.
2019-03-07 17:08:19 -08:00
Kenneth Graunke 335726fdac iris: Spruce up "are we using this engine?" checks for flushing
We were using batch->contains_draw as a proxy for "are we even using
this engine?"  That isn't quite right, because it only counts regular
draws.  BLORP operations may have also rendered to a resource, which
needs to trigger flushing.  To check for this, we also see if the
render and sometimes depth caches are non-empty.

We can also drop the "but there might already be stale data in the
cache even if we haven't emitted any commands yet" concern in the
comments.  The kernel flushes caches between batches.

This may not be great but it's at least better than what was there.
2019-03-07 17:08:07 -08:00
Timur Kristóf b0c214ccee radeonsi/nir: Only set window_space_position for vertex shaders.
By mistake, this was previously set for all shaders.
It is a vertex shader property so only makes sense to
set it for vertex shaders.

Signed-Off-By: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-By: Timothy Arceri <tarceri@itsqueeze.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
2019-03-08 00:39:45 +00:00
Rob Clark ebbb6b8eaa freedreno/a6xx: perfcntrs
Signed-off-by: Rob Clark <robdclark@gmail.com>
2019-03-07 15:33:42 -05:00
Rob Clark 40d8ed5ef3 freedreno/a6xx: fix border-color swizzles
Fixes nearly all of the remaining
dEQP-GLES31.functional.texture.border_clamp.formats.* fails

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
2019-03-07 15:33:42 -05:00
Rob Clark f5d80ff2db freedreno/a6xx: refactor fd6_tex_swiz()
We need a version of fd6_tex_swiz() that just returns the composed
swizzle without building part of the TEX_CONST_0 state.  So just
refactor the existing function to build more of the TEX_CONST_0 state,
and leave fd6_tex_swiz() simply composing swizzles.

The small IBO state change (to use LINEAR for smaller sizes/levels) is
to match the state in fd6_tex_const_0().  It seems like maybe tiled
actually works at the smaller sizes but not if minification is in play,
so best just to make images match what we do for textures.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
2019-03-07 15:33:42 -05:00
Rob Clark 8dc47490c8 freedreno/a6xx: remove astc_srgb workaround
Not used on a6xx, so remove some of the related plumbing that was copied
over from older gens.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2019-03-07 15:33:42 -05:00
Rob Clark 45271702ec freedreno: fix ir3_cmdline build
Fixes: 7530d4abfc glsl/freedreno/panfrost: pass gl_context to the standalone compiler
Signed-off-by: Rob Clark <robdclark@gmail.com>
2019-03-07 15:33:20 -05:00
Kenneth Graunke d53b1b6215 iris: Drop PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY
This cap is mainly for working around a r600 texture swizzle issue,
but it also controls whether ARB_texture_buffer_object (with legacy
formats) is enabled.  I suspect the missing I/L/A/LA faking is why
I had it set in the first place.

Thanks to Ilia for pointing out that I shouldn't be setting this.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2019-03-07 11:39:27 -08:00
Kenneth Graunke 809a81ec3a iris: Properly support alpha and luminance-alpha formats
For texturing, we map alpha formats to the corresponding red format,
as many alpha formats are outright missing, and red is more efficient
when sampling anyway.

When rendering to A8_UNORM, we use that format directly, so the image
gets the shader output's .a/.w channel, rather than the .r/.x channel.

All other A* formats are non-renderable, so we can't do much and just
mark them as unsupported for rendering.  Fortunately, GL only requires
rendering to A8_UNORM, so that works out.

According to Andre Heider and Timur Kristóf, this fixes font rendering
in Witcher 1 (via nine).  Andre also reported that it fixes Unigine
Heaven (presumably via nine).

v2: Use the same swizzle for both sampler views and "render targets".
    BLORP expects the read swizzle, and will take the inverse when
    setting up the destination swizzle (and actually applying it in
    the shaders).  We ignore the format swizzle when setting up normal
    rendering SURFACE_STATEs, which is necessary because it would be
    an illegal shader channel select combination.  Thanks to Jason
    Ekstrand for pointing out that BLORP took an inverse swizzle.

Tested-by: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2019-03-07 11:39:27 -08:00
Kenneth Graunke fbc51c4c95 iris: Defer uploading sampler state tables until draw time
Gallium might call us multiple times to bind subsets of the samplers,
at which point we'd recreate the table a bunch of times.  It doesn't
really buy us anything to do it here - even if we defer to draw time,
the dirty tracking ensures we'll only do it on the first draw after a
bind_sampler_states() call.

We now use the number of samplers specified by the shader instead of
the binding count.  If this number changes, we flag sampler state as
dirty so we re-upload a table with the right number of entries.

This also fixes a bug where ice->state.need_border_colors was never
unset, so once something needed border colors, the pool would always
be pinned in all future batches.

v2: Explicitly flag sampler states as dirty, rather than assuming that
    bind_sampler_states() will be called if the program texture count
    changes.  While this may be true for st/mesa, it isn't the case for
    Gallium HUD.

Tested-by: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2019-03-07 11:39:27 -08:00
Kenneth Graunke 9caabd6c5f iris: Plumb through ISL_SWIZZLE_IDENTITY in buffer surface emitters
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2019-03-07 11:39:27 -08:00
Kenneth Graunke 4787bc944a isl: Add a swizzle parameter to isl_buffer_fill_state()
This is necessary for legacy texture buffer object formats, where we'll
need to use a swizzle to fake e.g. luminance.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2019-03-07 11:39:27 -08:00
Lionel Landwerlin 575f8e8b60 iris: fix decode_get_bo callback
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: acb50d6b1f ("intel/decoders: handle decoding MI_BBS from ring")
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
2019-03-07 17:39:07 +00:00
Erik Faye-Lund 55e4759c8d virgl: remove unused variable
This variable is now unused, so let's remove it.

Fixes: 9c4930946a (virgl: add encoder functions for new protocol)
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2019-03-07 17:24:54 +00:00
Erik Faye-Lund 44620d4ef7 virgl: remove unused variable
This variable is now unused, so let's remove it.

Fixes: db77573d7b (virgl: modify how we handle GL_MAP_FLUSH_EXPLICIT_BIT)
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2019-03-07 17:24:54 +00:00
Erik Faye-Lund 524934586b virgl: remove unused variable
This variable is now unused, so let's remove it.

Fixes: c19aedcf1a (virgl: don't mark unclean after a flush)
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2019-03-07 17:24:54 +00:00
Erik Faye-Lund af29c93f22 virgl: remove unused variables
These variables are now unused, let's remove them to get rif of a few
warnings.

Fixes: f0e71b1088 (virgl: use transfer queue)
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2019-03-07 17:24:54 +00:00