Commit graph

313 commits

Author SHA1 Message Date
Jakob Bornecrantz 16b9dc13e2 xrt: Correct assert for ipc data type 2020-08-25 14:55:43 +01:00
Jakob Bornecrantz efac59a1d8 ipc: Add support for depth projection 2020-08-25 14:55:43 +01:00
Jakob Bornecrantz 1914a2ee93 ipc: Tidy 2020-08-21 18:17:18 +01:00
Ryan Pavlik 56dcaf5abf ipc: Some comment improvements. 2020-08-19 16:07:00 -05:00
Ryan Pavlik 7c0df6506b ipc/client: Use Android allocator on client side. 2020-08-19 16:07:00 -05:00
Ryan Pavlik 6600e738a3 ipc: Fix loop conditions in loopback allocator 2020-08-19 11:01:49 -05:00
Jakob Bornecrantz 201b5337df ipc: It's okay to send zero handles 2020-08-19 11:45:31 +00:00
Jakob Bornecrantz 019e962f94 ipc: Tidy and better error messages 2020-08-19 11:45:31 +00:00
Jakob Bornecrantz 4754dcd11b ipc: Add support for cube, cylinder and equirect layers 2020-08-14 19:15:02 +00:00
Ryan Pavlik a6b6ab8e2c ipc: Fix conditionals about handle types. 2020-08-13 17:34:05 -05:00
Ryan Pavlik 475192ec73 xrt: Rename "fd" references to "handle"
This breaks some Android pieces, which will be fixed shortly.
2020-08-12 17:11:42 -05:00
Ryan Pavlik 146218b346 xrt: Some clang tidy fixes.
A few suppressions as well where clang-tidy did the wrong thing.
2020-08-12 17:11:42 -05:00
Ryan Pavlik f1432789ee ipc: Const correctness 2020-08-12 09:51:07 -05:00
Jakob Bornecrantz d27044a18d ipc: Add a disabled loopback allocator 2020-08-12 15:26:43 +01:00
Jakob Bornecrantz a834c9977e ipc: Make it possible to give the client compositor a image allocator 2020-08-12 15:26:05 +01:00
Jakob Bornecrantz ca786df18c xrt: Make xrt_swapchain_create_info argument const 2020-08-07 19:15:18 +01:00
Jakob Bornecrantz 0b8d800dcc ipc: Use xrt_compositor_info in proto
Transport the whole compositor info struct to the client instead of just
formats so that all information is easily moved over.
2020-08-06 15:14:49 +00:00
Jakob Bornecrantz 3bbea14f24 ipc: Remove flip_y arguments to compositor creation 2020-08-06 15:14:49 +00:00
Jakob Bornecrantz d1d841e7c3 xrt: Use new info struct for compositor formats 2020-08-06 15:14:49 +00:00
Jakob Bornecrantz e8ca242967 xrt: Remove flip_y argument to native compositor creation 2020-08-06 15:14:49 +00:00
Christoph Haag 9a52e2384f ipc: initialize msg_control buffer 2020-08-05 20:32:51 +00:00
Ryan Pavlik e6abf3dea2 ipc: Docs 2020-07-22 16:17:09 +00:00
Jakob Bornecrantz 536e461776 ipc: Implement xrt_compositor::import_swapchain 2020-07-20 13:50:01 +00:00
Jakob Bornecrantz 11b2dfe213 ipc: Add function to import a swapchain 2020-07-20 13:50:01 +00:00
Jakob Bornecrantz 9c490127bb ipc: Fix in_handles handling by syncing with the server 2020-07-20 13:50:01 +00:00
Jakob Bornecrantz b93017911e xrt: Make xrt_compositor::create_swapchain return xrt_result_t 2020-07-20 13:50:01 +00:00
Ryan Pavlik 82395b23bb ipc: Use generic shmem functions now. 2020-07-16 13:06:07 -05:00
Ryan Pavlik 20c65e74e3 ipc: Define shmem utilities for Linux and Android 2020-07-16 13:06:07 -05:00
Christoph Haag a56fa20b50 build: Install tools with meson 2020-07-16 16:04:51 +02:00
Ryan Pavlik ebc7a11e70 ipc: Support client->server "in_handles" 2020-07-16 11:51:16 +00:00
Ryan Pavlik c3552ed420 xrt: Rename xrt_gfx_fd.h to xrt_gfx_native.h 2020-07-15 17:19:30 -05:00
Ryan Pavlik 54f56716fd xrt: Rename references to compositor/swapchain/image_fd to ..._native.
Reflecting that the native buffer isn't an FD on all platforms.
2020-07-15 09:11:58 -05:00
Ryan Pavlik 86d93601d7 ipc: Work on Android using AHardwareBuffer instead of FDs for graphics 2020-07-14 16:37:55 -05:00
Ryan Pavlik 44fe0e7709 build: Handle Android NDK better. 2020-07-14 16:37:55 -05:00
Ryan Pavlik 60cf946dd7 ipc: Normalize parameter names 2020-07-14 16:37:12 -05:00
Ryan Pavlik abc580d2b1 ipc: Replace "out_fds" with more generic "out_handles"
Also, finish porting client code to use factored-out utils.
2020-07-14 16:37:12 -05:00
Ryan Pavlik 040c82cb24 ipc: Port server side to use new factored-out utils 2020-07-14 16:24:26 -05:00
Ryan Pavlik 166c041421 ipc: Start providing handle marshalling util functions 2020-07-14 16:24:26 -05:00
Ryan Pavlik 1a692f5de6 ipc: Use factored-out utils on client side. 2020-07-14 16:24:26 -05:00
Ryan Pavlik 36f66ea630 ipc: Add factored-out basic message send/receive 2020-07-14 16:24:26 -05:00
Ryan Pavlik a5bde51c81 ipc: Change return type of some server functions from int to xrt_result_t 2020-07-14 16:24:26 -05:00
Ryan Pavlik c2e922b0f5 ipc: Formatting cleanup 2020-07-14 16:24:26 -05:00
Ryan Pavlik 87dbad9865 ipc: Have server utils return xrt_result_t 2020-07-14 16:24:26 -05:00
Ryan Pavlik 687beddcca ipc: Replace ipc_connection_t usage with struct ipc_connection 2020-07-14 16:24:23 -05:00
Ryan Pavlik cf68e11b97 ipc: Be more strict in type parsing 2020-07-14 16:18:17 -05:00
Ryan Pavlik 1b88c7e089 ipc: Move data structure out of generation script 2020-07-14 16:18:17 -05:00
Christoph Haag b073e3dfb9 xrt: Add support for assigned device roles
Abandons the assumption that in oxr_system.xdevs[], index 0 is HMD,
1 is left controller, 2 is right controller.

Now to represent the dynamically assigned roles, oxr_system.role contains
the index for a device in oxr_system.xdevs[] for head, left and right.

This role assignment happens on the client side and currently can not be updated
from the server side.

Also adds an enum that device drivers set indicating allowed assignments
(many controllers are physically designed to be held in a specific hand).

This also adds support for configurations with only a HMD and a right controller.
2020-07-13 18:03:01 +02:00
Christoph Haag 5788fb90a2 drivers: Add rotation/position tracking bool to xdev
xrGetSystemProperties() will return these values to application in XrSystemTrackingProperties
using the xdev assigned to head.
2020-07-13 18:03:01 +02:00
Jakob Bornecrantz deedd10a50 xrt: Tidy xrt_instance_create argument order and add doc-comment 2020-07-08 14:41:12 +00:00
Ryan Pavlik 323d794df3 ipc: Add a json schema for the IPC description 2020-07-08 09:15:51 -05:00
Jakob Bornecrantz 8ee7086ea6 xrt: Introduce xrt_swapchain_create_info 2020-07-04 11:04:07 +00:00
Jakob Bornecrantz 5bad87690f ipc: Avoid deadlocks due to render timing helper not getting data in time 2020-07-01 13:22:03 +01:00
Pete Black bd5aa24463 xrt: Add multi client and overlay client support 2020-06-25 15:48:34 +01:00
Jakob Bornecrantz 513ebd9957 ipc: Remove no longer used semaphore code (NFC) 2020-06-24 22:57:00 +01:00
Jakob Bornecrantz e59b4a1cb1 ipc: Use new frame timing code 2020-06-24 11:42:46 +01:00
Jakob Bornecrantz b75f4f844b xrt: Add frame_id to compositor frame calls 2020-06-23 21:31:00 +01:00
Christoph Haag f31f1edde2 ipc: Set destroyed swapchains to not active
Fixes the service failing to create swapchains with "ERROR: Too many swapchains!"
after one or several sequentially started and quit clients created 32 swapchains.
2020-06-19 14:41:34 +02:00
Jakob Bornecrantz 65dcc82e3a comp+ipc: Respect view space layer flag 2020-06-15 23:59:04 +00:00
Christoph Haag 8141a3c761 ipc: Reset waitframe semaphore when client disconnects
The semaphore was usually kept at a value of 1 after a client disconnected,
meaning the next client to connect was never blocked on it.
2020-06-15 15:47:56 +02:00
Ryan Pavlik 172ff0f434 ipc: Simplify code by just copying a structure. 2020-06-09 17:13:06 -05:00
Ryan Pavlik 1881bb6357 ipc: Further de-duplication of structures 2020-06-09 17:07:22 -05:00
Ryan Pavlik b6b5052d48 ipc: Remove structs that effectively duplicate xrt_layer_data
The only non-duplicate members are the swapchain IDs,
so store those in their own array as already done elsewhere in the
codebase.
2020-06-09 17:07:22 -05:00
Ryan Pavlik f407fb9461 ipc: Doc comments 2020-06-09 17:07:22 -05:00
Ryan Pavlik eaa4c186ce ipc: Port to using xrt_sub_image where possible.
This highlighted several places where we are not considering an image rect,
but possibly should be.
2020-06-09 16:26:01 -05:00
Ryan Pavlik e0e5aeceda xrt: name xrt_swapchain pointers consistently "xsc" or similar.
As is tradition.
2020-06-09 15:29:46 -05:00
Jakob Bornecrantz 45c977d199 xrt: Introduce xrt_sub_image and xrt_layer_projection_view_data 2020-06-09 20:32:53 +01:00
Jakob Bornecrantz 55e026245a xrt: Use new xrt_layer_data in layer functions 2020-06-09 19:04:48 +00:00
Jakob Bornecrantz 320c9ab3cb ipc+comp: Use new xrt_layer_data and friends struct 2020-06-09 19:04:48 +00:00
Jakob Bornecrantz 5912964ded ipc+comp: Even more make layers the same 2020-06-09 19:04:48 +00:00
Lubosz Sarnecki 08d81e5950 ipc+comp: Make layer structs more consistent.
Add missing fields.
Sort layer struct members.
ipc/protocol: Move xdev_id and name to common layer struct.
2020-06-09 19:04:48 +00:00
Lubosz Sarnecki b1d39e7f07 xrt: Move layer enum to xrt namespace. 2020-06-09 19:04:47 +00:00
Christoph Haag bc995e3aab ipc: Return XR_ERROR_INSTANCE_LOST instead of SIGABRT on the client side 2020-06-05 16:06:32 +02:00
Christoph Haag cc9b415a8f xrt: Add xrt_result_t return type to many functions
Many functions returned void and were assumed to always succeed, and some functions
returned only a bool to indicate vague success/failure.

