Failure during instance creation will leave instance->wayland_wsi
undefined. When we then try to clean that up we crash. Set
instance->wayland_wsi to NULL on failure and only clean it up if it's
non-NULL.
Fixes part of dEQP-VK.api.object_management.alloc_callback_fail.*
The kernel is going to give us whole pages anyway, so allocating part of a
page doesn't help. And this ensures that we can always work with whole
pages.
As per the spec:
minMemoryMapAlignment is the minimum required alignment, in bytes, of
host-visible memory allocations within the host address space. When
mapping a memory allocation with vkMapMemory, subtracting offset bytes
from the returned pointer will always produce a multiple of the value of
this limit.
First off, it now uses isl formats instead of anv_format. Also, it
properly handles integer vs. floating-point default channels and can
properly handle alpha-only channels. (Not sure if those are allowed).
This is done by passing the entrypoint name into spirv_to_nir. It will
then process the shader as if that were the only entrypoint we care about.
Instead of returning a nir_shader, it now returns a nir_function.
If we're going to hav valgrind verify state streams then we need to ensure
that once we choose a pointer into a block we always use that pointer until
the block is freed. I was trying to do this with the "current_map" thing.
However, that breaks down because you have to use the map from the block
pool to get to the stream_block to get at current_map. Instead, this
commit changes things to track the stream_block by pointer instead of by
offset into the block pool.
When I first did the valgrindifying for stream allocators, I misunderstood
some things about valgrind's expectations for NOACCESS and UNDEFINED.
First off, valgrind expects things to be marked NOACCESS before you
allocate out of them. Since our blocks came from a pool backed by a
mmapped memfd, they came in as UNDEFINED; we needed to mark them as
NOACCESS. Also, I didn't realize that VALGRIND_MEMPOOL_CHANGE only updated
the mempool allocation state and didn't actually change definedness; we had
to add a VALGRIND_MAKE_MEM_UNDEFINED to get rid of the NOACCESS on the
newly allocated portion.
anv_block_pool_init calls anv_block_pool_grow which checks
device->info.has_llc to see if it needs to set caching parameters.
If we don't set device->info early enough, this reads an undefined value
which is probably 0 and not what we want on llc platforms.
Found with valgrind.
Previously this wasn't a problem. However, with the new API update,
descriptor sets can now be sparse so the client doesn't have to provide an
entry for every binding. This means that it's possible for a binding to be
uninitialized other than the memset. In that case, we want to have a null
array of immutable samplers.
The plan all along was to eventualyl move isl out of the Vulkan
directory, because I intended i965 and anvil to share it.
A small problem I encountered when attempting to write unit tests for
isl precipitated the move. I discovered that it's easier to get isl
unit tests to build if I remove the extra, unneeded dependencies
injected by src/vulkan/Makefile.am. And the easiest way to remove those
unneeded dependencies is to move isl out of src/vulkan. (Unit tests come
in subsequent commits).
The code generated may be vec4 or simd8 depending on how we start the
compiler.
To run the GS in SIMD8, set the INTEL_SCALAR_GS environment variable.
This was added in:
commit 36fd653817
Author: Kenneth Graunke <kenneth@whitecape.org>
Date: Wed Mar 11 23:14:31 2015 -0700
i965: Add scalar geometry shader support.
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
This is what image_view does. Also, we really need to do this so that we
can properly handle the combined offsets from the buffer and from
pCreateInfo.
This fixes some of the nonzero offset buffer view CTS tests.
When building RENDER_SURFACE_STATE, the driver set
SurfaceType = anv_image::surface_type, which was calculated during
anv_image_init(). This was bad because the value of
anv_image::surface_type was taken from a gen-specific header,
gen8_pack.h, even though the anv_image structure is used for all gens.
Replace anv_image::surface_type with a gen-specific lookup function,
anv_surftype(), defined in gen${x}_state.c.
The lookup function contains some useful asserts that caught some nasty
bugs in anv meta, which were fixed in the previous commit.
Meta unconditionally used VK_IMAGE_VIEW_TYPE_2D in the functions below.
This caused some out-of-bound memory accesses.
anv_CmdCopyImage
anv_CmdBlitImage
anv_CmdCopyBufferToImage
anv_CmdClearColorImage
Fix it by adding a new function, anv_meta_get_view_type().
Regarding the subimages within a surface, sometimes isl called them
"images" and sometimes "LODs". This patch make isl consistently refer to
them as "images". I choose the term "image" over "LOD" because LOD is
an misnomer when applied to 3D surfaces. The alignment applies to each
individual 2D subimage, not to the LOD as a whole.
This patch changes no behavior. It's just a manually performed,
case-insensitive, replacement s/lod/image/ that maintains correct
indentation. any behavior.
Previously, meta would pass null shaders in for the VS when it intended to
disable the VS. However, this meant that we didn't know what inputs we had
and would dead-code things in the FS. In order to solve this, we
hard-coded a number. Now meta passes in a VS even if it plans to disable
the stage so this is no longer needed.
Don't validate the baseArrayLayer and layerCount of cube images. This
allows us to remove a bloated lookup table and an unneeded struct
definition (anv_image_view_info).
Similar to anv_cmd_buffer_push_constants, but handles the compute
pipeline, which requires different setup from the other stages.
This also handles initializing the compute shader local IDs.
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Replace
anv_image_create_info::force_tiling
anv_image_create_info::tiling
with the bitmask
anv_image_create_info::isl_tiling_flags
This allows us to drop the function
anv_image.c:choose_isl_tiling_flags().
Fixes assertion in vkCreateImage when VkFormat is combined depthstencil.
Fixed many vulkancts tests that use combined depthstencil. For example,
fixes dEQP-VK.pipeline.depth.format.d16_unorm_s8_uint.compare_ops.\
not_equal_less_or_equal_not_equal_greater.
We're required to expose a host-visible, coherent memory type. On big
core GPUs that share, LLC, we can expose one such memory type that's
also cached. However, on non-LLC GPUs we can't both be cached and
coherent. Thus, we expose both the required coherent type and the cached
but non-coherent combination.
Regular objects are created I915_CACHING_CACHED on LLC platforms and
I915_CACHING_NONE on non-LLC platforms. However, userptr objects are
always created as I915_CACHING_CACHED, which on non-LLC means
snooped. That can be useful but comes with a bit of overheard. Since
we're eplicitly clflushing and don't want the overhead we need to turn
it off.
Pre-Skylake, RENDER_SUFFACE_STATE.SurfaceVerticalAlignment is in units
of surface samples. A surface sample is equivalent to a pixel in all
surfaces except interleaved multisample surfaces.
In Skylake, it is in units of surface elements. A surface element is
equivalent to a surface sample except for compressed formats, in which
case the element is a compression block.