1 /*
2  * Copyright (C) 2015 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 #include <stdint.h>
18 #include <stdint.h>
19 #include "compositor.h"
20 
21 struct hwc_layer_1;
22 struct hwc_import_context;
23 
24 namespace android {
25 
26 class GLComposition;
27 
28 class GLCompositor : public Compositor, public Targeting {
29  public:
30   GLCompositor();
31   virtual ~GLCompositor();
32 
33   virtual int Init();
34   virtual Targeting *targeting();
35   virtual int CreateTarget(sp<android::GraphicBuffer> &buffer);
36   virtual void SetTarget(int target);
37   virtual void ForgetTarget(int target);
38   virtual Composition *CreateComposition(Importer *importer);
39   virtual int QueueComposition(Composition *composition);
40   virtual int Composite();
41 
42  private:
43   struct priv_data;
44   struct texture_from_handle;
45 
46   struct priv_data *priv_;
47 
48   int BeginContext();
49   int EndContext();
50   int GenerateShaders();
51   int DoComposition(GLComposition *composition);
52   int DoFenceWait(int acquireFenceFd);
53   int CreateTextureFromHandle(buffer_handle_t handle,
54                               struct texture_from_handle *tex);
55   void DestroyTextureFromHandle(const struct texture_from_handle &tex);
56   void CheckAndDestroyTarget(int target_handle);
57 
58   friend GLComposition;
59 };
60 
61 }  // namespace android
62