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

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: Reverted mojo readme, changed wait() to take a pointer Created 5 years, 2 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/command_buffer/service/mailbox_manager_sync.cc ('k') | gpu/command_buffer/service/sync_point_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..5101604a3687369c2be85c3b00888def013583a9 100644
--- a/gpu/command_buffer/service/mailbox_manager_unittest.cc
+++ b/gpu/command_buffer/service/mailbox_manager_unittest.cc
@@ -17,6 +17,9 @@ 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 +279,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 +294,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 +320,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 +339,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 +363,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 +391,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 +419,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 +429,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 +460,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 +482,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 +492,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 +525,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 +543,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 +571,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 +594,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 +622,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 +634,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 +661,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 +674,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));
« no previous file with comments | « gpu/command_buffer/service/mailbox_manager_sync.cc ('k') | gpu/command_buffer/service/sync_point_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698