--- gpu/ipc/service/gpu_init.cc.orig 2021-07-15 19:13:40 UTC +++ gpu/ipc/service/gpu_init.cc @@ -118,7 +118,7 @@ void InitializePlatformOverlaySettings(GPUInfo* gpu_in } #if BUILDFLAG(IS_CHROMEOS_LACROS) || \ - (defined(OS_LINUX) && !BUILDFLAG(IS_CHROMECAST)) + (defined(OS_LINUX) && !BUILDFLAG(IS_CHROMECAST)) || defined(OS_BSD) bool CanAccessNvidiaDeviceFile() { bool res = true; base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, @@ -129,7 +129,7 @@ bool CanAccessNvidiaDeviceFile() { } return res; } -#endif // BUILDFLAG(IS_CHROMEOS_LACROS) || (defined(OS_LINUX) && +#endif // BUILDFLAG(IS_CHROMEOS_LACROS) || defined(OS_BSD) || (defined(OS_LINUX) && // !BUILDFLAG(IS_CHROMECAST)) class GpuWatchdogInit { @@ -216,7 +216,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandL device_perf_info_ = device_perf_info; } -#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || defined(OS_BSD) if (gpu_info_.gpu.vendor_id == 0x10de && // NVIDIA gpu_info_.gpu.driver_vendor == "NVIDIA" && !CanAccessNvidiaDeviceFile()) return false; @@ -268,7 +268,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandL delayed_watchdog_enable = true; #endif -#if defined(OS_LINUX) || defined(OS_CHROMEOS) +#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) // PreSandbox is mainly for resource handling and not related to the GPU // driver, it doesn't need the GPU watchdog. The loadLibrary may take long // time that killing and restarting the GPU process will not help. @@ -308,7 +308,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandL } bool attempted_startsandbox = false; -#if defined(OS_LINUX) || defined(OS_CHROMEOS) +#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) // On Chrome OS ARM Mali, GPU driver userspace creates threads when // initializing a GL context, so start the sandbox early. // TODO(zmo): Need to collect OS version before this. @@ -317,7 +317,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandL watchdog_thread_.get(), &gpu_info_, gpu_preferences_); attempted_startsandbox = true; } -#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) +#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) base::TimeTicks before_initialize_one_off = base::TimeTicks::Now(); @@ -359,7 +359,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandL } if (gl_initialized && gl_use_swiftshader_ && gl::GetGLImplementation() != gl::kGLImplementationSwiftShaderGL) { -#if defined(OS_LINUX) || defined(OS_CHROMEOS) +#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) VLOG(1) << "Quit GPU process launch to fallback to SwiftShader cleanly " << "on Linux"; return false; @@ -367,7 +367,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandL SaveHardwareGpuInfoAndGpuFeatureInfo(); gl::init::ShutdownGL(true); gl_initialized = false; -#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) +#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) } if (!gl_initialized) { @@ -393,7 +393,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandL } } -#if defined(OS_LINUX) || defined(OS_CHROMEOS) +#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) // The ContentSandboxHelper is currently the only one implementation of // GpuSandboxHelper and it has no dependency. Except on Linux where // VaapiWrapper checks the GL implementation to determine which display @@ -458,7 +458,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandL command_line, gpu_feature_info_, gpu_preferences_.disable_software_rasterizer, false); if (gl_use_swiftshader_) { -#if defined(OS_LINUX) || defined(OS_CHROMEOS) +#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) VLOG(1) << "Quit GPU process launch to fallback to SwiftShader cleanly " << "on Linux"; return false; @@ -473,7 +473,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandL << "failed"; return false; } -#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) +#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) } } else { // gl_use_swiftshader_ == true switch (gpu_preferences_.use_vulkan) { @@ -549,7 +549,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandL InitializePlatformOverlaySettings(&gpu_info_, gpu_feature_info_); -#if defined(OS_LINUX) || defined(OS_CHROMEOS) +#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) // Driver may create a compatibility profile context when collect graphics // information on Linux platform. Try to collect graphics information // based on core profile context after disabling platform extensions. @@ -568,7 +568,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandL return false; } } -#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) +#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) if (gl_use_swiftshader_) { AdjustInfoToSwiftShader(); @@ -755,7 +755,7 @@ void GpuInit::InitializeInProcess(base::CommandLine* c InitializePlatformOverlaySettings(&gpu_info_, gpu_feature_info_); -#if defined(OS_LINUX) || defined(OS_CHROMEOS) +#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) // Driver may create a compatibility profile context when collect graphics // information on Linux platform. Try to collect graphics information // based on core profile context after disabling platform extensions. @@ -776,7 +776,7 @@ void GpuInit::InitializeInProcess(base::CommandLine* c } } } -#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) +#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD) if (gl_use_swiftshader_) { AdjustInfoToSwiftShader();