Each of the three framebuffers remembers the damage it missed while the
others were drawn, and a frame copied that again from the client's
surface, so a frame crossed PCIe with the damage of the last two or three
frames, not only its own. The worker now copies what its buffer missed
from the buffer it drew last (VRAM to VRAM, always the front or the
pending one, so never the one being drawn); only the frame's own damage
comes from the surface. The VRAM copies run on the first engine after the
copies that drew the source buffer (scheduler dependencies) and the
surface's copies on the other engine wait for them.
PRESENT takes moves (rows that scrolled): width x height at (x, y) are
the previous frame's pixels at (x, src_y). The worker copies them from the
buffer drawn last, which holds that frame, before the frame's damage.
A frame that replaces one in the mailbox, or comes before anything was
drawn, has its moves (and the replaced frame's) copied from the surface:
the rows they come from were never drawn. Moves outside the frame are
refused. The request's reserved word becomes the move count (old agents
send 0), moves follow the rectangles, at most 32 and 4096 bytes in all.
The statistics become version 3: bytes is what came from the surface,
vram_bytes what was copied in VRAM, moved_rows and moves_dropped.
test_display_pipeline: frames 2-4 take only their own damage from the
surface and the rest in VRAM; scrolling under a fixed header and inside
a window with mailbox replacement, and moves at the frame's edges, leave
every scanout pixel equal to the surface; moves past the frame refused.
rt_device_identity() copies what the amdgpu device knows after its probe:
VRAM size, type and width, CU count, the GC IP version, KFD's ISA target,
the VBIOS part number, version, build and date, and the FRU board name.
These are the values Linux shows in sysfs and AMDGPU_INFO; nothing is
derived per board.
rt_display_monitor() reports one connector's monitor from the state the
last probe left: the EDID monitor name (drm_edid_get_monitor_name) and the
display_info physical size. No detection, no AUX or DDC traffic.
libdrm's product-name table moves to rt/amdgpu_ids.h so libmlg_drm and the
dext use the same one.
test-dm-offline checks both on its fixture R9700 device.
The offline DM test's register file, VBIOS builder and EDIDs move to
dcn401_fixture.c so other tests can bring up Display Core on the same
synthetic DCN 4.0.1. The DM test now expects the output to refuse to
start without an SDMA engine, which its fixture has none of.
With the device removed (rt/removal.h), every display op returns
-ENODEV, and turning a pattern or output off commits nothing: the
recorded configuration is dropped and the buffers and client go as on a
Linux unplug. Surface imports, copies and checks return -ENODEV;
releasing still works and the client's mapping is returned once the
removal has completed the BO's fences.
The dext releases what the display ops hold in one place
(release_display_owners): at a session close unless a quarantine keeps
every owner, or the device is gone; and when a removal releases a
session that was quarantined, before compute stop and upstream removal.
Tests: test-session-shutdown removes the device under a display agent
with an output on screen and two imports, in a plain session, one that
quarantines during the close, and one quarantined before it (released
only by the removal); test-surface-import removes the device with an
import held; test-dm-offline removes it with the pattern on screen and
turns it off without a register write.
rt_display_output() lights one connector at an exact mode (size and
refresh within 50 mHz of one of its probed modes; -EINVAL otherwise)
with two framebuffers, recording the configuration before it as the
test pattern does; off and stop restore it.
rt_display_present() copies an imported surface's dirty rectangles into
the framebuffer not on screen with SDMA, together with the previous
frame's rectangles (that buffer is a frame behind; a whole frame when
it is stale or the damage overflowed), then flips to it with
drm_client_modeset_commit(), a plane update that completes on vblank.
A failed copy or flip is reported with its step's errno and leaves the
screen on the buffer it was on.
test-dm-offline: no mode at 59.000 Hz and a connector without a sink
are refused; [email protected] is lit with the output marker; a present
without a surface and a present with no output are refused.
For a display agent that mirrors the GPU's monitors as macOS displays:
- rt_display_status() (selector 84 op STATUS) returns the cached
connector state, with no detection and no AUX or DDC traffic, and a
hotplug epoch. The first call registers a monitor DRM client whose
hotplug callback counts events; DM's HPD handling reaches it through
drm_kms_helper_connector_hotplug_event(). Upstream unregisters and
frees the client with the DRM device; its callbacks take no lock of
ours. The report's reserved word is now hotplug_epoch.
- rt_display_modes() (op MODES, connector name required) lists one
connector's probed modes: size, refresh in mHz, pixel clock, the
preferred and interlace flags, and the physical size.
test-dm-offline checks epoch 1 at registration and +1 on a hotplug event,
the [email protected] preferred mode and 600x340 mm of a forced sink, an
empty list for an empty connector and -ENOENT for an unknown one;
test-session-shutdown checks the selector shapes.
test-dm-offline now continues past dm_hw_init the way amdgpu_pci_probe
does: drm_dev_register(), with the PCI function as the DRM device's
parent and a client file opened like amdgpu_driver_open_kms opens one
(its VM with CPU page-table updates, a scheduler no job reaches, the
real amdgpu_driver_postclose_kms), so dumb buffers and framebuffers are
amdgpu's own.
Two connectors get a sink the way Linux emulates a monitor (forced on,
a synthetic EDID through drm_edid_override_set, as video=<conn>:e and
debugfs edid_override do): HDMI-A-1 with a CTA-861 HDMI block and DP-2
with a base block only; DP-1 and DP-3 stay empty. The test then checks:
- connector sysfs as Linux shows it under drm/card0: status unknown
before probing, connected/disconnected after, enabled, dpms, the mode
list and the EDID bytes;
- probe: status, mode count, EDID size and the 1920x1080@60 preferred
mode per connector;
- refusals: an unknown pattern (-EINVAL), an output with no sink and a
connector that does not exist (-ENOENT), each leaving nothing behind;
- show on one connector, then on the other, then on every connected
output (each on its own CRTC), with the pattern bytes in VRAM, an OTG
programmed with 2200x1125 totals and a HUBP scanning out the
framebuffer address;
- off: the recorded configuration restored (enabled=disabled, the OTG's
master enable cleared), and the session-close stop;
- drm_dev_unregister() removing the connector and glue directories.
The fixture runs no DMCUB firmware, so DMUB and power-gate waits time
out and a run takes about three minutes.
test-dm-offline runs the unmodified dm_ip_block (dm_early_init,
dm_sw_init, dm_hw_init, dm_hw_fini, dm_sw_fini) from the host library
against a device with no GPU behind it:
- a synthetic atomfirmware VBIOS (ROM header v2.2, master data table
v2.1, firmware info v3.4, DCE info v4.5, SMU info v4.0, display object
info v1.5 with three DisplayPort and one HDMI path, DDC/HPD records and
a GPIO pin LUT at the DCN 4.0.1 GPIO registers);
- a register file behind amdgpu's indirect register hooks, with only the
DMCUB-present fuse preset;
- 64 MiB of host-memory VRAM under the real amdgpu_ttm_init(), with the
GMC v12 callbacks, and the device interrupt from amdgpu_irq_init();
- the locked linux-firmware DMCUB image from the embedded firmware table.
It reaches: DMCUB image request and validation, the DCN401 DMUB service
with its framebuffer in VRAM, dc_create() on DCN 4.0.1 (BIOS parser,
resource pool, five links: four connectors plus the virtual one), DMUB
hardware init up to the auto-load wait, dc_hardware_init(), and the DRM
CRTCs, planes and connectors (DP-1..3, HDMI-A-1). It stops where silicon
is required: no DMCUB executes the loaded image, so the auto-load wait
and later DMUB commands time out, power-gate status waits time out, and
with no sink every connector stays undetected. Teardown completes.