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

Side by Side Diff: ui/ozone/platform/drm/gpu/drm_thread.cc

Issue 2576263002: ozone: Allocate scanout buffer according to KMS modifiers (Closed)
Patch Set: ozone: Allocate scanout buffer according to KMS modifiers Created 4 years 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
OLDNEW
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
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_);
dnicoara 2016/12/19 19:44:46 nit: No need to DCHECK, the following access will
hoegsberg1 2016/12/22 23:05:20 Acknowledged.
128 gbm, ui::GetFourCCFormatFromBufferFormat(format), size, flags); 128 DrmWindow* window = screen_manager_->GetWindow(widget);
129 std::vector<uint64_t> modifiers;
130
131 uint32_t fourcc_format = ui::GetFourCCFormatFromBufferFormat(format);
132
133 if (window && window->GetController())
Daniele Castagna 2016/12/20 18:03:28 It'd be nice to understand why this happens, or at
hoegsberg1 2016/12/22 23:05:20 I added a todo there.
134 modifiers = window->GetController()->GetFormatModifiers(fourcc_format);
135
136 if (modifiers.size() > 0 && !(flags & GBM_BO_USE_LINEAR)) {
137 *buffer = GbmBuffer::CreateBufferWithModifiers(gbm, fourcc_format, size,
138 flags, modifiers);
139 } else {
140 *buffer = GbmBuffer::CreateBuffer(gbm, fourcc_format, size, flags);
141 }
129 } 142 }
130 143
131 void DrmThread::CreateBufferFromFds( 144 void DrmThread::CreateBufferFromFds(
132 gfx::AcceleratedWidget widget, 145 gfx::AcceleratedWidget widget,
133 const gfx::Size& size, 146 const gfx::Size& size,
134 gfx::BufferFormat format, 147 gfx::BufferFormat format,
135 std::vector<base::ScopedFD>&& fds, 148 std::vector<base::ScopedFD>&& fds,
136 const std::vector<gfx::NativePixmapPlane>& planes, 149 const std::vector<gfx::NativePixmapPlane>& planes,
137 scoped_refptr<GbmBuffer>* buffer) { 150 scoped_refptr<GbmBuffer>* buffer) {
138 scoped_refptr<GbmDevice> gbm = 151 scoped_refptr<GbmDevice> gbm =
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 correction_matrix); 286 correction_matrix);
274 } 287 }
275 288
276 // DrmThread requires a BindingSet instead of a simple Binding because it will 289 // DrmThread requires a BindingSet instead of a simple Binding because it will
277 // be used from multiple threads in multiple processes. 290 // be used from multiple threads in multiple processes.
278 void DrmThread::AddBinding(ozone::mojom::DeviceCursorRequest request) { 291 void DrmThread::AddBinding(ozone::mojom::DeviceCursorRequest request) {
279 bindings_.AddBinding(this, std::move(request)); 292 bindings_.AddBinding(this, std::move(request));
280 } 293 }
281 294
282 } // namespace ui 295 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698