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

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

Issue 2678343011: chromeos: decode video into NV12 format instead of RGBA in vaapi decoder (Closed)
Patch Set: decide scanout in runtime Created 3 years, 5 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
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 void DrmThread::CreateBuffer(gfx::AcceleratedWidget widget, 108 void DrmThread::CreateBuffer(gfx::AcceleratedWidget widget,
109 const gfx::Size& size, 109 const gfx::Size& size,
110 gfx::BufferFormat format, 110 gfx::BufferFormat format,
111 gfx::BufferUsage usage, 111 gfx::BufferUsage usage,
112 scoped_refptr<GbmBuffer>* buffer) { 112 scoped_refptr<GbmBuffer>* buffer) {
113 scoped_refptr<GbmDevice> gbm = 113 scoped_refptr<GbmDevice> gbm =
114 static_cast<GbmDevice*>(device_manager_->GetDrmDevice(widget).get()); 114 static_cast<GbmDevice*>(device_manager_->GetDrmDevice(widget).get());
115 DCHECK(gbm); 115 DCHECK(gbm);
116 116
117 uint32_t flags = 0; 117 uint32_t flags = GetGbmFlagsFromBufferUsage(usage);
118 switch (usage) {
119 case gfx::BufferUsage::GPU_READ:
120 flags = GBM_BO_USE_TEXTURING;
121 break;
122 case gfx::BufferUsage::SCANOUT:
123 flags = GBM_BO_USE_SCANOUT;
124 break;
125 case gfx::BufferUsage::SCANOUT_CPU_READ_WRITE:
126 flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_LINEAR;
127 break;
128 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
129 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT:
130 flags = GBM_BO_USE_TEXTURING | GBM_BO_USE_LINEAR;
131 break;
132 }
133
134 DrmWindow* window = screen_manager_->GetWindow(widget); 118 DrmWindow* window = screen_manager_->GetWindow(widget);
135 std::vector<uint64_t> modifiers; 119 std::vector<uint64_t> modifiers;
136 120
137 uint32_t fourcc_format = ui::GetFourCCFormatFromBufferFormat(format); 121 uint32_t fourcc_format = ui::GetFourCCFormatFromBufferFormat(format);
138 122
139 // TODO(hoegsberg): We shouldn't really get here without a window, 123 // TODO(hoegsberg): We shouldn't really get here without a window,
140 // but it happens during init. Need to figure out why. 124 // but it happens during init. Need to figure out why.
141 if (window && window->GetController()) 125 if (window && window->GetController())
142 modifiers = window->GetController()->GetFormatModifiers(fourcc_format); 126 modifiers = window->GetController()->GetFormatModifiers(fourcc_format);
143 127
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 correction_matrix); 283 correction_matrix);
300 } 284 }
301 285
302 // DrmThread requires a BindingSet instead of a simple Binding because it will 286 // DrmThread requires a BindingSet instead of a simple Binding because it will
303 // be used from multiple threads in multiple processes. 287 // be used from multiple threads in multiple processes.
304 void DrmThread::AddBinding(ozone::mojom::DeviceCursorRequest request) { 288 void DrmThread::AddBinding(ozone::mojom::DeviceCursorRequest request) {
305 bindings_.AddBinding(this, std::move(request)); 289 bindings_.AddBinding(this, std::move(request));
306 } 290 }
307 291
308 } // namespace ui 292 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698