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>
Olivier Lauffenburger [Thu, 6 Jul 2017 15:45:00 +0000 (09:45 -0600)]
vbo: fix glPrimitiveRestartNV crash inside a display list
glPrimitiveRestartNV crashes when it is called during the compilation
of a display list.
There are two reasons:
- ctx->Driver.CurrentSavePrimitive is not set to the current primitive
- save_PrimitiveRestartNV() calls _save_Begin() which only sets an
OpenGL error, instead of calling vbo_save_NotifyBegin().
This patch correctly calls vbo_save_NotifyBegin() but it detects
the current primitive mode by looking at the latest saved primitive.
Additional work by Brian Paul
Signed-off-by: Olivier Lauffenburger <o.lauffenburger@topsolid.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101464
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Brian Paul [Thu, 6 Jul 2017 22:31:43 +0000 (16:31 -0600)]
st/mesa: remove unused st_framebuffer::Private field
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Brian Paul [Thu, 6 Jul 2017 17:59:55 +0000 (11:59 -0600)]
mesa: add some braces in _mesa_make_current()
Slightly better readability.
Brian Paul [Thu, 6 Jul 2017 17:09:10 +0000 (11:09 -0600)]
vbo: rename target->index in loopback code
Because it's a vertex attribute index.
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Brian Paul [Thu, 6 Jul 2017 17:04:10 +0000 (11:04 -0600)]
vbo: whitespace/formatting fixes in vbo_save_loopback.c
Trivial.
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Brian Paul [Thu, 6 Jul 2017 16:53:41 +0000 (10:53 -0600)]
vbo: simplify vbo_save_NotifyBegin()
This function always returned GL_TRUE. Just make it a void function.
Remove unreachable code following the call to vbo_save_NotifyBegin()
in save_Begin() in dlist.c
There were some stale comments that no longer applied since an earlier
code refactoring.
No Piglit regressions.
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Brian Paul [Thu, 6 Jul 2017 02:08:54 +0000 (20:08 -0600)]
svga: adjust line subpixel position for HWv8
This fixes two regressions on HWv8:
Piglit gl-1.0-ortho-pos
Piglit/glean fbo
This was caused by commit
c2b92dada076a "svga: clamp device line width
to at least 1 to fix HWv8 line stippling"
This also fixes two conform tests: Vertex Order and Polygon Face
No Piglit/conform changes with HWv9 or later.
VMware bug
1905053
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Aleksander Morgado [Thu, 6 Jul 2017 21:18:57 +0000 (23:18 +0200)]
etnaviv: fix refcnt initialization in etna_screen
Despite being a member of the etna_screen struct, 'refcnt' is used by
the winsys-specific logic to track the reference count of the object
managed in a hash table. When the count reaches zero, the pipe screen
is removed from the table and destroyed.
Fix the logic by initializing the refcnt to 1 when screen created.
This initialization is done in etna_screen_create(), to follow the
same logic as in freedreno and virgl.
Fixes: c9e8b49b885 ("etnaviv: gallium driver for Vivante GPUs")
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Ilia Mirkin [Fri, 7 Jul 2017 04:33:50 +0000 (00:33 -0400)]
a5xx: add support for rendering to RGB10A2_UNORM formats
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Ilia Mirkin [Fri, 7 Jul 2017 04:19:03 +0000 (00:19 -0400)]
a5xx: set uint/sint bits for mrt output register
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Ilia Mirkin [Fri, 7 Jul 2017 01:03:03 +0000 (21:03 -0400)]
a5xx: add backface stencil emission
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Samuel Pitoiset [Fri, 30 Jun 2017 16:48:12 +0000 (18:48 +0200)]
radeonsi: fix invalidating bindless buffer descriptors
The VA is stored at [4:5], not [0:1]. This invalidated all
texture buffer descriptors when they were made resident in
the current context.
This removes few partial flushes and cache invalidations which
are needed when updating a bindless descriptor on the fly with
a WRITE_DATA packet.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Olivier Lauffenburger [Thu, 6 Jul 2017 15:27:00 +0000 (09:27 -0600)]
st/wgl: Implement wglUseFontBitmaps.
wglUseFontBitmaps is currently a noop.
This patch implements this function for Windows.
Misc code clean-ups by Brian.
Signed-off-by: Olivier Lauffenburger <o.lauffenburger@topsolid.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Olivier Lauffenburger [Thu, 6 Jul 2017 15:08:00 +0000 (09:08 -0600)]
st/wgl: improve selection of pixel format
Current selection of pixel format does not enforce the request of
stencil or depth buffer if the color depth is not the same as
requested.
For instance, GLUT requests a 32-bit color buffer with an 8-bit
stencil buffer, but because color buffers are only 24-bit, no
priority is given to creating a stencil buffer.
This patch gives more priority to the creation of requested buffers
and less priority to the difference in bit depth.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101703
Signed-off-by: Olivier Lauffenburger <o.lauffenburger@topsolid.com>
Tested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Alex Smith [Fri, 30 Jun 2017 10:15:42 +0000 (11:15 +0100)]
ac/nir: Fix ordering of parameters for image atomic cmpswap intrinsics
The NIR parameters are ordered "compare, data", matching GLSL, but both
the image and buffer LLVM intrinsics take them the other way around.
This is already handled correctly for SSBO atomics.
Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Fixes: f4e499ec791 "radv: add initial non-conformant radv vulkan driver"
Brian Paul [Wed, 5 Jul 2017 20:48:33 +0000 (14:48 -0600)]
mesa: simplify get_tex_images_for_clear()
Get rid of redundant code.
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Brian Paul [Wed, 5 Jul 2017 20:44:08 +0000 (14:44 -0600)]
mesa: new comments, assertion related to glClearTexSubImage
Reviewed-by: Charmaine Lee <charmainel@vmware.com>