sde-drm: add api locks to dpps mgr

Change adds api lock to dpps mgr implementation to prevent issues with
multiple threads using the interface.

Change-Id: Idabf674dffb5cf8f84edaa4fcf9a84222e71c696
diff --git a/sde-drm/drm_dpps_mgr_imp.cpp b/sde-drm/drm_dpps_mgr_imp.cpp
index 68ed4a5..99a690b 100644
--- a/sde-drm/drm_dpps_mgr_imp.cpp
+++ b/sde-drm/drm_dpps_mgr_imp.cpp
@@ -203,6 +203,7 @@
 }
 
 void DRMDppsManagerImp::Init(int fd, drmModeRes* res) {
+  std::lock_guard<std::mutex> guard(api_lock_);
   int ret = 0;
 
   if (fd < 0 || !res) {
@@ -315,6 +316,7 @@
 }
 
 void DRMDppsManagerImp::CacheDppsFeature(uint32_t obj_id, va_list args) {
+  std::lock_guard<std::mutex> guard(api_lock_);
   uint32_t feature_id = va_arg(args, uint32_t);
   uint64_t value = va_arg(args, uint64_t);
   struct DRMDppsPropInfo* info;
@@ -341,6 +343,7 @@
 }
 
 void DRMDppsManagerImp::CommitDppsFeatures(drmModeAtomicReq *req, const DRMDisplayToken &tok) {
+  std::lock_guard<std::mutex> guard(api_lock_);
   int ret = 0;
 
   if (!req)
@@ -398,6 +401,7 @@
 
 void DRMDppsManagerImp::GetDppsFeatureInfo(DRMDppsFeatureInfo *info)
 {
+  std::lock_guard<std::mutex> guard(api_lock_);
   int ret = 0;
   struct DRMDppsPropInfo* prop_info;
 
diff --git a/sde-drm/drm_dpps_mgr_imp.h b/sde-drm/drm_dpps_mgr_imp.h
index eefb213..a264e01 100644
--- a/sde-drm/drm_dpps_mgr_imp.h
+++ b/sde-drm/drm_dpps_mgr_imp.h
@@ -33,6 +33,7 @@
 #include "drm_interface.h"
 #include "drm_property.h"
 #include "drm_dpps_mgr_intf.h"
+#include <mutex>
 
 namespace sde_drm {
 
@@ -73,6 +74,7 @@
   int drm_fd_ = -1;
   std::vector<std::pair<uint32_t, drm_msm_ltm_buffers_ctrl>> ltm_buffers_ctrl_map_;
   std::vector<std::pair<uint32_t, DRMDppsLtmBuffers>> ltm_buffers_map_;
+  std::mutex api_lock_;
 };
 
 class DRMDppsManagerDummyImp : public DRMDppsManagerIntf {