1 /* 2 * Copyright (c) 2023 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 OHOS_HDI_DISPLAY_BUFFER_V1_0_MAPPER_SERVICE_H 17 #define OHOS_HDI_DISPLAY_BUFFER_V1_0_MAPPER_SERVICE_H 18 19 #include "idisplay_buffer_vdi.h" 20 #include "v1_0/display_buffer_type.h" 21 #include "v1_0/imapper.h" 22 23 namespace OHOS { 24 namespace HDI { 25 namespace Display { 26 namespace Buffer { 27 namespace V1_0 { 28 class MapperService : public IMapper { 29 public: 30 MapperService(); 31 virtual ~MapperService(); 32 33 int32_t FreeMem(const sptr<NativeBuffer>& handle) override; 34 int32_t Mmap(const sptr<NativeBuffer>& handle) override; 35 int32_t Unmap(const sptr<NativeBuffer>& handle) override; 36 int32_t FlushCache(const sptr<NativeBuffer>& handle) override; 37 int32_t InvalidateCache(const sptr<NativeBuffer>& handle) override; 38 39 private: 40 int32_t LoadVdi(); 41 42 void* libHandle_; 43 IDisplayBufferVdi* vdiImpl_; 44 CreateDisplayBufferVdiFunc createVdi_; 45 DestroyDisplayBufferVdiFunc destroyVdi_; 46 }; 47 } // namespace V1_0 48 } // namespace Buffer 49 } // namespace Display 50 } // namespace HDI 51 } // namespace OHOS 52 53 #endif // OHOS_HDI_DISPLAY_BUFFER_V1_0_MAPPER_SERVICE_H 54