# Cobalt boot: second session (17/11/2026) Test title: YTVCB0001 (diagnostic only, NOT a functional app). Runner: `tools/test_cobalt_boot_vita3k.ps1 [-Seconds N] [-TitleId T -Vpk V]` (syncs every changed VPK file into the installed title, captures cobalt_boot.log, starboard15.log and vita3k.log to `tools/capture/cobalt-boot-/`, reports SELF_EXIT/EXIT_CODE, and never touches other Vita3K instances). ## Root causes found and fixed (in order) | # | Symptom | Cause | Fix | |---|---|---|---| | 1 | Start hung after `eglCreateContext` | `SbEglInterface.eglCreatePbufferSurface` (and 21 other slots) were **null**; Cobalt's GraphicsContextEGL calls it right after creating the context, so it jumped to 0 | `port_graphics.cpp`: real EGL 1.4 layer over VitaGL: pbuffer registry, per-thread current context (EGL_BAD_ACCESS across threads), per-thread errors, every slot filled (real call or proper EGL error) | | 2 | GXM was never initialized | VitaGL's `eglInitialize` is a facade; `vglInit` was never called | `eglInitialize` brings up VitaGL once (RAM pool capped at 48 MiB) | | 3 | Rasterizer spun on null+0x64 | Skia rejected the GL interface: `glInsertEventMarkerEXT` missing although VitaGL advertises GL_EXT_debug_marker; GLES2 core funcs missing (glBlendColor, glGetShaderPrecisionFormat, ...) | Our `eglGetProcAddress` serves marker + EGL overrides; GLES2 core slots implemented (shader precision = SGX fp32; renderbuffer/texture parameter queries tracked) | | 4 | abort() during font init | Evergreen CRX ships an **empty** fonts.xml; platform must give system fonts | `tools/stage_vita_system_fonts.py` stages Cobalt's official 'limited' package (65 files, 2.9 MiB) to `system_fonts/`; `SbSystemGetPath(FontDirectory/FontConfigurationDirectory)` = `app0:/system_fonts` | | 5 | glLinkProgram hung, then Vita3K crashed | VitaGL's GLSL preprocessor hangs on Cobalt's `#pragma array` (a build-time directive of generate_shader_impl.py) | `glShaderSource` bridge drops pragmas GLSL ES requires drivers to ignore (keeps `#pragma STDGL`). Reproduced/validated in graphics test | | 6 | V8 fatal "ignored" | `SbMemoryMap(flags=0)` (kSbMemoryMapProtectReserved) rejected, and partial `SbMemoryUnmap` (musl alignment trim) rejected | Reserve = memblock + PROT_NONE; page-granular unmap with bitmap; map table 64 → 1024 | | 7 | Memory budget | Evergreen's malloc is musl over SbMemoryMap, not newlib | newlib heap 8 → 64 MiB (uses ~3-4 MiB), main stack 4 MiB, default thread stack 1 MiB; ~105 MiB left for Cobalt maps | | 8 | TLS rejected every server (no CA lookup) | `SbDirectoryGetNext` required a buffer of 256 but Cobalt passes kSbFileMaxName = 255, so `ssl/certs` listed as empty | accept >= kSbFileMaxName | ## Proven in Vita3K (build 4242) - `SbEventHandle(Start)` **returns** (COBALT_EVENT_START_RETURN); event pump runs. - 74/74 constructors, EGL context made current on main and rasterizer threads, Cobalt's 8 GL programs compile and link (shaders genuinely run through VitaGL/SceShaccCg). - Cobalt resolves `www.youtube.com`, completes the TLS handshake with its own trust store (140 CA files opened) and exchanges HTTP/2 traffic (~20 KB received). - Graphics test 31/31, Starboard regression 179 (+1 new test pending a run), 0 failures in the last complete run. ## Not achieved yet - **No frame presented yet** (eglSwapBuffers never called); no YouTube UI. - New blocker: after the YouTube response arrives, V8 hits a fatal CHECK (official build, message stripped) on thread 691; heuristic backtrace starts at ELF 0x1c07d7c → 0x15d7b44 (V8_Fatal) → 0x1c065b8 → 0x1be5d3c → 0x1302714. Memory is fine (105 MiB free, no map failures). Next: identify that V8 check. - SbPlayer still unavailable. ## Diagnostics left in the code - `YTV_GL_TRACE` CMake option (OFF by default; the current build dir was configured ON). - `ux0:data/youtubevita/cobalt_args.txt`: extra Cobalt switches (e.g. `--url=`). - `ux0:data/youtubevita/diag_hide_neon.txt`: hides NEON (diagnostic; ruled out as TLS cause). - Heartbeat, VM, net, socket-waiter, SSL-file and backtrace logs. ## Update (same day, later): first frames and the YouTube device gate Fixed: - **GLES2 pixel store**: VitaGL's glPixelStorei only accepts GL_UNPACK_ROW_LENGTH; GL_UNPACK/PACK_ALIGNMENT raised GL_INVALID_ENUM and Cobalt's GL_CALL aborted (it was a rasterizer CHECK, not V8). Bridge now keeps alignment/row-length state and repacks uploads/readbacks. - **GL_DITHER** (glEnable/glDisable/glIsEnabled), **GL_IMPLEMENTATION_COLOR_READ_FORMAT/TYPE** (RGBA/UNSIGNED_BYTE) and **GL_NUM_PROGRAM_BINARY_FORMATS** (0: VitaGL never names its format) answered by the bridge. - With a diagnostic wrapper that checks glGetError after every GLES call (YTV_GL_TRACE): **0 GL errors** in a full Cobalt run. - Graphics test 33/33 (pixel-store coverage added). Probe pump duration configurable via `ux0:data/youtubevita/pump_seconds.txt`. Observed: - Cobalt presents frames (eglSwapBuffers from the browser). GL trace of frame 1/2: clear with 0.157,0.157,0.157 (= page background #282828), splash images 426x96 and 540x540, glyph atlas 2048x2048 + text draws — i.e. the guest renders the real page. - The Vita3K window nevertheless shows plain white (OpenGL backend). Guest-side readback of display buffers returns zeros in Vita3K, so it cannot be used as evidence. Vulkan could not be selected (`--backend-renderer Vulkan` and the yml key were not applied by build 4242 in these runs). Pending: the Vita3K presentation fix the user applied for Darkest Dungeon; validation on real hardware. - **YouTube device gate**: www.youtube.com/tv answers this honest device identity (Sony / PlayStation Vita / GAME_CONSOLE) with the page "O YouTube não está disponível neste dispositivo" (QR to yt.be/tv-devices); the TV app bundle is never requested. Reproduced from the PC with a Cobalt 25/Starboard 15 style User-Agent. Getting the real TV app would require presenting as a certified device; NOT done (user decision, service terms). Tools: `tools/capture_vita3k_window.ps1` (PrintWindow of the test title's window), runner options `-Config`, `-Backend`. ## Update: official YouTube TV UI rendered in Vita3K - **Capture**: Windows screen capture of Vita3K's OpenGL window shows white. `tools/opengl_capture` (from Black Reliquary Vita; SwapBuffers hook + glReadPixels, injected only into the test's own Vita3K) shows the real framebuffer. Runner: `-CaptureFrames -CaptureIntervalMs N -CaptureMax N`; `tools/opengl_capture/bmp_to_png.py`. - **Device identity** (owner decision): `YTV_DEVICE_IDENTITY_PS4=1` → model "PlayStation 4", year 2013, firmware 12.00 (friendly name stays PlayStation Vita; no certification scope/keys). /tv then serves "YouTube na TV" (TVHTML5) instead of "not available on this device". - Result: Cobalt loads the TV app, fetches i.ytimg.com thumbnails, googlevideo.com, and renders the onboarding screen ("Watch the latest videos, just for you" / Get started). GIF: `tools/capture/cobalt-boot-20261117-111921/youtube_vita_boot_vita3k.gif`. - **VitaGL splash removed**: `third_party/vitagl-nosplash` = VitaGL ed51b21 (same as the VitaSDK image) built with NO_SPLASHSCREEN=1; CMake option `YTV_VITAGL_NOSPLASH` (ON). Graphics test 33/33 with it. - Next: controller input → SbEvent input events (pad_adapter exists but is not pumped yet); SbPlayer for video. ## Update: controller input and navigation - `port_input.cpp`: SceCtrl polled on the main thread each loop iteration, translated by pad_adapter (Starboard gamepad keys), dispatched as kSbEventTypeInput. SbInputData layout verified (76 bytes, key@16, wchar_t 4 bytes; SbEvent 24). - Diagnostic automation: `ux0:data/youtubevita/input_script.txt` ("