sdm: Add HIDL implementation to configure bit clocks.
Change-Id: I2ff291c6d0c27986bd207ffdc22c8b67431d632c
CRs-Fixed: 2476186
diff --git a/common.mk b/common.mk
index eca4769..fbfe96f 100644
--- a/common.mk
+++ b/common.mk
@@ -3,8 +3,14 @@
#Get the highest display config version available
display_config_version := $(shell \
+ if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.10" ];\
+ then echo DISPLAY_CONFIG_1_10; fi)
+
+ifeq ($(display_config_version),)
+display_config_version := $(shell \
if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.9" ];\
then echo DISPLAY_CONFIG_1_9; fi)
+endif
ifeq ($(display_config_version),)
display_config_version := $(shell \
if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.8" ];\
@@ -91,6 +97,12 @@
common_flags += -DDISPLAY_CONFIG_1_4 -DDISPLAY_CONFIG_1_5 -DDISPLAY_CONFIG_1_6
common_flags += -DDISPLAY_CONFIG_1_7 -DDISPLAY_CONFIG_1_8 -DDISPLAY_CONFIG_1_9
endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_10)
+ common_flags += -DDISPLAY_CONFIG_1_1 -DDISPLAY_CONFIG_1_2 -DDISPLAY_CONFIG_1_3
+ common_flags += -DDISPLAY_CONFIG_1_4 -DDISPLAY_CONFIG_1_5 -DDISPLAY_CONFIG_1_6
+ common_flags += -DDISPLAY_CONFIG_1_7 -DDISPLAY_CONFIG_1_8 -DDISPLAY_CONFIG_1_9
+ common_flags += -DDISPLAY_CONFIG_1_10
+endif
ifeq ($(TARGET_USES_COLOR_METADATA), true)
common_flags += -DUSE_COLOR_METADATA
diff --git a/config/display-product.mk b/config/display-product.mk
index 20bf314..ad8e47e 100644
--- a/config/display-product.mk
+++ b/config/display-product.mk
@@ -24,6 +24,7 @@
vendor.display.config@1.7.vendor \
vendor.display.config@1.8.vendor \
vendor.display.config@1.9.vendor \
+ vendor.display.config@1.10.vendor \
modetest
#QDCM calibration xml file for 2k panel
diff --git a/sdm/libs/hwc2/Android.mk b/sdm/libs/hwc2/Android.mk
index 832700e..8aa8020 100644
--- a/sdm/libs/hwc2/Android.mk
+++ b/sdm/libs/hwc2/Android.mk
@@ -93,6 +93,18 @@
LOCAL_SHARED_LIBRARIES += vendor.display.config@1.8
LOCAL_SHARED_LIBRARIES += vendor.display.config@1.9
endif
+ifeq ($(display_config_version), DISPLAY_CONFIG_1_10)
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.1
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.2
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.3
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.4
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.5
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.6
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.7
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.8
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.9
+LOCAL_SHARED_LIBRARIES += vendor.display.config@1.10
+endif
ifeq ($(TARGET_BOARD_AUTO), true)
LOCAL_CFLAGS += -DCONFIG_BASEID_FROM_PROP
diff --git a/sdm/libs/hwc2/hwc_display_builtin.cpp b/sdm/libs/hwc2/hwc_display_builtin.cpp
index 34c6485..d763b74 100644
--- a/sdm/libs/hwc2/hwc_display_builtin.cpp
+++ b/sdm/libs/hwc2/hwc_display_builtin.cpp
@@ -909,13 +909,10 @@
}
DisplayError HWCDisplayBuiltIn::SetDynamicDSIClock(uint64_t bitclk) {
- {
- SEQUENCE_WAIT_SCOPE_LOCK(HWCSession::locker_[type_]);
- DisplayError error = display_intf_->SetDynamicDSIClock(bitclk);
- if (error != kErrorNone) {
- DLOGE(" failed: Clk: %llu Error: %d", bitclk, error);
- return error;
- }
+ DisplayError error = display_intf_->SetDynamicDSIClock(bitclk);
+ if (error != kErrorNone) {
+ DLOGE(" failed: Clk: %llu Error: %d", bitclk, error);
+ return error;
}
callbacks_->Refresh(id_);
@@ -925,7 +922,6 @@
}
DisplayError HWCDisplayBuiltIn::GetDynamicDSIClock(uint64_t *bitclk) {
- SEQUENCE_WAIT_SCOPE_LOCK(HWCSession::locker_[type_]);
if (display_intf_) {
return display_intf_->GetDynamicDSIClock(bitclk);
}
diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp
index 5e8748a..eca5508 100644
--- a/sdm/libs/hwc2/hwc_session.cpp
+++ b/sdm/libs/hwc2/hwc_session.cpp
@@ -2281,7 +2281,12 @@
android::status_t HWCSession::SetDsiClk(const android::Parcel *input_parcel) {
int disp_id = input_parcel->readInt32();
uint64_t clk = UINT64(input_parcel->readInt64());
- if (disp_id < 0 || !hwc_display_[disp_id]) {
+ if (disp_id < 0) {
+ return -EINVAL;
+ }
+
+ SEQUENCE_WAIT_SCOPE_LOCK(locker_[disp_id]);
+ if (!hwc_display_[disp_id]) {
return -EINVAL;
}
@@ -2291,7 +2296,12 @@
android::status_t HWCSession::GetDsiClk(const android::Parcel *input_parcel,
android::Parcel *output_parcel) {
int disp_id = input_parcel->readInt32();
- if (disp_id < 0 || !hwc_display_[disp_id]) {
+ if (disp_id < 0) {
+ return -EINVAL;
+ }
+
+ SEQUENCE_WAIT_SCOPE_LOCK(locker_[disp_id]);
+ if (!hwc_display_[disp_id]) {
return -EINVAL;
}
@@ -2305,7 +2315,12 @@
android::status_t HWCSession::GetSupportedDsiClk(const android::Parcel *input_parcel,
android::Parcel *output_parcel) {
int disp_id = input_parcel->readInt32();
- if (disp_id < 0 || !hwc_display_[disp_id]) {
+ if (disp_id < 0) {
+ return -EINVAL;
+ }
+
+ SCOPE_LOCK(locker_[disp_id]);
+ if (!hwc_display_[disp_id]) {
return -EINVAL;
}
diff --git a/sdm/libs/hwc2/hwc_session.h b/sdm/libs/hwc2/hwc_session.h
index a0995df..75b288b 100644
--- a/sdm/libs/hwc2/hwc_session.h
+++ b/sdm/libs/hwc2/hwc_session.h
@@ -20,7 +20,9 @@
#ifndef __HWC_SESSION_H__
#define __HWC_SESSION_H__
-#ifdef DISPLAY_CONFIG_1_9
+#ifdef DISPLAY_CONFIG_1_10
+#include <vendor/display/config/1.10/IDisplayConfig.h>
+#elif DISPLAY_CONFIG_1_9
#include <vendor/display/config/1.9/IDisplayConfig.h>
#elif DISPLAY_CONFIG_1_8
#include <vendor/display/config/1.8/IDisplayConfig.h>
@@ -65,7 +67,9 @@
namespace sdm {
-#ifdef DISPLAY_CONFIG_1_9
+#ifdef DISPLAY_CONFIG_1_10
+using vendor::display::config::V1_10::IDisplayConfig;
+#elif DISPLAY_CONFIG_1_9
using vendor::display::config::V1_9::IDisplayConfig;
#elif DISPLAY_CONFIG_1_8
using vendor::display::config::V1_8::IDisplayConfig;
@@ -86,8 +90,16 @@
#else
using vendor::display::config::V1_0::IDisplayConfig;
#endif
+
+#ifdef DISPLAY_CONFIG_1_10
+// Need to be declarated for any version 10 or above.
+using vendor::display::config::V1_10::IDisplayCWBCallback;
+#endif
+
using ::android::hardware::Return;
using ::android::hardware::hidl_string;
+using android::hardware::hidl_handle;
+using ::android::hardware::hidl_vec;
int32_t GetDataspaceFromColorMode(ColorMode mode);
@@ -382,6 +394,16 @@
Return<bool> isBuiltInDisplay(uint32_t disp_id) override;
#endif
+#ifdef DISPLAY_CONFIG_1_10
+ Return<void> getSupportedDSIBitClks(uint32_t disp_id,
+ getSupportedDSIBitClks_cb _hidl_cb) override;
+ Return<uint64_t> getDSIClk(uint32_t disp_id) override;
+ Return<int32_t> setDSIClk(uint32_t disp_id, uint64_t bit_clk) override;
+ Return<int32_t> setCWBOutputBuffer(const ::android::sp<IDisplayCWBCallback> &callback,
+ uint32_t disp_id, const Rect &rect, bool post_processed,
+ const hidl_handle& buffer) override;
+#endif
+
// QClient methods
virtual android::status_t notifyCallback(uint32_t command, const android::Parcel *input_parcel,
android::Parcel *output_parcel);
diff --git a/sdm/libs/hwc2/hwc_session_services.cpp b/sdm/libs/hwc2/hwc_session_services.cpp
index dd12ade..eb8887b 100644
--- a/sdm/libs/hwc2/hwc_session_services.cpp
+++ b/sdm/libs/hwc2/hwc_session_services.cpp
@@ -844,4 +844,49 @@
}
#endif // DISPLAY_CONFIG_1_9
+#ifdef DISPLAY_CONFIG_1_10
+Return<void> HWCSession::getSupportedDSIBitClks(uint32_t disp_id,
+ getSupportedDSIBitClks_cb _hidl_cb) {
+ SCOPE_LOCK(locker_[disp_id]);
+ if (!hwc_display_[disp_id]) {
+ return Void();
+ }
+
+ std::vector<uint64_t> bit_clks;
+ hwc_display_[disp_id]->GetSupportedDSIClock(&bit_clks);
+
+ hidl_vec<uint64_t> hidl_bit_clks = bit_clks;
+ _hidl_cb(hidl_bit_clks);
+
+ return Void();
+}
+
+Return<uint64_t> HWCSession::getDSIClk(uint32_t disp_id) {
+ SCOPE_LOCK(locker_[disp_id]);
+ if (!hwc_display_[disp_id]) {
+ return 0;
+ }
+
+ uint64_t bit_clk = 0;
+ hwc_display_[disp_id]->GetDynamicDSIClock(&bit_clk);
+
+ return bit_clk;
+}
+
+Return<int32_t> HWCSession::setDSIClk(uint32_t disp_id, uint64_t bit_clk) {
+ SCOPE_LOCK(locker_[disp_id]);
+ if (!hwc_display_[disp_id]) {
+ return -1;
+ }
+
+ return hwc_display_[disp_id]->SetDynamicDSIClock(bit_clk);
+}
+
+Return<int32_t> HWCSession::setCWBOutputBuffer(const ::android::sp<IDisplayCWBCallback> &callback,
+ uint32_t disp_id, const Rect &rect,
+ bool post_processed, const hidl_handle& buffer) {
+ return -1;
+}
+#endif // DISPLAY_CONFIG_1_10
+
} // namespace sdm