Skip to content

Android: weave window origin is hardcoded (0,0), so the interlace phase is off by the status-bar inset in landscape #173

Description

@dfattal

Symptom

On the tablet (NP02J, 2560×1600 landscape) inline-3D weaves but the 3D is soft / phase-shifted — reported as "some phase offset, 3D not super clear". Fullscreen looks right; windowed (status bar visible) does not.

Root cause

patches/0089-feat-android-GPU-side-AHardwareBuffer-extraction-the.patch:337

SetWindowGeometryAndroid(/*origin_x=*/0, /*origin_y=*/0,

The origin is a hardcoded literal, while client_width/height come from the real surface. So we report an inconsistent rect: the window's origin with the surface's size.

Measured on device, windowed:

window screen rect 0,0 2560x1540 display 0        <- what we report
weave full-target screen-pos 0,0 target 2560x1540 <- phase anchored at y=0
InsetsSource ITYPE_STATUS_BAR frame=[0,0][2560,60] <- surface actually starts at y=60
Frames: frame=[0,0][2560,1600]                     <- window is edge-to-edge

The woven surface occupies rows 60..1600, but the interlace phase is referenced to row 0. The lenticular phase is absolute-screen, so a 60-row error puts every column on the wrong lens phase → crosstalk / mushy depth. Going fullscreen changes the report to 0,0 2560x1600, where origin 0 is the truth, and the error vanishes:

window screen rect 0,0 2560x1600 display 0        <- fullscreen, correct by luck

Why the phone never showed it

LPD-20W is portrait-natural. Its browser surface is 1080x2301 on a 2400-tall panel (99-row inset), and the Leia plug-in's portrait branch (leia-plugin #196 / browser #165) converts to CNSDK's bottom-origin as panel_h - surface_h - win_y = 2400 - 2301 - 0 = 99 — numerically the correct anchor, by accident, because win_y was wrongly 0 and the flip re-derived the inset. In landscape (w > h) that branch is skipped, so the hardcoded 0 is exposed raw. Two bugs cancelling in one orientation is why this shipped looking fine.

Fix

Report the true on-screen origin of the woven surface instead of the literal: the window frame origin plus the top inset actually applied to the content (view.getLocationOnScreen() on the surface view, or window origin + WindowInsets top). With a correct win_y the plug-in's existing math is consistent in both orientations — portrait then computes 2400 - 2301 - 99 = 0, which is the right bottom-origin value.

Worth doing together with a check of the plug-in side: with a truthful origin, confirm the landscape path still needs no flip (leia-plugin leia_cnsdk.cpp, the if (h > w) guard) rather than assuming it — the "landscape verified on device" note behind that guard was only ever exercised at fullscreen, where the offset is 0.

Workaround until fixed

Fullscreen the page (the hello-cube sample toggles fullscreen on tap) — the origin is then genuinely (0,0).

Environment: tablet NP02J Android 13, runtime v2.14.9, plug-in v2.6.4, browser preview-0.1.17 (the last Android APK published — later previews are Windows-only, tracked separately).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions