Room view¶
TL;DR. SteamVR's room view (the dashboard's camera button) shows the room in colour. The driver gives SteamVR a
camera component from the frames it already captures, pico4-roomview hands them to SteamVR's compositor, and the
compositor projects them onto the depth mesh of PICO OS's own see-through pipeline, which pico4-slamd runs,
coloured from the IMX471 RGB camera.
On the Frame¶
SteamVR shows the forward cameras as its room view (the dashboard's camera button). On the Frame,
the HMD driver (driver_cv) implements OpenVR's camera component and Valve's XR service captures
the cameras, computes a depth mesh on the CVP and feeds the compositor (RoomView3D; without a mesh,
a fixed sphere, RoomView2D). The Steam client's VR sign-in does not use the cameras.
steamvr-v4l2cam (a virtual webcam) and steamvr-v4l2loopback stay masked.
The camera component¶
On the PICO 4 driver_monado's HMD provides the camera component
(monado-steamvr-camera.patch) from
the frames the driver already captures in vrserver, so cameras and station keep one owner:
- Cameras. The lower pair looks forward, about 40° down, 11 cm apart: cam3 (left), cam2 (right).
pico4_passthrough.c turns each image upright
(
pico4_tcam_upright, 480×640), with the KB4 fit of the factory model (OpenVR's FTheta) and the camera-to-head transforms turned alike. - Component. NV12, left above right (480×1280,
Stereo|VerticalLayout), 25 Hz, with exposure time and head pose; propertiesHasCamera,HasCameraComponent, FTheta k1–k4, neutral white balance. Settings as the Frame's:camera.enableCamera,roomView2,contentAwareRoomviewMonochromeTint,dashboard.allowPassthroughPortalManageroff. - Why a separate producer. In SteamVR 2.17
vrcompositorstarts a camera only when the shared stateVR_CameraPassthroughStatemarks one enabled, and only the privateIVRCameraPassthroughInternal_001invrclient.sowrites it.vrserverhas no implementation, so the producer is a client process:pico4-roomview(below). - Depth-mesh queues. The room view connects to the block queues
/xrservice/roomview3d/meshDataand/xrservice/roomview3d/meshLayout(IVRBlockQueue_005); only code insidevrservermay create them, so the camera component does, when the HMD activates. WithProp_SupportsRoomViewDepthProjection_Bool(2079) the compositor projects the cameras onto the mesh; with the property and no mesh it draws black, so the HMD reports it only where the image carries PICO OS's pipeline. Without it each eye sees its own camera and close objects double. The values areIVRPaths_001path properties stored in the block header (512 bytes; 16 refuses them withOutOfMemory): - meshData queue: bool
/meshData/meshIsUpToDateturns the mesh on; - meshLayout block: u64
/meshLayout/layoutId, int32vertexCount,indexCount; uint32 triangle indices (the compositor swaps each triangle's last two); - meshData block: u64
/meshData/meshId,layoutId, int32elementCount(three per vertex),rawFromMeshPose(HmdMatrix34), doubleposePredictionBaseTime; float x, y, z vertices.
A geometric stand-in (a sphere around the head) is worse than none when worn: the mesh has to be
the measured room.
- PICO OS's see-through. pxrseethroughservice feeds libphotoid.so each grey forward pair with
the tracker's pose and map points. Its pipeline (vst_releaseA) computes depth with a neural
network (FLNet_lite_v2, SNPE on the Compute DSP); it sets up a CVP depth-from-stereo session
but never runs it. It fills gaps from the map points and builds a hemisphere mesh around the head
that ends at the ground, which libSlam reports with ground detection on
(setAlgorithmParameters("plane", "1")). The guardian service colours it from the RGB camera.
- The same mesh here. pico4-slamd runs libphotoid in the tracker's root
(vst.c): cam3 and cam2 after each scene set, libSlam's pose nearest the
set's time and its map points. The stand-ins (stubs.c) answer the CVP
session, so neither /dev/cvp nor CVP firmware is needed (a call of cvpDfs_Sync would fail
loudly). SNPE's DSP module lies in /system/lib64, the path SNPE gives the DSP. Meshes go into the
feed's two mesh slots (pico4_slam_feed.h).
- Axes trap. libphotoid takes the head and map points, and returns the mesh, in libSlam's
world turned a quarter turn about z, (−y, x, z); pico4-slamd turns both inputs (fed unchanged,
a head turned 39° right put the hemisphere 39° below the horizon). The mesh's floor lies along −y;
triangles face the head.
- Publishing. While the room view asks for frames, driver_monado asks the driver for each new
mesh; pico4-slamd feeds the pipeline only within a second of the driver's stamp, so it idles
otherwise. Vertices come in the head pose's world (with a saved room's turn and shift) with their
place in SteamVR's raw space.
monado-steamvr-roomview-mesh.patch
publishes each mesh once, as the Frame's XR service does: the layout block when it changes, the data
block (posePredictionBaseTime = mid-exposure on CLOCK_MONOTONIC_RAW), then meshIsUpToDate;
both queues use 512-byte headers, 4 data and 2 layout blocks. IVRServerInternal slots 41 (plane
anchors) and 42 (tracking world jumps) are not needed.
The producer¶
The producer pico4-roomview is a user unit that runs with SteamVR
(pico4-roomview.service):
cameras ─▶ driver_monado (vrserver) ─▶ /dev/shm/pico4-roomview ─▶ pico4-roomview ─▶ vrcompositor
converted frame, the (pico4_roomview.h) dma-bufs and room view
head pose at exposure per-frame metadata
- Shared memory. pico4_roomview.h (version 2): camera size, KB4 intrinsics, camera-to-head transforms, a ring of four frames, format (two grey cameras or one NV12 image). The driver fills it only while the producer's heartbeat says the compositor wants frames, with the head pose at mid-exposure in the space it reports to SteamVR (tracking origin included) and without prediction (with it the room trailed the head's turns).
- Client.
VR_Initas a background application, thenIVRCompositor_029(only asking for a compositor interface opensvrclient's connection that the frame import uses), the passthrough interface,SetGraphicsDevicewith its own Vulkan device on Turnip (external semaphore extensions enabled:vrclientimports an OPAQUE_FD timeline semaphore), andSetupCameraFrameswith three linear images per camera exported as dma-bufs. - Each frame. The newest ring frame into a free image, then its metadata and
PublishFrame. The metadata the shaders read: exposure time onCLOCK_MONOTONIC_RAW(a time after the compositor's now shows nothing), fx, fy, cx, cy, k1–k4, the camera pose in raw tracking space at the exposure (+0x30), the camera in the head frame (+0x60, the compositor picks the camera nearest each eye), a head-frame calibration (+0x90, identity) and the valid rectangle (0, 0, 1, 1; zero samples one texel). Camera poses use computer-vision axes (x right, y down, +z forward): with OpenVR's camera axes every point leaves the image. The compositor reprojects with inverse(+0x30) × the point in raw space; putting the head at +0x90 instead warped the view on every head motion. - Restarts. A new compositor process gets the frames set up again; without
vrserverthe producer exits and the unit starts again with SteamVR.
Colour¶
Colour is the default (PICO4_ROOMVIEW_RGB=0 keeps the grey pair). As on PICO OS, the grey pair
builds the mesh and the IMX471 colours it:
- The IMX471 streams as capture slot 4 through
pico4-imx471(kernel.md): 2328×1748 RAW10 RGGB (2×2 binned), free-running at 50 fps on four lanes of CSIPHY 1 (2064.8 Mbit/s), CSID 4 and the third IFE-lite. Exposure and gain are V4L2 controls. - A driver thread pinned to the A77 cores 4–6 converts each frame (9 ms): 2×2 cells to 1164×874, black level 64, grey-world white balance, sRGB, full-range BT.601 NV12. Auto exposure aims at 18% grey: 1/100 s (flicker-free), then gain up to 16×, then up to 20 ms.
- The sensor streams only while the room view shows it: 5 s after it closes the driver pauses it
(
pico4-imx471's paused control). - The lens is PICO's omni model with "fisheye62" distortion; pico4_tcam.c
projects it and fits KB4 for the metadata, over the rays up to 70° off axis only: the view's edge lies at
about 55–60°, and fitted out to the image's corners (80–90°, which the headset never shows) the fit's error
swung by up to 2 px inside the view and the room wobbled toward the edges. Up to 70° it grows smoothly to
about 1 px at the edge; the room view logs it at its start (
lens fit up to 70 degrees: rms …, max …). pico4-roomviewpublishes the NV12 frame (one linear dma-buf) to both camera slots.--test-patternshows colour bars.
Verified results¶
On the headset on Valve's kernel.
| Check | Result |
|---|---|
| Room view in Valve's session, still headset | 25 frames per second per camera published, none skipped; the stock tracker within 1.3 mm over 60 s (1.1 mm without) |
| Room view worn, colour on the depth mesh | 25 frames per second, shown about 40–80 ms after mid-exposure; turning and nodding show the room fixed in place without warp or visible lag; still, the tracker within 0.5 mm and 0.10° over 60 s; pico4-slamd 104% of a core (54% without) |
| Depth mesh, headset on a desk | 14,841 vertices and 29,400 triangles per pair (25 Hz), 0.9–5 m from the head; ready 72 ms after mid-exposure; floor at −0.75 m (libSlam 0.79 m) |
| Room view reprojection, frame dumps | head rotation compensated equally in pitch and yaw (4.6–4.7 px per degree); with the mesh a 10 cm move follows at 1.6–2.7 m depth (without: as if 10–25 m away) |
| RGB camera | 50.01 fps; 47 of 50 frames per second reach the ring, 30.5 ms (median) after mid-exposure; conversion 44% of a core |