From 143ff5a0ac51a43538388976874337e3b7daa944 Mon Sep 17 00:00:00 2001 From: Yu Li Date: Thu, 21 Mar 2024 12:09:07 +0800 Subject: [PATCH] ipc: Add support for get bounds rect function --- src/xrt/ipc/client/ipc_client_compositor.c | 13 +++++++++++++ src/xrt/ipc/server/ipc_server_handler.c | 14 ++++++++++++++ src/xrt/ipc/shared/proto.json | 9 +++++++++ 3 files changed, 36 insertions(+) diff --git a/src/xrt/ipc/client/ipc_client_compositor.c b/src/xrt/ipc/client/ipc_client_compositor.c index 13d95988d..1b5e976f5 100644 --- a/src/xrt/ipc/client/ipc_client_compositor.c +++ b/src/xrt/ipc/client/ipc_client_compositor.c @@ -856,6 +856,18 @@ ipc_compositor_request_display_refresh_rate(struct xrt_compositor *xc, float dis IPC_CHK_ALWAYS_RET(icc->ipc_c, xret, "ipc_call_compositor_request_display_refresh_rate"); } +static xrt_result_t +ipc_compositor_get_reference_bounds_rect(struct xrt_compositor *xc, + enum xrt_reference_space_type reference_space_type, + struct xrt_vec2 *bounds) +{ + struct ipc_client_compositor *icc = ipc_client_compositor(xc); + xrt_result_t xret; + + xret = ipc_call_compositor_get_reference_bounds_rect(icc->ipc_c, reference_space_type, bounds); + IPC_CHK_ALWAYS_RET(icc->ipc_c, xret, "ipc_call_compositor_get_reference_bounds_rect"); +} + static void ipc_compositor_destroy(struct xrt_compositor *xc) { @@ -899,6 +911,7 @@ ipc_compositor_init(struct ipc_client_compositor *icc, struct xrt_compositor_nat icc->base.base.get_display_refresh_rate = ipc_compositor_get_display_refresh_rate; icc->base.base.request_display_refresh_rate = ipc_compositor_request_display_refresh_rate; icc->base.base.set_performance_level = ipc_compositor_set_performance_level; + icc->base.base.get_reference_bounds_rect = ipc_compositor_get_reference_bounds_rect; // Using in wait frame. os_precise_sleeper_init(&icc->sleeper); diff --git a/src/xrt/ipc/server/ipc_server_handler.c b/src/xrt/ipc/server/ipc_server_handler.c index 342cc8e24..e53d48704 100644 --- a/src/xrt/ipc/server/ipc_server_handler.c +++ b/src/xrt/ipc/server/ipc_server_handler.c @@ -1185,6 +1185,20 @@ ipc_handle_compositor_set_thread_hint(volatile struct ipc_client_state *ics, return xrt_comp_set_thread_hint(ics->xc, hint, thread_id); } +xrt_result_t +ipc_handle_compositor_get_reference_bounds_rect(volatile struct ipc_client_state *ics, + enum xrt_reference_space_type reference_space_type, + struct xrt_vec2 *bounds) +{ + IPC_TRACE_MARKER(); + + if (ics->xc == NULL) { + return XRT_ERROR_IPC_SESSION_NOT_CREATED; + } + + return xrt_comp_get_reference_bounds_rect(ics->xc, reference_space_type, bounds); +} + xrt_result_t ipc_handle_system_get_clients(volatile struct ipc_client_state *_ics, struct ipc_client_list *list) { diff --git a/src/xrt/ipc/shared/proto.json b/src/xrt/ipc/shared/proto.json index 95ea25765..4436f0d60 100644 --- a/src/xrt/ipc/shared/proto.json +++ b/src/xrt/ipc/shared/proto.json @@ -244,6 +244,15 @@ ] }, + "compositor_get_reference_bounds_rect": { + "in": [ + {"name": "reference_space_type", "type": "enum xrt_reference_space_type"} + ], + "out": [ + {"name": "bounds", "type": "struct xrt_vec2"} + ] + }, + "swapchain_get_properties": { "in": [ {"name": "info", "type": "struct xrt_swapchain_create_info"}