Commit Graph
14017 Commits
Author SHA1 Message Date
Dean Galvin bf6b6c0a17 docs(relinker): describe fixed-base default for Windows executables 2026-10-14 17:39:48 +13:00
poonasorandClaude Opus 5.5 7ce7338242 perf(shader): read adjacent BDA dword loads of one block through one span read
A scalar load of several dwords (s_load_dwordx8) becomes one
LoadAddressU32 per dword, and each took its own span read: a probe of
the page table and a fallback that looks every byte up. Loads in one
block with equal address operands and offsets within 16 bytes of the
first now share its span read. Instructions that write memory end a
group; the address operands are compared by content, since each load
carries its own GetAddressResource and SelectU32 values.

An NHL 27 (PPSA34063) main-menu pixel shader goes from 136 span reads
to 34. AMD's Windows compiler inlines the read helpers at every call,
and did not finish that shader before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 00:39:27 -04:00
Dean 90d0cb4812 Merge pull request #4719 from gjonn/fix/pread-posix-errors
fix(libkernel): return errors from pread instead of aborting
2026-10-14 17:38:48 +13:00
Nicolas AboschandClaude Opus 5.5 5062157228 perf(agc): refuse a display buffer that is a slice of two pending array images
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 17:37:01 +13:00
Nicolas AboschandClaude Opus 5.5 ed95e6618e perf(agc): present a display buffer that is a later slice of a pending array image
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 17:37:01 +13:00
Nicolas AboschandClaude Opus 5.5 ccd8591fb0 perf(agc): keep only the slice a draw rendered pending in an array target
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 17:37:01 +13:00
Nicolas AboschandClaude Opus 5.5 a062eda972 test(agc): cover the slice decision and layered conversion of a resident presentation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 17:37:01 +13:00
Nicolas AboschandClaude Opus 5.5 4589edf7f5 perf(agc): present a display buffer from its slice of a pending array image
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 17:37:01 +13:00
Dean e33258a648 Merge pull request #5311 from oneandonlydean/up4/present-resident-direct-2
perf(agc): present resident displays without the 4K convert chain
2026-10-14 17:26:59 +13:00
Dean ee50655414 Merge pull request #5109 from pushkarreddyy/feat/libkernel-foreign-module-protect
feat(libkernel): support sceKernelMprotect on foreign guest module images on Windows
2026-10-14 17:26:42 +13:00
Dean 718ae1355c Merge pull request #4903 from ErenYeager1836/carry/fstat-guest-socket
fix(libkernel): report socket status from fstat on a guest socket
2026-10-14 17:26:23 +13:00
Dean 1c95691fb5 Merge pull request #5290 from veosett/codex/allocator-failure-results
fix(libc): return allocation failures to guest callers
2026-10-14 17:26:13 +13:00
Dean 22beaa2e7a Merge pull request #4628 from mugurc/fix/asm-macho-symbols
fix(libs): spell inline assembly symbols for Mach-O hosts
2026-10-14 17:26:02 +13:00
Dean 6fad06c19e Merge pull request #4669 from milescoviello/fix/scenet-unspec-disconnect
fix(libSceNet): dissolve a datagram association on connect to AF_UNSPEC
2026-10-14 17:25:39 +13:00
Dean 6ed374413e Merge pull request #4681 from milescoviello/fix/alias-trailing-slash
fix(libc): keep a trailing slash on paths under a mount alias
2026-10-14 17:25:15 +13:00
Dean f919033ace Merge pull request #5653 from oneandonlydean/ci-mesa-cache-cpu-model
ci(build): key the Mesa shader cache by the runner's CPU model too
2026-10-14 17:21:56 +13:00
Rishit Vora 2caefdb8ed fix(libkernel): resolve renamed guest exports in the default scope 2026-10-14 04:19:49 +00:00
milescovielloandClaude Opus 5.5 cf9dd4f181 fix(agc): refresh a block-copied texture the fast lookup would reuse
fastTexture hands back the texture of a stage-A record when its memory is
unchanged, and declines only depth surfaces and textures remade per use.
The block copy of #4747 is a copy refreshed on reuse over a surface that
is not a depth surface, so the fast path returned it without
RefreshDepthCopy: after a compute pass stored new blocks into its storage
image, a sample read the blocks of the previous copy.

Decline copies refreshed on reuse in fastTexture as well, so the lookup
takes cachedTexture, whose cache hit refreshes them.

