From 14586227297117c65c44956daf548c90a4a4b461 Mon Sep 17 00:00:00 2001 From: Markus Fritsche Date: Sat, 25 Apr 2026 21:57:33 +0000 Subject: [PATCH] src/context.c: temporary diagnostic logging in CreateContext Added request_log() calls at every failure path inside RequestCreateContext to identify exactly which guard fires when Brave's vaCreateContext fails on ohm. Will revert these before final. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/context.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/context.c b/src/context.c index 13662ed..4ebc8da 100644 --- a/src/context.c +++ b/src/context.c @@ -72,17 +72,25 @@ VAStatus RequestCreateContext(VADriverContextP context, VAConfigID config_id, int rc; video_format = driver_data->video_format; - if (video_format == NULL) + if (video_format == NULL) { + request_log("CreateContext: video_format is NULL\n"); return VA_STATUS_ERROR_OPERATION_FAILED; + } output_type = v4l2_type_video_output(video_format->v4l2_mplane); capture_type = v4l2_type_video_capture(video_format->v4l2_mplane); + request_log("CreateContext: mplane=%d output_type=%u capture_type=%u\n", + video_format->v4l2_mplane, output_type, capture_type); config_object = CONFIG(driver_data, config_id); if (config_object == NULL) { + request_log("CreateContext: config_object NULL for config_id %u\n", + config_id); status = VA_STATUS_ERROR_INVALID_CONFIG; goto error; } + request_log("CreateContext: profile=%d width=%d height=%d\n", + config_object->profile, picture_width, picture_height); id = object_heap_allocate(&driver_data->context_heap); context_object = CONTEXT(driver_data, id); @@ -119,6 +127,8 @@ VAStatus RequestCreateContext(VADriverContextP context, VAConfigID config_id, rc = v4l2_set_format(driver_data->video_fd, output_type, pixelformat, picture_width, picture_height); if (rc < 0) { + request_log("CreateContext: S_FMT(OUTPUT) failed for pixelformat 0x%x\n", + pixelformat); status = VA_STATUS_ERROR_OPERATION_FAILED; goto error; } @@ -126,9 +136,13 @@ VAStatus RequestCreateContext(VADriverContextP context, VAConfigID config_id, rc = v4l2_create_buffers(driver_data->video_fd, output_type, surfaces_count, &index_base); if (rc < 0) { + request_log("CreateContext: CREATE_BUFS failed surfaces=%d\n", + surfaces_count); status = VA_STATUS_ERROR_ALLOCATION_FAILED; goto error; } + request_log("CreateContext: S_FMT + CREATE_BUFS ok, index_base=%u\n", + index_base); /* * The surface_ids array has been allocated by the caller and @@ -155,6 +169,7 @@ VAStatus RequestCreateContext(VADriverContextP context, VAConfigID config_id, rc = v4l2_query_buffer(driver_data->video_fd, output_type, index, &length, &offset, 1); if (rc < 0) { + request_log("CreateContext: QUERYBUF idx=%u failed\n", index); status = VA_STATUS_ERROR_ALLOCATION_FAILED; goto error; } @@ -162,6 +177,8 @@ VAStatus RequestCreateContext(VADriverContextP context, VAConfigID config_id, source_data = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, driver_data->video_fd, offset); if (source_data == MAP_FAILED) { + request_log("CreateContext: mmap len=%u offset=%u failed\n", + length, offset); status = VA_STATUS_ERROR_ALLOCATION_FAILED; goto error; } @@ -173,12 +190,14 @@ VAStatus RequestCreateContext(VADriverContextP context, VAConfigID config_id, rc = v4l2_set_stream(driver_data->video_fd, output_type, true); if (rc < 0) { + request_log("CreateContext: STREAMON(OUTPUT) failed\n"); status = VA_STATUS_ERROR_OPERATION_FAILED; goto error; } rc = v4l2_set_stream(driver_data->video_fd, capture_type, true); if (rc < 0) { + request_log("CreateContext: STREAMON(CAPTURE) failed\n"); status = VA_STATUS_ERROR_OPERATION_FAILED; goto error; }