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_DISPLAY_GRALLOC_CLIENT_V1_0_H 17 #define HDI_DISPLAY_GRALLOC_CLIENT_V1_0_H 18 19 #include "iservmgr_hdi.h" 20 #include "buffer_handle.h" 21 #include "display_type.h" 22 #include "idisplay_gralloc.h" 23 #include "allocator_proxy.h" 24 #include "mapper_adapter.h" 25 26 namespace OHOS { 27 namespace HDI { 28 namespace Display { 29 namespace V1_0 { 30 class DisplayGrallocClient : public IDisplayGralloc { 31 public: 32 DisplayGrallocClient(); ~DisplayGrallocClient()33 virtual ~DisplayGrallocClient() {} 34 int32_t AllocMem(const AllocInfo& info, BufferHandle*& handle) const override; 35 void FreeMem(const BufferHandle& handle) const override; 36 void *Mmap(const BufferHandle& handle) const override; 37 void *MmapCache(const BufferHandle &handle) const override; 38 int32_t Unmap(const BufferHandle& handle) const override; 39 int32_t FlushCache(const BufferHandle &handle) const override; 40 int32_t FlushMCache(const BufferHandle &handle) const override; 41 int32_t InvalidateCache(const BufferHandle& handle) const override; 42 int32_t RegAllocatorDeathCallback(AllocatorDeathCallback func, void *data) override; 43 int32_t IsSupportedAlloc(const std::vector<VerifyAllocInfo> &infos, 44 std::vector<bool> &supporteds) const override; 45 46 private: 47 std::shared_ptr<MapperAdapter> mapperAdapter_; 48 sptr<IDisplayAllocator> allocatorProxy_; 49 }; 50 } // namespace V1_0 51 } // namespace Display 52 } // namespace HDI 53 } // namespace OHOS 54 55 #endif // HDI_DISPLAY_GRALLOC_CLIENT_V1_0_H 56