OSDN Git Service

Removed unused is_cursor_layer param in InitializeFromNativeHandle.
[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 NativeBufferHandler;
30 class ResourceManager;
31
32 class OverlayBuffer {
33  public:
34   static std::shared_ptr<OverlayBuffer> CreateOverlayBuffer();
35
36   OverlayBuffer(OverlayBuffer&& rhs) = default;
37   OverlayBuffer& operator=(OverlayBuffer&& other) = default;
38   OverlayBuffer() = default;
39
40   virtual ~OverlayBuffer() {
41   }
42
43   virtual void InitializeFromNativeHandle(HWCNativeHandle handle,
44                                           ResourceManager* buffer_manager) = 0;
45
46   virtual uint32_t GetWidth() const = 0;
47
48   virtual uint32_t GetHeight() const = 0;
49
50   virtual uint32_t GetFormat() const = 0;
51
52   virtual HWCLayerType GetUsage() const = 0;
53
54   virtual uint32_t GetFb() const = 0;
55
56   virtual uint32_t GetPrimeFD() const = 0;
57
58   virtual const uint32_t* GetPitches() const = 0;
59
60   virtual const uint32_t* GetOffsets() const = 0;
61
62   virtual uint32_t GetTilingMode() const = 0;
63
64   // external_import should be true if this resource is not owned by HWC.
65   // If resource is owned by HWC, than the implementation needs to create
66   // frame buffer for this buffer.
67   virtual const ResourceHandle& GetGpuResource(GpuDisplay egl_display,
68                                                bool external_import) = 0;
69
70   virtual const ResourceHandle& GetGpuResource() = 0;
71
72   // Returns Media resource for this buffer which can be used by compositor.
73   // Surface will be clipped to width, height even if buffer size is
74   // greater than these values.
75   virtual const MediaResourceHandle& GetMediaResource(MediaDisplay display,
76                                                       uint32_t width,
77                                                       uint32_t height) = 0;
78
79   virtual bool CreateFrameBuffer() = 0;
80
81   virtual void Dump() = 0;
82 };
83
84 }  // namespace hwcomposer
85 #endif  // WSI_OVERLAYBUFFER_H_