The open source OpenXR runtime
0
fork

Configure Feed

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

xrt: Add brightness control feature and callbacks

Allowing a headset's display brightness to be queried and updated.

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2426>

averyv 8731b6db 6f1d5318

+46
+46
src/xrt/include/xrt/xrt_device.h
··· 264 264 bool face_tracking; 265 265 bool body_tracking; 266 266 bool battery_status; 267 + bool brightness_control; 267 268 268 269 bool planes; 269 270 enum xrt_plane_detection_capability_flags_ext plane_capability_flags; ··· 627 628 float *out_charge); 628 629 629 630 /*! 631 + * @brief Get the current display brightness. 632 + * 633 + * @param[in] xdev The device. 634 + * @param[out] out_brightness Current display brightness. Usually between 0 and 1. Some devices may 635 + * exceed 1 if the supported range exceeds 100% 636 + */ 637 + xrt_result_t (*get_brightness)(struct xrt_device *xdev, float *out_brightness); 638 + 639 + /*! 640 + * @brief Set the display brightness. 641 + * 642 + * @param[in] xdev The device. 643 + * @param[in] brightness Desired display brightness. Usually between 0 and 1. Some devices may 644 + * allow exceeding 1 if the supported range exceeds 100%, but it will be clamped to 645 + * the supported range. 646 + * @param[in] relative Whether to add \a brightness to the current brightness, instead of overwriting 647 + * the current brightness. 648 + */ 649 + xrt_result_t (*set_brightness)(struct xrt_device *xdev, float brightness, bool relative); 650 + 651 + /*! 630 652 * Enable the feature for this device. 631 653 * 632 654 * @param[in] xdev The device. ··· 924 946 xrt_device_get_battery_status(struct xrt_device *xdev, bool *out_present, bool *out_charging, float *out_charge) 925 947 { 926 948 return xdev->get_battery_status(xdev, out_present, out_charging, out_charge); 949 + } 950 + 951 + /*! 952 + * Helper function for @ref xrt_device::get_brightness. 953 + * 954 + * @copydoc xrt_device::get_brightness 955 + * @public @memberof xrt_device 956 + */ 957 + static inline xrt_result_t 958 + xrt_device_get_brightness(struct xrt_device *xdev, float *out_brightness) 959 + { 960 + return xdev->get_brightness(xdev, out_brightness); 961 + } 962 + 963 + /*! 964 + * Helper function for @ref xrt_device::set_brightness. 965 + * 966 + * @copydoc xrt_device::set_brightness 967 + * @public @memberof xrt_device 968 + */ 969 + static inline xrt_result_t 970 + xrt_device_set_brightness(struct xrt_device *xdev, float brightness, bool relative) 971 + { 972 + return xdev->set_brightness(xdev, brightness, relative); 927 973 } 928 974 929 975 /*!