OSDN Git Service

fix build error
[android-x86/external-IA-Hardware-Composer.git] / wsi / overlaybuffer.h
1 /*
2 // Copyright (c) 2016 Intel Corporation
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 #ifndef WSI_OVERLAYBUFFER_H_
17 #define WSI_OVERLAYBUFFER_H_
18
19 #include <platformdefines.h>
20
21 #include <memory>
22
23 #include "compositordefs.h"
24
25 #include "hwcdefs.h"
26
27 namespace hwcomposer {
28
29 class FrameBufferManager;
30 class NativeBufferHandler;
31 class ResourceManager;
32
33 class OverlayBuffer {
34  public:
35   static std::shared_ptr<OverlayBuffer> CreateOverlayBuffer();
36
37   OverlayBuffer(OverlayBuffer&& rhs) = default;
38   OverlayBuffer& operator=(OverlayBuffer&& other) = default;
39   OverlayBuffer() = default;
40
41   virtual ~OverlayBuffer() {
42   }
43
44   virtual void InitializeFromNativeHandle(HWCNativeHandle handle,
45                                           ResourceManager* buffer_manager) = 0;
46
47   virtual uint32_t GetDataSpace() const = 0;
48
49   virtual uint32_t GetWidth() const = 0;
50
51   virtual uint32_t GetHeight() const = 0;
52
53   virtual uint32_t GetFormat() const = 0;
54
55   virtual HWCLayerType GetUsage() const = 0;
56
57   virtual uint32_t GetFb(bool* isNewCreated = NULL) = 0;
58
59   virtual uint32_t GetPrimeFD() const = 0;
60
61   virtual const uint32_t* GetPitches() const = 0;
62
63   virtual const uint32_t* GetOffsets() const = 0;
64
65   virtual uint32_t GetTilingMode() const = 0;
66
67   virtual void SetDataSpace(uint32_t dataspace) = 0;
68
69   virtual bool GetInterlace() = 0;
70
71   virtual void SetInterlace(bool isInterlaced) = 0;
72
73   // external_import should be true if this resource is not owned by HWC.
74   // If resource is owned by HWC, than the implementation needs to create
75   // frame buffer for this buffer.
76   virtual const ResourceHandle& GetGpuResource(GpuDisplay egl_display,
77                                                bool external_import) = 0;
78
79   virtual const ResourceHandle& GetGpuResource() = 0;
80
81   // Returns Media resource for this buffer which can be used by compositor.
82   // Surface will be clipped to width, height even if buffer size is
83   // greater than these values.
84   virtual const MediaResourceHandle& GetMediaResource(MediaDisplay display,
85                                                       uint32_t width,
86                                                       uint32_t height) = 0;
87
88   // Creates Framebuffer taking into account any Modifiers.
89   virtual bool CreateFrameBufferWithModifier(uint64_t modifier) = 0;
90
91   virtual HWCNativeHandle GetOriginalHandle() const = 0;
92
93   virtual void SetOriginalHandle(HWCNativeHandle handle) = 0;
94
95   virtual void Dump() = 0;
96 };
97
98 }  // namespace hwcomposer
99 #endif  // WSI_OVERLAYBUFFER_H_