Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2813)

Unified Diff: gpu/ipc/service/gpu_channel.h

Issue 2814843002: gpu: GPU service scheduler. (Closed)
Patch Set: Do not allow HIGH priority contexts by unprivileged clients. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/ipc/common/struct_traits_unittest.cc ('k') | gpu/ipc/service/gpu_channel.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/ipc/service/gpu_channel.h
diff --git a/gpu/ipc/service/gpu_channel.h b/gpu/ipc/service/gpu_channel.h
index bd583b2674eee5e835c66d2ab208dc059bd77cf3..bf8d7753e970e444df2ccf3062b2f1e71f56ec86 100644
--- a/gpu/ipc/service/gpu_channel.h
+++ b/gpu/ipc/service/gpu_channel.h
@@ -20,9 +20,9 @@
#include "base/threading/thread_checker.h"
#include "base/trace_event/memory_dump_provider.h"
#include "build/build_config.h"
+#include "gpu/command_buffer/common/gpu_stream_constants.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"
@@ -42,6 +42,7 @@ class WaitableEvent;
namespace gpu {
class PreemptionFlag;
+class Scheduler;
class SyncPointManager;
class GpuChannelManager;
class GpuChannelMessageFilter;
@@ -82,6 +83,7 @@ class GPU_EXPORT GpuChannel : public IPC::Listener, public FilteredSender {
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,6 +101,8 @@ class GPU_EXPORT GpuChannel : public IPC::Listener, public FilteredSender {
// 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.
@@ -106,6 +110,8 @@ class GPU_EXPORT GpuChannel : public IPC::Listener, public FilteredSender {
return gpu_channel_manager_;
}
+ Scheduler* scheduler() const { return scheduler_; }
+
SyncPointManager* sync_point_manager() const { return sync_point_manager_; }
GpuWatchdogThread* watchdog() const { return watchdog_; }
@@ -132,8 +138,6 @@ class GPU_EXPORT GpuChannel : public IPC::Listener, public FilteredSender {
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_;
}
@@ -180,6 +184,8 @@ class GPU_EXPORT GpuChannel : public IPC::Listener, public FilteredSender {
uint32_t internalformat,
SurfaceHandle surface_handle);
+ void HandleMessage(const IPC::Message& msg);
+
// Handle messages enqueued in |message_queue_|.
void HandleMessageOnQueue();
@@ -224,11 +230,16 @@ class GPU_EXPORT GpuChannel : public IPC::Listener, public FilteredSender {
// Map of routing id to command buffer stub.
std::unordered_map<int32_t, std::unique_ptr<GpuCommandBufferStub>> stubs_;
+ // Map of stream id to scheduler sequence id.
+ std::map<int32_t, SequenceId> stream_sequences_;
+
// 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_;
@@ -289,11 +300,18 @@ 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;
@@ -317,8 +335,11 @@ class GPU_EXPORT GpuChannelMessageFilter : public IPC::MessageFilter {
std::vector<scoped_refptr<IPC::MessageFilter>> channel_filters_;
GpuChannel* gpu_channel_ = nullptr;
+ // Map of route id to scheduler sequence id.
+ std::map<int32_t, SequenceId> route_sequences_;
base::Lock gpu_channel_lock_;
+ Scheduler* scheduler_;
scoped_refptr<GpuChannelMessageQueue> message_queue_;
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
@@ -344,11 +365,11 @@ class 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,
- SyncPointManager* sync_point_manager);
+ scoped_refptr<PreemptionFlag> preempted_flag);
void Destroy();
@@ -359,8 +380,6 @@ class GpuChannelMessageQueue
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.
const GpuChannelMessage* BeginMessageProcessing();
@@ -438,7 +457,6 @@ class GpuChannelMessageQueue
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);
};
« no previous file with comments | « gpu/ipc/common/struct_traits_unittest.cc ('k') | gpu/ipc/service/gpu_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698