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

Unified Diff: gpu/command_buffer/service/mailbox_manager_unittest.cc

Issue 1331843005: Implemented new fence syncs which replaces the old sync points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added mojo README.chromium changes, fixed and added test for missing order number release case Created 5 years, 3 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
Index: gpu/command_buffer/service/mailbox_manager_unittest.cc
diff --git a/gpu/command_buffer/service/mailbox_manager_unittest.cc b/gpu/command_buffer/service/mailbox_manager_unittest.cc
index d715a398160c56f66922dbf19d862062f2ebfbf6..762479b78c0f5b8d04b21c77f2706fd669ba42a7 100644
--- a/gpu/command_buffer/service/mailbox_manager_unittest.cc
+++ b/gpu/command_buffer/service/mailbox_manager_unittest.cc
@@ -17,6 +17,12 @@ namespace gles2 {
using namespace ::testing;
+static const SyncToken g_sync_token = {
+ gpu::CommandBufferNamespace::GPU_IO,
+ 123,
+ 0
+};
+
class MailboxManagerTest : public GpuServiceTest {
public:
MailboxManagerTest() {}
@@ -276,8 +282,8 @@ TEST_F(MailboxManagerSyncTest, ProduceSyncDestroy) {
EXPECT_EQ(texture, manager_->ConsumeTexture(name));
// Synchronize
- manager_->PushTextureUpdates(0);
- manager2_->PullTextureUpdates(0);
+ manager_->PushTextureUpdates(g_sync_token);
+ manager2_->PullTextureUpdates(g_sync_token);
DestroyTexture(texture);
EXPECT_EQ(NULL, manager_->ConsumeTexture(name));
@@ -291,7 +297,7 @@ TEST_F(MailboxManagerSyncTest, ProduceSyncClobberDestroy) {
Mailbox name = Mailbox::Generate();
manager_->ProduceTexture(name, texture);
- manager_->PushTextureUpdates(0);
+ manager_->PushTextureUpdates(g_sync_token);
// Clobber
Texture* old_texture = texture;
@@ -317,8 +323,8 @@ TEST_F(MailboxManagerSyncTest, ProduceConsumeResize) {
EXPECT_EQ(texture, manager_->ConsumeTexture(name));
// Synchronize
- manager_->PushTextureUpdates(0);
- manager2_->PullTextureUpdates(0);
+ manager_->PushTextureUpdates(g_sync_token);
+ manager2_->PullTextureUpdates(g_sync_token);
EXPECT_CALL(*gl_, GenTextures(1, _))
.WillOnce(SetArgPointee<1>(kNewTextureId));
@@ -336,10 +342,10 @@ TEST_F(MailboxManagerSyncTest, ProduceConsumeResize) {
EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
// Synchronize again
- manager_->PushTextureUpdates(0);
+ manager_->PushTextureUpdates(g_sync_token);
SetupUpdateTexParamExpectations(
kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT);
- manager2_->PullTextureUpdates(0);
+ manager2_->PullTextureUpdates(g_sync_token);
GLsizei width, height;
new_texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr);
EXPECT_EQ(16, width);
@@ -360,7 +366,7 @@ TEST_F(MailboxManagerSyncTest, ProduceConsumeResize) {
// The last change to the texture should be visible without a sync point (i.e.
// push).
- manager2_->PullTextureUpdates(0);
+ manager2_->PullTextureUpdates(g_sync_token);
new_texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr);
EXPECT_EQ(64, width);
EXPECT_EQ(64, height);
@@ -388,8 +394,8 @@ TEST_F(MailboxManagerSyncTest, ProduceConsumeBidirectional) {
manager2_->ProduceTexture(name2, texture2);
// Make visible.
- manager_->PushTextureUpdates(0);
- manager2_->PushTextureUpdates(0);
+ manager_->PushTextureUpdates(g_sync_token);
+ manager2_->PushTextureUpdates(g_sync_token);
// Create textures in the other manager instances for texture1 and texture2,
// respectively to create a real sharing scenario. Otherwise, there would
@@ -416,7 +422,7 @@ TEST_F(MailboxManagerSyncTest, ProduceConsumeBidirectional) {
SetParameter(texture1, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
// Make sure this does not clobber it with the previous version we pushed.
- manager_->PullTextureUpdates(0);
+ manager_->PullTextureUpdates(g_sync_token);
// Make a change to texture2
DCHECK_EQ(static_cast<GLuint>(GL_LINEAR), texture2->mag_filter());
@@ -426,16 +432,16 @@ TEST_F(MailboxManagerSyncTest, ProduceConsumeBidirectional) {
Mock::VerifyAndClearExpectations(gl_.get());
// Synchronize in both directions
- manager_->PushTextureUpdates(0);
- manager2_->PushTextureUpdates(0);
+ manager_->PushTextureUpdates(g_sync_token);
+ manager2_->PushTextureUpdates(g_sync_token);
// manager1 should see the change to texture2 mag_filter being applied.
SetupUpdateTexParamExpectations(
new_texture2->service_id(), GL_LINEAR, GL_NEAREST, GL_REPEAT, GL_REPEAT);
- manager_->PullTextureUpdates(0);
+ manager_->PullTextureUpdates(g_sync_token);
// manager2 should see the change to texture1 min_filter being applied.
SetupUpdateTexParamExpectations(
new_texture1->service_id(), GL_NEAREST, GL_LINEAR, GL_REPEAT, GL_REPEAT);
- manager2_->PullTextureUpdates(0);
+ manager2_->PullTextureUpdates(g_sync_token);
DestroyTexture(texture1);
DestroyTexture(texture2);
@@ -457,8 +463,8 @@ TEST_F(MailboxManagerSyncTest, ProduceAndClobber) {
EXPECT_EQ(texture, manager_->ConsumeTexture(name));
// Synchronize
- manager_->PushTextureUpdates(0);
- manager2_->PullTextureUpdates(0);
+ manager_->PushTextureUpdates(g_sync_token);
+ manager2_->PullTextureUpdates(g_sync_token);
EXPECT_CALL(*gl_, GenTextures(1, _))
.WillOnce(SetArgPointee<1>(kNewTextureId));
@@ -479,8 +485,8 @@ TEST_F(MailboxManagerSyncTest, ProduceAndClobber) {
SetParameter(texture, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
// Synchronize in both directions - no changes, since it's not shared
- manager_->PushTextureUpdates(0);
- manager2_->PullTextureUpdates(0);
+ manager_->PushTextureUpdates(g_sync_token);
+ manager2_->PullTextureUpdates(g_sync_token);
EXPECT_EQ(static_cast<GLuint>(GL_LINEAR), new_texture->min_filter());
// Make a change to the previously shared texture
@@ -489,10 +495,10 @@ TEST_F(MailboxManagerSyncTest, ProduceAndClobber) {
SetParameter(old_texture, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
// Synchronize and expect update
- manager_->PushTextureUpdates(0);
+ manager_->PushTextureUpdates(g_sync_token);
SetupUpdateTexParamExpectations(
new_texture->service_id(), GL_LINEAR, GL_NEAREST, GL_REPEAT, GL_REPEAT);
- manager2_->PullTextureUpdates(0);
+ manager2_->PullTextureUpdates(g_sync_token);
EXPECT_CALL(*gl_, GenTextures(1, _))
.WillOnce(SetArgPointee<1>(kNewTextureId));
@@ -522,8 +528,8 @@ TEST_F(MailboxManagerSyncTest, ClearedStateSynced) {
EXPECT_EQ(texture, manager_->ConsumeTexture(name));
// Synchronize
- manager_->PushTextureUpdates(0);
- manager2_->PullTextureUpdates(0);
+ manager_->PushTextureUpdates(g_sync_token);
+ manager2_->PullTextureUpdates(g_sync_token);
EXPECT_CALL(*gl_, GenTextures(1, _))
.WillOnce(SetArgPointee<1>(kNewTextureId));
@@ -540,10 +546,10 @@ TEST_F(MailboxManagerSyncTest, ClearedStateSynced) {
EXPECT_FALSE(texture->SafeToRenderFrom());
// Synchronize
- manager_->PushTextureUpdates(0);
+ manager_->PushTextureUpdates(g_sync_token);
SetupUpdateTexParamExpectations(
kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT);
- manager2_->PullTextureUpdates(0);
+ manager2_->PullTextureUpdates(g_sync_token);
// Cleared state should be synced.
EXPECT_FALSE(new_texture->SafeToRenderFrom());
@@ -568,8 +574,8 @@ TEST_F(MailboxManagerSyncTest, SyncIncompleteTexture) {
EXPECT_EQ(texture, manager_->ConsumeTexture(name));
// Synchronize
- manager_->PushTextureUpdates(0);
- manager2_->PullTextureUpdates(0);
+ manager_->PushTextureUpdates(g_sync_token);
+ manager2_->PullTextureUpdates(g_sync_token);
// Should sync to new texture which is not defined.
EXPECT_CALL(*gl_, GenTextures(1, _))
@@ -591,10 +597,10 @@ TEST_F(MailboxManagerSyncTest, SyncIncompleteTexture) {
EXPECT_TRUE(texture->IsDefined());
// Synchronize
- manager_->PushTextureUpdates(0);
+ manager_->PushTextureUpdates(g_sync_token);
SetupUpdateTexParamExpectations(
kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT);
- manager2_->PullTextureUpdates(0);
+ manager2_->PullTextureUpdates(g_sync_token);
// Cleared state should be synced.
EXPECT_TRUE(new_texture->IsDefined());
@@ -619,10 +625,10 @@ TEST_F(MailboxManagerSyncTest, SharedThroughMultipleMailboxes) {
manager_->ProduceTexture(name1, texture);
// Share
- manager_->PushTextureUpdates(0);
+ manager_->PushTextureUpdates(g_sync_token);
EXPECT_CALL(*gl_, GenTextures(1, _))
.WillOnce(SetArgPointee<1>(kNewTextureId));
- manager2_->PullTextureUpdates(0);
+ manager2_->PullTextureUpdates(g_sync_token);
SetupUpdateTexParamExpectations(
kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT);
Texture* new_texture = manager2_->ConsumeTexture(name1);
@@ -631,8 +637,8 @@ TEST_F(MailboxManagerSyncTest, SharedThroughMultipleMailboxes) {
manager_->ProduceTexture(name2, texture);
// Synchronize
- manager_->PushTextureUpdates(0);
- manager2_->PullTextureUpdates(0);
+ manager_->PushTextureUpdates(g_sync_token);
+ manager2_->PullTextureUpdates(g_sync_token);
// name2 should return the same texture
EXPECT_EQ(new_texture, manager2_->ConsumeTexture(name2));
@@ -658,7 +664,7 @@ TEST_F(MailboxManagerSyncTest, ProduceBothWays) {
manager_->ProduceTexture(name, texture1);
// Share
- manager_->PushTextureUpdates(0);
+ manager_->PushTextureUpdates(g_sync_token);
EXPECT_CALL(*gl_, GenTextures(1, _))
.WillOnce(SetArgPointee<1>(kNewTextureId));
SetupUpdateTexParamExpectations(
@@ -671,8 +677,8 @@ TEST_F(MailboxManagerSyncTest, ProduceBothWays) {
manager_->ProduceTexture(name, texture1);
// Synchronize manager -> manager2
- manager_->PushTextureUpdates(0);
- manager2_->PullTextureUpdates(0);
+ manager_->PushTextureUpdates(g_sync_token);
+ manager2_->PullTextureUpdates(g_sync_token);
// name should return the original texture, and not texture2 or a new one.
EXPECT_EQ(new_texture, manager2_->ConsumeTexture(name));

Powered by Google App Engine
This is Rietveld 408576698