| // camera/mojo/gpu/jpeg_encode_accelerator.mojom.h is auto generated by mojom_bindings_generator.py, do not edit |
| |
| // Copyright 2013 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef CAMERA_MOJO_GPU_JPEG_ENCODE_ACCELERATOR_MOJOM_H_ |
| #define CAMERA_MOJO_GPU_JPEG_ENCODE_ACCELERATOR_MOJOM_H_ |
| |
| #include <stdint.h> |
| |
| #include <limits> |
| #include <optional> |
| #include <type_traits> |
| #include <utility> |
| |
| #include "base/types/cxx23_to_underlying.h" |
| #include "mojo/public/cpp/bindings/clone_traits.h" |
| #include "mojo/public/cpp/bindings/equals_traits.h" |
| #include "mojo/public/cpp/bindings/lib/serialization.h" |
| #include "mojo/public/cpp/bindings/struct_ptr.h" |
| #include "mojo/public/cpp/bindings/struct_traits.h" |
| #include "mojo/public/cpp/bindings/union_traits.h" |
| |
| #include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h" |
| |
| #include "camera/mojo/gpu/jpeg_encode_accelerator.mojom-features.h" |
| #include "camera/mojo/gpu/jpeg_encode_accelerator.mojom-shared.h" |
| #include "camera/mojo/gpu/jpeg_encode_accelerator.mojom-forward.h" |
| #include "camera/mojo/gpu/dmabuf.mojom-forward.h" |
| #include <string> |
| #include <vector> |
| |
| #include "mojo/public/cpp/bindings/lib/control_message_handler.h" |
| #include "mojo/public/cpp/bindings/lib/message_size_estimator.h" |
| #include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h" |
| |
| |
| |
| |
| |
| |
| namespace cros::mojom { |
| |
| class JpegEncodeAcceleratorProxy; |
| |
| template <typename ImplRefTraits> |
| class JpegEncodeAcceleratorStub; |
| |
| class JpegEncodeAcceleratorRequestValidator; |
| class JpegEncodeAcceleratorResponseValidator; |
| |
| |
| class JpegEncodeAccelerator |
| : public JpegEncodeAcceleratorInterfaceBase { |
| public: |
| using IPCStableHashFunction = uint32_t(*)(); |
| |
| static const char Name_[]; |
| static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message); |
| static const char* MessageToMethodName_(mojo::Message& message); |
| static constexpr uint32_t Version_ = 1; |
| static constexpr bool PassesAssociatedKinds_ = false; |
| static constexpr bool HasUninterruptableMethods_ = false; |
| |
| using Base_ = JpegEncodeAcceleratorInterfaceBase; |
| using Proxy_ = JpegEncodeAcceleratorProxy; |
| |
| template <typename ImplRefTraits> |
| using Stub_ = JpegEncodeAcceleratorStub<ImplRefTraits>; |
| |
| using RequestValidator_ = JpegEncodeAcceleratorRequestValidator; |
| using ResponseValidator_ = JpegEncodeAcceleratorResponseValidator; |
| enum MethodMinVersions : uint32_t { |
| kInitializeMinVersion = 0, |
| kEncodeWithFDMinVersion = 0, |
| kEncodeWithDmaBufMinVersion = 0, |
| }; |
| |
| // crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK |
| // with not having this data in traces there. |
| #if !BUILDFLAG(IS_FUCHSIA) |
| struct Initialize_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct EncodeWithFD_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| struct EncodeWithDmaBuf_Sym { |
| NOINLINE static uint32_t IPCStableHash(); |
| }; |
| #endif // !BUILDFLAG(IS_FUCHSIA) |
| virtual ~JpegEncodeAccelerator() = default; |
| |
| |
| using InitializeCallback = base::OnceCallback<void(bool)>; |
| |
| virtual void Initialize(InitializeCallback callback) = 0; |
| |
| |
| using EncodeWithFDCallback = base::OnceCallback<void(int32_t, uint32_t, EncodeStatus)>; |
| |
| virtual void EncodeWithFD(int32_t task_id, ::mojo::ScopedHandle input_fd, uint32_t input_buffer_size, int32_t coded_size_width, int32_t coded_size_height, ::mojo::ScopedHandle exif_fd, uint32_t exif_buffer_size, ::mojo::ScopedHandle output_fd, uint32_t output_buffer_size, EncodeWithFDCallback callback) = 0; |
| |
| |
| using EncodeWithDmaBufCallback = base::OnceCallback<void(uint32_t, EncodeStatus)>; |
| |
| virtual void EncodeWithDmaBuf(int32_t task_id, uint32_t input_format, std::vector<::cros::mojom::DmaBufPlanePtr> input_planes, std::vector<::cros::mojom::DmaBufPlanePtr> output_planes, ::mojo::ScopedHandle exif_handle, uint32_t exif_buffer_size, int32_t coded_size_width, int32_t coded_size_height, int32_t quality, bool has_input_modifier, uint64_t input_modifier, EncodeWithDmaBufCallback callback) = 0; |
| }; |
| |
| |
| |
| class JpegEncodeAcceleratorProxy |
| : public JpegEncodeAccelerator { |
| public: |
| using InterfaceType = JpegEncodeAccelerator; |
| |
| explicit JpegEncodeAcceleratorProxy(mojo::MessageReceiverWithResponder* receiver); |
| |
| void Initialize(InitializeCallback callback) final; |
| |
| void EncodeWithFD(int32_t task_id, ::mojo::ScopedHandle input_fd, uint32_t input_buffer_size, int32_t coded_size_width, int32_t coded_size_height, ::mojo::ScopedHandle exif_fd, uint32_t exif_buffer_size, ::mojo::ScopedHandle output_fd, uint32_t output_buffer_size, EncodeWithFDCallback callback) final; |
| |
| void EncodeWithDmaBuf(int32_t task_id, uint32_t input_format, std::vector<::cros::mojom::DmaBufPlanePtr> input_planes, std::vector<::cros::mojom::DmaBufPlanePtr> output_planes, ::mojo::ScopedHandle exif_handle, uint32_t exif_buffer_size, int32_t coded_size_width, int32_t coded_size_height, int32_t quality, bool has_input_modifier, uint64_t input_modifier, EncodeWithDmaBufCallback callback) final; |
| |
| private: |
| mojo::MessageReceiverWithResponder* receiver_; |
| }; |
| class JpegEncodeAcceleratorStubDispatch { |
| public: |
| static bool Accept(JpegEncodeAccelerator* impl, mojo::Message* message); |
| static bool AcceptWithResponder( |
| JpegEncodeAccelerator* impl, |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder); |
| }; |
| |
| template <typename ImplRefTraits = |
| mojo::RawPtrImplRefTraits<JpegEncodeAccelerator>> |
| class JpegEncodeAcceleratorStub |
| : public mojo::MessageReceiverWithResponderStatus { |
| public: |
| using ImplPointerType = typename ImplRefTraits::PointerType; |
| |
| JpegEncodeAcceleratorStub() = default; |
| ~JpegEncodeAcceleratorStub() override = default; |
| |
| void set_sink(ImplPointerType sink) { sink_ = std::move(sink); } |
| ImplPointerType& sink() { return sink_; } |
| |
| bool Accept(mojo::Message* message) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return JpegEncodeAcceleratorStubDispatch::Accept( |
| ImplRefTraits::GetRawPointer(&sink_), message); |
| } |
| |
| bool AcceptWithResponder( |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return JpegEncodeAcceleratorStubDispatch::AcceptWithResponder( |
| ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder)); |
| } |
| |
| private: |
| ImplPointerType sink_; |
| }; |
| class JpegEncodeAcceleratorRequestValidator : public mojo::MessageReceiver { |
| public: |
| bool Accept(mojo::Message* message) override; |
| }; |
| class JpegEncodeAcceleratorResponseValidator : public mojo::MessageReceiver { |
| public: |
| bool Accept(mojo::Message* message) override; |
| }; |
| |
| |
| |
| |
| |
| } // cros::mojom |
| |
| namespace mojo { |
| |
| } // namespace mojo |
| |
| #endif // CAMERA_MOJO_GPU_JPEG_ENCODE_ACCELERATOR_MOJOM_H_ |