mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-02-03 12:28:07 +00:00
aux/util: Make new u_extents_2d as alternative to u_device_simple_info
This commit is contained in:
parent
e554f9ee02
commit
01bfed1694
src/xrt/auxiliary/util
|
@ -5,6 +5,7 @@
|
|||
* @brief Misc helpers for device drivers.
|
||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||
* @author Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||
* @author Moses Turner <moses@collabora.com>
|
||||
* @ingroup aux_util
|
||||
*/
|
||||
|
||||
|
@ -131,6 +132,35 @@ u_device_dump_config(struct xrt_device *xdev, const char *prefix, const char *pr
|
|||
*
|
||||
*/
|
||||
|
||||
bool
|
||||
u_extents_2d_split_side_by_side(struct xrt_device *xdev, const struct u_extents_2d *extents)
|
||||
{
|
||||
uint32_t eye_w_pixels = extents->w_pixels / 2;
|
||||
uint32_t eye_h_pixels = extents->h_pixels;
|
||||
|
||||
xdev->hmd->screens[0].w_pixels = extents->w_pixels;
|
||||
xdev->hmd->screens[0].h_pixels = extents->h_pixels;
|
||||
|
||||
// Left
|
||||
xdev->hmd->views[0].display.w_pixels = eye_w_pixels;
|
||||
xdev->hmd->views[0].display.h_pixels = eye_h_pixels;
|
||||
xdev->hmd->views[0].viewport.x_pixels = 0;
|
||||
xdev->hmd->views[0].viewport.y_pixels = 0;
|
||||
xdev->hmd->views[0].viewport.w_pixels = eye_w_pixels;
|
||||
xdev->hmd->views[0].viewport.h_pixels = eye_h_pixels;
|
||||
xdev->hmd->views[0].rot = u_device_rotation_ident;
|
||||
|
||||
// Right
|
||||
xdev->hmd->views[1].display.w_pixels = eye_w_pixels;
|
||||
xdev->hmd->views[1].display.h_pixels = eye_h_pixels;
|
||||
xdev->hmd->views[1].viewport.x_pixels = eye_w_pixels;
|
||||
xdev->hmd->views[1].viewport.y_pixels = 0;
|
||||
xdev->hmd->views[1].viewport.w_pixels = eye_w_pixels;
|
||||
xdev->hmd->views[1].viewport.h_pixels = eye_h_pixels;
|
||||
xdev->hmd->views[1].rot = u_device_rotation_ident;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
u_device_setup_split_side_by_side(struct xrt_device *xdev, const struct u_device_simple_info *info)
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* @brief Misc helpers for device drivers.
|
||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||
* @author Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||
* @author Moses Turner <moses@collabora.com>
|
||||
* @ingroup aux_util
|
||||
*/
|
||||
|
||||
|
@ -33,6 +34,22 @@ enum u_device_alloc_flags
|
|||
// clang-format on
|
||||
};
|
||||
|
||||
/*!
|
||||
*
|
||||
* Info to describe 2D extents of a device's screen
|
||||
*
|
||||
*/
|
||||
struct u_extents_2d
|
||||
{
|
||||
uint32_t w_pixels; // Width of entire screen in pixels
|
||||
uint32_t h_pixels; // Height of entire screen
|
||||
};
|
||||
|
||||
/*!
|
||||
*
|
||||
* Info to describe a very simple headset with diffractive lens optics.
|
||||
*
|
||||
*/
|
||||
struct u_device_simple_info
|
||||
{
|
||||
struct
|
||||
|
@ -61,6 +78,17 @@ struct u_device_simple_info
|
|||
bool
|
||||
u_device_setup_split_side_by_side(struct xrt_device *xdev, const struct u_device_simple_info *info);
|
||||
|
||||
/*!
|
||||
* Just setup the device's display's 2D extents.
|
||||
* Good for headsets without traditional VR optics.
|
||||
*
|
||||
* @return true on success.
|
||||
* @ingroup aux_util
|
||||
*/
|
||||
bool
|
||||
u_extents_2d_split_side_by_side(struct xrt_device *xdev, const struct u_extents_2d *extents);
|
||||
|
||||
|
||||
/*!
|
||||
* Dump the device config to stderr.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue