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 virtual int32_t AllocMem(const AllocInfo& info, BufferHandle*& handle) const override; 35 virtual void FreeMem(const BufferHandle& handle) const override; 36 virtual void *Mmap(const BufferHandle& handle) const override; 37 virtual void *MmapCache(const BufferHandle &buffer) const override; 38 virtual int32_t Unmap(const BufferHandle& handle) const override; 39 virtual int32_t FlushCache(const BufferHandle &buffer) const override; 40 virtual int32_t FlushMCache(const BufferHandle &buffer) const override; 41 virtual int32_t InvalidateCache(const BufferHandle& handle) const override; 42 43 private: 44 std::shared_ptr<MapperAdapter> mapperAdapter_; 45 sptr<IDisplayAllocator> allocatorProxy_; 46 }; 47 } // namespace V1_0 48 } // namespace Display 49 } // namespace HDI 50 } // namespace OHOS 51 52 #endif // HDI_DISPLAY_GRALLOC_CLIENT_V1_0_H 53