• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_V1_0_DISPLAY_BUFFER_HDI_IMPL_H
17 #define OHOS_HDI_DISPLAY_V1_0_DISPLAY_BUFFER_HDI_IMPL_H
18 
19 #include <iremote_object.h>
20 #include "buffer_handle.h"
21 #include "v1_0/display_buffer_type.h"
22 #include "v1_0/iallocator.h"
23 #include "v1_0/imapper.h"
24 #include "v1_0/include/idisplay_buffer.h"
25 
26 namespace OHOS {
27 namespace HDI {
28 namespace Display {
29 namespace Buffer {
30 namespace V1_0 {
31 class DisplayBufferHdiImpl : public IDisplayBuffer {
32 public:
33     explicit DisplayBufferHdiImpl(bool isAllocLocal = false);
34     virtual ~DisplayBufferHdiImpl();
35 
36     bool AddDeathRecipient(const sptr<IRemoteObject::DeathRecipient>& recipient) override;
37     bool RemoveDeathRecipient() override;
38     int32_t AllocMem(const AllocInfo& info, BufferHandle*& handle) const override;
39     void FreeMem(const BufferHandle& handle) const override;
40     void *Mmap(const BufferHandle& handle) const override;
41     int32_t Unmap(const BufferHandle& handle) const override;
42     int32_t FlushCache(const BufferHandle& handle) const override;
43     int32_t InvalidateCache(const BufferHandle& handle) const override;
44     int32_t IsSupportedAlloc(
45         const std::vector<VerifyAllocInfo>& infos, std::vector<bool>& supporteds) const override;
46 
47 private:
48     static constexpr uint32_t WAIT_TIME_INTERVAL = 1000;
49     sptr<IAllocator> allocator_;
50     sptr<IMapper> mapper_;
51     sptr<IRemoteObject::DeathRecipient> recipient_;
52 };
53 } // namespace V1_0
54 } // namespace Buffer
55 } // namespace Display
56 } // namespace HDI
57 } // namespace OHOS
58 
59 #endif // OHOS_HDI_DISPLAY_V1_0_DISPLAY_BUFFER_HDI_IMPL_H
60