• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015-2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ANDROID_VIRTUAL_COMPOSITOR_WORKER_H_
18 #define ANDROID_VIRTUAL_COMPOSITOR_WORKER_H_
19 
20 #include "drmhwcomposer.h"
21 #include "queue_worker.h"
22 
23 namespace android {
24 
25 struct VirtualComposition {
26   UniqueFd outbuf_acquire_fence;
27   std::vector<UniqueFd> layer_acquire_fences;
28   int release_timeline;
29 };
30 
31 class VirtualCompositorWorker : public QueueWorker<VirtualComposition> {
32  public:
33   VirtualCompositorWorker();
34   ~VirtualCompositorWorker() override;
35 
36   int Init();
37   void QueueComposite(hwc_display_contents_1_t *dc);
38 
39  protected:
40   void ProcessWork(std::unique_ptr<VirtualComposition> composition);
41 
42  private:
43   int CreateNextTimelineFence();
44   int FinishComposition(int timeline);
45 
46   int timeline_fd_;
47   int timeline_;
48   int timeline_current_;
49 };
50 }
51 
52 #endif
53