OSDN Git Service

Add API to set and retrieve offscreen target for a given DisplayPlane.
authorKalyan Kondapally <kalyan.kondapally@intel.com>
Tue, 14 Feb 2017 11:07:39 +0000 (03:07 -0800)
committerKalyan Kondapally <kalyan.kondapally@intel.com>
Tue, 14 Feb 2017 23:16:09 +0000 (15:16 -0800)
This is in preparation to move NativeSurface to DisplayPlaneManager,
so we can do a test commit exactly the same as in real commit.

Jira: None.
Test: No Graphics Regressions on Linux and Android.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
common/compositor/compositor.cpp
common/compositor/compositor.h
common/display/displayplanestate.h

index 956f74b..be9454a 100644 (file)
@@ -108,14 +108,12 @@ bool Compositor::Draw(DisplayPlaneStateList &comp_planes,
       if (comp_regions.empty())
         continue;
 
-      if (!PrepareForComposition()) {
+      if (!PrepareForComposition(plane)) {
         ETRACE("Failed to initialize resources for composition");
         return false;
       }
 
-      NativeSurface *surface = in_flight_surfaces_.back();
-      surface->SetPlaneTarget(plane, gpu_fd_);
-      Render(layers, surface, comp_regions);
+      Render(layers, plane.GetOffScreenTarget(), comp_regions);
     }
   }
 
@@ -178,7 +176,7 @@ void Compositor::InsertFence(int fence) {
   renderer_->InsertFence(fence);
 }
 
-bool Compositor::PrepareForComposition() {
+bool Compositor::PrepareForComposition(DisplayPlaneState &plane) {
   NativeSurface *surface = NULL;
   for (auto &fb : surfaces_) {
     if (!fb->InUse()) {
@@ -194,6 +192,8 @@ bool Compositor::PrepareForComposition() {
     surface = surfaces_.back().get();
   }
 
+  surface->SetPlaneTarget(plane, gpu_fd_);
+  plane.SetOffScreenTarget(surface);
   in_flight_surfaces_.emplace_back(surface);
   return true;
 }
index abd4543..975f3b6 100644 (file)
@@ -52,7 +52,7 @@ class Compositor {
   void InsertFence(int fence);
 
  private:
-  bool PrepareForComposition();
+  bool PrepareForComposition(DisplayPlaneState &plane);
   void Render(std::vector<OverlayLayer> &layers, NativeSurface *surface,
               const std::vector<CompositionRegion> &comp_regions);
   void SeparateLayers(const std::vector<size_t> &dedicated_layers,
index d4877d0..87e7e6b 100644 (file)
@@ -25,6 +25,7 @@ namespace hwcomposer {
 
 class DisplayPlane;
 class DisplayPlaneState;
+class NativeSurface;
 struct OverlayLayer;
 
 typedef std::vector<DisplayPlaneState> DisplayPlaneStateList;
@@ -83,6 +84,14 @@ class DisplayPlaneState {
     return layer_;
   }
 
+  void SetOffScreenTarget(NativeSurface *target) {
+    offscreen_target_ = target;
+  }
+
+  NativeSurface *GetOffScreenTarget() const {
+    return offscreen_target_;
+  }
+
   DisplayPlane *plane() const {
     return plane_;
   }
@@ -95,6 +104,7 @@ class DisplayPlaneState {
   State state_ = State::kScanout;
   DisplayPlane *plane_ = NULL;
   OverlayLayer *layer_ = NULL;
+  NativeSurface *offscreen_target_ = NULL;
   HwcRect<int> display_frame_;
   std::vector<size_t> source_layers_;
 };