软件平台:Android11
硬件平台:QCS6125
需求描述:通过adb命令行,同注册为vndbinder的服务通信,调用其相关接口,注册vndbinder的服务在HW层实现。
命令行执行命令如下:
adb shell "vndservice call display.qservice 38 i32 <qsync_mode>"
可以大概看出,是vndservice可执行程序通过vndbinder调用同样注册vndbinder的display.qservice服务,后边跟的参数38代表功能接口的ID号即为一个方法,再往后的i32为该功能的参数数据类型定义为int32,再往后尖括号就是参数值。
我需要添加的就是一套ID定义,直接上HW层实现:
diff --git a/libdisplayconfig/DisplayConfig.h b/libdisplayconfig/DisplayConfig.h
index fbce8b61..83c5f044 100644
--- a/libdisplayconfig/DisplayConfig.h
+++ b/libdisplayconfig/DisplayConfig.h
@@ -108,6 +108,7 @@ int setIdleTimeout(uint32_t value);
int getHDRCapabilities(int dpy, DisplayHDRCapabilities *caps);
int setCameraLaunchStatus(uint32_t on);
bool displayBWTransactionPending();
+int setPanelRefreshMode(int mode);
int32_t getWriteBackCapabilities( WriteBackCapabilities *caps);
} // namespace display
diff --git a/libqdutils/display_config.cpp b/libqdutils/display_config.cpp
index c283b381..ea3147ae 100644
--- a/libqdutils/display_config.cpp
+++ b/libqdutils/display_config.cpp
@@ -370,6 +370,22 @@ int setPanelLuminanceAttributes(int dpy, float min_lum, float max_lum) {
return err;
}
+int setPanelRefreshMode(int mode) {
+ ALOGE("====== %s() kongbo add for setfreshmode ======", __FUNCTION__);
+ status_t err = (status_t) FAILED_TRANSACTION;
+ sp<IQService> binder = getBinder();
+ Parcel inParcel, outParcel;
+
+ if(binder != NULL) {
+ inParcel.writeInt32(mode);
+ status_t err = binder->dispatch(IQService::SET_DISPLAY_REFRESH_MODE, &inParcel, &outParcel);
+ if(err) {
+ ALOGE("%s() failed with err %d", __FUNCTION__, err);
+ }
+ }
+ return err;
+}
+
}// namespace
// ----------------------------------------------------------------------------
diff --git a/libqdutils/display_config.h b/libqdutils/display_config.h
index 21aea606..c128436a 100644
--- a/libqdutils/display_config.h
+++ b/libqdutils/display_config.h
@@ -170,6 +170,9 @@ int getSupportedBitClk(int dpy, std::vector<uint64_t>& bit_rates);
// Sets the specified min and max luminance values.
int setPanelLuminanceAttributes(int dpy, float min_lum, float max_lum);
+// Sets the panel refresh mode
+int setPanelRefreshMode(int mode);
+
}; //namespace
diff --git a/libqservice/IQService.h b/libqservice/IQService.h
index 1236ed5c..111b33da 100644
--- a/libqservice/IQService.h
+++ b/libqservice/IQService.h
@@ -86,6 +86,8 @@ public:
GET_SUPPORTED_DSI_CLK = 44, // Get supported DSI Clk.
SET_COLOR_MODE_FROM_CLIENT = 45, // Overrides the QDCM mode using the given mode ID
SET_PANEL_LUMINANCE = 46, // Set Panel Luminance attributes.
+ /* kanyun add hwc handwrite */
+ SET_DISPLAY_REFRESH_MODE = 47, // Set T1000 refresh mode
COMMAND_LIST_END = 400,
};
diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp
index 21be352f..e4f2fef8 100644
--- a/sdm/libs/hwc2/hwc_session.cpp
+++ b/sdm/libs/hwc2/hwc_session.cpp
@@ -1191,6 +1191,22 @@ int32_t HWCSession::SetAutoLowLatencyMode(hwc2_device_t *device, hwc2_display_t
return HWC2_ERROR_UNSUPPORTED;
}
+int32_t HWCSession::SetPanelRefreshMode(hwc2_device_t *device, hwc2_display_t display, int32_t mode) {
+ DLOGE("====== HWCSession::SetPanelRefreshMode get from fw: %d .", mode);
+ if (!device || display >= HWCCallbacks::kNumDisplays) {
+ return HWC2_ERROR_BAD_DISPLAY;
+ }
+ return HWC2_ERROR_NONE;
+}
+
int32_t HWCSession::GetSupportedContentTypes(hwc2_device_t *device, hwc2_display_t display,
uint32_t *count, uint32_t *contentTypes) {
contentTypes = {};
@@ -1382,6 +1398,10 @@ hwc2_function_pointer_t HWCSession::GetFunction(struct hwc2_device *device,
(HWCSession::SetActiveConfigWithConstraints);
case HWC2::FunctionDescriptor::SetAutoLowLatencyMode:
return AsFP<HWC2_PFN_SET_AUTO_LOW_LATENCY_MODE>(HWCSession::SetAutoLowLatencyMode);
+ case HWC2::FunctionDescriptor::SetPanelRefreshMode:
+ return AsFP<HWC2_PFN_SET_PANEL_REFRESH_MODE>(HWCSession::SetPanelRefreshMode);
case HWC2::FunctionDescriptor::GetSupportedContentTypes:
return AsFP<HWC2_PFN_GET_SUPPORTED_CONTENT_TYPES>(HWCSession::GetSupportedContentTypes);
case HWC2::FunctionDescriptor::SetContentType:
@@ -1808,6 +1828,15 @@ android::status_t HWCSession::notifyCallback(uint32_t command, const android::Pa
status = SetPanelLuminanceAttributes(input_parcel);
break;
+ case qService::IQService::SET_DISPLAY_REFRESH_MODE:
+ if (!input_parcel) {
+ DLOGE("QService command SET_DISPLAY_REFRESH_MODE = %d: input_parcel needed.", command);
+ break;
+ }
+ DLOGE("====== HW session rec SET_DISPLAY_REFRESH_MODE cmd");
+ //status = SetPanelLuminanceAttributes(input_parcel);
+ break;
+
case qService::IQService::SET_COLOR_MODE_FROM_CLIENT:
if (!input_parcel) {
DLOGE("QService command = %d: input_parcel needed.", command);
diff --git a/sdm/libs/hwc2/hwc_session.h b/sdm/libs/hwc2/hwc_session.h
index 5931a5d9..c0c3bd45 100644
--- a/sdm/libs/hwc2/hwc_session.h
+++ b/sdm/libs/hwc2/hwc_session.h
@@ -233,6 +233,8 @@ class HWCSession : hwc2_device_t, HWCUEventListener, public qClient::BnQClient,
static int32_t GetDozeSupport(hwc2_device_t *device, hwc2_display_t display,
int32_t *out_support);
static int32_t SetAutoLowLatencyMode(hwc2_device_t *device, hwc2_display_t display, bool on);
+ static int32_t SetPanelRefreshMode(hwc2_device_t *device, hwc2_display_t display, int32_t mode);
static int32_t GetSupportedContentTypes(hwc2_device_t *device, hwc2_display_t display,
uint32_t *count, uint32_t *contentTypes);
static int32_t SetContentType(hwc2_device_t *device, hwc2_display_t display,int32_t type);
添加完成,增量编译,刷机待验证。
验证方式有如下两种:
1、通过命令行验证:
adb shell "vndservice call display.qservice 47 i32 1"
在执行上述指令的同时,打开logcat日志,可以看到“======”标示的日志输出,代表数据通路没问题。
2、代码层面去调用:
sp<IServiceManager> sm = defaultServiceManager();
service = sm->checkService(String16("display.qservice"));
ifName = get_interface_name(service);
if (service != nullptr && ifName.size() > 0) {
Parcel data, reply;
// the interface name is first
data.writeInterfaceToken(ifName);
int32_t code = atoi("47");
data.writeInt32(atoi("2"));
service->transact(code, data, &reply);
}
可达到跟命令行执行同样的调用效果,需要注意的是,这个代码片需要在/dev/vndbinder域去添加。