Now that these functions get piped over IPC all of them have to be able to indicate
an IPC failure like for example an unreachable service.

With the xrt_result_t return type they now have the opportunity to report various
types of failures.
2020-06-05 16:06:32 +02:00
Christoph Haag db5db10a19 ipc: Replace ipc_result_t with global xrt_result_t
Functions down the line should be able to fail and return a status.

They can be called either through IPC or directly depending on compile settings,
therefore we need an internal result type for various XR_ERROR_* errors, but also IPC failure.

For now functions in ipc_client_utils.c only return XRT_SUCCESS or XRT_ERROR_IPC_FAILURE.
If there is no IPC failure, the generated protocol will extract and return the called functions'
actual return value from the reply.

v2: make failure results negative
2020-06-05 16:02:38 +02:00
Ryan Pavlik bc6cc85e7d xrt: Improve doxygen documentation. 2020-06-03 16:28:18 -05:00
Jakob Bornecrantz fb867b02c3 xrt: Remove array_size field on xrt_swapchain 2020-06-02 13:02:04 +01:00
Jakob Bornecrantz 9ec0b559d4 ipc/util: Don't follow null pointers and add alignment paranoia 2020-06-02 13:02:04 +01:00
Jakob Bornecrantz 05827abd8e ipc/server: Fix swapchain handling 2020-06-02 13:02:04 +01:00
Lubosz Sarnecki 7186bddf60 c/comp+ipc: Use array indices again.
This fixes a regression introduced by the IPC and layer rendering
patchsets and passes the array_index to the correct places, so the
correct VkImageView is used instead of the one with index 0.
2020-06-02 12:42:42 +02:00
Lubosz Sarnecki 4ad806df38 ipc/server_process: Check for swapchain NULL pointer.
Skip rendering when swapchains are invalid.
2020-05-28 22:16:57 +00:00
Lubosz Sarnecki d0539161dc c/renderer+ipc: Use layer renderer.
Make the renderer and IPC aware of multiple projection and quad layers
using the layer renderer.

Remove redundant code related to idle images and imported buffers and
command buffer rebuild, since we now always just display the layer
renderer's frame buffer.

