Commit graph

746 commits

Author SHA1 Message Date
Christoph Haag ee366e16e5 c/main: rename extensions num -> count 2022-01-13 23:03:56 +01:00
Christoph Haag 1ae1e695e2 c/util: Fix device extension list comment 2022-01-13 23:03:25 +01:00
Christoph Haag 8d5847d5a9 comp: Fix running with XRT_COMPOSITOR_XCB_FULLSCREEN=1
It required XRT_COMPOSITOR_XCB_DISPLAY to be set to a valid display or the
swapchain creation would fail because the requested width x height was 0x0.

Now the first display with a size other than 0x0 is selected when the current
selected display is 0x0.

fixes #148
2022-01-13 20:50:48 +00:00
Christoph Haag d36123927d comp: avoid an unnecessary struct copy for print modes 2022-01-12 21:57:18 +01:00
Christoph Haag 3dfec5f1ab comp: Don't omit first mode in debug print
Also avoid an unnecessary struct copy.
2022-01-12 21:53:47 +01:00
Antonio Ospite 2b456da531 c/client: make sure layer_commit passes complete frames in comp_gl_client
Make sure `layer_commit` passes on complete frames in `comp_gl_client.c`
even when EGL_ANDROID_native_fence_sync is not available.

The `insert_fence` function defined in `comp_egl_client.c` and passed as
argument to `comp_egl_client::client_gl_compositor_init` is only setting
up a proper fence when EGL_ANDROID_native_fence_sync is available,
resulting in a no-op otherwise.

However the fact that the insert_fence function is still valid results
in the `glFlush` workaround from
`comp_gl_client::client_gl_compositor_layer_commit` not kicking in.

To fix this define a NULL `insert_fence` function when
EGL_ANDROID_native_fence_sync is not available, and while at it turn the
`glFlush` workaround into a `glFinish` for extra safety.

This ensures that frames are always complete after
`client_gl_compositor_layer_commit` has been called.
2022-01-06 14:54:55 +00:00
Ryan Pavlik 1203cf38f0 cmake: Fix build when we have EGL but not GLES headers. 2021-12-13 15:00:24 -06:00
Ryan Pavlik 46d095d978 comp/util: Allow enabling timeline semaphores when creating bundle. 2021-12-08 00:54:12 +00:00
Jakob Bornecrantz 27f80a90d9 c/render: Make it safe to call comp_resources_close in more cases
Fixes #139
2021-12-01 16:08:12 +00:00
Jakob Bornecrantz 0bd38a0a0d c/render: Error on failing to get memory type 2021-11-24 17:05:13 +00:00
Christoph Haag a1c00e14fd st/oxr: Implement a basic version of XR_FB_display_refresh_rate 2021-11-22 20:44:18 +00:00
Jakob Bornecrantz 3f98ea5595 xrt: Tidy s/ll/log_level/g
Also make sure all variable logging uses the right type for logging variables.
2021-11-22 14:29:10 -06:00
Jakob Bornecrantz a56ea7cad6 c/multi: Fix copy-pasto 2021-11-18 20:14:05 +00:00
nima01 70263a6b16 c/util: Use GPU index specified by XRT_COMPOSITOR_FORCE_CLIENT_GPU_INDEX 2021-11-18 14:14:32 +00:00
Ryan Pavlik 185bf61dd8 comp: Migrate num_ to _count 2021-11-13 12:04:38 +00:00
Ryan Pavlik dfa0aba496 aux: Migrate num_ to _count 2021-11-13 12:04:38 +00:00
Ryan Pavlik 33c0287f8b xrt: Rename all "num" parameters and fields to "count" (or "capacity" as appropriate)
This matches the OpenXR usage: the array is the plural of the element type,
and the count is the singular element type plus "count" (usually CountOutput
because of the two-call idiom)

