Chromium Code Reviews| Index: components/exo/wayland/clients/client_base.cc |
| diff --git a/components/exo/wayland/clients/client_base.cc b/components/exo/wayland/clients/client_base.cc |
| index 8c17ba56ed51b15fbaa3d47db39a00aed4b0b794..209d0c9a597a835376e06717b5fe930eadcdcf75 100644 |
| --- a/components/exo/wayland/clients/client_base.cc |
| +++ b/components/exo/wayland/clients/client_base.cc |
| @@ -57,6 +57,9 @@ const char kUseDrm[] = "use-drm"; |
| // Specifies if client should be fullscreen. |
| const char kFullscreen[] = "fullscreen"; |
| +// Specifies if no-roundtrip dmabuf import path should be used. |
| +const char kNoRoundtripImport[] = "no-roundtrip-import"; |
|
reveman
2017/04/28 17:21:24
No need for this flag. Please refactor the code so
|
| + |
| } // namespace switches |
| namespace { |
| @@ -174,6 +177,7 @@ bool ClientBase::InitParams::FromCommandLine( |
| fullscreen = command_line.HasSwitch(switches::kFullscreen); |
| transparent_background = |
| command_line.HasSwitch(switches::kTransparentBackground); |
| + immed = command_line.HasSwitch(switches::kNoRoundtripImport); |
| return true; |
| } |
| @@ -200,6 +204,7 @@ bool ClientBase::Init(const InitParams& params) { |
| scale_ = params.scale; |
| fullscreen_ = params.fullscreen; |
| transparent_background_ = params.transparent_background; |
| + immed_ = params.immed; |
| display_.reset(wl_display_connect(nullptr)); |
| if (!display_) { |
| @@ -313,7 +318,8 @@ bool ClientBase::Init(const InitParams& params) { |
| buffers_.push_back(std::move(buffer)); |
| } |
| - wl_display_roundtrip(display_.get()); |
| + if (!immed_) |
| + wl_display_roundtrip(display_.get()); |
| for (size_t i = 0; i < buffers_.size(); ++i) { |
| if (!buffers_[i]->buffer) { |
| LOG(ERROR) << "LinuxBufferParamsCreated was not called on the buffer."; |
| @@ -397,8 +403,12 @@ std::unique_ptr<ClientBase::Buffer> ClientBase::CreateBuffer( |
| zwp_linux_buffer_params_v1_add(buffer->params.get(), fd.get(), i, offset, |
| stride, 0, 0); |
| } |
| - zwp_linux_buffer_params_v1_create(buffer->params.get(), width_, height_, |
| - drm_format, 0); |
| + if (immed_) |
| + buffer->buffer.reset(zwp_linux_buffer_params_v1_create_immed( |
| + buffer->params.get(), width_, height_, drm_format, 0)); |
| + else |
| + zwp_linux_buffer_params_v1_create(buffer->params.get(), width_, height_, |
| + drm_format, 0); |
| if (gbm_bo_get_num_planes(buffer->bo.get()) != 1) |
| return buffer; |