Get view and projection properties from xrt_device.
2020-05-28 22:16:57 +00:00
Ryan Pavlik cef1970340 ipc: Make script more pythonic 2020-05-28 13:22:30 -05:00
Ryan Pavlik ff3a4d8b50 ipc: Fix all Flake8 warnings 2020-05-28 13:20:28 -05:00
Ryan Pavlik 4efdb6762a ipc: More script simplification. 2020-05-28 11:56:22 -05:00
Ryan Pavlik 0964a6dd07 ipc: Clean up generation script 2020-05-28 11:34:36 -05:00
Ryan Pavlik a44a915151 ipc: Put generator main in a function, for testing purposes 2020-05-28 11:34:36 -05:00
Ryan Pavlik 8bd1ac776e ipc: Fix class methods, mistaken use of class variables in IPC generator 2020-05-28 11:34:36 -05:00
Ryan Pavlik a034260ec3 ipc/client: Remove implementation of xrt_prober_create 2020-05-27 18:40:56 -05:00
Jakob Bornecrantz e8e7493679 ipc: Pass all arguments to create swapchain image 2020-05-27 21:57:48 +01:00
Jakob Bornecrantz 18fbd3f819 ipc: Make the XR client actually wait in wait frame by setting the correct semaphore value 2020-05-27 17:50:06 +01:00
Jakob Bornecrantz 7ab48b691c c/main&ipc: Adopt to flip y in layers change
Client side changes by Lubosz Sarnecki.
2020-05-26 11:33:58 +01:00
Lubosz Sarnecki e445f60ccf ipc: Add client side support for layers. 2020-05-26 11:33:58 +01:00
Jakob Bornecrantz b7b9d9307b ipc: Remove leftover fprintf (NFC) 2020-05-23 13:54:49 +01:00
Christoph Haag b32652c4df ipc: Implement xrWaitFrame by waiting on a shared semaphore v2
Version 2 additions by Jakob, still use a semaphore to wake up the client.
But now instead call the compositor wait frame and have that thread wake up
the client, and return immediatly on the IPC channel.
2020-05-13 17:07:08 +01:00
Ryan Pavlik 098ddde5da ipc: Fix typo 2020-05-12 11:46:53 -05:00
Christoph Haag 26539e79b6 ipc: Fix looking up tracking origins
Fixes #78
2020-05-09 21:14:24 +02:00
Jakob Bornecrantz cf3a337547 ipc: Be paranoid about tracking origins 2020-05-09 19:37:48 +01:00
Jakob Bornecrantz 66bcdf712e ipc: Track tracking origins with variable tracking 2020-05-09 12:43:26 +01:00
Jakob Bornecrantz ee163cbdb2 ipc: Reflect tracking origins correctly 2020-05-09 12:43:26 +01:00
Ryan Pavlik 8f6b7b930a ipc: Output the attempted filename in the bind error message. 2020-05-08 14:53:03 -05:00
Ryan Pavlik 83cace51d4 ipc: Add error message on bind failure. 2020-05-07 17:00:25 -05:00
Ryan Pavlik c4f8c7fdf7 ipc: Unlink on exit, not before start. 2020-05-07 16:55:10 -05:00
Ryan Pavlik 5935fad73b ipc: Add ability for service to be launched by systemd socket activation. 2020-05-07 16:54:11 -05:00
Ryan Pavlik d7e84cf5b5 build: Fix include directories for IPC server module 2020-05-07 15:46:29 -05:00
Jakob Bornecrantz d8428b2544 ipc/client: Don't assert on devices with no output 2020-05-01 19:20:03 +01:00
Christoph Haag 7ab1ca727f ipc: Make send_and_get_reply thread safe
When multiple threads call OpenXR functions, make sure one thread
can not read the reply meant for another thread.

Unfortunately this also blocks other OpenXR functions from being
called while xrWaitFrame() is blocking.
2020-05-01 16:11:26 +02:00
Christoph Haag d491f59b55 ipc: Log unexpected messaging events as errors
Any of these unexpected events will likely lead to more errors down the line.
Always printing them as errors will make it easier to diagnose the ipc.
2020-05-01 16:11:00 +02:00
Christoph Haag a195f22bc3 ipc: disconnect client on xrDestroyInstance()
The service considers clients to be connected as long as the fd is not closed.
After destroying an XrInstance this prevents the client from creating a subsequent XrInstance.
2020-05-01 02:49:44 +02:00
Jakob Bornecrantz a4dcdf1f0b ipc/server: Improve error messages 2020-04-30 20:45:34 +01:00
Jakob Bornecrantz 6d770336b7 ipc/server: Pass in MSG_NOSIGNAL to not get SIGPIPEd 2020-04-30 20:44:35 +01:00
Jakob Bornecrantz a02293e8dd ipc: Improve swapchain handling a tiny bit 2020-04-30 20:44:35 +01:00
Jakob Bornecrantz 11539e28b7 ipc/server: Fix swapchain being swapped left and right 2020-04-30 14:00:27 +01:00
Jakob Bornecrantz 7c8a8a3f87 ipc: Add code to enable a service process
This enables out of process compositing.
2020-04-29 14:58:24 +01:00