agc_driver_bc_block_copy failed on main at "sample of blocks stored
again" (Linux, NVIDIA) and passes with this change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 04:18:43 +00:00
Dean Galvin 8702de1e6f ci(build): key the Mesa shader cache by the runner's CPU model too
Since #5263 the Linux job restores a lavapipe shader cache keyed by the
runner's /proc/cpuinfo flags. llvmpipe compiles shaders with LLVM's host
CPU *name* (from vendor, family and model) plus the detected feature bits,
and keys its cache only by the feature bits, so two runners with the same
flags but different models share cached code. A hull shader JIT-compiled
on a znver4/znver5 or Ice Lake class host uses GFNI (vgf2p8affineqb);
loaded on a Zen 3 host with the same flags it raises SIGILL, which is what
agc_driver_tessellation has been hitting on main and on dispatched builds
since the first main build after #5234 saved that hull variant.

Hash vendor_id, cpu family, model and flags into the key, so a runner only
restores code compiled for its own CPU model, and print the model name so a
future mismatch can be read off the log.
2026-10-14 17:11:46 +13:00
Dean f40b6930ff Merge pull request #4914 from MarcZX100/codex/carry-link-follow-symlink-4026
fix(libkernel_sys): follow symbolic links in link
2026-10-14 17:05:05 +13:00
Dean 00f4b3351b Merge pull request #3972 from semirkabir/feat/videoout-output-status-vrr
feat(videoout): implement sceVideoOutGetOutputStatusWithVrr
2026-10-14 16:44:42 +13:00
Dean a31043146e Merge pull request #5367 from MarcZX100/marc/sysctl-leaf-enotdir-5356
fix(libkernel): return ENOTDIR for trailing sysctl leaf components
2026-10-14 16:41:21 +13:00
Dean a1ca1e7bad Merge pull request #5137 from MarcZX100/codex/request-v21-compat
fix(shader): accept both version 21 request layouts
2026-10-14 16:41:11 +13:00
Dean 21def5c6f8 Merge pull request #5597 from JJenkx/fix/thread-stack-retirement-order
fix(libkernel): retire stack metadata before releasing mappings
2026-10-14 16:41:01 +13:00
ThatsLeo 9828710a38 feat(videoout): implement sceVideoOutGetOutputStatusWithVrr
Writes the 80-byte status described in #2746: the sceVideoOutGetOutputStatus
fields followed by zeros, with the documented codes for a null status and an
unknown handle.

