Commit c4225f93 authored by Zhenyao Mo's avatar Zhenyao Mo Committed by Commit Bot

Pass GpuFeatureInfo through GpuChannelHost.

Right now GpuFeatureInfo is passed from GPU to browser through GpuProcessHost.
However, we will want blacklist decisions on the renderer side also, so this CL
hooks it up with GpuChannelHost.

We will be able to remove blacklisting and driver bugs info from Capabilities
and GPUInfo because now we have GpuFeatureInfo available in the renderer side,
but let's leave the cleanup to a separate CL.

BUG=744658
TEST=bots
R=piman@chromium.org

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I9fe61bcf12dbdda80762bd994402a337e44babc2
Reviewed-on: https://chromium-review.googlesource.com/685301Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504774}
parent fb0b9d31
...@@ -47,7 +47,10 @@ class BrowserGpuChannelHostFactory::EstablishRequest ...@@ -47,7 +47,10 @@ class BrowserGpuChannelHostFactory::EstablishRequest
void Cancel(); void Cancel();
IPC::ChannelHandle& channel_handle() { return channel_handle_; } IPC::ChannelHandle& channel_handle() { return channel_handle_; }
gpu::GPUInfo gpu_info() { return gpu_info_; } const gpu::GPUInfo& gpu_info() const { return gpu_info_; }
const gpu::GpuFeatureInfo& gpu_feature_info() const {
return gpu_feature_info_;
}
private: private:
friend class base::RefCountedThreadSafe<EstablishRequest>; friend class base::RefCountedThreadSafe<EstablishRequest>;
...@@ -56,6 +59,7 @@ class BrowserGpuChannelHostFactory::EstablishRequest ...@@ -56,6 +59,7 @@ class BrowserGpuChannelHostFactory::EstablishRequest
void EstablishOnIO(); void EstablishOnIO();
void OnEstablishedOnIO(const IPC::ChannelHandle& channel_handle, void OnEstablishedOnIO(const IPC::ChannelHandle& channel_handle,
const gpu::GPUInfo& gpu_info, const gpu::GPUInfo& gpu_info,
const gpu::GpuFeatureInfo& gpu_feature_info,
GpuProcessHost::EstablishChannelStatus status); GpuProcessHost::EstablishChannelStatus status);
void FinishOnIO(); void FinishOnIO();
void FinishOnMain(); void FinishOnMain();
...@@ -65,6 +69,7 @@ class BrowserGpuChannelHostFactory::EstablishRequest ...@@ -65,6 +69,7 @@ class BrowserGpuChannelHostFactory::EstablishRequest
const uint64_t gpu_client_tracing_id_; const uint64_t gpu_client_tracing_id_;
IPC::ChannelHandle channel_handle_; IPC::ChannelHandle channel_handle_;
gpu::GPUInfo gpu_info_; gpu::GPUInfo gpu_info_;
gpu::GpuFeatureInfo gpu_feature_info_;
bool finished_; bool finished_;
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
}; };
...@@ -118,6 +123,7 @@ void BrowserGpuChannelHostFactory::EstablishRequest::EstablishOnIO() { ...@@ -118,6 +123,7 @@ void BrowserGpuChannelHostFactory::EstablishRequest::EstablishOnIO() {
void BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO( void BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO(
const IPC::ChannelHandle& channel_handle, const IPC::ChannelHandle& channel_handle,
const gpu::GPUInfo& gpu_info, const gpu::GPUInfo& gpu_info,
const gpu::GpuFeatureInfo& gpu_feature_info,
GpuProcessHost::EstablishChannelStatus status) { GpuProcessHost::EstablishChannelStatus status) {
if (!channel_handle.mojo_handle.is_valid() && if (!channel_handle.mojo_handle.is_valid() &&
status == GpuProcessHost::EstablishChannelStatus::GPU_HOST_INVALID) { status == GpuProcessHost::EstablishChannelStatus::GPU_HOST_INVALID) {
...@@ -128,6 +134,7 @@ void BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO( ...@@ -128,6 +134,7 @@ void BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO(
} }
channel_handle_ = channel_handle; channel_handle_ = channel_handle;
gpu_info_ = gpu_info; gpu_info_ = gpu_info;
gpu_feature_info_ = gpu_feature_info;
FinishOnIO(); FinishOnIO();
} }
...@@ -308,6 +315,7 @@ void BrowserGpuChannelHostFactory::GpuChannelEstablished() { ...@@ -308,6 +315,7 @@ void BrowserGpuChannelHostFactory::GpuChannelEstablished() {
GetContentClient()->SetGpuInfo(pending_request_->gpu_info()); GetContentClient()->SetGpuInfo(pending_request_->gpu_info());
gpu_channel_ = gpu::GpuChannelHost::Create( gpu_channel_ = gpu::GpuChannelHost::Create(
this, gpu_client_id_, pending_request_->gpu_info(), this, gpu_client_id_, pending_request_->gpu_info(),
pending_request_->gpu_feature_info(),
pending_request_->channel_handle(), shutdown_event_.get(), pending_request_->channel_handle(), shutdown_event_.get(),
gpu_memory_buffer_manager_.get()); gpu_memory_buffer_manager_.get());
} }
......
...@@ -42,11 +42,13 @@ void GpuClient::OnEstablishGpuChannel( ...@@ -42,11 +42,13 @@ void GpuClient::OnEstablishGpuChannel(
const EstablishGpuChannelCallback& callback, const EstablishGpuChannelCallback& callback,
const IPC::ChannelHandle& channel, const IPC::ChannelHandle& channel,
const gpu::GPUInfo& gpu_info, const gpu::GPUInfo& gpu_info,
const gpu::GpuFeatureInfo& gpu_feature_info,
GpuProcessHost::EstablishChannelStatus status) { GpuProcessHost::EstablishChannelStatus status) {
if (status == GpuProcessHost::EstablishChannelStatus::GPU_ACCESS_DENIED) { if (status == GpuProcessHost::EstablishChannelStatus::GPU_ACCESS_DENIED) {
// GPU access is not allowed. Notify the client immediately. // GPU access is not allowed. Notify the client immediately.
DCHECK(!channel.mojo_handle.is_valid()); DCHECK(!channel.mojo_handle.is_valid());
callback.Run(render_process_id_, mojo::ScopedMessagePipeHandle(), gpu_info); callback.Run(render_process_id_, mojo::ScopedMessagePipeHandle(), gpu_info,
gpu_feature_info);
return; return;
} }
...@@ -59,7 +61,8 @@ void GpuClient::OnEstablishGpuChannel( ...@@ -59,7 +61,8 @@ void GpuClient::OnEstablishGpuChannel(
DCHECK(channel.mojo_handle.is_valid()); DCHECK(channel.mojo_handle.is_valid());
mojo::ScopedMessagePipeHandle channel_handle; mojo::ScopedMessagePipeHandle channel_handle;
channel_handle.reset(channel.mojo_handle); channel_handle.reset(channel.mojo_handle);
callback.Run(render_process_id_, std::move(channel_handle), gpu_info); callback.Run(render_process_id_, std::move(channel_handle), gpu_info,
gpu_feature_info);
} }
void GpuClient::OnCreateGpuMemoryBuffer( void GpuClient::OnCreateGpuMemoryBuffer(
...@@ -73,7 +76,7 @@ void GpuClient::EstablishGpuChannel( ...@@ -73,7 +76,7 @@ void GpuClient::EstablishGpuChannel(
GpuProcessHost* host = GpuProcessHost::Get(); GpuProcessHost* host = GpuProcessHost::Get();
if (!host) { if (!host) {
OnEstablishGpuChannel( OnEstablishGpuChannel(
callback, IPC::ChannelHandle(), gpu::GPUInfo(), callback, IPC::ChannelHandle(), gpu::GPUInfo(), gpu::GpuFeatureInfo(),
GpuProcessHost::EstablishChannelStatus::GPU_ACCESS_DENIED); GpuProcessHost::EstablishChannelStatus::GPU_ACCESS_DENIED);
return; return;
} }
......
...@@ -25,6 +25,7 @@ class GpuClient : public ui::mojom::Gpu { ...@@ -25,6 +25,7 @@ class GpuClient : public ui::mojom::Gpu {
void OnEstablishGpuChannel(const EstablishGpuChannelCallback& callback, void OnEstablishGpuChannel(const EstablishGpuChannelCallback& callback,
const IPC::ChannelHandle& channel, const IPC::ChannelHandle& channel,
const gpu::GPUInfo& gpu_info, const gpu::GPUInfo& gpu_info,
const gpu::GpuFeatureInfo& gpu_feature_info,
GpuProcessHost::EstablishChannelStatus status); GpuProcessHost::EstablishChannelStatus status);
void OnCreateGpuMemoryBuffer(const CreateGpuMemoryBufferCallback& callback, void OnCreateGpuMemoryBuffer(const CreateGpuMemoryBufferCallback& callback,
const gfx::GpuMemoryBufferHandle& handle); const gfx::GpuMemoryBufferHandle& handle);
......
...@@ -197,6 +197,11 @@ void GpuDataManagerImpl::UpdateGpuFeatureInfo( ...@@ -197,6 +197,11 @@ void GpuDataManagerImpl::UpdateGpuFeatureInfo(
private_->UpdateGpuFeatureInfo(gpu_feature_info); private_->UpdateGpuFeatureInfo(gpu_feature_info);
} }
gpu::GpuFeatureInfo GpuDataManagerImpl::GetGpuFeatureInfo() const {
base::AutoLock auto_lock(lock_);
return private_->GetGpuFeatureInfo();
}
void GpuDataManagerImpl::AppendRendererCommandLine( void GpuDataManagerImpl::AppendRendererCommandLine(
base::CommandLine* command_line) const { base::CommandLine* command_line) const {
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
......
...@@ -115,6 +115,8 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager { ...@@ -115,6 +115,8 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager {
// of GPU rasterization. In the future this will be used for more features. // of GPU rasterization. In the future this will be used for more features.
void UpdateGpuFeatureInfo(const gpu::GpuFeatureInfo& gpu_feature_info); void UpdateGpuFeatureInfo(const gpu::GpuFeatureInfo& gpu_feature_info);
gpu::GpuFeatureInfo GetGpuFeatureInfo() const;
// Insert disable-feature switches corresponding to preliminary gpu feature // Insert disable-feature switches corresponding to preliminary gpu feature
// flags into the renderer process command line. // flags into the renderer process command line.
void AppendRendererCommandLine(base::CommandLine* command_line) const; void AppendRendererCommandLine(base::CommandLine* command_line) const;
......
...@@ -708,6 +708,10 @@ void GpuDataManagerImplPrivate::UpdateGpuFeatureInfo( ...@@ -708,6 +708,10 @@ void GpuDataManagerImplPrivate::UpdateGpuFeatureInfo(
} }
} }
gpu::GpuFeatureInfo GpuDataManagerImplPrivate::GetGpuFeatureInfo() const {
return gpu_feature_info_;
}
void GpuDataManagerImplPrivate::AppendRendererCommandLine( void GpuDataManagerImplPrivate::AppendRendererCommandLine(
base::CommandLine* command_line) const { base::CommandLine* command_line) const {
DCHECK(command_line); DCHECK(command_line);
......
...@@ -71,6 +71,7 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate { ...@@ -71,6 +71,7 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
void UpdateGpuInfo(const gpu::GPUInfo& gpu_info); void UpdateGpuInfo(const gpu::GPUInfo& gpu_info);
void UpdateGpuFeatureInfo(const gpu::GpuFeatureInfo& gpu_feature_info); void UpdateGpuFeatureInfo(const gpu::GpuFeatureInfo& gpu_feature_info);
gpu::GpuFeatureInfo GetGpuFeatureInfo() const;
void AppendRendererCommandLine(base::CommandLine* command_line) const; void AppendRendererCommandLine(base::CommandLine* command_line) const;
......
...@@ -693,7 +693,7 @@ void GpuProcessHost::EstablishGpuChannel( ...@@ -693,7 +693,7 @@ void GpuProcessHost::EstablishGpuChannel(
// If GPU features are already blacklisted, no need to establish the channel. // If GPU features are already blacklisted, no need to establish the channel.
if (!GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL)) { if (!GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL)) {
DVLOG(1) << "GPU blacklisted, refusing to open a GPU channel."; DVLOG(1) << "GPU blacklisted, refusing to open a GPU channel.";
callback.Run(IPC::ChannelHandle(), gpu::GPUInfo(), callback.Run(IPC::ChannelHandle(), gpu::GPUInfo(), gpu::GpuFeatureInfo(),
EstablishChannelStatus::GPU_ACCESS_DENIED); EstablishChannelStatus::GPU_ACCESS_DENIED);
return; return;
} }
...@@ -776,7 +776,7 @@ void GpuProcessHost::OnChannelEstablished( ...@@ -776,7 +776,7 @@ void GpuProcessHost::OnChannelEstablished(
if (channel_handle.is_valid() && if (channel_handle.is_valid() &&
!gpu_data_manager->GpuAccessAllowed(nullptr)) { !gpu_data_manager->GpuAccessAllowed(nullptr)) {
gpu_service_ptr_->CloseChannel(client_id); gpu_service_ptr_->CloseChannel(client_id);
callback.Run(IPC::ChannelHandle(), gpu::GPUInfo(), callback.Run(IPC::ChannelHandle(), gpu::GPUInfo(), gpu::GpuFeatureInfo(),
EstablishChannelStatus::GPU_ACCESS_DENIED); EstablishChannelStatus::GPU_ACCESS_DENIED);
RecordLogMessage(logging::LOG_WARNING, "WARNING", RecordLogMessage(logging::LOG_WARNING, "WARNING",
"Hardware acceleration is unavailable."); "Hardware acceleration is unavailable.");
...@@ -784,7 +784,9 @@ void GpuProcessHost::OnChannelEstablished( ...@@ -784,7 +784,9 @@ void GpuProcessHost::OnChannelEstablished(
} }
callback.Run(IPC::ChannelHandle(channel_handle.release()), callback.Run(IPC::ChannelHandle(channel_handle.release()),
gpu_data_manager->GetGPUInfo(), EstablishChannelStatus::SUCCESS); gpu_data_manager->GetGPUInfo(),
gpu_data_manager->GetGpuFeatureInfo(),
EstablishChannelStatus::SUCCESS);
} }
void GpuProcessHost::OnGpuMemoryBufferCreated( void GpuProcessHost::OnGpuMemoryBufferCreated(
...@@ -1085,7 +1087,7 @@ void GpuProcessHost::SendOutstandingReplies() { ...@@ -1085,7 +1087,7 @@ void GpuProcessHost::SendOutstandingReplies() {
while (!channel_requests_.empty()) { while (!channel_requests_.empty()) {
auto callback = channel_requests_.front(); auto callback = channel_requests_.front();
channel_requests_.pop(); channel_requests_.pop();
callback.Run(IPC::ChannelHandle(), gpu::GPUInfo(), callback.Run(IPC::ChannelHandle(), gpu::GPUInfo(), gpu::GpuFeatureInfo(),
EstablishChannelStatus::GPU_HOST_INVALID); EstablishChannelStatus::GPU_HOST_INVALID);
} }
......
...@@ -75,6 +75,7 @@ class GpuProcessHost : public BrowserChildProcessHostDelegate, ...@@ -75,6 +75,7 @@ class GpuProcessHost : public BrowserChildProcessHostDelegate,
using EstablishChannelCallback = using EstablishChannelCallback =
base::Callback<void(const IPC::ChannelHandle&, base::Callback<void(const IPC::ChannelHandle&,
const gpu::GPUInfo&, const gpu::GPUInfo&,
const gpu::GpuFeatureInfo&,
EstablishChannelStatus status)>; EstablishChannelStatus status)>;
enum class BufferCreationStatus { enum class BufferCreationStatus {
......
...@@ -34,12 +34,14 @@ scoped_refptr<GpuChannelHost> GpuChannelHost::Create( ...@@ -34,12 +34,14 @@ scoped_refptr<GpuChannelHost> GpuChannelHost::Create(
GpuChannelHostFactory* factory, GpuChannelHostFactory* factory,
int channel_id, int channel_id,
const gpu::GPUInfo& gpu_info, const gpu::GPUInfo& gpu_info,
const gpu::GpuFeatureInfo& gpu_feature_info,
const IPC::ChannelHandle& channel_handle, const IPC::ChannelHandle& channel_handle,
base::WaitableEvent* shutdown_event, base::WaitableEvent* shutdown_event,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) { gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) {
DCHECK(factory->IsMainThread()); DCHECK(factory->IsMainThread());
scoped_refptr<GpuChannelHost> host = new GpuChannelHost( scoped_refptr<GpuChannelHost> host =
factory, channel_id, gpu_info, gpu_memory_buffer_manager); new GpuChannelHost(factory, channel_id, gpu_info, gpu_feature_info,
gpu_memory_buffer_manager);
host->Connect(channel_handle, shutdown_event); host->Connect(channel_handle, shutdown_event);
return host; return host;
} }
...@@ -48,10 +50,12 @@ GpuChannelHost::GpuChannelHost( ...@@ -48,10 +50,12 @@ GpuChannelHost::GpuChannelHost(
GpuChannelHostFactory* factory, GpuChannelHostFactory* factory,
int channel_id, int channel_id,
const gpu::GPUInfo& gpu_info, const gpu::GPUInfo& gpu_info,
const gpu::GpuFeatureInfo& gpu_feature_info,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager)
: factory_(factory), : factory_(factory),
channel_id_(channel_id), channel_id_(channel_id),
gpu_info_(gpu_info), gpu_info_(gpu_info),
gpu_feature_info_(gpu_feature_info),
gpu_memory_buffer_manager_(gpu_memory_buffer_manager) { gpu_memory_buffer_manager_(gpu_memory_buffer_manager) {
next_image_id_.GetNext(); next_image_id_.GetNext();
next_route_id_.GetNext(); next_route_id_.GetNext();
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "base/process/process.h" #include "base/process/process.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "gpu/config/gpu_feature_info.h"
#include "gpu/config/gpu_info.h" #include "gpu/config/gpu_info.h"
#include "gpu/gpu_export.h" #include "gpu/gpu_export.h"
#include "gpu/ipc/common/flush_params.h" #include "gpu/ipc/common/flush_params.h"
...@@ -82,6 +83,7 @@ class GPU_EXPORT GpuChannelHost ...@@ -82,6 +83,7 @@ class GPU_EXPORT GpuChannelHost
GpuChannelHostFactory* factory, GpuChannelHostFactory* factory,
int channel_id, int channel_id,
const gpu::GPUInfo& gpu_info, const gpu::GPUInfo& gpu_info,
const gpu::GpuFeatureInfo& gpu_feature_info,
const IPC::ChannelHandle& channel_handle, const IPC::ChannelHandle& channel_handle,
base::WaitableEvent* shutdown_event, base::WaitableEvent* shutdown_event,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager);
...@@ -95,6 +97,9 @@ class GPU_EXPORT GpuChannelHost ...@@ -95,6 +97,9 @@ class GPU_EXPORT GpuChannelHost
// The GPU stats reported by the GPU process. // The GPU stats reported by the GPU process.
const gpu::GPUInfo& gpu_info() const { return gpu_info_; } const gpu::GPUInfo& gpu_info() const { return gpu_info_; }
const gpu::GpuFeatureInfo& gpu_feature_info() const {
return gpu_feature_info_;
}
// IPC::Sender implementation: // IPC::Sender implementation:
bool Send(IPC::Message* msg) override; bool Send(IPC::Message* msg) override;
...@@ -214,6 +219,7 @@ class GPU_EXPORT GpuChannelHost ...@@ -214,6 +219,7 @@ class GPU_EXPORT GpuChannelHost
GpuChannelHost(GpuChannelHostFactory* factory, GpuChannelHost(GpuChannelHostFactory* factory,
int channel_id, int channel_id,
const gpu::GPUInfo& gpu_info, const gpu::GPUInfo& gpu_info,
const gpu::GpuFeatureInfo& gpu_feature_info,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager);
~GpuChannelHost() override; ~GpuChannelHost() override;
void Connect(const IPC::ChannelHandle& channel_handle, void Connect(const IPC::ChannelHandle& channel_handle,
...@@ -230,6 +236,7 @@ class GPU_EXPORT GpuChannelHost ...@@ -230,6 +236,7 @@ class GPU_EXPORT GpuChannelHost
const int channel_id_; const int channel_id_;
const gpu::GPUInfo gpu_info_; const gpu::GPUInfo gpu_info_;
const gpu::GpuFeatureInfo gpu_feature_info_;
scoped_refptr<MessageFilter> channel_filter_; scoped_refptr<MessageFilter> channel_filter_;
......
...@@ -137,12 +137,15 @@ scoped_refptr<gpu::GpuChannelHost> Gpu::EstablishGpuChannelSync() { ...@@ -137,12 +137,15 @@ scoped_refptr<gpu::GpuChannelHost> Gpu::EstablishGpuChannelSync() {
int client_id = 0; int client_id = 0;
mojo::ScopedMessagePipeHandle channel_handle; mojo::ScopedMessagePipeHandle channel_handle;
gpu::GPUInfo gpu_info; gpu::GPUInfo gpu_info;
gpu::GpuFeatureInfo gpu_feature_info;
mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call; mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call;
if (!gpu_->EstablishGpuChannel(&client_id, &channel_handle, &gpu_info)) { if (!gpu_->EstablishGpuChannel(&client_id, &channel_handle, &gpu_info,
&gpu_feature_info)) {
DLOG(WARNING) << "Encountered error while establishing gpu channel."; DLOG(WARNING) << "Encountered error while establishing gpu channel.";
return nullptr; return nullptr;
} }
OnEstablishedGpuChannel(client_id, std::move(channel_handle), gpu_info); OnEstablishedGpuChannel(client_id, std::move(channel_handle), gpu_info,
gpu_feature_info);
return gpu_channel_; return gpu_channel_;
} }
...@@ -162,15 +165,17 @@ scoped_refptr<gpu::GpuChannelHost> Gpu::GetGpuChannel() { ...@@ -162,15 +165,17 @@ scoped_refptr<gpu::GpuChannelHost> Gpu::GetGpuChannel() {
void Gpu::OnEstablishedGpuChannel(int client_id, void Gpu::OnEstablishedGpuChannel(int client_id,
mojo::ScopedMessagePipeHandle channel_handle, mojo::ScopedMessagePipeHandle channel_handle,
const gpu::GPUInfo& gpu_info) { const gpu::GPUInfo& gpu_info,
const gpu::GpuFeatureInfo& gpu_feature_info) {
DCHECK(IsMainThread()); DCHECK(IsMainThread());
DCHECK(gpu_.get()); DCHECK(gpu_.get());
DCHECK(!gpu_channel_); DCHECK(!gpu_channel_);
if (client_id && channel_handle.is_valid()) { if (client_id && channel_handle.is_valid()) {
gpu_channel_ = gpu::GpuChannelHost::Create( gpu_channel_ = gpu::GpuChannelHost::Create(
this, client_id, gpu_info, IPC::ChannelHandle(channel_handle.release()), this, client_id, gpu_info, gpu_feature_info,
&shutdown_event_, gpu_memory_buffer_manager_.get()); IPC::ChannelHandle(channel_handle.release()), &shutdown_event_,
gpu_memory_buffer_manager_.get());
} }
auto callbacks = std::move(establish_callbacks_); auto callbacks = std::move(establish_callbacks_);
......
...@@ -65,7 +65,8 @@ class Gpu : public gpu::GpuChannelHostFactory, ...@@ -65,7 +65,8 @@ class Gpu : public gpu::GpuChannelHostFactory,
scoped_refptr<gpu::GpuChannelHost> GetGpuChannel(); scoped_refptr<gpu::GpuChannelHost> GetGpuChannel();
void OnEstablishedGpuChannel(int client_id, void OnEstablishedGpuChannel(int client_id,
mojo::ScopedMessagePipeHandle channel_handle, mojo::ScopedMessagePipeHandle channel_handle,
const gpu::GPUInfo& gpu_info); const gpu::GPUInfo& gpu_info,
const gpu::GpuFeatureInfo& gpu_feature_info);
// gpu::GpuChannelHostFactory overrides: // gpu::GpuChannelHostFactory overrides:
bool IsMainThread() override; bool IsMainThread() override;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/callback_helpers.h" #include "base/callback_helpers.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/test/scoped_task_environment.h" #include "base/test/scoped_task_environment.h"
#include "gpu/config/gpu_feature_info.h"
#include "gpu/config/gpu_info.h" #include "gpu/config/gpu_info.h"
#include "mojo/public/cpp/bindings/binding_set.h" #include "mojo/public/cpp/bindings/binding_set.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -42,7 +43,8 @@ class TestGpuImpl : public mojom::Gpu { ...@@ -42,7 +43,8 @@ class TestGpuImpl : public mojom::Gpu {
if (success) if (success)
handle = std::move(mojo::MessagePipe().handle0); handle = std::move(mojo::MessagePipe().handle0);
base::ResetAndReturn(&establish_channel_callback_) base::ResetAndReturn(&establish_channel_callback_)
.Run(client_id, std::move(handle), gpu::GPUInfo()); .Run(client_id, std::move(handle), gpu::GPUInfo(),
gpu::GpuFeatureInfo());
return true; return true;
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
module ui.mojom; module ui.mojom;
import "gpu/ipc/common/gpu_feature_info.mojom";
import "gpu/ipc/common/gpu_info.mojom"; import "gpu/ipc/common/gpu_info.mojom";
import "gpu/ipc/common/sync_token.mojom"; import "gpu/ipc/common/sync_token.mojom";
import "media/gpu/mojo/jpeg_decoder.mojom"; import "media/gpu/mojo/jpeg_decoder.mojom";
...@@ -18,7 +19,8 @@ interface Gpu { ...@@ -18,7 +19,8 @@ interface Gpu {
[Sync] [Sync]
EstablishGpuChannel() => (int32 client_id, EstablishGpuChannel() => (int32 client_id,
handle<message_pipe>? channel_handle, handle<message_pipe>? channel_handle,
gpu.mojom.GpuInfo gpu_info); gpu.mojom.GpuInfo gpu_info,
gpu.mojom.GpuFeatureInfo gpu_feature_info);
// Creates a new JpegDecodeAccelerator and binds it to |jda|. // Creates a new JpegDecodeAccelerator and binds it to |jda|.
CreateJpegDecodeAccelerator(media.mojom.GpuJpegDecodeAccelerator& jda); CreateJpegDecodeAccelerator(media.mojom.GpuJpegDecodeAccelerator& jda);
......
...@@ -22,10 +22,12 @@ namespace ws { ...@@ -22,10 +22,12 @@ namespace ws {
GpuClient::GpuClient( GpuClient::GpuClient(
int client_id, int client_id,
gpu::GPUInfo* gpu_info, gpu::GPUInfo* gpu_info,
gpu::GpuFeatureInfo* gpu_feature_info,
viz::ServerGpuMemoryBufferManager* gpu_memory_buffer_manager, viz::ServerGpuMemoryBufferManager* gpu_memory_buffer_manager,
viz::mojom::GpuService* gpu_service) viz::mojom::GpuService* gpu_service)
: client_id_(client_id), : client_id_(client_id),
gpu_info_(gpu_info), gpu_info_(gpu_info),
gpu_feature_info_(gpu_feature_info),
gpu_memory_buffer_manager_(gpu_memory_buffer_manager), gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
gpu_service_(gpu_service), gpu_service_(gpu_service),
weak_factory_(this) { weak_factory_(this) {
...@@ -40,7 +42,8 @@ GpuClient::~GpuClient() { ...@@ -40,7 +42,8 @@ GpuClient::~GpuClient() {
void GpuClient::OnGpuChannelEstablished( void GpuClient::OnGpuChannelEstablished(
const EstablishGpuChannelCallback& callback, const EstablishGpuChannelCallback& callback,
mojo::ScopedMessagePipeHandle channel_handle) { mojo::ScopedMessagePipeHandle channel_handle) {
callback.Run(client_id_, std::move(channel_handle), *gpu_info_); callback.Run(client_id_, std::move(channel_handle), *gpu_info_,
*gpu_feature_info_);
} }
// mojom::Gpu overrides: // mojom::Gpu overrides:
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define SERVICES_UI_WS_GPU_CLIENT_H_ #define SERVICES_UI_WS_GPU_CLIENT_H_
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "gpu/config/gpu_feature_info.h"
#include "gpu/config/gpu_info.h" #include "gpu/config/gpu_info.h"
#include "services/ui/public/interfaces/gpu.mojom.h" #include "services/ui/public/interfaces/gpu.mojom.h"
...@@ -31,6 +32,7 @@ class GpuClient : public mojom::Gpu { ...@@ -31,6 +32,7 @@ class GpuClient : public mojom::Gpu {
public: public:
GpuClient(int client_id, GpuClient(int client_id,
gpu::GPUInfo* gpu_info, gpu::GPUInfo* gpu_info,
gpu::GpuFeatureInfo* gpu_feature_info,
viz::ServerGpuMemoryBufferManager* gpu_memory_buffer_manager, viz::ServerGpuMemoryBufferManager* gpu_memory_buffer_manager,
viz::mojom::GpuService* gpu_service); viz::mojom::GpuService* gpu_service);
~GpuClient() override; ~GpuClient() override;
...@@ -61,6 +63,7 @@ class GpuClient : public mojom::Gpu { ...@@ -61,6 +63,7 @@ class GpuClient : public mojom::Gpu {
// The objects these pointers refer to are owned by the GpuHost object. // The objects these pointers refer to are owned by the GpuHost object.
const gpu::GPUInfo* gpu_info_; const gpu::GPUInfo* gpu_info_;
const gpu::GpuFeatureInfo* gpu_feature_info_;
viz::ServerGpuMemoryBufferManager* gpu_memory_buffer_manager_; viz::ServerGpuMemoryBufferManager* gpu_memory_buffer_manager_;
viz::mojom::GpuService* gpu_service_; viz::mojom::GpuService* gpu_service_;
......
...@@ -82,9 +82,9 @@ void DefaultGpuHost::CreateFrameSinkManager( ...@@ -82,9 +82,9 @@ void DefaultGpuHost::CreateFrameSinkManager(
} }
GpuClient* DefaultGpuHost::AddInternal(mojom::GpuRequest request) { GpuClient* DefaultGpuHost::AddInternal(mojom::GpuRequest request) {
auto client(base::MakeUnique<GpuClient>(next_client_id_++, &gpu_info_, auto client(base::MakeUnique<GpuClient>(
gpu_memory_buffer_manager_.get(), next_client_id_++, &gpu_info_, &gpu_feature_info_,
gpu_service_.get())); gpu_memory_buffer_manager_.get(), gpu_service_.get()));
GpuClient* client_ref = client.get(); GpuClient* client_ref = client.get();
gpu_bindings_.AddBinding(std::move(client), std::move(request)); gpu_bindings_.AddBinding(std::move(client), std::move(request));
return client_ref; return client_ref;
...@@ -100,6 +100,7 @@ void DefaultGpuHost::DidInitialize( ...@@ -100,6 +100,7 @@ void DefaultGpuHost::DidInitialize(
const gpu::GPUInfo& gpu_info, const gpu::GPUInfo& gpu_info,
const gpu::GpuFeatureInfo& gpu_feature_info) { const gpu::GpuFeatureInfo& gpu_feature_info) {
gpu_info_ = gpu_info; gpu_info_ = gpu_info;
gpu_feature_info_ = gpu_feature_info;
delegate_->OnGpuServiceInitialized(); delegate_->OnGpuServiceInitialized();
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h" #include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "gpu/config/gpu_feature_info.h"
#include "gpu/config/gpu_info.h" #include "gpu/config/gpu_info.h"
#include "gpu/ipc/client/gpu_channel_host.h" #include "gpu/ipc/client/gpu_channel_host.h"
#include "mojo/public/cpp/bindings/binding_set.h" #include "mojo/public/cpp/bindings/binding_set.h"
...@@ -95,6 +96,7 @@ class DefaultGpuHost : public GpuHost, public mojom::GpuHost { ...@@ -95,6 +96,7 @@ class DefaultGpuHost : public GpuHost, public mojom::GpuHost {
viz::mojom::GpuServicePtr gpu_service_; viz::mojom::GpuServicePtr gpu_service_;
mojo::Binding<mojom::GpuHost> gpu_host_binding_; mojo::Binding<mojom::GpuHost> gpu_host_binding_;
gpu::GPUInfo gpu_info_; gpu::GPUInfo gpu_info_;
gpu::GpuFeatureInfo gpu_feature_info_;
std::unique_ptr<viz::ServerGpuMemoryBufferManager> gpu_memory_buffer_manager_; std::unique_ptr<viz::ServerGpuMemoryBufferManager> gpu_memory_buffer_manager_;
mojom::GpuMainPtr gpu_main_; mojom::GpuMainPtr gpu_main_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment