mesa.git
6 years agopython: Don't abuse hex()
Mathieu Bridon [Sun, 17 Jun 2018 15:53:16 +0000 (17:53 +0200)]
python: Don't abuse hex()

The hex() builtin returns a string containing the hexa-decimal
representation of an integer.

When the argument is not an integer, then the function calls that
object's __hex__() method, if one is defined. That method is supposed to
return a string.

While that's not explicitly documented, that string is supposed to be a
valid hexa-decimal representation for a number. Python 2 doesn't enforce
this though, which is why we got away with returning things like
'NIR_TRUE' which are not numbers.

In Python 3, the hex() builtin instead calls an object's __index__()
method, which itself must return an integer. That integer is then
automatically converted to a string with its hexa-decimal representation
by the rest of the hex() function.

As a result, we really can't make this compatible with Python 3 as it
is.

The solution is to stop using the hex() builtin, and instead use a hex()
object method, which can return whatever we want, in Python 2 and 3.

Signed-off-by: Mathieu Bridon <bochecha@daitauha.fr>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agopython: Better get character ordinals
Mathieu Bridon [Sun, 17 Jun 2018 12:44:46 +0000 (14:44 +0200)]
python: Better get character ordinals

In Python 2, iterating over a byte-string yields single-byte strings,
and we can pass them to ord() to get the corresponding integer.

In Python 3, iterating over a byte-string directly yields those
integers.

Transforming the byte string into a bytearray gives us a list of the
integers corresponding to each byte in the string, removing the need to
call ord().

This makes the script compatible with both Python 2 and 3.

Signed-off-by: Mathieu Bridon <bochecha@daitauha.fr>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoloader_dri3: Handle mismatched depth 30 formats for Prime renderoffload.
Mario Kleiner [Thu, 14 Jun 2018 04:04:24 +0000 (06:04 +0200)]
loader_dri3: Handle mismatched depth 30 formats for Prime renderoffload.

Detect if the display (X-Server) gpu and Prime renderoffload gpu prefer
different channel ordering for color depth 30 formats ([X/A]BGR2101010
vs. [X/A]RGB2101010) and perform format conversion during the blitImage()
detiling op from tiled backbuffer -> linear buffer.

For this we need to find the visual (= red channel mask) for the
X-Drawable used to display on the server gpu. We use the same proven
logic for finding that visual as in commit "egl/x11: Handle both depth
30 formats for eglCreateImage()".

This is mostly to allow "NVidia Optimus" at depth 30, as Intel/AMD
gpu's prefer xRGB2101010 ordering, whereas NVidia gpu's prefer
xBGR2101010 ordering, so we can offload to nouveau without getting
funky colors.

Tested on Intel single gpu, NVidia single gpu, Intel + NVidia prime
offload with DRI3/Present.

Note: An unintended but pleasant surprise of this patch is that it also
seems to make the modesetting-ddx of server 1.20.0 work at depth 30
on nouveau, at least with unredirected "classic" X rendering, and
with redirected desktop compositing under XRender accel, and with OpenGL
compositing under GLX. Only X11 compositing via OpenGL + EGL still gives
funky colors. modesetting-ddx + glamor are not yet ready to deal with
nouveau's ABGR2101010 format, and treat it as ARGB2101010, also exposing
X-visuals with ARGB2101010 style channel masks. Seems somehow this triggers
the logic in this patch on modesetting-ddx + depth 30 + DRI3 buffer sharing
and does the "wrong" channel swizzling that then cancels out the "wrong"
swizzling of glamor and we end up with the proper pixel formatting in
the scanout buffer :). This so far tested on a NVA5 Tesla card under KDE5
Plasma as shipping with Ubuntu 16.04.4 LTS.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoegl/x11: Handle both depth 30 formats for eglCreateImage(). (v4)
Mario Kleiner [Wed, 13 Jun 2018 04:04:13 +0000 (06:04 +0200)]
egl/x11: Handle both depth 30 formats for eglCreateImage(). (v4)

We need to distinguish if the backing storage of a pixmap
is XRGB2101010 or XBGR2101010, as different gpu hw supports
different formats. NVidia hw prefers XBGR, whereas AMD and
Intel are happy with XRGB.

Use the red channel mask of the first depth 30 visual of
the x-screen to distinguish which hw format to choose.

This fixes desktop composition of color depth 30 windows
when the X11 compositor uses EGL.

v2: Switch from using the visual of the root window to simply
    using the first depth 30 visual for the x-screen, as testing
    shows that each driver only exports either xrgb ordering or
    xbgr ordering for the channel masks of its depth 30 visuals,
    so this should be unambiguous and avoid trouble if X ever
    supports depth 30 pixmaps on screens with a non-depth 30 root
    window visual. This per Michels suggestion.

v3: No change to v2, but spent some time testing this more on
    AMD hw, with my software hacked up to intentionally choose
    pixel formats/visual with the non-preferred xBGR2101010
    ordering on the ati-ddx, also with a standard non-OpenGL
    X-Window with depth 30 visual, to make sure that things show
    up properly with the right colors on the screen when going
    through EGL+OpenGL based compositing on KDE-5. Iow. to confirm
    that my explanation to the v2 patch on the mailing list of why
    it should work and the actual practice agree (or possibly that
    i am good at fooling myself during testing ;).

