camerad: cleanup CameraBuf::acquire (#25737)

* cleanup

* add that back

* less indent

Co-authored-by: Comma Device <device@comma.ai>
pull/25813/head
Dean Lee 3 years ago committed by GitHub
parent 5bb230cde4
commit 78fd303d50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 23
      system/camerad/cameras/camera_common.cc
  2. 1
      system/camerad/cameras/camera_common.h

@ -116,30 +116,24 @@ bool CameraBuf::acquire() {
if (camera_bufs_metadata[cur_buf_idx].frame_id == -1) { if (camera_bufs_metadata[cur_buf_idx].frame_id == -1) {
LOGE("no frame data? wtf"); LOGE("no frame data? wtf");
release();
return false; return false;
} }
cur_frame_data = camera_bufs_metadata[cur_buf_idx]; cur_frame_data = camera_bufs_metadata[cur_buf_idx];
cur_yuv_buf = vipc_server->get_buffer(yuv_type); cur_yuv_buf = vipc_server->get_buffer(yuv_type);
cl_mem camrabuf_cl = camera_bufs[cur_buf_idx].buf_cl;
cl_event event;
double start_time = millis_since_boot();
cur_camera_buf = &camera_bufs[cur_buf_idx]; cur_camera_buf = &camera_bufs[cur_buf_idx];
debayer->queue(q, camrabuf_cl, cur_yuv_buf->buf_cl, rgb_width, rgb_height, &event); double start_time = millis_since_boot();
cl_event event;
debayer->queue(q, camera_bufs[cur_buf_idx].buf_cl, cur_yuv_buf->buf_cl, rgb_width, rgb_height, &event);
clWaitForEvents(1, &event); clWaitForEvents(1, &event);
CL_CHECK(clReleaseEvent(event)); CL_CHECK(clReleaseEvent(event));
cur_frame_data.processing_time = (millis_since_boot() - start_time) / 1000.0; cur_frame_data.processing_time = (millis_since_boot() - start_time) / 1000.0;
VisionIpcBufExtra extra = { VisionIpcBufExtra extra = {
cur_frame_data.frame_id, cur_frame_data.frame_id,
cur_frame_data.timestamp_sof, cur_frame_data.timestamp_sof,
cur_frame_data.timestamp_eof, cur_frame_data.timestamp_eof,
}; };
cur_yuv_buf->set_frame_id(cur_frame_data.frame_id); cur_yuv_buf->set_frame_id(cur_frame_data.frame_id);
vipc_server->send(cur_yuv_buf, &extra); vipc_server->send(cur_yuv_buf, &extra);
@ -147,10 +141,6 @@ bool CameraBuf::acquire() {
return true; return true;
} }
void CameraBuf::release() {
// Empty
}
void CameraBuf::queue(size_t buf_idx) { void CameraBuf::queue(size_t buf_idx) {
safe_queue.push(buf_idx); safe_queue.push(buf_idx);
} }
@ -328,7 +318,6 @@ void *processing_thread(MultiCameraState *cameras, CameraState *cs, process_thre
// this takes 10ms??? // this takes 10ms???
publish_thumbnail(cameras->pm, &(cs->buf)); publish_thumbnail(cameras->pm, &(cs->buf));
} }
cs->buf.release();
++cnt; ++cnt;
} }
return NULL; return NULL;

@ -102,7 +102,6 @@ public:
~CameraBuf(); ~CameraBuf();
void init(cl_device_id device_id, cl_context context, CameraState *s, VisionIpcServer * v, int frame_cnt, VisionStreamType yuv_type); void init(cl_device_id device_id, cl_context context, CameraState *s, VisionIpcServer * v, int frame_cnt, VisionStreamType yuv_type);
bool acquire(); bool acquire();
void release();
void queue(size_t buf_idx); void queue(size_t buf_idx);
}; };

Loading…
Cancel
Save