Includes fixes to other code to match API changes.
2021-11-13 12:04:38 +00:00
Ryan Pavlik cc4007a69e cmake: Substantial cleanups and simplifications
We now have a cmake-format config file.
We no longer use list variables for sources, instead using
target_sources when we need to add, in accordance with current
best practice. (This makes it a lot easier to edit too.) There's no more
include_directories(), add_definitions(), or other gently-deprecated
directory-scoped commands, nor any CMake scripts that include
a parent directory reference (named targets instead)
2021-11-12 09:48:37 -06:00
Ryan Pavlik 201765d3a7 comp: Populate blend mode list in system compositor info from device 2021-11-12 03:05:10 +00:00
Jakob Bornecrantz 7ecf649ac2 c/render: Use new Vulkan helpers 2021-11-10 14:22:28 +00:00
Jakob Bornecrantz 42b0361852 c/main: Use Vulkan helper in util 2021-11-07 15:14:04 +00:00
Jakob Bornecrantz 7703b7104b c/main: Tidy extensions 2021-11-06 10:51:19 +00:00
Jakob Bornecrantz a97523591f c/util: Add Vulkan helper 2021-11-06 10:51:19 +00:00
Jakob Bornecrantz 56b5918d69 c/main: Fix tab CVK_ERROR macro 2021-11-04 20:57:55 +00:00
Jakob Bornecrantz c912c67dc6 c/main: Use comp_base 2021-11-04 20:57:53 +00:00
Jakob Bornecrantz a1b515616a c/render: Documentation 2021-11-04 20:56:21 +00:00
Jakob Bornecrantz 6e28533bdc c/render: Break out into own library 2021-11-04 20:56:21 +00:00
Jakob Bornecrantz e08c1b1f04 c/util: Add comp_base native compositor helper base class 2021-11-04 20:56:21 +00:00
Jakob Bornecrantz c3b8810bb0 c/util: Documentation 2021-11-04 20:56:20 +00:00
Jakob Bornecrantz 029031cfd3 c/util: Break out swapchain and sync into own library 2021-11-04 20:55:48 +00:00
Jakob Bornecrantz 78936d2b4e c/main: Use get_vk more 2021-11-04 20:54:11 +00:00
Jakob Bornecrantz c6031a26e8 c/main: Refactor fence to be more independent 2021-11-04 20:46:09 +00:00
Jakob Bornecrantz 293d617dd5 c/main: Refactor swapchain to be more independent 2021-11-04 20:46:03 +00:00
Ryan Pavlik 3bd0a07aa2 cmake: Split out finding GLX from the rest of OpenGL on Linux.
Fixes #132.
2021-11-04 15:36:58 +00:00
Jakob Bornecrantz 36765256a6 c/render: Free command buffer when closing rendering 2021-11-03 23:10:47 +00:00
Ryan Pavlik 7a26a2339b comp: Fix some it's vs its. 2021-11-03 17:28:17 -05:00
Jakob Bornecrantz ec9cfa690d c/render: s/rts/rtr/g 2021-11-03 13:28:15 +00:00
Jakob Bornecrantz 12bfc8b5c9 c/render: Do not depend on the compositor 2021-11-03 13:26:42 +00:00
Jakob Bornecrantz c346d812c7 c/render: Add helpers to access the vk_bundle 2021-11-03 13:25:15 +00:00
Jakob Bornecrantz 648f49f4ef c/render: Change argument order to object first 2021-11-03 13:25:15 +00:00
Jakob Bornecrantz ccc4bbcf86 c/render: Remove unused disable_atw argument 2021-11-03 13:25:15 +00:00
Jakob Bornecrantz 56f4466ffa c/render: Move shaders to render 2021-11-03 13:25:15 +00:00
Jakob Bornecrantz 8c8d72647b c/render: Refactor out timewarp matrix into util file 2021-11-03 13:25:15 +00:00
Jakob Bornecrantz 60024efba9 c/render: If we only have a projection layer skip the layer renderer 2021-11-03 13:25:14 +00:00
Jakob Bornecrantz 4ca35b8b3c c/render: Don't cache comp_rendering 2021-11-03 13:24:20 +00:00
Jakob Bornecrantz 847e322fe5 c/render: Remove stub function decls 2021-11-02 20:19:05 +00:00
Jakob Bornecrantz d8a580d875 c/render: Tidy compute rendering 2021-11-02 20:19:05 +00:00
Jakob Bornecrantz f74812f02e c/render: Refactor rendering code so target data is it's own struct. 2021-11-02 20:19:05 +00:00
Jakob Bornecrantz 08135b6365 c/shaders: Tidy and codestyle 2021-11-02 20:19:05 +00:00
Jakob Bornecrantz 0b9bf9c772 c/main: Do not go via target for compositor 2021-11-02 20:19:05 +00:00
Jakob Bornecrantz 765feb6fe1 c/main: Refactor mesh descriptor and UBO upload 2021-11-02 20:19:05 +00:00
Mario Kleiner a6185490e8 c/direct: Fix direct display RandR leased output on multi-X-Screen.
The old code assumes the HMD is always connected to a RandR
output on X-Screen 0, but this is not neccessarily the case
on multi-X-Screen setups. Use a loop to iterate over all
X-Screens outputs until the HMD output is found.

Tested on single and dual X-Screen setups, also with Oculus
Rift CV1 connected to 2nd X-Screen.

This is rather useful for porting applications from "OpenHMD Rift
on separate X-Screen for performance" to OpenXR Monado direct
mode, so one can quickly switch between Monado and OpenHMD native
without cumbersome xorg.conf + logout + login games.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2021-10-28 12:29:36 +00:00
Ryan Pavlik 782aa11754 comp/main: Initial wiring, but don't actually allow closing the window on Windows for now. 2021-10-15 15:29:58 -05:00
Ryan Pavlik cb3fc65f14 comp/main: Win32: Spawn a thread for our windowed output. 2021-10-15 15:13:00 -05:00
Ryan Pavlik 2790f6d29f comp: Fix windows build - near and far are keywords. 2021-10-15 10:15:16 -05:00
Ryan Pavlik 884a312011 build: Fix build with CMake before 3.14 2021-10-01 11:21:35 -05:00
Christoph Haag 2ef9e0aa61 comp: Don't disconnect from NULL wayland_display
Fixes crash when not running on wayland.
2021-09-20 13:54:36 +00:00
Jakob Bornecrantz d36eec8fbb c/main: Guard against XRT_HAVE_WAYLAND_DIRECT 2021-09-17 11:54:57 +00:00
Jakob Bornecrantz 02d67a52c5 c/main: Guard use of VK_EXT_acquire_drm_display identifier 2021-09-17 11:54:57 +00:00
Jakob Bornecrantz a58b8df4a9 cmake: Link with WAYLAND_LIBRARIES or SDL gets sad 2021-09-17 11:54:57 +00:00
Simon Zeni 47be806428 c/main: Implement WINDOW_DIRECT_WAYLAND 2021-09-15 18:44:18 +00:00
Jakob Bornecrantz c5c07eced2 c/render: Remove the hacks 2021-09-14 16:15:27 +00:00
Jakob Bornecrantz 5bff6f3c9b c/render: Add ATW support for compute rendering 2021-09-14 16:15:27 +00:00
Jakob Bornecrantz 3795004208 c/main: Add compute distortion rendering backend 2021-09-14 16:15:27 +00:00
Christoph Haag 79fe29f674 c/main: Use ns_to_ms helper for nominal frame interval 2021-09-13 21:28:10 +01:00
Christoph Haag 83e194e9d3 comp: Wait for release/acquire fence before destroying swapchain
Fixes validation warning when quitting Vulkan OpenXR applications
like hello_xr -G Vulkan2:

