feat: Cardboard VR mode with ARM64 SteamVR (#704)

* feat: add Cardboard mode with side-by-side lens-distorted eyes and 3DoF head tracking

* fix: derive the Cardboard field of view from the panel and recentre fully when far from upright

* feat: share the Cardboard head pose with the guest and add a SteamVR driver for it

* feat: run SteamVR's compositor on Turnip/KGSL with a display-extension layer and a driver-direct HMD

* feat: show SteamVR frames in Cardboard mode through a driver-side presenter and a fake direct-mode display

* feat: install and start SteamVR for Cardboard mode from the session drawer

* docs: describe Cardboard mode and the SteamVR path

* feat: drive SteamVR hands from the game pad and keep the Cardboard headset out of standby

* docs: record where the SteamVR dashboard stops

* fix: map Cardboard head tracking to the screen's axes and keep turns about the real vertical as yaw

* fix: give Cardboard its previous picture back when SteamVR stops

* fix: report sem_otime from emulated SysV semaphores so SteamVR's web helper can start

* fix: bridge SteamVR's shared semaphores across processes and keep Steam alive while SteamVR runs

* feat: present SteamVR straight to DroidDeck's compositor at panel resolution

* docs: update Cardboard VR notes for the dashboard, semaphore bridge and direct presenter

* fix: keep Wine and FEX signal handlers in the VR layer; add semaphore tracing

* fix: clear a stale SteamVR active marker on status

* fix: clear only an old SteamVR active marker

* fix: unblock SteamVR clients on Turnip and keep Steam's web helper alive across SteamVR runs

* fix: judge shared waits before a submit's own signals and on Vulkan 1.0 devices

* docs: record VR games, SteamVR Home and OpenXR results on the Thor

* docs: add Cardboard VR learnings from the Thor bring-up

* docs: add Cardboard VR screenshots from the Thor

* fix: keep the VR layer's display stand-in to SteamVR runs and clear a leftover marker at session start

* fix: report SteamVR start and stop failures from the helper's exit code
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-13 14:36:56 +00:00
1 parent 92d038b428
commit f4b0ab6867
57 files changed
+17799 -15

No files matched your search

+15 -3
View File
@@ -43,8 +43,14 @@ struct sem_header {
uint32_t key;
uint32_t mode;
int32_t creator_pid;
int32_t pad[11];
/* What IPC_STAT reports as sem_otime / sem_ctime (seconds). The usual race-free init has the
* creator semop the new set once, and every other process wait until sem_otime is non-zero;
* SteamVR's web helper spins on exactly that. */
_Atomic uint32_t otime;
_Atomic uint32_t ctime;
int32_t pad[9];
};
_Static_assert(sizeof(struct sem_header) == 64, "semaphore files written by older sessions keep their layout");
/* The counters follow the header, one 32-bit word each (a futex word). */
struct sem_map { int id; struct sem_header *hdr; size_t len; };
@@ -176,7 +182,8 @@ int semget(key_t key, int nsems, int semflg) {
size_t len = sizeof(struct sem_header) + (size_t)nsems * sizeof(int32_t);
if (ftruncate(fd, (off_t)len) != 0) { close(fd); return -1; }
struct sem_header h = {.magic = SEM_MAGIC, .nsems = (uint32_t)nsems, .key = (uint32_t)key,
.mode = (uint32_t)(semflg & 0777), .creator_pid = (int32_t)getpid()};
.mode = (uint32_t)(semflg & 0777), .creator_pid = (int32_t)getpid(),
.ctime = (uint32_t)time(NULL)};
if (pwrite(fd, &h, sizeof(h), 0) != (ssize_t)sizeof(h)) { close(fd); return -1; }
} else {
struct sem_header h;
@@ -222,6 +229,7 @@ int semtimedop(int semid, struct sembuf *sops, size_t nsops, const struct timesp
}
if (sops[i].sem_op < 0) futex(w, FUTEX_WAKE, INT_MAX, NULL); /* zero-waiters see the change */
}
atomic_store(&h->otime, (uint32_t)time(NULL));
return 0;
}
@@ -256,6 +264,7 @@ int semctl(int semid, int semnum, int cmd, ...) {
if (semnum < 0 || (uint32_t)semnum >= h->nsems) { errno = EINVAL; return -1; }
atomic_store(&words[semnum], (int32_t)(intptr_t)arg.buf);
futex(&words[semnum], FUTEX_WAKE, INT_MAX, NULL);
atomic_store(&h->ctime, (uint32_t)time(NULL));
return 0;
case GETALL:
for (uint32_t i = 0; i < h->nsems; i++) arg.array[i] = (unsigned short)atomic_load(&words[i]);
@@ -265,6 +274,7 @@ int semctl(int semid, int semnum, int cmd, ...) {
atomic_store(&words[i], arg.array[i]);
futex(&words[i], FUTEX_WAKE, INT_MAX, NULL);
}
atomic_store(&h->ctime, (uint32_t)time(NULL));
return 0;
case GETPID: return h->creator_pid;
case GETNCNT: case GETZCNT: return 0;
@@ -275,8 +285,10 @@ int semctl(int semid, int semnum, int cmd, ...) {
arg.buf->sem_perm.gid = arg.buf->sem_perm.cgid = getgid();
arg.buf->sem_perm.mode = (unsigned short)h->mode;
arg.buf->sem_nsems = h->nsems;
arg.buf->sem_otime = (time_t)atomic_load(&h->otime);
arg.buf->sem_ctime = (time_t)atomic_load(&h->ctime);
return 0;
case IPC_SET: return 0;
case IPC_SET: atomic_store(&h->ctime, (uint32_t)time(NULL)); return 0;
default: errno = EINVAL; return -1;
}
}
+4 -2
View File
@@ -47,9 +47,11 @@ static int is_status_path(const char *path) {
}
/* Chromium stands its hang watchdogs down when it sees a tracer, and the client's web helper does
* not come up within their patience here: it is left reading the truth. */
* not come up within their patience here: it is left reading the truth. SteamVR's web helper (the
* dashboard, Cardboard mode's SteamVR) is the same Chromium and stalls the same way. */
static int is_web_helper(void) {
return strcmp(program_invocation_short_name, "steamwebhelper") == 0;
return strcmp(program_invocation_short_name, "steamwebhelper") == 0 ||
strcmp(program_invocation_short_name, "vrwebhelper") == 0;
}
static int write_all(int fd, const char *data, size_t len) {