• 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 RS_SURFACE_FRAME_OHOS_VULKAN_H
17 #define RS_SURFACE_FRAME_OHOS_VULKAN_H
18 
19 #include <surface.h>
20 
21 #include "sync_fence.h"
22 #ifdef USE_M133_SKIA
23 #include "include/gpu/ganesh/GrDirectContext.h"
24 #else
25 #include "include/gpu/GrDirectContext.h"
26 #endif
27 
28 #include "platform/ohos/rs_surface_frame_ohos.h"
29 
30 namespace OHOS {
31 namespace Rosen {
32 
33 class RSSurfaceFrameOhosVulkan : public RSSurfaceFrameOhos {
34 public:
35     RSSurfaceFrameOhosVulkan(std::shared_ptr<Drawing::Surface> surface, int32_t width,
36         int32_t height, int32_t bufferAge);
37     ~RSSurfaceFrameOhosVulkan() override = default;
38 
39     Drawing::Canvas* GetCanvas() override;
40     std::shared_ptr<Drawing::Surface> GetSurface() override;
41     void SetDamageRegion(int32_t left, int32_t top, int32_t width, int32_t height) override;
42     void SetDamageRegion(const std::vector<RectI>& rects) override;
43     sptr<SyncFence> GetAcquireFence() const;
44     void SetAcquireFence(const sptr<SyncFence>& fence);
45     int32_t GetReleaseFence() const;
46     void SetReleaseFence(const int32_t& fence);
47     int32_t GetBufferAge() const override;
48 
49 private:
50     sptr<SyncFence> acquireFence_ = SyncFence::InvalidFence();
51     int32_t releaseFence_ = 0;
52     std::shared_ptr<Drawing::Surface> surface_;
53     int width_ = 0;
54     int height_ = 0;
55     int32_t bufferAge_ = -1;
56     void CreateCanvas();
57 };
58 } // namespace Rosen
59 } // namespace OHOS
60 
61 #endif // RENDER_SERVICE_BASE_PLATFORM_RS_SURFACE_FRAME_OHOS_H
62