OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | |
6 #include <gbm.h> | |
7 | |
5 #include "base/bind.h" | 8 #include "base/bind.h" |
6 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
7 #include "base/logging.h" | 10 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
9 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
10 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
11 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
12 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
13 #include "content/common/gpu/gpu_channel.h" | 16 #include "content/common/gpu/media/vaapi_video_decode_accelerator_drm.h" |
scherkus (not reviewing)
2014/07/29 17:48:54
looks like this .cc file has incorrect include ord
vignatti (out of this project)
2014/07/30 21:51:30
right, I fixed. The problem happened because I've
| |
14 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" | |
15 #include "media/base/bind_to_current_loop.h" | 17 #include "media/base/bind_to_current_loop.h" |
16 #include "media/video/picture.h" | 18 #include "media/video/picture.h" |
17 #include "ui/gl/gl_bindings.h" | 19 #include "ui/gl/gl_bindings.h" |
20 #include "ui/gl/gl_surface_egl.h" | |
18 #include "ui/gl/scoped_binders.h" | 21 #include "ui/gl/scoped_binders.h" |
19 | 22 |
20 static void ReportToUMA( | 23 static void ReportToUMA( |
21 content::VaapiH264Decoder::VAVDAH264DecoderFailure failure) { | 24 content::VaapiH264Decoder::VAVDAH264DecoderFailure failure) { |
22 UMA_HISTOGRAM_ENUMERATION( | 25 UMA_HISTOGRAM_ENUMERATION( |
23 "Media.VAVDAH264.DecoderFailure", | 26 "Media.VAVDAH264.DecoderFailure", |
24 failure, | 27 failure, |
25 content::VaapiH264Decoder::VAVDA_H264_DECODER_FAILURES_MAX); | 28 content::VaapiH264Decoder::VAVDA_H264_DECODER_FAILURES_MAX); |
26 } | 29 } |
27 | 30 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 // at the end of decode (or when a new set of PictureBuffers is required). | 70 // at the end of decode (or when a new set of PictureBuffers is required). |
68 // | 71 // |
69 // TFPPictures are used for output, contents of VASurfaces passed from decoder | 72 // TFPPictures are used for output, contents of VASurfaces passed from decoder |
70 // are put into the associated pixmap memory and sent to client. | 73 // are put into the associated pixmap memory and sent to client. |
71 class VaapiVideoDecodeAccelerator::TFPPicture : public base::NonThreadSafe { | 74 class VaapiVideoDecodeAccelerator::TFPPicture : public base::NonThreadSafe { |
72 public: | 75 public: |
73 ~TFPPicture(); | 76 ~TFPPicture(); |
74 | 77 |
75 static linked_ptr<TFPPicture> Create( | 78 static linked_ptr<TFPPicture> Create( |
76 const base::Callback<bool(void)>& make_context_current, | 79 const base::Callback<bool(void)>& make_context_current, |
77 const GLXFBConfig& fb_config, | 80 int fd, |
78 Display* x_display, | 81 VaapiWrapper* va_wrapper, |
79 int32 picture_buffer_id, | 82 int32 picture_buffer_id, |
80 uint32 texture_id, | 83 uint32 texture_id, |
81 gfx::Size size); | 84 gfx::Size size); |
82 | 85 |
83 int32 picture_buffer_id() { | 86 int32 picture_buffer_id() { |
84 return picture_buffer_id_; | 87 return picture_buffer_id_; |
85 } | 88 } |
86 | 89 |
87 gfx::Size size() { | 90 gfx::Size size() { |
88 return size_; | 91 return size_; |
89 } | 92 } |
90 | 93 |
91 int x_pixmap() { | 94 // Upload vaimage data to texture. Needs to be called every frame. |
92 return x_pixmap_; | 95 bool Upload(VASurfaceID id); |
93 } | |
94 | |
95 // Bind texture to pixmap. Needs to be called every frame. | |
96 bool Bind(); | |
97 | 96 |
98 private: | 97 private: |
99 TFPPicture(const base::Callback<bool(void)>& make_context_current, | 98 TFPPicture(const base::Callback<bool(void)>& make_context_current, |
100 Display* x_display, | 99 int fd, |
100 VaapiWrapper* va_wrapper, | |
101 int32 picture_buffer_id, | 101 int32 picture_buffer_id, |
102 uint32 texture_id, | 102 uint32 texture_id, |
103 gfx::Size size); | 103 gfx::Size size); |
104 | 104 |
105 bool Initialize(const GLXFBConfig& fb_config); | 105 bool Initialize(); |
106 | 106 |
107 base::Callback<bool(void)> make_context_current_; | 107 base::Callback<bool(void)> make_context_current_; |
108 | 108 |
109 Display* x_display_; | 109 int fd_; |
110 VaapiWrapper* va_wrapper_; | |
110 | 111 |
111 // Output id for the client. | 112 // Output id for the client. |
112 int32 picture_buffer_id_; | 113 int32 picture_buffer_id_; |
113 uint32 texture_id_; | 114 uint32 texture_id_; |
114 | 115 |
115 gfx::Size size_; | 116 gfx::Size size_; |
116 | 117 VAImage va_image_; |
117 // Pixmaps bound to this texture. | |
118 Pixmap x_pixmap_; | |
119 GLXPixmap glx_pixmap_; | |
120 | 118 |
121 DISALLOW_COPY_AND_ASSIGN(TFPPicture); | 119 DISALLOW_COPY_AND_ASSIGN(TFPPicture); |
122 }; | 120 }; |
123 | 121 |
124 VaapiVideoDecodeAccelerator::TFPPicture::TFPPicture( | 122 VaapiVideoDecodeAccelerator::TFPPicture::TFPPicture( |
125 const base::Callback<bool(void)>& make_context_current, | 123 const base::Callback<bool(void)>& make_context_current, |
126 Display* x_display, | 124 int fd, |
125 VaapiWrapper* va_wrapper, | |
127 int32 picture_buffer_id, | 126 int32 picture_buffer_id, |
128 uint32 texture_id, | 127 uint32 texture_id, |
129 gfx::Size size) | 128 gfx::Size size) |
130 : make_context_current_(make_context_current), | 129 : make_context_current_(make_context_current), |
131 x_display_(x_display), | 130 fd_(fd), |
131 va_wrapper_(va_wrapper), | |
132 picture_buffer_id_(picture_buffer_id), | 132 picture_buffer_id_(picture_buffer_id), |
133 texture_id_(texture_id), | 133 texture_id_(texture_id), |
134 size_(size), | 134 size_(size) { |
135 x_pixmap_(0), | |
136 glx_pixmap_(0) { | |
137 DCHECK(!make_context_current_.is_null()); | 135 DCHECK(!make_context_current_.is_null()); |
138 }; | 136 }; |
139 | 137 |
140 linked_ptr<VaapiVideoDecodeAccelerator::TFPPicture> | 138 linked_ptr<VaapiVideoDecodeAccelerator::TFPPicture> |
141 VaapiVideoDecodeAccelerator::TFPPicture::Create( | 139 VaapiVideoDecodeAccelerator::TFPPicture::Create( |
142 const base::Callback<bool(void)>& make_context_current, | 140 const base::Callback<bool(void)>& make_context_current, |
143 const GLXFBConfig& fb_config, | 141 int fd, |
144 Display* x_display, | 142 VaapiWrapper* va_wrapper, |
145 int32 picture_buffer_id, | 143 int32 picture_buffer_id, |
146 uint32 texture_id, | 144 uint32 texture_id, |
147 gfx::Size size) { | 145 gfx::Size size) { |
148 | 146 |
149 linked_ptr<TFPPicture> tfp_picture( | 147 linked_ptr<TFPPicture> tfp_picture( |
150 new TFPPicture(make_context_current, x_display, picture_buffer_id, | 148 new TFPPicture(make_context_current, fd, va_wrapper, picture_buffer_id, |
151 texture_id, size)); | 149 texture_id, size)); |
152 | 150 |
153 if (!tfp_picture->Initialize(fb_config)) | 151 if (!tfp_picture->Initialize()) |
154 tfp_picture.reset(); | 152 tfp_picture.reset(); |
155 | 153 |
156 return tfp_picture; | 154 return tfp_picture; |
157 } | 155 } |
158 | 156 |
159 bool VaapiVideoDecodeAccelerator::TFPPicture::Initialize( | 157 bool VaapiVideoDecodeAccelerator::TFPPicture::Initialize() { |
160 const GLXFBConfig& fb_config) { | |
161 DCHECK(CalledOnValidThread()); | 158 DCHECK(CalledOnValidThread()); |
162 if (!make_context_current_.Run()) | 159 if (!make_context_current_.Run()) |
163 return false; | 160 return false; |
164 | 161 |
165 XWindowAttributes win_attr; | 162 if (!va_wrapper_->CreateRGBImage(size_, &va_image_)) { |
166 int screen = DefaultScreen(x_display_); | 163 DVLOG(1) << "Failed to create VAImage"; |
167 XGetWindowAttributes(x_display_, RootWindow(x_display_, screen), &win_attr); | |
168 //TODO(posciak): pass the depth required by libva, not the RootWindow's depth | |
169 x_pixmap_ = XCreatePixmap(x_display_, RootWindow(x_display_, screen), | |
170 size_.width(), size_.height(), win_attr.depth); | |
171 if (!x_pixmap_) { | |
172 DVLOG(1) << "Failed creating an X Pixmap for TFP"; | |
173 return false; | 164 return false; |
174 } | 165 } |
175 | |
176 static const int pixmap_attr[] = { | |
177 GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT, | |
178 GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGB_EXT, | |
179 GL_NONE, | |
180 }; | |
181 | |
182 glx_pixmap_ = glXCreatePixmap(x_display_, fb_config, x_pixmap_, pixmap_attr); | |
183 if (!glx_pixmap_) { | |
184 // x_pixmap_ will be freed in the destructor. | |
185 DVLOG(1) << "Failed creating a GLX Pixmap for TFP"; | |
186 return false; | |
187 } | |
188 | |
189 return true; | 166 return true; |
190 } | 167 } |
191 | 168 |
192 VaapiVideoDecodeAccelerator::TFPPicture::~TFPPicture() { | 169 VaapiVideoDecodeAccelerator::TFPPicture::~TFPPicture() { |
193 DCHECK(CalledOnValidThread()); | 170 DCHECK(CalledOnValidThread()); |
194 // Unbind surface from texture and deallocate resources. | 171 if (va_wrapper_) { |
scherkus (not reviewing)
2014/07/29 17:48:54
nit: a lot of this existing code seems to use no {
vignatti (out of this project)
2014/07/30 21:51:30
Done.
| |
195 if (glx_pixmap_ && make_context_current_.Run()) { | 172 va_wrapper_->DestroyImage(&va_image_); |
196 glXReleaseTexImageEXT(x_display_, glx_pixmap_, GLX_FRONT_LEFT_EXT); | |
197 glXDestroyPixmap(x_display_, glx_pixmap_); | |
198 } | 173 } |
199 | |
200 if (x_pixmap_) | |
201 XFreePixmap(x_display_, x_pixmap_); | |
202 XSync(x_display_, False); // Needed to work around buggy vdpau-driver. | |
203 } | 174 } |
204 | 175 |
205 bool VaapiVideoDecodeAccelerator::TFPPicture::Bind() { | 176 bool VaapiVideoDecodeAccelerator::TFPPicture::Upload(VASurfaceID surface) { |
206 DCHECK(CalledOnValidThread()); | 177 DCHECK(CalledOnValidThread()); |
207 DCHECK(x_pixmap_); | |
208 DCHECK(glx_pixmap_); | |
209 if (!make_context_current_.Run()) | 178 if (!make_context_current_.Run()) |
210 return false; | 179 return false; |
211 | 180 |
181 if (!va_wrapper_->PutSurfaceIntoImage(surface, &va_image_)) { | |
182 DVLOG(1) << "Failed to put va surface to image"; | |
183 return false; | |
184 } | |
185 | |
186 void* buffer = NULL; | |
187 if (!va_wrapper_->MapImage(&va_image_, &buffer)) { | |
188 DVLOG(1) << "Failed to map VAImage"; | |
189 return false; | |
190 } | |
191 | |
212 gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_2D, texture_id_); | 192 gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_2D, texture_id_); |
213 glXBindTexImageEXT(x_display_, glx_pixmap_, GLX_FRONT_LEFT_EXT, NULL); | 193 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
194 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | |
195 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size_.width(), size_.height(), | |
196 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer); | |
197 | |
198 va_wrapper_->UnmapImage(&va_image_); | |
214 | 199 |
215 return true; | 200 return true; |
216 } | 201 } |
217 | 202 |
218 VaapiVideoDecodeAccelerator::TFPPicture* | 203 VaapiVideoDecodeAccelerator::TFPPicture* |
219 VaapiVideoDecodeAccelerator::TFPPictureById(int32 picture_buffer_id) { | 204 VaapiVideoDecodeAccelerator::TFPPictureById(int32 picture_buffer_id) { |
220 TFPPictures::iterator it = tfp_pictures_.find(picture_buffer_id); | 205 TFPPictures::iterator it = tfp_pictures_.find(picture_buffer_id); |
221 if (it == tfp_pictures_.end()) { | 206 if (it == tfp_pictures_.end()) { |
222 DVLOG(1) << "Picture id " << picture_buffer_id << " does not exist"; | 207 DVLOG(1) << "Picture id " << picture_buffer_id << " does not exist"; |
223 return NULL; | 208 return NULL; |
224 } | 209 } |
225 | 210 |
226 return it->second.get(); | 211 return it->second.get(); |
227 } | 212 } |
228 | 213 |
229 VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator( | 214 VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator( |
230 Display* x_display, | |
231 const base::Callback<bool(void)>& make_context_current) | 215 const base::Callback<bool(void)>& make_context_current) |
232 : x_display_(x_display), | 216 : fd_(0), |
233 make_context_current_(make_context_current), | 217 make_context_current_(make_context_current), |
234 state_(kUninitialized), | 218 state_(kUninitialized), |
235 input_ready_(&lock_), | 219 input_ready_(&lock_), |
236 surfaces_available_(&lock_), | 220 surfaces_available_(&lock_), |
237 message_loop_(base::MessageLoop::current()), | 221 message_loop_(base::MessageLoop::current()), |
238 decoder_thread_("VaapiDecoderThread"), | 222 decoder_thread_("VaapiDecoderThread"), |
239 num_frames_at_client_(0), | 223 num_frames_at_client_(0), |
240 num_stream_bufs_at_decoder_(0), | 224 num_stream_bufs_at_decoder_(0), |
241 finish_flush_pending_(false), | 225 finish_flush_pending_(false), |
242 awaiting_va_surfaces_recycle_(false), | 226 awaiting_va_surfaces_recycle_(false), |
243 requested_num_pics_(0), | 227 requested_num_pics_(0), |
244 weak_this_factory_(this) { | 228 weak_this_factory_(this) { |
245 weak_this_ = weak_this_factory_.GetWeakPtr(); | 229 weak_this_ = weak_this_factory_.GetWeakPtr(); |
246 va_surface_release_cb_ = media::BindToCurrentLoop( | 230 va_surface_release_cb_ = media::BindToCurrentLoop( |
247 base::Bind(&VaapiVideoDecodeAccelerator::RecycleVASurfaceID, weak_this_)); | 231 base::Bind(&VaapiVideoDecodeAccelerator::RecycleVASurfaceID, weak_this_)); |
248 } | 232 } |
249 | 233 |
250 VaapiVideoDecodeAccelerator::~VaapiVideoDecodeAccelerator() { | 234 VaapiVideoDecodeAccelerator::~VaapiVideoDecodeAccelerator() { |
251 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 235 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
252 } | 236 fd_ = 0; |
scherkus (not reviewing)
2014/07/29 17:48:54
is this really necessary? if we're protecting agai
vignatti (out of this project)
2014/07/30 21:51:30
fd_ was initialized in the constructor and for saf
| |
253 | |
254 class XFreeDeleter { | |
255 public: | |
256 void operator()(void* x) const { | |
257 ::XFree(x); | |
258 } | |
259 }; | |
260 | |
261 bool VaapiVideoDecodeAccelerator::InitializeFBConfig() { | |
262 const int fbconfig_attr[] = { | |
263 GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT, | |
264 GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT, | |
265 GLX_BIND_TO_TEXTURE_RGB_EXT, GL_TRUE, | |
266 GLX_Y_INVERTED_EXT, GL_TRUE, | |
267 GL_NONE, | |
268 }; | |
269 | |
270 int num_fbconfigs; | |
271 scoped_ptr<GLXFBConfig, XFreeDeleter> glx_fb_configs( | |
272 glXChooseFBConfig(x_display_, DefaultScreen(x_display_), fbconfig_attr, | |
273 &num_fbconfigs)); | |
274 if (!glx_fb_configs) | |
275 return false; | |
276 if (!num_fbconfigs) | |
277 return false; | |
278 | |
279 fb_config_ = glx_fb_configs.get()[0]; | |
280 return true; | |
281 } | 237 } |
282 | 238 |
283 bool VaapiVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile, | 239 bool VaapiVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile, |
284 Client* client) { | 240 Client* client) { |
285 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 241 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
286 | 242 |
287 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); | 243 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); |
288 client_ = client_ptr_factory_->GetWeakPtr(); | 244 client_ = client_ptr_factory_->GetWeakPtr(); |
289 | 245 |
290 base::AutoLock auto_lock(lock_); | 246 base::AutoLock auto_lock(lock_); |
291 DCHECK_EQ(state_, kUninitialized); | 247 DCHECK_EQ(state_, kUninitialized); |
292 DVLOG(2) << "Initializing VAVDA, profile: " << profile; | 248 DVLOG(2) << "Initializing VAVDA, profile: " << profile; |
293 | 249 |
294 if (!make_context_current_.Run()) | 250 if (!make_context_current_.Run()) |
295 return false; | 251 return false; |
296 | 252 |
297 if (!InitializeFBConfig()) { | 253 gbm_device* device = NULL; |
298 DVLOG(1) << "Could not get a usable FBConfig"; | 254 device = reinterpret_cast<gbm_device*>( |
255 gfx::GetPlatformDefaultEGLNativeDisplay()); | |
256 fd_ = gbm_device_get_fd(device); | |
257 if (!fd_) { | |
258 DVLOG(1) << "Could not get a usable DRM device"; | |
299 return false; | 259 return false; |
300 } | 260 } |
301 | 261 |
302 vaapi_wrapper_ = VaapiWrapper::Create( | 262 vaapi_wrapper_ = VaapiWrapper::Create( |
303 VaapiWrapper::kDecode, | 263 VaapiWrapper::kDecode, |
304 profile, | 264 profile, |
305 x_display_, | 265 fd_, |
306 base::Bind(&ReportToUMA, content::VaapiH264Decoder::VAAPI_ERROR)); | 266 base::Bind(&ReportToUMA, content::VaapiH264Decoder::VAAPI_ERROR)); |
307 | 267 |
308 if (!vaapi_wrapper_.get()) { | 268 if (!vaapi_wrapper_.get()) { |
309 DVLOG(1) << "Failed initializing VAAPI"; | 269 DVLOG(1) << "Failed initializing VAAPI"; |
310 return false; | 270 return false; |
311 } | 271 } |
312 | 272 |
313 decoder_.reset( | 273 decoder_.reset( |
314 new VaapiH264Decoder( | 274 new VaapiH264Decoder( |
315 vaapi_wrapper_.get(), | 275 vaapi_wrapper_.get(), |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
349 | 309 |
350 int32 output_id = tfp_picture->picture_buffer_id(); | 310 int32 output_id = tfp_picture->picture_buffer_id(); |
351 | 311 |
352 TRACE_EVENT2("Video Decoder", "VAVDA::OutputSurface", | 312 TRACE_EVENT2("Video Decoder", "VAVDA::OutputSurface", |
353 "input_id", input_id, | 313 "input_id", input_id, |
354 "output_id", output_id); | 314 "output_id", output_id); |
355 | 315 |
356 DVLOG(3) << "Outputting VASurface " << va_surface->id() | 316 DVLOG(3) << "Outputting VASurface " << va_surface->id() |
357 << " into pixmap bound to picture buffer id " << output_id; | 317 << " into pixmap bound to picture buffer id " << output_id; |
358 | 318 |
359 RETURN_AND_NOTIFY_ON_FAILURE(tfp_picture->Bind(), | |
360 "Failed binding texture to pixmap", | |
361 PLATFORM_FAILURE, ); | |
362 | |
363 RETURN_AND_NOTIFY_ON_FAILURE( | 319 RETURN_AND_NOTIFY_ON_FAILURE( |
364 vaapi_wrapper_->PutSurfaceIntoPixmap(va_surface->id(), | 320 tfp_picture->Upload(va_surface->id()), |
365 tfp_picture->x_pixmap(), | |
366 tfp_picture->size()), | |
367 "Failed putting surface into pixmap", PLATFORM_FAILURE, ); | 321 "Failed putting surface into pixmap", PLATFORM_FAILURE, ); |
368 | 322 |
369 // Notify the client a picture is ready to be displayed. | 323 // Notify the client a picture is ready to be displayed. |
370 ++num_frames_at_client_; | 324 ++num_frames_at_client_; |
371 TRACE_COUNTER1("Video Decoder", "Textures at client", num_frames_at_client_); | 325 TRACE_COUNTER1("Video Decoder", "Textures at client", num_frames_at_client_); |
372 DVLOG(4) << "Notifying output picture id " << output_id | 326 DVLOG(4) << "Notifying output picture id " << output_id |
373 << " for input "<< input_id << " is ready"; | 327 << " for input "<< input_id << " is ready"; |
374 if (client_) | 328 if (client_) |
375 client_->PictureReady(media::Picture(output_id, input_id)); | 329 client_->PictureReady(media::Picture(output_id, input_id)); |
376 } | 330 } |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
697 &va_surface_ids), | 651 &va_surface_ids), |
698 "Failed creating VA Surfaces", PLATFORM_FAILURE, ); | 652 "Failed creating VA Surfaces", PLATFORM_FAILURE, ); |
699 DCHECK_EQ(va_surface_ids.size(), buffers.size()); | 653 DCHECK_EQ(va_surface_ids.size(), buffers.size()); |
700 | 654 |
701 for (size_t i = 0; i < buffers.size(); ++i) { | 655 for (size_t i = 0; i < buffers.size(); ++i) { |
702 DVLOG(2) << "Assigning picture id: " << buffers[i].id() | 656 DVLOG(2) << "Assigning picture id: " << buffers[i].id() |
703 << " to texture id: " << buffers[i].texture_id() | 657 << " to texture id: " << buffers[i].texture_id() |
704 << " VASurfaceID: " << va_surface_ids[i]; | 658 << " VASurfaceID: " << va_surface_ids[i]; |
705 | 659 |
706 linked_ptr<TFPPicture> tfp_picture( | 660 linked_ptr<TFPPicture> tfp_picture( |
707 TFPPicture::Create(make_context_current_, fb_config_, x_display_, | 661 TFPPicture::Create(make_context_current_, fd_, vaapi_wrapper_.get(), |
708 buffers[i].id(), buffers[i].texture_id(), | 662 buffers[i].id(), buffers[i].texture_id(), |
709 requested_pic_size_)); | 663 requested_pic_size_)); |
710 | 664 |
711 RETURN_AND_NOTIFY_ON_FAILURE( | 665 RETURN_AND_NOTIFY_ON_FAILURE( |
712 tfp_picture.get(), "Failed assigning picture buffer to a texture.", | 666 tfp_picture.get(), "Failed assigning picture buffer to a texture.", |
713 PLATFORM_FAILURE, ); | 667 PLATFORM_FAILURE, ); |
714 | 668 |
715 bool inserted = tfp_pictures_.insert(std::make_pair( | 669 bool inserted = tfp_pictures_.insert(std::make_pair( |
716 buffers[i].id(), tfp_picture)).second; | 670 buffers[i].id(), tfp_picture)).second; |
717 DCHECK(inserted); | 671 DCHECK(inserted); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
914 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 868 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
915 Cleanup(); | 869 Cleanup(); |
916 delete this; | 870 delete this; |
917 } | 871 } |
918 | 872 |
919 bool VaapiVideoDecodeAccelerator::CanDecodeOnIOThread() { | 873 bool VaapiVideoDecodeAccelerator::CanDecodeOnIOThread() { |
920 return false; | 874 return false; |
921 } | 875 } |
922 | 876 |
923 } // namespace content | 877 } // namespace content |
OLD | NEW |