forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There is a global CommandBufferTaskExecutor that gets created if an instance isn't provided. This task executor picks up the current command line to create GpuPreferences on first use, which caused problems where depending on what test ran first the GpuPreferences would be different and later tests would fail. Don't use the global task executor in gl_tests. Move and rename InProcessGpuThreadHolder so that each test which needs it can instantiate the object itself. Also enable GLInProcessCommandBufferTest.CreateImage again. Bug: 897456 Change-Id: Icdc307bd68453fdc2b898a9765a3f903b21fdfe8 Reviewed-on: https://chromium-review.googlesource.com/c/1298214 Commit-Queue: kylechar <kylechar@chromium.org> Reviewed-by: Antoine Labour <piman@chromium.org> Cr-Commit-Position: refs/heads/master@{#603143}
- Loading branch information
kylechar
authored and
Commit Bot
committed
Oct 26, 2018
1 parent
f33f9de
commit d6d5893
Showing
8 changed files
with
194 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// Copyright 2018 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "gpu/ipc/in_process_gpu_thread_holder.h" | ||
|
||
#include "base/command_line.h" | ||
#include "base/synchronization/waitable_event.h" | ||
#include "base/threading/thread_task_runner_handle.h" | ||
#include "gpu/command_buffer/service/scheduler.h" | ||
#include "gpu/command_buffer/service/service_utils.h" | ||
#include "gpu/command_buffer/service/sync_point_manager.h" | ||
#include "gpu/config/gpu_info_collector.h" | ||
#include "gpu/config/gpu_util.h" | ||
#include "gpu/ipc/gpu_in_process_thread_service.h" | ||
#include "gpu/ipc/host/gpu_memory_buffer_support.h" | ||
|
||
namespace gpu { | ||
|
||
InProcessGpuThreadHolder::InProcessGpuThreadHolder() | ||
: base::Thread("GpuThread") { | ||
DCHECK(base::CommandLine::InitializedForCurrentProcess()); | ||
auto* command_line = base::CommandLine::ForCurrentProcess(); | ||
gpu_preferences_ = gles2::ParseGpuPreferences(command_line); | ||
gpu_preferences_.texture_target_exception_list = | ||
CreateBufferUsageAndFormatExceptionList(); | ||
|
||
gpu::GPUInfo gpu_info; | ||
gpu::CollectGraphicsInfoForTesting(&gpu_info); | ||
gpu::GpuFeatureInfo gpu_feature_info = gpu::ComputeGpuFeatureInfo( | ||
gpu_info, gpu_preferences_, command_line, nullptr); | ||
|
||
Start(); | ||
} | ||
|
||
InProcessGpuThreadHolder::~InProcessGpuThreadHolder() { | ||
// Ensure members created on GPU thread are destroyed there too. | ||
task_runner()->PostTask( | ||
FROM_HERE, base::BindOnce(&InProcessGpuThreadHolder::DeleteOnGpuThread, | ||
base::Unretained(this))); | ||
Stop(); | ||
} | ||
|
||
GpuPreferences* InProcessGpuThreadHolder::GetGpuPreferences() { | ||
DCHECK(!task_executor_); | ||
return &gpu_preferences_; | ||
} | ||
|
||
GpuFeatureInfo* InProcessGpuThreadHolder::GetGpuFeatureInfo() { | ||
DCHECK(!task_executor_); | ||
return &gpu_feature_info_; | ||
} | ||
|
||
void InProcessGpuThreadHolder::SetGpuFeatureInfo( | ||
const GpuFeatureInfo& gpu_feature_info) { | ||
DCHECK(!task_executor_); | ||
gpu_feature_info_ = gpu_feature_info; | ||
} | ||
|
||
scoped_refptr<CommandBufferTaskExecutor> | ||
InProcessGpuThreadHolder::GetTaskExecutor() { | ||
if (!task_executor_) { | ||
base::WaitableEvent completion; | ||
task_runner()->PostTask( | ||
FROM_HERE, | ||
base::BindOnce(&InProcessGpuThreadHolder::InitializeOnGpuThread, | ||
base::Unretained(this), &completion)); | ||
completion.Wait(); | ||
} | ||
return task_executor_; | ||
} | ||
|
||
void InProcessGpuThreadHolder::InitializeOnGpuThread( | ||
base::WaitableEvent* completion) { | ||
sync_point_manager_ = std::make_unique<SyncPointManager>(); | ||
scheduler_ = | ||
std::make_unique<Scheduler>(task_runner(), sync_point_manager_.get()); | ||
task_executor_ = base::MakeRefCounted<GpuInProcessThreadService>( | ||
task_runner(), scheduler_.get(), sync_point_manager_.get(), nullptr, | ||
nullptr, gl::GLSurfaceFormat(), gpu_feature_info_, gpu_preferences_); | ||
|
||
completion->Signal(); | ||
} | ||
|
||
void InProcessGpuThreadHolder::DeleteOnGpuThread() { | ||
task_executor_.reset(); | ||
scheduler_.reset(); | ||
sync_point_manager_.reset(); | ||
} | ||
|
||
} // namespace gpu |
Oops, something went wrong.