v4l2: surface error_idx + errno on VIDIOC_S_EXT_CTRLS failure
ampere-av1 Phase 2.1 + 3 diagnostic: log which control failed validation on S_EXT_CTRLS rejection so debug iterations can identify the offending CID without strace. Pre-validation failures (error_idx >= count) log as "<pre-validation>" with the syscall errno surfacing the root reason. Already informative on ampere — surfaces the pre-existing benign H264 + HEVC device-init failures on the vpu981 AV1 fd as count=2 / failed_cid=0 (those go through (void)cast at context.c:450/473 by design). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+23
-1
@@ -433,6 +433,7 @@ static int v4l2_ioctl_controls(int video_fd, int request_fd, unsigned long ioc,
|
||||
unsigned int num_controls)
|
||||
{
|
||||
struct v4l2_ext_controls controls;
|
||||
int rc;
|
||||
|
||||
memset(&controls, 0, sizeof(controls));
|
||||
|
||||
@@ -444,7 +445,28 @@ static int v4l2_ioctl_controls(int video_fd, int request_fd, unsigned long ioc,
|
||||
controls.request_fd = request_fd;
|
||||
}
|
||||
|
||||
return ioctl(video_fd, ioc, &controls);
|
||||
rc = ioctl(video_fd, ioc, &controls);
|
||||
if (rc < 0) {
|
||||
/* ampere-av1 Phase 2.1 diag: surface error_idx so the caller's
|
||||
* error path knows which CID failed validation. error_idx >=
|
||||
* count means the failure was pre-validation (e.g., bad
|
||||
* request_fd). errno carries the syscall-level reason. */
|
||||
const char *failed_cid_label = "<pre-validation>";
|
||||
unsigned int failed_size = 0;
|
||||
if (controls.error_idx < num_controls) {
|
||||
failed_size = control_array[controls.error_idx].size;
|
||||
(void)failed_cid_label; /* keep symbol if logger truncates */
|
||||
}
|
||||
request_log("v4l2_ioctl_controls: rc=%d errno=%d (%s) "
|
||||
"ioc=0x%lx error_idx=%u count=%u "
|
||||
"failed_cid=0x%x failed_size=%u\n",
|
||||
rc, errno, strerror(errno), ioc,
|
||||
controls.error_idx, num_controls,
|
||||
controls.error_idx < num_controls
|
||||
? control_array[controls.error_idx].id : 0,
|
||||
failed_size);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
int v4l2_get_controls(int video_fd, int request_fd,
|
||||
|
||||
Reference in New Issue
Block a user