OLD | NEW |
---|---|
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 Loading... | |
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 |
66 m->WriteBytes(&verified_flush, sizeof(verified_flush)); | |
64 m->WriteBytes(&namespace_id, sizeof(namespace_id)); | 67 m->WriteBytes(&namespace_id, sizeof(namespace_id)); |
65 m->WriteBytes(&command_buffer_id, sizeof(command_buffer_id)); | 68 m->WriteBytes(&command_buffer_id, sizeof(command_buffer_id)); |
66 m->WriteBytes(&release_count, sizeof(release_count)); | 69 m->WriteBytes(&release_count, sizeof(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 | |
piman
2015/10/29 23:45:17
Can you add:
if (p->HasData() && !verified_flush)
David Yen
2015/10/30 00:01:30
Done.
| |
95 if (verified_flush) | |
96 p->SetVerifyFlush(); | |
97 | |
87 return true; | 98 return true; |
88 } | 99 } |
89 | 100 |
90 void ParamTraits<gpu::SyncToken>::Log(const param_type& p, std::string* l) { | 101 void ParamTraits<gpu::SyncToken>::Log(const param_type& p, std::string* l) { |
91 *l += | 102 *l += |
92 base::StringPrintf("[%d:%llX] %llu", static_cast<int>(p.namespace_id()), | 103 base::StringPrintf("[%d:%llX] %llu", static_cast<int>(p.namespace_id()), |
93 static_cast<unsigned long long>(p.command_buffer_id()), | 104 static_cast<unsigned long long>(p.command_buffer_id()), |
94 static_cast<unsigned long long>(p.release_count())); | 105 static_cast<unsigned long long>(p.release_count())); |
95 } | 106 } |
96 | 107 |
(...skipping 13 matching lines...) Expand all Loading... | |
110 } | 121 } |
111 | 122 |
112 void ParamTraits<gpu::Mailbox>::Log(const param_type& p, std::string* l) { | 123 void ParamTraits<gpu::Mailbox>::Log(const param_type& p, std::string* l) { |
113 for (size_t i = 0; i < sizeof(p.name); ++i) | 124 for (size_t i = 0; i < sizeof(p.name); ++i) |
114 *l += base::StringPrintf("%02x", p.name[i]); | 125 *l += base::StringPrintf("%02x", p.name[i]); |
115 } | 126 } |
116 | 127 |
117 void ParamTraits<gpu::MailboxHolder>::Write(Message* m, const param_type& p) { | 128 void ParamTraits<gpu::MailboxHolder>::Write(Message* m, const param_type& p) { |
118 WriteParam(m, p.mailbox); | 129 WriteParam(m, p.mailbox); |
119 WriteParam(m, p.texture_target); | 130 WriteParam(m, p.texture_target); |
120 WriteParam(m, p.sync_point); | 131 WriteParam(m, p.sync_token); |
121 } | 132 } |
122 | 133 |
123 bool ParamTraits<gpu::MailboxHolder> ::Read(const Message* m, | 134 bool ParamTraits<gpu::MailboxHolder> ::Read(const Message* m, |
124 base::PickleIterator* iter, | 135 base::PickleIterator* iter, |
125 param_type* p) { | 136 param_type* p) { |
126 if (!ReadParam(m, iter, &p->mailbox) || | 137 if (!ReadParam(m, iter, &p->mailbox) || |
127 !ReadParam(m, iter, &p->texture_target) || | 138 !ReadParam(m, iter, &p->texture_target) || |
128 !ReadParam(m, iter, &p->sync_point)) | 139 !ReadParam(m, iter, &p->sync_token)) |
129 return false; | 140 return false; |
130 return true; | 141 return true; |
131 } | 142 } |
132 | 143 |
133 void ParamTraits<gpu::MailboxHolder>::Log(const param_type& p, std::string* l) { | 144 void ParamTraits<gpu::MailboxHolder>::Log(const param_type& p, std::string* l) { |
134 ParamTraits<gpu::Mailbox>::Log(p.mailbox, l); | 145 ParamTraits<gpu::Mailbox>::Log(p.mailbox, l); |
135 *l += base::StringPrintf(":%04x@%d", p.texture_target, p.sync_point); | 146 *l += base::StringPrintf(":%04x@", p.texture_target); |
147 ParamTraits<gpu::SyncToken>::Log(p.sync_token, l); | |
136 } | 148 } |
137 | 149 |
138 void ParamTraits<gpu::ValueState>::Write(Message* m, const param_type& p) { | 150 void ParamTraits<gpu::ValueState>::Write(Message* m, const param_type& p) { |
139 m->WriteData(reinterpret_cast<const char*>(&p), | 151 m->WriteData(reinterpret_cast<const char*>(&p), |
140 sizeof(gpu::ValueState)); | 152 sizeof(gpu::ValueState)); |
141 } | 153 } |
142 | 154 |
143 bool ParamTraits<gpu::ValueState> ::Read(const Message* m, | 155 bool ParamTraits<gpu::ValueState> ::Read(const Message* m, |
144 base::PickleIterator* iter, | 156 base::PickleIterator* iter, |
145 param_type* p) { | 157 param_type* p) { |
(...skipping 10 matching lines...) Expand all Loading... | |
156 l->append("<ValueState ("); | 168 l->append("<ValueState ("); |
157 for (int value : p.int_value) | 169 for (int value : p.int_value) |
158 *l += base::StringPrintf("%i ", value); | 170 *l += base::StringPrintf("%i ", value); |
159 l->append(" int values "); | 171 l->append(" int values "); |
160 for (float value : p.float_value) | 172 for (float value : p.float_value) |
161 *l += base::StringPrintf("%f ", value); | 173 *l += base::StringPrintf("%f ", value); |
162 l->append(" float values)>"); | 174 l->append(" float values)>"); |
163 } | 175 } |
164 | 176 |
165 } // namespace IPC | 177 } // namespace IPC |
OLD | NEW |