Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ set(BUILD_CATEGORY "ALL" CACHE STRING "Build Category")
set(TOP_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})

include_directories(${TOP_DIRECTORY}/include)
include_directories(${TOP_DIRECTORY}/common/memory)

# Check whether MMM color format header is present.
include(CheckIncludeFile)
Expand Down Expand Up @@ -79,6 +80,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLE_CAMERA")
endif()

include_directories(${TOP_DIRECTORY}/include)
include_directories(${TOP_DIRECTORY}/common/memory)

# === Common libs ===
if (NOT HAVE_BINDER_H)
Expand Down
3 changes: 2 additions & 1 deletion common/camera-meta/qmmf_camera_metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ void CameraMetadata_libCameraMetadataClose() __attribute__ ((destructor (101)));
void CameraMetadata_libCameraMetadataOpen() {
if (NULL == CameraMetadata::libcamera_metadata_handle) {
std::string lib_name =
Target::GetLibName(std::string(kCameraMetaDataLibName), "1");
Target::GetLibName(std::string(kCameraMetaDataLibName),
std::string(kCameraMetaDataLibVersion));

CameraMetadata::libcamera_metadata_handle =
dlopen(lib_name.c_str(), RTLD_LAZY);
Expand Down
3 changes: 2 additions & 1 deletion common/camera-meta/qmmf_vendor_tag_descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ void VendorTagDescriptor_libCameraMetadataClose() __attribute__ ((destructor (10
void VendorTagDescriptor_libCameraMetadataOpen() {
if (NULL == VendorTagDescriptor::libcamera_metadata_handle) {
std::string lib_name =
Target::GetLibName(std::string(kCameraMetaDataLibName), "1");
Target::GetLibName(std::string(kCameraMetaDataLibName),
std::string(kCameraMetaDataLibVersion));

VendorTagDescriptor::libcamera_metadata_handle =
dlopen(lib_name.c_str(), RTLD_LAZY);
Expand Down
5 changes: 5 additions & 0 deletions common/cameraadaptor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ project(qmmf_camera_adaptor_${PLATFORM} VERSION 1.0)

find_package(PkgConfig REQUIRED)

if (NOT HAVE_BINDER_H)
pkg_check_modules(QMMF_PROTO
REQUIRED qmmf_proto)
endif()
if (NOT HAVE_ANDROID_UTILS)
pkg_check_modules(QMMF_CONFIG
REQUIRED qmmf_config)
endif()

pkg_check_modules(QMMF_UTILS
REQUIRED qmmf_utils)

Expand Down
56 changes: 53 additions & 3 deletions common/cameraadaptor/gtest/qmmf_camera_adaptor_gtest.cc

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ int32_t DualCamera3Gtest::StartStreaming(CameraContext &ctx, uint32_t width,
}

memset(&streamParams, 0, sizeof(streamParams));
streamParams.hdrmode = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD;
streamParams.bufferCount = BUFFER_COUNT;
streamParams.format = format;
streamParams.width = width;
Expand Down
33 changes: 32 additions & 1 deletion common/cameraadaptor/qmmf_camera3_device_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ Camera3DeviceClient::Camera3DeviceClient(CameraClientCallbacks clientCb)
vendor_tag_ops_{},
is_camera_device_available_ (true),
cam_opmode_ (0),
enableProviderExtension_(false),
session_metadata_ (CameraMetadata(128, 128)) {
QMMF_GET_LOG_LEVEL();
camera3_callback_ops::notify = &notifyFromHal;
Expand Down Expand Up @@ -319,6 +320,30 @@ int32_t Camera3DeviceClient::OpenCamera(uint32_t idx) {
goto exit;
}

// check the status of EnableProviderExtension
{
uint32_t tag_enable = 0;
QMMF_DEBUG("%s: Enter EnableProviderExtension", __func__);
std::shared_ptr<VendorTagDescriptor> vTags =
VendorTagDescriptor::getGlobalVendorTagDescriptor();

if (vTags.get() != NULL) {
CameraMetadata::getTagFromName(
"org.quic.camera.extensionProvider.EnableProviderExtension",
vTags.get(), &tag_enable);

if (tag_enable > 0) {
camera_metadata_entry_t entry = device_info_.find(tag_enable);
if (entry.count > 0) {
enableProviderExtension_ = entry.data.u8[0];
QMMF_DEBUG("%s: EnableProviderExtension = %d",
__func__, enableProviderExtension_);
}
}
}
QMMF_DEBUG("%s: Exit EnableProviderExtension", __func__);
}

{
camera_metadata_entry partialResultsCount =
device_info_.find(ANDROID_REQUEST_PARTIAL_RESULT_COUNT);
Expand Down Expand Up @@ -1582,7 +1607,7 @@ void Camera3DeviceClient::SendCaptureResult(
// pickframe node will be held on EISv3 module for several seconds at most
// so frame sequence passed by camx will be out of order,

if (!CAM_OPMODE_IS_FRAMESELECTION(cam_opmode_)) {
if (!CAM_OPMODE_IS_FRAMESELECTION(cam_opmode_) && !enableProviderExtension_) {
if (resultExtras.input) {
if (frameNumber < next_result_input_frame_number_) {
SET_ERR(
Expand Down Expand Up @@ -2383,9 +2408,15 @@ void Camera3DeviceClient::deviceStatusChange(
if (new_status == CAMERA_DEVICE_STATUS_NOT_PRESENT) {
ctx->UpdateCameraStatus(false);
QMMF_WARN ("%s: Camera with id (%d) is not present", __func__, camera_id);
if (nullptr != ctx->client_cb_.deviceStatusCb) {
ctx->client_cb_.deviceStatusCb(camera_id, false);
}
} else if (new_status == CAMERA_DEVICE_STATUS_PRESENT) {
ctx->UpdateCameraStatus(true);
QMMF_DEBUG ("%s: Camera with id (%d) is present", __func__, camera_id);
if (nullptr != ctx->client_cb_.deviceStatusCb) {
ctx->client_cb_.deviceStatusCb(camera_id, true);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions common/cameraadaptor/qmmf_camera3_device_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ class Camera3DeviceClient : public ICameraDeviceClient,
bool is_hfr_supported_;
bool is_raw_only_;
bool hfr_mode_enabled_;
bool enableProviderExtension_;
int8_t super_frames_;
uint32_t cam_feature_flags_;
uint32_t fps_sensormode_index_;
Expand Down
4 changes: 0 additions & 4 deletions common/cameraadaptor/qmmf_camera3_smooth_zoom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@
#include <stdlib.h>
#include <math.h>

#ifdef HAVE_ANDROID_UTILS
#include <cutils/properties.h>
#else
#include "common/config/qmmf_config.h"
#endif
#include <qmmf_camera3_utils.h>
#include <qmmf_camera3_device_client.h>
#include "recorder/src/service/qmmf_recorder_common.h"
Expand Down
4 changes: 3 additions & 1 deletion common/cameraadaptor/qmmf_camera3_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,9 @@ int32_t Camera3Stream::GetBufferLocked(camera3_stream_buffer *streamBuffer) {
Colorimetry colorimetry = Colorimetry::kBT601;

#if defined(CAMX_ANDROID_API) && (CAMX_ANDROID_API >= 31)
if (hdrmode_ == 0) {
if (hdrmode_ == ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD &&
data_space_ == HAL_DATASPACE_UNKNOWN &&
color_space_ == -1) {
colorimetry = Colorimetry::kBT601;
} else if (hdrmode_ == ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10) {
colorimetry = Colorimetry::kBT2100HLGFULL;
Expand Down
3 changes: 2 additions & 1 deletion common/cameraadaptor/qmmf_camera3_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ CameraModule::CameraModule() : status_(-1) {}

int32_t CameraModule::LoadHwGetModule(HwGetModuleFn *out_fn) {
std::string lib_name =
Target::GetLibName(std::string(kCameraHardwareLibName), "1");
Target::GetLibName(std::string(kCameraHardwareLibName),
std::string(kCameraHardwareLibVersion));

handle_ = dlopen(lib_name.c_str(), RTLD_NOW);
if (!handle_) {
Expand Down
6 changes: 6 additions & 0 deletions common/cameraadaptor/qmmf_camera3_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@

namespace qmmf {

#ifdef HAVE_ANDROID_UTILS
inline const char* kCameraHardwareLibName = "libhardware";
inline const char* kCameraHardwareLibVersion = "0";
#else
inline const char* kCameraHardwareLibName = "libcamx_hardware";
inline const char* kCameraHardwareLibVersion = "1";
#endif
using HwGetModuleFn = int (*)(const char* id, const struct hw_module_t** module_out);

namespace cameraadaptor {
Expand Down
1 change: 1 addition & 0 deletions common/cameraadaptor/test/camera_factory_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ int32_t Camera::PowerOn() {
}

memset(&streamParams, 0, sizeof(streamParams));
streamParams.hdrmode = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD;
streamParams.bufferCount = STREAM_BUFFER_COUNT;
streamParams.format = HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED;
streamParams.width = PREVIEW_WIDTH;
Expand Down
12 changes: 12 additions & 0 deletions common/config/qmmf_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,20 @@ class Property {
template <typename T>
static T Get(std::string property, T default_value) {
T value = default_value;
#ifdef HAVE_ANDROID_UTILS
char prop_val[PROPERTY_VALUE_MAX];
#else
char prop_val[QMMF_PROP_VAL_MAX];
#endif

std::stringstream s;
s << default_value;

#ifdef HAVE_ANDROID_UTILS
property_get(property.c_str(), prop_val, s.str().c_str());
#else
qmmf_property_get(property.c_str(), prop_val, s.str().c_str());
#endif

std::stringstream output(prop_val);
output >> value;
Expand All @@ -60,6 +68,10 @@ class Property {
std::stringstream s;
s << value;

#ifdef HAVE_ANDROID_UTILS
property_set(property.c_str(), s.str().c_str());
#else
qmmf_property_set(property.c_str(), s.str().c_str());
#endif
}
};
14 changes: 8 additions & 6 deletions common/memory/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ find_package(PkgConfig REQUIRED)

pkg_check_modules(QMMF_CAMERA_METADATA
REQUIRED qmmf_camera_metadata)
pkg_check_modules(QMMF_PROTO
REQUIRED qmmf_proto)
pkg_check_modules(QMMF_UTILS
REQUIRED qmmf_utils)
if (NOT HAVE_ANDROID_UTILS)
pkg_check_modules(QMMF_CONFIG
REQUIRED qmmf_config)
endif()

if (NOT MEMORY_ENABLED)
set(exclude EXCLUDE_FROM_ALL)
Expand Down Expand Up @@ -37,10 +39,10 @@ qmmf_memory_interface.cc
qmmf_gralloc_interface.cc)
endif()

add_dependencies(qmmf_memory_interface_${PLATFORM}
qmmf_utils
qmmf_config
)
add_dependencies(qmmf_memory_interface_${PLATFORM} qmmf_utils)
if (NOT HAVE_ANDROID_UTILS)
add_dependencies(qmmf_memory_interface_${PLATFORM} qmmf_config)
endif()

target_include_directories(qmmf_memory_interface_${PLATFORM}
PRIVATE ${TOP_DIRECTORY}
Expand Down
9 changes: 6 additions & 3 deletions common/memory/qmmf_gbm_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@ class GBMDevice : public IAllocDevice {
gbm_device* GetDevice() const;

MemAllocError AllocBuffer(IBufferHandle& handle, int32_t width,
int32_t height, int32_t format,
MemAllocFlags usage, uint32_t* stride,
uint32_t colorimetry) override;
#ifdef HAVE_BINDER
int32_t height, int32_t format,
#else
int32_t height, int32_t format, int32_t override_format,
#endif // HAVE_BINDER
MemAllocFlags usage, uint32_t *stride, uint32_t colorimetry) override;

MemAllocError ImportBuffer(IBufferHandle& handle,
void* buffer_handle, int fd) override;
Expand Down
25 changes: 22 additions & 3 deletions common/utils/qmmf_common_utils_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,14 @@ namespace qmmf {
const int64_t kWaitDelay = 2000000000; // 2 sec
const uint32_t kMaxSocketBufSize = 300000;

#ifdef HAVE_ANDROID_UTILS
inline const char* kCameraMetaDataLibName = "libcamera_metadata";
inline const char* kCameraMetaDataLibVersion = "0";
#else
inline const char* kCameraMetaDataLibName = "libcamx_metadata";
inline const char* kCameraMetaDataLibVersion = "1";
#endif


#define FORCE_SENSOR_MODE_MASK (0x00F00000)
#define FORCE_SENSOR_MODE_DATA(idx) ((idx + 1) << 20)
Expand Down Expand Up @@ -108,7 +115,10 @@ enum class SocId {
kHAMOA = 709,
kHAMOA_10CORE = 710,
kPURWA = 711,
kGLYMUR_KALAMBO = 719
kGLYMUR_KALAMBO = 719,
kSHIKRA_CQM = 756,
kSHIKRA_CQS = 758,
kSHIKRA_IQS = 759
};

struct StreamBuffer {
Expand Down Expand Up @@ -225,9 +235,9 @@ struct CameraStreamParameters {
height(0),
format(-1),
data_space(0x0),
color_space(0),
color_space(-1),
usecase(0),
hdrmode(0),
hdrmode(0x01),
rotation(0),
allocFlags(),
bufferCount(0),
Expand Down Expand Up @@ -306,6 +316,8 @@ typedef std::function<void(const CaptureResult &result)> ResultCallback;
// Notifies about all sorts of system messages that can happen during camera
// operation
typedef std::function<void(uint32_t errorCode)> SystemCallback;
// Notifies about camera device status changes (present/not present)
typedef std::function<void(int camera_id, bool is_present)> DeviceStatusCallback;

// Please note that these callbacks shouldn't get blocked for long durations.
// Also very important is to not to try and call "Camera3DeviceClient" API
Expand All @@ -318,6 +330,7 @@ typedef struct {
PreparedCallback peparedCb;
ResultCallback resultCb;
SystemCallback systemCb;
DeviceStatusCallback deviceStatusCb;
} CameraClientCallbacks;

// Please note that this callbacks need to return as fast as possible
Expand Down Expand Up @@ -466,6 +479,12 @@ class Target {
case SocId::kGLYMUR_MAHUA:
case SocId::kGLYMUR_KALAMBO:
return "glymur";

case SocId::kSHIKRA_CQM:
case SocId::kSHIKRA_CQS:
case SocId::kSHIKRA_IQS:
return "shikra";

default:
return {};
}
Expand Down
4 changes: 0 additions & 4 deletions common/utils/qmmf_extra_param.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@

#include "qmmf-sdk/qmmf_recorder_extra_param.h"

#ifdef HAVE_ANDROID_UTILS
#include <utils/Log.h>
#else
#include <common/utils/qmmf_log.h>
#endif

namespace qmmf {

Expand Down
5 changes: 4 additions & 1 deletion common/utils/qmmf_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,14 @@ int qmmf_property_set(const char *key, const char *value);
#ifdef HAVE_ANDROID_UTILS
#define QMMF_GET_LOG_LEVEL() \
({ \
char prop[QMMF_PROP_VAL_MAX]; \
char prop[PROPERTY_VALUE_MAX]; \
property_get("persist.qmmf.sdk.log.level", prop, "0"); \
qmmf_log_level = atoi(prop); \
})

#define QMMF_INFO(fmt, args...) ALOGI(fmt, ##args)
#define QMMF_WARN(fmt, args...) ALOGW(fmt, ##args)
#define QMMF_ERROR(fmt, args...) ALOGE(fmt, ##args)
#define QMMF_DEBUG(fmt, args...) ALOGD_IF((qmmf_log_level > 0), fmt, ##args)
#define QMMF_VERBOSE(fmt, args...) ALOGV_IF((qmmf_log_level > 1), fmt, ##args)
#else
Expand Down
4 changes: 0 additions & 4 deletions config/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ set(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -DUSE_FPS_IDX")

set(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -DDISABLE_RESCALER_COLORSPACE")

set(JPEG_LIB chiofflinepostproclib.so.0)

set(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -DJPEG_POSTPROC_LIB=\"\\\"${JPEG_LIB}\\\"\"")

set(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -DEIS_MODES_ENABLE")

set(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -DVHDR_MODES_ENABLE")
Expand Down
Loading
Loading