sdm: Add API for SR and PU control from Dpps

In current design, Dpps uses binder calls to trigger screen refresh and
control partial update state. Binder calls can introduce delays if
CPU is heavily loaded. Recent change that moved Dpps into SDM allows
optimization to avoid the binder call route.
This change adds an API for Dpps to trigger screen refresh and
set partial update directly without binder call.

CRs-Fixed: 2242446
Change-Id: I45d3e799766f61812593dced8e68c03ea909b1c6
diff --git a/sdm/libs/core/drm/hw_peripheral_drm.cpp b/sdm/libs/core/drm/hw_peripheral_drm.cpp
index df1149c..6420c13 100644
--- a/sdm/libs/core/drm/hw_peripheral_drm.cpp
+++ b/sdm/libs/core/drm/hw_peripheral_drm.cpp
@@ -37,6 +37,7 @@
 using sde_drm::DRMDisplayType;
 using sde_drm::DRMOps;
 using sde_drm::DRMPowerMode;
+using sde_drm::DppsFeaturePayload;
 using sde_drm::DRMDppsFeatureInfo;
 using sde_drm::DRMSecureMode;
 using sde_drm::DRMCWbCaptureMode;
@@ -143,10 +144,19 @@
   return kErrorNone;
 }
 
-DisplayError HWPeripheralDRM::SetDppsFeature(uint32_t object_type,
-        uint32_t feature_id, uint64_t value) {
-  uint32_t obj_id;
+DisplayError HWPeripheralDRM::SetDppsFeature(void *payload, size_t size) {
+  uint32_t obj_id = 0, object_type = 0, feature_id = 0;
+  uint64_t value = 0;
 
+  if (size != sizeof(DppsFeaturePayload)) {
+    DLOGE("invalid payload size %d, expected %d", size, sizeof(DppsFeaturePayload));
+    return kErrorParameters;
+  }
+
+  DppsFeaturePayload *feature_payload = reinterpret_cast<DppsFeaturePayload *>(payload);
+  object_type = feature_payload->object_type;
+  feature_id = feature_payload->feature_id;
+  value = feature_payload->value;
   if (object_type == DRM_MODE_OBJECT_CRTC) {
     obj_id = token_.crtc_id;
   } else if (object_type == DRM_MODE_OBJECT_CONNECTOR) {
@@ -160,8 +170,12 @@
   return kErrorNone;
 }
 
-DisplayError HWPeripheralDRM::GetDppsFeatureInfo(void *info) {
-  DRMDppsFeatureInfo *feature_info = reinterpret_cast<DRMDppsFeatureInfo *>(info);
+DisplayError HWPeripheralDRM::GetDppsFeatureInfo(void *payload, size_t size) {
+  if (size != sizeof(DRMDppsFeatureInfo)) {
+    DLOGE("invalid payload size %d, expected %d", size, sizeof(DRMDppsFeatureInfo));
+    return kErrorParameters;
+  }
+  DRMDppsFeatureInfo *feature_info = reinterpret_cast<DRMDppsFeatureInfo *>(payload);
   drm_mgr_intf_->GetDppsFeatureInfo(feature_info);
   return kErrorNone;
 }