1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef HDI_MAPPER_ADAPTER_V1_0_H
17 #define HDI_MAPPER_ADAPTER_V1_0_H
18 
19 #include "buffer_handle.h"
20 #include "display_gralloc.h"
21 #include "display_type.h"
22 
23 namespace OHOS {
24 namespace HDI {
25 namespace Display {
26 namespace V1_0 {
27 class MapperAdapter {
28 public:
29     MapperAdapter();
30     virtual ~MapperAdapter();
31     bool IsReady() const;
32     int32_t MapBuffer(const BufferHandle& handle, void *&outData) const;
33     int32_t UnmapBuffer(const BufferHandle& handle) const;
34     int32_t InvalidateCache(const BufferHandle& handle) const;
35     int32_t FlushCache(const BufferHandle& handle) const;
36     void FreeBuffer(const BufferHandle& handle) const;
37 
38 private:
39     GrallocFuncs *mapperFuncs_ = nullptr;
40 };
41 } // namespace V1_0
42 } // namespace Display
43 } // namespace HDI
44 } // namespace OHOS
45 
46 #endif // HDI_MAPPER_ADAPTER_V1_0_H
47