iter8 Phase 7 IMP-1 experiment: LIBVA_V4L2_ZERO_CAPTURE pre-zero gate
Env-gated CAPTURE pre-zero in BeginPicture after cap_pool_acquire. With LIBVA_V4L2_ZERO_CAPTURE=1, the slot mmap region is memset 0 before the kernel decode runs. Discriminates "kernel writes partial then aborts" from "kernel writes nothing, buffer carries stale residue from prior allocation." Per Phase 5 IMP-1: the 16x32 patch in libva H.264 frame 1 may be either real partial kernel write OR stale residue. This gate makes the next sweep run deterministically zero the buffer; if the patch still appears after, the kernel really writes it; if not, it was stale. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -321,6 +321,29 @@ VAStatus RequestBeginPicture(VADriverContextP context, VAContextID context_id,
|
||||
if (cap_slot == NULL)
|
||||
return VA_STATUS_ERROR_ALLOCATION_FAILED;
|
||||
surface_bind_slot(surface_object, cap_slot);
|
||||
|
||||
/*
|
||||
* iter8 Phase 7 IMP-1 experiment: env-gated CAPTURE buffer
|
||||
* pre-zero. LIBVA_V4L2_ZERO_CAPTURE=1 wipes the slot's mmap'd
|
||||
* region before kernel decode. Discriminates "kernel writes
|
||||
* partial then aborts" from "kernel writes nothing and we
|
||||
* see stale residue."
|
||||
*/
|
||||
{
|
||||
static const char *zero_env = NULL;
|
||||
static bool zero_env_checked = false;
|
||||
if (!zero_env_checked) {
|
||||
zero_env = getenv("LIBVA_V4L2_ZERO_CAPTURE");
|
||||
zero_env_checked = true;
|
||||
}
|
||||
if (zero_env != NULL && zero_env[0] == '1') {
|
||||
unsigned int b;
|
||||
for (b = 0; b < cap_slot->buffers_count; b++)
|
||||
if (cap_slot->map[b] != NULL)
|
||||
memset(cap_slot->map[b], 0,
|
||||
cap_slot->map_lengths[b]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user