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

Unified Diff: cc/resources/video_resource_updater.cc

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mock gpu video accelerator factory 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
Index: cc/resources/video_resource_updater.cc
diff --git a/cc/resources/video_resource_updater.cc b/cc/resources/video_resource_updater.cc
index b2f8629459f87bc5d8a65dba0787dd7460391948..08b81a7143042159825045c25babce3d6ab46541 100644
--- a/cc/resources/video_resource_updater.cc
+++ b/cc/resources/video_resource_updater.cc
@@ -72,27 +72,31 @@ VideoFrameExternalResources::ResourceType ResourceTypeForVideoFrame(
class SyncPointClientImpl : public media::VideoFrame::SyncPointClient {
public:
explicit SyncPointClientImpl(gpu::gles2::GLES2Interface* gl,
- uint32 sync_point)
- : gl_(gl), sync_point_(sync_point) {}
+ uint32 sync_point,
+ const gpu::SyncToken& sync_token)
+ : gl_(gl), sync_point_(sync_point), sync_token_(sync_token) {}
~SyncPointClientImpl() override {}
uint32 InsertSyncPoint() override {
if (sync_point_)
return sync_point_;
return gl_->InsertSyncPointCHROMIUM();
}
- void WaitSyncPoint(uint32 sync_point) override {
- if (!sync_point)
- return;
- gl_->WaitSyncPointCHROMIUM(sync_point);
- if (sync_point_) {
- gl_->WaitSyncPointCHROMIUM(sync_point_);
- sync_point_ = 0;
+ void WaitSyncPoint(uint32 sync_point,
+ const gpu::SyncToken& sync_token) override {
+ if (sync_point || sync_token.HasData()) {
+ gl_->WaitSyncPointCHROMIUM(sync_point, sync_token.GetConstData());
+ if (sync_point_ || sync_token_.HasData()) {
+ gl_->WaitSyncPointCHROMIUM(sync_point_, sync_token_.GetConstData());
+ sync_point_ = 0;
+ sync_token_.Clear();
+ }
}
}
private:
gpu::gles2::GLES2Interface* gl_;
uint32 sync_point_;
+ gpu::SyncToken sync_token_;
};
} // namespace
@@ -381,8 +385,8 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
SetPlaneResourceUniqueId(video_frame.get(), i, &plane_resource);
}
- external_resources.mailboxes.push_back(
- TextureMailbox(plane_resource.mailbox, GL_TEXTURE_2D, 0));
+ external_resources.mailboxes.push_back(TextureMailbox(
+ plane_resource.mailbox, GL_TEXTURE_2D, 0, gpu::SyncToken()));
external_resources.release_callbacks.push_back(
base::Bind(&RecycleResource, AsWeakPtr(), plane_resource.resource_id));
}
@@ -396,6 +400,7 @@ void VideoResourceUpdater::ReturnTexture(
base::WeakPtr<VideoResourceUpdater> updater,
const scoped_refptr<media::VideoFrame>& video_frame,
uint32 sync_point,
+ const gpu::SyncToken& sync_token,
bool lost_resource,
BlockingTaskRunner* main_thread_task_runner) {
// TODO(dshwang) this case should be forwarded to the decoder as lost
@@ -406,7 +411,7 @@ void VideoResourceUpdater::ReturnTexture(
// returned by the compositor and emit a WaitSyncPointCHROMIUM on
// |video_frame|'s previous sync point using the current GL context.
SyncPointClientImpl client(updater->context_provider_->ContextGL(),
- sync_point);
+ sync_point, sync_token);
video_frame->UpdateReleaseSyncPoint(&client);
}
@@ -434,7 +439,8 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes(
break;
external_resources.mailboxes.push_back(
TextureMailbox(mailbox_holder.mailbox, mailbox_holder.texture_target,
- mailbox_holder.sync_point, video_frame->coded_size(),
+ mailbox_holder.sync_point, mailbox_holder.sync_token,
+ video_frame->coded_size(),
video_frame->metadata()->IsTrue(
media::VideoFrameMetadata::ALLOW_OVERLAY)));
external_resources.release_callbacks.push_back(
@@ -448,6 +454,7 @@ void VideoResourceUpdater::RecycleResource(
base::WeakPtr<VideoResourceUpdater> updater,
ResourceId resource_id,
uint32 sync_point,
+ const gpu::SyncToken& sync_token,
bool lost_resource,
BlockingTaskRunner* main_thread_task_runner) {
if (!updater.get()) {
@@ -464,8 +471,9 @@ void VideoResourceUpdater::RecycleResource(
return;
ContextProvider* context_provider = updater->context_provider_;
- if (context_provider && sync_point) {
- context_provider->ContextGL()->WaitSyncPointCHROMIUM(sync_point);
+ if (context_provider && (sync_point || sync_token.HasData())) {
+ context_provider->ContextGL()->WaitSyncPointCHROMIUM(
+ sync_point, sync_token.GetConstData());
}
if (lost_resource) {

Powered by Google App Engine
This is Rietveld 408576698