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

Side by Side Diff: content/common/gpu/media/vaapi_video_decode_accelerator.cc

Issue 43283002: Enable GLX/EGL backend switching while run HW video decode with libva. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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 (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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/debug/trace_event.h" 6 #include "base/debug/trace_event.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // at the end of decode (or when a new set of PictureBuffers is required). 67 // at the end of decode (or when a new set of PictureBuffers is required).
68 // 68 //
69 // TFPPictures are used for output, contents of VASurfaces passed from decoder 69 // TFPPictures are used for output, contents of VASurfaces passed from decoder
70 // are put into the associated pixmap memory and sent to client. 70 // are put into the associated pixmap memory and sent to client.
71 class VaapiVideoDecodeAccelerator::TFPPicture { 71 class VaapiVideoDecodeAccelerator::TFPPicture {
72 public: 72 public:
73 ~TFPPicture(); 73 ~TFPPicture();
74 74
75 static linked_ptr<TFPPicture> Create( 75 static linked_ptr<TFPPicture> Create(
76 const base::Callback<bool(void)>& make_context_current, 76 const base::Callback<bool(void)>& make_context_current,
77 #if defined(VIDEO_TEXTURE_GLX_BACKEND)
77 const GLXFBConfig& fb_config, 78 const GLXFBConfig& fb_config,
79 #elif defined(VIDEO_TEXTURE_EGL_BACKEND)
80 EGLDisplay egl_display,
81 #endif
78 Display* x_display, 82 Display* x_display,
79 int32 picture_buffer_id, 83 int32 picture_buffer_id,
80 uint32 texture_id, 84 uint32 texture_id,
81 gfx::Size size); 85 gfx::Size size);
82 86
83 int32 picture_buffer_id() { 87 int32 picture_buffer_id() {
84 return picture_buffer_id_; 88 return picture_buffer_id_;
85 } 89 }
86 90
87 uint32 texture_id() { 91 uint32 texture_id() {
(...skipping 10 matching lines...) Expand all
98 102
99 // Bind texture to pixmap. Needs to be called every frame. 103 // Bind texture to pixmap. Needs to be called every frame.
100 bool Bind(); 104 bool Bind();
101 105
102 private: 106 private:
103 TFPPicture(const base::Callback<bool(void)>& make_context_current, 107 TFPPicture(const base::Callback<bool(void)>& make_context_current,
104 Display* x_display, 108 Display* x_display,
105 int32 picture_buffer_id, 109 int32 picture_buffer_id,
106 uint32 texture_id, 110 uint32 texture_id,
107 gfx::Size size); 111 gfx::Size size);
108 112 #if defined(VIDEO_TEXTURE_GLX_BACKEND)
109 bool Initialize(const GLXFBConfig& fb_config); 113 bool Initialize(const GLXFBConfig& fb_config);
114 #elif defined(VIDEO_TEXTURE_EGL_BACKEND)
115 bool Initialize(EGLDisplay egl_display);
116 #endif
110 117
111 base::Callback<bool(void)> make_context_current_; 118 base::Callback<bool(void)> make_context_current_;
112 119
113 Display* x_display_; 120 Display* x_display_;
114 121
115 // Output id for the client. 122 // Output id for the client.
116 int32 picture_buffer_id_; 123 int32 picture_buffer_id_;
117 uint32 texture_id_; 124 uint32 texture_id_;
118 125
119 gfx::Size size_; 126 gfx::Size size_;
120 127
121 // Pixmaps bound to this texture. 128 // Pixmaps bound to this texture.
122 Pixmap x_pixmap_; 129 Pixmap x_pixmap_;
130 #if defined(VIDEO_TEXTURE_GLX_BACKEND)
123 GLXPixmap glx_pixmap_; 131 GLXPixmap glx_pixmap_;
124 132 #elif defined(VIDEO_TEXTURE_EGL_BACKEND)
133 EGLDisplay egl_display_;
134 EGLImageKHR egl_image_;
135 #endif
125 DISALLOW_COPY_AND_ASSIGN(TFPPicture); 136 DISALLOW_COPY_AND_ASSIGN(TFPPicture);
126 }; 137 };
127 138
128 VaapiVideoDecodeAccelerator::TFPPicture::TFPPicture( 139 VaapiVideoDecodeAccelerator::TFPPicture::TFPPicture(
129 const base::Callback<bool(void)>& make_context_current, 140 const base::Callback<bool(void)>& make_context_current,
130 Display* x_display, 141 Display* x_display,
131 int32 picture_buffer_id, 142 int32 picture_buffer_id,
132 uint32 texture_id, 143 uint32 texture_id,
133 gfx::Size size) 144 gfx::Size size)
134 : make_context_current_(make_context_current), 145 : make_context_current_(make_context_current),
135 x_display_(x_display), 146 x_display_(x_display),
136 picture_buffer_id_(picture_buffer_id), 147 picture_buffer_id_(picture_buffer_id),
137 texture_id_(texture_id), 148 texture_id_(texture_id),
138 size_(size), 149 size_(size),
139 x_pixmap_(0), 150 x_pixmap_(0),
140 glx_pixmap_(0) { 151 #if defined(VIDEO_TEXTURE_GLX_BACKEND)
152 glx_pixmap_(0)
153 #elif defined(VIDEO_TEXTURE_EGL_BACKEND)
154 egl_display_(0),
155 egl_image_(0)
156 #endif
157 {
141 DCHECK(!make_context_current_.is_null()); 158 DCHECK(!make_context_current_.is_null());
142 }; 159 };
143 160
144 linked_ptr<VaapiVideoDecodeAccelerator::TFPPicture> 161 linked_ptr<VaapiVideoDecodeAccelerator::TFPPicture>
145 VaapiVideoDecodeAccelerator::TFPPicture::Create( 162 VaapiVideoDecodeAccelerator::TFPPicture::Create(
146 const base::Callback<bool(void)>& make_context_current, 163 const base::Callback<bool(void)>& make_context_current,
164 #if defined(VIDEO_TEXTURE_GLX_BACKEND)
147 const GLXFBConfig& fb_config, 165 const GLXFBConfig& fb_config,
166 #elif defined(VIDEO_TEXTURE_EGL_BACKEND)
167 EGLDisplay egl_display,
168 #endif
148 Display* x_display, 169 Display* x_display,
149 int32 picture_buffer_id, 170 int32 picture_buffer_id,
150 uint32 texture_id, 171 uint32 texture_id,
151 gfx::Size size) { 172 gfx::Size size) {
152 173
153 linked_ptr<TFPPicture> tfp_picture( 174 linked_ptr<TFPPicture> tfp_picture(
154 new TFPPicture(make_context_current, x_display, picture_buffer_id, 175 new TFPPicture(make_context_current, x_display, picture_buffer_id,
155 texture_id, size)); 176 texture_id, size));
156 177
178 #if defined(VIDEO_TEXTURE_GLX_BACKEND)
157 if (!tfp_picture->Initialize(fb_config)) 179 if (!tfp_picture->Initialize(fb_config))
180 #elif defined(VIDEO_TEXTURE_EGL_BACKEND)
181 if (!tfp_picture->Initialize(egl_display))
182 #endif
158 tfp_picture.reset(); 183 tfp_picture.reset();
159 184
160 return tfp_picture; 185 return tfp_picture;
161 } 186 }
162 187
163 bool VaapiVideoDecodeAccelerator::TFPPicture::Initialize( 188 bool VaapiVideoDecodeAccelerator::TFPPicture::Initialize(
189 #if defined(VIDEO_TEXTURE_GLX_BACKEND)
164 const GLXFBConfig& fb_config) { 190 const GLXFBConfig& fb_config) {
191 #elif defined(VIDEO_TEXTURE_EGL_BACKEND)
192 EGLDisplay egl_display) {
193 #endif
165 // Check for NULL prevents unittests from crashing on nonexistent ChildThread. 194 // Check for NULL prevents unittests from crashing on nonexistent ChildThread.
166 DCHECK(ChildThread::current() == NULL || 195 DCHECK(ChildThread::current() == NULL ||
167 ChildThread::current()->message_loop() == base::MessageLoop::current()); 196 ChildThread::current()->message_loop() == base::MessageLoop::current());
168 197
169 if (!make_context_current_.Run()) 198 if (!make_context_current_.Run())
170 return false; 199 return false;
171 200
172 XWindowAttributes win_attr; 201 XWindowAttributes win_attr;
173 int screen = DefaultScreen(x_display_); 202 int screen = DefaultScreen(x_display_);
174 XGetWindowAttributes(x_display_, RootWindow(x_display_, screen), &win_attr); 203 XGetWindowAttributes(x_display_, RootWindow(x_display_, screen), &win_attr);
175 //TODO(posciak): pass the depth required by libva, not the RootWindow's depth 204 //TODO(posciak): pass the depth required by libva, not the RootWindow's depth
176 x_pixmap_ = XCreatePixmap(x_display_, RootWindow(x_display_, screen), 205 x_pixmap_ = XCreatePixmap(x_display_, RootWindow(x_display_, screen),
177 size_.width(), size_.height(), win_attr.depth); 206 size_.width(), size_.height(), win_attr.depth);
178 if (!x_pixmap_) { 207 if (!x_pixmap_) {
179 DVLOG(1) << "Failed creating an X Pixmap for TFP"; 208 DVLOG(1) << "Failed creating an X Pixmap for TFP";
180 return false; 209 return false;
181 } 210 }
182 211 #if defined(VIDEO_TEXTURE_GLX_BACKEND)
183 static const int pixmap_attr[] = { 212 static const int pixmap_attr[] = {
184 GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT, 213 GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT,
185 GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGB_EXT, 214 GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGB_EXT,
186 GL_NONE, 215 GL_NONE,
187 }; 216 };
188 217
189 glx_pixmap_ = glXCreatePixmap(x_display_, fb_config, x_pixmap_, pixmap_attr); 218 glx_pixmap_ = glXCreatePixmap(x_display_, fb_config, x_pixmap_, pixmap_attr);
190 if (!glx_pixmap_) { 219 if (!glx_pixmap_) {
191 // x_pixmap_ will be freed in the destructor. 220 // x_pixmap_ will be freed in the destructor.
192 DVLOG(1) << "Failed creating a GLX Pixmap for TFP"; 221 DVLOG(1) << "Failed creating a GLX Pixmap for TFP";
193 return false; 222 return false;
194 } 223 }
224 #elif defined(VIDEO_TEXTURE_EGL_BACKEND)
225 egl_display_ = egl_display;
226 EGLint image_attrs[] = { EGL_IMAGE_PRESERVED_KHR, 1 , EGL_NONE };
227
228 egl_image_ = eglCreateImageKHR(egl_display_,
229 EGL_NO_CONTEXT,
230 EGL_NATIVE_PIXMAP_KHR,
231 (EGLClientBuffer)x_pixmap_,
232 image_attrs);
233 if (!egl_image_) {
234 DVLOG(1) << "Failed creating a EGLImage from Pixmap for KHR";
235 return false;
236 }
237 #endif
195 238
196 return true; 239 return true;
197 } 240 }
198 241
199 VaapiVideoDecodeAccelerator::TFPPicture::~TFPPicture() { 242 VaapiVideoDecodeAccelerator::TFPPicture::~TFPPicture() {
200 // Check for NULL prevents unittests from crashing on nonexistent ChildThread. 243 // Check for NULL prevents unittests from crashing on nonexistent ChildThread.
201 DCHECK(ChildThread::current() == NULL || 244 DCHECK(ChildThread::current() == NULL ||
202 ChildThread::current()->message_loop() == base::MessageLoop::current()); 245 ChildThread::current()->message_loop() == base::MessageLoop::current());
203 246
204 // Unbind surface from texture and deallocate resources. 247 // Unbind surface from texture and deallocate resources.
248 #if defined(VIDEO_TEXTURE_GLX_BACKEND)
205 if (glx_pixmap_ && make_context_current_.Run()) { 249 if (glx_pixmap_ && make_context_current_.Run()) {
206 glXReleaseTexImageEXT(x_display_, glx_pixmap_, GLX_FRONT_LEFT_EXT); 250 glXReleaseTexImageEXT(x_display_, glx_pixmap_, GLX_FRONT_LEFT_EXT);
207 glXDestroyPixmap(x_display_, glx_pixmap_); 251 glXDestroyPixmap(x_display_, glx_pixmap_);
208 } 252 }
253 #elif defined(VIDEO_TEXTURE_EGL_BACKEND)
254 if (egl_image_ && make_context_current_.Run()) {
255 eglDestroyImageKHR(egl_display_, egl_image_);
256 }
257 #endif
209 258
210 if (x_pixmap_) 259 if (x_pixmap_)
211 XFreePixmap(x_display_, x_pixmap_); 260 XFreePixmap(x_display_, x_pixmap_);
212 XSync(x_display_, False); // Needed to work around buggy vdpau-driver. 261 XSync(x_display_, False); // Needed to work around buggy vdpau-driver.
213 } 262 }
214 263
215 bool VaapiVideoDecodeAccelerator::TFPPicture::Bind() { 264 bool VaapiVideoDecodeAccelerator::TFPPicture::Bind() {
216 DCHECK(x_pixmap_); 265 DCHECK(x_pixmap_);
266 #if defined(VIDEO_TEXTURE_GLX_BACKEND)
217 DCHECK(glx_pixmap_); 267 DCHECK(glx_pixmap_);
268 #elif defined(VIDEO_TEXTURE_EGL_BACKEND)
269 DCHECK(egl_image_);
270 #endif
218 // Check for NULL prevents unittests from crashing on nonexistent ChildThread. 271 // Check for NULL prevents unittests from crashing on nonexistent ChildThread.
219 DCHECK(ChildThread::current() == NULL || 272 DCHECK(ChildThread::current() == NULL ||
220 ChildThread::current()->message_loop() == base::MessageLoop::current()); 273 ChildThread::current()->message_loop() == base::MessageLoop::current());
221 274
222 if (!make_context_current_.Run()) 275 if (!make_context_current_.Run())
223 return false; 276 return false;
224 277
225 gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_2D, texture_id_); 278 gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_2D, texture_id_);
279 #if defined(VIDEO_TEXTURE_GLX_BACKEND)
226 glXBindTexImageEXT(x_display_, glx_pixmap_, GLX_FRONT_LEFT_EXT, NULL); 280 glXBindTexImageEXT(x_display_, glx_pixmap_, GLX_FRONT_LEFT_EXT, NULL);
227 281 #elif defined(VIDEO_TEXTURE_EGL_BACKEND)
282 glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, egl_image_);
283 #endif
228 return true; 284 return true;
229 } 285 }
230 286
231 VaapiVideoDecodeAccelerator::TFPPicture* 287 VaapiVideoDecodeAccelerator::TFPPicture*
232 VaapiVideoDecodeAccelerator::TFPPictureById(int32 picture_buffer_id) { 288 VaapiVideoDecodeAccelerator::TFPPictureById(int32 picture_buffer_id) {
233 TFPPictures::iterator it = tfp_pictures_.find(picture_buffer_id); 289 TFPPictures::iterator it = tfp_pictures_.find(picture_buffer_id);
234 if (it == tfp_pictures_.end()) { 290 if (it == tfp_pictures_.end()) {
235 DVLOG(1) << "Picture id " << picture_buffer_id << " does not exist"; 291 DVLOG(1) << "Picture id " << picture_buffer_id << " does not exist";
236 return NULL; 292 return NULL;
237 } 293 }
238 294
239 return it->second.get(); 295 return it->second.get();
240 } 296 }
241 297
242 VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator( 298 VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator(
299 #if defined(VIDEO_TEXTURE_GLX_BACKEND)
243 Display* x_display, GLXContext glx_context, 300 Display* x_display, GLXContext glx_context,
301 #elif defined(VIDEO_TEXTURE_EGL_BACKEND)
302 EGLDisplay egl_display, EGLContext egl_context,
303 #endif
244 Client* client, 304 Client* client,
245 const base::Callback<bool(void)>& make_context_current) 305 const base::Callback<bool(void)>& make_context_current)
306 #if defined(VIDEO_TEXTURE_GLX_BACKEND)
246 : x_display_(x_display), 307 : x_display_(x_display),
247 glx_context_(glx_context), 308 glx_context_(glx_context),
309 #elif defined(VIDEO_TEXTURE_EGL_BACKEND)
310 : x_display_(0),
311 egl_display_(egl_display),
312 egl_context_(egl_context),
313 #endif
248 make_context_current_(make_context_current), 314 make_context_current_(make_context_current),
249 state_(kUninitialized), 315 state_(kUninitialized),
250 input_ready_(&lock_), 316 input_ready_(&lock_),
251 surfaces_available_(&lock_), 317 surfaces_available_(&lock_),
252 message_loop_(base::MessageLoop::current()), 318 message_loop_(base::MessageLoop::current()),
253 weak_this_(base::AsWeakPtr(this)), 319 weak_this_(base::AsWeakPtr(this)),
254 client_ptr_factory_(client), 320 client_ptr_factory_(client),
255 client_(client_ptr_factory_.GetWeakPtr()), 321 client_(client_ptr_factory_.GetWeakPtr()),
256 decoder_thread_("VaapiDecoderThread"), 322 decoder_thread_("VaapiDecoderThread"),
257 num_frames_at_client_(0), 323 num_frames_at_client_(0),
258 num_stream_bufs_at_decoder_(0), 324 num_stream_bufs_at_decoder_(0),
259 finish_flush_pending_(false), 325 finish_flush_pending_(false),
260 awaiting_va_surfaces_recycle_(false), 326 awaiting_va_surfaces_recycle_(false),
261 requested_num_pics_(0) { 327 requested_num_pics_(0) {
262 DCHECK(client); 328 DCHECK(client);
263 } 329 }
264 330
265 VaapiVideoDecodeAccelerator::~VaapiVideoDecodeAccelerator() { 331 VaapiVideoDecodeAccelerator::~VaapiVideoDecodeAccelerator() {
266 DCHECK_EQ(message_loop_, base::MessageLoop::current()); 332 DCHECK_EQ(message_loop_, base::MessageLoop::current());
267 } 333 }
268 334
269 class ScopedPtrXFree { 335 class ScopedPtrXFree {
270 public: 336 public:
271 void operator()(void* x) const { 337 void operator()(void* x) const {
272 ::XFree(x); 338 ::XFree(x);
273 } 339 }
274 }; 340 };
275 341 #if defined(VIDEO_TEXTURE_GLX_BACKEND)
276 bool VaapiVideoDecodeAccelerator::InitializeFBConfig() { 342 bool VaapiVideoDecodeAccelerator::InitializeFBConfig() {
277 const int fbconfig_attr[] = { 343 const int fbconfig_attr[] = {
278 GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT, 344 GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT,
279 GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT, 345 GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT,
280 GLX_BIND_TO_TEXTURE_RGB_EXT, GL_TRUE, 346 GLX_BIND_TO_TEXTURE_RGB_EXT, GL_TRUE,
281 GLX_Y_INVERTED_EXT, GL_TRUE, 347 GLX_Y_INVERTED_EXT, GL_TRUE,
282 GL_NONE, 348 GL_NONE,
283 }; 349 };
284 350
285 int num_fbconfigs; 351 int num_fbconfigs;
286 scoped_ptr_malloc<GLXFBConfig, ScopedPtrXFree> glx_fb_configs( 352 scoped_ptr_malloc<GLXFBConfig, ScopedPtrXFree> glx_fb_configs(
287 glXChooseFBConfig(x_display_, DefaultScreen(x_display_), fbconfig_attr, 353 glXChooseFBConfig(x_display_, DefaultScreen(x_display_), fbconfig_attr,
288 &num_fbconfigs)); 354 &num_fbconfigs));
289 if (!glx_fb_configs) 355 if (!glx_fb_configs)
290 return false; 356 return false;
291 if (!num_fbconfigs) 357 if (!num_fbconfigs)
292 return false; 358 return false;
293 359
294 fb_config_ = glx_fb_configs.get()[0]; 360 fb_config_ = glx_fb_configs.get()[0];
295 return true; 361 return true;
296 } 362 }
297 363 #endif
298 bool VaapiVideoDecodeAccelerator::Initialize( 364 bool VaapiVideoDecodeAccelerator::Initialize(
299 media::VideoCodecProfile profile) { 365 media::VideoCodecProfile profile) {
300 DCHECK_EQ(message_loop_, base::MessageLoop::current()); 366 DCHECK_EQ(message_loop_, base::MessageLoop::current());
301 367
302 base::AutoLock auto_lock(lock_); 368 base::AutoLock auto_lock(lock_);
303 DCHECK_EQ(state_, kUninitialized); 369 DCHECK_EQ(state_, kUninitialized);
304 DVLOG(2) << "Initializing VAVDA, profile: " << profile; 370 DVLOG(2) << "Initializing VAVDA, profile: " << profile;
305 371
306 if (!make_context_current_.Run()) 372 if (!make_context_current_.Run())
307 return false; 373 return false;
308 374
375 #if defined(VIDEO_TEXTURE_GLX_BACKEND)
309 if (!InitializeFBConfig()) { 376 if (!InitializeFBConfig()) {
310 DVLOG(1) << "Could not get a usable FBConfig"; 377 DVLOG(1) << "Could not get a usable FBConfig";
311 return false; 378 return false;
312 } 379 }
380 #elif defined(VIDEO_TEXTURE_EGL_BACKEND)
381 x_display_ = base::MessagePumpForUI::GetDefaultXDisplay();
382 #endif
313 383
314 vaapi_wrapper_ = VaapiWrapper::Create( 384 vaapi_wrapper_ = VaapiWrapper::Create(
315 profile, x_display_, 385 profile, x_display_,
316 base::Bind(&ReportToUMA, content::VaapiH264Decoder::VAAPI_ERROR)); 386 base::Bind(&ReportToUMA, content::VaapiH264Decoder::VAAPI_ERROR));
317 387
318 if (!vaapi_wrapper_.get()) { 388 if (!vaapi_wrapper_.get()) {
319 DVLOG(1) << "Failed initializing VAAPI"; 389 DVLOG(1) << "Failed initializing VAAPI";
320 return false; 390 return false;
321 } 391 }
322 392
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 &va_surface_ids), 781 &va_surface_ids),
712 "Failed creating VA Surfaces", PLATFORM_FAILURE, ); 782 "Failed creating VA Surfaces", PLATFORM_FAILURE, );
713 DCHECK_EQ(va_surface_ids.size(), buffers.size()); 783 DCHECK_EQ(va_surface_ids.size(), buffers.size());
714 784
715 for (size_t i = 0; i < buffers.size(); ++i) { 785 for (size_t i = 0; i < buffers.size(); ++i) {
716 DVLOG(2) << "Assigning picture id: " << buffers[i].id() 786 DVLOG(2) << "Assigning picture id: " << buffers[i].id()
717 << " to texture id: " << buffers[i].texture_id() 787 << " to texture id: " << buffers[i].texture_id()
718 << " VASurfaceID: " << va_surface_ids[i]; 788 << " VASurfaceID: " << va_surface_ids[i];
719 789
720 linked_ptr<TFPPicture> tfp_picture( 790 linked_ptr<TFPPicture> tfp_picture(
791 #if defined(VIDEO_TEXTURE_GLX_BACKEND)
721 TFPPicture::Create(make_context_current_, fb_config_, x_display_, 792 TFPPicture::Create(make_context_current_, fb_config_, x_display_,
793 #elif defined(VIDEO_TEXTURE_EGL_BACKEND)
794 TFPPicture::Create(make_context_current_, egl_display_, x_display_,
795 #endif
722 buffers[i].id(), buffers[i].texture_id(), 796 buffers[i].id(), buffers[i].texture_id(),
723 requested_pic_size_)); 797 requested_pic_size_));
724 798
725 RETURN_AND_NOTIFY_ON_FAILURE( 799 RETURN_AND_NOTIFY_ON_FAILURE(
726 tfp_picture.get(), "Failed assigning picture buffer to a texture.", 800 tfp_picture.get(), "Failed assigning picture buffer to a texture.",
727 PLATFORM_FAILURE, ); 801 PLATFORM_FAILURE, );
728 802
729 bool inserted = tfp_pictures_.insert(std::make_pair( 803 bool inserted = tfp_pictures_.insert(std::make_pair(
730 buffers[i].id(), tfp_picture)).second; 804 buffers[i].id(), tfp_picture)).second;
731 DCHECK(inserted); 805 DCHECK(inserted);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 state_ = kUninitialized; 999 state_ = kUninitialized;
926 } 1000 }
927 1001
928 void VaapiVideoDecodeAccelerator::Destroy() { 1002 void VaapiVideoDecodeAccelerator::Destroy() {
929 DCHECK_EQ(message_loop_, base::MessageLoop::current()); 1003 DCHECK_EQ(message_loop_, base::MessageLoop::current());
930 Cleanup(); 1004 Cleanup();
931 delete this; 1005 delete this;
932 } 1006 }
933 1007
934 } // namespace content 1008 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698