Commit Graph

109055 Commits

Author SHA1 Message Date
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
Chia-I Wu 3b3af6321b 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.
2019-03-11 10:01:41 -07:00
Chad Versace aaa59ef70c turnip: Annotate vkGetImageSubresourceLayout with tu_stub
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
2019-03-11 10:01:41 -07:00
Chia-I Wu ba6bcb387c turnip: preliminary support for tu_CmdBeginRenderPass 2019-03-11 10:01:41 -07:00
Chia-I Wu 1085df8176 turnip: preliminary support for tu_image_view_init 2019-03-11 10:01:41 -07:00
Chia-I Wu 992ecdd40e turnip: preliminary support for tu_BindImageMemory2 2019-03-11 10:01:41 -07:00
Chia-I Wu ef49b07b83 turnip: add cmdbuf->bo_list to bo_list in queue submit 2019-03-11 10:01:41 -07:00
Chia-I Wu 6c4df43db5 turnip: add tu_bo_list_merge
tu_bo_list_merge adds an entire list to the current list.
2019-03-11 10:01:41 -07:00
Chia-I Wu 7ad01913bd 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.
2019-03-11 10:01:41 -07:00
Chia-I Wu c969d8b975 turnip: add more tu_cs helpers 2019-03-11 10:01:41 -07:00
Chia-I Wu 39ba2b20d1 turnip: inline tu_cs_check_space
This allows the fast path (size check) to be inlined.
2019-03-11 10:01:41 -07:00
Chia-I Wu 2bcaa78236 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.
2019-03-11 10:01:41 -07:00
Chia-I Wu b01d1618a4 turnip: minor cleanup to tu_cs_end
Add comments and error checking.
2019-03-11 10:01:41 -07:00
Chia-I Wu af4eb20891 turnip: add tu_cs_add_bo
Refactor BO allocation code out of tu_cs_begin.  Add error checking.
2019-03-11 10:01:41 -07:00
Chia-I Wu ae9a72b48b turnip: document tu_cs 2019-03-11 10:01:41 -07:00
Chia-I Wu 45120127ea turnip: run sed and clang-format on tu_cs 2019-03-11 10:01:41 -07:00
Kristian H. Kristensen 0801019d33 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.
2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen 23d6f0f970 turnip: Move stream functions to tu_cs.c 2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen ac2a845abf 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.
2019-03-11 10:01:41 -07:00
Chia-I Wu 2e684cb800 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.
2019-03-11 10:01:41 -07:00
Chia-I Wu b7a6a80e6c turnip: constify tu_device in tu_gem_* 2019-03-11 10:01:41 -07:00
Chia-I Wu 3809e6cf63 turnip: add wrappers around DRM_MSM_SUBMITQUEUE_*
Add tu_drm_submitqueue_new and tu_drm_submitqueue_close.
2019-03-11 10:01:41 -07:00
Chia-I Wu fcf24f47aa turnip: add wrappers around DRM_MSM_GET_PARAM
Add tu_drm_get_gpu_id and tu_drm_get_gmem_size.
2019-03-11 10:01:41 -07:00
Chia-I Wu a25a803127 turnip: remove unnecessary libfreedreno_drm dep
Remove libfreedreno_drm dep and unused fd_device.
2019-03-11 10:01:41 -07:00
Chia-I Wu 91232c52fe turnip: use msm_drm.h from inc_freedreno
The recent change to msm_drm.h changed the APIs in an incompatible
way.
2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen 4f32869e3d turnip: Shorten primary_cmd_stream name.
It really is too long.
2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen 26261847cf turnip: Fill command buffer 2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen abe352525d turnip: Implement submission. 2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen abf0792bbe turnip: Make bo_list functions not static 2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen 65e0e79054 turnip: Add msm queue support. 2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen 8713499657 turnip: Add a command stream. 2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen e3a9b07923 turnip: Implement a slow bo list 2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen 48b65201a6 turnip: Implement some UUIDs. 2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen 7ae005f037 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%)
2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen 06602bf77f turnip: Remove some radv leftovers. 2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen c72e6085e7 turnip: Implement some format properties for RGBA8.
Just to get some tests to not skip. This is neither complete
nor completely correct.
2019-03-11 10:01:41 -07:00
Chia-I Wu d30baaaba6 turnip: add .clang-format
Add and apply .clang-format.
2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen 6401ad389e turnip: Implement pipe-less param query. 2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen b0562e272f turnip: move tu_gem.c to tu_drm.c 2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen 3d99dd55a0 turnip: Stop hardcoding the msm version check. 2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen d9c3dc8ec8 turnip: Add image layout calculations. 2019-03-11 10:01:41 -07:00
Bas Nieuwenhuizen 603354cffa turnip: Fix memory mapping. 2019-03-11 10:01:41 -07:00