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 DISPLAY_BUFFER_VDI_IMPL_H 17 #define DISPLAY_BUFFER_VDI_IMPL_H 18 19 #include "buffer_handle.h" 20 #include "idisplay_buffer_vdi.h" 21 #include "v1_0/display_buffer_type.h" 22 #include "v1_2/display_buffer_type.h" 23 24 namespace OHOS { 25 namespace HDI { 26 namespace DISPLAY { 27 using namespace OHOS::HDI::Display::Buffer::V1_2; 28 29 class DisplayBufferVdiImpl : public IDisplayBufferVdi { 30 public: 31 DisplayBufferVdiImpl(); 32 virtual ~DisplayBufferVdiImpl(); 33 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 int32_t Unmap(const BufferHandle& handle) const override; 38 virtual int32_t FlushCache(const BufferHandle& handle) const override; 39 virtual int32_t InvalidateCache(const BufferHandle& handle) const override; 40 virtual int32_t IsSupportedAlloc(const std::vector<VerifyAllocInfo>& infos, 41 std::vector<bool>& supporteds) const override; 42 virtual int32_t RegisterBuffer(const BufferHandle& handle) override; 43 virtual int32_t SetMetadata(const BufferHandle& handle, uint32_t key, const std::vector<uint8_t>& value) override; 44 virtual int32_t GetMetadata(const BufferHandle& handle, uint32_t key, std::vector<uint8_t>& value) override; 45 virtual int32_t ListMetadataKeys(const BufferHandle& handle, std::vector<uint32_t>& keys) override; 46 virtual int32_t EraseMetadataKey(const BufferHandle& handle, uint32_t key) override; 47 virtual int32_t GetImageLayout(const BufferHandle& handle, 48 Display::Buffer::V1_2::ImageLayout& layout) const override; 49 }; 50 } // namespace DISPLAY 51 } // namespace HDI 52 } // namespace OHOS 53 #endif // DISPLAY_BUFFER_VDI_IMPL_H 54