7 Commits
Author SHA1 Message Date
geramyloveless 3266899b74 display: copy a region redrawn in place once per flip
Measured on the R9700 (build 235, the Dell at 2560x1440): a window
redrawing a 1732x1140 region every frame made every flip copy about
24.8 MB from the capture surface, three times the region: the frame's
damage plus the same region again for each scanout buffer that had
missed it, kept as separate rectangles. At 0.73 ms per MiB over
Thunderbolt that is 17.3 ms of copy per 16.7 ms frame, so frames were
replaced before they could flip (55 flips/s) and the picture lagged; a
full-screen workload stopped the output when its copies backed up past
the flip timeout.

Damage now folds a rectangle into any it overlaps closely (contained,
equal, or overlapping so the box is no larger than the two), so the
region stays one rectangle and is copied once; damage covering nine
tenths of the frame becomes one whole-frame copy. The flip wait first
waits for its own copies (bounded at 2 s, as GPU work), then for the
flip (200 ms), and says which did not complete.

printk_once and the DRM *_ONCE messages are now once per call site:
DM's MST/DSC check logged "dsc precompute is not needed" on every
commit, sixty times a second, filling the kernel log.

The display agent also finishes launching as a background agent only
after its virtual display has a mode: made an NSApplication earlier,
the process never saw the new display's modes.

test_display_pipeline: a window redrawn in place with an item inside
it copies the window's bytes once per flip.
2026-10-03 20:01:06 -07:00
geramyloveless ec7674b0e8 Merge Vulkan foundation: Linux file transport and command submission
Adds the Linux file RPC (user client type 2) that carries DRM and KFD
ioctls with Linux numbering, libmlg_drm for clients, the in-dext command
submission self-test, and fixes the DRM_COMMAND_BASE override in the
linuxu drm.h.
2026-10-02 22:09:37 -07:00
geramyloveless 96eb5f42e4 linuxu: DRM ioctl numbers and stack zeroing as a Linux build has them
linuxu's drm/drm.h redefined DRM_COMMAND_BASE as 0 and DRM_COMMAND_END
as 0x0f over the uapi's 0x40 and 0xA0. Every DRM_IOCTL_AMDGPU_* number
was therefore not the Linux one, and drm_ioctl() sent the core ioctls
below 0x0f (DRM_IOCTL_VERSION, GET_UNIQUE, ...) to the driver's table:
a render-node client issuing Linux ioctl numbers, as libdrm and Mesa do,
reached the wrong handlers. The uapi band now stands.

Linux builds with CONFIG_INIT_STACK_ALL_ZERO, the default whenever the
compiler supports it, and upstream depends on it: amdgpu_vm_bo_update()
returns an uninitialized r for the PRT mapping when nothing needs
updating, which the first AMDGPU_CS of every render client hits. Host and
DriverKit builds now pass -ftrivial-auto-var-init=zero as Linux does.
2026-10-02 21:31:13 -07:00
geramyloveless 965c4af2be linuxu: library services the display code links against
- get_random_bytes()/get_random_u*() from the platform CSPRNG
  (arc4random_buf(), which DriverKit's libSystem also provides); DP MST
  uses it for sideband nonces.
- lib/uuid.c built unmodified as a helper (guid_gen(), guid_null for DP
  MST branch GUIDs), with hex_to_bin()/hex2bin()/bin2hex() from
  lib/hexdump.c and the upstream linux/hex.h.
- kstrtobool() and kstrtobool_from_user() from lib/kstrtox.c for the
  DC debugfs write handlers.
- vzalloc() for the DML/DML2 work areas.
- Upstream headers and helpers: linux/bitfield.h and linux/typecheck.h
  verbatim (kernel.h now uses the upstream typecheck()), the full
  linux/backlight.h and drm_privacy_screen_consumer.h (their
  !CONFIG inlines replace stray declarations), ffz(), might_sleep_if(),
  delayed_work_pending(), ARCH_KMALLOC_MINALIGN, linux/minmax.h, and
  linux/err.h from linux/dmi.h as the quirk tables need. ssleep() is the
  upstream inline now.
2026-10-02 20:56:28 -07:00
geramyloveless 2effeb9871 linuxu: headers for the display tree and the DRM display helpers
Vendor the upstream display headers verbatim (drm/display/ DP, MST,
dual-mode, DSC, HDCP, HDMI, SCDC; drm_crtc_helper.h, drm_probe_helper.h,
drm_modeset_helper.h, drm_modeset_helper_vtables.h, drm_bridge_helper.h,
drm_audio_component.h, acpi/video.h, linux/average.h, linux/iopoll.h,
media/cec-notifier.h and the uapi linux/cec.h). The trimmed DP/MST
helper headers and the inline display stubs they carried give way to the
upstream declarations, now that the upstream helpers are built.

media/cec.h keeps only the upstream CONFIG_CEC_CORE=n API. Smaller
upstream pieces the display code reaches: fsleep()/ssleep() and
TICK_NSEC, noinline/noinline_for_stack, the in-place byteorder helpers
(kernel.h includes asm/byteorder.h as upstream does), the
DIV64_U64_ROUND_* family, the !CONFIG_ACPI companion helpers, guid_t
through mod_devicetable.h, str_*() through kernel.h/seq_file.h, and the
workqueue disable/current_work declarations.

The drm_simple_encoder_init() stub is removed: drm_simple_kms_helper.c
provides it, as drm_dp_helper.c and drm_panel_orientation_quirks.c now
provide what linuxu/src/drm/dp_helper.c carried.
2026-10-02 20:42:02 -07:00
geramyloveless 558edabfac display: build Display Core, the display helpers and the KMS helpers
Add drivers/gpu/drm/display/ to the sparse checkout and compile the
display side of upstream amdgpu:

- mk/upstream_sources.mk gains the 498 objects of AMD_DISPLAY_FILES
  (amd/display/Makefile and the Makefiles it includes, evaluated with
  DRM_AMD_DC=y, DRM_AMD_DC_FP=y, DEBUG_FS=y), the drm_display_helper
  module for the DRM_DISPLAY_* helpers amdgpu selects, the whole
  drm_kms_helper module and the panel orientation/backlight quirk tables.
  DCN 4.0.1 links the dcn10..dcn35 code it reuses, so every DCN is built.
- mk/kernel_config.mk and linux/autoconf.h enable DRM_AMD_DC, DC_FP and
  the display helper configs; CEC, DP AUX chardev/CEC, DP tunnel, bridge
  connector, SI DCE and secure display stay off.
- INCPATHS carries the subdir-ccflags-y include roots of the display
  Makefiles in upstream order.
- CONFIG_DRM_AMD_DC_FP is declared in patches/manifest.json as a config
  intervention: Kconfig drops it for clang+arm64 because of kernel FPU
  rules that do not apply to userspace. scripts/verify-upstream.py checks
  that each declared config intervention names a Kconfig symbol and is
  set in autoconf.h.
- linux/kconfig.h provides IS_ENABLED/IS_REACHABLE as kbuild's forced
  include does; autoconf.h pulls it in after the CONFIG table.

Display stays off at runtime by default; that gating follows separately.
2026-10-02 20:41:36 -07:00
geramyloveless 953cf0149c mac_linuxgpu: upstream Linux amdgpu on macOS
Runs the unmodified upstream Linux amdgpu and amdkfd drivers on Apple
Silicon Macs inside a DriverKit system extension, for AMD GPUs attached
over Thunderbolt. The Linux sources come from a pinned submodule and are
compiled against linuxu, a userspace implementation of the Linux kernel
APIs they use. Includes the HSA runtime, the host installer app, the
setup and firmware fetch scripts, and the offline test suite.
2026-10-02 18:49:17 -07:00