summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authordyen <dyen@chromium.org>2015-11-03 12:03:04 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-03 20:04:03 +0000
commitcc16ed4d1e600f3d478bd00d8d315894a74d68bb (patch)
treebd2ca9893e7ce38921b7a664486d55931db35aeb /ppapi
parent55df5b2e04bc9ab96196b38a05a8dfb5f9701ca4 (diff)
downloadchromium_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 'ppapi')
-rw-r--r--ppapi/proxy/compositor_layer_resource.cc35
-rw-r--r--ppapi/proxy/compositor_layer_resource.h7
-rw-r--r--ppapi/proxy/compositor_resource.cc9
-rw-r--r--ppapi/proxy/compositor_resource.h13
-rw-r--r--ppapi/proxy/ppapi_messages.h5
-rw-r--r--ppapi/shared_impl/compositor_layer_data.h4
6 files changed, 41 insertions, 32 deletions
diff --git a/ppapi/proxy/compositor_layer_resource.cc b/ppapi/proxy/compositor_layer_resource.cc
index c42776e..3507c92 100644
--- a/ppapi/proxy/compositor_layer_resource.cc
+++ b/ppapi/proxy/compositor_layer_resource.cc
@@ -10,6 +10,7 @@
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/common/mailbox.h"
+#include "gpu/command_buffer/common/sync_token.h"
#include "ppapi/proxy/compositor_resource.h"
#include "ppapi/shared_impl/ppb_graphics_3d_shared.h"
#include "ppapi/thunk/enter.h"
@@ -30,14 +31,13 @@ float clamp(float value) {
return std::min(std::max(value, 0.0f), 1.0f);
}
-void OnTextureReleased(
- const ScopedPPResource& layer,
- const ScopedPPResource& context,
- uint32_t texture,
- const scoped_refptr<TrackedCallback>& release_callback,
- int32_t result,
- uint32_t sync_point,
- bool is_lost) {
+void OnTextureReleased(const ScopedPPResource& layer,
+ const ScopedPPResource& context,
+ uint32_t texture,
+ const scoped_refptr<TrackedCallback>& release_callback,
+ int32_t result,
+ const gpu::SyncToken& sync_token,
+ bool is_lost) {
if (!TrackedCallback::IsPending(release_callback))
return;
@@ -47,7 +47,7 @@ void OnTextureReleased(
}
do {
- if (!sync_point)
+ if (!sync_token.HasData())
break;
EnterResourceNoLock<PPB_Graphics3D_API> enter(context.get(), true);
@@ -58,19 +58,18 @@ void OnTextureReleased(
static_cast<PPB_Graphics3D_Shared*>(enter.object());
GLES2Implementation* gl = graphics->gles2_impl();
- gl->WaitSyncPointCHROMIUM(sync_point);
+ gl->WaitSyncTokenCHROMIUM(sync_token.GetConstData());
} while (false);
release_callback->Run(is_lost ? PP_ERROR_FAILED : PP_OK);
}
-void OnImageReleased(
- const ScopedPPResource& layer,
- const ScopedPPResource& image,
- const scoped_refptr<TrackedCallback>& release_callback,
- int32_t result,
- uint32_t sync_point,
- bool is_lost) {
+void OnImageReleased(const ScopedPPResource& layer,
+ const ScopedPPResource& image,
+ const scoped_refptr<TrackedCallback>& release_callback,
+ int32_t result,
+ const gpu::SyncToken& sync_token,
+ bool is_lost) {
if (!TrackedCallback::IsPending(release_callback))
return;
release_callback->Run(result);
@@ -175,7 +174,7 @@ int32_t CompositorLayerResource::SetTexture(
data_.common.size = *size;
data_.common.resource_id = compositor_->GenerateResourceId();
data_.texture->target = target;
- data_.texture->sync_point = gl->InsertSyncPointCHROMIUM();
+ data_.texture->sync_token = gpu::SyncToken(gl->InsertSyncPointCHROMIUM());
data_.texture->source_rect.point = PP_MakeFloatPoint(0.0f, 0.0f);
data_.texture->source_rect.size = source_size_;
diff --git a/ppapi/proxy/compositor_layer_resource.h b/ppapi/proxy/compositor_layer_resource.h
index dc6024f..8d4dfd3 100644
--- a/ppapi/proxy/compositor_layer_resource.h
+++ b/ppapi/proxy/compositor_layer_resource.h
@@ -12,6 +12,10 @@
#include "ppapi/shared_impl/scoped_pp_resource.h"
#include "ppapi/thunk/ppb_compositor_layer_api.h"
+namespace gpu {
+struct SyncToken;
+}
+
namespace ppapi {
namespace proxy {
@@ -22,7 +26,8 @@ class PPAPI_PROXY_EXPORT CompositorLayerResource
public thunk::PPB_CompositorLayer_API {
public:
// Release callback for texture or image layer.
- typedef base::Callback<void(int32_t, uint32_t, bool)> ReleaseCallback;
+ typedef base::Callback<void(int32_t, const gpu::SyncToken&, bool)>
+ ReleaseCallback;
CompositorLayerResource(Connection connection,
PP_Instance instance,
diff --git a/ppapi/proxy/compositor_resource.cc b/ppapi/proxy/compositor_resource.cc
index 443d7a9..f15e402 100644
--- a/ppapi/proxy/compositor_resource.cc
+++ b/ppapi/proxy/compositor_resource.cc
@@ -36,7 +36,7 @@ CompositorResource::~CompositorResource() {
for (ReleaseCallbackMap::iterator it = release_callback_map_.begin();
it != release_callback_map_.end(); ++it) {
if (!it->second.is_null())
- it->second.Run(PP_ERROR_ABORTED, 0, false);
+ it->second.Run(PP_ERROR_ABORTED, gpu::SyncToken(), false);
}
}
@@ -126,12 +126,12 @@ void CompositorResource::OnPluginMsgCommitLayersReply(
void CompositorResource::OnPluginMsgReleaseResource(
const ResourceMessageReplyParams& params,
int32_t id,
- uint32_t sync_point,
+ const gpu::SyncToken& sync_token,
bool is_lost) {
ReleaseCallbackMap::iterator it = release_callback_map_.find(id);
DCHECK(it != release_callback_map_.end()) <<
"Can not found release_callback_ by id(" << id << ")!";
- it->second.Run(PP_OK, sync_point, is_lost);
+ it->second.Run(PP_OK, sync_token, is_lost);
release_callback_map_.erase(it);
}
@@ -140,7 +140,8 @@ void CompositorResource::ResetLayersInternal(bool is_aborted) {
it != layers_.end(); ++it) {
ReleaseCallback release_callback = (*it)->release_callback();
if (!release_callback.is_null()) {
- release_callback.Run(is_aborted ? PP_ERROR_ABORTED : PP_OK, 0, false);
+ release_callback.Run(is_aborted ? PP_ERROR_ABORTED : PP_OK,
+ gpu::SyncToken(), false);
(*it)->ResetReleaseCallback();
}
(*it)->Invalidate();
diff --git a/ppapi/proxy/compositor_resource.h b/ppapi/proxy/compositor_resource.h
index 0d3161d..49ccf3d 100644
--- a/ppapi/proxy/compositor_resource.h
+++ b/ppapi/proxy/compositor_resource.h
@@ -13,6 +13,10 @@
#include "ppapi/shared_impl/proxy_lock.h"
#include "ppapi/thunk/ppb_compositor_api.h"
+namespace gpu {
+struct SyncToken;
+}
+
namespace ppapi {
namespace proxy {
@@ -44,11 +48,10 @@ class PPAPI_PROXY_EXPORT CompositorResource
// IPC msg handlers:
void OnPluginMsgCommitLayersReply(const ResourceMessageReplyParams& params);
- void OnPluginMsgReleaseResource(
- const ResourceMessageReplyParams& params,
- int32_t id,
- uint32_t sync_point,
- bool is_lost);
+ void OnPluginMsgReleaseResource(const ResourceMessageReplyParams& params,
+ int32_t id,
+ const gpu::SyncToken& sync_token,
+ bool is_lost);
void ResetLayersInternal(bool is_aborted);
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index c36ceac..a27a3ee 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -15,6 +15,7 @@
#include "base/sync_socket.h"
#include "gpu/command_buffer/common/command_buffer.h"
#include "gpu/command_buffer/common/mailbox.h"
+#include "gpu/command_buffer/common/sync_token.h"
#include "gpu/ipc/gpu_command_buffer_traits.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_message_macros.h"
@@ -278,8 +279,8 @@ IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(ppapi::CompositorLayerData::TextureLayer)
IPC_STRUCT_TRAITS_MEMBER(mailbox)
+ IPC_STRUCT_TRAITS_MEMBER(sync_token)
IPC_STRUCT_TRAITS_MEMBER(target)
- IPC_STRUCT_TRAITS_MEMBER(sync_point)
IPC_STRUCT_TRAITS_MEMBER(source_rect)
IPC_STRUCT_TRAITS_MEMBER(premult_alpha)
IPC_STRUCT_TRAITS_END()
@@ -1402,7 +1403,7 @@ IPC_MESSAGE_CONTROL2(PpapiHostMsg_Compositor_CommitLayers,
IPC_MESSAGE_CONTROL0(PpapiPluginMsg_Compositor_CommitLayersReply)
IPC_MESSAGE_CONTROL3(PpapiPluginMsg_Compositor_ReleaseResource,
int32_t /* id */,
- uint32_t /* sync_point */,
+ gpu::SyncToken /* sync_token */,
bool /* is_lost */)
// File chooser.
diff --git a/ppapi/shared_impl/compositor_layer_data.h b/ppapi/shared_impl/compositor_layer_data.h
index 8cf096e..d726e28 100644
--- a/ppapi/shared_impl/compositor_layer_data.h
+++ b/ppapi/shared_impl/compositor_layer_data.h
@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "gpu/command_buffer/common/mailbox.h"
+#include "gpu/command_buffer/common/sync_token.h"
#include "ppapi/c/ppb_compositor_layer.h"
#include "ppapi/shared_impl/host_resource.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"
@@ -79,13 +80,12 @@ struct PPAPI_SHARED_EXPORT CompositorLayerData {
struct TextureLayer {
TextureLayer()
: target(0),
- sync_point(0),
source_rect(PP_MakeFloatRectFromXYWH(0.0f, 0.0f, 1.0f, 1.0f)),
premult_alpha(true) {}
gpu::Mailbox mailbox;
+ gpu::SyncToken sync_token;
uint32_t target;
- uint32_t sync_point;
PP_FloatRect source_rect;
bool premult_alpha;
};