The open source OpenXR runtime
0
fork

Configure Feed

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

xrt: Add new API in xrt_compositor and xrt_multi_compositor_control interfaces

authored by

Zhongwang Zhang and committed by
Jakob Bornecrantz
195efff9 f84bef91

+96
+96
src/xrt/include/xrt/xrt_compositor.h
··· 730 730 XRT_COMPOSITOR_EVENT_OVERLAY_CHANGE = 2, 731 731 XRT_COMPOSITOR_EVENT_LOSS_PENDING = 3, 732 732 XRT_COMPOSITOR_EVENT_LOST = 4, 733 + XRT_COMPOSITOR_EVENT_DISPLAY_REFRESH_RATE_CHANGE = 5, 733 734 }; 734 735 735 736 /*! ··· 769 770 }; 770 771 771 772 /*! 773 + * Display refresh rate changed event. 774 + */ 775 + struct xrt_compositor_event_display_refresh_rate_change 776 + { 777 + enum xrt_compositor_event_type type; 778 + float from_display_refresh_rate_hz; 779 + float to_display_refresh_rate_hz; 780 + }; 781 + 782 + /*! 772 783 * Compositor events union. 773 784 */ 774 785 union xrt_compositor_event { ··· 777 788 struct xrt_compositor_event_state_change overlay; 778 789 struct xrt_compositor_event_loss_pending loss_pending; 779 790 struct xrt_compositor_event_lost lost; 791 + struct xrt_compositor_event_display_refresh_rate_change display; 780 792 }; 781 793 782 794 ··· 1249 1261 1250 1262 /*! @} */ 1251 1263 1264 + 1265 + /*! 1266 + * @name Function pointers for XR_FB_display_refresh_rate. 1267 + * @{ 1268 + */ 1269 + 1270 + /*! 1271 + * Get the current display refresh rate. 1272 + * 1273 + * @param xc Self pointer 1274 + * @param out_display_refresh_rate_hz Current display refresh rate in Hertz. 1275 + */ 1276 + xrt_result_t (*get_display_refresh_rate)(struct xrt_compositor *xc, float *out_display_refresh_rate_hz); 1277 + 1278 + /*! 1279 + * Request system to change the display refresh rate to the requested value. 1280 + * 1281 + * @param xc Self pointer 1282 + * @param display_refresh_rate_hz Requested display refresh rate in Hertz. 1283 + */ 1284 + xrt_result_t (*request_display_refresh_rate)(struct xrt_compositor *xc, float display_refresh_rate_hz); 1285 + 1286 + /*! @} */ 1287 + 1288 + 1252 1289 /*! 1253 1290 * Teardown the compositor. 1254 1291 * ··· 1661 1698 /*! @} */ 1662 1699 1663 1700 /*! 1701 + * @copydoc xrt_compositor::get_display_refresh_rate 1702 + * 1703 + * Helper for calling through the function pointer. 1704 + * 1705 + * @public @memberof xrt_compositor 1706 + */ 1707 + static inline xrt_result_t 1708 + xrt_comp_get_display_refresh_rate(struct xrt_compositor *xc, float *out_display_refresh_rate_hz) 1709 + { 1710 + return xc->get_display_refresh_rate(xc, out_display_refresh_rate_hz); 1711 + } 1712 + 1713 + /*! 1714 + * @copydoc xrt_compositor::request_display_refresh_rate 1715 + * 1716 + * Helper for calling through the function pointer. 1717 + * 1718 + * @public @memberof xrt_compositor 1719 + */ 1720 + static inline xrt_result_t 1721 + xrt_comp_request_display_refresh_rate(struct xrt_compositor *xc, float display_refresh_rate_hz) 1722 + { 1723 + return xc->request_display_refresh_rate(xc, display_refresh_rate_hz); 1724 + } 1725 + 1726 + 1727 + /*! 1664 1728 * @copydoc xrt_compositor::destroy 1665 1729 * 1666 1730 * Helper for calling through the function pointer: does a null check and sets ··· 2150 2214 * Notify this client/session if the compositor lost the ability of rendering. 2151 2215 */ 2152 2216 xrt_result_t (*notify_lost)(struct xrt_system_compositor *xsc, struct xrt_compositor *xc); 2217 + 2218 + /*! 2219 + * Notify this client/session if the display refresh rate has been changed. 2220 + */ 2221 + xrt_result_t (*notify_display_refresh_changed)(struct xrt_system_compositor *xsc, 2222 + struct xrt_compositor *xc, 2223 + float from_display_refresh_rate_hz, 2224 + float to_display_refresh_rate_hz); 2153 2225 }; 2154 2226 2155 2227 /*! ··· 2299 2371 } 2300 2372 2301 2373 return xsc->xmcc->notify_lost(xsc, xc); 2374 + } 2375 + 2376 + /*! 2377 + * @copydoc xrt_multi_compositor_control::notify_display_refresh_changed 2378 + * 2379 + * Helper for calling through the function pointer. 2380 + * 2381 + * If the system compositor @p xsc does not implement @ref xrt_multi_composition_control, 2382 + * this returns @ref XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED. 2383 + * 2384 + * @public @memberof xrt_system_compositor 2385 + */ 2386 + static inline xrt_result_t 2387 + xrt_syscomp_notify_display_refresh_changed(struct xrt_system_compositor *xsc, 2388 + struct xrt_compositor *xc, 2389 + float from_display_refresh_rate_hz, 2390 + float to_display_refresh_rate_hz) 2391 + { 2392 + if (xsc->xmcc == NULL) { 2393 + return XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED; 2394 + } 2395 + 2396 + return xsc->xmcc->notify_display_refresh_changed(xsc, xc, from_display_refresh_rate_hz, 2397 + to_display_refresh_rate_hz); 2302 2398 } 2303 2399 2304 2400 /*!