#include "gpu/config/gpu_info.h"
#include <stdint.h>
#include "base/logging.h"
#include "base/notreached.h"
#include "build/build_config.h"
#include "gpu/config/gpu_util.h"
namespace {
void EnumerateGPUDevice(const gpu::GPUInfo::GPUDevice& device,
gpu::GPUInfo::Enumerator* enumerator) { … }
void EnumerateVideoDecodeAcceleratorSupportedProfile(
const gpu::VideoDecodeAcceleratorSupportedProfile& profile,
gpu::GPUInfo::Enumerator* enumerator) { … }
void EnumerateVideoEncodeAcceleratorSupportedProfile(
const gpu::VideoEncodeAcceleratorSupportedProfile& profile,
gpu::GPUInfo::Enumerator* enumerator) { … }
const char* ImageDecodeAcceleratorTypeToString(
gpu::ImageDecodeAcceleratorType type) { … }
const char* ImageDecodeAcceleratorSubsamplingToString(
gpu::ImageDecodeAcceleratorSubsampling subsampling) { … }
void EnumerateImageDecodeAcceleratorSupportedProfile(
const gpu::ImageDecodeAcceleratorSupportedProfile& profile,
gpu::GPUInfo::Enumerator* enumerator) { … }
#if BUILDFLAG(IS_WIN)
void EnumerateOverlayInfo(const gpu::OverlayInfo& info,
gpu::GPUInfo::Enumerator* enumerator) {
enumerator->BeginOverlayInfo();
enumerator->AddBool("directComposition", info.direct_composition);
enumerator->AddBool("supportsOverlays", info.supports_overlays);
enumerator->AddString("yuy2OverlaySupport",
gpu::OverlaySupportToString(info.yuy2_overlay_support));
enumerator->AddString("nv12OverlaySupport",
gpu::OverlaySupportToString(info.nv12_overlay_support));
enumerator->AddString("bgra8OverlaySupport", gpu::OverlaySupportToString(
info.bgra8_overlay_support));
enumerator->AddString(
"rgb10a2OverlaySupport",
gpu::OverlaySupportToString(info.rgb10a2_overlay_support));
enumerator->AddString("p010OverlaySupport",
gpu::OverlaySupportToString(info.p010_overlay_support));
enumerator->EndOverlayInfo();
}
#endif
}
namespace gpu {
#if BUILDFLAG(IS_WIN)
const char* OverlaySupportToString(gpu::OverlaySupport support) {
switch (support) {
case gpu::OverlaySupport::kNone:
return "NONE";
case gpu::OverlaySupport::kDirect:
return "DIRECT";
case gpu::OverlaySupport::kScaling:
return "SCALING";
case gpu::OverlaySupport::kSoftware:
return "SOFTWARE";
}
}
#endif
VideoDecodeAcceleratorCapabilities::VideoDecodeAcceleratorCapabilities()
: … { … }
VideoDecodeAcceleratorCapabilities::VideoDecodeAcceleratorCapabilities(
const VideoDecodeAcceleratorCapabilities& other) = default;
VideoDecodeAcceleratorCapabilities::~VideoDecodeAcceleratorCapabilities() =
default;
ImageDecodeAcceleratorSupportedProfile::ImageDecodeAcceleratorSupportedProfile()
: … { … }
ImageDecodeAcceleratorSupportedProfile::ImageDecodeAcceleratorSupportedProfile(
const ImageDecodeAcceleratorSupportedProfile& other) = default;
ImageDecodeAcceleratorSupportedProfile::ImageDecodeAcceleratorSupportedProfile(
ImageDecodeAcceleratorSupportedProfile&& other) = default;
ImageDecodeAcceleratorSupportedProfile::
~ImageDecodeAcceleratorSupportedProfile() = default;
ImageDecodeAcceleratorSupportedProfile& ImageDecodeAcceleratorSupportedProfile::
operator=(const ImageDecodeAcceleratorSupportedProfile& other) = default;
ImageDecodeAcceleratorSupportedProfile& ImageDecodeAcceleratorSupportedProfile::
operator=(ImageDecodeAcceleratorSupportedProfile&& other) = default;
GPUInfo::GPUDevice::GPUDevice() = default;
GPUInfo::GPUDevice::GPUDevice(const GPUInfo::GPUDevice& other) = default;
GPUInfo::GPUDevice::GPUDevice(GPUInfo::GPUDevice&& other) noexcept = default;
GPUInfo::GPUDevice::~GPUDevice() noexcept = default;
GPUInfo::GPUDevice& GPUInfo::GPUDevice::operator=(
const GPUInfo::GPUDevice& other) = default;
GPUInfo::GPUDevice& GPUInfo::GPUDevice::operator=(
GPUInfo::GPUDevice&& other) noexcept = default;
bool GPUInfo::GPUDevice::IsSoftwareRenderer() const { … }
GPUInfo::GPUInfo()
: … { … }
GPUInfo::GPUInfo(const GPUInfo& other) = default;
GPUInfo::~GPUInfo() = default;
GPUInfo::GPUDevice& GPUInfo::active_gpu() { … }
const GPUInfo::GPUDevice& GPUInfo::active_gpu() const { … }
bool GPUInfo::IsInitialized() const { … }
bool GPUInfo::UsesSwiftShader() const { … }
unsigned int GPUInfo::GpuCount() const { … }
const GPUInfo::GPUDevice* GPUInfo::GetGpuByPreference(
gl::GpuPreference preference) const { … }
#if BUILDFLAG(IS_WIN)
GPUInfo::GPUDevice* GPUInfo::FindGpuByLuid(DWORD low_part, LONG high_part) {
if (gpu.luid.LowPart == low_part && gpu.luid.HighPart == high_part)
return &gpu;
for (auto& device : secondary_gpus) {
if (device.luid.LowPart == low_part && device.luid.HighPart == high_part)
return &device;
}
return nullptr;
}
#endif
void GPUInfo::EnumerateFields(Enumerator* enumerator) const { … }
}