diff --git a/runtime/nvn_api_cmd.c b/runtime/nvn_api_cmd.c index 054f3794..b05b1da2 100644 --- a/runtime/nvn_api_cmd.c +++ b/runtime/nvn_api_cmd.c @@ -29,7 +29,7 @@ #define MIN_COMMAND_SIZE 512 // NVN_DEVICE_INFO_COMMAND_BUFFER_MIN_COMMAND_SIZE (nvn_api_core.c devinfo) #define MIN_CONTROL_SIZE 256 // NVN_DEVICE_INFO_COMMAND_BUFFER_MIN_CONTROL_SIZE #define CTL_PER_RECORDING 64 // control memory one recording is reported to use -#define COPY_PAGE_SHIFT 12 +#define COPY_PAGE_SHIFT 16 // recording copy index granularity (release_copies) static cmd_t *cmd_of(const Cpu *c) { return arg_p(c, 0); } @@ -158,8 +158,10 @@ static const tex_t *tex_pin(const NVNtexture *nt) { } // ---------- recording copies -// A handle points just past a copy_prefix. Copies are indexed by the 4 KiB page of their control-memory position, so -// adding control memory again releases the copies recorded there without walking every live copy. +// A handle points just past a copy_prefix. Copies are indexed by the 64 KiB block of their control-memory position, so +// adding control memory again releases the copies recorded there without walking every live copy. 4 KiB pages cost +// about 500 lookups per AddControlMemory under the exclusive lock (1.4.3 field: 53 calls a frame, 2 MiB ranges, 3.7 +// copies per page), and the recording threads waited on it. typedef struct { uint64_t magic, bytes, made_at, used_at, deferred; } copy_prefix; // deferred: 0 unknown, 1 none, 2 some _Static_assert(sizeof(copy_prefix) % 8 == 0, "records stay 8-byte aligned"); typedef struct { uintptr_t lo, hi; uint8_t *copy; } cmd_copy;