OSDN Git Service

Move LayerHashGenerator to Native display
authorHarish Krupo <harish.krupo.kps@intel.com>
Tue, 13 Feb 2018 10:05:26 +0000 (15:35 +0530)
committerKalyan Kondapally <kalyan.kondapally@intel.com>
Tue, 13 Feb 2018 10:46:37 +0000 (02:46 -0800)
Moving the implementation of LayerHashGenerator from Physical
diplay to nativedisplay as other classes directly implement
nativedisplay.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
public/nativedisplay.h
wsi/physicaldisplay.cpp
wsi/physicaldisplay.h

index 95ab518..2adee39 100644 (file)
@@ -309,7 +309,13 @@ class NativeDisplay {
    * layer ids. The argument to the method is the
    * initial size of the pool
    */
-  virtual int InitializeLayerHashGenerator(int) {
+  virtual int InitializeLayerHashGenerator(int size) {
+    LayerIds_.clear();
+    for (int i = 0; i < size; i++) {
+      LayerIds_.push_back(i);
+    }
+
+    current_max_layer_ids_ = size;
     return 0;
   }
 
@@ -318,19 +324,27 @@ class NativeDisplay {
    * unused id for the layer.
    */
   virtual uint64_t AcquireId() {
-    return 0;
+    if (LayerIds_.empty())
+      return ++current_max_layer_ids_;
+
+    uint64_t id = LayerIds_.back();
+    LayerIds_.pop_back();
+
+    return id;
   }
 
   /**
    * Method to return a destroyed layer's id back into the pool
    */
-  virtual void ReleaseId(uint64_t) {
+  virtual void ReleaseId(uint64_t id) {
+    LayerIds_.push_back(id);
   }
 
   /**
    * Call this to reset the id pool back to its initial state.
    */
   virtual void ResetLayerHashGenerator() {
+    InitializeLayerHashGenerator(current_max_layer_ids_);
   }
 
   /**
@@ -367,6 +381,11 @@ class NativeDisplay {
   // to individual layers shown by this display.
   virtual void RotateDisplay(HWCRotation /*rotation*/) {
   }
+
+private:
+  std::vector<uint64_t> LayerIds_;
+  uint64_t current_max_layer_ids_;
+
 };
 
 /**
index eb3ee3c..a53f4e7 100644 (file)
@@ -578,32 +578,4 @@ bool PhysicalDisplay::GetDisplayName(uint32_t *size, char *name) {
   strncpy(name, string.c_str(), *size);
   return true;
 }
-
-int PhysicalDisplay::InitializeLayerHashGenerator(int size) {
-  LayerIds_.clear();
-  for (int i = 0; i < size; i++) {
-    LayerIds_.push_back(i);
-  }
-
-  current_max_layer_ids_ = size;
-  return 0;
-}
-
-uint64_t PhysicalDisplay::AcquireId() {
-  if (LayerIds_.empty())
-    return ++current_max_layer_ids_;
-
-  uint64_t id = LayerIds_.back();
-  LayerIds_.pop_back();
-
-  return id;
-}
-
-void PhysicalDisplay::ReleaseId(uint64_t id) {
-  LayerIds_.push_back(id);
-}
-
-void PhysicalDisplay::ResetLayerHashGenerator() {
-  InitializeLayerHashGenerator(current_max_layer_ids_);
-}
 }  // namespace hwcomposer
index 130389f..e4cea65 100644 (file)
@@ -207,20 +207,10 @@ class PhysicalDisplay : public NativeDisplay, public DisplayPlaneHandler {
   virtual void HandleLazyInitialization() {
   }
 
-  int InitializeLayerHashGenerator(int) override;
-
-  uint64_t AcquireId() override;
-
-  void ReleaseId(uint64_t) override;
-
-  void ResetLayerHashGenerator() override;
-
  private:
   bool UpdatePowerMode();
   void RefreshClones();
   void HandleClonedDisplays(std::vector<HwcLayer *> &source_layers);
-  std::vector<uint64_t> LayerIds_;
-  uint64_t current_max_layer_ids_;
 
  protected:
   enum DisplayConnectionStatus {