diff options
author | dyen <dyen@chromium.org> | 2015-11-03 12:03:04 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-03 20:04:03 +0000 |
commit | cc16ed4d1e600f3d478bd00d8d315894a74d68bb (patch) | |
tree | bd2ca9893e7ce38921b7a664486d55931db35aeb /mojo/converters | |
parent | 55df5b2e04bc9ab96196b38a05a8dfb5f9701ca4 (diff) | |
download | chromium_src-cc16ed4d1e600f3d478bd00d8d315894a74d68bb.zip chromium_src-cc16ed4d1e600f3d478bd00d8d315894a74d68bb.tar.gz chromium_src-cc16ed4d1e600f3d478bd00d8d315894a74d68bb.tar.bz2 |
Modified old wait sync point functions to also accept new sync tokens.
In order to help with refactoring old sync points into new sync points,
glWaitSyncPointCHROMIUM() has been changed to accept both the old and
new sync points.
This CL only refactors all the ways we pass around sync points so in
theory shouldn't change any behavior. Once this lands we can then
incrementally change the sync point insertions to the new sync points.
R=piman@chromium.org
BUG=514815
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1427543002
Cr-Commit-Position: refs/heads/master@{#357595}
Diffstat (limited to 'mojo/converters')
-rw-r--r-- | mojo/converters/surfaces/DEPS | 1 | ||||
-rw-r--r-- | mojo/converters/surfaces/surfaces_type_converters.cc | 37 | ||||
-rw-r--r-- | mojo/converters/surfaces/surfaces_type_converters.h | 12 | ||||
-rw-r--r-- | mojo/converters/surfaces/tests/surface_unittest.cc | 20 |
4 files changed, 56 insertions, 14 deletions
diff --git a/mojo/converters/surfaces/DEPS b/mojo/converters/surfaces/DEPS index 3d09d22..9c16679 100644 --- a/mojo/converters/surfaces/DEPS +++ b/mojo/converters/surfaces/DEPS @@ -6,6 +6,7 @@ include_rules = [ "+components/mus/public", "+gpu/command_buffer/common/mailbox.h", "+gpu/command_buffer/common/mailbox_holder.h", + "+gpu/command_buffer/common/sync_token.h", "+third_party/skia/include", "+ui/gfx/geometry", "+ui/gfx/transform.h", diff --git a/mojo/converters/surfaces/surfaces_type_converters.cc b/mojo/converters/surfaces/surfaces_type_converters.cc index 5f2f25d..8908fc8 100644 --- a/mojo/converters/surfaces/surfaces_type_converters.cc +++ b/mojo/converters/surfaces/surfaces_type_converters.cc @@ -25,6 +25,7 @@ using mus::mojom::Color; using mus::mojom::ColorPtr; +using mus::mojom::CommandBufferNamespace; using mus::mojom::CompositorFrame; using mus::mojom::CompositorFramePtr; using mus::mojom::CompositorFrameMetadata; @@ -54,6 +55,8 @@ using mus::mojom::SurfaceId; using mus::mojom::SurfaceIdPtr; using mus::mojom::SurfaceQuadState; using mus::mojom::SurfaceQuadStatePtr; +using mus::mojom::SyncToken; +using mus::mojom::SyncTokenPtr; using mus::mojom::TextureQuadState; using mus::mojom::TextureQuadStatePtr; using mus::mojom::TileQuadState; @@ -527,12 +530,38 @@ gpu::Mailbox TypeConverter<gpu::Mailbox, MailboxPtr>::Convert( } // static +SyncTokenPtr TypeConverter<SyncTokenPtr, gpu::SyncToken>::Convert( + const gpu::SyncToken& input) { + DCHECK(!input.HasData() || input.verified_flush()); + SyncTokenPtr sync_token(SyncToken::New()); + sync_token->verified_flush = input.verified_flush(); + sync_token->namespace_id = + static_cast<CommandBufferNamespace>(input.namespace_id()); + sync_token->command_buffer_id = input.command_buffer_id(); + sync_token->release_count = input.release_count(); + return sync_token.Pass(); +} + +// static +gpu::SyncToken TypeConverter<gpu::SyncToken, SyncTokenPtr>::Convert( + const SyncTokenPtr& input) { + const gpu::CommandBufferNamespace namespace_id = + static_cast<gpu::CommandBufferNamespace>(input->namespace_id); + gpu::SyncToken sync_token(namespace_id, input->command_buffer_id, + input->release_count); + if (input->verified_flush) + sync_token.SetVerifyFlush(); + + return sync_token; +} + +// static MailboxHolderPtr TypeConverter<MailboxHolderPtr, gpu::MailboxHolder>::Convert( const gpu::MailboxHolder& input) { MailboxHolderPtr holder(MailboxHolder::New()); holder->mailbox = Mailbox::From<gpu::Mailbox>(input.mailbox); + holder->sync_token = SyncToken::From<gpu::SyncToken>(input.sync_token); holder->texture_target = input.texture_target; - holder->sync_point = input.sync_point; return holder.Pass(); } @@ -541,8 +570,8 @@ gpu::MailboxHolder TypeConverter<gpu::MailboxHolder, MailboxHolderPtr>::Convert( const MailboxHolderPtr& input) { gpu::MailboxHolder holder; holder.mailbox = input->mailbox.To<gpu::Mailbox>(); + holder.sync_token = input->sync_token.To<gpu::SyncToken>(); holder.texture_target = input->texture_target; - holder.sync_point = input->sync_point; return holder; } @@ -603,7 +632,7 @@ TypeConverter<ReturnedResourcePtr, cc::ReturnedResource>::Convert( const cc::ReturnedResource& input) { ReturnedResourcePtr returned = ReturnedResource::New(); returned->id = input.id; - returned->sync_point = input.sync_point; + returned->sync_token = SyncToken::From<gpu::SyncToken>(input.sync_token); returned->count = input.count; returned->lost = input.lost; return returned.Pass(); @@ -615,7 +644,7 @@ TypeConverter<cc::ReturnedResource, ReturnedResourcePtr>::Convert( const ReturnedResourcePtr& input) { cc::ReturnedResource returned; returned.id = input->id; - returned.sync_point = input->sync_point; + returned.sync_token = input->sync_token.To<gpu::SyncToken>(); returned.count = input->count; returned.lost = input->lost; return returned; diff --git a/mojo/converters/surfaces/surfaces_type_converters.h b/mojo/converters/surfaces/surfaces_type_converters.h index 4bcb0db..a172a8d 100644 --- a/mojo/converters/surfaces/surfaces_type_converters.h +++ b/mojo/converters/surfaces/surfaces_type_converters.h @@ -14,6 +14,7 @@ #include "components/mus/public/interfaces/surface_id.mojom.h" #include "gpu/command_buffer/common/mailbox.h" #include "gpu/command_buffer/common/mailbox_holder.h" +#include "gpu/command_buffer/common/sync_token.h" #include "mojo/converters/surfaces/mojo_surfaces_export.h" #include "third_party/skia/include/core/SkColor.h" @@ -106,6 +107,17 @@ struct MOJO_SURFACES_EXPORT template <> struct MOJO_SURFACES_EXPORT + TypeConverter<mus::mojom::SyncTokenPtr, gpu::SyncToken> { + static mus::mojom::SyncTokenPtr Convert(const gpu::SyncToken& input); +}; +template <> +struct MOJO_SURFACES_EXPORT + TypeConverter<gpu::SyncToken, mus::mojom::SyncTokenPtr> { + static gpu::SyncToken Convert(const mus::mojom::SyncTokenPtr& input); +}; + +template <> +struct MOJO_SURFACES_EXPORT TypeConverter<mus::mojom::MailboxHolderPtr, gpu::MailboxHolder> { static mus::mojom::MailboxHolderPtr Convert(const gpu::MailboxHolder& input); }; diff --git a/mojo/converters/surfaces/tests/surface_unittest.cc b/mojo/converters/surfaces/tests/surface_unittest.cc index fceaa32..3d0694b 100644 --- a/mojo/converters/surfaces/tests/surface_unittest.cc +++ b/mojo/converters/surfaces/tests/surface_unittest.cc @@ -402,17 +402,17 @@ TEST(SurfaceLibTest, MailboxHolder) { gpu::Mailbox mailbox; mailbox.Generate(); uint32_t texture_target = GL_TEXTURE_2D; - uint32_t sync_point = 7u; - gpu::MailboxHolder holder(mailbox, texture_target, sync_point); + gpu::SyncToken sync_token(7u); + gpu::MailboxHolder holder(mailbox, sync_token, texture_target); MailboxHolderPtr mus_holder = MailboxHolder::From(holder); EXPECT_EQ(texture_target, mus_holder->texture_target); - EXPECT_EQ(sync_point, mus_holder->sync_point); + EXPECT_EQ(sync_token, mus_holder->sync_token.To<gpu::SyncToken>()); gpu::MailboxHolder round_trip_holder = mus_holder.To<gpu::MailboxHolder>(); EXPECT_EQ(mailbox, round_trip_holder.mailbox); EXPECT_EQ(texture_target, round_trip_holder.texture_target); - EXPECT_EQ(sync_point, round_trip_holder.sync_point); + EXPECT_EQ(sync_token, round_trip_holder.sync_token); } TEST(SurfaceLibTest, TransferableResource) { @@ -446,32 +446,32 @@ TEST(SurfaceLibTest, TransferableResource) { EXPECT_EQ(mailbox_holder.mailbox, round_trip_resource.mailbox_holder.mailbox); EXPECT_EQ(mailbox_holder.texture_target, round_trip_resource.mailbox_holder.texture_target); - EXPECT_EQ(mailbox_holder.sync_point, - round_trip_resource.mailbox_holder.sync_point); + EXPECT_EQ(mailbox_holder.sync_token, + round_trip_resource.mailbox_holder.sync_token); EXPECT_EQ(is_software, round_trip_resource.is_software); } TEST(SurfaceLibTest, ReturnedResource) { uint32_t id = 5u; - uint32_t sync_point = 24u; + gpu::SyncToken sync_token(24u); int count = 2; bool lost = false; cc::ReturnedResource resource; resource.id = id; - resource.sync_point = sync_point; + resource.sync_token = sync_token; resource.count = count; resource.lost = lost; ReturnedResourcePtr mus_resource = ReturnedResource::From(resource); EXPECT_EQ(id, mus_resource->id); - EXPECT_EQ(sync_point, mus_resource->sync_point); + EXPECT_EQ(sync_token, mus_resource->sync_token.To<gpu::SyncToken>()); EXPECT_EQ(count, mus_resource->count); EXPECT_EQ(lost, mus_resource->lost); cc::ReturnedResource round_trip_resource = mus_resource.To<cc::ReturnedResource>(); EXPECT_EQ(id, round_trip_resource.id); - EXPECT_EQ(sync_point, round_trip_resource.sync_point); + EXPECT_EQ(sync_token, round_trip_resource.sync_token); EXPECT_EQ(count, round_trip_resource.count); EXPECT_EQ(lost, round_trip_resource.lost); } |