mesa.git
6 years agobroadcom/vc5: Turn the decimate mode field into an enum in the XML.
Eric Anholt [Thu, 28 Dec 2017 00:43:10 +0000 (16:43 -0800)]
broadcom/vc5: Turn the decimate mode field into an enum in the XML.

6 years agobroadcom/vc5: Turn the output image format into an enum.
Eric Anholt [Thu, 28 Dec 2017 00:36:09 +0000 (16:36 -0800)]
broadcom/vc5: Turn the output image format into an enum.

6 years agobroadcom/vc5: Turn the CLE XML's memory format into an enum.
Eric Anholt [Thu, 28 Dec 2017 00:20:12 +0000 (16:20 -0800)]
broadcom/vc5: Turn the CLE XML's memory format into an enum.

6 years agobroadcom/vc5: Emit flat shade flags for varying components > 24.
Eric Anholt [Wed, 27 Dec 2017 23:38:57 +0000 (15:38 -0800)]
broadcom/vc5: Emit flat shade flags for varying components > 24.

This means that with no flatshading we'll emit the single-byte
ZERO_ALL_FLAT_SHADE_FLAGS, and otherwise emit a set of FLAT_SHADE_FLAGS to
get all the bits we need set.

There's a _SET enum in the packet we could use to possibly set entire
ranges of the bitfield without using another packet, but this at least
fixes the conformance failure.

6 years agobroadcom/vc5: Emit proper flatshading code for glShadeModel(GL_FLAT).
Eric Anholt [Wed, 27 Dec 2017 23:12:37 +0000 (15:12 -0800)]
broadcom/vc5: Emit proper flatshading code for glShadeModel(GL_FLAT).

In updating the simulator, behavior changed slightly so that our old code
wasn't getting glxgears's flatshading interpolated right.  Emit flat
shading code just like we would for a normal flat-shaded varying, by
passing a flag in the shader key for glShadeModel(GL_FLAT) state and
customizing the color inputs based on that.

6 years agobraodcom/vc5: Rely on OVRTMUOUT always being set.
Eric Anholt [Fri, 29 Dec 2017 19:48:41 +0000 (11:48 -0800)]
braodcom/vc5: Rely on OVRTMUOUT always being set.

It seems that the HW team has decided that it's the only supported mode,
and it's the mode I actually meant to be using but forgot.  Our table of
return_32_bit should have matched the default non-OVRTMUOUT behavior, so
this change should be invisible.

However, the change revealed that some my return_size checks for swizzling
were a bit confused in the shadow case, so I had to move them to draw time
once we have both the sampler and the view together.

Fixes assertion failures in the updated simulator, where the non-OVRTMUOUT
support has been removed.

6 years agobroadcom/vc5: Move texture return channel setup into the compiler.
Eric Anholt [Tue, 2 Jan 2018 19:26:58 +0000 (11:26 -0800)]
broadcom/vc5: Move texture return channel setup into the compiler.

The compiler decides how many LDTMUs we're going to emit, and that must
match the P1 flags.  This brings the return channel counting to a single
place (so all that's passed into the compiler is "how many return channels
you may request from this texture's format), and was a necessary step for
shadow samplers once we stop using OVRTMUOUT=0.

6 years agobroadcom/vc5: Switch to setting the primitive list format in the RCL.
Eric Anholt [Thu, 21 Dec 2017 01:19:23 +0000 (17:19 -0800)]
broadcom/vc5: Switch to setting the primitive list format in the RCL.

This means that we get a single copy of it emitted, instead of once at the
start of each tile (though it's still executed once per tile).  Fixes
assertion failures with the updated simulator.

6 years agobroadcom/vc5: Switch to using the C++ interface for the simulator.
Eric Anholt [Thu, 21 Dec 2017 00:51:29 +0000 (16:51 -0800)]
broadcom/vc5: Switch to using the C++ interface for the simulator.

In newer versions they've removed the C interface, so make one here.  This
also isolates the Mesa codebase from the simulator codebase, so we don't
have conflicts over things like "unreachable"

6 years agomesa: Add GL_UNSIGNED_INT_2_10_10_10_REV OES read type for BGRX1010102.
Mario Kleiner [Fri, 15 Dec 2017 22:05:09 +0000 (23:05 +0100)]
mesa: Add GL_UNSIGNED_INT_2_10_10_10_REV OES read type for BGRX1010102.

As Marek noted, the GL_RGBA + GL_UNSIGNED_INT_2_10_10_10_REV type
combo is also good for readback of BGRX1010102 framebuffers, not
only for BGRA1010102 framebuffers for use with glReadPixels()
under GLES, so add it for the GL_IMPLEMENTATION_COLOR_READ_TYPE_OES
query.

Successfully tested on gallium r600 driver with a (quickly hacked
for RGBA 10 10 10 0) dEQP testcase
dEQP-EGL.functional.wide_color.window_1010102_colorspace_default.

Suggested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agost/dri: Add option to control exposure of 10 bpc color configs.
Mario Kleiner [Fri, 15 Dec 2017 22:05:08 +0000 (23:05 +0100)]
st/dri: Add option to control exposure of 10 bpc color configs.

Some clients may not like rgb10 fbconfigs and visuals.
Support driconf option 'allow_rgb10_configs' on gallium
to allow per application enable/disable.

The option defaults to enabled.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agost/dri: Add support for BGR[A/X]1010102 formats.
Mario Kleiner [Fri, 15 Dec 2017 22:05:07 +0000 (23:05 +0100)]
st/dri: Add support for BGR[A/X]1010102 formats.

Exposes RGBA 10 10 10 2 and 10 10 10 0 visuals and
fbconfigs for rendering.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agost/dri: Support texture_from_pixmap for BGR[A/X]1010102 formats.
Mario Kleiner [Fri, 15 Dec 2017 22:05:06 +0000 (23:05 +0100)]
st/dri: Support texture_from_pixmap for BGR[A/X]1010102 formats.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agost/dri2: Add buffer handling for BGR[A/X]1010102 formats.
Mario Kleiner [Fri, 15 Dec 2017 22:05:05 +0000 (23:05 +0100)]
st/dri2: Add buffer handling for BGR[A/X]1010102 formats.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agost/dri2: Add format translations for BGR[A/X]1010102 formats.
Mario Kleiner [Fri, 15 Dec 2017 22:05:04 +0000 (23:05 +0100)]
st/dri2: Add format translations for BGR[A/X]1010102 formats.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agost/mesa: Handle BGR[A/X]1010102 formats.
Mario Kleiner [Fri, 15 Dec 2017 22:05:03 +0000 (23:05 +0100)]
st/mesa: Handle BGR[A/X]1010102 formats.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoegl/wayland: Add Wayland shm swrast support for RGB10 winsys buffers.
Mario Kleiner [Fri, 15 Dec 2017 22:05:02 +0000 (23:05 +0100)]
egl/wayland: Add Wayland shm swrast support for RGB10 winsys buffers.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoegl/wayland: Add Wayland dmabuf support for RGB10 winsys buffers. (v2)
Mario Kleiner [Fri, 15 Dec 2017 22:05:01 +0000 (23:05 +0100)]
egl/wayland: Add Wayland dmabuf support for RGB10 winsys buffers. (v2)

Successfully tested under Weston 3.0.
Photometer confirms 10 rgb bits from rendering to display.

v2: Rebased onto master for dri2_teardown_wayland().

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoegl/wayland: Add Wayland drm support for RGB10 winsys buffers.
Mario Kleiner [Fri, 15 Dec 2017 22:05:00 +0000 (23:05 +0100)]
egl/wayland: Add Wayland drm support for RGB10 winsys buffers.

Successfully tested under Weston 3.0.
Photometer confirms 10 rgb bits from rendering to display.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoegl/x11: Handle depth 30 drawables for EGL_KHR_image_pixmap.
Mario Kleiner [Fri, 15 Dec 2017 22:04:59 +0000 (23:04 +0100)]
egl/x11: Handle depth 30 drawables for EGL_KHR_image_pixmap.

Enables eglCreateImageKHR() with target set to
EGL_NATIVE_PIXMAP_KHR to handle color depth 30
X11 drawables.

Note that in theory the drawable depth 32 case in the
current implementation is ambiguous: A depth 32 drawable
could be of format ARGB8888 or ARGB2101010, therefore an
assignment of __DRI_IMAGE_FORMAT_ARGB8888 for a pixmap of
ARGB2101010 format would be wrong. In practice however, the
X-Server (as of v1.19) does not provide any depth 32 visuals
for ARGB2101010 EGL/GLX configs. Those are associated with
depth 30 visuals without an alpha channel instead. Therefore
the switch-case depth 32 branch is only executed for ARGB8888
pixmaps and we get away with this.

Tested with KDE Plasma 5 under X11, DRI2 and DRI3/Present,
selecting EGL + OpenGL compositing and different fbconfigs
with/without 2 bit alpha channel. glxinfo confirms use of
depth 30 visuals for ARGB2101010 only.

Suggested-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoegl/x11: Handle depth 30 drawables under software rasterizer.
Mario Kleiner [Fri, 15 Dec 2017 22:04:58 +0000 (23:04 +0100)]
egl/x11: Handle depth 30 drawables under software rasterizer.

For fixing eglCreateWindowSurface() under swrast, as tested
with LIBGL_ALWAYS_SOFTWARE=1.

Suggested-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoegl/x11: Match depth 30 RGB visuals to 32-bit RGBA EGLConfigs.
Mario Kleiner [Fri, 15 Dec 2017 22:04:57 +0000 (23:04 +0100)]
egl/x11: Match depth 30 RGB visuals to 32-bit RGBA EGLConfigs.

Similar to the matching of 24 bit RGB visuals to 32-bit
RGBA EGLConfigs, so X11 compositors won't alpha-blend any
config with a destination alpha buffer during compositing.

Additionally this fixes failure to select ARGB2101010
configs via eglChooseConfig() with EGL_ALPHA_BITS 2 on
a depth 30 X-Screen. The X-Server doesn't provide any
visuals of depth 32 for ARGB2101010 configs, it only
provides depth 30 visuals. Therefore if we'd only match
ARGB2101010 configs to depth 32 RGBA visuals, we would
not ever get a visual for such a config.

This was apparent in piglit tests for egl configs, which
are fixed by this commit.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agomesa: Add GL_RGBA + GL_UNSIGNED_INT_2_10_10_10_REV for OES read type.
Mario Kleiner [Fri, 15 Dec 2017 22:04:56 +0000 (23:04 +0100)]
mesa: Add GL_RGBA + GL_UNSIGNED_INT_2_10_10_10_REV for OES read type.

This format + type combo is good for BGRA1010102 framebuffers
for use with glReadPixels() under GLES, so add it for the
GL_IMPLEMENTATION_COLOR_READ_TYPE_OES query.

Allows successful testing of 10 bpc / depth 30 rendering with dEQP test
case dEQP-EGL.functional.wide_color.window_1010102_colorspace_default.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoi965/screen: Honor 'allow_rgb10_configs' option. (v2)
Mario Kleiner [Fri, 15 Dec 2017 22:04:55 +0000 (23:04 +0100)]
i965/screen: Honor 'allow_rgb10_configs' option. (v2)

Allows to prevent exposing RGB10 configs and visuals to
clients.

v2: Rename expose_rgb10_configs to allow_rgb10_configs,
    as suggested by Emil.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agodri/common: Add option to allow exposure of 10 bpc color configs. (v2)
Mario Kleiner [Fri, 15 Dec 2017 22:04:54 +0000 (23:04 +0100)]
dri/common: Add option to allow exposure of 10 bpc color configs. (v2)

Some clients may not like RGB10X2 and RGB10A2 fbconfigs and
visuals. Add a new driconf option 'allow_rgb10_configs' to
allow per application enable/disable.

The option defaults to enabled.

v2: Rename expose_rgb10_configs to allow_rgb10_configs,
    as suggested by Emil. Add comment to option parsing,
    to make sure it stays before the ->InitScreen().

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoi965/screen: Add basic support for rendering 10 bpc/depth 30 framebuffers. (v3)
Mario Kleiner [Fri, 15 Dec 2017 22:04:53 +0000 (23:04 +0100)]
i965/screen: Add basic support for rendering 10 bpc/depth 30 framebuffers. (v3)

Expose formats which are supported at least back to Gen 5 Ironlake,
possibly further. Allow creation of 10 bpc winsys buffers for drawables.

glxinfo now lists new RGBA 10 10 10 2/0 formats.

v2: Move the BGRA/BGRX1010102 formats before the RGBA/RGBX8888
    32 bit formats, as the code comments require. Thanks Emil!
    Update num_formats from 3 to 5, to keep the special Android
    handling intact.

v3: Use num_formats = ARRAY_SIZE(formats) - 2 as suggested by Tapani,
    to only exclude the last 2 Android formats, add Tapani's r-b.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoi965/screen: Add XRGB2101010 and ARGB2101010 support for DRI3.
Mario Kleiner [Fri, 15 Dec 2017 22:04:52 +0000 (23:04 +0100)]
i965/screen: Add XRGB2101010 and ARGB2101010 support for DRI3.

Allow DRI3/Present buffer sharing for 10 bpc buffers.
Otherwise composited desktops under DRI3 will only display
black client areas for redirected windows.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoloader/dri3: Add XRGB2101010 and ARGB2101010 support.
Mario Kleiner [Fri, 15 Dec 2017 22:04:51 +0000 (23:04 +0100)]
loader/dri3: Add XRGB2101010 and ARGB2101010 support.

To allow DRI3/Present buffer sharing for 10 bpc buffers.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agodri: Add 10 bpc formats as available formats. (v2)
Mario Kleiner [Fri, 15 Dec 2017 22:04:50 +0000 (23:04 +0100)]
dri: Add 10 bpc formats as available formats. (v2)

Used to support ARGB2101010 and XRGB2101010
winsys framebuffers / drawables, but added
other 10 bpc fourcc's as well for consistency
with definitions in wayland_drm.h, gbm.h, and
drm_fourcc.h.

v2: Align new defines with tabs instead of spaces, for
    consistency with remainder of that block of definitions,
    as suggested by Tapani.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoi965: Support accelerated blit for depth 30 formats. (v2)
Mario Kleiner [Fri, 15 Dec 2017 22:04:49 +0000 (23:04 +0100)]
i965: Support accelerated blit for depth 30 formats. (v2)

Extend intel_miptree_blit() to handle at least
ARGB2101010 -> XRGB2101010, ARGB2101010 -> ARGB2101010,
and XRGB2101010 -> XRGB2101010 via the BLT engine,
but not XRGB2101010 -> ARGB2101010 yet.

This works as tested under Compiz, KDE-5, Gnome-Shell.

v2: Restrict BLT fast path to exclude XRGB2101010 -> ARGB2101010,
    as intel_miptree_set_alpha_to_one() isn't ready to set 2 bit
    alpha channels to 1.0 yet. However, couldn't find a test case
    where this specific blit would be needed, so maybe not much
    of a point to improve here.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoi965: Support xrgb/argb2101010 formats for glx_texture_from_pixmap.
Mario Kleiner [Fri, 15 Dec 2017 22:04:48 +0000 (23:04 +0100)]
i965: Support xrgb/argb2101010 formats for glx_texture_from_pixmap.

Makes compositing under X11/GLX work.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
6 years agoswr/rast: fix MemoryBuffer build break for llvm-6
Tim Rowley [Tue, 2 Jan 2018 16:48:21 +0000 (10:48 -0600)]
swr/rast: fix MemoryBuffer build break for llvm-6

LLVM api change.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104381
Tested-by: Laurent Carlier <lordheavym@gmail.com>
Reviewed-By: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoAndroid: util: fix locale generation in options.h
Rob Herring [Tue, 19 Dec 2017 22:14:41 +0000 (16:14 -0600)]
Android: util: fix locale generation in options.h

The parameters to gen_xmlpool.py are wrong and cause the following
warnings:

Warning: language 'out/target/product/linaro_x86_64/gen/STATIC_LIBRARIES/libmesa_util_intermediates/xmlpool/es/LC_MESSAGES/options.mo' not found.
Warning: language 'out/target/product/linaro_x86_64/gen/STATIC_LIBRARIES/libmesa_util_intermediates/xmlpool/nl/LC_MESSAGES/options.mo' not found.
Warning: language 'out/target/product/linaro_x86_64/gen/STATIC_LIBRARIES/libmesa_util_intermediates/xmlpool/fr/LC_MESSAGES/options.mo' not found.
Warning: language 'out/target/product/linaro_x86_64/gen/STATIC_LIBRARIES/libmesa_util_intermediates/xmlpool/sv/LC_MESSAGES/options.mo' not found.
Warning: language 'external/mesa3d/src/util/xmlpool/t_options.h' not found.
Warning: language 'out/target/product/linaro_x86_64/gen/STATIC_LIBRARIES/libmesa_util_intermediates/xmlpool' not found.
Warning: language 'de' not found.
Warning: language 'es' not found.
Warning: language 'nl' not found.
Warning: language 'fr' not found.
Warning: language 'sv' not found.

The result is English is the only language in options.h. Use "$<"
instead of "$^" because we only need the first dependency (the script),
not all dependencies.

Signed-off-by: Rob Herring <robh@kernel.org>
6 years agoi965: Drop support for the legacy SNORM -> Float equation.
Kenneth Graunke [Tue, 26 Dec 2017 03:10:22 +0000 (19:10 -0800)]
i965: Drop support for the legacy SNORM -> Float equation.

Older OpenGL defines two equations for converting from signed-normalized
to floating point data.  These are:

    f = (2c + 1)/(2^b - 1)                (equation 2.2)
    f = max{c/2^(b-1) - 1), -1.0}         (equation 2.3)

Both OpenGL 4.2+ and OpenGL ES 3.0+ mandate that equation 2.3 is to be
used in all scenarios, and remove equation 2.2.  DirectX uses equation
2.3 as well.  Intel hardware only supports equation 2.3, so Gen7.5+
systems that use the vertex fetcher hardware to do the conversions
always get formula 2.3.

This can make a big difference for 10-10-10-2 formats - the 2-bit value
can represent 0 with equation 2.3, and cannot with equation 2.2.

Ivybridge and older were using equation 2.2 for OpenGL, and 2.3 for ES.
Now that Ivybridge supports OpenGL 4.2, this is wrong - we need to use
the new rules, at least in core profile.  That would leave Gen4-6 doing
something different than all other hardware, which seems...lame.

With context version promotion, applications that requested a pre-4.2
context may get promoted to 4.2, and thus get the new rules.  Zero cases
have been reported of this being a problem.  However, we've received a
report that following the old rules breaks expectations.  SuperTuxKart
apparently renders the cars red when following equation 2.2, and works
correctly when following equation 2.3:

https://github.com/supertuxkart/stk-code/issues/2885#issuecomment-353858405

So, this patch deletes the legacy equation 2.2 support entirely, making
all hardware and APIs consistently use the new equation 2.3 rules.

If we ever find an application that truly requires the old formula, then
we'd likely want that application to work on modern hardware, too.  We'd
likely restore this support as a driconf option.  Until then, drop it.

This commit will regress Piglit's draw-vertices-2101010 test on
pre-Haswell without the corresponding Piglit patch to accept either
formula (commit 35daaa1695ea01eb85bc02f9be9b6ebd1a7113a1):

    draw-vertices-2101010: Accept either SNORM conversion formula.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
6 years agometa: Don't pollute the texture namespace
Ian Romanick [Wed, 20 Jan 2016 01:43:05 +0000 (17:43 -0800)]
meta: Don't pollute the texture namespace

tl;dr: For many types of GL object, we can *NEVER* use the Gen function.

In OpenGL ES (all versions!) and OpenGL compatibility profile,
applications don't have to call Gen functions.  The GL spec is very
clear about how you can mix-and-match generated names and non-generated
names: you can use any name you want for a particular object type until
you call the Gen function for that object type.

Here's the problem scenario:

 - Application calls a meta function that generates a name.  The first
   Gen will probably return 1.

 - Application decides to use the same name for an object of the same
   type without calling Gen.  Many demo programs use names 1, 2, 3,
   etc. without calling Gen.

 - Application calls the meta function again, and the meta function
   replaces the data.  The application's data is lost, and the app
   fails.  Have fun debugging that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agometa: Use _mesa_bind_texture instead of _mesa_BindTexture
Ian Romanick [Wed, 20 Jan 2016 01:15:08 +0000 (17:15 -0800)]
meta: Use _mesa_bind_texture instead of _mesa_BindTexture

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agometa: Use _mesa_CreateTextures instead of _mesa_GenTextures
Ian Romanick [Wed, 20 Jan 2016 00:38:20 +0000 (16:38 -0800)]
meta: Use _mesa_CreateTextures instead of _mesa_GenTextures

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agometa: Track temporary textures using gl_texture_object instead of GL API object handle
Ian Romanick [Thu, 14 Jan 2016 20:07:02 +0000 (12:07 -0800)]
meta: Track temporary textures using gl_texture_object instead of GL API object handle

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agometa/blit: Track temporary texture using gl_texture_object instead of GL API object...
Ian Romanick [Thu, 14 Jan 2016 19:14:49 +0000 (11:14 -0800)]
meta/blit: Track temporary texture using gl_texture_object instead of GL API object handle

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agometa/blit: Use _mesa_bind_texture instead of _mesa_BindTexture
Ian Romanick [Wed, 13 Jan 2016 09:25:59 +0000 (01:25 -0800)]
meta/blit: Use _mesa_bind_texture instead of _mesa_BindTexture

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agometa/blit: Don't bind texture in _mesa_meta_bind_rb_as_tex_image
Ian Romanick [Thu, 14 Jan 2016 18:33:14 +0000 (10:33 -0800)]
meta/blit: Don't bind texture in _mesa_meta_bind_rb_as_tex_image

All of the callers of _mesa_meta_bind_rb_as_tex_image call
_mesa_meta_setup_sampler shortly after.  _mesa_meta_setup_sampler also
binds the texture.  This is necessary because not all paths that lead to
_mesa_meta_setup_sampler some through _mesa_meta_bind_rb_as_tex_image.

Rename the function _mesa_meta_texture_object_from_renderbuffer to
reflect its true purpose.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agometa/blit: Track source texture using gl_texture_object instead of GL API object...
Ian Romanick [Wed, 13 Jan 2016 09:22:43 +0000 (01:22 -0800)]
meta/blit: Track source texture using gl_texture_object instead of GL API object handle

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agometa/blit: Since _mesa_meta_bind_rb_as_tex_image has only one output, return it
Ian Romanick [Wed, 13 Jan 2016 02:21:18 +0000 (18:21 -0800)]
meta/blit: Since _mesa_meta_bind_rb_as_tex_image has only one output, return it

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agometa/blit: Don't return the texture handle from _mesa_meta_bind_rb_as_tex_image
Ian Romanick [Wed, 13 Jan 2016 02:17:33 +0000 (18:17 -0800)]
meta/blit: Don't return the texture handle from _mesa_meta_bind_rb_as_tex_image

It's always the same as *texObj->Name.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agometa/blit: Don't return the target from _mesa_meta_bind_rb_as_tex_image
Ian Romanick [Wed, 13 Jan 2016 02:09:47 +0000 (18:09 -0800)]
meta/blit: Don't return the target from _mesa_meta_bind_rb_as_tex_image

It's always the same as *texObj->Target.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agometa/blit: Don't restore state of the temporary texture
Ian Romanick [Wed, 13 Jan 2016 01:39:54 +0000 (17:39 -0800)]
meta/blit: Don't restore state of the temporary texture

It's about to be destroyed, so there's no point.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agometa/blit: Check the values instead of the target before restoring
Ian Romanick [Wed, 13 Jan 2016 01:37:02 +0000 (17:37 -0800)]
meta/blit: Check the values instead of the target before restoring

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agomesa: Add _mesa_bind_texture method
Ian Romanick [Wed, 13 Jan 2016 09:20:09 +0000 (01:20 -0800)]
mesa: Add _mesa_bind_texture method

Light-weight glBindTexture for internal use.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agoRevert "mesa: remove unused _mesa_delete_nameless_texture()"
Ian Romanick [Wed, 13 Dec 2017 03:41:49 +0000 (19:41 -0800)]
Revert "mesa: remove unused _mesa_delete_nameless_texture()"

Changes in this series use this function.

This reverts commit 048de9e34a2214371481143cddcaa53f52468c6b.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Cc: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: Fold _mesa_record_error into its only caller
Ian Romanick [Tue, 12 Dec 2017 17:05:46 +0000 (09:05 -0800)]
mesa: Fold _mesa_record_error into its only caller

Also, the comment on _mesa_record_error was wrong.
dd_function_table::Error was not called because that function does not
exist.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agoetnaviv: disable in-place resolve for non-supertiled surfaces
Lucas Stach [Tue, 19 Dec 2017 16:35:59 +0000 (17:35 +0100)]
etnaviv: disable in-place resolve for non-supertiled surfaces

The in-place resolve probably has some additional restrictions when not
operating on a super tiled surface. Disable it on non-supertiled surfaces
for now to work around a GPU hang.

Fixes: 78ade659569e ("etnaviv: Do GC3000 resolve-in-place when possible")
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
6 years agoradv: Implement binning on GFX9.
Bas Nieuwenhuizen [Sat, 30 Dec 2017 16:31:44 +0000 (17:31 +0100)]
radv: Implement binning on GFX9.

Overall it does not really help or hurt. The deferred demo gets 1%
improvement and some games a 3% decrease, so I don't think this
should be enabled by default.

But with the code upstream it is easier to experiment with it.

v2: Remove initializing the registers from si_emit_config.

Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Add flag for enabling binning.
Bas Nieuwenhuizen [Sat, 30 Dec 2017 16:31:15 +0000 (17:31 +0100)]
radv: Add flag for enabling binning.

Letting it be disabled by default.

Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoi965: Combine {VS,FS}_OPCODE_GET_BUFFER_SIZE opcodes.
Kenneth Graunke [Mon, 11 Dec 2017 01:03:32 +0000 (17:03 -0800)]
i965: Combine {VS,FS}_OPCODE_GET_BUFFER_SIZE opcodes.

These are the same, we don't need a separate opcode enum per backend.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agonir: add missing local_group_size intrinsic
Rob Clark [Mon, 25 Dec 2017 20:18:00 +0000 (15:18 -0500)]
nir: add missing local_group_size intrinsic

For GL_ARB_compute_variable_group_size

Reported-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agonv50/ir: Fix unused var warnings in release build
Rhys Kidd [Sat, 2 Dec 2017 18:14:25 +0000 (13:14 -0500)]
nv50/ir: Fix unused var warnings in release build

v2: Add preventative comment (Ilia Mirkin)

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
6 years agonvc0: Fix unused var warnings in release build
Rhys Kidd [Sat, 2 Dec 2017 18:06:45 +0000 (13:06 -0500)]
nvc0: Fix unused var warnings in release build

Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
6 years agonv50: Fix unused var warning in release build
Rhys Kidd [Sat, 2 Dec 2017 17:56:26 +0000 (12:56 -0500)]
nv50: Fix unused var warning in release build

Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
6 years agor600: fix textureSize queries with tbos
Roland Scheidegger [Sat, 23 Dec 2017 03:50:13 +0000 (04:50 +0100)]
r600: fix textureSize queries with tbos

piglit doesn't care, but I'm quite confident that the size actually bound
as range should be reported and not the base size of the resource (and
some quick piglit test hacking confirms this).
Also, the array in the constant buffer looks overallocated by a factor of 4.
For eg, also decrease the size by another factor of 2 by using the same
constant slot for both buffer size (required for txq for TBOs) and the number
of layers for cube arrays, as these are mutually exclusive. Could of course use
some more logic and only actually do this for the samplers/images/buffers where
it's required rather than for all, but ah well...

Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agor600: kill off native_integer shader ctx flag
Roland Scheidegger [Fri, 22 Dec 2017 22:31:43 +0000 (23:31 +0100)]
r600: kill off native_integer shader ctx flag

Maybe upon a time it wasn't always true.

Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Also set DCC params for sampling for input attachment usage.
Bas Nieuwenhuizen [Fri, 29 Dec 2017 22:26:33 +0000 (23:26 +0100)]
radv: Also set DCC params for sampling for input attachment usage.

Those are implemented as texture sampling, so we need to make the
texture TC-compatible too.

Fixes: 34d23e82ca9 "radv: set some dcc parameters depending on if texture will be sampled"
Reviewed-by: Fredrik Höglund <fredrik@kde.org>
6 years agoradv: Enable DCC with transfers.
Bas Nieuwenhuizen [Thu, 28 Dec 2017 01:33:00 +0000 (02:33 +0100)]
radv: Enable DCC with transfers.

Before this DCC was in practice disabled for most games. This
enables practical DCC use. Expect a 5-10% perf increase on a
bunch of games on vega @ 4k.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradv: Decompress copy destination if formats are incompatible.
Bas Nieuwenhuizen [Fri, 29 Dec 2017 00:57:17 +0000 (01:57 +0100)]
radv: Decompress copy destination if formats are incompatible.

If both source and destination are DCC compressed, and their formats
are not compatible, we need to decompress one of them to make
sure we can do reinterpretation (which needs src format == dst format)
.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradv: Disable DCC for GENERAL layout and compute transfer dest.
Bas Nieuwenhuizen [Thu, 28 Dec 2017 01:54:10 +0000 (02:54 +0100)]
radv: Disable DCC for GENERAL layout and compute transfer dest.

Apps can use this for render feedback loops, where things are
defined if they render each pixel only once. However, DCC fails
here, as the level of coherence is a block not a pixel, so disable it.

This is also going to help implementing other stuff.

Even if we optimize this later to only happen if there actually is
a loop (if possible at all ...), then the machinery is still useful
to exclude images accessible by the SDMA queue when that is implemented.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradv: Don't init DCC metadata during FS resolve.
Bas Nieuwenhuizen [Fri, 29 Dec 2017 00:28:48 +0000 (01:28 +0100)]
radv: Don't init DCC metadata during FS resolve.

It should already be valid there + the RB will update it during
rendering.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradv: Make color meta operations layout aware.
Bas Nieuwenhuizen [Fri, 29 Dec 2017 00:25:07 +0000 (01:25 +0100)]
radv: Make color meta operations layout aware.

For fast clear eliminate and decompressions, we always use the most compressed
format.

For clears, the code already creates a renderpass on demand with the exact same
layout as specified.

Otherwise we start distinguishing between GENERAL and TRANSFER_DST_OPTIMAL.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradv: Add compute DCC decompress.
Bas Nieuwenhuizen [Sat, 23 Dec 2017 12:17:52 +0000 (13:17 +0100)]
radv: Add compute DCC decompress.

We do an in place copy where we read compressed and write decompressed.
By doing this in sizes that cover entire DCC blocks and waiting for all
reads in the block before starting to write we avoid corruption.

In the end we clear the DCC metadata to 0xffffffff.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradv: Use the meta fast clear destructor on construction failure.
Bas Nieuwenhuizen [Sat, 23 Dec 2017 11:37:13 +0000 (12:37 +0100)]
radv: Use the meta fast clear destructor on construction failure.

Simplifies failure paths. The caller already calls
radv_device_finish_meta_fast_clear_flush_state on failure.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradv: Add GFX DCC decompress.
Bas Nieuwenhuizen [Sat, 23 Dec 2017 11:18:29 +0000 (12:18 +0100)]
radv: Add GFX DCC decompress.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradv: Don't enable DCC / TC compat HTILE for storage images.
Bas Nieuwenhuizen [Sat, 23 Dec 2017 10:42:18 +0000 (11:42 +0100)]
radv: Don't enable DCC / TC compat HTILE for storage images.

We don't get a layout when binding to a descriptor set, but can
assume that the LAYOUT is GENERAL.

For DCC stores with the DCC bits set will result in a hang, so
better be safe than sorry.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoRevert "radv/gfx9: fix block compression texture views."
Bas Nieuwenhuizen [Fri, 29 Dec 2017 09:59:27 +0000 (10:59 +0100)]
Revert "radv/gfx9: fix block compression texture views."

This reverts commit 59515780433837ad3975f8ed20b93cf2fe6870e5.

The mentioned commit causes a hang in DoW3 on Vega.

Fixes: 59515780433 "radv/gfx9: fix block compression texture views."
Acked-by: Dave Airlie <airlied@redhat.com>
6 years agosvga: update SVGA_NEW_ flags for updating sampler state
Brian Paul [Thu, 28 Dec 2017 17:07:59 +0000 (10:07 -0700)]
svga: update SVGA_NEW_ flags for updating sampler state

The SVGA_NEW_FS flag is needed since we now examine the fragment
shader's fs_shadow_compare_units flags.  The SVGA_NEW_TEXTURE_FLAGS
flag is not needed since it's only for pre-VGPU10.

No piglit changes.  This doesn't fix any known issues but it could
pop up somewhere.  Suggested by Charmaine.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agosvga: whitespace, formatting fixes in svga_state_tss.c
Brian Paul [Thu, 28 Dec 2017 17:38:29 +0000 (10:38 -0700)]
svga: whitespace, formatting fixes in svga_state_tss.c

6 years agoradv/gfx9: use correct swizzle parameter to work out border swizzle.
Dave Airlie [Fri, 29 Dec 2017 01:32:36 +0000 (11:32 +1000)]
radv/gfx9: use correct swizzle parameter to work out border swizzle.

This should fix:
dEQP-VK.pipeline.sampler.view_type.*.format.b4g4r4a4_unorm_pack16.address_modes.all_mode_clamp_to_border_opaque_black
and a few others in that area.

Fixes: b11c4a5546 (radv: add texture descriptor/fmask/cmask support for GFX9)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv/gfx9: use a bigger hammer to flush cb/db caches.
Dave Airlie [Fri, 29 Dec 2017 01:00:34 +0000 (11:00 +1000)]
radv/gfx9: use a bigger hammer to flush cb/db caches.

amdvlk is probably more subtle than this but it never uses
the inv cb/db variants, we fail some CTS tests without this.

Fixes:
dEQP-VK.renderpass.dedicated_allocation.formats.d32_sfloat_s8_uint.input*.

Fixes: c2fbeb7ca05 (radv: add GFX9 cache flushing support.)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> (for now :-)
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv/gfx9: fix block compression texture views.
Dave Airlie [Fri, 29 Dec 2017 00:30:39 +0000 (10:30 +1000)]
radv/gfx9: fix block compression texture views.

This ports a fix from amdvlk, to fix the sizing for mip levels
when block compressed images are viewed using uncompressed views.

Fixes:
dEQP-VK.image.texel_view_compatible.graphic.extended*bc*

Fixes: e38685cc62e 'Revert "radv: disable support for VEGA for now."'
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv/gfx9: fix buffer to image for 3d images on compute queues
Dave Airlie [Thu, 28 Dec 2017 23:20:21 +0000 (09:20 +1000)]
radv/gfx9: fix buffer to image for 3d images on compute queues

This fixes some of the broken:
dEQP-VK.synchronization.op.multi_queue.*64x64x8* tests.

Fixes: e38685cc62e 'Revert "radv: disable support for VEGA for now."'
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv/gfx9: fix 3d image clears on compute queues
Dave Airlie [Thu, 28 Dec 2017 22:52:07 +0000 (08:52 +1000)]
radv/gfx9: fix 3d image clears on compute queues

This fixes some of the broken:
dEQP-VK.synchronization.op.multi_queue.*64x64x8* tests.

Fixes: e38685cc62e 'Revert "radv: disable support for VEGA for now."'
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv/gfx9: fix 3d image to image transfers on compute queues.
Dave Airlie [Thu, 28 Dec 2017 07:10:35 +0000 (17:10 +1000)]
radv/gfx9: fix 3d image to image transfers on compute queues.

This fixes some of the broken:
dEQP-VK.synchronization.op.multi_queue.*64x64x8* tests.

Fixes: e38685cc62e 'Revert "radv: disable support for VEGA for now."'
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoanv/device: Mark all state buffers as needing capture
Jason Ekstrand [Wed, 27 Dec 2017 16:41:30 +0000 (08:41 -0800)]
anv/device: Mark all state buffers as needing capture

Previously, we were flagging the instruction state buffer for capture
but not surface state or dynamic state.  We want those captured too.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agointel/aubinator: Gracefully handle dynamic state not being available
Jason Ekstrand [Wed, 27 Dec 2017 16:40:30 +0000 (08:40 -0800)]
intel/aubinator: Gracefully handle dynamic state not being available

Some older versions of the Vulkan driver didn't properly tag dynamic
state as needing to be captured.  Also, this prevents crashes when
looking at dumps on older kernels.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agointel/aubinator: Free section data last
Jason Ekstrand [Wed, 27 Dec 2017 16:39:10 +0000 (08:39 -0800)]
intel/aubinator: Free section data last

We were walking the sections, printing the batches, and then freeing
them in one pass.  If the batch happens to reference any earlier
sections (which it almost certainly will since it's at the end), we will
access freed memory.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agospirv: consider bitsize when handling OpSwitch cases
Eero Tamminen [Tue, 26 Dec 2017 15:21:21 +0000 (07:21 -0800)]
spirv: consider bitsize when handling OpSwitch cases

This reverts commit 7665383a33f9ce9256aa121cbe4d3bd948dff145 and is
squashed together with https://patchwork.freedesktop.org/patch/194610/
(spirv: avoid infinite loop / freeze in vtn_cfg_walk_blocks()) which
fixes https://bugs.freedesktop.org/show_bug.cgi?id=104359 properly.

Fixes: 9702fac68e (spirv: consider bitsize when handling OpSwitch cases)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104359
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agosvga: check for null fs pointer in update_samplers()
Brian Paul [Thu, 28 Dec 2017 16:16:44 +0000 (09:16 -0700)]
svga: check for null fs pointer in update_samplers()

This can happen when there's no active fragment shader, such as
when using transform feedback.  This wasn't hit by any Piglit test
but is hit by Daniel Rákos' Nature demo.  VMware bug 2026189.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agost/mesa: increase size of glsl_base_type bitfields
Brian Paul [Wed, 27 Dec 2017 20:36:30 +0000 (13:36 -0700)]
st/mesa: increase size of glsl_base_type bitfields

Change 59f458cd8703b97b31b8 added more enums to glsl_base_type.  We
have to bump up the size of the bitfields for fields of this type
for MSVC.  Also, add another assertion to catch another place where
this enum bitfield is used.

Reviewed-by: Neha Bhende <bhenden@vmware.com>
6 years agoradv: fix pipeline statistics end query on compute queue
Dave Airlie [Thu, 28 Dec 2017 06:31:48 +0000 (16:31 +1000)]
radv: fix pipeline statistics end query on compute queue

It's legal to a pipeline stat query on a compute queue,
but we'd emit the wrong packet here. This should fix it to emit
the correct packet.

Noticed while inspecting the mpv hang.

Fixes: ad61eac250 (radv: factor out eop event writing code. (v2))
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: fix events on compute queues.
Dave Airlie [Thu, 28 Dec 2017 06:26:18 +0000 (16:26 +1000)]
radv: fix events on compute queues.

The event emission wasn't sending the correct packet for gfx8 compute
queues, which explains why it works on vega fine.

This fixes the mpv vulkan hang.

Fixes: ad61eac250 (radv: factor out eop event writing code. (v2))
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: move local bos usage to a perftest flag.
Dave Airlie [Wed, 27 Dec 2017 23:49:32 +0000 (09:49 +1000)]
radv: move local bos usage to a perftest flag.

These seem mildly unstable on vega, crashing CTS in various fun ways,
and looks like leaking memory.

Disable for now, but leave the option to enable them.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agovulkan/wsi: free cmd pools
Dave Airlie [Wed, 27 Dec 2017 23:45:07 +0000 (09:45 +1000)]
vulkan/wsi: free cmd pools

We destroy the pools but don't free the container.

This fixes:
dEQP-VK.wsi.xlib.swapchain.simulate_oom*

Fixes: d50937f137 (vulkan/wsi: Implement prime in a completely generic way)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Always use fragment resolve if dest uses DCC.
Bas Nieuwenhuizen [Sat, 23 Dec 2017 10:43:49 +0000 (11:43 +0100)]
radv: Always use fragment resolve if dest uses DCC.

HW resolve does not support it either.

Fixes: 2a04f5481df "radv/meta: select resolve paths"
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Use correct framebuffer size for partial FS resolves.
Bas Nieuwenhuizen [Wed, 27 Dec 2017 23:19:28 +0000 (00:19 +0100)]
radv: Use correct framebuffer size for partial FS resolves.

Framebuffer is from 0,0, not (dst.x, dst.y).

Fixes: 69136f4e633 "radv/meta: add resolve pass using fragment/vertex shaders"
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Fix fragment resolve destination offset.
Bas Nieuwenhuizen [Tue, 26 Dec 2017 15:11:35 +0000 (16:11 +0100)]
radv: Fix fragment resolve destination offset.

The position start at (dst.x, dst.y), so if we want the source to
start at (src.x, src.y), we have to offset by (src.x-dst.x,src.y-dst.y).

Haven't tested that this fixed anything yet, but found by inspection.

Fixes: 69136f4e633 "radv/meta: add resolve pass using fragment/vertex shaders"
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Don't handle DCC in compute resolve.
Bas Nieuwenhuizen [Mon, 25 Dec 2017 13:30:50 +0000 (14:30 +0100)]
radv: Don't handle DCC in compute resolve.

If the destination has DCC, we will use the FS resolve.

Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Flush caches before subpass resolve.
Bas Nieuwenhuizen [Mon, 25 Dec 2017 13:27:28 +0000 (14:27 +0100)]
radv: Flush caches before subpass resolve.

Fixes: f4e499ec791 "radv: add initial non-conformant radv vulkan driver"
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Invert condition for all samples identical during resolve.
Bas Nieuwenhuizen [Mon, 25 Dec 2017 12:15:06 +0000 (13:15 +0100)]
radv: Invert condition for all samples identical during resolve.

the samples_identical instruction returns 0 if they are differet, so
we have to do the extra work if the result is 0, not if it is != 0.

Fixes: f4e499ec791 "radv: add initial non-conformant radv vulkan driver"
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoegl: don't try the software path twice
Eric Engestrom [Wed, 20 Dec 2017 15:53:10 +0000 (15:53 +0000)]
egl: don't try the software path twice

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reported-by: Brendan King <Brendan.King@imgtec.com>
6 years agoegl: rename LIBGL_ALWAYS_SOFTWARE variable from UseFallback to ForceSoftware
Eric Engestrom [Wed, 20 Dec 2017 15:53:09 +0000 (15:53 +0000)]
egl: rename LIBGL_ALWAYS_SOFTWARE variable from UseFallback to ForceSoftware

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl: let each platform decided how to handle LIBGL_ALWAYS_SOFTWARE
Eric Engestrom [Wed, 20 Dec 2017 15:53:08 +0000 (15:53 +0000)]
egl: let each platform decided how to handle LIBGL_ALWAYS_SOFTWARE

My refactor in 47273d7312cb5b5b6b0b9 missed this early return; because
of it, setting UseFallback one layer above actually prevented the
software path from being used.

Remove this early return and let each platform's dri2_initialize_*()
decide what it can do with the LIBGL_ALWAYS_SOFTWARE restriction.

platform_{surfaceless,x11,wayland} were already handling it themselves.

Fixes: 47273d7312cb5b5b6b0b9 "egl: set UseFallback if LIBGL_ALWAYS_SOFTWARE is set"
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reported-by: Brendan King <Brendan.King@imgtec.com>
6 years agoegl: link libEGL against the dynamic version of libglapi
Brendan King [Mon, 18 Dec 2017 16:33:18 +0000 (16:33 +0000)]
egl: link libEGL against the dynamic version of libglapi

Note: the following happens only when using slibtool.
Since this is a very serious breakage, we will keep the workaround until
a better solution is available.

DRI modules store the address of the dispatch table in a TLS variable,
_glapi_tls_Dispatch.

Changes to the way libEGL is built in d884d8d0077c16d459b1 resulted in
it being statically linked against libglapi, and thus containing its own
copy of _glapi_tls_Dispatch. The result was that some applications would
fail to work (e.g. deqp-egl, which dynamically loads libEGL), due to the
DRI module storing the dispatch table address in one copy of
_glapi_tls_Dispatch, and libEGL obtaining the address from another copy
of the variable.

Fixes: d884d8d0077c16d459b1 "egl/dri: link directly to libglapi.so"
Signed-off-by: Brendan King <Brendan.King@imgtec.com>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoradv: don't do format replacement on tc compat htile surfaces.
Dave Airlie [Wed, 27 Dec 2017 07:00:29 +0000 (17:00 +1000)]
radv: don't do format replacement on tc compat htile surfaces.

For copies the texture unit needs to know the depth format so
it can read the htile data properly.

This fixes:
dEQP-VK.renderpass.suballocation.formats.d32_sfloat_s8_uint.load.clear

Fixes: ad3d98da9f (radv: enable tc compatible htile for d32s8 also.)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>