1 /* 2 * Copyright (c) 2025 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 RENDER_SERVICE_HDR_BUFFER_LAYER_H 17 #define RENDER_SERVICE_HDR_BUFFER_LAYER_H 18 19 #include "common/rs_common_def.h" 20 #include "pipeline/render_thread/rs_base_render_engine.h" 21 #include "pipeline/rs_surface_handler.h" 22 #include "transaction/rs_render_service_client.h" 23 #include <string> 24 25 namespace OHOS::Rosen { 26 namespace DrawableV2 { 27 class RSHDRBUfferLayer { 28 public: 29 RSHDRBUfferLayer(const std::string& name, NodeId layerId); 30 ~RSHDRBUfferLayer(); 31 void FlushHDRDstBuffer(sptr<SurfaceBuffer> dstBuffer); 32 GetMutableRSSurfaceHandler()33 std::shared_ptr<RSSurfaceHandler> GetMutableRSSurfaceHandler() const 34 { 35 return surfaceHandler_; 36 } 37 void ConsumeAndUpdateBuffer(); 38 sptr<SurfaceBuffer> PrepareHDRDstBuffer(RSSurfaceRenderParams *surfaceParams, ScreenId screenId); 39 40 private: 41 void FlushSurfaceBuffer(sptr<SurfaceBuffer> &buffer, int32_t acquireFence, 42 BufferFlushConfig &flushConfig); 43 sptr<SurfaceBuffer> RequestSurfaceBuffer(BufferRequestConfig& config, int32_t &releaseFence); 44 bool CreateSurface(sptr<IBufferConsumerListener> listener); 45 static constexpr uint32_t BUFFER_SIZE = 4; 46 std::shared_ptr<RSSurfaceHandler> surfaceHandler_; 47 bool surfaceCreated_ = false; 48 std::string layerName_; 49 sptr<Surface> surface_ = nullptr; 50 }; 51 } 52 } // OHOS::Rosen 53 54 #endif 55