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

Side by Side Diff: gpu/ipc/gpu_command_buffer_traits.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: format Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/common/sync_token.h ('k') | media/base/video_frame.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/ipc/gpu_command_buffer_traits.h" 5 #include "gpu/ipc/gpu_command_buffer_traits.h"
6 6
7 #include "gpu/command_buffer/common/mailbox_holder.h" 7 #include "gpu/command_buffer/common/mailbox_holder.h"
8 #include "gpu/command_buffer/common/sync_token.h" 8 #include "gpu/command_buffer/common/sync_token.h"
9 #include "gpu/command_buffer/common/value_state.h" 9 #include "gpu/command_buffer/common/value_state.h"
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 return false; 50 return false;
51 } 51 }
52 } 52 }
53 53
54 void ParamTraits<gpu::CommandBuffer::State> ::Log(const param_type& p, 54 void ParamTraits<gpu::CommandBuffer::State> ::Log(const param_type& p,
55 std::string* l) { 55 std::string* l) {
56 l->append("<CommandBuffer::State>"); 56 l->append("<CommandBuffer::State>");
57 } 57 }
58 58
59 void ParamTraits<gpu::SyncToken>::Write(Message* m, const param_type& p) { 59 void ParamTraits<gpu::SyncToken>::Write(Message* m, const param_type& p) {
60 DCHECK(!p.HasData() || p.verified_flush());
61 const bool verified_flush = p.verified_flush();
60 const int namespace_id = static_cast<int>(p.namespace_id()); 62 const int namespace_id = static_cast<int>(p.namespace_id());
61 const uint64_t command_buffer_id = p.command_buffer_id(); 63 const uint64_t command_buffer_id = p.command_buffer_id();
62 const uint64_t release_count = p.release_count(); 64 const uint64_t release_count = p.release_count();
63 65
64 m->WriteBytes(&namespace_id, sizeof(namespace_id)); 66 m->WriteBool(verified_flush);
65 m->WriteBytes(&command_buffer_id, sizeof(command_buffer_id)); 67 m->WriteInt(namespace_id);
66 m->WriteBytes(&release_count, sizeof(release_count)); 68 m->WriteUInt64(command_buffer_id);
69 m->WriteUInt64(release_count);
67 } 70 }
68 71
69 bool ParamTraits<gpu::SyncToken>::Read(const Message* m, 72 bool ParamTraits<gpu::SyncToken>::Read(const Message* m,
70 base::PickleIterator* iter, 73 base::PickleIterator* iter,
71 param_type* p) { 74 param_type* p) {
75 bool verified_flush = false;
76 if (!iter->ReadBool(&verified_flush))
77 return false;
78
72 int namespace_id = -1; 79 int namespace_id = -1;
73 if (!iter->ReadInt(&namespace_id)) 80 if (!iter->ReadInt(&namespace_id))
74 return false; 81 return false;
75 82
76 uint64_t command_buffer_id = 0; 83 uint64_t command_buffer_id = 0;
77 if (!iter->ReadUInt64(&command_buffer_id)) 84 if (!iter->ReadUInt64(&command_buffer_id))
78 return false; 85 return false;
79 86
80 uint64_t release_count = 0; 87 uint64_t release_count = 0;
81 if (!iter->ReadUInt64(&release_count)) 88 if (!iter->ReadUInt64(&release_count))
82 return false; 89 return false;
83 90
84 p->Set(static_cast<gpu::CommandBufferNamespace>(namespace_id), 91 p->Set(static_cast<gpu::CommandBufferNamespace>(namespace_id),
85 command_buffer_id, 92 command_buffer_id,
86 release_count); 93 release_count);
94
95 if (p->HasData()) {
96 if (!verified_flush)
97 return false;
98 p->SetVerifyFlush();
99 }
100
87 return true; 101 return true;
88 } 102 }
89 103
90 void ParamTraits<gpu::SyncToken>::Log(const param_type& p, std::string* l) { 104 void ParamTraits<gpu::SyncToken>::Log(const param_type& p, std::string* l) {
91 *l += 105 *l +=
92 base::StringPrintf("[%d:%llX] %llu", static_cast<int>(p.namespace_id()), 106 base::StringPrintf("[%d:%llX] %llu", static_cast<int>(p.namespace_id()),
93 static_cast<unsigned long long>(p.command_buffer_id()), 107 static_cast<unsigned long long>(p.command_buffer_id()),
94 static_cast<unsigned long long>(p.release_count())); 108 static_cast<unsigned long long>(p.release_count()));
95 } 109 }
96 110
(...skipping 12 matching lines...) Expand all
109 return true; 123 return true;
110 } 124 }
111 125
112 void ParamTraits<gpu::Mailbox>::Log(const param_type& p, std::string* l) { 126 void ParamTraits<gpu::Mailbox>::Log(const param_type& p, std::string* l) {
113 for (size_t i = 0; i < sizeof(p.name); ++i) 127 for (size_t i = 0; i < sizeof(p.name); ++i)
114 *l += base::StringPrintf("%02x", p.name[i]); 128 *l += base::StringPrintf("%02x", p.name[i]);
115 } 129 }
116 130
117 void ParamTraits<gpu::MailboxHolder>::Write(Message* m, const param_type& p) { 131 void ParamTraits<gpu::MailboxHolder>::Write(Message* m, const param_type& p) {
118 WriteParam(m, p.mailbox); 132 WriteParam(m, p.mailbox);
133 WriteParam(m, p.sync_token);
119 WriteParam(m, p.texture_target); 134 WriteParam(m, p.texture_target);
120 WriteParam(m, p.sync_point);
121 } 135 }
122 136
123 bool ParamTraits<gpu::MailboxHolder> ::Read(const Message* m, 137 bool ParamTraits<gpu::MailboxHolder> ::Read(const Message* m,
124 base::PickleIterator* iter, 138 base::PickleIterator* iter,
125 param_type* p) { 139 param_type* p) {
126 if (!ReadParam(m, iter, &p->mailbox) || 140 if (!ReadParam(m, iter, &p->mailbox) || !ReadParam(m, iter, &p->sync_token) ||
127 !ReadParam(m, iter, &p->texture_target) || 141 !ReadParam(m, iter, &p->texture_target))
128 !ReadParam(m, iter, &p->sync_point))
129 return false; 142 return false;
130 return true; 143 return true;
131 } 144 }
132 145
133 void ParamTraits<gpu::MailboxHolder>::Log(const param_type& p, std::string* l) { 146 void ParamTraits<gpu::MailboxHolder>::Log(const param_type& p, std::string* l) {
134 ParamTraits<gpu::Mailbox>::Log(p.mailbox, l); 147 LogParam(p.mailbox, l);
135 *l += base::StringPrintf(":%04x@%d", p.texture_target, p.sync_point); 148 LogParam(p.sync_token, l);
149 *l += base::StringPrintf(":%04x@", p.texture_target);
136 } 150 }
137 151
138 void ParamTraits<gpu::ValueState>::Write(Message* m, const param_type& p) { 152 void ParamTraits<gpu::ValueState>::Write(Message* m, const param_type& p) {
139 m->WriteData(reinterpret_cast<const char*>(&p), 153 m->WriteData(reinterpret_cast<const char*>(&p),
140 sizeof(gpu::ValueState)); 154 sizeof(gpu::ValueState));
141 } 155 }
142 156
143 bool ParamTraits<gpu::ValueState> ::Read(const Message* m, 157 bool ParamTraits<gpu::ValueState> ::Read(const Message* m,
144 base::PickleIterator* iter, 158 base::PickleIterator* iter,
145 param_type* p) { 159 param_type* p) {
(...skipping 10 matching lines...) Expand all
156 l->append("<ValueState ("); 170 l->append("<ValueState (");
157 for (int value : p.int_value) 171 for (int value : p.int_value)
158 *l += base::StringPrintf("%i ", value); 172 *l += base::StringPrintf("%i ", value);
159 l->append(" int values "); 173 l->append(" int values ");
160 for (float value : p.float_value) 174 for (float value : p.float_value)
161 *l += base::StringPrintf("%f ", value); 175 *l += base::StringPrintf("%f ", value);
162 l->append(" float values)>"); 176 l->append(" float values)>");
163 } 177 }
164 178
165 } // namespace IPC 179 } // namespace IPC
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/sync_token.h ('k') | media/base/video_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698