v4: Drop the local `red_mask` and just `return visual->red_mask`/
    `return 0`, as suggested by Eric Engestrom.

    Rebased onto current master, to take the cleanup via the new
    function dri2_format_for_depth() into account.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agogbm: Add support for 10bpp BGR formats
Daniel Stone [Wed, 13 Jun 2018 04:04:12 +0000 (06:04 +0200)]
gbm: Add support for 10bpp BGR formats

Add support for XBGR2101010 and ABGR2101010 formats.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoegl/wayland: Add 10bpc BGR configs
Daniel Stone [Wed, 13 Jun 2018 04:04:11 +0000 (06:04 +0200)]
egl/wayland: Add 10bpc BGR configs

Add support for XBGR2101010 and ABGR2101010.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agointel/compiler: implement 8-bit constant load
Iago Toral Quiroga [Fri, 27 Jul 2018 11:38:39 +0000 (13:38 +0200)]
intel/compiler: implement 8-bit constant load

Fixes VK-GL-CTS CL#2567

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agointel/compiler: add setup_imm_(u)b helpers
Iago Toral Quiroga [Fri, 27 Jul 2018 11:38:38 +0000 (13:38 +0200)]
intel/compiler: add setup_imm_(u)b helpers

The hardware doesn't support byte immediates, so similar to setup_imm_df()
for doubles, these helpers work by loading the constant value into a
VGRF.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoglsl: fix function inlining with opaque parameters
Rhys Perry [Wed, 6 Jun 2018 19:55:08 +0000 (20:55 +0100)]
glsl: fix function inlining with opaque parameters

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoglsl, glsl_to_tgsi: fix sampler/image constants
Rhys Perry [Wed, 6 Jun 2018 19:55:07 +0000 (20:55 +0100)]
glsl, glsl_to_tgsi: fix sampler/image constants

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoglsl: allow ?: operator with images and samplers when bindless is enabled
Rhys Perry [Wed, 6 Jun 2018 19:55:06 +0000 (20:55 +0100)]
glsl: allow ?: operator with images and samplers when bindless is enabled

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoglsl_to_tgsi: allow bound samplers and images to be used as l-values
Rhys Perry [Wed, 6 Jun 2018 19:55:05 +0000 (20:55 +0100)]
glsl_to_tgsi: allow bound samplers and images to be used as l-values

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agogallium: add new SAMP2HND and IMG2HND opcodes
Rhys Perry [Wed, 6 Jun 2018 19:55:03 +0000 (20:55 +0100)]
gallium: add new SAMP2HND and IMG2HND opcodes

This commit does not add support for the opcodes in gallivm or tgsi_to_nir.c

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agodocs/features: update virgl GLES 3.1/3.2 status
Dave Airlie [Mon, 30 Jul 2018 19:07:23 +0000 (05:07 +1000)]
docs/features: update virgl GLES 3.1/3.2 status

virgl now exposes GLES3.1 and 3.2

6 years agodocs/features: update virgl GL 4.3 support
Dave Airlie [Mon, 30 Jul 2018 19:07:06 +0000 (05:07 +1000)]
docs/features: update virgl GL 4.3 support

virgl with up to date host renderer now exposes GL 4.3.

6 years agovirgl: enable FBFETCH if virglrenderer supports it
Erik Faye-Lund [Fri, 20 Jul 2018 10:10:56 +0000 (11:10 +0100)]
virgl: enable FBFETCH if virglrenderer supports it

This fixes the following dEQP-GLES31 cases from NotSupported to
Pass for me:

- dEQP-GLES31.functional.blend_equation_advanced.state_query.*
- dEQP-GLES31.functional.blend_equation_advanced.basic.*
- dEQP-GLES31.functional.blend_equation_advanced.srgb.*
- dEQP-GLES31.functional.blend_equation_advanced.msaa.*
- dEQP-GLES31.functional.blend_equation_advanced.barrier.*
- dEQP-GLES31.functional.draw_buffers_indexed.overwrite_*advanced_blend_eq*
- dEQP-GLES31.functional.state_query.indexed.blend_equation_advanced_*
- dEQP-GLES31.functional.debug.negative_coverage.*.advanced_blend.*

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agovirgl: add texture_barrier stub
Erik Faye-Lund [Fri, 20 Jul 2018 10:10:20 +0000 (11:10 +0100)]
virgl: add texture_barrier stub

In gallium, supporting FBFETCH means supporting non-coherent fetches, but
in virglrenderer, due to technical reasons this is backed by coherent
fetches instead. This means we don't need to do anything for the barriers.

However, if we don't have a texture_barrier implementation, we get crashes
because the non-coherent extensions is exposed.

So, let's leave this as a NOP for now.

[airlied: I've got a more complete impl of this somewhere, once we
land the host side].
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
6 years agovirgl: enable robustness if the host exposes it
Dave Airlie [Mon, 30 Jul 2018 18:45:15 +0000 (04:45 +1000)]
virgl: enable robustness if the host exposes it

Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agovirgl: Support ARB_framebuffer_no_attachments
Dave Airlie [Wed, 18 Jul 2018 19:35:53 +0000 (05:35 +1000)]
virgl: Support ARB_framebuffer_no_attachments

