Skip to content

sokol: fix Wayland pipe descriptor ABI - #28751

Draft
medvednikov wants to merge 2 commits into
masterfrom
fix/wayland-pipe-abi-20260918
Draft

medvednikov wants to merge 2 commits into
masterfrom
fix/wayland-pipe-abi-20260918

Conversation

@medvednikov

@medvednikov medvednikov commented Sep 18, 2026

Copy link
Copy Markdown
Member

Summary

Fix Graphics CI's conflicting Wayland C.pipe declarations and the corresponding descriptor-storage bug in Sokol's drag-and-drop receiver.

This PR was already open when the prepared follow-up was published. Commit bfda53b2fb168f515a34d0499f4452be97bb60c3 extends the original 5ccb7b89 without rewriting history or creating a duplicate fix PR. The original cross-module ABI regression and its workflow step are retained unchanged.

The original PR is based on 2217aba7. Before publication, the affected master files were rechecked at ec858c8b1cc19e62c510b18a0a44b7ce6de20cca; their complete blob hashes still match the prepared baselines. This is a fast-forward follow-up on the existing PR, not a rebase of its history.

Fix

The completed Graphics CI job bootstrapped V and passed the legacy gg isolation check, then failed to compile draw_rect_empty_test.v and frame_pacing_test.v with -d gg_multiwindow -d sokol_wayland. Sokol declared C.pipe(fds &int), while x.multiwindow declared C.pipe(fds &i32).

  • Use fn C.pipe(fds &i32) i32 in both modules, matching builtin's declaration.
  • Create the pipe in a private wl_create_drop_pipe() ![2]i32 helper, using two C-width descriptor slots rather than two platform-width V integers. The drag-and-drop callback uses that same helper.
  • Preserve failure cleanup, data-offer transfer, close order, flushing, the read loop, and URI parsing. No public API is added.

Changing only the declaration would leave the underlying output buffer wrong. The helper makes the actual production descriptor-creation code testable without a compositor.

V regression coverage

Retained verbatim: vlib/gg/wayland_pipe_abi_test.c.v imports sokol.sapp and x.multiwindow together without redeclaring C.pipe. It checks canaries, native descriptor access modes, binary transfer including NUL/high-bit bytes, EOF, and cleanup. Its existing strict, bounded Graphics CI invocation is unchanged.

Added: three tests in vlib/sokol/sapp/sapp_wayland_pipe_linux_test.v call the production helper and check:

  1. Two simultaneously live, independent pipe pairs with isolated byte transfers.
  2. Complete URI-list transfer followed by EOF after write-end closure.
  3. Thirty-two repeated empty-pipe creation, closure, and EOF cases.

These tests require Linux with sokol_wayland enabled but do not open a display. One bounded -new-compiler invocation is added to the existing Multiwindow Linux checks block. All prior workflow commands, settings, flags, and tests remain intact. There is no new Python file, workflow job, retry, ignored failure, or test exclusion.

This is not a live Wayland drag-and-drop/compositor test.

Validation

V compilation, v fmt, the V regressions, and Graphics CI have not been executed locally. There is no local V executable; a fresh direct GitHub read still fails at DNS resolution. This PR remains draft pending V-level validation. The V test cases listed above are defined coverage, not locally passed V tests.

Rerun for publication:

  • Standalone native C probes under both GCC and Clang with -std=c11 -O2 -Wall -Wextra -Werror -fsanitize=address,undefined.
  • Both reproduce the old output-buffer error: native descriptors [3, 4] are interpreted as [17179869187, 0] in two zeroed 64-bit slots on this host. The probe closes the real descriptors, never the intentionally misinterpreted ones.
  • Corrected storage passes independent-pair transfer, URI transfer, EOF, 100 repeated empty-pipe cycles, guard-byte preservation, and before/after descriptor counts under both compilers.
  • Both compilers reject an incompatible 64-bit-pointer declaration of pipe against the system header and accept the corrected 32-bit-pointer declaration.
  • These native checks are not V-generated C or executions of the V implementation.
  • The supplied patch is byte-for-byte identical to the prepared bundle. All baseline source-window hashes and the new V test hash match the manifest.
  • Source-window patch application, reversal, reapplication, and git diff --cached --check pass. These local checks are not a complete checkout validation.
  • Parsed YAML and shell syntax checks pass. The existing PR workflow baseline matches blob 9fffedcf3c82429e5401149f49c3729b6bf7025f; removing only the new helper-test invocation restores that entire workflow byte-for-byte.
  • The combined uploaded workflow matches local blob 4807028964d285b90b1a455494c9e53aa6ebc6d0.
  • Complete source files were assembled in isolated [internal assembly] Apply Wayland pipe helper patch to complete source #28759, which did not target master. Its full-source diff matches the prepared production changes exactly, with no truncation or unrelated edits. The follow-up commit is parented directly to the existing PR head; no synthetic ancestor, helper workflow, or CI-skip marker enters this review branch.

Files in the PR

  • vlib/sokol/sapp/sapp_linux.c.v
  • vlib/sokol/sapp/sapp_wayland_linux.v
  • vlib/sokol/sapp/sapp_wayland_pipe_linux_test.v
  • vlib/x/multiwindow/wayland_backend.c.v
  • vlib/gg/wayland_pipe_abi_test.c.v — retained from the original commit, unchanged by the follow-up.
  • .github/workflows/gg_regressions_ci.yml

This targets the confirmed Graphics CI declaration blocker and descriptor-storage defect. It does not claim that all subsequent graphics checks pass or resolve the separate MSVC, archived pkg-config-test, or reporter failures.

medvednikov added a commit that referenced this pull request Sep 18, 2026
Internal assembly on automation/wayland-pipe-base-4a2b695e only. Master and the review branch are unchanged. The full source diff is verified before making a clean follow-up on #28751.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant