OSDN Git Service
Nicolai Hähnle [Wed, 12 Jul 2017 13:38:57 +0000 (15:38 +0200)]
radeonsi/gfx9: fix crash building monolithic merged ES-GS shader
Forwarding from the ES prolog to the ES just barely exceeds the current
maximum array size when 16 vertex attributes are used. Give it a decent
bump to account for merged shaders having up to 32 user SGPRs.
Fixes a crash in GL45-CTS.multi_bind.draw_bind_vertex_buffers.
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Thomas Hellstrom [Tue, 4 Jul 2017 03:55:15 +0000 (12:55 +0900)]
loader/dri3: Use dri3_find_back in loader_dri3_swap_buffers_msc
If the application hasn't done any drawing since the last call, we
would reuse the same back buffer which was used for the previous swap,
which may not have completed yet. This could result in various issues
such as tearing or application hangs.
In the normal case, the behaviour is unchanged.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97957
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101683
Cc: mesa-stable@lists.freedesktop.org
[Michel Dänzer: Make Thomas' fix from bugzilla actually work as
intended, write commit log]
Jason Ekstrand [Tue, 13 Jun 2017 01:57:45 +0000 (18:57 -0700)]
i965/screen: Drop get_tiled_height
It's no longer used.
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Tue, 13 Jun 2017 01:57:32 +0000 (18:57 -0700)]
i965/screen: Use ISL for doing image import checks
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Tue, 13 Jun 2017 01:21:09 +0000 (18:21 -0700)]
i965/screen: Use ISL for allocating image BOs
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Tue, 13 Jun 2017 00:52:41 +0000 (17:52 -0700)]
intel/isl: Add a helper to convert tilings from ISL to i915
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Mon, 12 Jun 2017 23:52:20 +0000 (16:52 -0700)]
intel/isl: Add basic modifier introspection
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Mon, 12 Jun 2017 23:02:00 +0000 (16:02 -0700)]
i965: Add an isl_device to intel_screen
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Fri, 16 Jun 2017 17:31:31 +0000 (10:31 -0700)]
i965/miptree: Move CCS allocation into create_for_dri_image
Any form of CCS on gen9+ only works on Y-tiled images. The only caller
of create_for_bo which uses Y-tiled BOs is create_for_dri_image.
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Fri, 16 Jun 2017 17:28:39 +0000 (10:28 -0700)]
i965: Use create_for_dri_image in intel_update_image_buffer
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Fri, 16 Jun 2017 16:57:12 +0000 (09:57 -0700)]
i965/miptree: Add support for window system images to create_for_dri_image
We want to start using create_for_dri_image for all miptrees created
from __DRIimage, including those which come from a window system. In
order to allow for fast clears to still work on window system buffers,
we need to allow for creating aux surfaces.
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Fri, 16 Jun 2017 18:35:32 +0000 (11:35 -0700)]
i965/miptree: Add a colorspace parameter to create_for_dri_image
The __DRI_FORMAT enums are all UNORM but we will frequently want sRGB
when creating miptrees for renderbuffers. This lets us specify.
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Wed, 28 Jun 2017 22:13:58 +0000 (15:13 -0700)]
main/formats: Add a get_linear_format_srgb helper
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Wed, 28 Jun 2017 22:10:34 +0000 (15:10 -0700)]
main/formats: Autogenerate _mesa_get_srgb_format_linear
Due to the wonders of autogeneration, this new version covers a few
formats that the old version was missing:
MESA_FORMAT_SRGB8_ALPHA8_ASTC_3x3x3
MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x3x3
MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x4x3
MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x4x4
MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x4x4
MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5x4
MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5x5
MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x5x5
MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x6x5
MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x6x6
Reviewed-by: Chad Versace <chadversary@chromium.org>
Ben Widawsky [Tue, 30 May 2017 11:53:58 +0000 (17:23 +0530)]
i965/miptree: Allocate mt earlier in update winsys
Later commits require intel_update_image_buffer() to have control over
the miptree creation. However, intel_update_winsys_renderbuffer_miptree()
currently creates it based on the given buffer object. This patch moves
the creation to the caller side.
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Ben Widawsky [Tue, 30 May 2017 11:53:57 +0000 (17:23 +0530)]
i965/miptree: Add a return for updating of winsys
There is nothing particularly useful to do currently if the update
fails, but there is no point carrying on either. As a result, this has a
behavior change.
v2: Make the return type a bool (Topi)
v3: Don't leak the bo if update_winsys_renderbuffer fails. (Jason)
Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com> (v2)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Mon, 12 Jun 2017 17:40:46 +0000 (10:40 -0700)]
i965: Use miptree_create_for_dri_image in image_target_renderbuffer_storage
This does make a tiny functional change in that we now also test for
whether or not the format supports texturing and not just rendering.
However, this should have no practical effect as all renderbuffers use
texturable formats.
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Mon, 12 Jun 2017 17:38:48 +0000 (10:38 -0700)]
i965/miptree: Set level_x/h in create_for_dri_image
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Mon, 12 Jun 2017 17:36:18 +0000 (10:36 -0700)]
i965/miptree: Add tile_x/y to total_width/height
This is what we do in intel_image_target_renderbuffer_storage and it
makes more sense than stomping them. Because the image gets created as
a 2D image with one miplevel, they should already be equal to the
provided width/height. Adding the tile offset makes some sense
depending on how you interpret the fields.
The only place these fields are used for in state setup is to set up the
image parameters we pass into shaders. There may be issues here if you
try to use image_load_store on something pulled in from EGL but that's
probably broken already. This just makes it consistently broken.
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Mon, 12 Jun 2017 17:30:44 +0000 (10:30 -0700)]
i965/miptree: Pass the offset into create_for_bo in create_for_dri_image
Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Jason Ekstrand [Mon, 12 Jun 2017 17:25:26 +0000 (10:25 -0700)]
i965: Move the DRIimage -> miptree code to intel_mipmap_tree.c
This is mostly a direct port. The only bit of refactoring that was done
was to make creating a planar miptree be an early return from the
non-planar case. Alternatively, we could have three functions: two
helpers and a main function to just call the right helper. Making the
planar case an early return seemed cleaner.
Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Ilia Mirkin [Tue, 11 Jul 2017 00:58:31 +0000 (20:58 -0400)]
nv50/ir: fix threads calculation for non-compute shaders
We were using the "cp" union fields, which are only valid for compute
shaders. The threads calculation affects the available GPRs, so just
pick a small number for other shader types to avoid limiting available
registers.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
Ilia Mirkin [Wed, 12 Jul 2017 01:44:12 +0000 (21:44 -0400)]
freedreno/ir3: fix load_front_face conversion
The comments are correct - we get -1 and 0. However by adding 1, we
convert this into 0,1. This mostly works for conditionals, but when
negated, this will yield the wrong result. Instead just negate the
values (as they are backwards -- -1 means back instead of front).
Fixes tests/shaders/glsl-fs-frontfacing-not.shader_test and
dEQP-GLES3.functional.shaders.builtin_variable.frontfacing on A530.
The latter also tested on A306 by Rob Clark.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Alex Smith [Wed, 12 Jul 2017 09:29:52 +0000 (10:29 +0100)]
radv: Fix descriptors for cube images with VK_IMAGE_USAGE_STORAGE_BIT
If a cube image has VK_IMAGE_USAGE_STORAGE_BIT set, the type in an image
view's descriptor was set to a 2D array (and a few other fields adjusted
accordingly). This is correct when the image view is actually bound as a
storage image, but not when bound as a sampled image. In that case the
type should be set as a cube.
Fix by generating 2 sets of descriptors at view creation time for both
storage and non-storage usage, and then choose between them based on
descriptor type when writing descriptor sets.
v2: Generate storage descriptors for images with TRANSFER_DST, since
those may be used as storage images internally.
Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Alex Smith [Wed, 12 Jul 2017 10:14:21 +0000 (11:14 +0100)]
radv: Fix possible invalid free of dynamic descriptors
This free was left in after dynamic descriptors were changed to not be
allocated separately from the descriptor set, and can cause a crash.
Fixes:
39644fa40a3 ("radv: Don't allocate dynamic descriptors separately")
Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Bruce Cherniak [Wed, 12 Jul 2017 20:04:47 +0000 (15:04 -0500)]
swr: Add path to draw directly from client memory without copy.
If size of client memory copy is too large, don't copy. The draw will
access user-buffer directly and then block. This is faster and more
efficient than queuing many large client draws.
Applications that still use large client arrays benefit from this. VMD
is an example.
The threshold for this path defaults to 32KB. This value can be
overridden by setting environment variable SWR_CLIENT_COPY_LIMIT.
v2: Use #define for default value, rather than hard-coded constant.
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
Bruce Cherniak [Wed, 12 Jul 2017 20:04:46 +0000 (15:04 -0500)]
swr: Move environment config options into separate function.
Moved reading of environment config options out of
swr_create_screen_internal, into a separate swr_validate_env_options.
This is to keep from cluttering create_screen.
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
Bruce Cherniak [Wed, 12 Jul 2017 20:04:45 +0000 (15:04 -0500)]
swr: Remove hard-coded constant and "todo" comment.
Removed the hard-coded constant in favor of a #define. Also removed
TODO comment. The constant value doesn't need an environment
configurable option.
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
Rob Herring [Wed, 5 Jul 2017 18:19:58 +0000 (11:19 -0700)]
Android: Fix vc4 build since XML changes.
Since commit
7f80a9ff1312 ("vc4: Introduce XML-based packet header
generation like Intel's."), the vc4 build on Android is broken:
out/target/product/linaro_x86_64/gen/STATIC_LIBRARIES/libmesa_broadcom_genxml_intermediates/broadcom/cle/v3d_packet_v21_pack.h:12:10: fatal error: 'v3d_packet_helpers.h' file not found
external/mesa3d/src/gallium/drivers/vc4/vc4_cl_dump.c:28:10: fatal error: 'vc4_packet.h' file not found
The path of the generated header needs to be fixed since we build out of
tree.
Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Rob Herring <robh@kernel.org>
Charmaine Lee [Tue, 11 Jul 2017 06:06:11 +0000 (23:06 -0700)]
st/mesa: add a winsys buffers list in st_context
Commit
a5e733c6b52e93de3000647d075f5ca2f55fcb71 fixes the dangling
framebuffer object by unreferencing the window system draw/read buffers
when context is released. However this can prematurely destroy the
resources associated with these window system buffers. The problem is
reproducible with Turbine Demo running with VMware driver. In this case,
the depth buffer content was lost when the context is rebound to a
drawable.
To prevent premature destroy of the resources associated with
window system buffers, this patch maintains a list of these buffers in
the context, making sure the reference counts of these buffers will not
reach zero until the associated framebuffer interface objects no
longer exist. This also helps to avoid unnecessary destruction and
re-construction of the resources associated with the framebuffer.
Fixes VMware bug
1909807.
Reviewed-by: Brian Paul <brianp@vmware.com>
Kenneth Graunke [Tue, 11 Jul 2017 21:01:20 +0000 (14:01 -0700)]
i965: Drop bogus pthread_mutex_unlock in map_gtt error path.
The locking was supposed to go away in commit
314647c4c206917ec01b7
(i965: Drop global bufmgr lock from brw_bo_map_* functions.), but
this lone unlock remains.
I'm guessing I messed this up when splitting up Chris's patch.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Anuj Phogat [Tue, 27 Jun 2017 22:16:35 +0000 (15:16 -0700)]
intel/compiler: Don't use opt_sampler_eot() optimization on gen10+
This optimization has been removed on gen10+.
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Eric Anholt [Mon, 5 Jun 2017 21:50:26 +0000 (14:50 -0700)]
vc4: Set shareable BOs as T tiled if possible
X11 and GL compositor performance on VC4 has been terrible because of our
SHARED-usage buffers all being forced to linear. This swaps SHARED &&
!LINEAR buffers over to being tiled.
This is an expected win for all GL compositors during rendering (a full
copy of each shared texture per draw call), allows X11 to be used with
decent performance without a GL compositor, and improves X11 windowed
swapbuffers performance as well. It also halves the memory usage of
shared buffers that get textured from. The only cost should be idle
systems with a scanout-only buffer that isn't flagged as LINEAR, in which
case the memory bandwidth cost of scanout goes up ~25%.
This implements the EGL_EXT_image_dma_buf_import_modifiers extension,
supporting the VC4 T_TILED modifier.
v2: Added modifier support to resource creation/import, and
advertisement (by daniels).
v3: Fix old-kernel fallback path, fix compiler error and warnings, and
comment touchups (by anholt).
Reviewed-by: Daniel Stone <daniels@collabora.com>
Eric Anholt [Thu, 22 Jun 2017 18:45:08 +0000 (19:45 +0100)]
vc4: Use vc4_setup_slices for resource import
Rather than open-coding populating the first slice inside resource
import, use vc4_setup_slices to do it for us.
v2: Rebase on VC4_DEBUG=surf change
Reviewed-by: Daniel Stone <daniels@collabora.com>
Eric Anholt [Thu, 29 Jun 2017 00:39:34 +0000 (17:39 -0700)]
vc4: Make the miptree debug code available under VC4_DEBUG=surf
I kept flipping the bool on for debug, so let's just make it available.
Reviewed-by: Daniel Stone <daniels@collabora.com>
Eric Anholt [Thu, 15 Jun 2017 23:52:22 +0000 (16:52 -0700)]
vc4: Switch back to using a local copy of vc4_drm.h.
Needing to get our uapi header from libdrm has only complicated things.
Follow intel's lead and drop our requirement for it.
Generated from the same commit mentioned in the README.
v2: Update Android.mk as well, move vc4_drm.h reference for distcheck.
Reviewed-by: Daniel Stone <daniels@collabora.com>
Eric Anholt [Wed, 28 Jun 2017 23:35:55 +0000 (16:35 -0700)]
intel: Move the DRM uapi headers to a non-Intel location.
I want to remove vc4's dependency on headers from libdrm as well, but
storing multiple copies of drm_fourcc.h in our tree would be silly.
v2: Update Android.mk as well, move distcheck drm*.h references to
top-level noinst_HEADERS.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> (v1)
Reviewed-by: Daniel Stone <daniels@collabora.com> (v1)
Reviewed-by: Rob Herring <robh@kernel.org>
Eric Anholt [Wed, 12 Jul 2017 16:41:21 +0000 (09:41 -0700)]
vc4: Remove a stale comment.
The kernel hasn't been synchronous in a couple of years, plus there was
synchronization code right there.
Jason Ekstrand [Wed, 12 Jul 2017 02:04:38 +0000 (19:04 -0700)]
anv: Round u_vector element sizes to a power of two
This fixes 32-bit builds of the driver. Commit
08413a81b93dc537fb0c3
changed things so that we now put struct anv_states in the u_vector for
binding tables. On 64-bit builds, sizeof(struct anv_state) is a power
of two but it isn't on 32-bit builds.
Fixes:
08413a81b93dc537fb0c34327ad162f07e8c3427
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
Brian Paul [Wed, 12 Jul 2017 16:27:43 +0000 (10:27 -0600)]
svga: whitespace, formatting fixes in svga_swtnl_backend.c
Brian Paul [Wed, 12 Jul 2017 16:25:10 +0000 (10:25 -0600)]
svga: whitespace, formatting fixes in svga_swtnl_draw.c
Brian Paul [Wed, 12 Jul 2017 16:24:11 +0000 (10:24 -0600)]
svga: whitespace, formatting fixes in svga_swtnl_state.c
Brian Paul [Tue, 11 Jul 2017 18:57:46 +0000 (12:57 -0600)]
svga: move comment, declaration in svga_init_shader_key_common()
put the comment before the relevant code. Move declaration of
swizzle_tab var to where it's used.
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Brian Paul [Tue, 11 Jul 2017 14:15:57 +0000 (08:15 -0600)]
draw: whitespace, formatting fixes in draw_vs_exec.c
Trivial.
Brian Paul [Tue, 11 Jul 2017 14:12:49 +0000 (08:12 -0600)]
draw: s/unsigned/enum tgsi_semantic/
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Emil Velikov [Tue, 4 Jul 2017 15:53:40 +0000 (16:53 +0100)]
travis: lower SWR requirement to GCC 4.8, aka std=c++11
With ealier commit we relaxed the requirement from C++14 to C++11.
Update the build script so that it
Cc: Tim Rowley <timothy.o.rowley@intel.com
Fixes:
0b80b025021 ("swr: relax c++ requirement from c++14 to c++11")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Emil Velikov [Fri, 30 Jun 2017 11:09:32 +0000 (12:09 +0100)]
docs: update HTTP -> HTTPS reference to reflect reality
The link recently got updated to https.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Emil Velikov [Wed, 28 Jun 2017 15:41:30 +0000 (16:41 +0100)]
egl: set KHR_gl_texture_3D_image only when the requirements are met.
DRI_IMAGE's createImageFromTexture is used to implement the extension,
so we should check for it prior to advertising.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Emil Velikov [Wed, 28 Jun 2017 23:35:56 +0000 (00:35 +0100)]
egl: enhance KHR_gl_image extensions checks
Drop the (duplicate) top-level check in dri2_create_image_khr() and add
the respective checks in dri2_create_image_khr_{texture,renderbuffer}
v2: use unreachable instead of assert in dri2_create_image_khr_texture
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Emil Velikov [Wed, 28 Jun 2017 23:24:27 +0000 (00:24 +0100)]
egl: don't set modifier if no modifiers are available
If no modifiers are available, the variable will never be used. Thus
there's no point in initialising it.
Cc: Varad Gautam <varad.gautam@collabora.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Emil Velikov [Wed, 28 Jun 2017 23:12:15 +0000 (00:12 +0100)]
egl: check for extensions' presence during attr parsing
If the respective extension is not supported, one should return
EGL_BAD_PARAMETER as mentioned in earlier commits.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Emil Velikov [Wed, 28 Jun 2017 23:19:16 +0000 (00:19 +0100)]
egl: add width/height as EXT_image_dma_buf_import attrs
Although not listed amongst the initial EGL_LINUX_DRM_FOURCC_EXT and
friends list, the spec reads
... Required attributes and their values are as
follows:
* EGL_WIDTH & EGL_HEIGHT: The logical dimensions of the buffer in pixels
* EGL_LINUX_DRM_FOURCC_EXT: The pixel format of the buffer, as specified
by drm_fourcc.h and used as the pixel_format parameter of the
drm_mode_fb_cmd2 ioctl.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Emil Velikov [Wed, 28 Jun 2017 23:09:15 +0000 (00:09 +0100)]
egl: polish EXT_image_dma_buf_import attr parsing
Simplify the existing if/else + temporary variable into if (foo) return
X.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Emil Velikov [Wed, 28 Jun 2017 22:46:11 +0000 (23:46 +0100)]
egl: simplify EXT_image_dma_buf_import_modifiers attr parsing
Move the common extension check at the top.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Emil Velikov [Wed, 28 Jun 2017 21:39:51 +0000 (22:39 +0100)]
egl: split _eglParseImageAttribList into per extension functions
Will allow us to simplify existing code and make further improvements
short and simple.
No functional change intended.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Emil Velikov [Wed, 28 Jun 2017 19:31:18 +0000 (20:31 +0100)]
egl: call _eglError within _eglParseImageAttribList
As per EGL_KHR_image_base:
If an attribute specified in <attrib_list> is not one of the
attributes listed in Table bbb, the error EGL_BAD_PARAMETER is
generated.
We should set the error as opposed to simply log it.
Currently we have a partial solution, whereby only some of the callers
call _eglError().
Since that has proven to be less robust, simply set the error by the
function itself and change the return type to EGLBoolean, updating the
callers.
So now the code is slightly simpler. Plus the follow-up fixes will be
easier to manage.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Emil Velikov [Wed, 28 Jun 2017 20:23:00 +0000 (21:23 +0100)]
egl: move eglCreateDRMImageMESA's malloc later
Don't bother allocating any memory until we're finished parsing and
sanitising all the attributes.
As a nice side effect we now consistently set eglError when any of
the attrib/values are not correct.
Strangely enough the spec does not mention _anything_ about what error
should be set where, even if the implementation already sets the odd
one.
Cc: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Brian Paul [Tue, 11 Jul 2017 20:56:00 +0000 (14:56 -0600)]
svga: fix texture swizzle writemasking
Commit
bfe1e7737a76e3b046 changed how texture swizzles are set up.
This exposed a latent bug in the VMware driver: we were ignoring
the texture instruction's writemask when applying the 0 and 1
swizzle terms.
This wasn't caught by the Piglit texture swizzle test because it
only exercises fixed function (no write masking).
Fixes issues seen with ETQW apitrace.
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Chris Wilson [Tue, 11 Jul 2017 15:54:25 +0000 (16:54 +0100)]
i965: Use VALGRIND_MAKE_MEM_x in place of MALLOCLIKE/FREELIKE
Valgrind doesn't actually implement VALGRIND_FREELIKE_BLOCK as the
exact inverse of VALGRIND_MALLOCLIKE_BLOCK. It makes the block
inaccessible, but still leaves it defined in its allocation tracker i.e.
it will report the mmap as lost despite the call to FREELIKE!
Instead of treating the mmap as an allocation, treat it as changing the
access bits upon the memory, i.e. that it becomes defined (because of
the buffer objects always contain valid content from the user's
perspective) upon mmap and inaccessible upon munmap. This makes memcheck
happy without leaving it thinking there is a very large leak.
Finally for consistency, we treat all the mmap/munmap paths the same
even though valgrind can intercept the regular mmap used for GTT. We
could move this in the drm_mmap/drm_munmap macros, but that quickly
looks ugly given the desire for those to support different OSes, but I
didn't try that hard!
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Kenneth Graunke [Sat, 1 Jul 2017 08:55:55 +0000 (01:55 -0700)]
i965: Fix asynchronous mappings on !LLC platforms.
When using a read-only CPU mapping, we may encounter stale buffer
contents. For example, the Piglit primitive-restart test offers the
following scenario:
1. Read data via a CPU map.
2. Destroy that buffer.
3. Create a new buffer - obtaining the same one via the BO cache.
4. Call BufferSubData, which does a GTT map with MAP_WRITE | MAP_ASYNC.
(We avoid set_domain for async mappings, so no flushing occurs.)
5. Read data via a CPU map.
(Without explicit clflushing, this will contain data from step 1!)
Otherwise, everything ought to work, keeping in mind that we never use
CPU maps for writing - just read-only CPU maps.
This restores the performance gains after Matt's revert in commit
71651b3139c501f50e6547c21a1cdb816b0a9dde.
v2: Do the invalidate later, and even when asking for a brand new map.
v3: Add more comments from Chris.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Kenneth Graunke [Sat, 1 Jul 2017 18:33:35 +0000 (11:33 -0700)]
i965: Don't use PREAD for glGetBufferSubData().
Just map the buffer and memcpy. This will do a CPU mmap, which should
be reasonably efficient, and doing this gives us full control over the
domains and caching instead of leaving it to the kernel.
This prevents regressions on Braswell in the next commit. Specifically
GL45-CTS.shader_atomic_counters.basic-buffer-operations. Because async
maps start skipping set-domain, the pread thought everything was nicely
still in the CPU domain, and returned stale data.
v2: Use _mesa_error_no_memory() if the map fails instead of crashing.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Tim Rowley [Thu, 29 Jun 2017 19:37:07 +0000 (14:37 -0500)]
swr: build driver proper separate from rasterizer
swr used to build and link the rasterizer to the driver, and to support
multiple architectures we needed to have multiple versions of the
driver/rasterizer combination, which needed to link in much of mesa.
Changing to having one instance of the driver and just building
architecture specific versions of the rasterizer gives a large reduction
in disk space.
libGL.so 6464 Kb -> 7000 Kb
libswrAVX.so 10068 Kb -> 5432 Kb
libswrAVX2.so 9828 Kb -> 5200 Kb
Total 26360 Kb -> 17632 Kb
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Tim Rowley [Thu, 29 Jun 2017 19:03:43 +0000 (14:03 -0500)]
swr: switch to using SwrGetInterface api table
Use the SWR rasterizer API through the table returned from
SwrGetInterface rather than referencing the functions directly.
This will allow us to move to a model of having the driver dynamically
load the appropriate swr architecture library.
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
George Kyriazis [Tue, 11 Jul 2017 14:13:49 +0000 (08:13 -0600)]
swr/rast: make SWR_VISIBLE attribute work for windows
Needed to expose SwrGetInterface
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
Lionel Landwerlin [Wed, 21 Jun 2017 16:48:14 +0000 (17:48 +0100)]
i965: perf: use new subslices numbers from device info
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Lionel Landwerlin [Wed, 21 Jun 2017 16:44:17 +0000 (17:44 +0100)]
intel: add number of subslices to device info
We could have used a single integer to store that value, but
Cannonlake has different number of subslices per slice depending on
the GT.
v2: Add CFL subslice numbers (Lionel)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Ben Widawsky [Thu, 6 Jul 2017 00:04:16 +0000 (17:04 -0700)]
i965: Use already existing eu_total
Reduces IOCTL calls by 1, and provides a centralized place to override
such configurations if we have a need to do so.
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Chris Wilson [Mon, 12 Jun 2017 14:17:20 +0000 (15:17 +0100)]
i965: Resolve framebuffers before signaling the fence
From KHR_fence_sync:
When the condition of the sync object is satisfied by the fence
command, the sync is signaled by the associated client API context,
causing any eglClientWaitSyncKHR commands (see below) blocking on
<sync> to unblock. The only condition currently supported is
EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR, which is satisfied by
completion of the fence command corresponding to the sync object,
and all preceding commands in the associated client API context's
command stream. The sync object will not be signaled until all
effects from these commands on the client API's internal and
framebuffer state are fully realized. No other state is affected by
execution of the fence command.
If clients are passing the fence fd (from EGL_ANDROID_native_fence_sync)
to a compositor, that fence must only be signaled once the framebuffer
is resolved and not before as is currently the case.
v2: fixup assert to use GL_SYNC_GPU_COMMANDS_COMPLETE (Chad)
Reported-by: Sergi Granell <xerpi.g.12@gmail.com>
Fixes:
c636284ee8ee ("i965/sync: Implement DRI2_Fence extension")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Sergi Granell <xerpi.g.12@gmail.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Chad Versace <chadversary@chromium.org>
Cc: Daniel Stone <daniels@collabora.com>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Brian Paul [Mon, 10 Jul 2017 20:14:17 +0000 (14:14 -0600)]
svga: s/unsigned/enum tgsi_texture_type/
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Brian Paul [Mon, 10 Jul 2017 20:12:27 +0000 (14:12 -0600)]
svga: s/unsigned/enum tgsi_swizzle
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Brian Paul [Mon, 10 Jul 2017 20:09:25 +0000 (14:09 -0600)]
svga: s/unsigned/enum tgsi_interpolate_mode/
And s/unsigned/enum tgsi_interpolate_loc/
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Brian Paul [Mon, 10 Jul 2017 20:08:36 +0000 (14:08 -0600)]
svga: s/unsigned/enum tgsi_file_type/
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Brian Paul [Mon, 10 Jul 2017 20:03:48 +0000 (14:03 -0600)]
svga: s/unsigned/enum tgsi_semantic/
Makes gdb debugging a little nicer.
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Kenneth Graunke [Sat, 1 Jul 2017 08:55:52 +0000 (01:55 -0700)]
i965: Assert that we don't use CPU write maps to non-coherent buffers.
Using CPU maps of non-coherent buffers can get us in a lot of trouble,
and WC maps are a reasonable alternative anyway. Guard against shooting
ourselves in the foot by adding an assert, and comment.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Chris Wilson [Tue, 20 Jun 2017 10:39:22 +0000 (11:39 +0100)]
i965: Disable access to CPU mmap for async access on non-LLC machines
If the user triggers an implicit batch flush while holding access to a
CPU mapped buffer, that mmapping will be invalidated by the kernel for
non-LLC devices. (The kernel when executing a batch will change the
cache domain of the buffers in that batch, which for non-LLC CPU access
will cause that buffer to be clflushed and any further CPU access to be
discarded.) To prevent this, simply disallow any CPU async mmap access.
The cases where async CPU access to a non-LLC buffer should continue to
be allowed via their preferred snooping path.
v2 (Ken): Reword the comment slightly.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Chris Wilson [Mon, 19 Jun 2017 10:55:00 +0000 (11:55 +0100)]
i965: Track when a bo is shared with an external client
If the buffer is being shared with an external client, our own state
tracking may be stale and in some cases we may wish to double check with
the kernel/hw state. At the moment, this is synonymous with not being
reusable, but the semantics between reusable and external are quite
different and we will have more examples of non-reusable buffers in the
near future.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Kenneth Graunke [Sat, 1 Jul 2017 09:04:50 +0000 (02:04 -0700)]
intel: Fix clflushing on modern (Baytrail+) Atom CPUs.
Thanks to Chris Wilson for pointing this out.
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Kenneth Graunke [Sat, 1 Jul 2017 08:59:40 +0000 (01:59 -0700)]
intel: Move clflush helpers from anv to common/gen_clflush.h.
I want to use these in the OpenGL driver as well.
v2: Add to COMMON_FILES in Makefile.sources (caught by Emil)
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Matt Turner <mattst88@gmail.com>
James Legg [Mon, 26 Jun 2017 09:46:23 +0000 (10:46 +0100)]
spirv: Fix reaching unreachable for compare exchange on images
We were hitting the
unreachable("Invalid image opcode")
near the end of vtn_handle_image when parsing the
SpvOpAtomicCompareExchange opcode.
v2: Add stable CC.
v3: Ignore SpvOpAtomicCompareExchangeWeak. It requires the Kernel
capability which is not exposed in Vulkan, and spirv_to_nir is not used
for OpenCL which does support it.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
CC: <mesa-stable@lists.freedesktop.org>
Marek Olšák [Thu, 6 Jul 2017 00:23:46 +0000 (02:23 +0200)]
gallium: use "ull" number suffix to keep the QtCreator parser happy
It can't parse "llu".
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Chris Wilson [Fri, 7 Jul 2017 12:12:54 +0000 (13:12 +0100)]
i965: Use brw_bo_wait() for brw_bo_wait_rendering()
Currently, we use set_domain() to cause a stall on rendering. But the
set-domain ioctl has the side-effect of changing the kernel's cache
domain underneath the struct_mutex, which may perturb state if there was
no rendering to wait upon and in general is much heavier than the
lockless wait-ioctl. Historically libdrm used set-domain as we did not
have an explicit wait-ioctl (and the patches to teach it to use wait if
available were lost in the mists). Since mesa already depends upon a
kernel support the wait-ioctl, we do not need to supply a fallback.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Brian Paul [Mon, 10 Jul 2017 14:36:15 +0000 (08:36 -0600)]
svga: fix PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE value
This query is supposed to return the max texture buffer size/width in
texels, not size in bytes. Divide by 16 (the largest format size) to
return texels.
Fixes Piglit arb_texture_buffer_object-max-size test.
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by :Charmaine Lee <charmainel@vmware.com>
Brian Paul [Sun, 9 Jul 2017 19:45:28 +0000 (12:45 -0700)]
svga: fix breakage in create_backed_surface_view()
This fixes a regression in some piglit tests since commit
5e5d5f1a2eb.
I think I mis-resolved the merge conflict when cherry-picking that
commit to master.
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Jason Ekstrand [Fri, 7 Jul 2017 17:57:09 +0000 (10:57 -0700)]
anv: Stop setting domains to RENDER on EXEC_OBJECT_WRITE
The reason we were doing this was to ensure that the kernel did the
appropriate cross-ring synchronization and flushing. However, the
kernel only looks at EXEC_OBJECT_WRITE to determine whether or not to
insert a fence. It only cares about the domain for determining whether
or not it needs to clflush the BO before using it for scanout but the
domain automatically gets set to RENDER internally by the kernel if
EXEC_OBJECT_WRITE is set.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Ilia Mirkin [Sun, 9 Jul 2017 22:06:25 +0000 (18:06 -0400)]
a5xx: fix condition for updating *_FS_OUTPUT_CNTL
The register values depend on the currently set program, so make sure to
revalidate when the program changes.
Fixes glsl-1.10-fragdepth as well as
dEQP-GLES3.functional.shaders.fragdepth.compare.*
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Dave Airlie [Thu, 6 Jul 2017 22:09:07 +0000 (23:09 +0100)]
radv/ac: drop setting xnack
Since radv uses compute rings and we can't know when we are setting
up the shaders what ring they are to be used on, we should just use
the default xnack setting. This may be suboptimal in some places,
but if we hit a problem, we likely should try and address this
between llvm and mesa.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Sun, 9 Jul 2017 19:34:04 +0000 (20:34 +0100)]
radv: add support for using addrlib max alignment.
Rather than using 64k, use what addrlib returns as the base
alignment for vulkan allocations.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Ilia Mirkin [Sat, 8 Jul 2017 00:32:24 +0000 (20:32 -0400)]
nir: copy front interpolation when creating fake back color input
Fixes a bunch of gl_BackColor interpolation tests that had explicit
interpolation specified on the fragment shader gl_Color.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Ilia Mirkin [Sat, 8 Jul 2017 15:13:35 +0000 (11:13 -0400)]
a5xx: remove no-longer-accurate border color layout comment
Better to just point at the bcolor_entry struct which has our current
understanding encoded into it. Also add an assert to ensure that the
struct remains the expected size.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Ilia Mirkin [Sat, 8 Jul 2017 14:51:19 +0000 (10:51 -0400)]
a5xx: fix border color for depth formats
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Ilia Mirkin [Sat, 8 Jul 2017 14:16:56 +0000 (10:16 -0400)]
a5xx: add border color clamping, add packed border color formats
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Ilia Mirkin [Sat, 8 Jul 2017 12:46:02 +0000 (08:46 -0400)]
a5xx: fix border colors for swizzled texture formats
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Ilia Mirkin [Sat, 8 Jul 2017 12:32:32 +0000 (08:32 -0400)]
a5xx: fix integer texture border colors
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Ilia Mirkin [Sat, 8 Jul 2017 01:10:05 +0000 (21:10 -0400)]
a5xx: fix primitive restart
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Andres Gomez [Sat, 8 Jul 2017 12:21:20 +0000 (15:21 +0300)]
nir/spirv: Remove unnecessary comment.
It should have been removed after
00c47e111c.
Cc: Jason Ekstrand <jason@jlekstrand.net>
Cc: Connor Abbott <cwabbott0@gmail.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Bas Nieuwenhuizen [Fri, 7 Jul 2017 13:56:57 +0000 (15:56 +0200)]
radv: Add compute htile clear for combined depth+stencil surfaces.
Figured out the clear value when we have a combined depth stencil
surface.
Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Roland Scheidegger [Fri, 7 Jul 2017 22:14:35 +0000 (00:14 +0200)]
draw: handle more TGSI_SEMANTIC_COLOR indices
It could only handle indices 0/1, otherwise what happened was bad (accessing
array out of bounds, no crash but kind of random). This is enough for the gl
state tracker (primary/secondary color) but not enough for some other state
trackers (d3d9 has no limits on the number of color interpolants).
The complexity with color semantics are all due to the front/back mapping (2
outputs in the vs map to one input in the fs) so this isn't extended to
indices > 1 - d3d9 has no use for back colors, therefore this isn't needed and
still only 2 back colors can be handled correctly.
Reviewed-by: Brian Paul <brianp@vmware.com>
Matias N. Goldberg [Wed, 5 Jul 2017 17:02:50 +0000 (14:02 -0300)]
st/mesa: Fix grabbing the wrong variant if glDrawPixels is called
By design pixel shaders can have up to 3 variants:
* The standard one.
* glDrawPixels variant.
* glBitmap variant.
However "shader_has_one_variant" ignores this fact, and therefore
st_update_fp would select the wrong variant if glDrawPixels or glBitmap
was ever called.
This patch fixes the problem. If the standard variant has been created,
calling glDrawPixels or glBitmap will append the variant to the second
entry of the linked list, so that st_update_fp still selects the right
one if shader_has_one_variant is set.
If the standard variant hasn't been created yet and glDrawPixel/Bitmap
has been called, st_update_fp will will see this and take the slow path
instead. The standard variant will then be added at the front of the
linked list, so that the next time the fast path is taken.
Blender in particular is hit by this bug.
v2: Marek - cosmetic changes
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=101596
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Nanley Chery [Wed, 5 Jul 2017 18:42:00 +0000 (11:42 -0700)]
Revert "intel/isl: Only create a CCS buffer if the image supports rendering"
This reverts commit
8aaa13467dc289d35dc7900ab9fab9a7689c4178, which was
based on an incorrect assumption. Unlike the restriction placed on image
views in the Vulkan API, OpenGL allows you to render to texture views
whose formats differ from the originals.
Bugzilla: https://bugzilla.freedesktop.org/show_bug.cgi?id=101677
Brian Paul [Thu, 6 Jul 2017 23:54:49 +0000 (17:54 -0600)]
mesa: finish implementing glPrimitiveRestartNV() for display lists
If we try to build a display list with just a glPrimitiveRestartNV()
call, we'd crash because of a null GLvertexformat::PrimitiveRestartNV
pointer. This change fixes that case.
The previous patch fixed the case of calling glPrimitiveRestartNV()
inside a glBegin/End pair.
v2: minor clean-up in save_PrimitiveRestartNV(), per Charmaine.
Reviewed-by: Charmaine Lee <charmainel@vmware.com>