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

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

Issue 2627193003: ozone: Allocate scanout buffers according to KMS modifiers. (Closed)
Patch Set: Created 3 years, 11 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 | « ui/ozone/platform/drm/gpu/drm_device.cc ('k') | ui/ozone/platform/drm/gpu/gbm_buffer.h » ('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 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 DrmWindow* window = screen_manager_->GetWindow(widget);
128 gbm, ui::GetFourCCFormatFromBufferFormat(format), size, flags); 128 std::vector<uint64_t> modifiers;
129
130 uint32_t fourcc_format = ui::GetFourCCFormatFromBufferFormat(format);
131
132 // TODO(hoegsberg): We shouldn't really get here without a window,
133 // but it happens during init. Need to figure out why.
134 if (window && window->GetController())
135 modifiers = window->GetController()->GetFormatModifiers(fourcc_format);
136
137 if (modifiers.size() > 0 && !(flags & GBM_BO_USE_LINEAR))
138 *buffer = GbmBuffer::CreateBufferWithModifiers(gbm, fourcc_format, size,
139 flags, modifiers);
140 else
141 *buffer = GbmBuffer::CreateBuffer(gbm, fourcc_format, size, flags);
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
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_device.cc ('k') | ui/ozone/platform/drm/gpu/gbm_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698