feat(libcairo): implement nineteen image and surface exports #14327

Merged
hyvvs merged 10 commits from upstream-pr/14327 into main 2026-11-05 08:46:27 +00:00
hyvvs commented 2026-11-01 09:23:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hyvvs on 2026-11-01T09:23:50Z.


What

Implement 19 previously throwing libcairo exports with typed guest SysV declarations and real in-process image storage, including:

  • Image surfaces (7): create/create_for_data, data, format, width, height, stride.
  • General surfaces (11): create_similar, create_for_rectangle, reference/destroy, status, type, content, device scale, flush and mark_dirty_rectangle.
  • cairo_format_stride_for_width (1): format-specific aligned stride and overflow handling.

Image surfaces have Cairo-compatible formats, dimensions, zero-initialized owned data, borrowed caller-owned pixel buffers, surface lifetime/reference tracking, error statuses, and sub-surface references. The CPU memory backend has no deferred device cache; flush/mark_dirty are synchronous no-ops in that specific backend, not substitutes for unimplemented drawing operations.

Measured: upstream base 26fa1212b8 8,981 / 34,237 -> branch 9,000 / 34,237 (+19 genuine implemented exports; libcairo 0/161 -> 19/161). This PR is independent of matrix PR #14258. No overlap found with other open Cairo implementation PRs during development.

Coordinated landing order: #14258 (matrix) -> #14327 (image surfaces) -> #14328 (font options) -> #14329 (regions). Symbol implementations are disjoint but the PRs share Cairo export inventory, CMake, and technical-debt files. Each later PR will integrate earlier merged changes before landing; standalone branches are not yet a single integrated Cairo build.