VUID-vkDestroyImage-image-01000(ERROR / SPEC): msgNum: -221078694 - Validation Error: [ VUID-vkDestroyImage-image-01000 ] Object 0: handle = 0x55d4d96e4960, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xf2d29b5a | Cannot call vkDestroyImage on VkImage 0xcb1c7c000000001b[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to image, either directly or via a VkImageView, must have completed execution (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VUID-vkDestroyImage-image-01000)
    Objects: 1
        [0] 0x55d4d96e4960, type: 3, name: NULL

This is an addition to commit 778515739f that
introduced this fence.
2021-09-07 11:51:03 +02:00
Christoph Haag 527efd379f comp: debug print the numeric format
helps to see which format it is when it can not be translated to a string
2021-09-03 15:32:35 +00:00
korejan 42af354f65 c/multi: Fixes some uninitialized mutexes.
Fixes some uninitialized/null mutexes that causes crash bug during the creation of the multi compositors (seen on Windows).
2021-08-21 11:34:33 +01:00
Jakob Bornecrantz 9178e0ef59 c/main: Constify argument 2021-08-17 12:04:49 +01:00
Christoph Haag 778515739f comp: Guard acquire/release with a fence
Fixes validation warning when acquiring images before the command buffer
of the previous acquire or release on the same queue has finished.

VUID-vkQueueSubmit-pCommandBuffers-00071(ERROR / SPEC): msgNum: 774851941 - Validation Error: [ VUID-vkQueueSubmit-pCommandBuffers-00071 ] Object 0: handle = 0x558634c5c750, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x2e2f4d65 | vkQueueSubmit(): pSubmits[0].pCommandBuffers[0] VkCommandBuffer 0x558634b85a10[] is already in use and is not marked for simultaneous use. The Vulkan spec states: If any element of the pCommandBuffers member of any element of pSubmits was not recorded with the VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT, it must not be in the pending state (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VUID-vkQueueSubmit-pCommandBuffers-00071)
    Objects: 1
        [0] 0x558634c5c750, type: 3, name: NULL
2021-08-16 15:52:57 +02:00
Christoph Haag b249af9415 comp: Bind the correct GL texture for importing memory objects 2021-08-09 15:17:25 +02:00
Christoph Haag 1b179306dc comp: Only use dedicated allocation when supported/preferred
Fixes OpenGL depth formats on Tegra
2021-08-09 15:17:25 +02:00
Jakob Bornecrantz 9d9879ca3e c/multi: Make sure there are at least some predicted data
To avoid asserts in non-service mode.
2021-07-22 17:19:45 +01:00
Christoph Haag ab209bcf18 c/main: Add return value for when asserts are disabled
It's not worth introducing a new error code for this case, just
return XRT_ERROR_VULKAN.

Fixes error with asserts disabled

../src/xrt/compositor/main/comp_compositor.c: In function 'compositor_mark_frame':
../src/xrt/compositor/main/comp_compositor.c:186:1: warning: control reaches end of non-void function [-Wreturn-type]
  186 | }
      | ^
2021-07-15 01:31:19 +02:00
Ryan Pavlik 2d20a6436c comp: Wrap a unistd include for Windows. 2021-06-15 17:37:14 -05:00
Jakob Bornecrantz ebc2208a73 c/main: Also resize on VK_SUBOPTIMAL_KHR 2021-06-15 19:45:14 +00:00
Jakob Bornecrantz 9996d686e4 c/main: Tidy 2021-06-15 19:45:14 +00:00
Jakob Bornecrantz 1eebc12780 c/main: Refactor out viewport calculation into own function 2021-06-15 19:45:14 +00:00
Jakob Bornecrantz 6d011e25d4 c/main: Give the correct queue family argument to vkGetPhysicalDeviceSurfaceSupportKHR 2021-06-15 19:45:14 +00:00
Jakob Bornecrantz f38932cb64 c/main: Tidy comp_renderer fence creation a bit 2021-06-15 19:45:14 +00:00
Jakob Bornecrantz 65ca3113f8 c/main: Allow to specifiy image usage for target images 2021-06-15 19:45:14 +00:00
Jakob Bornecrantz fd1a916e0b c/main: Tidy and add a bit of debug to comp_target_swapchain 2021-06-15 19:45:14 +00:00
Jakob Bornecrantz 0f07e5b899 c/main: Tweak swapchain formats a bit 2021-06-15 19:45:14 +00:00
Jakob Bornecrantz 928ae5b27a c/render: Add support for non-freeable descriptor pools 2021-06-15 19:45:14 +00:00
Jakob Bornecrantz 6c033658a8 c/render: Add support for storage image descriptors 2021-06-15 19:45:14 +00:00
Jakob Bornecrantz 8a7d857dde aux/vk: Add the option to handle optional device features 2021-06-15 19:45:14 +00:00
Jakob Bornecrantz 57d24ecdbb aux/vk: Make it possible to get a compute only queue 2021-06-15 19:45:14 +00:00
Jakob Bornecrantz b805742a53 c/main: Do not list VK_FORMAT_A2B10G10R10_UNORM_PACK32 as a supported format 2021-06-15 14:27:07 +00:00
Jakob Bornecrantz f9b5097134 c/client: Use the EGL compositor's display in swapchain 2021-06-02 14:26:59 +00:00
Jakob Bornecrantz 13a5036b24 c/main: Make temp_vk be a pointer 2021-05-11 16:34:10 +00:00
Jakob Bornecrantz 9b6b5b7e6a c/main: Do not copy vk_bundle 2021-05-11 16:34:10 +00:00
Jakob Bornecrantz bd6e15c70c c/main: Follow style of using vk variable for vk_bundle interactions 2021-05-11 16:34:10 +00:00
Jakob Bornecrantz 3af65d60d2 c/client: Follow style of using vk variable for vk_bundle interactions 2021-05-11 16:34:10 +00:00
Jakob Bornecrantz 35beaeead4 c/client: Add EGL comment (NFC) 2021-05-05 16:14:00 +00:00
Jakob Bornecrantz c1ac7fc679 c/client: s/comp_egl_glue.c/comp_egl_client.c (NFC) 2021-05-05 16:14:00 +00:00
Jakob Bornecrantz 3a537b8374 c/client: Tidy EGL code (NFC) 2021-05-05 16:14:00 +00:00
Jakob Bornecrantz 12489295cb c/client: Do not blindly try to restore no EGLDisplay contexts 2021-05-05 16:14:00 +00:00
Jakob Bornecrantz 41817b6e11 c/client: Tidy EGL code (NFC) 2021-05-05 16:14:00 +00:00
Jakob Bornecrantz 1af00e7cbe c/client: Fix swapchain leak 2021-04-30 21:56:09 +00:00
Jakob Bornecrantz 76ed4d16ce c/client: Tidy and lower the logging level 2021-04-28 12:25:53 +00:00
Ryan Pavlik 2dd81f53e3 comp: Port to using new zero/identity defines 2021-04-26 22:38:42 +00:00
Jakob Bornecrantz 41ad1dcf99 c/main: Better Vulkan error printing 2021-04-26 22:56:08 +01:00
Jakob Bornecrantz 159eeb81a7 c/main: Pass in preferred dimensions to create images
Fixes #120
2021-04-26 20:28:32 +00:00
Jakob Bornecrantz 9c4b41f58e c/main: Assert that preferred dimensions are somewhat valid 2021-04-26 20:28:32 +00:00
Jakob Bornecrantz 2efd2f543f c/main: Tidy code in comp_target_swapchain (NFC) 2021-04-26 20:28:32 +00:00
Jakob Bornecrantz 5915318654 c/main: Clarify in code that it is preferred dimensions (NFC) 2021-04-26 20:28:32 +00:00
Jakob Bornecrantz ceb6c8b3fe c/main: Remove trailing newline in error message (NFC) 2021-04-26 20:28:32 +00:00
Jakob Bornecrantz 846a663942 c/main: Make instance extension list more readable (NFC) 2021-04-26 20:28:32 +00:00
Jakob Bornecrantz 64093dfaaf c/main: Expose more formats 2021-04-26 20:26:30 +01:00
Jakob Bornecrantz a377fb135f c/client: Vulkan formats are listed as numbers not hex 2021-04-26 18:52:31 +00:00
Jakob Bornecrantz c1d18f9b25 c/client: Add support for more formats in GL 2021-04-26 18:52:31 +00:00
Jakob Bornecrantz 7af531a6c5 c/main: Refactor so we can do an early acquire 2021-04-21 17:56:29 +00:00
Christoph Haag c47775a95d comp: Fix warning after Vulkan 1.2.174 VK_NULL_HANDLE change
../src/xrt/compositor/main/comp_layer_renderer.c:317:17: warning: initialization of 'unsigned int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
  317 |      .subpass = VK_NULL_HANDLE,
      |                 ^~~~~~~~~~~~~~
