rockchip: make camera be aware of display orientation

Signed-off-by: hmz007 <hmz007@gmail.com>
master
hmz007 8 months ago
parent 684713d7e7
commit 8a784c53fb

@ -49,6 +49,6 @@
<!-- image size larger than the last entry will not be supported-->
</FpsList>
<!-- orientation -->
<Orientation degree="0"/>
<!-- <Orientation degree="0"/> -->
</Device>
</ExternalCamera>

@ -49,6 +49,6 @@
<!-- image size larger than the last entry will not be supported-->
</FpsList>
<!-- orientation -->
<Orientation degree="0"/>
<!-- <Orientation degree="0"/> -->
</Device>
</ExternalCamera>

@ -758,6 +758,12 @@ void PlatformData::getCameraInfo(int cameraId, struct camera_info * info)
appendTags(staticMeta,ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS,RK_CONTROL_AIQ_SATURATION);
appendTags(staticMeta,ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS,RK_CONTROL_AIQ_SATURATION);
}
int degree = property_get_int32("vendor.hwc.orient.main", 0);
if (info->orientation == 0 && degree == 270) {
info->orientation = degree;
staticMeta.update(ANDROID_SENSOR_ORIENTATION, &info->orientation, 1);
ALOGD("camera %d orientation updated to %d\n", cameraId, info->orientation);
}
info->static_camera_characteristics = staticMeta.getAndLock();
staticMeta.unlock( info->static_camera_characteristics);
#else

@ -26,6 +26,7 @@
#include <algorithm>
#include <cinttypes>
#include <cmath>
#include <cutils/properties.h>
#define HAVE_JPEG // required for libyuv.h to export MJPEG decode APIs
#include <libyuv.h>
@ -164,6 +165,12 @@ ExternalCameraConfig ExternalCameraConfig::loadFromCfg(const char* cfgPath) {
XMLElement* orientation = deviceCfg->FirstChildElement("Orientation");
if (orientation == nullptr) {
ALOGI("%s: no sensor orientation specified", __FUNCTION__);
ret.orientation = property_get_int32("vendor.hwc.orient.main", -1);
if (ret.orientation < 0) {
// Simple delay to wait vendor property ready
usleep(1000*100);
ret.orientation = property_get_int32("vendor.hwc.orient.main", kDefaultOrientation);
}
} else {
ret.orientation = orientation->IntAttribute("degree", /*Default*/ kDefaultOrientation);
}

@ -26,6 +26,7 @@
#include <algorithm>
#include <cinttypes>
#include <cmath>
#include <cutils/properties.h>
#define HAVE_JPEG // required for libyuv.h to export MJPEG decode APIs
#include <libyuv.h>
@ -164,6 +165,12 @@ HdmiConfig HdmiConfig::loadFromCfg(const char* cfgPath) {
XMLElement* orientation = deviceCfg->FirstChildElement("Orientation");
if (orientation == nullptr) {
ALOGI("%s: no sensor orientation specified", __FUNCTION__);
ret.orientation = property_get_int32("vendor.hwc.orient.main", -1);
if (ret.orientation < 0) {
// Simple delay to wait vendor property ready
usleep(1000*100);
ret.orientation = property_get_int32("vendor.hwc.orient.main", kDefaultOrientation);
}
} else {
ret.orientation = orientation->IntAttribute("degree", /*Default*/ kDefaultOrientation);
}

@ -1437,6 +1437,10 @@ HWC2::Error DrmHwcTwo::HwcDisplay::GetDisplayConfigs(uint32_t *num_configs,
}
}
// set display orientation for camera
if (handle_ == HWC_DISPLAY_PRIMARY && ctx_.rel_xres < ctx_.rel_yres)
property_set(PROPERTY_TYPE ".hwc.orient.main", "270");
const std::vector<int> vrr_mode = connector_->vrr_modes();
if(bVrrDisplay_ && vrr_mode.size() > 1){
if (!configs) {

Loading…
Cancel
Save