diff options
author | dyen <dyen@chromium.org> | 2015-10-12 11:07:09 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-12 18:08:23 +0000 |
commit | 1e5cd82449106d3550e4c896d42cc8af01197a4a (patch) | |
tree | 4b1d73f4a4accdb91bf887eb2b89d67ab8ecc820 /gpu/command_buffer/client/gles2_implementation.cc | |
parent | d2a2d8758119085991bc98883287c8678ec80bfc (diff) | |
download | chromium_src-1e5cd82449106d3550e4c896d42cc8af01197a4a.zip chromium_src-1e5cd82449106d3550e4c896d42cc8af01197a4a.tar.gz chromium_src-1e5cd82449106d3550e4c896d42cc8af01197a4a.tar.bz2 |
Reland: Added SyncToken command buffer trait to help with IPC messages
Revert "Revert of Added SyncToken command buffer trait to help with IPC messages. (patchset #1 id:1 of https://codereview.chromium.org/1394543003/ )"
This reverts commit 77970f1c3cd71d535a248d6e15f14081312b300a.
This CL is relands the SyncToken command buffer trait changes but also
fixes the alignment issues found on android.
R=piman@chromium.org
BUG=514815
Review URL: https://codereview.chromium.org/1399173002
Cr-Commit-Position: refs/heads/master@{#353555}
Diffstat (limited to 'gpu/command_buffer/client/gles2_implementation.cc')
-rw-r--r-- | gpu/command_buffer/client/gles2_implementation.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index 27bdd8a..b1a2aa8 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc @@ -30,6 +30,7 @@ #include "gpu/command_buffer/client/vertex_array_object_manager.h" #include "gpu/command_buffer/common/gles2_cmd_utils.h" #include "gpu/command_buffer/common/id_allocator.h" +#include "gpu/command_buffer/common/sync_token.h" #include "gpu/command_buffer/common/trace_event.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect_f.h" @@ -5385,12 +5386,10 @@ void GLES2Implementation::GenSyncTokenCHROMIUM(GLuint64 fence_sync, return; } - SyncToken* sync_token_data = reinterpret_cast<SyncToken*>(sync_token); - memset(sync_token_data, 0, sizeof(SyncToken)); - - sync_token_data->namespace_id = gpu_control_->GetNamespaceID(); - sync_token_data->command_buffer_id = gpu_control_->GetCommandBufferID(); - sync_token_data->release_count = fence_sync; + // Copy the data over after setting the data to ensure alignment. + SyncToken sync_token_data(gpu_control_->GetNamespaceID(), + gpu_control_->GetCommandBufferID(), fence_sync); + memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); } void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) { @@ -5399,11 +5398,12 @@ void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) { return; }; - const SyncToken* sync_token_data = - reinterpret_cast<const SyncToken*>(sync_token); - helper_->WaitSyncTokenCHROMIUM(sync_token_data->namespace_id, - sync_token_data->command_buffer_id, - sync_token_data->release_count); + // Copy the data over before data access to ensure alignment. + SyncToken sync_token_data; + memcpy(&sync_token_data, sync_token, sizeof(SyncToken)); + helper_->WaitSyncTokenCHROMIUM(sync_token_data.namespace_id(), + sync_token_data.command_buffer_id(), + sync_token_data.release_count()); } namespace { |