Queue-0 DMA_DATA packets drained the draw pipeline unless APS5_PIPELINE_DMA was set, so the packet worker waited on the committer at every small immediate store. Kena PPSA01746 issues 17-23k DMA_DATA packets per 10 s and 11329 of its 20134 pipeline drains per 10 s are opcode 0x50. enqueueDmaPacket now queues DMA_DATA stores and fills unconditionally, and keepsDrawPipeline keeps the pipeline for a copy or fill whose source and destination miss every queued write. The APS5_PIPELINE_DMA switch and its documentation are removed and the tests run the default path.
fcntl(F_SETFL) threw when it changed O_APPEND on a Windows file. The
guest flag already chooses WriteAtEnd, but a descriptor opened with
O_APPEND also carries the CRT's append flag, so _write kept appending
after the guest cleared it. F_SETFL now replaces the CRT descriptor of
every descriptor sharing the open file's status with a duplicate handle
opened with or without _O_APPEND, as libc fdopen does for append mode.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
powf returned the host pow, except for base 1, so its last bit and errno
depended on the host: on Windows the bits differ from titles' libc.prx on
3,171,678 of 100,001,089 sampled argument pairs. That libc.prx is the
older form of FreeBSD msun's e_powf.c: a NaN argument returns x + y, so
powf(1, NaN) is NaN rather than 1, and (+-1)**+-inf is NaN. It sets EDOM
for a negative base with a non-integer exponent and ERANGE only in its
final overflow and underflow returns.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
exp2f returned the host exp2, so its last bit and errno depended on the
host: on Windows the bits differ from the libc.prx that titles ship on
213,306,266 of the 2^32 floats. That libc.prx is msun's s_exp2f.c, setting
ERANGE only in its overflow and underflow branches. The port gives the same
bits and errno as PPSA07923's, PPSA05916's and PPSA13934's copies for every
argument.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The relinker stopped printing a 'Guest module:' line for each converted
module in 56c2a5318; it reports 'Converted modules: N' and lists the
.guest.prx files under app0/ in its runtime layout tree. GAME_TESTING.md
and USAGE.md still told readers to use the files printed as 'Guest module:'.
Table T#s keyed at runtime feeding image_atomic64_* now lower to
OpAtomic* on the table Atomic64View instead of faulting, mirroring
the 32-bit path: gate, dedup identity, binding flags and view
selection. Packed formats and BY element counts still fault; hosts
need VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT for the view format.
The recorder took its ranges once, at the snapshot, so a title that
committed memory during the captured frames replayed submissions from
memory the capture never had. Each memory delta now adds the allocations
the registry gained since the last one as new ranges with their nonzero
64 KiB blocks, and the header counts them as late_ranges.
A submission ended a captured frame when the driver's flip count changed
while it was being submitted, and the count was global, so a submission
that overlapped another thread's flipping one ended the frame as well.
The count is now kept per thread.
agc_driver_frame_replay copies its second frame from a block committed
during the capture, and agc_driver_frame_capture_eop checks that a flip
submitted on another thread leaves this thread's count unchanged; both
fail without the fix.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Order memory deltas and video output registration before the next
recorded call, and serialize the deadlock breaker with delta application
- Capture the blocks holding shader code with each shader delta
- Reserve explicit and automatic EOP flip tokens under one lock
- Record video output unregistration so replay can close and reopen a handle
- Clear already mapped ranges before restoring the snapshot so elided zero
blocks replay as zero
Co-Authored-By: Claude Opus 5.5 <[email protected]>
An EOP flip reservation also ended a frame, and so did the submission
whose EOP release carries the reserved token, so a title flipping with
EOP releases counted each displayed frame twice: a capture of N frames
stopped after about N/2 and could start between the reservation and
the submission that flips. The reservation is now only recorded; a
frame ends at a CPU flip or at a submission that flips.
agc_driver_frame_capture_eop reserves and submits six EOP flips with
APS5_FRAME_CAPTURE_FRAMES=3 and checks that the capture starts after
the first flipping submission and holds three frames of one reservation
and one submission each.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
APS5_FRAME_CAPTURE=<dir> makes the AGC driver record a few frames of a
title: the shader registrations and ABI resolutions, video output and
EOP flip reservations it made since it started, a snapshot of every
readable guest allocation (the title image included) taken at a frame
boundary once the driver is idle, and for the next frames each
submission, flip and suspend point with the thread that made it, its
serial progress and the guest pages the write tracker saw the CPU write
before it. At the end it stores the presented display buffers as
reference images. APS5_FRAME_CAPTURE_AT_FLIP, _TRIGGER and _FRAMES pick
the frames.
agc_frame_replay maps the captured memory at its addresses and replays
the calls of each captured thread on a thread of its own, in captured
order, through the current build of the driver with no title running.
It paces GPU work to the in-flight depth the title had, releases GPU
waits that the title's CPU threads released without calling the driver
(AgcDriverAwaitedWaits), and reports frame times, released waits and
how closely the replayed display buffers match the references.
Tests: agc_frame_capture (file format) and agc_driver_frame_replay
(two captured frames of CPU writes and DMA copies replayed and
compared). Docs: BUILD.md, ENVIRONMENT.md and the libSceAgcDriver debt
file.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
%U and %W take the weekday as (tm_wday + 7) % 7 and (tm_wday + 6) % 7
with the C remainder, which fits the PS5 rows of libSceLibcInternal.sprx
and of the libc.prx titles ship. A composite conversion is written part
by part, each part all or nothing. %G, %g and %V throw for a tm_yday
past the year and a tm_wday below -6, where no rule fits the console.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The tests now check the SDK values of the pan error constants, that 0 params leaves the output untouched, that a NaN param angle keeps its LFE level with 7 speakers, and that a param one float below the first speaker in radians throws. The throw messages and the debt entry say the PS5 module did not return within 60 s for those inputs instead of claiming it never returns.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A Windows process started without a standard handle, such as a detached
process or a --windows-gui executable started from Explorer, has
descriptors 0 to 2 whose _get_osfhandle is -2. fcntl then threw on their
unknown file type, which stopped Halo: Combat Evolved (PPSA99500) at
start-up. Open NUL on each of them when libc loads, as Linux and macOS
already open /dev/null on a closed standard descriptor.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
rewatchSettledImports passed an import's 64 KiB-rounded span to
Rewatch. For an import whose size is not a block multiple the span's
last block holds pages past the allocation, the walk fails on them, and
the import stayed compared for good. Pass the import's own pages; the
shared-block and live storage image checks still use the block span.
#7948 requires the FMASK of an eight-fragment DCC target to be
write-watched at the initial import and at each reuse. On Windows an
FMASK in a host import whose deferred settle has not run yet is still
compared, so the target is refused with "native FMASK contents require
watched guest memory" after the previous commit has settled its color and
metadata ranges.
Call WatchedAfterSettle for the FMASK range at both checks, as the initial
import already does for the color, DCC and CMASK ranges. A range that is
unwatched without an import awaiting its read is still refused, and
nothing changes off Windows.
Four-sample targets take no FMASK range, so this changes nothing for them.
Refs https://github.com/boykopovar/AnyPS5/issues/9724
Rush 2 Recompiled (PPSA69423) and Wave Race 64 Recompiled (PPSA69424)
stop on Windows with "initial multisampled DCC contents require watched
guest memory" (https://github.com/boykopovar/AnyPS5/issues/9724). Their
multisampled color target lives in a 784 KiB host import made at map
time. An import under 1 MiB stays compared until a later lookup reaps
its deferred settle read, and the titles draw to the target first.
When an initial multisampled DCC import needs a range whose import still
waits for its settle read, submit that read now if it is still wanted,
wait for its fence and return the import to the write watch before the
check. This builds on #8527's ordering: the read goes through its
main-queue batch with barriers around it, so it runs after every earlier
main-queue access, and the wait happens under the GPU mutex that
submission holds.
An import that is not a whole number of 64 KiB blocks, such as these
titles' 0xc4000 bytes, never got a deferred read, and Rewatch refuses a
range that does not start and end on a block. Such an import now waits
for this path alone. It returns to the write watch with its partial
blocks whole, each stamped as a CPU store, unless another compared
import or a live storage image shares them.
Imports that stay compared for any other reason still do, an explicitly
unwatched range is still refused, and APS5_NO_DEFERRED_SETTLES still
keeps these imports compared.
The prosper console oracle measured SCE_KERNEL_ERROR_EINVAL for creating
a semaphore with an initial count above the maximum, a maximum of 0, a
negative initial count or a null name, for polling 0 or more than the
maximum, and for signalling 0. These threw, or polled past the maximum
returned EBUSY, and signalling 0 succeeded.
Co-Authored-By: Claude Opus 5.5 <[email protected]>