2021-04-19 13:04:59 +02:00
Jakob Bornecrantz daff92a275 c/main: None functional refactor of renderer.
Not ment to change the functionallity of the code only reflow the code.
2021-04-17 00:12:22 +01:00
Jakob Bornecrantz 5d605c7b3f c/main: Do not create images when initing swapchain. 2021-04-16 02:27:22 +01:00
Ryan Pavlik 1521953813 c/main: Re-arrange comp_renderer to allow late init.
Co-author: Jakob Bornecrantz <jakob@collabora.com>
2021-04-16 02:27:22 +01:00
Ryan Pavlik 1cf39ec2c0 c/main: Add comp_target::has_images, and implement in comp_target_swapchain. 2021-04-16 01:51:05 +01:00
Ryan Pavlik 90192118d0 c/main: Add comp_target::check_ready, and implement in comp_target_swapchain. 2021-04-16 01:45:38 +01:00
Jakob Bornecrantz 780ec4fac9 c/main: Turn debug into spew 2021-04-16 01:45:38 +01:00
Ryan Pavlik 7c2ea1369f c/main: Normalize destroy pattern for comp_renderer. 2021-04-15 23:28:47 +01:00
Ryan Pavlik 70982e9c39 c/main: Remove unimplemented comp_renderer function. 2021-04-15 23:28:47 +01:00
Ryan Pavlik 04c9a7d892 c/main: Normalize comp_layer_renderer_destroy convention. 2021-04-15 23:28:47 +01:00
Ryan Pavlik ffe458fdba c/main: Add comp_layer_renderer docs. 2021-04-15 23:28:47 +01:00
Ryan Pavlik 80da6fe3b8 c/main: Add comp_renderer docs. 2021-04-15 23:28:47 +01:00
Ryan Pavlik ab5f9ae9d8 c/main: Add comp_target docs. 2021-04-15 23:28:47 +01:00
Ryan Pavlik 969c78efbd c/client: Fix comment. 2021-04-15 23:28:47 +01:00
Jakob Bornecrantz 7dc132a207 c/client: Set correct reference on swapchain 2021-04-13 23:21:14 +01:00
Jakob Bornecrantz b48cdfed44 c/main: Fix xrt_compositor::wait_frame 2021-04-13 16:56:17 +00:00
Jakob Bornecrantz 4507804819 c/multi: Implement xrt_compositor::wait_frame 2021-04-13 16:56:17 +00:00
Ryan Pavlik cb2710db87 comp: Improve docs on comp_target_swapchain 2021-04-13 11:46:53 -05:00
Ryan Pavlik 1e1fe01374 comp: Doc improvements. 2021-04-13 11:46:53 -05:00
Jakob Bornecrantz 1b51cbd1a7 aux/vk: Add support for VK_EXT_global_priority 2021-04-12 22:16:31 +00:00
Jakob Bornecrantz 796f3cf792 c/main: Set default logging level to INFO 2021-04-12 22:16:31 +00:00
Jakob Bornecrantz c9c362e16a c/multi: Overwrite stale scheduled frames 2021-04-12 22:16:31 +00:00
Jakob Bornecrantz b0c9f2a1d9 c/multi: Break potential long running tasks into functions for better trace_marker logging 2021-04-12 22:16:31 +00:00
Jakob Bornecrantz 95e95ba9b5 c/render: Tidy mesh shader 2021-04-12 22:16:31 +00:00
Ryan Pavlik 1ce306cb55 cmake: Fix include dir scope for comp_multi 2021-04-09 18:11:46 -05:00
Ryan Pavlik dde274b13e comp: Fix typo. 2021-04-09 18:11:52 +01:00
Jakob Bornecrantz aca09bdebf c/multi: Do not display frames before they are to be displayed
This follows the OpenXR spec that says that a frame might not be
displayed before XrFrameEndInfo::displayTime value.
2021-04-07 15:41:47 +01:00
Jakob Bornecrantz 8215af5e5c u/rt: Refactor render timing 2021-04-07 01:04:20 +01:00
Jakob Bornecrantz 971f88f34f u/ft: Rename frame timing functions 2021-04-07 00:50:10 +01:00
Jakob Bornecrantz 5dbcca65c5 u/tr: Refactor rendering timing code 2021-04-07 00:50:10 +01:00
Jakob Bornecrantz f14958f2b0 c/main: Explicitly wait for GPU work to finish 2021-04-07 00:50:10 +01:00
Jakob Bornecrantz bf2a90fec5 c/main: Switch to multi client layer 2021-04-07 00:50:10 +01:00
Jakob Bornecrantz 205db10353 c/main: Implement new predict and mark frame functions 2021-04-07 00:50:10 +01:00
Ryan Pavlik 22df47f974 c/main: Port to using u_graphics_sync_unref 2021-04-07 00:50:10 +01:00
Jakob Bornecrantz 2035da1ec9 c/main: Implement fence functions 2021-04-07 00:50:10 +01:00
Jakob Bornecrantz 086bef8545 c/multi: Add new multi-client helper 2021-04-07 00:50:10 +01:00
Jakob Bornecrantz efdba1602f xrt: Pass along display_time_ns to layer begin 2021-04-07 00:50:10 +01:00
Moses Turner b62b6eaef7 c/main: Follow OpenXR spec with blackground colour, tweek no layer colour.
Make background colour completely black if there are layers to display, to
follow OpenXR spec. Make the default background colour darker.
2021-04-04 20:34:35 +01:00
Ryan Pavlik d34e1464fd comp: Update file header. 2021-04-02 18:02:10 -05:00
Ryan Pavlik c81ae4670b comp: Properly service Windows message queue. 2021-04-02 17:47:40 -05:00
Ryan Pavlik 0139aa1525 comp: Fix conversion warnings 2021-03-31 12:02:41 -05:00
Ryan Pavlik d4c352ef69 comp: Improve Windows errors. 2021-03-31 12:02:41 -05:00
Ryan Pavlik 942091c10d comp: Enable VK_EXT_debug_report extension 2021-03-31 12:02:41 -05:00
Ryan Pavlik 592df37c0f comp: Fix some narrowing conversion warnings 2021-03-31 12:02:41 -05:00
Ryan Pavlik 78301ae5eb comp: Use precise sleeper. 2021-03-31 12:02:41 -05:00
Ryan Pavlik ace8dc8c46 comp: clean up comment 2021-03-30 20:46:00 +00:00
Ryan Pavlik 8553b5f901 comp/vk_client: Be sure to init/de-init the mutexes in the vulkan bundle 2021-03-30 20:46:00 +00:00
Ryan Pavlik 3f2b09ae54 comp: Comment cleanup 2021-03-30 20:46:00 +00:00
Ryan Pavlik be5a273659 comp/main: Use the new vk_bundle mutex functions. 2021-03-30 20:46:00 +00:00
Ryan Pavlik 7b92d212a2 comp: Fix doxygen warnings 2021-03-26 17:10:53 -05:00
Ryan Pavlik b57d52f373 comp/main: Fix warnings 2021-03-26 17:06:17 -05:00
Ryan Pavlik bd00c7ffd3 comp/main: Deal with MSVC not liking static array sizes being non-constant. 2021-03-26 17:06:17 -05:00
Ryan Pavlik 0140ea34b6 comp/main: Implement consumption of sync handle on Windows 2021-03-26 17:06:17 -05:00
Jakob Bornecrantz 63f5c86257 xrt: Make xrt_swapchain be reference counted 2021-03-24 17:50:08 +00:00
Jakob Bornecrantz 0452c69caa c/main: Detect when config is needed but missing 2021-03-12 00:06:36 +00:00
Jakob Bornecrantz 0571e0337e xrt: Add XRT_ERROR_EGL_CONFIG_MISSING error 2021-03-12 00:06:36 +00:00
Jakob Bornecrantz 8be59f73ec xrt: Return xrt_result_t from xrt_gfx_provider_create_gl_egl 2021-03-12 00:06:36 +00:00
Jakob Bornecrantz 8992f79257 c/main: Be even more paranoid about display timing code 2021-03-10 17:53:36 +00:00
Jakob Bornecrantz a6da40de50 c/main: Remove unused fields
Tested-by: Boris-Chengbiao Zhou <bobo1239@web.de>
2021-03-09 18:16:01 +00:00
Jakob Bornecrantz 003b70d05e c/main: Use correct predicted display time for rendering
Closes #114

Reported-by: Boris-Chengbiao Zhou <bobo1239@web.de>
Tested-by: Boris-Chengbiao Zhou <bobo1239@web.de>
2021-03-09 18:15:52 +00:00
Jakob Bornecrantz 8c724d67d4 c/main: Trace markers 2021-03-08 11:20:52 +00:00
Jakob Bornecrantz fac1ce4a5a c/main: Hookup up new frame timing code 2021-03-08 11:20:52 +00:00
Mateo de Mayo 75e908552f doc: Fix missing entities from modules documentation 2021-03-06 20:34:35 -03:00
Jakob Bornecrantz 48c2fe1f87 c/main: Refactor out wait idle to own function 2021-02-24 14:33:34 +00:00
Jakob Bornecrantz 616b7f6ae0 c/main: Tidy comp_target_swapchain 2021-02-24 14:33:34 +00:00
Christoph Haag cc81174b70 comp: Fix VkDisplayKHR direct mode build without libx11-xcb 2021-02-10 22:02:30 +01:00
Christoph Haag f5abb14422 comp: Don't allocate ubos with VK_MEMORY_PROPERTY_HOST_CACHED_BIT
On Tegra the only supported combinations for VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT are

* VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
* VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
* VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT

This article agrees that we do not need host cached memory here:
https://zeux.io/2020/02/27/writing-an-efficient-vulkan-renderer/
2021-02-03 02:24:35 +01:00
Jakob Bornecrantz 18fb3e7024 c/main: Lower priority on sRGB format
This works around a bug in the OpenXR CTS and mirrors better what at least on
other OpenXR runtime does.
2021-01-27 15:41:15 +00:00
Jakob Bornecrantz e375523d80 c/main: Also print format when debugging swapchain creation 2021-01-27 14:03:27 +00:00
Christoph Haag b23f04fed9 comp: Return proper errors for Vulkan xrCreateSwapchain 2021-01-26 15:26:47 +00:00
Christoph Haag b64b6f75fe comp: Return proper errors for OpenGL xrCreateSwapchain 2021-01-26 15:26:47 +00:00
Jakob Bornecrantz afea93f297 xrt: Remove prepare function from xrt_compositor 2021-01-20 15:04:09 +00:00
Jakob Bornecrantz 2b8c835b68 xrt: Introduce xrt_system_compositor 2021-01-20 15:04:09 +00:00
Christoph Haag 9481013081 comp: add VkDisplayKHR window backend
Must be activated/selected with an env var for now: XRT_COMPOSITOR_FORCE_VK_DISPLAY=2
2021-01-19 17:00:46 +00:00
Christoph Haag 5e8338a6de comp: Render with pose for next display time, not last 2021-01-15 18:25:27 +01:00
Jakob Bornecrantz 2b996f30c4 xrt: Reflow after column change 2021-01-15 13:50:32 +00:00
Jakob Bornecrantz a5560f8363 c/main: Remove unused field 2021-01-14 12:30:54 +00:00
Christoph Haag ad1e809dfc comp: Extend nvidia VK_ERROR_INITIALIZATION_FAILED message
The real cause for this failure seems to be an extended desktop to the direct mode
display, not the allowhmd setting.
2021-01-13 23:51:36 +01:00
Christoph Haag f684ae95d1 comp: Fix depth-stencil image validation warning
Depth-only formats must use *only* VK_IMAGE_ASPECT_DEPTH_BIT.
Depth-stencil formats must use both VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT.
2021-01-13 20:39:20 +01:00
Lubosz Sarnecki b005f4e2fa comp/vk: Guard VkCommandBuffer usage with command pool mutex.
Lock all queue submits with 2 mutexes using a new vk_locked_submit
function.
2021-01-13 12:42:26 +01:00
Lubosz Sarnecki fc3b7fef25 comp/vk: Lock command pool calls with a mutex.
This patch resolves multithreading issues as detected by the Vulkan
validation when running the OpenXR CTS using OpenGL.
2021-01-13 12:33:15 +01:00
Lubosz Sarnecki c97404e873 comp/vk_client: Improve error messages.
As we use u_logging here, new lines are redundant. Also showing the
VkError code is handy.
2021-01-13 12:33:15 +01:00
Lubosz Sarnecki cc44816026 comp/vk: Put queue mutex around vkDeviceWaitIdle calls. 2021-01-13 12:33:15 +01:00
Lubosz Sarnecki 9a9d46b85a comp/vk: Lock our only VkQueue with a mutex.
This resolved mutlithreading issues as seen in the `multithreading` test
of the OpenXR CTS.

This patch fixes the test on Vulkan Android and resolves Vulkan
validation errors when running on Linux with OpenGL.
2021-01-13 12:33:15 +01:00
Jakob Bornecrantz eea8036e91 c/client: Ensure that EGL_ANDROID_native_fence_sync 2021-01-11 16:50:02 +00:00
Christoph Haag 726c752db2 comp: Add support for list of optional device extensions
If one of the supplied optional extensions is VK_GOOGLE_display_timing and it is
supported by the driver, vk_bundle::has_GOOGLE_display_timing will be set to true.
2021-01-07 19:12:41 +01:00
Jakob Bornecrantz 15320d9ebe c/client: Insert fence and give sync handle on layer_commit (EGL for now only) 2020-12-28 15:22:46 +00:00
Jakob Bornecrantz 32c9cb1bf3 c/main: Make sure to close sync handles on layer_commit 2020-12-28 15:22:06 +00:00
Jakob Bornecrantz 1302b07d68 xrt: Add sync_handle argument to layer_commit 2020-12-28 15:22:06 +00:00
Lubosz Sarnecki 4acab28f3f c/client: Port printfs to static u_logging. 2020-12-28 13:04:11 +00:00
Lubosz Sarnecki ba1d966f9f aux/vk: Port to u_logging.
Fix log calls where no valid state struct was provided.
2020-12-28 13:04:11 +00:00
Boris-Chengbiao Zhou 98ef9a8ef7 comp: Fix Wayland backend 2020-12-28 04:13:22 +01:00
Lubosz Sarnecki d0262c8613 c/comp: Fix switch fall through warning in gcc10. 2020-12-16 15:07:28 +01:00
Jakob Bornecrantz c30c4c011d c/main: Silence warnings and make sure that layer configs are picked up 2020-12-15 14:27:31 +00:00
Lubosz Sarnecki 200fb5aeed c/layers: Don't build equirect code if not enabled. 2020-12-14 18:59:28 +00:00
Lubosz Sarnecki 4995854d06 c/layers: Implement equirect1 rendering.
Add equirect1 boilerplate, shader files, ubo and pipeline.
2020-12-14 18:59:28 +00:00
Lubosz Sarnecki dc45a201db c+ipc+st: Complete equirect1 boilerplate. 2020-12-14 18:59:28 +00:00
Lubosz Sarnecki f334b8b6c7 src: Consistently append 2 to equirect2 code.
Rename XRT_FEATURE_OPENXR_LAYER_EQUIRECT to XRT_FEATURE_OPENXR_LAYER_EQUIRECT2.
Rename equirect to equirect2.
Rename shader files.
2020-12-14 18:59:28 +00:00
Christoph Haag ada506513f comp: Add XRT_COMPOSITOR_DEFAULT_FRAMERATE variable, default to 60
This variable only has an effect if
* The compositor is not run in direct mode (which uses the actual refresh interval of the chosen mode)
* The HMD driver does not default to a refresh ate by settting hmd->screens[0].nominal_frame_interval_ns
2020-12-10 16:36:22 +01:00
Christoph Haag 99e8416cac comp: Hook up xcb fullscreen and display settings to variables 2020-12-10 16:33:38 +01:00
Christoph Haag 199536c575 comp: Default xcb window to VK_PRESENT_MODE_IMMEDIATE_KHR
VK_PRESENT_MODE_FIFO_KHR leads to unsteady 60 fps.
2020-12-10 16:33:34 +01:00
Ryan Pavlik ee755961fc comp: Guard more of the caps-detector with an ifdef. 2020-12-06 23:07:05 +00:00
Ryan Pavlik 8b4e3aafa5 comp: Remove unused macro 2020-12-06 23:07:05 +00:00
Ryan Pavlik 5ea9fe04a3 comp: Add comments near Vulkan extension lists about updating docs. 2020-12-06 23:07:05 +00:00
Ryan Pavlik 0cb64ce5bd comp/main: Windows work - got a window to appear! 2020-12-06 23:07:05 +00:00
Ryan Pavlik 2743790180 comp/main: Remove *nix-only include 2020-12-06 23:07:05 +00:00
Lubosz Sarnecki 373a3096a9 c/window_android: Use cached surface from IPC.
Create window if activity is cached for in process.
2020-12-01 18:05:32 +01:00
Lubosz Sarnecki ae76b5037d c/renderer: Fix right eye viewport when not pre-rotating.
Scale X / Y were swapped incorrectly.
2020-12-01 15:46:21 +01:00
Lubosz Sarnecki c4683bb059 c/renderer: Pre-rotate display for transformed surfaces.
This resolves VK_SUBOPTIMAL_KHR warnings when preseting the swap chain
on systems likes Android.

