OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/mus/gpu/gpu_service_impl.h" | 5 #include "components/mus/gpu/gpu_service_impl.h" |
6 | 6 |
7 #include "components/mus/common/gpu_type_converters.h" | 7 #include "components/mus/common/gpu_type_converters.h" |
8 #include "components/mus/gpu/gpu_service_mus.h" | 8 #include "components/mus/gpu/gpu_service_mus.h" |
9 #include "services/shell/public/cpp/connection.h" | 9 #include "services/shell/public/cpp/connection.h" |
10 | 10 |
11 namespace mus { | 11 namespace mus { |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 void EstablishGpuChannelDone( | 15 void EstablishGpuChannelDone( |
16 const mojom::GpuService::EstablishGpuChannelCallback& callback, | |
16 int32_t client_id, | 17 int32_t client_id, |
17 const mojom::GpuService::EstablishGpuChannelCallback& callback, | |
18 const IPC::ChannelHandle& channel_handle) { | 18 const IPC::ChannelHandle& channel_handle) { |
19 // TODO(penghuang): Send the GPUInfo to the client. | 19 // TODO(penghuang): Send the GPUInfo to the client. |
20 callback.Run(client_id, mojom::ChannelHandle::From(channel_handle), nullptr); | 20 callback.Run(client_id, mojom::ChannelHandle::From(channel_handle), nullptr); |
21 } | 21 } |
22 } | 22 } |
23 | 23 |
24 GpuServiceImpl::GpuServiceImpl( | 24 GpuServiceImpl::GpuServiceImpl( |
25 mojo::InterfaceRequest<mojom::GpuService> request, | 25 mojo::InterfaceRequest<mojom::GpuService> request, |
26 shell::Connection* connection) | 26 shell::Connection* connection) |
27 : binding_(this, std::move(request)), | 27 : binding_(this, std::move(request)) {} |
28 client_id_(connection->GetRemoteInstanceID() + 1) { | |
29 // Use remote instead id + 1 as client id, so every GpuServiceImpl instances | |
30 // for a same client will have the same client id. | |
31 // Make sure client_id_ is greater than 1, because 1 is used for the local | |
32 // GpuChannel. | |
33 DCHECK_GT(client_id_, 1); | |
34 } | |
35 | 28 |
36 GpuServiceImpl::~GpuServiceImpl() {} | 29 GpuServiceImpl::~GpuServiceImpl() {} |
37 | 30 |
38 void GpuServiceImpl::EstablishGpuChannel( | 31 void GpuServiceImpl::EstablishGpuChannel( |
39 const mojom::GpuService::EstablishGpuChannelCallback& callback) { | 32 const mojom::GpuService::EstablishGpuChannelCallback& callback) { |
40 GpuServiceMus* service = GpuServiceMus::GetInstance(); | 33 GpuServiceMus* service = GpuServiceMus::GetInstance(); |
34 // TODO(penghuang): figure out how to generate a meaningful tracing id. | |
piman
2016/06/03 21:02:31
The important part is that the tracing ID given to
Peng
2016/06/06 14:10:33
Filed a bug. Done
| |
35 const uint64_t client_tracing_id = 0; | |
41 // TODO(penghuang): windows server may want to control those flags. | 36 // TODO(penghuang): windows server may want to control those flags. |
42 // Add a private interface for windows server. | 37 // Add a private interface for windows server. |
43 const bool preempts = false; | 38 const bool preempts = false; |
44 const bool allow_view_command_buffers = false; | 39 const bool allow_view_command_buffers = false; |
45 const bool allow_real_time_streams = false; | 40 const bool allow_real_time_streams = false; |
46 service->EstablishGpuChannel( | 41 service->EstablishGpuChannel( |
47 client_id_, client_id_, preempts, allow_view_command_buffers, | 42 client_tracing_id, preempts, allow_view_command_buffers, |
48 allow_real_time_streams, | 43 allow_real_time_streams, base::Bind(&EstablishGpuChannelDone, callback)); |
49 base::Bind(&EstablishGpuChannelDone, client_id_, callback)); | |
50 } | 44 } |
51 | 45 |
52 void GpuServiceImpl::CreateGpuMemoryBuffer( | 46 void GpuServiceImpl::CreateGpuMemoryBuffer( |
53 mojom::GpuMemoryBufferIdPtr id, | 47 mojom::GpuMemoryBufferIdPtr id, |
54 const gfx::Size& size, | 48 const gfx::Size& size, |
55 mojom::BufferFormat format, | 49 mojom::BufferFormat format, |
56 mojom::BufferUsage usage, | 50 mojom::BufferUsage usage, |
57 uint64_t surface_id, | 51 uint64_t surface_id, |
58 const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) { | 52 const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) { |
59 NOTIMPLEMENTED(); | 53 NOTIMPLEMENTED(); |
60 } | 54 } |
61 | 55 |
62 void GpuServiceImpl::CreateGpuMemoryBufferFromHandle( | 56 void GpuServiceImpl::CreateGpuMemoryBufferFromHandle( |
63 mojom::GpuMemoryBufferHandlePtr buffer_handle, | 57 mojom::GpuMemoryBufferHandlePtr buffer_handle, |
64 mojom::GpuMemoryBufferIdPtr id, | 58 mojom::GpuMemoryBufferIdPtr id, |
65 const gfx::Size& size, | 59 const gfx::Size& size, |
66 mojom::BufferFormat format, | 60 mojom::BufferFormat format, |
67 const mojom::GpuService::CreateGpuMemoryBufferFromHandleCallback& | 61 const mojom::GpuService::CreateGpuMemoryBufferFromHandleCallback& |
68 callback) { | 62 callback) { |
69 NOTIMPLEMENTED(); | 63 NOTIMPLEMENTED(); |
70 } | 64 } |
71 | 65 |
72 void GpuServiceImpl::DestroyGpuMemoryBuffer(mojom::GpuMemoryBufferIdPtr id, | 66 void GpuServiceImpl::DestroyGpuMemoryBuffer(mojom::GpuMemoryBufferIdPtr id, |
73 const gpu::SyncToken& sync_token) { | 67 const gpu::SyncToken& sync_token) { |
74 NOTIMPLEMENTED(); | 68 NOTIMPLEMENTED(); |
75 } | 69 } |
76 | 70 |
77 } // namespace mus | 71 } // namespace mus |
OLD | NEW |