| // camera/mojo/gpu/dmabuf.mojom.cc 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. |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wunused-private-field" |
| #endif |
| |
| #include "camera/mojo/gpu/dmabuf.mojom.h" |
| |
| #include <math.h> |
| #include <stdint.h> |
| #include <utility> |
| |
| #include "base/debug/alias.h" |
| #include "base/hash/md5_constexpr.h" |
| #include "base/run_loop.h" |
| #include "base/strings/string_number_conversions.h" |
| #include "base/task/thread_pool/thread_pool_instance.h" |
| #include "base/trace_event/trace_event.h" |
| #include "base/trace_event/typed_macros.h" |
| #include "mojo/public/cpp/bindings/features.h" |
| #include "mojo/public/cpp/bindings/lib/default_construct_tag_internal.h" |
| #include "mojo/public/cpp/bindings/lib/generated_code_util.h" |
| #include "mojo/public/cpp/bindings/lib/message_internal.h" |
| #include "mojo/public/cpp/bindings/lib/proxy_to_responder.h" |
| #include "mojo/public/cpp/bindings/lib/send_message_helper.h" |
| #include "mojo/public/cpp/bindings/lib/serialization_util.h" |
| #include "mojo/public/cpp/bindings/lib/unserialized_message_context.h" |
| #include "mojo/public/cpp/bindings/lib/validate_params.h" |
| #include "mojo/public/cpp/bindings/lib/validation_errors.h" |
| #include "mojo/public/cpp/bindings/mojo_buildflags.h" |
| #include "mojo/public/cpp/bindings/urgent_message_scope.h" |
| #include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h" |
| #include "third_party/perfetto/include/perfetto/tracing/traced_value.h" |
| |
| #include "camera/mojo/gpu/dmabuf.mojom-params-data.h" |
| #include "camera/mojo/gpu/dmabuf.mojom-shared-message-ids.h" |
| |
| #include "camera/mojo/gpu/dmabuf.mojom-import-headers.h" |
| #include "camera/mojo/gpu/dmabuf.mojom-test-utils.h" |
| |
| |
| namespace cros::mojom { |
| DmaBufPlane::DmaBufPlane() |
| : fd_handle(), |
| stride(), |
| offset(), |
| size() {} |
| |
| DmaBufPlane::DmaBufPlane( |
| ::mojo::ScopedHandle fd_handle_in, |
| int32_t stride_in, |
| uint32_t offset_in, |
| uint32_t size_in) |
| : fd_handle(std::move(fd_handle_in)), |
| stride(std::move(stride_in)), |
| offset(std::move(offset_in)), |
| size(std::move(size_in)) {} |
| |
| DmaBufPlane::~DmaBufPlane() = default; |
| |
| void DmaBufPlane::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "fd_handle"), this->fd_handle, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type ::mojo::ScopedHandle>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "stride"), this->stride, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type int32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "offset"), this->offset, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "size"), this->size, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool DmaBufPlane::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| DmaBufVideoFrame::DmaBufVideoFrame() |
| : format(), |
| coded_width(), |
| coded_height(), |
| planes(), |
| has_modifier(), |
| modifier() {} |
| |
| DmaBufVideoFrame::DmaBufVideoFrame( |
| VideoPixelFormat format_in, |
| uint32_t coded_width_in, |
| uint32_t coded_height_in, |
| std::vector<DmaBufPlanePtr> planes_in) |
| : format(std::move(format_in)), |
| coded_width(std::move(coded_width_in)), |
| coded_height(std::move(coded_height_in)), |
| planes(std::move(planes_in)), |
| has_modifier(), |
| modifier() {} |
| |
| DmaBufVideoFrame::DmaBufVideoFrame( |
| VideoPixelFormat format_in, |
| uint32_t coded_width_in, |
| uint32_t coded_height_in, |
| std::vector<DmaBufPlanePtr> planes_in, |
| bool has_modifier_in, |
| uint64_t modifier_in) |
| : format(std::move(format_in)), |
| coded_width(std::move(coded_width_in)), |
| coded_height(std::move(coded_height_in)), |
| planes(std::move(planes_in)), |
| has_modifier(std::move(has_modifier_in)), |
| modifier(std::move(modifier_in)) {} |
| |
| DmaBufVideoFrame::~DmaBufVideoFrame() = default; |
| |
| void DmaBufVideoFrame::WriteIntoTrace( |
| perfetto::TracedValue traced_context) const { |
| [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary(); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "format"), this->format, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type VideoPixelFormat>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "coded_width"), this->coded_width, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "coded_height"), this->coded_height, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint32_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "planes"), this->planes, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type std::vector<DmaBufPlanePtr>>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "has_modifier"), this->has_modifier, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type bool>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| perfetto::WriteIntoTracedValueWithFallback( |
| dict.AddItem( |
| "modifier"), this->modifier, |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| "<value of type uint64_t>" |
| #else |
| "<value>" |
| #endif // BUILDFLAG(MOJO_TRACE_ENABLED) |
| ); |
| } |
| |
| bool DmaBufVideoFrame::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| return Data_::Validate(data, validation_context); |
| } |
| |
| |
| } // cros::mojom |
| |
| |
| namespace mojo { |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::DmaBufPlane::DataView, ::cros::mojom::DmaBufPlanePtr>::Read( |
| ::cros::mojom::DmaBufPlane::DataView input, |
| ::cros::mojom::DmaBufPlanePtr* output) { |
| bool success = true; |
| ::cros::mojom::DmaBufPlanePtr result(::cros::mojom::DmaBufPlane::New()); |
| |
| if (success) |
| result->fd_handle = input.TakeFdHandle(); |
| if (success) |
| result->stride = input.stride(); |
| if (success) |
| result->offset = input.offset(); |
| if (success) |
| result->size = input.size(); |
| *output = std::move(result); |
| return success; |
| } |
| |
| |
| // static |
| bool StructTraits<::cros::mojom::DmaBufVideoFrame::DataView, ::cros::mojom::DmaBufVideoFramePtr>::Read( |
| ::cros::mojom::DmaBufVideoFrame::DataView input, |
| ::cros::mojom::DmaBufVideoFramePtr* output) { |
| bool success = true; |
| ::cros::mojom::DmaBufVideoFramePtr result(::cros::mojom::DmaBufVideoFrame::New()); |
| |
| if (success && !input.ReadFormat(&result->format)) |
| success = false; |
| if (success) |
| result->coded_width = input.coded_width(); |
| if (success) |
| result->coded_height = input.coded_height(); |
| if (success && !input.ReadPlanes(&result->planes)) |
| success = false; |
| if (success) |
| result->has_modifier = input.has_modifier(); |
| if (success) |
| result->modifier = input.modifier(); |
| *output = std::move(result); |
| return success; |
| } |
| |
| } // namespace mojo |
| |
| |
| // Symbols declared in the -test-utils.h header are defined here instead of a |
| // separate .cc file to save compile time. |
| |
| |
| namespace cros::mojom { |
| |
| |
| |
| |
| } // cros::mojom |
| |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic pop |
| #endif |