This uses new protocol to send the default sizes to the host.

Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agovirgl: add initial ARB_compute_shader support
Dave Airlie [Fri, 15 Jun 2018 01:20:53 +0000 (11:20 +1000)]
virgl: add initial ARB_compute_shader support

This hooks up compute shader creation and launch grid support.

Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agoutil: don't use __builtin_clz unconditionally
Marek Olšák [Wed, 1 Aug 2018 02:50:44 +0000 (22:50 -0400)]
util: don't use __builtin_clz unconditionally

This fixes the build if __builtin_clz is unsupported.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agoac/surface: fix MSAA corruption on Vega due to FMASK tile swizzle
Marek Olšák [Fri, 27 Jul 2018 02:46:21 +0000 (22:46 -0400)]
ac/surface: fix MSAA corruption on Vega due to FMASK tile swizzle

a needle in the haystack?

Cc: 18.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agov3d: use snprintf(..., "%s", ...) instead of strncpy
Eric Anholt [Tue, 31 Jul 2018 23:41:28 +0000 (16:41 -0700)]
v3d: use snprintf(..., "%s", ...) instead of strncpy

Fixes a compiler warning about terminator NUL, based on f836d799f906
("intel/decoder: use snprintf(..., "%s", ...) instead of strncpy")

6 years agov3d: Add support for the TMUWT instruction.
Eric Anholt [Thu, 14 Dec 2017 17:28:42 +0000 (09:28 -0800)]
v3d: Add support for the TMUWT instruction.

This instruction is used to ensure that TMU stores have been processed
before moving on.  In particular, you need any TMU ops to be done by the
time the shader ends.

6 years agoradeonsi: report supported EQAA combinations from is_format_supported
Marek Olšák [Thu, 24 May 2018 02:56:25 +0000 (22:56 -0400)]
radeonsi: report supported EQAA combinations from is_format_supported

Framebuffer without attachments now supports 16 samples.

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradeonsi: use storage_samples instead of color_samples in most places
Marek Olšák [Thu, 24 May 2018 02:42:49 +0000 (22:42 -0400)]
radeonsi: use storage_samples instead of color_samples in most places

and use pipe_resource::nr_storage_samples instead of
r600_texture::num_color_samples.

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agogallium: add storage_sample_count parameter into is_format_supported
Marek Olšák [Wed, 23 May 2018 22:46:19 +0000 (18:46 -0400)]
gallium: add storage_sample_count parameter into is_format_supported

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agogallium: add pipe_resource::nr_storage_samples, and set it same as nr_samples
Marek Olšák [Thu, 24 May 2018 02:25:12 +0000 (22:25 -0400)]
gallium: add pipe_resource::nr_storage_samples, and set it same as nr_samples

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agogallium: add PIPE_CAP_FRAMEBUFFER_MSAA_CONSTRAINTS
Marek Olšák [Wed, 23 May 2018 21:45:50 +0000 (17:45 -0400)]
gallium: add PIPE_CAP_FRAMEBUFFER_MSAA_CONSTRAINTS

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agodocs: update radeonsi features and release notes
Marek Olšák [Tue, 24 Jul 2018 00:07:20 +0000 (20:07 -0400)]
docs: update radeonsi features and release notes

6 years agost/mesa: implement ASTC 2D LDR fallback for all drivers
Marek Olšák [Tue, 13 Feb 2018 03:25:29 +0000 (04:25 +0100)]
st/mesa: implement ASTC 2D LDR fallback for all drivers

Tested-by: Mike Lothian <mike@fireburn.co.uk>
Tested-By: Gert Wollny<gert.wollny@collabora.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-By: Gert Wollny <gw.fossdev@gmail.com>
6 years agost/mesa: add ETC2 & ASTC fast path for GetTex(Sub)Image
Marek Olšák [Tue, 13 Feb 2018 16:37:56 +0000 (17:37 +0100)]
st/mesa: add ETC2 & ASTC fast path for GetTex(Sub)Image

Not sure if GL/GLES can hit this path, but it's just decompression.

Tested-by: Mike Lothian <mike@fireburn.co.uk>
Tested-By: Gert Wollny<gert.wollny@collabora.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-By: Gert Wollny <gw.fossdev@gmail.com>
6 years agost/mesa: generalize fallback_copy_image for compressed textures
Marek Olšák [Wed, 14 Feb 2018 00:49:33 +0000 (01:49 +0100)]
st/mesa: generalize fallback_copy_image for compressed textures

in order to support ASTC

Tested-by: Mike Lothian <mike@fireburn.co.uk>
Tested-By: Gert Wollny<gert.wollny@collabora.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-By: Gert Wollny <gw.fossdev@gmail.com>
6 years agost/mesa: generalize code for the compressed texture map/unmap fallback
Marek Olšák [Tue, 13 Feb 2018 15:39:11 +0000 (16:39 +0100)]
st/mesa: generalize code for the compressed texture map/unmap fallback

in order to support ASTC

Tested-by: Mike Lothian <mike@fireburn.co.uk>
Tested-By: Gert Wollny<gert.wollny@collabora.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-By: Gert Wollny <gw.fossdev@gmail.com>
6 years agost/mesa: use st_compressed_format_fallback more
Marek Olšák [Tue, 13 Feb 2018 03:19:05 +0000 (04:19 +0100)]
st/mesa: use st_compressed_format_fallback more