https://android-developers.googleblog.com/2020/02/handling-device-orientation-efficiently.html
2020-11-27 16:50:55 +01:00
Ryan Pavlik 147dcc24e0 comp/main: Fix finding M_PI 2020-11-23 14:27:21 -06:00
Ryan Pavlik 8b4c473233 comp/main: Change annotation for struct packing for MSVC compatibility. 2020-11-23 14:27:21 -06:00
Ryan Pavlik 6fbd12bde4 comp/main: near and far are keywords on Windows. 2020-11-23 14:27:21 -06:00
Ryan Pavlik 66811b436a xrt: Have the vk_helper vk_create_device take in a list of device extensions, and fix usages. 2020-11-23 14:27:21 -06:00
Ryan Pavlik 6c2b5d6614 comp/main: Clean up lists of extensions in main compositor 2020-11-23 14:27:21 -06:00
Ryan Pavlik 69a33c642d comp/client: Clean up Vulkan extension list, and add Windows extensions. 2020-11-23 14:18:20 -06:00
Jakob Bornecrantz 9bf58ec275 c/main: Make COMP_ERROR respect log level 2020-11-20 03:20:33 +00:00
Jakob Bornecrantz 6902f6d7a3 c/render: Change some COMP_ERROR to VK_ERROR 2020-11-20 03:20:33 +00:00
Jakob Bornecrantz 363703602e c/main: Tidy comp_target_swapchain 2020-11-20 03:20:33 +00:00
Jakob Bornecrantz ea723240e3 c/main: Tidy comp_android_window 2020-11-20 03:20:33 +00:00
Jakob Bornecrantz f4c1ebe90c c/main: Remove vk field from comp_target_swapchain 2020-11-20 03:20:33 +00:00
Jakob Bornecrantz d60ae941f1 c/main: Remove comp_window struct 2020-11-20 03:20:33 +00:00
Jakob Bornecrantz 9302bfa028 c/main: Move c field from comp_window to comp_target 2020-11-20 03:20:33 +00:00
Jakob Bornecrantz e8360c013d c/main: Refactor vk_swapchain into comp_target_swapchain 2020-11-20 03:20:33 +00:00
Jakob Bornecrantz 6260248d20 c/main: Introduce comp_target struct 2020-11-20 03:20:33 +00:00
Jakob Bornecrantz 78f7ad7301 c/main: Tidy vk_swapchain a bit 2020-11-19 01:13:23 +00:00
Jakob Bornecrantz e0a7df0f1d st/oxr: Make sure to restore old EGL display/context/drawables when creating a EGL compositor 2020-11-15 22:47:42 +00:00
Benjamin Saunders 15a89005ca Fix trailing space in xrGetVulkanDeviceExtensionsKHR
Also tweak the instance extensions definition for consistency.
2020-11-07 12:50:25 -08:00
Christoph Haag 2a00c9f09e comp: Add basic frame timing information to trace log 2020-11-06 00:50:24 +01:00
Christoph Haag 965fa60bff xrt: Move synchronized state test into oxr session
The compositor now moves immediately to visible/focused when polling.
The state tracker will generate relevant openxr state changes once the session is synchronized.

Properly working alternative to e03ee48dce (reverted in e7643de8db)
2020-11-04 00:37:10 +01:00
Jakob Bornecrantz e7643de8db c/main: Revert "Transition to visible/focused after xrEndFrame, not xrWaitFrame"
This reverts commit e03ee48dce.
2020-11-03 21:04:05 +00:00
Ryan Pavlik 5f70826ba5 xrt: Add misc missing copyright/license notices 2020-11-02 17:04:51 +00:00
Christoph Haag e03ee48dce comp: Transition to visible/focused after xrEndFrame, not xrWaitFrame
The application synchronizes its frame loop by "by calling xrWaitFrame,
xrBeginFrame and xrEndFrame in a loop."

Applications can discard frames by not calling xrEndFrame. If initial
frames are discarded, we should not consider the frame loop synchronized.

Previously a sequence like
  xrBeginFrame, xrWaitFrame, xrBeginFrame, xrWaitFrame, xrPollEvent, xrBeginFrame
failed because xrPollEvent the compositor emitted transitions to visible
and focused but they were not emitted in the state tracker, because the
oxr session had not internally tranisitioned to the synchronized state.
2020-10-31 20:14:49 +01:00
Lubosz Sarnecki a8c7ac2074 c/eglimage_swapchain: Actually return created swapchain. 2020-10-28 12:12:31 -05:00
Lubosz Sarnecki af4c6a8ba3 c/gl_client: Check if swapchain is not NULL. 2020-10-28 12:12:31 -05:00
Lubosz Sarnecki bd107095fd c/gl_client: Port to u_logging. 2020-10-28 12:12:31 -05:00
Lubosz Sarnecki 633b7839c2 aux/vk+comp/sc: Initialize extra structs for hardware buffer extension.
Fix sRGB format for Android hardware buffers.
2020-10-28 12:12:31 -05:00
Lubosz Sarnecki 3cc8793d7d aux+comp: Add Android hardware buffer device extension. 2020-10-28 12:12:31 -05:00
Ryan Pavlik a0bbca572d comp: Basic Android compositor window.
Also makes the service feature not depend on other options:
it can be used without those other parts.

comp/window_android: Remove unused EGL code for now, as it is crashing.

comp/window_android: Use MonadoView async method to create surface.

comp/window_android: Use custom surface as intended

Co-authored-by: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
2020-10-28 09:41:30 -05:00