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

Unified Diff: gpu/ipc/service/gpu_channel_unittest.cc

Issue 2814843002: gpu: GPU service scheduler. (Closed)
Patch Set: fix test dcheck failures Created 3 years, 7 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/service/gpu_channel_test_common.cc ('k') | gpu/ipc/service/gpu_command_buffer_stub.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/ipc/service/gpu_channel_unittest.cc
diff --git a/gpu/ipc/service/gpu_channel_unittest.cc b/gpu/ipc/service/gpu_channel_unittest.cc
index e76f2dbf44766dd68413cb14c7dd694f0aaf98ce..286124a69aa003f7d6c4f12895512dbd14e26a43 100644
--- a/gpu/ipc/service/gpu_channel_unittest.cc
+++ b/gpu/ipc/service/gpu_channel_unittest.cc
@@ -32,7 +32,7 @@ TEST_F(GpuChannelTest, CreateViewCommandBufferAllowed) {
init_params.surface_handle = surface_handle;
init_params.share_group_id = MSG_ROUTING_NONE;
init_params.stream_id = 0;
- init_params.stream_priority = GpuStreamPriority::NORMAL;
+ init_params.stream_priority = SchedulingPriority::kNormal;
init_params.attribs = gles2::ContextCreationAttribHelper();
init_params.active_url = GURL();
bool result = false;
@@ -60,7 +60,7 @@ TEST_F(GpuChannelTest, CreateViewCommandBufferDisallowed) {
init_params.surface_handle = surface_handle;
init_params.share_group_id = MSG_ROUTING_NONE;
init_params.stream_id = 0;
- init_params.stream_priority = GpuStreamPriority::NORMAL;
+ init_params.stream_priority = SchedulingPriority::kNormal;
init_params.attribs = gles2::ContextCreationAttribHelper();
init_params.active_url = GURL();
bool result = false;
@@ -84,7 +84,7 @@ TEST_F(GpuChannelTest, CreateOffscreenCommandBuffer) {
init_params.surface_handle = kNullSurfaceHandle;
init_params.share_group_id = MSG_ROUTING_NONE;
init_params.stream_id = 0;
- init_params.stream_priority = GpuStreamPriority::NORMAL;
+ init_params.stream_priority = SchedulingPriority::kNormal;
init_params.attribs = gles2::ContextCreationAttribHelper();
init_params.active_url = GURL();
bool result = false;
@@ -110,7 +110,7 @@ TEST_F(GpuChannelTest, IncompatibleStreamIds) {
init_params.surface_handle = kNullSurfaceHandle;
init_params.share_group_id = MSG_ROUTING_NONE;
init_params.stream_id = kStreamId1;
- init_params.stream_priority = GpuStreamPriority::NORMAL;
+ init_params.stream_priority = SchedulingPriority::kNormal;
init_params.attribs = gles2::ContextCreationAttribHelper();
init_params.active_url = GURL();
bool result = false;
@@ -129,7 +129,7 @@ TEST_F(GpuChannelTest, IncompatibleStreamIds) {
init_params.share_group_id = kRouteId1;
init_params.stream_id = kStreamId2;
- init_params.stream_priority = GpuStreamPriority::NORMAL;
+ init_params.stream_priority = SchedulingPriority::kNormal;
init_params.attribs = gles2::ContextCreationAttribHelper();
init_params.active_url = GURL();
HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer(
@@ -141,21 +141,20 @@ TEST_F(GpuChannelTest, IncompatibleStreamIds) {
EXPECT_FALSE(stub);
}
-TEST_F(GpuChannelTest, RealTimeStreamsDisallowed) {
+TEST_F(GpuChannelTest, HighPriorityStreamsDisallowed) {
int32_t kClientId = 1;
bool is_gpu_host = false;
GpuChannel* channel = CreateChannel(kClientId, is_gpu_host);
ASSERT_TRUE(channel);
- // Create first context.
+ // Highest priority is disallowed.
int32_t kRouteId = 1;
int32_t kStreamId = 1;
- GpuStreamPriority kStreamPriority = GpuStreamPriority::REAL_TIME;
GPUCreateCommandBufferConfig init_params;
init_params.surface_handle = kNullSurfaceHandle;
init_params.share_group_id = MSG_ROUTING_NONE;
init_params.stream_id = kStreamId;
- init_params.stream_priority = kStreamPriority;
+ init_params.stream_priority = SchedulingPriority::kHighest;
init_params.attribs = gles2::ContextCreationAttribHelper();
init_params.active_url = GURL();
bool result = false;
@@ -164,37 +163,50 @@ TEST_F(GpuChannelTest, RealTimeStreamsDisallowed) {
init_params, kRouteId, GetSharedHandle(), &result,
&capabilities));
EXPECT_FALSE(result);
+ EXPECT_FALSE(channel->LookupCommandBuffer(kRouteId));
- GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId);
- EXPECT_FALSE(stub);
+ // High priority is also disallowed.
+ init_params.stream_priority = SchedulingPriority::kHigh;
+ HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer(
+ init_params, kRouteId, GetSharedHandle(), &result,
+ &capabilities));
+ EXPECT_FALSE(result);
+ EXPECT_FALSE(channel->LookupCommandBuffer(kRouteId));
}
-TEST_F(GpuChannelTest, RealTimeStreamsAllowed) {
+TEST_F(GpuChannelTest, HighPriorityStreamsAllowed) {
int32_t kClientId = 1;
bool is_gpu_host = true;
GpuChannel* channel = CreateChannel(kClientId, is_gpu_host);
ASSERT_TRUE(channel);
- // Create first context.
- int32_t kRouteId = 1;
- int32_t kStreamId = 1;
- GpuStreamPriority kStreamPriority = GpuStreamPriority::REAL_TIME;
+ // Highest priority is allowed.
+ int32_t kRouteId1 = 1;
GPUCreateCommandBufferConfig init_params;
init_params.surface_handle = kNullSurfaceHandle;
init_params.share_group_id = MSG_ROUTING_NONE;
- init_params.stream_id = kStreamId;
- init_params.stream_priority = kStreamPriority;
+ init_params.stream_id = 1;
+ init_params.stream_priority = SchedulingPriority::kHighest;
init_params.attribs = gles2::ContextCreationAttribHelper();
init_params.active_url = GURL();
bool result = false;
gpu::Capabilities capabilities;
HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer(
- init_params, kRouteId, GetSharedHandle(), &result,
+ init_params, kRouteId1, GetSharedHandle(), &result,
&capabilities));
EXPECT_TRUE(result);
+ EXPECT_TRUE(channel->LookupCommandBuffer(kRouteId1));
- GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId);
- EXPECT_TRUE(stub);
+ // High priority is also allowed.
+ int32_t kRouteId2 = 2;
+ init_params.stream_id = 2;
+ init_params.stream_priority = SchedulingPriority::kHigh;
+ result = false;
+ HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer(
+ init_params, kRouteId2, GetSharedHandle(), &result,
+ &capabilities));
+ EXPECT_TRUE(result);
+ EXPECT_TRUE(channel->LookupCommandBuffer(kRouteId2));
}
TEST_F(GpuChannelTest, CreateFailsIfSharedContextIsLost) {
@@ -210,7 +222,7 @@ TEST_F(GpuChannelTest, CreateFailsIfSharedContextIsLost) {
init_params.surface_handle = kNullSurfaceHandle;
init_params.share_group_id = MSG_ROUTING_NONE;
init_params.stream_id = 0;
- init_params.stream_priority = GpuStreamPriority::NORMAL;
+ init_params.stream_priority = SchedulingPriority::kNormal;
init_params.attribs = gles2::ContextCreationAttribHelper();
init_params.active_url = GURL();
bool result = false;
@@ -230,7 +242,7 @@ TEST_F(GpuChannelTest, CreateFailsIfSharedContextIsLost) {
init_params.surface_handle = kNullSurfaceHandle;
init_params.share_group_id = kSharedRouteId;
init_params.stream_id = 0;
- init_params.stream_priority = GpuStreamPriority::NORMAL;
+ init_params.stream_priority = SchedulingPriority::kNormal;
init_params.attribs = gles2::ContextCreationAttribHelper();
init_params.active_url = GURL();
bool result = false;
@@ -254,7 +266,7 @@ TEST_F(GpuChannelTest, CreateFailsIfSharedContextIsLost) {
init_params.surface_handle = kNullSurfaceHandle;
init_params.share_group_id = kSharedRouteId;
init_params.stream_id = 0;
- init_params.stream_priority = GpuStreamPriority::NORMAL;
+ init_params.stream_priority = SchedulingPriority::kNormal;
init_params.attribs = gles2::ContextCreationAttribHelper();
init_params.active_url = GURL();
bool result = false;
« no previous file with comments | « gpu/ipc/service/gpu_channel_test_common.cc ('k') | gpu/ipc/service/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698