Commit Graph

1096 Commits

Author SHA1 Message Date
Kristian Høgsberg Kristensen 5526c1782a vk: Handle allocation failures in meta init paths
Fixes dEQP-VK.api.object_management.alloc_callback_fail.* failures.
2016-01-04 10:07:08 -08:00
Kristian Høgsberg Kristensen b2ad2a20b6 vk: Handle allocation failure in anv_pipeline_init()
Fixes dEQP-VK.api.object_management.alloc_callback_fail.* failures.
2016-01-04 10:06:50 -08:00
Kristian Høgsberg Kristensen 3954594eb4 vk: Call vk_error when we generate a VK_ERROR 2016-01-04 10:02:50 -08:00
Kristian Høgsberg Kristensen 75e01c8b2d vk: Only finish wayland wsi if we created it
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.*
2016-01-04 10:02:50 -08:00
Jason Ekstrand 6b0b57225c anv/device: Only allocate whole pages in AllocateMemory
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.
2016-01-02 07:52:24 -08:00
Jason Ekstrand f076d5330d anv/device: Handle non-4k-aligned calls to MapMemory
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.
2016-01-01 09:29:29 -08:00
Jason Ekstrand 6b5cbdb317 anv/format: Get rid of num_channels 2015-12-31 12:07:43 -08:00
Jason Ekstrand 3fe1f118f8 anv/cmd_buffer: Fix a pointer-cast typo 2015-12-31 12:07:43 -08:00
Jason Ekstrand 5318424d49 anv/pipeline: Better vertex input channel setup
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).
2015-12-31 12:02:08 -08:00
Jason Ekstrand c6364495b2 anv/pipeline: Move vk_to_gen tables into a shared header 2015-12-31 12:02:08 -08:00
Jason Ekstrand 3421ba1843 anv/device: Place memory types at heapIndex == 0
Previously, they were at heapIndex == 1 even though we only advertised one
heap.
2015-12-30 19:32:43 -08:00
Jason Ekstrand 0fe4580e64 nir/spirv: Add support for multiple entrypoints per shader
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.
2015-12-30 17:45:43 -08:00
Jason Ekstrand e993e45eb1 nir/spirv: Get the shader stage from the SPIR-V
Previously, we depended on it being passed in.
2015-12-30 17:45:43 -08:00
Jason Ekstrand e6fc170afb anv/allocator: Rework state streams again
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.
2015-12-30 11:40:38 -08:00
Jason Ekstrand 28243b2fba gen7/8/cmd_buffer: Allocate the correct ammount for COLOR_CALC_STATE
We were allocating 6 bytes when we should have been allocating 6 dwords.
2015-12-30 10:37:57 -08:00
Jason Ekstrand a0b2829f20 anv/stream_alloc: Properly manage valgrind NOACCESS and UNDEFINED status
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.
2015-12-30 10:36:19 -08:00
Kenneth Graunke ccd84848f0 anv/state: Fix reversed MIN vs. MAX in levelCount handling.
The point is to promote a levelCount of 0 to 1 before subtracting 1.
This needs MAX, not MIN.
2015-12-29 15:51:14 -08:00
Jason Ekstrand a33fcc0fd4 Merge remote-tracking branch 'mesa-public/master' into vulkan
This pulls in nir_builder_init_simple_shader and allows us to delete
anv_nir_builder.h entirely.
2015-12-29 13:53:41 -08:00
Jason Ekstrand e10b0e2b49 anv/pipeline: Use vs_prog_data.inputs_read when computing vb_used 2015-12-29 13:03:01 -08:00
Jason Ekstrand bbf99511d0 gen7/8/pipeline: s/vb_used/elements in emit_vertex_input 2015-12-29 09:40:22 -08:00
Kristian Høgsberg Kristensen fc03723bcd vk: Fill out buffer surface state when updating descriptor set
We can do this when we update the descriptor set instead of on the
fly.
2015-12-28 21:57:56 -08:00
Kristian Høgsberg Kristensen a00524a216 vk: Unstub VkSemaphore implementation
There really is nothing to do for us here, at least with the current
kernel interface.
2015-12-28 21:57:56 -08:00
Jason Ekstrand 5fab35d090 gen7/pipeline: Actually use inputs_read from the VS for laying out inputs 2015-12-28 18:21:11 -08:00
Jason Ekstrand b090f9dce1 gen8/pipeline: Actually use inputs_read from the VS for laying out inputs 2015-12-28 18:21:11 -08:00
Jason Ekstrand 3eb108ef87 anv/meta: Fix the pos_out location for the vertex shader 2015-12-28 18:21:11 -08:00
Jason Ekstrand 9c84b6cce0 anv/device: Set device->info sooner in CreateDevice
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.
2015-12-28 13:29:01 -08:00
Jason Ekstrand 7aaed91581 nir/spirv: Move to its own directory 2015-12-28 11:49:39 -08:00
Jason Ekstrand d5fa51bdee Merge remote-tracking branch 'mesa-public/master' into vulkan
This pulls in the removal of nir_function_overload
2015-12-28 10:56:31 -08:00
Jason Ekstrand ea77b384e8 Merge remote-tracking branch 'mesa-public/master' into vulkan
This pulls in tessellation and the store_var changes that go with it.
2015-12-27 23:23:05 -08:00
Jason Ekstrand 3b391892aa anv/descriptor_set: Use anv_foreach_stage 2015-12-23 13:49:56 -08:00
Jason Ekstrand 72ceb99bab anv: Mask out invalid stages in foreach_stage 2015-12-23 13:49:56 -08:00
Jason Ekstrand ac975b73cf anv/pipeline: Run lower_returns and inline_functions after spirv_to_nir 2015-12-23 13:49:56 -08:00
Jason Ekstrand 23cfa683d5 nir: move nir_copy_var from anv_nir_builder to nir_builder 2015-12-23 13:49:56 -08:00
Kristian Høgsberg Kristensen 220ac9337b vk: Only require wc bo mmap for !llc GPUs 2015-12-19 22:25:57 -08:00
Kristian Høgsberg Kristensen b49aaf5de0 vk: Remove stale 48 bit addresses FIXMEs
This has worked fine for a long time.
2015-12-19 22:20:45 -08:00
Kristian Høgsberg Kristensen c4802bc44c vk/gen8: Implement VkEvent for gen8
We use PIPE_CONTROL for setting and resetting the event from cmd buffers
and MI_SEMAPHORE_WAIT in polling mode for waiting on an event.
2015-12-19 22:17:19 -08:00
Kristian Høgsberg Kristensen 8ac46d84ff vk: Fix check for I915_PARAM_MMAP_VERSION
Comparing the wrong thing for < 1.
2015-12-18 17:24:19 -08:00
Jordan Justen 5e82a91324 anv/gen8: Add support for gl_NumWorkGroups
Co-authored-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2015-12-18 01:45:11 -08:00
Jason Ekstrand 1473a8dc6f anv/formats: Add more 64-bit formats 2015-12-17 13:51:09 -08:00
Jason Ekstrand 167809365b anv/formats: Add more PACK32 formats 2015-12-17 13:44:50 -08:00
Jason Ekstrand 952bf05897 anv/image: Properly report buffer features 2015-12-17 11:52:31 -08:00
Jason Ekstrand b1325404c5 anv/device: Handle zero-sized memory allocations 2015-12-17 11:00:38 -08:00
Jason Ekstrand c643e9cea8 anv/state: Allow levelCount to be 0
This can happen if the client is creating an image view of a textureable
surface and they only ever intend to render to that view.
2015-12-16 17:34:57 -08:00
Jason Ekstrand 1c51d91bfe anv/pipeline: Allow the user to pass a null MultisampleCreateInfo
According to section 5.2 of the Vulkan spec, this is allowed for color-only
rendering pipelines.
2015-12-15 16:26:10 -08:00
Jason Ekstrand d61ff1ed08 anv/descriptor_set: Initialize immutable_samplers to NULL
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.
2015-12-15 16:24:22 -08:00
Jason Ekstrand 28c4ef9d6c anv/device: Bump the size of the instruction block pool
Some CTS test shaders were failing to compile.  At some point soon, we
really need to make a real pipeline cache and stop using a block pool for
this.
2015-12-15 11:49:28 -08:00
Jason Ekstrand 306abbead3 anv/pipeline: Properly set IncludeVertexHandles in 3DSTATE_GS 2015-12-15 11:37:18 -08:00
Chad Versace f7e36f9f66 isl: Move it a standalone directory
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).
2015-12-15 08:45:49 -08:00
Jordan Justen 7edcc59a7b anv: Rename gs_vec4 to gs_kernel
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>
2015-12-14 18:23:14 -08:00
Jason Ekstrand f46544dea1 anv: Fix CUBE storage images 2015-12-14 16:59:59 -08:00
Jason Ekstrand 783a21192c anv: Add support for storage texel buffers 2015-12-14 16:51:12 -08:00
Jason Ekstrand 1f98bf8da0 anv: Pass an isl_format into fill_buffer_surface_state 2015-12-14 16:14:20 -08:00
Jordan Justen c4219bc6ff anv/cmd_buffer: Gen 8 requires 64 byte alignment for push constant data
See MEDIA_CURBE_LOAD, CURBE Data Start Address & CURBE Total Data Length

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2015-12-14 15:39:07 -08:00
Jason Ekstrand f0313a5569 anv: Add initial support for cube maps
This fixes 486 cubemap CTS tests.
2015-12-14 15:36:30 -08:00
Jason Ekstrand dba28da075 anv/buffer_view: Store a bo + offset instead of buffer pointer
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.
2015-12-14 14:10:40 -08:00
Chad Versace ee57062e1e anv: Remove anv_image::surface_type
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.
2015-12-14 10:46:27 -08:00
Chad Versace f0d11d5a81 anv/meta: Fix VkImageViewType
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().
2015-12-14 09:03:58 -08:00
Chad Versace 0bebaeacd7 isl: Rename s/lod_align/image_align/ for consistency
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.
2015-12-14 09:01:51 -08:00
Chad Versace 85a6384014 anv/tests: gitignore block_pool_no_free 2015-12-14 09:00:28 -08:00
Chad Versace 0da776b733 anv: Fix build for unit tests
Clearly no one has been running `make check`, because the unittestbuild
has been broken for a long time. After this buildfix, all tests now
pass.
2015-12-14 09:00:28 -08:00
Jason Ekstrand c56186026f anv: Add initial support for texel buffers 2015-12-12 16:11:23 -08:00
Jason Ekstrand d12ea21dd5 gen8/pipeline: Support vec4 vertex shaders
In order to actually get them, you need INTEL_DEBUG=vec4.
2015-12-11 13:25:17 -08:00
Jason Ekstrand 6ae4e59fac anv/pipeline: Get rid of the no kernel input parameters hack
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.
2015-12-10 22:37:30 -08:00
Jason Ekstrand bd0e25d41e anv/apply_pipeline_layout: Multiply uniform sizes by 4
This is because uniforms are now in terms of bytes everywhere.
2015-12-10 22:36:49 -08:00
Jason Ekstrand 21cf55ab54 gen8/cmd_buffer: Don't push CS constants if there aren't any
Issuing MEDIA_CURB_LOAD with a size of zero causes GPU hangs on BDW.
2015-12-10 18:56:27 -08:00
Jason Ekstrand 3893e11f4b anv: Use 4 instead of sizeof(gl_constant_value)
We no longer have access to gl_constant_value and, really, it's 4 because
our uniform layout code works entirely in dwords.
2015-12-10 18:55:16 -08:00
Jason Ekstrand d5c9955d3e Merge remote-tracking branch 'mesa-public/master' into vulkan
This pulls in nir_intrinsic_load/store changes and the switch of all
uniforms in i965 to bytes.  This accounts for the Vulkan changes.
2015-12-10 18:29:36 -08:00
Jason Ekstrand 8beea9d45b anv/icd: Advertise the right ABI version 2015-12-10 12:27:13 -08:00
Chad Versace 5ba9121fe8 anv/image: Remove some vkCreateImage validation
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).
2015-12-09 16:33:23 -08:00
Chad Versace 9a9c551f3e anv/image: Drop unused halign, valign lookup tables 2015-12-09 15:36:39 -08:00
Jordan Justen 47e5fb52f4 gen8/compute: Setup push constants and local ids
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2015-12-09 11:04:30 -08:00
Jordan Justen f8d5fb4293 anv: Add anv_cmd_buffer_cs_push_constants
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>
2015-12-09 11:02:20 -08:00
Jordan Justen d28df86c87 anv/compute: Fix thread width max off by 1
See cooresponding code in:

