chromium/gpu/ipc/common/gpu_info_mojom_traits.cc

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "gpu/ipc/common/gpu_info_mojom_traits.h"
#include "build/build_config.h"

#include "base/notreached.h"
#include "mojo/public/cpp/base/time_mojom_traits.h"

#if BUILDFLAG(ENABLE_VULKAN)
#include "gpu/ipc/common/vulkan_info_mojom_traits.h"
#endif

namespace mojo {

// static
bool StructTraits<gpu::mojom::GpuDeviceDataView, gpu::GPUInfo::GPUDevice>::Read(
    gpu::mojom::GpuDeviceDataView data,
    gpu::GPUInfo::GPUDevice* out) {}

// static
gpu::mojom::VideoCodecProfile
EnumTraits<gpu::mojom::VideoCodecProfile, gpu::VideoCodecProfile>::ToMojom(
    gpu::VideoCodecProfile video_codec_profile) {}

// static
bool EnumTraits<gpu::mojom::VideoCodecProfile, gpu::VideoCodecProfile>::
    FromMojom(gpu::mojom::VideoCodecProfile input,
              gpu::VideoCodecProfile* out) {}

// static
bool StructTraits<gpu::mojom::VideoDecodeAcceleratorSupportedProfileDataView,
                  gpu::VideoDecodeAcceleratorSupportedProfile>::
    Read(gpu::mojom::VideoDecodeAcceleratorSupportedProfileDataView data,
         gpu::VideoDecodeAcceleratorSupportedProfile* out) {}

// static
bool StructTraits<gpu::mojom::VideoDecodeAcceleratorCapabilitiesDataView,
                  gpu::VideoDecodeAcceleratorCapabilities>::
    Read(gpu::mojom::VideoDecodeAcceleratorCapabilitiesDataView data,
         gpu::VideoDecodeAcceleratorCapabilities* out) {}

// static
bool StructTraits<gpu::mojom::VideoEncodeAcceleratorSupportedProfileDataView,
                  gpu::VideoEncodeAcceleratorSupportedProfile>::
    Read(gpu::mojom::VideoEncodeAcceleratorSupportedProfileDataView data,
         gpu::VideoEncodeAcceleratorSupportedProfile* out) {}

// static
gpu::mojom::ImageDecodeAcceleratorType EnumTraits<
    gpu::mojom::ImageDecodeAcceleratorType,
    gpu::ImageDecodeAcceleratorType>::ToMojom(gpu::ImageDecodeAcceleratorType
                                                  image_type) {}

// static
bool EnumTraits<gpu::mojom::ImageDecodeAcceleratorType,
                gpu::ImageDecodeAcceleratorType>::
    FromMojom(gpu::mojom::ImageDecodeAcceleratorType input,
              gpu::ImageDecodeAcceleratorType* out) {}

// static
gpu::mojom::ImageDecodeAcceleratorSubsampling
EnumTraits<gpu::mojom::ImageDecodeAcceleratorSubsampling,
           gpu::ImageDecodeAcceleratorSubsampling>::
    ToMojom(gpu::ImageDecodeAcceleratorSubsampling subsampling) {}

// static
bool EnumTraits<gpu::mojom::ImageDecodeAcceleratorSubsampling,
                gpu::ImageDecodeAcceleratorSubsampling>::
    FromMojom(gpu::mojom::ImageDecodeAcceleratorSubsampling input,
              gpu::ImageDecodeAcceleratorSubsampling* out) {}

// static
bool StructTraits<gpu::mojom::ImageDecodeAcceleratorSupportedProfileDataView,
                  gpu::ImageDecodeAcceleratorSupportedProfile>::
    Read(gpu::mojom::ImageDecodeAcceleratorSupportedProfileDataView data,
         gpu::ImageDecodeAcceleratorSupportedProfile* out) {}

#if BUILDFLAG(IS_WIN)
// static
gpu::mojom::OverlaySupport
EnumTraits<gpu::mojom::OverlaySupport, gpu::OverlaySupport>::ToMojom(
    gpu::OverlaySupport support) {
  switch (support) {
    case gpu::OverlaySupport::kNone:
      return gpu::mojom::OverlaySupport::NONE;
    case gpu::OverlaySupport::kDirect:
      return gpu::mojom::OverlaySupport::DIRECT;
    case gpu::OverlaySupport::kScaling:
      return gpu::mojom::OverlaySupport::SCALING;
    case gpu::OverlaySupport::kSoftware:
      return gpu::mojom::OverlaySupport::SOFTWARE;
  }
}

bool EnumTraits<gpu::mojom::OverlaySupport, gpu::OverlaySupport>::FromMojom(
    gpu::mojom::OverlaySupport input,
    gpu::OverlaySupport* out) {
  switch (input) {
    case gpu::mojom::OverlaySupport::NONE:
      *out = gpu::OverlaySupport::kNone;
      break;
    case gpu::mojom::OverlaySupport::DIRECT:
      *out = gpu::OverlaySupport::kDirect;
      break;
    case gpu::mojom::OverlaySupport::SCALING:
      *out = gpu::OverlaySupport::kScaling;
      break;
    case gpu::mojom::OverlaySupport::SOFTWARE:
      *out = gpu::OverlaySupport::kSoftware;
      break;
  }
  return true;
}

bool StructTraits<gpu::mojom::OverlayInfoDataView, gpu::OverlayInfo>::Read(
    gpu::mojom::OverlayInfoDataView data,
    gpu::OverlayInfo* out) {
  out->direct_composition = data.direct_composition();
  out->supports_overlays = data.supports_overlays();
  return data.ReadYuy2OverlaySupport(&out->yuy2_overlay_support) &&
         data.ReadNv12OverlaySupport(&out->nv12_overlay_support) &&
         data.ReadBgra8OverlaySupport(&out->bgra8_overlay_support) &&
         data.ReadRgb10a2OverlaySupport(&out->rgb10a2_overlay_support) &&
         data.ReadP010OverlaySupport(&out->p010_overlay_support);
}
#endif

bool StructTraits<gpu::mojom::GpuInfoDataView, gpu::GPUInfo>::Read(
    gpu::mojom::GpuInfoDataView data,
    gpu::GPUInfo* out) {}

}  // namespace mojo