Tested-by: Mike Lothian <mike@fireburn.co.uk>
Tested-By: Gert Wollny<gert.wollny@collabora.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-By: Gert Wollny <gw.fossdev@gmail.com>
6 years agost/mesa: generalize st_etc_fallback -> st_compressed_format_fallback
Marek Olšák [Tue, 13 Feb 2018 03:00:17 +0000 (04:00 +0100)]
st/mesa: generalize st_etc_fallback -> st_compressed_format_fallback

for ASTC support later

Tested-by: Mike Lothian <mike@fireburn.co.uk>
Tested-By: Gert Wollny<gert.wollny@collabora.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-By: Gert Wollny <gw.fossdev@gmail.com>
6 years agomesa: add ASTC 2D LDR decoder
Marek Olšák [Tue, 13 Feb 2018 15:02:14 +0000 (16:02 +0100)]
mesa: add ASTC 2D LDR decoder

Tested-by: Mike Lothian <mike@fireburn.co.uk>
Tested-By: Gert Wollny <gert.wollny@collabora.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agodocs/features: mark virgl image features and GL4.2 as done
Dave Airlie [Mon, 30 Jul 2018 19:04:56 +0000 (05:04 +1000)]
docs/features: mark virgl image features and GL4.2 as done

6 years agovirgl: also mark sampler views as dirty
Gurchetan Singh [Tue, 10 Jul 2018 23:19:24 +0000 (16:19 -0700)]
virgl: also mark sampler views as dirty

When texture buffers are used as images in compute shaders, the guest
never sees the modified data since the TBO is always marked as clean.

Fixes most dEQP-GLES31.functional.image_load_store.buffer.* tests.

Example test cases:
   dEQP-GLES31.functional.image_load_store.buffer.load_store.r32ui
   dEQP-GLES31.functional.image_load_store.buffer.qualifiers.coherent_r32f
   dEQP-GLES31.functional.image_load_store.buffer.format_reinterpret.rgba8_rgba8ui

Note: virglrenderer side patch also needed to bind TBOs correctly

Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agovirgl: add memory barrier support
Dave Airlie [Wed, 18 Jul 2018 03:37:49 +0000 (13:37 +1000)]
virgl: add memory barrier support

Reviwed-by: Gert Wollny <gert.wollny@collabora.com>
6 years agovirgl: add TXQS support
Dave Airlie [Thu, 19 Jul 2018 23:18:04 +0000 (09:18 +1000)]
virgl: add TXQS support

Reviwed-by: Gert Wollny <gert.wollny@collabora.com>
6 years agovirgl: add initial images support (v2)
Dave Airlie [Wed, 18 Jul 2018 02:54:30 +0000 (12:54 +1000)]
virgl: add initial images support (v2)

v2: add max image samples support

Reviwed-by: Gert Wollny <gert.wollny@collabora.com>
6 years agoMake glXChooseFBConfig handle unspecified sRGB correctly
Jon Turney [Sat, 14 Jul 2018 14:24:14 +0000 (15:24 +0100)]
Make glXChooseFBConfig handle unspecified sRGB correctly

Make glXChooseFBConfig properly handle the case where the only matching
configs have the sRGB flag set, but no sRGB attribute is specified.

Since 6e06e281, the sRGBcapable flag is now actually compared, using
MATCH_DONT_CARE.

7b0f912e added defaulting of sRGBcapable to GL_FALSE in
__glXInitializeVisualConfigFromTags(), to handle servers which don't report
it, but this function is also used by glXChooseFBConfig(), so sRGBcapable is
implicitly false when not explicitly specified.

(This can cause e.g. glxinfo to fail to find anything matching the simple
config it looks for if all the candidates have the sRGB flag set to true.
I'm assuming this doesn't happen 'normally' as candidate configs with and
without sRGB true are available)

Move this defaulting to createConfigsFromProperties(), and set the default
for glXChooseFBConfig() in init_fbconfig_for_chooser() to GLX_DONT_CARE.

Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agodri3: For 1.2, use root window instead of pixmap drawable
Olivier Fourdan [Thu, 26 Jul 2018 07:46:39 +0000 (09:46 +0200)]
dri3: For 1.2, use root window instead of pixmap drawable

get_supported_modifiers() and pixmap_from_buffers() requests both
expect a window as drawable, passing a pixmap will fail as the Xserver
will fail to match the given drawable to a window.

That leads to dri3_alloc_render_buffer() to return NULL and breaks
rendering when using GLX_DOUBLEBUFFER on pixmaps.

Query the root window of the pixmap on first init, and use the root
window instead of the pixmap drawable for get_supported_modifiers()
and pixmap_from_buffers().

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107117
Fixes: 069fdd5 ("egl/x11: Support DRI3 v1.1")
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agoi965: enable XFB and GeometryStreams for gen7+
Alejandro Piñeiro [Fri, 13 Jul 2018 11:35:38 +0000 (13:35 +0200)]
i965: enable XFB and GeometryStreams for gen7+

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoi965: Link XFB varyings for SPIR-V shaders
Neil Roberts [Tue, 12 Dec 2017 16:30:57 +0000 (17:30 +0100)]
i965: Link XFB varyings for SPIR-V shaders

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agonir/linker: Add the start of a pure-NIR linker for XFB
Neil Roberts [Tue, 12 Dec 2017 16:27:44 +0000 (17:27 +0100)]
nir/linker: Add the start of a pure-NIR linker for XFB

