mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 20:03:53 +08:00
camerad: build camerad on PC (#25726)
* compile camerad on PC
* scons cleanup
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: 29f9c536b4
This commit is contained in:
@@ -99,9 +99,6 @@ if arch == "larch64":
|
||||
"#third_party/libyuv/larch64/lib",
|
||||
"/usr/lib/aarch64-linux-gnu"
|
||||
]
|
||||
cpppath += [
|
||||
"#system/camerad/include",
|
||||
]
|
||||
cflags = ["-DQCOM2", "-mcpu=cortex-a57"]
|
||||
cxxflags = ["-DQCOM2", "-mcpu=cortex-a57"]
|
||||
rpath += ["/usr/local/lib"]
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
Import('env', 'arch', 'cereal', 'messaging', 'common', 'gpucommon', 'visionipc')
|
||||
|
||||
libs = ['m', 'pthread', common, 'jpeg', 'OpenCL', 'yuv', cereal, messaging, 'zmq', 'capnp', 'kj', visionipc, gpucommon]
|
||||
libs = ['m', 'pthread', common, 'jpeg', 'OpenCL', 'yuv', cereal, messaging, 'zmq', 'capnp', 'kj', visionipc, gpucommon, 'atomic']
|
||||
|
||||
cameras = []
|
||||
if arch == "larch64":
|
||||
libs += ['atomic']
|
||||
cameras = ['cameras/camera_qcom2.cc']
|
||||
cenv = env.Clone()
|
||||
cenv['CPPPATH'].append('include/')
|
||||
|
||||
env.Program('camerad', [
|
||||
'main.cc',
|
||||
'cameras/camera_common.cc',
|
||||
'cameras/camera_util.cc',
|
||||
'imgproc/utils.cc',
|
||||
cameras,
|
||||
], LIBS=libs)
|
||||
camera_obj = cenv.Object(['cameras/camera_qcom2.cc', 'cameras/camera_common.cc', 'cameras/camera_util.cc'])
|
||||
cenv.Program('camerad', [
|
||||
'main.cc',
|
||||
camera_obj,
|
||||
], LIBS=libs)
|
||||
|
||||
if GetOption("test") and arch == "x86_64":
|
||||
env.Program('test/ae_gray_test', [
|
||||
cenv.Program('test/ae_gray_test', [
|
||||
'test/ae_gray_test.cc',
|
||||
'cameras/camera_common.cc',
|
||||
camera_obj,
|
||||
], LIBS=libs)
|
||||
|
||||
@@ -18,11 +18,9 @@
|
||||
#include "system/hardware/hw.h"
|
||||
#include "msm_media_info.h"
|
||||
|
||||
#include "system/camerad/cameras/camera_qcom2.h"
|
||||
#ifdef QCOM2
|
||||
#include "CL/cl_ext_qcom.h"
|
||||
#include "system/camerad/cameras/camera_qcom2.h"
|
||||
#else
|
||||
#include "system/camerad/test/camera_test.h"
|
||||
#endif
|
||||
|
||||
ExitHandler do_exit;
|
||||
|
||||
@@ -1304,4 +1304,3 @@ void cameras_run(MultiCameraState *s) {
|
||||
|
||||
cameras_close(s);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,14 +7,17 @@
|
||||
#include "system/hardware/hw.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (!Hardware::PC()) {
|
||||
int ret;
|
||||
ret = util::set_realtime_priority(53);
|
||||
assert(ret == 0);
|
||||
ret = util::set_core_affinity({6});
|
||||
assert(ret == 0 || Params().getBool("IsOffroad")); // failure ok while offroad due to offlining cores
|
||||
if (Hardware::PC()) {
|
||||
printf("camerad is not meant to run on PC\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ret;
|
||||
ret = util::set_realtime_priority(53);
|
||||
assert(ret == 0);
|
||||
ret = util::set_core_affinity({6});
|
||||
assert(ret == 0 || Params().getBool("IsOffroad")); // failure ok while offroad due to offlining cores
|
||||
|
||||
camerad_thread();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
// TODO: cleanup AE tests
|
||||
// needed by camera_common.cc
|
||||
void camera_autoexposure(CameraState *s, float grey_frac) {}
|
||||
void cameras_init(VisionIpcServer *v, MultiCameraState *s, cl_device_id device_id, cl_context ctx) {}
|
||||
void cameras_open(MultiCameraState *s) {}
|
||||
void cameras_run(MultiCameraState *s) {}
|
||||
|
||||
typedef struct CameraState {
|
||||
int camera_num;
|
||||
CameraInfo ci;
|
||||
|
||||
int fps;
|
||||
float digital_gain = 0;
|
||||
|
||||
int camera_id;
|
||||
|
||||
CameraBuf buf;
|
||||
} CameraState;
|
||||
|
||||
typedef struct MultiCameraState {
|
||||
CameraState road_cam;
|
||||
CameraState driver_cam;
|
||||
|
||||
PubMaster *pm = nullptr;
|
||||
} MultiCameraState;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user