Eric Anholt [Wed, 27 Feb 2019 19:12:59 +0000 (11:12 -0800)]
util: Add a DAG datastructure.
I keep writing this for various schedulers.
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Kristian H. Kristensen [Fri, 1 Mar 2019 22:33:36 +0000 (14:33 -0800)]
freedreno/a6xx: Remove extra parens
There's a warning about this now.
Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Kristian H. Kristensen [Fri, 1 Mar 2019 22:25:57 +0000 (14:25 -0800)]
freedreno: Use c_vis_args and no_override_init_args
Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Chia-I Wu [Fri, 8 Feb 2019 21:45:53 +0000 (13:45 -0800)]
turnip: preliminary support for Wayland WSI
Chia-I Wu [Mon, 11 Feb 2019 19:12:32 +0000 (11:12 -0800)]
turnip: preliminary support for tu_GetImageSubresourceLayout
Chad Versace [Sat, 2 Feb 2019 01:08:51 +0000 (17:08 -0800)]
turnip: Use Vulkan 1.1 names instead of KHR
That is, drop KHR from all tokens that were promoted to Vulkan 1.1.
The consistency makes ctags more useful (it now jumps directly to the
real definitions in vulkan_core.h instead of the typedefs); and it makes
the code slightly less verbose.
Chia-I Wu [Fri, 8 Mar 2019 19:27:50 +0000 (11:27 -0800)]
turnip: guard -Dvulkan-driver=freedreno
Require -DI-love-half-baked-turnips=true as well to enable freedreno
vulkan driver.
Chia-I Wu [Fri, 22 Feb 2019 16:50:58 +0000 (08:50 -0800)]
turnip: preliminary support for tu_CmdDraw
Chia-I Wu [Fri, 22 Feb 2019 06:37:34 +0000 (22:37 -0800)]
turnip: preliminary support for draw state binding
This adds support for tu_CmdBindPipeline, tu_CmdBindVertexBuffers,
etc.
Chia-I Wu [Wed, 20 Feb 2019 22:26:06 +0000 (14:26 -0800)]
turnip: add draw_cs to tu_cmd_buffer
It will hold draw commands.
Chia-I Wu [Fri, 22 Feb 2019 06:31:36 +0000 (22:31 -0800)]
turnip: parse VkPipelineVertexInputStateCreateInfo
Chia-I Wu [Wed, 27 Feb 2019 06:10:34 +0000 (22:10 -0800)]
turnip: parse VkPipelineShaderStageCreateInfo
Chia-I Wu [Wed, 27 Feb 2019 06:09:37 +0000 (22:09 -0800)]
turnip: compile VkPipelineShaderStageCreateInfo
Compile all shaders and upload the binaries to a BO.
Chia-I Wu [Wed, 20 Feb 2019 17:53:47 +0000 (09:53 -0800)]
turnip: preliminary support for shader modules
Save SPIR-V in tu_shader_module. Tranlation to NIR happens in
tu_shader_create, and compilation to binary code happens in
tu_shader_compile. Both will be called during pipeline creation.
Chia-I Wu [Thu, 21 Feb 2019 22:58:52 +0000 (14:58 -0800)]
turnip: parse VkPipeline{Multisample,ColorBlend}StateCreateInfo
Chia-I Wu [Thu, 21 Feb 2019 19:46:59 +0000 (11:46 -0800)]
turnip: parse VkPipelineDepthStencilStateCreateInfo
Chia-I Wu [Wed, 27 Feb 2019 07:29:51 +0000 (23:29 -0800)]
turnip: parse VkPipelineRasterizationStateCreateInfo
Chia-I Wu [Tue, 19 Feb 2019 21:49:01 +0000 (13:49 -0800)]
turnip: parse VkPipelineViewportStateCreateInfo
Chia-I Wu [Thu, 21 Feb 2019 19:07:38 +0000 (11:07 -0800)]
turnip: parse VkPipelineInputAssemblyStateCreateInfo
Chia-I Wu [Thu, 21 Feb 2019 17:41:49 +0000 (09:41 -0800)]
turnip: parse VkPipelineDynamicStateCreateInfo
Chia-I Wu [Thu, 21 Feb 2019 17:22:17 +0000 (09:22 -0800)]
turnip: create a less dummy pipeline
Still dummy, but at least it is created from tu_pipeline_builder.
Chia-I Wu [Mon, 25 Feb 2019 22:38:34 +0000 (14:38 -0800)]
turnip: simplify tu_cs sub-streams usage
Let tu_cs_begin_sub_stream imply tu_cs_reserve_space, and
tu_cs_end_sub_stream imply tu_cs_sanity_check. Callers are no
longer required to call them (but can still do if they choose to).
Chia-I Wu [Mon, 25 Feb 2019 22:37:55 +0000 (14:37 -0800)]
turnip: fix tu_cs sub-streams
Update cs->start in tu_cs_end_sub_stream. Otherwise, the entry
would include commands from all prior sub-streams.
Chia-I Wu [Mon, 25 Feb 2019 22:57:03 +0000 (14:57 -0800)]
turnip: tu_cs_emit_array
Array version of tu_cs_emit. Useful for updating multiple
consecutive array-like registers, or loading a shader binary with
SS6_DIRECT.
Chia-I Wu [Mon, 25 Feb 2019 22:49:34 +0000 (14:49 -0800)]
turnip: add tu_cs_discard_entries
We will start a draw IB at the beginning of a subpass and consume it
at the end of the subpass. With tu_cs_discard_entries, we can reuse
the same tu_cs for all subpasses.
Chia-I Wu [Mon, 25 Feb 2019 22:55:06 +0000 (14:55 -0800)]
turnip: more/better asserts for tu_cs
Asserting (cur < end) in tu_cs_emit catches much less programming
errors comparing to asserting (cur < reserved_end). We should never
write more commands than what we have reserved.
Assert IB is non-empty and sane in tu_cs_emit_ib.
Chia-I Wu [Mon, 25 Feb 2019 22:44:52 +0000 (14:44 -0800)]
turnip: use 32-bit offset in tu_cs_entry
We don't support nor expect BOs to be that big in tu_cs.
Chia-I Wu [Mon, 25 Feb 2019 22:32:36 +0000 (14:32 -0800)]
turnip: mark IBs for dumping
Includes IBs in kernel cmdbuf dumps.
Eric Engestrom [Wed, 27 Feb 2019 12:31:06 +0000 (12:31 +0000)]
turnip: use the platform defines in vk.xml instead of hard-coding them
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Bas Nieuwenhuizen [Thu, 21 Feb 2019 21:39:22 +0000 (22:39 +0100)]
turnip: Add todo for copies.
Bas Nieuwenhuizen [Mon, 18 Feb 2019 15:43:24 +0000 (16:43 +0100)]
turnip: Add buffer->image DMA copies.
Passes dEQP-VK.api.copy_and_blit.core.buffer_to_image.*
Bas Nieuwenhuizen [Mon, 18 Feb 2019 15:13:23 +0000 (16:13 +0100)]
turnip: Add image->buffer DMA copies.
Passes dEQP-VK.api.copy_and_blit.core.image_to_buffer.*
Bas Nieuwenhuizen [Mon, 18 Feb 2019 15:09:27 +0000 (16:09 +0100)]
turnip: Implement buffer->buffer DMA copies.
Passes dEQP-VK.api.copy_and_blit.core.buffer_to_buffer.*
Bas Nieuwenhuizen [Mon, 4 Feb 2019 13:52:34 +0000 (14:52 +0100)]
turnip: Add tu6_rb_fmt_to_ifmt.
Bas Nieuwenhuizen [Mon, 18 Feb 2019 13:49:52 +0000 (14:49 +0100)]
turnip: Make tu6_emit_event_write shared.
Bas Nieuwenhuizen [Tue, 15 Jan 2019 21:54:15 +0000 (22:54 +0100)]
turnip: Add buffer memory binding.
Chia-I Wu [Thu, 14 Feb 2019 18:53:20 +0000 (10:53 -0800)]
turnip: respect color attachment formats
Make tu6_get_native_format available to tu_cmd_buffer and start
using of it.
Chia-I Wu [Thu, 14 Feb 2019 22:36:52 +0000 (14:36 -0800)]
turnip: preliminary support for fences
This should be quite complete feature-wise. External fences are
still missing. We probably also want to add a simpler path to
tu_WaitForFences for when fenceCount == 1.
Chia-I Wu [Wed, 13 Feb 2019 18:23:32 +0000 (10:23 -0800)]
turnip: fix VkClearValue packing
Add tu_pack_clear_value to correctly pack VkClearValue according to
VkFormat. It ignores the component order defined by VkFormat, and
always packs to WZYX order.
Chia-I Wu [Fri, 1 Feb 2019 18:36:19 +0000 (10:36 -0800)]
turnip: add support for VK_KHR_external_memory_{fd,dma_buf}
Chia-I Wu [Fri, 1 Feb 2019 18:27:28 +0000 (10:27 -0800)]
turnip: advertise VK_KHR_external_memory
AFAICT, it is supported. We don't need to handle any of the new
structs because our BOs can always be exported.
Chia-I Wu [Fri, 1 Feb 2019 18:12:38 +0000 (10:12 -0800)]
turnip: advertise VK_KHR_external_memory_capabilities
AFAICT, it is supported.
Chia-I Wu [Thu, 31 Jan 2019 23:03:03 +0000 (15:03 -0800)]
turnip: add functions to import/export prime fd
Add tu_bo_init_dmabuf, tu_bo_export_dmabuf, tu_gem_import_dmabuf,
and tu_gem_export_dmabuf.
Chad Versace [Sat, 2 Feb 2019 00:48:44 +0000 (16:48 -0800)]
turnip: Fix error behavior for VkPhysicalDeviceExternalImageFormatInfo
If the handle type is unsupported, then the spec requires us to return
VK_ERROR_FORMAT_NOT_SUPPORTED.
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Closes: https://gitlab.freedesktop.org/bnieuwenhuizen/mesa/merge_requests/17
Chia-I Wu [Fri, 25 Jan 2019 19:13:54 +0000 (11:13 -0800)]
turnip: add a more complete format table
A format table is an array of tu_native_format. Table lookup is
done through array indexing.
This commit defines a single format table for core VkFormat. It is
derived from the table in the gallium driver. There might be errors
introduced in the process of the conversion.
When an extension that defines new VkFormat is supported, we need to
add a new table for the extension.
Chia-I Wu [Fri, 11 Jan 2019 23:01:26 +0000 (15:01 -0800)]
turnip: preliminary support for loadOp and storeOp
- create tile_load_ib and tile_store_ib at the beginning of each
subpass
- execute the IBs at the end of each subpass
- no DONT_CARE support
- no subpass dependency analysis and subpass merging
- no zs support
- no true VkImageView support
- assume VK_FORMAT_B8G8R8A8_UNORM
- no tiling
- no MSAA
This also removes cur_cs from tu_cmd_buffer.
Chia-I Wu [Tue, 29 Jan 2019 23:00:34 +0000 (15:00 -0800)]
turnip: add TU_CS_MODE_SUB_STREAM
When in TU_CS_MODE_SUB_STREAM, tu_cs_begin_sub_stream (or
tu_cs_end_sub_stream) should be called instead of tu_cs_begin (or
tu_cs_end). It gives the caller a TU_CS_MODE_EXTERNAL cs to emit
commands to.
Chia-I Wu [Mon, 28 Jan 2019 22:33:20 +0000 (14:33 -0800)]
turnip: add tu_cs_mode
Add tu_cs_mode and TU_CS_MODE_EXTERNAL. When in
TU_CS_MODE_EXTERNAL, tu_cs wraps an external buffer and can not
grow.
This also moves tu_cs* up in tu_private.h, such that other structs
can embed tu_cs_entry.
Chia-I Wu [Tue, 29 Jan 2019 18:43:48 +0000 (10:43 -0800)]
turnip: provide both emit_ib and emit_call
tu_cs_emit_ib emits a CP_INDIRECT_BUFFER for a BO. tu_cs_emit_call
emits a CP_INDIRECT_BUFFER for each entry of a target cs.
Chia-I Wu [Tue, 29 Jan 2019 00:31:54 +0000 (16:31 -0800)]
turnip: add tu_cs_sanity_check
It replaces tu_cs_reserve_space_assert and can be called at any
time to sanity check tu_cs.
Chia-I Wu [Mon, 28 Jan 2019 23:55:40 +0000 (15:55 -0800)]
turnip: never fail tu_cs_begin/tu_cs_end
Error checking tu_cs_begin/tu_cs_end is too tedious for the callers.
Move tu_cs_add_bo and tu_cs_reserve_entry to tu_cs_reserve_space
such that tu_cs_begin/tu_cs_end never fails.
Chia-I Wu [Tue, 29 Jan 2019 00:24:48 +0000 (16:24 -0800)]
turnip: specify initial size in tu_cs_init
We will drop size parameter from tu_cs_begin shortly, such that
tu_cs_begin never fails.
Chia-I Wu [Mon, 28 Jan 2019 23:52:36 +0000 (15:52 -0800)]
turnip: add tu_cs_{reserve,add}_entry
We will stop calling tu_cs_reserve_entry in tu_cs_end shortly, such
that tu_cs_end never fails.
Chia-I Wu [Tue, 29 Jan 2019 22:09:17 +0000 (14:09 -0800)]
turnip: add internal helpers for tu_cs
Add tu_cs_get_offset, tu_cs_get_size, tu_cs_get_space, and
tu_cs_is_empty.
Chia-I Wu [Tue, 22 Jan 2019 18:27:22 +0000 (10:27 -0800)]
turnip: add tu_tiling_config
We need the current color/depth/stencil attachments and the current
render area to compute the tiling config.
We compute the tiling config at the beginning of each subpass for
the moment. We should change that when the driver can reorder/merge
subpasses.
It is very common that the render area is the entire framebuffer.
We might want to optimize for the case and compute the tiling config
in tu_framebuffer ctor.
Chia-I Wu [Tue, 22 Jan 2019 18:27:18 +0000 (10:27 -0800)]
turnip: preliminary support for tu_GetRenderAreaGranularity
Set it to tile alignments, 32x32 on 6xx.
Chia-I Wu [Fri, 18 Jan 2019 16:54:04 +0000 (08:54 -0800)]
turnip: emit HW init in tu_BeginCommandBuffer
Being the first commit that emits meaningful command packets, there
are many things included in this commit
- tu6_emit_xxx are low-level helpers that emit command packets
without boundary checks
- tu6_xxx are high-level helpers that emit command packets with
boundary checks
- cmdbuf->cs is a pointer to the current CS, so that we can use the
helpers above to emit to other CS
- use cmd as the variable name of tu_cmd_buffer
- there is a per-cmdbuf scratch bo for CP_EVENT_WRITE writeback
- there is a per-cmdbuf debug marker, using scratch reg 7 or 6
depending on whether the cmdbuf is primary or secondary
(olv, after rebase) REG_A6XX_SP_UNKNOWN_AB20 is renamed
Chia-I Wu [Fri, 18 Jan 2019 22:24:45 +0000 (14:24 -0800)]
turnip: add tu_cs_reserve_space(_assert)
They are used like
tu_cs_reserve_space(...);
tu_cs_emit(...);
...;
tu_cs_reserve_space_assert();
to make sure we reserved enough space at the beginning.
Chad Versace [Wed, 16 Jan 2019 23:01:35 +0000 (15:01 -0800)]
turnip: Annotate vkGetImageSubresourceLayout with tu_stub
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Chia-I Wu [Fri, 11 Jan 2019 22:27:01 +0000 (14:27 -0800)]
turnip: preliminary support for tu_CmdBeginRenderPass
Chia-I Wu [Thu, 10 Jan 2019 19:58:07 +0000 (11:58 -0800)]
turnip: preliminary support for tu_image_view_init
Chia-I Wu [Thu, 10 Jan 2019 19:51:39 +0000 (11:51 -0800)]
turnip: preliminary support for tu_BindImageMemory2
Chia-I Wu [Thu, 17 Jan 2019 19:15:39 +0000 (11:15 -0800)]
turnip: add cmdbuf->bo_list to bo_list in queue submit
Chia-I Wu [Thu, 17 Jan 2019 19:15:21 +0000 (11:15 -0800)]
turnip: add tu_bo_list_merge
tu_bo_list_merge adds an entire list to the current list.
Chia-I Wu [Thu, 17 Jan 2019 18:23:19 +0000 (10:23 -0800)]
turnip: build drm_msm_gem_submit_bo array directly
Build drm_msm_gem_submit_bo array directly in tu_bo_list. We might
change this again, but this is good enough for now.
There are other issues as well, such as not using
VkAllocationCallbacks and sloppy error checking. We should revisit
this in the near future. Same to tu_cs.
Chia-I Wu [Wed, 16 Jan 2019 22:40:37 +0000 (14:40 -0800)]
turnip: add more tu_cs helpers
Chia-I Wu [Wed, 16 Jan 2019 22:12:53 +0000 (14:12 -0800)]
turnip: inline tu_cs_check_space
This allows the fast path (size check) to be inlined.
Chia-I Wu [Wed, 16 Jan 2019 22:05:55 +0000 (14:05 -0800)]
turnip: update cs->start in tu_cs_end
This allows us to assert that there is no dangling command in
tu_cs_begin, rather than discarding them silently.
Chia-I Wu [Wed, 16 Jan 2019 22:00:43 +0000 (14:00 -0800)]
turnip: minor cleanup to tu_cs_end
Add comments and error checking.
Chia-I Wu [Wed, 16 Jan 2019 19:17:26 +0000 (11:17 -0800)]
turnip: add tu_cs_add_bo
Refactor BO allocation code out of tu_cs_begin. Add error checking.
Chia-I Wu [Wed, 16 Jan 2019 18:20:33 +0000 (10:20 -0800)]
turnip: document tu_cs
Chia-I Wu [Wed, 16 Jan 2019 18:03:02 +0000 (10:03 -0800)]
turnip: run sed and clang-format on tu_cs
Kristian H. Kristensen [Wed, 16 Jan 2019 19:02:38 +0000 (11:02 -0800)]
turnip: Only get bo offset when we need to mmap
The offset we get from MSM_INFO_GET_OFFSET is an offset into the drm fd
for the purpose of mmaping the buffer.
Bas Nieuwenhuizen [Wed, 16 Jan 2019 17:27:04 +0000 (18:27 +0100)]
turnip: Move stream functions to tu_cs.c
Bas Nieuwenhuizen [Tue, 15 Jan 2019 21:18:15 +0000 (22:18 +0100)]
turnip: Add emit functions in a header.
This adds a radv-style check_space functions + emit functions.
Also puts them in a header as a bunch of inlines, so
(1) we can use them from meta code.
(2) they are inline for performance as these are common and small.
Did not put them in tu_private.h as a bunch of inlines only
clutters up that huge headerfile.
Precise error propagation for memory allocation failures is still
todo.
Chia-I Wu [Thu, 10 Jan 2019 22:07:50 +0000 (14:07 -0800)]
turnip: preliminary support for tu_QueueWaitIdle
This creates a new fd on each queue submit. I do not go with
DRM_IOCTL_MSM_WAIT_FENCE solely because the path is marked legacy.
Otherwise, we can use the fence id rather than requesting a fence
fd until external fences are supported and enabled.
Chia-I Wu [Fri, 11 Jan 2019 18:55:15 +0000 (10:55 -0800)]
turnip: constify tu_device in tu_gem_*
Chia-I Wu [Thu, 10 Jan 2019 23:34:44 +0000 (15:34 -0800)]
turnip: add wrappers around DRM_MSM_SUBMITQUEUE_*
Add tu_drm_submitqueue_new and tu_drm_submitqueue_close.
Chia-I Wu [Thu, 10 Jan 2019 23:27:28 +0000 (15:27 -0800)]
turnip: add wrappers around DRM_MSM_GET_PARAM
Add tu_drm_get_gpu_id and tu_drm_get_gmem_size.
Chia-I Wu [Fri, 11 Jan 2019 18:09:53 +0000 (10:09 -0800)]
turnip: remove unnecessary libfreedreno_drm dep
Remove libfreedreno_drm dep and unused fd_device.
Chia-I Wu [Fri, 11 Jan 2019 18:03:51 +0000 (10:03 -0800)]
turnip: use msm_drm.h from inc_freedreno
The recent change to msm_drm.h changed the APIs in an incompatible
way.
Bas Nieuwenhuizen [Thu, 10 Jan 2019 21:07:04 +0000 (22:07 +0100)]
turnip: Shorten primary_cmd_stream name.
It really is too long.
Bas Nieuwenhuizen [Thu, 10 Jan 2019 20:39:14 +0000 (21:39 +0100)]
turnip: Fill command buffer
Bas Nieuwenhuizen [Thu, 10 Jan 2019 20:25:20 +0000 (21:25 +0100)]
turnip: Implement submission.
Bas Nieuwenhuizen [Thu, 10 Jan 2019 20:20:35 +0000 (21:20 +0100)]
turnip: Make bo_list functions not static
Bas Nieuwenhuizen [Thu, 10 Jan 2019 20:12:38 +0000 (21:12 +0100)]
turnip: Add msm queue support.
Bas Nieuwenhuizen [Mon, 31 Dec 2018 13:15:30 +0000 (14:15 +0100)]
turnip: Add a command stream.
Bas Nieuwenhuizen [Mon, 31 Dec 2018 10:34:32 +0000 (11:34 +0100)]
turnip: Implement a slow bo list
Bas Nieuwenhuizen [Mon, 31 Dec 2018 10:08:45 +0000 (11:08 +0100)]
turnip: Implement some UUIDs.
Bas Nieuwenhuizen [Fri, 28 Dec 2018 16:27:12 +0000 (17:27 +0100)]
turnip: clean up TODO.
./deqp-vk -n dEQP-VK.info.*
Writing test log into TestResults.qpa
dEQP Core unknown (0xcafebabe) starting..
target implementation = 'Surfaceless'
WARNING: tu is not a conformant vulkan implementation, testing use only.
WARNING: tu is not a conformant vulkan implementation, testing use only.
Test case 'dEQP-VK.info.build'..
Pass (Not validated)
Test case 'dEQP-VK.info.device'..
Pass (Not validated)
Test case 'dEQP-VK.info.platform'..
Pass (Not validated)
Test case 'dEQP-VK.info.memory_limits'..
Pass (Pass)
DONE!
Test run totals:
Passed: 4/4 (100.0%)
Failed: 0/4 (0.0%)
Not supported: 0/4 (0.0%)
Warnings: 0/4 (0.0%)
Bas Nieuwenhuizen [Fri, 28 Dec 2018 16:25:17 +0000 (17:25 +0100)]
turnip: Remove some radv leftovers.
Bas Nieuwenhuizen [Fri, 28 Dec 2018 15:27:24 +0000 (16:27 +0100)]
turnip: Implement some format properties for RGBA8.
Just to get some tests to not skip. This is neither complete
nor completely correct.
Chia-I Wu [Wed, 9 Jan 2019 22:16:01 +0000 (14:16 -0800)]
turnip: add .clang-format
Add and apply .clang-format.
Bas Nieuwenhuizen [Fri, 21 Dec 2018 13:49:30 +0000 (14:49 +0100)]
turnip: Implement pipe-less param query.
Bas Nieuwenhuizen [Fri, 21 Dec 2018 13:12:17 +0000 (14:12 +0100)]
turnip: move tu_gem.c to tu_drm.c
Bas Nieuwenhuizen [Fri, 21 Dec 2018 12:46:06 +0000 (13:46 +0100)]
turnip: Stop hardcoding the msm version check.
Bas Nieuwenhuizen [Fri, 21 Dec 2018 11:50:55 +0000 (12:50 +0100)]
turnip: Add image layout calculations.
Bas Nieuwenhuizen [Thu, 20 Dec 2018 23:54:15 +0000 (00:54 +0100)]
turnip: Fix memory mapping.
Bas Nieuwenhuizen [Thu, 20 Dec 2018 21:57:07 +0000 (22:57 +0100)]
turnip: Fix bo allocation after we stopped using libdrm_freedreno ...
Al this figuring out new errors is why I don't like reinventing the
wheel.
Bas Nieuwenhuizen [Thu, 20 Dec 2018 17:08:49 +0000 (18:08 +0100)]
turnip: Add 630 to the list.