Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/ozone/platform/drm/gpu/drm_thread.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_thread.h" |
| 6 | 6 |
| 7 #include <gbm.h> | 7 #include <gbm.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 break; | 117 break; |
| 118 case gfx::BufferUsage::SCANOUT: | 118 case gfx::BufferUsage::SCANOUT: |
| 119 flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING; | 119 flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING; |
| 120 break; | 120 break; |
| 121 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: | 121 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: |
| 122 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: | 122 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: |
| 123 flags = GBM_BO_USE_LINEAR; | 123 flags = GBM_BO_USE_LINEAR; |
| 124 break; | 124 break; |
| 125 } | 125 } |
| 126 | 126 |
| 127 *buffer = GbmBuffer::CreateBuffer( | 127 DCHECK(screen_manager_); |
| 128 gbm, ui::GetFourCCFormatFromBufferFormat(format), size, flags); | 128 DrmWindow* window = screen_manager_->GetWindow(widget); |
| 129 | |
| 130 uint32_t fourcc_format = ui::GetFourCCFormatFromBufferFormat(format); | |
| 131 uint64_t modifiers[16]; | |
|
Daniele Castagna
2016/12/16 00:27:41
It'd be nice if this could go away (for a vector m
hoegsberg1
2016/12/17 01:10:49
Acknowledged.
| |
| 132 uint32_t nmodifiers = 0; | |
|
Daniele Castagna
2016/12/16 00:27:41
nit: s/nmodifiers/num_modifiers or modifiers_size
hoegsberg1
2016/12/17 01:10:49
Ack, but it becomes modifers.size(), even better.
| |
| 133 | |
| 134 if (window && window->GetController()) { | |
|
Daniele Castagna
2016/12/16 00:27:41
Did we figure out when this is not the case?
hoegsberg1
2016/12/17 01:10:49
No... maybe related to the logout button race? (cr
| |
| 135 nmodifiers = window->GetController()->GetFormatModifiers(fourcc_format, | |
| 136 » » » » » » » modifiers, arraysiz e(modifiers)); | |
| 137 } | |
| 138 | |
| 139 if (nmodifiers > 0 && !(flags & GBM_BO_USE_LINEAR)) | |
|
Daniele Castagna
2016/12/16 00:27:41
Why do we need to special case for GBM_BO_USE_LINE
hoegsberg1
2016/12/17 01:10:49
If we need a linear buffer, we can either 1) go th
| |
| 140 *buffer = GbmBuffer::CreateBufferWithModifiers( | |
|
Daniele Castagna
2016/12/16 00:27:41
nit: if you split the body of an if, you need to a
hoegsberg1
2016/12/17 01:10:49
Acknowledged.
| |
| 141 gbm, fourcc_format, size, flags, modifiers, nmodifiers); | |
| 142 else | |
| 143 *buffer = GbmBuffer::CreateBuffer( | |
| 144 gbm, fourcc_format, size, flags); | |
| 129 } | 145 } |
| 130 | 146 |
| 131 void DrmThread::CreateBufferFromFds( | 147 void DrmThread::CreateBufferFromFds( |
| 132 gfx::AcceleratedWidget widget, | 148 gfx::AcceleratedWidget widget, |
| 133 const gfx::Size& size, | 149 const gfx::Size& size, |
| 134 gfx::BufferFormat format, | 150 gfx::BufferFormat format, |
| 135 std::vector<base::ScopedFD>&& fds, | 151 std::vector<base::ScopedFD>&& fds, |
| 136 const std::vector<gfx::NativePixmapPlane>& planes, | 152 const std::vector<gfx::NativePixmapPlane>& planes, |
| 137 scoped_refptr<GbmBuffer>* buffer) { | 153 scoped_refptr<GbmBuffer>* buffer) { |
| 138 scoped_refptr<GbmDevice> gbm = | 154 scoped_refptr<GbmDevice> gbm = |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 correction_matrix); | 289 correction_matrix); |
| 274 } | 290 } |
| 275 | 291 |
| 276 // DrmThread requires a BindingSet instead of a simple Binding because it will | 292 // DrmThread requires a BindingSet instead of a simple Binding because it will |
| 277 // be used from multiple threads in multiple processes. | 293 // be used from multiple threads in multiple processes. |
| 278 void DrmThread::AddBinding(ozone::mojom::DeviceCursorRequest request) { | 294 void DrmThread::AddBinding(ozone::mojom::DeviceCursorRequest request) { |
| 279 bindings_.AddBinding(this, std::move(request)); | 295 bindings_.AddBinding(this, std::move(request)); |
| 280 } | 296 } |
| 281 | 297 |
| 282 } // namespace ui | 298 } // namespace ui |
| OLD | NEW |