(cherry picked from commit e893efad2d0a7b90243d07bf6669cc9b5f540432)
2026-10-14 16:37:40 +13:00
Dean a14ae8e232 Merge pull request #5186 from p3n1cillin/claude/carry-fioclex
fix(libkernel): handle FIOCLEX and FIONCLEX in ioctl
2026-10-14 16:31:08 +13:00
Dean Galvin 70fbb186c0 test(libkernel): check the libkernel.prx rejection on its own image
&sceKernelMprotect in the test executable is its import thunk, so the
call protected a page of the executable's own code read-only and the
next call through it crashed. Use the libkernel.prx image instead.
2026-10-14 16:24:33 +13:00
Ondra97 f10ab0b6ab fix(relinker): validate complete relocation symbol entries 2026-10-14 05:18:50 +02:00
babyhuey f535918337 fix(agc): accept geometry programs with fewer GS and ES input VGPRs 2026-10-13 23:18:02 -04:00
JJenkx 8b26c5a4ce chore: refresh against current upstream main 2026-10-13 23:13:51 -04:00
JJenkx bfa0de72cb fix(libkernel): retain shared mutex attributes 2026-10-13 23:13:51 -04:00
JJenkx 079164e84c chore: resolve current upstream integration conflicts 2026-10-13 23:13:50 -04:00
JJenkx 2f9d04fb77 chore: resolve current upstream integration conflicts 2026-10-13 23:13:49 -04:00
Dean Galvin 7f2c2a51c3 test(libkernel): give the module image protection test its own .elf0 module
The shared guest_memory_module gained a .elf0 section, so on Windows its
data was no longer counted against flexible memory and
CheckGuestModuleUsesFlexibleMemory failed. Build the .elf0 variant as a
separate guest_memory_elf0_module, keep the shared module as on main, and
check that a .guest.prx module without .elf0 is rejected.
2026-10-14 16:11:16 +13:00
Dean Galvin e5d65569e5 fix(agc): dissolve the cached address space when a written V# overlaps a read-only V# copied across imports
A read-only V# that crosses two base regions is copied per build while the
space stays. A written V# overlapping that copy would bind the base region's
import while the read-only V# binds the copy of the same bytes. Dissolve the
space in that case (either order of the two), as without this branch, so both
share the one merged region.
2026-10-14 16:10:33 +13:00
Yunus Shaikh 1243f067b1 fix(shader): lower hulls that write one output control point per patch
A hull with one output control point writes its control point at the
patch record offset alone, so the write has no control-point term and
was taken for a patch constant with no control stride ('the hull shader
writes off-chip memory outside its control points and patch constants').
Take the control stride from the patch term of such writes when the
write fits in one record (its offset is at least 0 and its end within
the patch term), the rule domain programs already apply to control-point
reads; patch-constant records lie outside that, below the top of the
off-chip block or above every control point. With one invocation per
patch, per-patch outputs also need no control-point-0 guard. Resident
Evil Village's quad patches have one output control point.
2026-10-13 20:09:35 -07:00
Yunus Shaikh e25d561b7c fix(shader): take a hull's input stride from its patch term when it reads one control point
derive() learned the LS-to-HS stride from the control-point term of hull LDS reads, or from the patch term of reads at a computed control-point index. A hull with one input control point reads it at constant offsets, so neither applies and the stride stays unknown ('the hull shader reads no LDS per control point, so the local stride is unknown'). Every hull read already has a patch term of exactly inputControlPoints * localStride, so take the stride from it for reads without a control-point term too. Resident Evil Village's quad patches have one input control point.
2026-10-13 20:09:35 -07:00
Dean a5f493f90d Merge pull request #5152 from dev-mca/test/convert-keycode
test(libSceConvertKeycode): cover sceConvertKeycodeGetImeKeyboardType
2026-10-14 16:06:42 +13:00
Dean f5cda839ec Merge pull request #4717 from Ondra97/codex/fix-relro-unused-filter
fix(relinker): map standalone RELRO in unused import filtering
2026-10-14 16:05:01 +13:00
Dean e1544df5f2 Merge pull request #4772 from TideOPL/perf/spirv-specialization
perf(shader): index specialization tables by SPIR-V id
2026-10-14 16:04:50 +13:00
milescovielloandClaude Opus 5.5 472437a703 fix(libkernel): report socket status from fstat on a guest socket
fstat on a guest socket descriptor passed the guest number to the host,
which has no such descriptor, and threw ("FillFileStat: fstat failed for
fd 268435460"); sceKernelFstat returned EBADF. FreeBSD fills the stat
buffer for a socket through soo_stat (sys/kern/sys_socket.c):

	bzero((caddr_t)ub, sizeof (*ub));
	ub->st_mode = S_IFSOCK;
	...
	if ((sb->sb_state & SBS_CANTRCVMORE) == 0 || sbavail(sb))
		ub->st_mode |= S_IRUSR | S_IRGRP | S_IROTH;
	ub->st_size = sbavail(sb) - sb->sb_ctl;
	...
	if ((sb->sb_state & SBS_CANTSENDMORE) == 0)
		ub->st_mode |= S_IWUSR | S_IWGRP | S_IWOTH;

and pru_sense_null (sys/kern/uipc_socket.c) adds
st_blksize = so->so_snd.sb_hiwat.

fstat and sceKernelFstat now answer a guest socket from the socket
table: S_IFSOCK, the read bits until the receive side is shut down and
drained, the write bits until the send side is shut down, st_size from
the bytes queued and st_blksize from the send buffer size, other fields
zero. shutdown records which side it closed. A closed socket descriptor
returns EBADF. The differences from the console (peer shutdown, the
host's FIONREAD and SO_SNDBUF, socketpair identity) are listed in
TechnicalDebt.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 08:34:16 +05:30
Dean Galvin 46989a7d8a docs(libkernel): keep the memory protection bits entry 2026-10-14 16:00:06 +13:00
Celegans12 c1e4a0ba8b fix(shader): record BDA faults in hull programs instead of refusing them
Every hull program with a BDA access was refused with "BDA fault
termination requires a barrier-safe tessellation-control execution
protocol". The refusal predates BdaInvocationsMayStop: a program with
s_barrier no longer stops a faulting invocation; the fault is recorded,
the read returns zero and every invocation reaches the barrier. In a
hull, s_barrier is the only control barrier the backend emits after the
guest code starts, so that rule already covers it, and a hull without
one can stop an invocation without stranding a barrier.

The tessellation test draws hulls that scale their levels by a BDA read,
with and without s_barrier, and requires an unmapped read to report a
tessellation-control fault (not on llvmpipe, which runs hull loads that
the unmapped-address check skips). The contract test now accepts a hull
with s_barrier.
2026-10-14 04:59:27 +02:00
Celegans12 2eda9f893c feat(agc): rebuild the hull's relative patch index when it is used as data
Hull programs whose relative patch index (v1 bits 7:0) reached anything
but a tessellation ring or LDS address threw, because the lowering runs
every Vulkan patch as relative patch 0. The quad terrain hull 0x80002fc700
in Ghost of Yotei is one, and so is the domain 0x8068fbd900 (v7).

Such hulls and domains now take (PrimitiveID mod GE_CNTL.PRIM_GRP_SIZE)
mod VGT_LS_HS_CONFIG.NUM_PATCHES, as if hull threadgroups took NUM_PATCHES
patches at a time out of each primitive group; both stages see the same
PrimitiveID for a patch. This holds only when every instance starts a new
threadgroup, so it needs GE_CNTL.BREAK_WAVE_AT_EOI (bit 18); with the bit
clear the instances share threadgroups and such programs still throw.
PRIM_GRP_SIZE and BREAK_WAVE_AT_EOI join the tessellation configuration
(draw keys, hull and domain cache keys, request version 24). A missing
GE_CNTL throws, and so do local programs, whose relative vertex index
depends on vertex reuse that Vulkan does not expose.
2026-10-14 04:59:07 +02:00
Adrià FranchandClaude fce953802a fix(libSceNet): fail the AF_UNSPEC connect with EAFNOSUPPORT as FreeBSD does
Co-Authored-By: Claude <[email protected]>
2026-10-14 02:58:42 +00:00
milescovielloandClaude Opus 5.5 65d56b3147 fix(libSceNet): dissolve a datagram association on connect to AF_UNSPEC
sceNetConnect() on a connected datagram socket rejected an address
whose family is AF_UNSPEC (a null address) with EINVAL before touching
the socket, so the socket stayed connected: sceNetGetpeername() still
reported the old peer and datagrams from any other sender were dropped
by the host.

FreeBSD 11.4 disconnects a connected datagram socket first and only then
looks at the address. sys/kern/uipc_socket.c, soconnectat():

	 * If protocol is connection-based, can only connect once.
	 * Otherwise, if connected, try to disconnect first.  This allows
	 * user to disconnect by connecting to, e.g., a null address.
	 */
	if (so->so_state & (SS_ISCONNECTED|SS_ISCONNECTING) &&
	    ((so->so_proto->pr_flags & PR_CONNREQUIRED) ||
	    (error = sodisconnect(so)))) {

udp_disconnect() (sys/netinet/udp_usrreq.c) clears the peer and keeps
the local port. connect(2): "Datagram sockets may dissolve the
association by connecting to an invalid address, such as a null
address." libkernel's connect gets the same change in #4498.

A connected datagram socket given an address whose family byte is 0 is
now disconnected on the host first (AF_UNSPEC on Linux, a zeroed
address of the socket's family on Windows), and the call then fails
with EINVAL as before. Linux also drops an ephemeral local port on that
disconnect, so the port is bound again on the wildcard address, which
is what FreeBSD leaves. A host failure during the disconnect is
returned as the call's error. Stream sockets keep the previous path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 02:58:42 +00:00
Celegans12 866ed445b9 fix(agc): lower hull exec masks restored through phis to own lane bits
A wave64 hull program narrows EXEC with s_and_saveexec_b64 and restores it
later, so its exec words reach the lane-bit test as ANDs with the host
ballot, as loop or join phis, and through separate ballots for the two
halves. Tessellation lowering refused them as "uses a lane mask other
than its own lane's bit".

The own-lane bit of a mask pair is now rebuilt from the words' operations
(ballots, bitwise ops, selects, phis, constants); both halves must have
the same shape and ballot the same predicate. Dead hull cycles such as a
saved-exec loop are removed before the remaining-ballot check, so a mask
whose other lanes are read (s_bcnt1_i32_b64 exec) is still refused. The
words are replaced through identities and block conditions are resolved,
so a branch on a compare copied to VCC keeps its condition. Local and
domain programs keep their exec words for the half-wave matcher.

Block conditions fix and HullCompareBranch test from EagleBearerYS.
2026-10-14 04:57:58 +02:00
Dean f265cd5593 Merge pull request #5234 from AnthonyClemens/fix/agc-integer-tessellation-partitioning
fix(agc): accept integer tessellation partitioning
2026-10-14 15:55:50 +13:00
milescovielloandClaude Opus 5.5 2c25b181fe fix(libSceNet): report SO_SNDBUF and SO_RCVBUF from sceNetGetsockopt
Steam Remote Play (PPSA99350) reads SO_RCVBUF on its UDP socket with
sceNetGetsockopt, and main fails it with EOPNOTSUPP (0x8041012d),
although sceNetSetsockopt already accepts the option.

FreeBSD 11.4 answers both options with the buffer's high-water mark
(sys/kern/uipc_socket.c, sogetopt), which setsockopt sets to the
requested size through sbreserve:

	case SO_SNDBUF:
		optval = so->so_snd.sb_hiwat;
		goto integer;

	case SO_RCVBUF:
		optval = so->so_rcv.sb_hiwat;
		goto integer;

sceNetGetsockopt now answers both. A size the guest set is reported as
set, as on FreeBSD; reading the host would give twice the value on
Linux, which doubles it. Before the guest sets one, the host socket's
current size is reported.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 02:55:25 +00:00
Dean 970316ae04 Merge pull request #4704 from AlxcBTW/feat/input-mouse-look
feat(input): turn mouse speed into a smooth right-stick tilt
2026-10-14 15:55:08 +13:00