Commit Graph

117 Commits

Author SHA1 Message Date
Chia-I Wu 949ce2745d turnip: preliminary support for tu_CmdDraw 2019-03-11 10:02:13 -07:00
Chia-I Wu f9b34622cd turnip: preliminary support for draw state binding
This adds support for tu_CmdBindPipeline, tu_CmdBindVertexBuffers,
etc.
2019-03-11 10:02:13 -07:00
Chia-I Wu 54b7a57c22 turnip: add draw_cs to tu_cmd_buffer
It will hold draw commands.
2019-03-11 10:02:13 -07:00
Chia-I Wu 1cdbab016e turnip: parse VkPipelineVertexInputStateCreateInfo 2019-03-11 10:02:13 -07:00
Chia-I Wu d17096b9b1 turnip: parse VkPipelineShaderStageCreateInfo 2019-03-11 10:02:13 -07:00
Chia-I Wu a7d842c97c turnip: compile VkPipelineShaderStageCreateInfo
Compile all shaders and upload the binaries to a BO.
2019-03-11 10:02:13 -07:00
Chia-I Wu 970a8fec96 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu 9e0d878787 turnip: parse VkPipeline{Multisample,ColorBlend}StateCreateInfo 2019-03-11 10:02:13 -07:00
Chia-I Wu bec0abf294 turnip: parse VkPipelineDepthStencilStateCreateInfo 2019-03-11 10:02:13 -07:00
Chia-I Wu 9496b377ff turnip: parse VkPipelineRasterizationStateCreateInfo 2019-03-11 10:02:13 -07:00
Chia-I Wu b4884761e8 turnip: parse VkPipelineViewportStateCreateInfo 2019-03-11 10:02:13 -07:00
Chia-I Wu 1bea6a91cb turnip: parse VkPipelineInputAssemblyStateCreateInfo 2019-03-11 10:02:13 -07:00
Chia-I Wu c584c2e86c turnip: parse VkPipelineDynamicStateCreateInfo 2019-03-11 10:02:13 -07:00
Chia-I Wu df48cb7b3e turnip: create a less dummy pipeline
Still dummy, but at least it is created from tu_pipeline_builder.
2019-03-11 10:02:13 -07:00
Chia-I Wu 57327626dc 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).
2019-03-11 10:02:13 -07:00
Chia-I Wu 59419bb691 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu c0567e84db 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu fffaa9b4b3 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu 10c5013442 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu aa7dd6cb7f turnip: use 32-bit offset in tu_cs_entry
We don't support nor expect BOs to be that big in tu_cs.
2019-03-11 10:02:13 -07:00
Chia-I Wu b8a5e10d0d turnip: mark IBs for dumping
Includes IBs in kernel cmdbuf dumps.
2019-03-11 10:02:13 -07:00
Eric Engestrom 4a48dd9fb8 turnip: use the platform defines in vk.xml instead of hard-coding them
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
2019-03-11 10:02:13 -07:00
Bas Nieuwenhuizen 0d12bcbfa7 turnip: Add todo for copies. 2019-03-11 10:02:13 -07:00
Bas Nieuwenhuizen 51115e7201 turnip: Add buffer->image DMA copies.
Passes dEQP-VK.api.copy_and_blit.core.buffer_to_image.*
2019-03-11 10:02:13 -07:00
Bas Nieuwenhuizen 6616563472 turnip: Add image->buffer DMA copies.
Passes dEQP-VK.api.copy_and_blit.core.image_to_buffer.*
2019-03-11 10:02:13 -07:00
Bas Nieuwenhuizen d76a1e2aa1 turnip: Implement buffer->buffer DMA copies.
Passes dEQP-VK.api.copy_and_blit.core.buffer_to_buffer.*
2019-03-11 10:02:13 -07:00
Bas Nieuwenhuizen bafbf3bafe turnip: Add tu6_rb_fmt_to_ifmt. 2019-03-11 10:02:13 -07:00
Bas Nieuwenhuizen 148876d424 turnip: Make tu6_emit_event_write shared. 2019-03-11 10:02:13 -07:00
Bas Nieuwenhuizen 7238471587 turnip: Add buffer memory binding. 2019-03-11 10:02:13 -07:00
Chia-I Wu 08b1c3fc7f turnip: respect color attachment formats
Make tu6_get_native_format available to tu_cmd_buffer and start
using of it.
2019-03-11 10:02:13 -07:00
Chia-I Wu 68c27ea92b 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu 15319963fa 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu 6545461041 turnip: add support for VK_KHR_external_memory_{fd,dma_buf} 2019-03-11 10:02:13 -07:00
Chia-I Wu 6d1c4049de 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu 0253845272 turnip: advertise VK_KHR_external_memory_capabilities
AFAICT, it is supported.
2019-03-11 10:02:13 -07:00
Chia-I Wu de89436216 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.
2019-03-11 10:02:13 -07:00
Chad Versace d5239bc59c 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
2019-03-11 10:02:13 -07:00
Chia-I Wu 4b9f967cd1 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu f3bf779184 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu 0aeef7c8bd 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu f59c381423 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu 5c63fc626f 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu 741a4325df 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu 29f1110003 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu 0d81be3959 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu 2774a1b97d 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu c11580373f 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu 429e2d5755 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.
2019-03-11 10:02:13 -07:00
Chia-I Wu 7c4483de0e turnip: preliminary support for tu_GetRenderAreaGranularity
Set it to tile alignments, 32x32 on 6xx.
2019-03-11 10:02:13 -07:00
Chia-I Wu 9c83a7572b 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
2019-03-11 10:01:49 -07:00