/* * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef FRAMEWORKS_SURFACE_INCLUDE_BUFFER_CLIENT_PRODUCER_H #define FRAMEWORKS_SURFACE_INCLUDE_BUFFER_CLIENT_PRODUCER_H #include #include #include #include #include #include #include "surface_buffer_impl.h" namespace OHOS { class BufferClientProducer : public IRemoteProxy { public: BufferClientProducer(const sptr& impl); virtual ~BufferClientProducer(); GSError RequestBuffer(const BufferRequestConfig &config, sptr &bedata, RequestBufferReturnValue &retval) override; GSError CancelBuffer(uint32_t sequence, const sptr &bedata) override; GSError FlushBuffer(uint32_t sequence, const sptr &bedata, const sptr& fence, BufferFlushConfigWithDamages &config) override; GSError GetLastFlushedBuffer(sptr& buffer, sptr& fence, float matrix[16]) override; uint32_t GetQueueSize() override; GSError SetQueueSize(uint32_t queueSize) override; GSError GetName(std::string &name) override; uint64_t GetUniqueId() override; GSError GetNameAndUniqueId(std::string& name, uint64_t& uniqueId) override; int32_t GetDefaultWidth() override; int32_t GetDefaultHeight() override; uint32_t GetDefaultUsage() override; GSError SetTransform(GraphicTransformType transform) override; GSError AttachBuffer(sptr& buffer) override; GSError DetachBuffer(sptr& buffer) override; GSError RegisterReleaseListener(sptr listener) override; GSError UnRegisterReleaseListener() override; GSError IsSupportedAlloc(const std::vector &infos, std::vector &supporteds) override; // Call carefully. This interface will empty all caches of the current process GSError CleanCache() override; GSError Disconnect() override; GSError GoBackground() override; GSError SetScalingMode(uint32_t sequence, ScalingMode scalingMode) override; GSError SetMetaData(uint32_t sequence, const std::vector &metaData) override; GSError SetMetaDataSet(uint32_t sequence, GraphicHDRMetadataKey key, const std::vector &metaData) override; GSError SetTunnelHandle(const GraphicExtDataHandle *handle) override; GSError GetPresentTimestamp(uint32_t sequence, GraphicPresentTimestampType type, int64_t &time) override; sptr GetNativeSurface() override; GSError SendDeathRecipientObject() override; private: static inline BrokerDelegator delegator_; std::string name_ = "not init"; uint64_t uniqueId_ = 0; std::mutex mutex_; sptr token_; }; }; // namespace OHOS #endif // FRAMEWORKS_SURFACE_INCLUDE_BUFFER_CLIENT_PRODUCER_H