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

Side by Side Diff: components/exo/wayland/clients/rects.cc

Issue 2804643003: exo: advertise supported formats to linux_dmabuf clients
Patch Set: indent fixup Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « components/exo/wayland/clients/client_base.cc ('k') | components/exo/wayland/server.cc » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 // Implementation of a client that produces output in the form of RGBA 5 // Implementation of a client that produces output in the form of RGBA
6 // buffers when receiving pointer/touch events. RGB contains the lower 6 // buffers when receiving pointer/touch events. RGB contains the lower
7 // 24 bits of the event timestamp and A is 0xff. 7 // 24 bits of the event timestamp and A is 0xff.
8 8
9 #include <linux-dmabuf-unstable-v1-client-protocol.h> 9 #include <linux-dmabuf-unstable-v1-client-protocol.h>
10 #include <presentation-time-client-protocol.h> 10 #include <presentation-time-client-protocol.h>
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 public: 210 public:
211 RectsClient() {} 211 RectsClient() {}
212 212
213 // Initialize and run client main loop. 213 // Initialize and run client main loop.
214 int Run(const ClientBase::InitParams& params, 214 int Run(const ClientBase::InitParams& params,
215 size_t max_frames_pending, 215 size_t max_frames_pending,
216 size_t num_rects, 216 size_t num_rects,
217 size_t num_benchmark_runs, 217 size_t num_benchmark_runs,
218 base::TimeDelta benchmark_interval, 218 base::TimeDelta benchmark_interval,
219 bool show_fps_counter); 219 bool show_fps_counter);
220 static void AddDmaBufFormat(uint32_t format);
220 221
221 private: 222 private:
223 static std::vector<uint32_t> dmabuf_formats_;
222 DISALLOW_COPY_AND_ASSIGN(RectsClient); 224 DISALLOW_COPY_AND_ASSIGN(RectsClient);
223 }; 225 };
224 226
227 std::vector<uint32_t> RectsClient::dmabuf_formats_ = std::vector<uint32_t>();
228
229 void RectsClient::AddDmaBufFormat(uint32_t format) {
230 dmabuf_formats_.push_back(format);
231 }
232
233 void LinuxDmaBufFormatReceived(void* data,
234 struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf,
235 uint32_t format) {
236 RectsClient::AddDmaBufFormat(format);
237 }
238
225 int RectsClient::Run(const ClientBase::InitParams& params, 239 int RectsClient::Run(const ClientBase::InitParams& params,
226 size_t max_frames_pending, 240 size_t max_frames_pending,
227 size_t num_rects, 241 size_t num_rects,
228 size_t num_benchmark_runs, 242 size_t num_benchmark_runs,
229 base::TimeDelta benchmark_interval, 243 base::TimeDelta benchmark_interval,
230 bool show_fps_counter) { 244 bool show_fps_counter) {
231 if (!ClientBase::Init(params)) 245 if (!ClientBase::Init(params))
232 return 1; 246 return 1;
233 247
234 EventTimeStack event_times; 248 EventTimeStack event_times;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 527
514 size_t benchmark_interval_ms = 5000; // 5 seconds. 528 size_t benchmark_interval_ms = 5000; // 5 seconds.
515 if (command_line->HasSwitch(switches::kBenchmarkInterval) && 529 if (command_line->HasSwitch(switches::kBenchmarkInterval) &&
516 (!base::StringToSizeT( 530 (!base::StringToSizeT(
517 command_line->GetSwitchValueASCII(switches::kBenchmarkInterval), 531 command_line->GetSwitchValueASCII(switches::kBenchmarkInterval),
518 &benchmark_interval_ms))) { 532 &benchmark_interval_ms))) {
519 LOG(ERROR) << "Invalid value for " << switches::kBenchmarkInterval; 533 LOG(ERROR) << "Invalid value for " << switches::kBenchmarkInterval;
520 return 1; 534 return 1;
521 } 535 }
522 536
537 params.dmabuf_listener = {exo::wayland::clients::LinuxDmaBufFormatReceived};
523 exo::wayland::clients::RectsClient client; 538 exo::wayland::clients::RectsClient client;
524 return client.Run(params, max_frames_pending, num_rects, num_benchmark_runs, 539 return client.Run(params, max_frames_pending, num_rects, num_benchmark_runs,
525 base::TimeDelta::FromMilliseconds(benchmark_interval_ms), 540 base::TimeDelta::FromMilliseconds(benchmark_interval_ms),
526 command_line->HasSwitch(switches::kShowFpsCounter)); 541 command_line->HasSwitch(switches::kShowFpsCounter));
527 } 542 }
OLDNEW
« no previous file with comments | « components/exo/wayland/clients/client_base.cc ('k') | components/exo/wayland/server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698