Tested

  • Windows 64-bit MinGW C++20 guest-SysV linked source/test executable: passed.
  • Ubuntu WSL GCC C++20 with -fsanitize=address,undefined, leak checks, -Wall -Wextra -Werror: passed.
  • Differential API probes against installed native Cairo 1.18 for image formats/strides, error codes, sub-surface metadata, device scale, invalid sizes and data borrowing.
  • python tools/tests/test_progress.py: 57 passed.
  • python core/libs/tests/test_public_headers.py --audit-only: passed.
  • python tools/check_conventions.py --base upstream/main: passed.
  • git diff --cached --check: passed.
  • Not tested on PS5 hardware. Full integrated CMake build/CTest not run in this fresh worktree (third-party submodules not initialized); linked Windows and Linux test executables were run separately. This is an image/metadata backend, not the full Cairo rasterizer; path/text/drawing exports remain throwing.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (no third-party code added)
  • Generic behaviour, not specific to one title
  • Depends on: #14258 (merge-order coordination only; implemented export families are disjoint)
  • Fixes: none
  • Unblocks: none identified
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5106074335 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14327). Originally posted by [hyvvs](https://github.com/hyvvs) on 2026-11-01T09:23:50Z. --- ### What Implement 19 previously throwing **libcairo** exports with typed guest SysV declarations and real in-process image storage, including: - Image surfaces (7): create/create_for_data, data, format, width, height, stride. - General surfaces (11): create_similar, create_for_rectangle, reference/destroy, status, type, content, device scale, flush and mark_dirty_rectangle. - cairo_format_stride_for_width (1): format-specific aligned stride and overflow handling. Image surfaces have Cairo-compatible formats, dimensions, zero-initialized owned data, borrowed caller-owned pixel buffers, surface lifetime/reference tracking, error statuses, and sub-surface references. The CPU memory backend has no deferred device cache; flush/mark_dirty are synchronous no-ops in that specific backend, not substitutes for unimplemented drawing operations. **Measured:** upstream base `26fa1212b8` 8,981 / 34,237 -> branch 9,000 / 34,237 (**+19** genuine implemented exports; libcairo 0/161 -> 19/161). This PR is independent of matrix PR #14258. No overlap found with other open Cairo implementation PRs during development. **Coordinated landing order:** #14258 (matrix) -> #14327 (image surfaces) -> #14328 (font options) -> #14329 (regions). Symbol implementations are disjoint but the PRs share Cairo export inventory, CMake, and technical-debt files. Each later PR will integrate earlier merged changes before landing; standalone branches are not yet a single integrated Cairo build. ### Tested - Windows 64-bit MinGW C++20 guest-SysV linked source/test executable: **passed**. - Ubuntu WSL GCC C++20 with `-fsanitize=address,undefined`, leak checks, `-Wall -Wextra -Werror`: **passed**. - Differential API probes against installed native Cairo 1.18 for image formats/strides, error codes, sub-surface metadata, device scale, invalid sizes and data borrowing. - `python tools/tests/test_progress.py`: **57 passed**. - `python core/libs/tests/test_public_headers.py --audit-only`: **passed**. - `python tools/check_conventions.py --base upstream/main`: **passed**. - `git diff --cached --check`: **passed**. - Not tested on PS5 hardware. Full integrated CMake build/CTest not run in this fresh worktree (third-party submodules not initialized); linked Windows and Linux test executables were run separately. This is an image/metadata backend, **not** the full Cairo rasterizer; path/text/drawing exports remain throwing. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (no third-party code added) - [x] Generic behaviour, not specific to one title - [x] Depends on: #14258 (merge-order coordination only; implemented export families are disjoint) - [x] Fixes: none - [x] Unblocks: none identified - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-11-01 09:48:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T09:48:55Z.

Review: COMMENTED


Checked — libcairo heads conflict pairwise, no landing order declared

#14327, #14328 and #14329 each change libcairo/Export.cpp, InventoryExports.hpp and docs/dev/debt/libcairo.md, every pair of them conflicts when merged, and all three declare Depends on: none.

What I ran

Exact heads: #14327 a590a7178814, #14328 e207dcbf4e14, #14329 823af579d6e0, and the older open #14258 a855b5a98105. Merge previews were run with git merge-tree between each pair of heads (git takes the merge base). The conflicted-file lists are below.

git merge-tree --write-tree --name-only --no-messages <head-A> <head-B>

No precheck, build, or test was run on these heads in this pass. The code in the three PRs was not reviewed line by line, so this comment is about landing order, not implementation quality.

Results

Pair (exact heads) Conflicting files
#14329 + #14328 libcairo/Export.cpp, libcairo/include/InventoryExports.hpp, docs/dev/debt/libcairo.md
#14329 + #14327 libcairo/CMakeLists.txt, libcairo/Export.cpp, libcairo/include/InventoryExports.hpp, docs/dev/debt/libcairo.md
#14328 + #14327 libcairo/Export.cpp, libcairo/include/InventoryExports.hpp, docs/dev/debt/libcairo.md
#14258 + #14329 libcairo/CMakeLists.txt, libcairo/Export.cpp, libcairo/include/InventoryExports.hpp, docs/dev/debt/libcairo.md
#14258 + #14328 docs/dev/debt/libcairo.md
#14258 + #14327 libcairo/CMakeLists.txt, libcairo/Export.cpp, libcairo/include/InventoryExports.hpp, libcairo/libcairo.hpp, docs/dev/debt/libcairo.md
Unedited merge-tree output
# git merge-tree --write-tree --name-only --no-messages 823af579d6e0 e207dcbf4e14
3d40d1bfb788386f16e6c7b456ea5b822181edf4
core/libs/prx/libcairo/Export.cpp
core/libs/prx/libcairo/include/InventoryExports.hpp
docs/dev/debt/libcairo.md
# exit=1
# git merge-tree --write-tree --name-only --no-messages 823af579d6e0 a590a7178814
86e3f06205a8847d0629ccf97a2a26fdd024de93
core/libs/prx/libcairo/CMakeLists.txt
core/libs/prx/libcairo/Export.cpp
core/libs/prx/libcairo/include/InventoryExports.hpp
docs/dev/debt/libcairo.md
# exit=1
# git merge-tree --write-tree --name-only --no-messages e207dcbf4e14 a590a7178814
545a9fb9995eea7b35ae2c5372da9364b2a5ad42
core/libs/prx/libcairo/Export.cpp
core/libs/prx/libcairo/include/InventoryExports.hpp
docs/dev/debt/libcairo.md
# exit=1
# git merge-tree --write-tree --name-only --no-messages a855b5a981057334db4aa0c1d4e3f92457814a89 823af579d6e0
789f61bccab8185da4b8f62289d4146278c2a9b0
core/libs/prx/libcairo/CMakeLists.txt
core/libs/prx/libcairo/Export.cpp
core/libs/prx/libcairo/include/InventoryExports.hpp
docs/dev/debt/libcairo.md
# exit=1
# git merge-tree --write-tree --name-only --no-messages a855b5a981057334db4aa0c1d4e3f92457814a89 e207dcbf4e14
85c6093a373bdc18d1cf11c3b60248adc9e00079
docs/dev/debt/libcairo.md
# exit=1
# git merge-tree --write-tree --name-only --no-messages a855b5a981057334db4aa0c1d4e3f92457814a89 a590a7178814
15237095e946dc67e35b9e0d4b0f22d15a67d8b4
core/libs/prx/libcairo/CMakeLists.txt
core/libs/prx/libcairo/Export.cpp
core/libs/prx/libcairo/include/InventoryExports.hpp
core/libs/prx/libcairo/libcairo.hpp
docs/dev/debt/libcairo.md
# exit=1

Findings

Blocking: none found in this pass.

Non-blocking, needs a decision from the author:

  1. Landing order. Each of the three pairs conflicts in the same export table and debt file, so whichever lands second must be rebased. Declare the order in Depends on on each PR (for example, "#14327 lands first; this PR rebases after it"). Today every PR says Depends on: none, which does not match the conflicts.
  2. #14258. It is older and its head is based on an earlier main: 191 files differ between current main and its head, most of them main changes it does not contain. It conflicts with #14329 and #14327 as well. Its Depends on and landing position should be stated with the other three.

Sources

  • Merge previews are the output above, computed from the exact head SHAs listed.
  • Declared dependencies: read from the PR bodies on each PR (all three read - [x] Depends on: none).

Not verified

  • The code and tests in the three PRs were not reviewed in this pass.
  • No precheck, build, or test was run on these heads.
  • Hosted CI for these heads was not re-read in this pass.

To get this to a good state

Declare a landing order for #14327, #14328, #14329 and #14258 in each Depends on field, and rebase the later PRs after the earlier ones merge. Re-check the merge previews on the final heads once the order is set.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5727467039 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14327#pullrequestreview-5727467039). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T09:48:55Z. **Review:** COMMENTED --- # Checked — libcairo heads conflict pairwise, no landing order declared #14327, #14328 and #14329 each change `libcairo/Export.cpp`, `InventoryExports.hpp` and `docs/dev/debt/libcairo.md`, every pair of them conflicts when merged, and all three declare `Depends on: none`. ## What I ran Exact heads: #14327 `a590a7178814`, #14328 `e207dcbf4e14`, #14329 `823af579d6e0`, and the older open #14258 `a855b5a98105`. Merge previews were run with `git merge-tree` between each pair of heads (git takes the merge base). The conflicted-file lists are below. ```sh git merge-tree --write-tree --name-only --no-messages <head-A> <head-B> ``` No precheck, build, or test was run on these heads in this pass. The code in the three PRs was not reviewed line by line, so this comment is about landing order, not implementation quality. ## Results | Pair (exact heads) | Conflicting files | |---|---| | #14329 + #14328 | `libcairo/Export.cpp`, `libcairo/include/InventoryExports.hpp`, `docs/dev/debt/libcairo.md` | | #14329 + #14327 | `libcairo/CMakeLists.txt`, `libcairo/Export.cpp`, `libcairo/include/InventoryExports.hpp`, `docs/dev/debt/libcairo.md` | | #14328 + #14327 | `libcairo/Export.cpp`, `libcairo/include/InventoryExports.hpp`, `docs/dev/debt/libcairo.md` | | #14258 + #14329 | `libcairo/CMakeLists.txt`, `libcairo/Export.cpp`, `libcairo/include/InventoryExports.hpp`, `docs/dev/debt/libcairo.md` | | #14258 + #14328 | `docs/dev/debt/libcairo.md` | | #14258 + #14327 | `libcairo/CMakeLists.txt`, `libcairo/Export.cpp`, `libcairo/include/InventoryExports.hpp`, `libcairo/libcairo.hpp`, `docs/dev/debt/libcairo.md` | <details> <summary>Unedited merge-tree output</summary> ```text # git merge-tree --write-tree --name-only --no-messages 823af579d6e0 e207dcbf4e14 3d40d1bfb788386f16e6c7b456ea5b822181edf4 core/libs/prx/libcairo/Export.cpp core/libs/prx/libcairo/include/InventoryExports.hpp docs/dev/debt/libcairo.md # exit=1 # git merge-tree --write-tree --name-only --no-messages 823af579d6e0 a590a7178814 86e3f06205a8847d0629ccf97a2a26fdd024de93 core/libs/prx/libcairo/CMakeLists.txt core/libs/prx/libcairo/Export.cpp core/libs/prx/libcairo/include/InventoryExports.hpp docs/dev/debt/libcairo.md # exit=1 # git merge-tree --write-tree --name-only --no-messages e207dcbf4e14 a590a7178814 545a9fb9995eea7b35ae2c5372da9364b2a5ad42 core/libs/prx/libcairo/Export.cpp core/libs/prx/libcairo/include/InventoryExports.hpp docs/dev/debt/libcairo.md # exit=1 # git merge-tree --write-tree --name-only --no-messages a855b5a981057334db4aa0c1d4e3f92457814a89 823af579d6e0 789f61bccab8185da4b8f62289d4146278c2a9b0 core/libs/prx/libcairo/CMakeLists.txt core/libs/prx/libcairo/Export.cpp core/libs/prx/libcairo/include/InventoryExports.hpp docs/dev/debt/libcairo.md # exit=1 # git merge-tree --write-tree --name-only --no-messages a855b5a981057334db4aa0c1d4e3f92457814a89 e207dcbf4e14 85c6093a373bdc18d1cf11c3b60248adc9e00079 docs/dev/debt/libcairo.md # exit=1 # git merge-tree --write-tree --name-only --no-messages a855b5a981057334db4aa0c1d4e3f92457814a89 a590a7178814 15237095e946dc67e35b9e0d4b0f22d15a67d8b4 core/libs/prx/libcairo/CMakeLists.txt core/libs/prx/libcairo/Export.cpp core/libs/prx/libcairo/include/InventoryExports.hpp core/libs/prx/libcairo/libcairo.hpp docs/dev/debt/libcairo.md # exit=1 ``` </details> ## Findings **Blocking:** none found in this pass. **Non-blocking, needs a decision from the author:** 1. Landing order. Each of the three pairs conflicts in the same export table and debt file, so whichever lands second must be rebased. Declare the order in `Depends on` on each PR (for example, "#14327 lands first; this PR rebases after it"). Today every PR says `Depends on: none`, which does not match the conflicts. 2. #14258. It is older and its head is based on an earlier main: 191 files differ between current `main` and its head, most of them main changes it does not contain. It conflicts with #14329 and #14327 as well. Its `Depends on` and landing position should be stated with the other three. ## Sources - Merge previews are the output above, computed from the exact head SHAs listed. - Declared dependencies: read from the PR bodies on each PR (all three read `- [x] Depends on: none`). ## Not verified - The code and tests in the three PRs were not reviewed in this pass. - No precheck, build, or test was run on these heads. - Hosted CI for these heads was not re-read in this pass. ## To get this to a good state Declare a landing order for #14327, #14328, #14329 and #14258 in each `Depends on` field, and rebase the later PRs after the earlier ones merge. Re-check the merge previews on the final heads once the order is set.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!14327
No description provided.