OSDN Git Service

Set HWC as DRM master when got exclusive lock of /vendor/hwc.lock.
authorWan Shuang <shuang.wan@intel.com>
Mon, 15 Oct 2018 02:40:49 +0000 (10:40 +0800)
committerLin Johnson <johnson.lin@intel.com>
Wed, 17 Oct 2018 02:37:44 +0000 (10:37 +0800)
This is to ensure HWC could take over the DRM master role when earlyEvs
exits and make the Android UI rendering correctly as expected.

Jira: OAM-70073
Tests: Boot into Android home screen
Signed-off-by: Wan Shuang <shuang.wan@intel.com>
common/core/gpudevice.cpp
wsi/displaymanager.h
wsi/drm/drmdisplaymanager.cpp
wsi/drm/drmdisplaymanager.h

index 8bf964f..170559d 100644 (file)
@@ -670,6 +670,8 @@ void GpuDevice::HandleRoutine() {
       ITRACE("Successfully grabbed the hwc lock.");
     }
 
+    display_manager_->setDrmMaster();
+
     close(lock_fd_);
     lock_fd_ = -1;
   }
index aa73ce4..748cf71 100644 (file)
@@ -53,6 +53,8 @@ class DisplayManager {
   // manager until ForceRefresh is called.
   virtual void IgnoreUpdates() = 0;
 
+  virtual void setDrmMaster() = 0;
+
   // Get FD associated with this DisplayManager.
   virtual uint32_t GetFD() const = 0;
 
index 08d5eab..ef57996 100644 (file)
@@ -445,6 +445,13 @@ void DrmDisplayManager::IgnoreUpdates() {
   }
 }
 
+void DrmDisplayManager::setDrmMaster() {
+  int ret = drmSetMaster(fd_);
+  if (ret) {
+    ETRACE("Failed to call drmSetMaster : %s", PRINTERROR());
+  }
+}
+
 void DrmDisplayManager::HandleLazyInitialization() {
   spin_lock_.lock();
   if (release_lock_) {
index d406217..e3f8ccf 100644 (file)
@@ -63,6 +63,8 @@ class DrmDisplayManager : public HWCThread, public DisplayManager {
 
   void IgnoreUpdates() override;
 
+  void setDrmMaster() override;
+
   uint32_t GetFD() const override {
     return fd_;
   }