The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ipc: Implement display refresh rate functions

authored by

Zhongwang Zhang and committed by
Jakob Bornecrantz
74df016d df071285

+59
+22
src/xrt/ipc/client/ipc_client_compositor.c
··· 792 792 IPC_CHK_ALWAYS_RET(icc->ipc_c, xret, "ipc_call_compositor_set_thread_hint"); 793 793 } 794 794 795 + static xrt_result_t 796 + ipc_compositor_get_display_refresh_rate(struct xrt_compositor *xc, float *out_display_refresh_rate_hz) 797 + { 798 + struct ipc_client_compositor *icc = ipc_client_compositor(xc); 799 + xrt_result_t xret; 800 + 801 + xret = ipc_call_compositor_get_display_refresh_rate(icc->ipc_c, out_display_refresh_rate_hz); 802 + IPC_CHK_ALWAYS_RET(icc->ipc_c, xret, "ipc_call_compositor_get_display_refresh_rate"); 803 + } 804 + 805 + static xrt_result_t 806 + ipc_compositor_request_display_refresh_rate(struct xrt_compositor *xc, float display_refresh_rate_hz) 807 + { 808 + struct ipc_client_compositor *icc = ipc_client_compositor(xc); 809 + xrt_result_t xret; 810 + 811 + xret = ipc_call_compositor_request_display_refresh_rate(icc->ipc_c, display_refresh_rate_hz); 812 + IPC_CHK_ALWAYS_RET(icc->ipc_c, xret, "ipc_call_compositor_request_display_refresh_rate"); 813 + } 814 + 795 815 static void 796 816 ipc_compositor_destroy(struct xrt_compositor *xc) 797 817 { ··· 839 859 icc->base.base.destroy = ipc_compositor_destroy; 840 860 icc->base.base.poll_events = ipc_compositor_poll_events; 841 861 icc->base.base.set_thread_hint = ipc_compositor_set_thread_hint; 862 + icc->base.base.get_display_refresh_rate = ipc_compositor_get_display_refresh_rate; 863 + icc->base.base.request_display_refresh_rate = ipc_compositor_request_display_refresh_rate; 842 864 843 865 // Using in wait frame. 844 866 os_precise_sleeper_init(&icc->sleeper);
+25
src/xrt/ipc/server/ipc_server_handler.c
··· 556 556 return xrt_comp_discard_frame(ics->xc, frame_id); 557 557 } 558 558 559 + xrt_result_t 560 + ipc_handle_compositor_get_display_refresh_rate(volatile struct ipc_client_state *ics, 561 + float *out_display_refresh_rate_hz) 562 + { 563 + IPC_TRACE_MARKER(); 564 + 565 + if (ics->xc == NULL) { 566 + return XRT_ERROR_IPC_SESSION_NOT_CREATED; 567 + } 568 + 569 + return xrt_comp_get_display_refresh_rate(ics->xc, out_display_refresh_rate_hz); 570 + } 571 + 572 + xrt_result_t 573 + ipc_handle_compositor_request_display_refresh_rate(volatile struct ipc_client_state *ics, float display_refresh_rate_hz) 574 + { 575 + IPC_TRACE_MARKER(); 576 + 577 + if (ics->xc == NULL) { 578 + return XRT_ERROR_IPC_SESSION_NOT_CREATED; 579 + } 580 + 581 + return xrt_comp_request_display_refresh_rate(ics->xc, display_refresh_rate_hz); 582 + } 583 + 559 584 static bool 560 585 _update_projection_layer(struct xrt_compositor *xc, 561 586 volatile struct ipc_client_state *ics,
+12
src/xrt/ipc/shared/proto.json
··· 203 203 ] 204 204 }, 205 205 206 + "compositor_get_display_refresh_rate": { 207 + "out": [ 208 + {"name": "out_display_refresh_rate_hz", "type": "float"} 209 + ] 210 + }, 211 + 212 + "compositor_request_display_refresh_rate": { 213 + "in": [ 214 + {"name": "display_refresh_rate_hz", "type": "float"} 215 + ] 216 + }, 217 + 206 218 "swapchain_get_properties": { 207 219 "in": [ 208 220 {"name": "info", "type": "struct xrt_swapchain_create_info"}