commit 8d87070af2
Author: Jordan Justen <jordan.l.justen@intel.com>
Date:   Thu Aug 28 14:47:19 2014 -0700

    i965/cs: Implement brw_emit_gpgpu_walker

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2015-12-08 18:09:31 -08:00
Chad Versace db66424218 anv: Remove unused anv_image_view_info_for_vk_image_view_type() 2015-12-08 14:25:28 -08:00
Jason Ekstrand f4aee5d82f gen8/cmd_buffer: Flush push constants after descriptor sets
This is because, if storage images are used, flushing descriptor sets can
cause push constants to become dirty.
2015-12-07 21:45:43 -08:00
Jason Ekstrand 43ac954e25 anv: Add initial support for pushing image params
The helper to fill out the image params data-structure is stilly a dummy,
but this puts the infastructure in place.
2015-12-07 21:08:26 -08:00
Jason Ekstrand 1eb731d9fe anv/descriptor_set: Add support for storage images in layouts 2015-12-07 21:08:26 -08:00
Jason Ekstrand ff05f634f6 anv/image: Add a separate storage image surface state
Thanks to hardware limitations, storage images may need a different surface
format and/or other bits in the surface state.
2015-12-07 21:08:22 -08:00
Jason Ekstrand 8f83222d37 isl: Add initial support for storage images 2015-12-07 21:08:08 -08:00
Jason Ekstrand cd75ff5d17 anv/pipeline: Only apply a pipeline layout if we have one 2015-12-07 16:56:02 -08:00
Chad Versace 9098e0f074 anv/image: Refactor anv_image_make_surface()
Reduce the number of function parameters. Deduce the
anv_image::*_surface from the parameters instead of requiring the caller
to do that.
2015-12-07 09:28:14 -08:00
Chad Versace 3d85a28e90 anv: Assert the succes of isl_surf_init() 2015-12-07 08:54:59 -08:00
Chad Versace 64e8af69b1 anv: Use isl_tiling_flags in anv_image_create_info
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().
2015-12-07 08:50:28 -08:00
Chad Versace c97d8af9aa anv: Fix anv_gem_set_tiling to respect tiling param
Function anv_gem_set_tiling() ignored its 'tiling' parameter. It
unconditionally set the bo's tiling to I915_TILING_X.
2015-12-07 08:42:11 -08:00
Chad Versace 01e2932d6a anv: Remove unused anv_format_s8_uint
This is no longer needed after migrating to isl.
2015-12-07 08:40:14 -08:00
Kristian Høgsberg Kristensen 0a5bee1fe6 vk: Don't override and hardcode autoconf CFLAGS
To disable optimizations pass CFLAGS="-O0 -g" on the configure command
line.
2015-12-04 21:24:15 -08:00
Kristian Høgsberg Kristensen 7337870036 vk: Move isl files to libisl.la helper library
These will be in their own library eventually - let's just do that now.
2015-12-04 21:24:15 -08:00
Chad Versace 2f270f0d15 anv/image: Fix choice of isl_surf_usage for depthstencil images
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.
2015-12-04 16:37:05 -08:00
Chad Versace a09b4c298c anv: Add func anv_get_isl_format() 2015-12-04 16:37:05 -08:00
Chad Versace 8b9ceda9f1 anv/image: Delete old ifdef'd out code 2015-12-04 16:37:05 -08:00
Jason Ekstrand 4dd5ef9e09 vk: Add needed builddir subdirectories to the include path
This fixes out-of-tree builds and closes #1
2015-12-04 15:48:27 -08:00
Kristian Høgsberg Kristensen f1f78a371e vk: gem handles are uint32_t
No functional difference, but lets be consistent with the kernel API.
2015-12-04 12:53:27 -08:00
Kristian Høgsberg dac57750db vk: Turn on Bay Trail, Cherryview and Broxton support 2015-12-04 09:51:47 -08:00
Kristian Høgsberg Kristensen bbb6875f35 vk: Map uncached, coherent memory as write-combine
This gives us the required characteristics for the memory type.
2015-12-04 09:51:47 -08:00
Kristian Høgsberg Kristensen c3c61d210f vk: Expose two memory types for non-LLC GPUs
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.
2015-12-04 09:51:47 -08:00
Kristian Høgsberg 773592051b vk: clflush all state for non-LLC GPUs 2015-12-04 09:51:47 -08:00
Kristian Høgsberg b431cf59a3 vk: Set I915_CACHING_NONE for userptr BOs when !llc
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.
2015-12-04 09:51:47 -08:00
Kristian Høgsberg e0b5f0308c vk: Implement vkFlushMappedMemoryRanges()
We'll do a runtime switch on device->info.has_llc for now.
2015-12-04 09:51:47 -08:00
Chad Versace 371fc2bc20 anv/gen9: Fix SURFACE_STATE halign and valign
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.
2015-12-03 15:33:08 -08:00
Chad Versace 981ef2f02d anv: Embed isl_surf into anv_surface
This reduces struct anv_surface to just two members: an offset and the
embedded isl_surf.
2015-12-03 15:31:00 -08:00