diff --git a/device/rockchip/rk3588/nanopi6/hdmi_config.xml b/device/rockchip/rk3588/nanopi6/hdmi_config.xml index 41d6f65dbf4..90fc25f9b74 100644 --- a/device/rockchip/rk3588/nanopi6/hdmi_config.xml +++ b/device/rockchip/rk3588/nanopi6/hdmi_config.xml @@ -49,6 +49,6 @@ - + diff --git a/device/rockchip/rk3588/nanopi6_box/etc/hdmi_config.xml b/device/rockchip/rk3588/nanopi6_box/etc/hdmi_config.xml index 41d6f65dbf4..90fc25f9b74 100644 --- a/device/rockchip/rk3588/nanopi6_box/etc/hdmi_config.xml +++ b/device/rockchip/rk3588/nanopi6_box/etc/hdmi_config.xml @@ -49,6 +49,6 @@ - + diff --git a/hardware/rockchip/camera/common/platformdata/PlatformData.cpp b/hardware/rockchip/camera/common/platformdata/PlatformData.cpp index 2f9df821a76..e594f1a4bc2 100644 --- a/hardware/rockchip/camera/common/platformdata/PlatformData.cpp +++ b/hardware/rockchip/camera/common/platformdata/PlatformData.cpp @@ -758,8 +758,14 @@ 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); } - info->static_camera_characteristics = staticMeta.getAndLock(); - staticMeta.unlock( info->static_camera_characteristics); + 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 info->static_camera_characteristics = getStaticMetadata(cameraId); #endif diff --git a/hardware/rockchip/camera_aidl/device/ExternalCameraUtils.cpp b/hardware/rockchip/camera_aidl/device/ExternalCameraUtils.cpp index ca86bfd8bce..02174557ed3 100644 --- a/hardware/rockchip/camera_aidl/device/ExternalCameraUtils.cpp +++ b/hardware/rockchip/camera_aidl/device/ExternalCameraUtils.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #define HAVE_JPEG // required for libyuv.h to export MJPEG decode APIs #include @@ -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); } diff --git a/hardware/rockchip/camera_aidl/device/HdmiUtils.cpp b/hardware/rockchip/camera_aidl/device/HdmiUtils.cpp index e526aee0287..7f633bca4ca 100644 --- a/hardware/rockchip/camera_aidl/device/HdmiUtils.cpp +++ b/hardware/rockchip/camera_aidl/device/HdmiUtils.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #define HAVE_JPEG // required for libyuv.h to export MJPEG decode APIs #include @@ -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); } diff --git a/hardware/rockchip/hwcomposer/drmhwc2/drmhwctwo.cpp b/hardware/rockchip/hwcomposer/drmhwc2/drmhwctwo.cpp index 1b1dea4c8c7..3a6ac5ffd0b 100755 --- a/hardware/rockchip/hwcomposer/drmhwc2/drmhwctwo.cpp +++ b/hardware/rockchip/hwcomposer/drmhwc2/drmhwctwo.cpp @@ -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 vrr_mode = connector_->vrr_modes(); if(bVrrDisplay_ && vrr_mode.size() > 1){ if (!configs) {