v2: ignore names on purpose, for consistency with other places where
    we are doing the same (Alejandro)

v3: changes proposed by Timothy Arceri, implemented by Alejandro Piñeiro:
   * Remove redundant 'struct active_xfb_varying'
   * Update several comments, including spec quotes if needed
   * Rename struct 'active_xfb_varying_array' to 'active_xfb_varyings'
   * Rename variable 'array' to 'active_varyings'
   * Replace one if condition for an assert (<MAX_FEEDBACK_BUFFERS)
   * Remove BufferMode initialization (was already done)

v4: simplify output pointer handling (Timothy)

Signed-off-by: Neil Roberts <nroberts@igalia.com>
Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agonir/types: Add a wrapper to access gl_type
Neil Roberts [Mon, 18 Dec 2017 17:33:32 +0000 (18:33 +0100)]
nir/types: Add a wrapper to access gl_type

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoarb_gl_spirv: add calls to several nir lowerings
Alejandro Piñeiro [Fri, 20 Jul 2018 11:03:05 +0000 (13:03 +0200)]
arb_gl_spirv: add calls to several nir lowerings

For now we are just adding nir lowerings that are needed/mandatory to
get things working. After everything is settled, we would start to add
good-to-have lowerings.

This patch adds the following calls:

  * nir_split_var_copits and nir_split_per_member_structs: as vulkan
    drivers are doing now. See commit
    b0c643d8f579a3e1e45a08f6d9de099f2c45898b ("spirv: Use NIR
    per-member splitting") for more info.

    Without this commit, piglit tests like this crashes:
    spec/arb_gl_spirv/execution/varying/block

    And in general most of the shaders that includes any kind of
    struct.

   * nir_copy_prop: after nir_deref_instr introduction, function calls
    need this. See commit "nir,spirv: Rework function calls"
    (c11833ab24dcba26de1b0a5805e35a5d6761514e) for more info.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agocompiler/spirv: add XFB and GeometryStreams capability check support
Alejandro Piñeiro [Fri, 13 Jul 2018 11:34:08 +0000 (13:34 +0200)]
compiler/spirv: add XFB and GeometryStreams capability check support

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agonir/gather_info: Set info.gs.uses_streams
Neil Roberts [Wed, 17 Jan 2018 15:37:35 +0000 (16:37 +0100)]
nir/gather_info: Set info.gs.uses_streams

Whenever a non-zero stream is written to it now sets uses_streams to
true. This reflects the code in validate_geometry_shader_emissions for
GLSL.

v2: set uses_streams at gather_info instead that at spirv to nir
    (Jason Ekstrand)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agospirv/nir: Fix the stream ID when emitting a primitive or vertex
Neil Roberts [Tue, 16 Jan 2018 18:47:07 +0000 (19:47 +0100)]
spirv/nir: Fix the stream ID when emitting a primitive or vertex

It looks like it was previously taking the SPIR-V instruction number
directly instead of looking up the constant value.

v2: use vtn_constant_value helper (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agospirv: Handle the SpvDecorationStream decoration
Neil Roberts [Wed, 17 Jan 2018 15:35:56 +0000 (16:35 +0100)]
spirv: Handle the SpvDecorationStream decoration

From SPIR-V 1.0 spec, section 3.20, "Decoration":

   "Stream
    Apply to an object or a member of a structure type. Indicates the
    stream number to put an output on."

Note the "or", so that means that it is allowed for both a full struct
or a membef or a struct (although the wording is not really ideal, and
somewhat error-prone, imho).

We found this with some Geometry Streams tests for ARB_gl_spirv, where
the full gl_PerVertex is assigned Stream 0 (default value on OpenGL
for gl_PerVertex).

So this commit allows structs to have this Decoration, and sets the
stream at the nir variable if needed.

Signed-off-by: Neil Roberts <nroberts@igalia.com>
Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
v2: squash two Decoration Stream patches (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa/glspirv: Set last_vert_prog
Neil Roberts [Mon, 18 Dec 2017 18:00:17 +0000 (19:00 +0100)]
mesa/glspirv: Set last_vert_prog

v2: simplify last_vert check (Timothy)

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agospirv: Handle XFB variable decorations
Neil Roberts [Tue, 12 Dec 2017 16:22:49 +0000 (17:22 +0100)]
spirv: Handle XFB variable decorations

These set the new explicit XFB members on nir_variable.

This is needed to support ARB_gl_spirv, as Vulkan doesn't support
transform feedback.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agospirv: Handle SpvExecutionModeXfb
Neil Roberts [Tue, 12 Dec 2017 16:18:32 +0000 (17:18 +0100)]
spirv: Handle SpvExecutionModeXfb

This just sets has_transform_feedback_varyings on the shader.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agonir: Add members for the explicit XFB properties to nir_variable
Neil Roberts [Tue, 12 Dec 2017 16:09:19 +0000 (17:09 +0100)]
nir: Add members for the explicit XFB properties to nir_variable

These are copied from the from the corresponding values in
ir_variable. The intention is to eventually use them in a pure-NIR
linker.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoetnaviv: fix typo in query names
Christian Gmeiner [Mon, 30 Jul 2018 07:44:01 +0000 (09:44 +0200)]
etnaviv: fix typo in query names

Fixes: d0bed0b4944d ("etnaviv: support HI performance counters")
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Chris Healy <cphealy@gmail.com>
6 years agomesa: fix a typo (trivial)
Tapani Pälli [Tue, 24 Jul 2018 05:58:21 +0000 (08:58 +0300)]
mesa: fix a typo (trivial)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agomesa: add glRenderbufferStorage support for EXT_texture_norm16 formats
Tapani Pälli [Tue, 24 Jul 2018 05:58:20 +0000 (08:58 +0300)]
mesa: add glRenderbufferStorage support for EXT_texture_norm16 formats

These bits were missing, found when extending the Piglit test.

Fixes: 7f467d4f73 "mesa: GL_EXT_texture_norm16 extension plumbing"
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agoegl/surfaceless: Allow DRMless fallback.
David Riley [Wed, 18 Jul 2018 00:12:05 +0000 (17:12 -0700)]
egl/surfaceless: Allow DRMless fallback.

Allow platform_surfaceless to use swrast even if DRM is not available.
To be used to allow a fuzzer for virgl to be run on a jailed VM without
hardware GL or DRM support.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Signed-off-by: David Riley <davidriley@chromium.org>
6 years agoegl/surfaceless: Define DRI_SWRastLoader extension when using swrast.
David Riley [Wed, 18 Jul 2018 00:12:04 +0000 (17:12 -0700)]
egl/surfaceless: Define DRI_SWRastLoader extension when using swrast.

Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
[chadv: Dropped spurious hunk]
Reviewed-by: Chad Versace <chadversary@chromium.org>
6 years agov3d: Dump the contents off all the buffers in CLIF mode.
Eric Anholt [Tue, 12 Jun 2018 20:46:32 +0000 (13:46 -0700)]
v3d: Dump the contents off all the buffers in CLIF mode.

A V3D_DEBUG=clif file from a non-texturing .shader_test can now be
successfully run through the CLIF runner in the simulator.  Now I need to
build an open source CLIF runner against the v3d DRM module.

6 years agov3d: Split walking the CLs to generate relocs from walking CLs to dump.
Eric Anholt [Thu, 28 Jun 2018 18:21:55 +0000 (11:21 -0700)]
v3d: Split walking the CLs to generate relocs from walking CLs to dump.

We need to dump each buffer's contents in order for a CLIF file, so we
need to collect all of the relocs into a buffer (such as the indirect CL
full of both uniforms and GL shader states) before we start dumping.

6 years agov3d: Include commands to run the BCL and RCL in CLIF dumps.
Eric Anholt [Wed, 27 Jun 2018 23:58:55 +0000 (16:58 -0700)]
v3d: Include commands to run the BCL and RCL in CLIF dumps.

6 years agov3d: Use a short, underscored name for packets in CLIF/CL dumping.
Eric Anholt [Wed, 27 Jun 2018 22:00:32 +0000 (15:00 -0700)]
v3d: Use a short, underscored name for packets in CLIF/CL dumping.

These will match the names that the CLIF parser expects to see.  I may in
the future decide to change more of the other names so that I match the
names the HW/closed SW team uses for their packets, rather than the names
in the spec (which only they and I can read anyway).

6 years agov3d: Rename "configuration" and "config" in the XML to "cfg"
Eric Anholt [Mon, 30 Jul 2018 20:17:39 +0000 (13:17 -0700)]
v3d: Rename "configuration" and "config" in the XML to "cfg"

This matches what CLIF parsing expects, and makes
TILE_BINNING_MODE_CONFIGURATION_COMMON_CONFIGURATION into a much more
legible TILE_BINNING_MODE_CFG_COMMON.

6 years agov3d: s/colour/color in the XML.
Eric Anholt [Mon, 30 Jul 2018 19:57:31 +0000 (12:57 -0700)]
v3d: s/colour/color in the XML.

The CLIF format expects american english spelling, and the rest of Mesa is
too.  I was previously adhering to the spec's spelling, which is
counterproductive.

6 years agov3d: Rename primitives to prims in the XML to match CLIF names.
Eric Anholt [Mon, 30 Jul 2018 19:55:31 +0000 (12:55 -0700)]
v3d: Rename primitives to prims in the XML to match CLIF names.

This makes us match up with the V3D HW team's names a bit more.

6 years agov3d: Print CLIF fixed-point values as just their decimal value.
Eric Anholt [Wed, 27 Jun 2018 22:16:05 +0000 (15:16 -0700)]
v3d: Print CLIF fixed-point values as just their decimal value.

The parser doesn't handle float input, so we have to dump the raw value.

6 years agov3d: When not doing terminal pretty-printing, comment struct field names.
Eric Anholt [Mon, 25 Jun 2018 22:20:22 +0000 (15:20 -0700)]
v3d: When not doing terminal pretty-printing, comment struct field names.

The struct field names aren't part of the CLIF ABI, just the order of
fields within the struct.  The comments are there for human readability.

6 years agov3d: Add a separate flag for CLIF ABI output versus human-readable CLs.
Eric Anholt [Mon, 30 Jul 2018 18:29:26 +0000 (11:29 -0700)]
v3d: Add a separate flag for CLIF ABI output versus human-readable CLs.

A few of the upcoming changes would make the V3D_DEBUG=cl output less
readable, so let's make proper CLIF file production be under a separate
V3D_DEBUG=clif flag.

6 years agov3d: Add pack header support for f187 values.
Eric Anholt [Mon, 30 Jul 2018 18:41:15 +0000 (11:41 -0700)]
v3d: Add pack header support for f187 values.

V3D only has one of these (the top 16 bits of a float32) left in its CLs,
but VC4 had many more.  This gets us proper pretty-printing of the values
instead of a large uint.

6 years agov3d: Move depth offset packet setup to CSO creation time.
Eric Anholt [Mon, 30 Jul 2018 20:44:40 +0000 (13:44 -0700)]
v3d: Move depth offset packet setup to CSO creation time.

This should be some simpler memcpying at draw time, and makes the next
change easier.

6 years agor600: reduce num compute threads to 1024.
Dave Airlie [Wed, 25 Jul 2018 03:14:58 +0000 (13:14 +1000)]
r600: reduce num compute threads to 1024.

I copied this value from radeonsi, but it was wrong, 1024
seems to be correct answer from looking at gpuinfo.

This should fix a few compute shader related hangs. (at least in CTS)

Cc: <mesa-stable@lists.freedesktop.org>
(airlied: pushed because it avoids hangs)

6 years agofreedreno/a5xx: fix txf_ms
Rob Clark [Mon, 30 Jul 2018 14:36:23 +0000 (10:36 -0400)]
freedreno/a5xx: fix txf_ms

Somehow this got lost from the initial MSAA patch.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agonvc0: serialize before updating some constant buffer bindings on Maxwell+
Rhys Perry [Sun, 15 Jul 2018 22:14:41 +0000 (23:14 +0100)]
nvc0: serialize before updating some constant buffer bindings on Maxwell+

To avoid serializing, this has the user constant buffer always be 65536
bytes and enabled unless it's required that something else is used for
constant buffer 0.

Fixes artifacts with at least XCOM: Enemy Within, 0 A.D. and Unigine
Valley, Heaven and Superposition.

v2: changed uniform_buffer_bound to be bool instead of a uint32_t
v3: remove magic constants
v3: remove pointless code in nvc0_validate_driverconst

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100177
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agov3d: Block bin on render when doing vertex texturing.
Eric Anholt [Fri, 27 Jul 2018 20:13:55 +0000 (13:13 -0700)]
v3d: Block bin on render when doing vertex texturing.

The kernel by default serializes the BCL on previous BCLs submitted on
this FD, but not RCLs.  For now this fix is conservative and blocks on
last RCL if any vertex texturing is done, which fails to get bin/render
overlap if there was an intermediate job that doesn't draw to the BCL's
buffer.  I've dropped a perf_debug() in here to note that as a potential
future improvement.

Fixes intermittent failures in
KHR-GLES3.copy_tex_image_conversions.required.*

6 years agov3d: Fix meson build without vc4.
Eric Anholt [Mon, 30 Jul 2018 02:22:33 +0000 (19:22 -0700)]
v3d: Fix meson build without vc4.

6 years agovc4: Fix meson build when enabled without v3d.
Eric Anholt [Mon, 30 Jul 2018 02:11:53 +0000 (19:11 -0700)]
vc4: Fix meson build when enabled without v3d.

Reported-by: Rob Clark <robdclark@gmail.com>
Fixes: e92959c4e03c ("v3d: Pass the whole clif_dump structure to v3d_print_group().")
6 years agonir/instr_set: Fix nir_instrs_equal for derefs
Jason Ekstrand [Wed, 25 Jul 2018 22:07:08 +0000 (15:07 -0700)]
nir/instr_set: Fix nir_instrs_equal for derefs

We weren't returning at the end of the nir_isntr_type_deref case in
nir_instrs_equal and it was falling through to the default of false.
While we're at it, make the default unreachable because all statements
in the switch now have their own returns.  Had we done that before, we
would have caught this bug a long time ago.

Fixes: 19a4662a540a8c94 "nir: Add a deref instruction type"
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Thomas Helland<thomashelland90@gmail.com>
6 years agonir: Take if uses into account in ssa_def_components_read
Jason Ekstrand [Wed, 25 Jul 2018 17:33:33 +0000 (10:33 -0700)]
nir: Take if uses into account in ssa_def_components_read

Fixes: d800b7daa5440 "nir: Add a helper for figuring out what..."
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
6 years agoutil/list: Make some helpers take const lists
Jason Ekstrand [Wed, 25 Jul 2018 17:37:53 +0000 (10:37 -0700)]
util/list: Make some helpers take const lists

They're all just querying things about the list and not mutating
anything.

Reviewed-by: Thomas Helland<thomashelland90@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
6 years agofreedreno/a5xx: small cleanup
Rob Clark [Tue, 24 Jul 2018 19:45:42 +0000 (15:45 -0400)]
freedreno/a5xx: small cleanup

We no longer have semi-custom clear pipe that uses 3d state.  Normal
clears happen via hw blitter, and everything else uses u_blitter these
days.  So we don't need this hack.

TODO a3xx+a4xx could get same treatment.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/a5xx: remove unused prototype
Rob Clark [Fri, 27 Jul 2018 13:52:35 +0000 (09:52 -0400)]
freedreno/a5xx: remove unused prototype

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: fix caps harder
Rob Clark [Tue, 24 Jul 2018 18:17:37 +0000 (14:17 -0400)]
freedreno: fix caps harder

Fixes: 868ca81c and f485e567
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agonir/lower_int64: mark all metadata as dirty
Karol Herbst [Mon, 16 Jul 2018 12:58:31 +0000 (14:58 +0200)]
nir/lower_int64: mark all metadata as dirty

v2: use nir_metadata_preserve
    preserve metadata in case of !progress

Fixes: 074f5ba0b56b12ddaca81eac3d9ed19da7054297
       "nir: Add a simple int64 lowering pass"
Signed-off-by: Karol Herbst <kherbst@redhat.com>
6 years agoandroid: radv: enable build of vulkan.radv HAL module
Mauro Rossi [Sat, 21 Jul 2018 11:11:34 +0000 (13:11 +0200)]
android: radv: enable build of vulkan.radv HAL module

src/amd/Android.mk requires to include src/amd/vulkan/Android.mk
to enable the build of vulkan.radv module

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoandroid: radv: add Android.mk for vulkan.radv HAL module
Mauro Rossi [Sat, 21 Jul 2018 10:55:22 +0000 (12:55 +0200)]
android: radv: add Android.mk for vulkan.radv HAL module

radv implements the Android Vulkan HAL interface, this patch adds
Android.mk building rules by porting of radv automake rules.
vendor HAL module is installed as /vendor/lib/hw/vulkan.radv.so

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoradv: generate entrypoints for VK_ANDROID_native_buffer
Mauro Rossi [Mon, 11 Jun 2018 20:41:33 +0000 (22:41 +0200)]
radv: generate entrypoints for VK_ANDROID_native_buffer

Patch changes radv entrypoints generator to not skip this extension even
though it is set as disabled in the vk.xml

Reference: 63525ba730 ("android: enable VK_ANDROID_native_buffer")
Fixes: 69f447553c ("vulkan: Drop vk_android_native_buffer.xml")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoradv: move vk_format_table.c to generated sources
Mauro Rossi [Sun, 11 Feb 2018 23:17:23 +0000 (00:17 +0100)]
radv: move vk_format_table.c to generated sources

Android build system will try to compile vk_format_table.c
as a shipped source, but at compile time it will be missing,
we move it to generated source, where it belongs

Fixes: f4e499ec791 ("radv: add initial non-conformant radv vulkan driver")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoxlib: fix build break from _swrast_map_soft_renderbuffer() call
Brian Paul [Fri, 27 Jul 2018 21:17:35 +0000 (15:17 -0600)]
xlib: fix build break from _swrast_map_soft_renderbuffer() call

We need to pass the new flip_y argument.

Reviewed-by: Clayton Craft <clayton.a.craft@intel.com>
6 years agoswrast: fix crash in AA line code when there's no texture
Brian Paul [Fri, 27 Jul 2018 18:59:29 +0000 (12:59 -0600)]
swrast: fix crash in AA line code when there's no texture

Fixes a crash running the Piglit polygon-mode-facing test (and
probably others).

Reviewed-by: Neha Bhende <bhenden@vmware.com>
6 years agomesa: add switch case for GL 2.1 in _mesa_compute_version()
Brian Paul [Fri, 27 Jul 2018 18:58:35 +0000 (12:58 -0600)]
mesa: add switch case for GL 2.1 in _mesa_compute_version()

The xlib/swrast driver only supports GL 2.1.  This patch fixes a
crash if the app calls glGetString(GL_SHADING_LANGUAGE_VERSION).

Reviewed-by: Neha Bhende <bhenden@vmware.com>
6 years agotgsi: whitespace fixes in tgsi_ureg.c
Brian Paul [Tue, 24 Jul 2018 02:20:34 +0000 (20:20 -0600)]
tgsi: whitespace fixes in tgsi_ureg.c

Trivial.

6 years agogallium/util: whitespace fixes in u_inlines.h
Brian Paul [Mon, 23 Jul 2018 21:48:22 +0000 (15:48 -0600)]
gallium/util: whitespace fixes in u_inlines.h

Trivial.

6 years agosvga: whitespace fixes in svga_tgsi_decl_sm30.c
Brian Paul [Mon, 23 Jul 2018 15:47:52 +0000 (09:47 -0600)]
svga: whitespace fixes in svga_tgsi_decl_sm30.c

Trivial.

6 years agomesa: replace tabs with spaces in mipmap.c
Brian Paul [Thu, 5 Jul 2018 16:47:32 +0000 (10:47 -0600)]
mesa: replace tabs with spaces in mipmap.c

Trivial.

6 years agogallium/util: whitespace fixes in u_debug_memory.c
Brian Paul [Mon, 2 Jul 2018 19:40:40 +0000 (13:40 -0600)]
gallium/util: whitespace fixes in u_debug_memory.c

Trivial.

6 years agomesa: whitespace clean-up in texstore.c
Brian Paul [Mon, 2 Jul 2018 18:47:20 +0000 (12:47 -0600)]
mesa: whitespace clean-up in texstore.c

Trivial.