Index: gpu/ipc/service/gpu_channel.h |
diff --git a/gpu/ipc/service/gpu_channel.h b/gpu/ipc/service/gpu_channel.h |
index ee8d1614f791810930a96a178ccf31174a2045bb..bd583b2674eee5e835c66d2ab208dc059bd77cf3 100644 |
--- a/gpu/ipc/service/gpu_channel.h |
+++ b/gpu/ipc/service/gpu_channel.h |
@@ -10,8 +10,9 @@ |
#include <memory> |
#include <string> |
- |
-#include "base/containers/flat_map.h" |
+#include <unordered_map> |
+ |
+#include "base/containers/hash_tables.h" |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/weak_ptr.h" |
@@ -21,6 +22,7 @@ |
#include "build/build_config.h" |
#include "gpu/command_buffer/service/sync_point_manager.h" |
#include "gpu/gpu_export.h" |
+#include "gpu/ipc/common/gpu_stream_constants.h" |
#include "gpu/ipc/service/gpu_command_buffer_stub.h" |
#include "gpu/ipc/service/gpu_memory_manager.h" |
#include "ipc/ipc_sender.h" |
@@ -40,7 +42,6 @@ |
namespace gpu { |
class PreemptionFlag; |
-class Scheduler; |
class SyncPointManager; |
class GpuChannelManager; |
class GpuChannelMessageFilter; |
@@ -81,7 +82,6 @@ |
public: |
// Takes ownership of the renderer process handle. |
GpuChannel(GpuChannelManager* gpu_channel_manager, |
- Scheduler* scheduler, |
SyncPointManager* sync_point_manager, |
GpuWatchdogThread* watchdog, |
scoped_refptr<gl::GLShareGroup> share_group, |
@@ -99,8 +99,6 @@ |
// listener. The listener is the GpuChannel and must be constructed first. |
void Init(std::unique_ptr<FilteredSender> channel); |
- base::WeakPtr<GpuChannel> AsWeakPtr(); |
- |
void SetUnhandledMessageListener(IPC::Listener* listener); |
// Get the GpuChannelManager that owns this channel. |
@@ -108,8 +106,6 @@ |
return gpu_channel_manager_; |
} |
- Scheduler* scheduler() const { return scheduler_; } |
- |
SyncPointManager* sync_point_manager() const { return sync_point_manager_; } |
GpuWatchdogThread* watchdog() const { return watchdog_; } |
@@ -135,6 +131,8 @@ |
int client_id() const { return client_id_; } |
uint64_t client_tracing_id() const { return client_tracing_id_; } |
+ |
+ base::WeakPtr<GpuChannel> AsWeakPtr(); |
const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner() const { |
return io_task_runner_; |
@@ -181,8 +179,6 @@ |
gfx::BufferFormat format, |
uint32_t internalformat, |
SurfaceHandle surface_handle); |
- |
- void HandleMessage(const IPC::Message& msg); |
// Handle messages enqueued in |message_queue_|. |
void HandleMessageOnQueue(); |
@@ -226,18 +222,13 @@ |
scoped_refptr<GpuChannelMessageFilter> filter_; |
// Map of routing id to command buffer stub. |
- base::flat_map<int32_t, std::unique_ptr<GpuCommandBufferStub>> stubs_; |
- |
- // Map of stream id to scheduler sequence id. |
- base::flat_map<int32_t, SequenceId> stream_sequences_; |
+ std::unordered_map<int32_t, std::unique_ptr<GpuCommandBufferStub>> stubs_; |
// The lifetime of objects of this class is managed by a GpuChannelManager. |
// The GpuChannelManager destroy all the GpuChannels that they own when they |
// are destroyed. So a raw pointer is safe. |
GpuChannelManager* const gpu_channel_manager_; |
- Scheduler* const scheduler_; |
- |
// Sync point manager. Outlives the channel and is guaranteed to outlive the |
// message loop. |
SyncPointManager* const sync_point_manager_; |
@@ -283,27 +274,26 @@ |
DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
}; |
-// This filter does the following: |
-// - handles the Nop message used for verifying sync tokens on the IO thread |
-// - forwards messages to child message filters |
-// - posts control and out of order messages to the main thread |
-// - forwards other messages to the message queue or the scheduler |
+// This filter does three things: |
+// - it counts and timestamps each message forwarded to the channel |
+// so that we can preempt other channels if a message takes too long to |
+// process. To guarantee fairness, we must wait a minimum amount of time |
+// before preempting and we limit the amount of time that we can preempt in |
+// one shot (see constants above). |
+// - it handles the GpuCommandBufferMsg_InsertSyncPoint message on the IO |
+// thread, generating the sync point ID and responding immediately, and then |
+// posting a task to insert the GpuCommandBufferMsg_RetireSyncPoint message |
+// into the channel's queue. |
+// - it generates mailbox names for clients of the GPU process on the IO thread. |
class GPU_EXPORT GpuChannelMessageFilter : public IPC::MessageFilter { |
public: |
GpuChannelMessageFilter( |
GpuChannel* gpu_channel, |
- Scheduler* scheduler, |
scoped_refptr<GpuChannelMessageQueue> message_queue, |
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); |
- // Methods called on main thread. |
void Destroy(); |
- // Called when scheduler is enabled. |
- void AddRoute(int32_t route_id, SequenceId sequence_id); |
- void RemoveRoute(int32_t route_id); |
- |
- // Methods called on IO thread. |
// IPC::MessageFilter implementation. |
void OnFilterAdded(IPC::Channel* channel) override; |
void OnFilterRemoved() override; |
@@ -327,11 +317,8 @@ |
std::vector<scoped_refptr<IPC::MessageFilter>> channel_filters_; |
GpuChannel* gpu_channel_ = nullptr; |
- // Map of route id to scheduler sequence id. |
- base::flat_map<int32_t, SequenceId> route_sequences_; |
- mutable base::Lock gpu_channel_lock_; |
- |
- Scheduler* scheduler_; |
+ base::Lock gpu_channel_lock_; |
+ |
scoped_refptr<GpuChannelMessageQueue> message_queue_; |
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
@@ -352,21 +339,16 @@ |
DISALLOW_COPY_AND_ASSIGN(GpuChannelMessage); |
}; |
-// This message queue counts and timestamps each message forwarded to the |
-// channel so that we can preempt other channels if a message takes too long to |
-// process. To guarantee fairness, we must wait a minimum amount of time before |
-// preempting and we limit the amount of time that we can preempt in one shot |
-// (see constants above). |
class GpuChannelMessageQueue |
: public base::RefCountedThreadSafe<GpuChannelMessageQueue> { |
public: |
GpuChannelMessageQueue( |
GpuChannel* channel, |
- scoped_refptr<SyncPointOrderData> sync_point_order_data, |
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
scoped_refptr<PreemptionFlag> preempting_flag, |
- scoped_refptr<PreemptionFlag> preempted_flag); |
+ scoped_refptr<PreemptionFlag> preempted_flag, |
+ SyncPointManager* sync_point_manager); |
void Destroy(); |
@@ -376,6 +358,8 @@ |
bool IsScheduled() const; |
void SetScheduled(bool scheduled); |
+ |
+ bool HasQueuedMessages() const; |
// Should be called before a message begins to be processed. Returns false if |
// there are no messages to process. |
@@ -454,6 +438,7 @@ |
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
scoped_refptr<PreemptionFlag> preempting_flag_; |
scoped_refptr<PreemptionFlag> preempted_flag_; |
+ SyncPointManager* const sync_point_manager_; |
DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageQueue); |
}; |