Files
geramyloveless a46365e5d0 lx: a client mapping waits for the kernel's work on its buffer
rt_lx_gem_map handed a buffer's pages to the client as soon as the buffer
was placed and pinned. amdgpu clears new VRAM with an SDMA fill
(AMDGPU_GEM_CREATE_VRAM_CLEARED for every userspace VRAM buffer), and a
move is an SDMA copy, so a client that wrote through a fresh mapping could
have its writes overwritten when that work ran later. test-scanout saw it
after the merge of 238 changed the fixture's scheduling: a framebuffer
filled through its mapping scanned out zeros. The mapping now waits, as
the Linux fault path does (ttm_bo_vm_fault_idle), for the buffer's
kernel-usage fences, bounded at 10 s; a timeout is the mapping's error.

test-scanout prints each display pipe's surface (DC's and the registers')
and the primary plane's framebuffer when a check fails.
2026-10-03 23:12:48 -07:00

50 lines
2.2 KiB
C

/* The display output on the fixture device (scanout_fixture.c) and what its
* clients (libmlg_drm/libdrm/tests/test_scanout.c, vulkan/tests/
* test_radv_scanout.c) ask of it. No kernel types. */
#ifndef TEST_SCANOUT_H
#define TEST_SCANOUT_H
#include <stdint.h>
struct pci_dev;
/* The fixture device with its display, flip interrupts running, an output
* lit on HDMI-A-1 at 1920x1080 and a desktop frame of @desktop on it. */
struct pci_dev *scanout_fixture_start(uint32_t desktop);
/* The output off, the desktop surface removed, the device stopped. */
void scanout_fixture_finish(void);
/* The libdrm-mlg client's checks; 0 on success. */
int test_scanout(void);
/* The value the client leaves on the primary plane at its end (the main
* program then checks that the client's death takes it off). */
#define TEST_SCANOUT_LEFT_ON_SCREEN 0x00c0ffeeu
/* Stop or resume the fixture's vblank (flip) interrupts. */
void scanout_fx_hold_vblank(int hold);
/* The 32-bit pixel at byte @offset of the surface pipe @pipe scans out. */
uint32_t scanout_fx_pipe_pixel(unsigned int pipe, uint64_t offset);
/* A bit per enabled pipe whose surface starts with @value. */
unsigned int scanout_fx_pipes_showing(uint32_t value);
/* The framebuffer on the output CRTC's primary plane: 1 with its size and
* modifier, 0 when there is none. */
int scanout_fx_primary_fb(uint32_t *width, uint32_t *height, uint64_t *modifier);
/* An overlay plane on the output's CRTC: 1 with its rectangle, 0 when
* none is. */
int scanout_fx_overlay(int32_t *x, int32_t *y, uint32_t *w, uint32_t *h);
/* Each pipe's surface as DC has it and as its registers have it, on
* stderr (for a failed check). */
void scanout_fx_report(void);
/* Whether the DRM device has a master. */
int scanout_fx_has_master(void);
/* A whole desktop frame of @value, presented as a display agent does. */
int scanout_fx_desktop_present(uint32_t value);
void scanout_fx_desktop_stats(uint64_t *received, uint64_t *flipped, int *error);
/* The output off and lit again (rt_display_off, rt_display_output). */
int scanout_fx_relight(void);
/* LX_SCANOUT ATTACH from a second client: its result. */
int scanout_fx_second_client_attach(void);
#endif