Commit Graph

297 Commits (master)

Author SHA1 Message Date
Dean Lee 0d3eec385c
camera_qcom2: new functions device_acquire & device_config (#22077)
* new function device_acquire & device_config

* add space

* apply reviews

* use the specified struct for each command

* fix typo

* apply review

* remove static

* revert device_control
2021-08-31 07:21:40 -07:00
Dean Lee ee5ef4dab2
camera_qcom2: use macros for link control operations (#22088) 2021-08-30 22:10:18 -07:00
Dean Lee d9baaf7eb9
loggerd: create encoder threads from cameras_logged (#21875) 2021-08-30 19:33:00 -07:00
Dean Lee cf4ad99554
camera_qcom2: refactor open_v4l_by_name_and_index (#22067)
* refactor

* small cleanup

Co-authored-by: Willem Melching <willem.melching@gmail.com>
2021-08-30 17:12:22 -07:00
Dean Lee 31230e5b60
retry ioctls while errno == EINTR (#22054) 2021-08-30 16:07:34 -07:00
Dean Lee 37dda3d6bf
camera_qcom2: remove req_mgr_session_info from CameraState (#22059)
* remove req_mgr_session_info from CameraState

* handle should be int32_t
2021-08-30 15:32:31 -07:00
Dean Lee 7a80bf7fcc
camera_qcom2: fix memory leaks in camera_open (#22061) 2021-08-30 14:59:04 -07:00
Dean Lee 862f93f7f1
camera_qcom2.cc : fix wrong LOGD order (#22072) 2021-08-30 09:21:35 -07:00
Dean Lee 0f4227f42b
qcom2/enqueue_buffer: use macro CAM_MEM_FLAG_HW_READ_WRITE (#22060) 2021-08-28 17:43:50 -07:00
Dean Lee ffb1dd019e
camera_qcom2.cc: use V4L_EVENT_CAM_REQ_MGR_EVENT (#22057) 2021-08-28 14:49:56 -07:00
Dean Lee df6432c8cd
camera_qcom2: remove unused variables from MultiCameraState (#22058) 2021-08-28 14:44:30 -07:00
Adeeb Shihadeh 54a4eeb0fc Revert "tici: give loggerd rt priority (#21503)"
This reverts commit 7e2752c878.
2021-08-22 16:57:53 -07:00
Adeeb Shihadeh 7e2752c878
tici: give loggerd rt priority (#21503)
* give loggerd rt priority

* assert

* little more

Co-authored-by: Comma Device <device@comma.ai>
2021-08-20 21:27:31 -07:00
Dean Lee e646febaae
camerad: remove unused macros and global (#21970) 2021-08-19 14:49:16 -07:00
Dean Lee 74ecbbed63
cameras_qcom2.cc: add a missing newline (#21956) 2021-08-18 10:37:05 +02:00
Willem Melching a39873872d
refactor loggerd: trigger rotate in encoder thread (#21860)
* trigger rotate in eoncode thread

* rotate in time

* lgtm

* dcam trigger rotate on C3

* check trigger rotate field

* Use >=

* add rotator thread

* set cnt to 0

* test encodeIdx is increasing across segments

* test both segmentId and encodeId

* fix encodeIdx

* no thread needed

* add log for failed to encode

* stricter C3 test, dont check start encodeId on C2 dcam

* only update last_camera_seen_tms when considered for rotate

Co-authored-by: deanlee <deanlee3@gmail.com>
2021-08-06 11:10:33 +02:00
arfy slowy d74def61f8
fix: spelling typos (#21861)
* fix: typo spelling grammar

* revert

* Update selfdrive/locationd/calibrationd.py

* more revert

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-08-05 12:05:49 -07:00
Willem Melching 25de93d133
C3 AE improvements (#21698)
* AE improvements

* boardd: also use gain to compute IR brightness

* use default rect for DM autoexposure

* more smooth

* whitespace

* camerad cpu usage

* hcg on is slightly better for noise

* hysteris around high conversion gain

* improve i2c timing

* use AB contexts

* HCG default off

* run at 10 hz

* stay in context A for now

* remove ae thread

* wait till next frame is started before sending i2c

* back at 20fps

* add comment and filter across 3 evs

* remove context switch code

* tuning

* recomened without HCG is 0.8x
2021-08-05 16:34:36 +02:00
Dean Lee fefc70b4ca
hw.h: move Hardware-related paths to namespace Path (#21826)
* refactor getenv and path

* apply review
2021-08-04 13:29:03 +02:00
Adeeb Shihadeh 4c0caf7f7e 100 yuv buffers for all 2021-07-26 14:02:49 -07:00
Willem Melching b6b0393e2d
Revert AE changes (#21682)
* Revert AE changes

* keep YUV buffer count
2021-07-22 11:22:19 -07:00
Willem Melching b35f6871cb
AE: revert changes to min grey target (#21648) 2021-07-19 10:37:43 +02:00
Willem Melching 0d9e7ad241
only 100 yuv buffers on C2 (#21622) 2021-07-16 11:59:30 +02:00
Willem Melching 3ad40963cc
tici: AE sane default values (#21610)
* tici: AE sane default values

* set exposure time

* remove comment

* set dc gain variable

* whitespace
2021-07-15 16:11:27 +02:00
Willem Melching 63c9b56063
tici: improve AE (#21493)
* simplify histogram calculation

* add debug prints

* faster AE

* revert that

* lower log level

* use minimum recomended gains from datasheet

* use define

* fix min gain

* dynamic grey target

* fix build

* add low pass

* more stable rounding

* increase max gain

* always enable HCG

* correctly set min ev

* fix analog gain

* remove unused variable

* fix build

* move recomended gain into cost function

* tweak cost function a bit

* small LPF on desired ev

* fix typo

* lower ts

* clean up defines

* that was used in common

* add cast

* less cost is fine

* fix tests

* whitespace

* filtering is broken

* put back

* clip gain changes instead

* cost function tweaking

* Only go below recomended gain when absolutely necessary

* small penalty on changing gains
2021-07-13 23:33:50 +02:00
Adeeb Shihadeh 4738fe0e45
increase yuv buffer count to hold 5s (#21528)
* increase yuv buffer count to hold 5s

* bump cereal
2021-07-10 14:46:20 -07:00
Willem Melching 47be6c751e
Refactor camerad exposure logging (#21506)
* simplify gain logging

* clean up metadata

* log grey fractions

* those are not used

* set grey fracs in message

* fix qcom
2021-07-08 15:22:00 +02:00
Willem Melching 8d075048b3
tici: Switch to 1D dead pixel correction (#21467) 2021-07-02 14:01:43 +02:00
Dean Lee 73d741b7be
fix webcam crash when failed to read video frame (#21272) 2021-06-15 12:25:05 +02:00
Dean Lee e4e669bb0f
add space after function name and if statement (#21225) 2021-06-11 10:17:52 +02:00
Maxime Desroches 03df1b08bb
Convert C++ while loops from int to bool (#21214) 2021-06-09 21:09:21 -07:00
Adeeb Shihadeh 9e94fb17cf fix qcom and qcom2 builds 2021-06-08 16:44:05 -07:00
Dean Lee c53cb5d570
Use C++ header files instead of C header files. (#21192)
* use cstring instead of string.h

* use cstdio instead of stdio.h

* remove inttypes.h

* use cstdlib instead of stdlib.h

* use cstdint instead of stdint.h

* #include <cstddef>

* cstdlib

* use cmath

* remove stddef.h

* use cassert

* use csignal

* use ctime

* use cerror

* rebase master
2021-06-08 13:46:22 -07:00
Dean Lee b06b3ecb60
Use full include path (#21194) 2021-06-08 12:09:30 -07:00
Dean Lee 65e0b1e699
Cleanup util.h (#20849)
* cleanup util.h

* fix build error:omx_encoder.cc:408: undefined reference to do_exit

* fix build error

* rebase master

* move helper functions back to util

* ExitHandleHelper->ExitHandlerHelper

* std::clamp

* struct ExitHandlerHelper to class

* rebase master

* cleanup

* restore ExitHandler

* prefer cassert
2021-06-01 16:53:12 +02:00
Adeeb Shihadeh cf6d133638
fix up model tests + tools (#21071)
* unlogger: send yuv stream

* fix up model test tools

* fix unlogger

* rename model replay

* bump cereal

* test in actions

* no ci for now
2021-05-28 23:08:08 -07:00
Adeeb Shihadeh 8fdbbdef73
remove oneplus camera params (#21047)
* remove oneplus camera params

* align
2021-05-26 17:46:43 -07:00
ShaneSmiskol a457144357
Improve focus when using snapshot (#21031) 2021-05-26 17:17:04 -07:00
George Hotz f43671c987
Move MCLK from 24 -> 19.2 mhz + Add accuracy in sidebar (#20960)
* wip

* one day i'll flip that right

Co-authored-by: Comma Device <device@comma.ai>
2021-05-18 22:37:33 -07:00
Dean Lee 0495426535
Cleanup includes (#20925)
* remove #include <pthread.h>

* remove #include<stdbool.h> for cc files

* remove #include<iostream>
2021-05-17 10:31:31 +02:00
Dean Lee 7222d0f20d
Cleanup selfdrive/ includes (#20822)
* cleanup include path

* continue

* format includes

* fix testraw.cc

* remove include path from SConstruct

* regroup

* rebase master

* almost done

* apply review

* rename FileReader.xx to filereader.xx

* rename Unlogger.x->unlogger.x

* rename FrameReader.xx -> framereader.xx

* apply reviews

* ui.h

* continue

* fix framebuffer.cc build error:mv util.h up

* full path to msm_media_info

* fix qcom2 camerad

Co-authored-by: Comma Device <device@comma.ai>
2021-05-08 22:15:17 -07:00
Willem Melching ab319d4f54
Replace ifdef with hw abstraction layer (#20843)
* Replace ifdefs with hardware abstraction layer (#20801)

* add type to class hadwareXXX

* replace ifdefs with hardware layer

* continue

* continue

* new function get_driver_view_transform

* full path to hw.h

* fix build error setup.cc

* apply review

* fix typo

* fix deprecated error:replace deprecated fromPath with new

* fix build error

* Fixes after ifdef clenaup (#20842)

* inheritance doesnt work with static

* fix debayer

* small cleanup

* Update selfdrive/camerad/cameras/camera_common.cc

* Update selfdrive/ui/qt/offroad/settings.cc

* Update selfdrive/common/modeldata.h

* flip conditions

* fix comment

Co-authored-by: Dean Lee <deanlee3@gmail.com>
2021-05-06 14:39:05 +02:00
Willem Melching 3a95d3ccaa Revert "Replace ifdefs with hardware abstraction layer (#20801)"
This reverts commit 757d2923d2.
2021-05-06 12:29:30 +02:00
Dean Lee 757d2923d2
Replace ifdefs with hardware abstraction layer (#20801)
* add type to class hadwareXXX

* replace ifdefs with hardware layer

* continue

* continue

* new function get_driver_view_transform

* full path to hw.h

* fix build error setup.cc

* apply review

* fix typo

* fix deprecated error:replace deprecated fromPath with new

* fix build error
2021-05-06 11:41:46 +02:00
Adeeb Shihadeh 8a280fbb8e bump cereal 2021-05-03 20:47:11 -07:00
iejMac 4866a39244
cereal: SubMaster refactor, update is now void (#20730)
* cereal: SubMaster refactor, update is now void

* bump cereal

* mistake

* update void

* checks

* semicolon

* Update selfdrive/camerad/cameras/camera_frame_stream.cc

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* check sensorEvent

* update cereal

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-04-22 22:13:32 -07:00
Dean Lee f0a1a6e4d6
camerad: SubMaster never updated (#20651)
* fix sm has not been updated

* update submaster in processing driver cam thread

* move Subbmaster to driver camera thread

* cleanup

Co-authored-by: Comma Device <device@comma.ai>
2021-04-13 15:26:24 -07:00
Dean Lee 5a3c22d804
camerad: refactor RGBToYUVState into a class (#20310)
* struct RGBToYUVState to class Rgb2Yuv

* clFinish

* blank line

* rebase master

* use event
2021-04-12 22:42:53 -07:00
Dean Lee cf80675369
Use std::size for element counts (#20654) 2021-04-12 12:22:22 +02:00
Adeeb Shihadeh 4e03e37381 Revert "CameraBuf: avoid busy waiting on safe_queue (#20643)"
This reverts commit e562a69a4d.
2021-04-11 17:56:38 -07:00
Dean Lee e562a69a4d
CameraBuf: avoid busy waiting on safe_queue (#20643)
* 20ms timeout

* Update camera_common.cc

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-04-11 16:49:38 -07:00
Willem Melching ae094042ad
add putBool/getBool wrappers to cython params class (#20611)
* add putBool/getBool wrappers to cython class

* use new API

* some more puts

* fix mockparams arguments

* add get_bool to MockParams

* typo
2021-04-07 15:36:37 +02:00
Willem Melching dfedf9d0de
snapshot.py only broadcast front frame when necessary (#20612)
* snapshot.py only broadcast front frame when necessary

* whitespace
2021-04-07 14:58:38 +02:00
Dean Lee d40891739f
refactor webcam, use common run_camera function (#20555)
* run camera in common function run_camera

continue

remove relase

clEnqueueReadBuffer

cleanup

blank line

remove cideo_cap.release

con tinue

* get camera id from env

* assert
2021-04-05 17:04:37 -07:00
Dean Lee 9b9bdd3da5
Added function power_set_wait, fix munmap invalid pointer error. (#20189)
* added function power_set_wait_cmd

* cleanup

* rename power_set_wait_cmd to power_set_wait

* rename delay to delay_ms
2021-04-02 21:17:42 -07:00
Dean Lee 26fa6e1644
camerad_qcom: init sensors with array (#20275)
Co-authored-by: ZwX1616 <zwx1616@gmail.com>
2021-04-02 21:13:37 -07:00
Dean Lee 540b853c9f
init frame_length in camera_init (#20261) 2021-04-02 21:10:48 -07:00
Dean Lee dd54c18bb7
camera_qcom: added new function cam_ioctl (#20184)
* added new function cam_ioctl

* static
2021-04-02 20:52:08 -07:00
Dean Lee 4e68bab6f6
refactor set_driver_exposure_target (#20327)
* driver_cam_set_exp_target

* rebase master

* rebase master

* rename to driver_cam_auto_exposure
2021-04-02 20:47:46 -07:00
Dean Lee 5e6e9df407
camera_qcom2: move the common file descriptors to MultiCameraState (#20182)
* move the common file descriptors to MultiCameraState

* use unique_fd for file descriptors

* done

* fix build

Co-authored-by: ZwX1616 <zwx1616@gmail.com>
2021-03-30 19:43:09 -07:00
Dean Lee 98e55996f6
Params: python-like interface (#20506)
* rebase master

* delete outdated test_params.c

* putBool & more robust getBool

* putBool(SshEnabled)
2021-03-30 12:54:59 +02:00
ZwX1616 97133a8fac
camerad jenkins box test (#20413)
* separate test

* send

* update test

* snapshot is rgb

* this does not belong here

* clean up

* tici

* no if

* no black frames

* flaky leds

* rename and cleanup

* should be stable and avoid lucky pass

* print

* logical and

* run in jenkins

* source profile on tici

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-03-26 13:23:18 -07:00
ZwX1616 3f221bd5ab
update line length (#20391)
Co-authored-by: Comma Device <device@comma.ai>
2021-03-17 17:35:11 -07:00
Dean Lee dd4fa036e9
CameraBuf: remove class variable yuv_metas (#20376) 2021-03-16 20:50:11 -07:00
Dean Lee 9df3bab96a
CameraBuf::acquire: remove reference frame_data, use cur_frame_data to keep consistency (#20361) 2021-03-16 11:11:19 +01:00
Dean Lee 3e663529bd
cameras:move cameras_supported to the top (#20370)
* move cameras_supported to the top

* remove extern CameraInfo cameras_supported from camera_common.h
2021-03-16 11:09:25 +01:00
Dean Lee ecfb9d88d0
camera_frame_stream.h: remove unused variables (#20340) 2021-03-13 14:30:40 -08:00
Dean Lee 4c225c6e1d
camera_qcom2: add std::mutex exp_lock (#20183)
* add std::mutex exp_lock

* auto &meta_data
2021-03-12 20:03:15 -08:00
Dean Lee e654d9ddf9
cleanup camera_qcom const structs (#20251)
* move actuator_ringing_params from global to function actuator_move

* remove varaible infinity_dac from CameraState

* static actuator_ringing_params

* continue

* rebase master
2021-03-12 19:52:04 -08:00
ZwX1616 65bb979c34
set_exposure_target test (#20318)
* build

* remove junk

* clean up

* clean up rebase

* new patterns

* add gts

* add to jenkis

* this more useful

* typo

* test only

* Update Jenkinsfile

* test flag

* remove from jenkins

* these should all just be common:wq

* oops

* unigt

* add to unit tests?

* build all is fine

Co-authored-by: Comma Device <device@comma.ai>
2021-03-12 17:40:50 -08:00
Adeeb Shihadeh 90795fc773
reduce log spam (#20330)
* fix big spammers

* my favorite test failure

* remove that one

* went down a bit more
2021-03-12 11:45:29 -08:00
Dean Lee 92e69e8b75
refactor function alloc (#20192) 2021-03-11 17:40:33 -08:00
Dean Lee 8a966de2b6
use loop index (#20307) 2021-03-11 17:24:02 -08:00
ZwX1616 b734647fb7
only destroy if inited (#20317) 2021-03-11 13:53:24 -08:00
Dean Lee 8abc85ea5e
LapConv::Update: use CL_TRUE instead of true (#20311) 2021-03-11 15:01:44 +01:00
Comma Device bcbcc03dc7 revert to divide first 2021-03-08 13:53:24 -08:00
Dean Lee 6e1730a3e8
camera_qcom: better error message for apply exp error (#20265) 2021-03-08 10:42:31 +01:00
Dean Lee 74afec9f15
camera_qcom: change unsigned int to uint32_t (#20262) 2021-03-08 10:41:07 +01:00
Dean Lee e66f816879
cameras_qcom: use macros for actuator moving dir (#20259)
* use macro

* revert change
2021-03-08 10:40:15 +01:00
Dean Lee e0cc95a565
camera_qcom: remove eeprom related stuff (#20254) 2021-03-08 10:19:43 +01:00
Dean Lee 80cc0eefc9
modeldata.h: new function get_model_yuv_transform (#20257) 2021-03-08 10:10:13 +01:00
Dean Lee 59698344a2
camera_qcom: move opencl stuff into class LapConv (#20180)
* class RGB2Gray

* rename Rgb2Grey to LapConv

* rebase master

* rebase master
2021-03-04 20:41:59 -08:00
Dean Lee 2f46ddf779
oneplus cleanup (continue) (#20212)
* cleanup cameras_supported

* use macro

* remove ois_fd

* remove ois_init_settings

* cleanup sensor_i2c.h

* apply_exposure

* better comment

* remove int err

* init apply_exposure in camera_init

* continue

* remove event startupOneplus

* Revert "remove event startupOneplus"

This reverts commit f5b16e864399bcf4dc7c48fc07a43e35c47e7dc2.

* move camera_init after xxx_apply_exposure
2021-03-04 11:25:53 -08:00
Comma Device 0d036de205 better transition 2021-03-04 11:08:52 -08:00
Dean Lee d3a71dcf65
camerad: fix thumbnail cnt (#20236) 2021-03-03 20:14:37 -08:00
ZwX1616 ab87aa1da8
clean up tici camera registers (#20209)
* clean up registers

* clean up more

Co-authored-by: Comma Device <device@comma.ai>
2021-03-03 19:29:08 -08:00
Comma Device a5e9c603bd force same gamma 2021-03-03 14:28:58 -08:00
Dean Lee f5109d9207
cameras_qcom: use std::mutex (#20181) 2021-03-03 11:48:49 +01:00
Dean Lee 824e4531d7
num_cids should be 1 (#20190) 2021-03-03 11:42:49 +01:00
robbederks 491309b639
Tici MIPI config (#20205)
* remove non-default mipi timings and preamble lengths

* actual correct settle count
2021-03-02 14:10:32 +01:00
Adeeb Shihadeh 07ab081a42
oneplus cleanup (#20200)
* start cleanup

* cleanup camerad

* remove unused

* little more

Co-authored-by: Comma Device <device@comma.ai>
2021-03-01 17:14:03 -08:00
ZwX1616 dd2bba0b42
Tici art4 (#20210)
* adjust gamma

* trust that light

* trust that chart

* unsrgb

Co-authored-by: Comma Device <device@comma.ai>
2021-03-01 16:35:43 -08:00
Dean Lee afcbf60cad
camera_qcom.h: regroup variables by usage (#20196) 2021-03-01 14:49:04 +01:00
Dean Lee e6c47916a2
(msm_sensor_power_setting*) type conversions are not required (#20191) 2021-03-01 12:17:30 +01:00
Dean Lee 468dc3f5a4
Move duplicate function declarations to camera_common.h (#20176) 2021-02-26 20:35:21 -08:00
Dean Lee 2f718d28e4
camerad: remove param pix_ptr from set_exposure_target (#20157) 2021-02-26 14:42:27 +01:00
Comma Device e3afd72265 gamma last and only one ccm 2021-02-25 16:37:28 -08:00
Comma Device ab694dbace better gain values 2021-02-25 16:34:15 -08:00
ZwX1616 28b80844c9
tici camerart 3.1 (#20143)
Co-authored-by: Comma Device <device@comma.ai>
2021-02-23 14:05:09 -08:00
ZwX1616 d8ddc1208e
tici camerart III: prehistoric visuals (#20012)
* reworked

* add ref

* f16

* faster

* extended tm

* fix hdr

* Revert "extended tm"

This reverts commit 55ba3ae320.

* reduce static/temporal noise

* split kernels to sync max

* no print

* cleanup qcom2

* optimize

* tune DC

* doesnt work

* minor fix

* adaptive

* smoothen HCG switch

* t

* histogram ceiling

* recalulate params

* group_hold

* less contrast

* recalibrate ccm

* better ae

* better ae revised

* made some changes

* clean up

* midtones

* some improvements

* more

* cleanup

* remove more junk

* lgtm

Co-authored-by: Comma Device <device@comma.ai>
2021-02-21 23:23:40 -08:00