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

Side by Side Diff: content/common/gpu/media/gpu_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: Refined based on Fischman's comments. 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 "content/common/gpu/media/gpu_video_decode_accelerator.h" 5 #include "content/common/gpu/media/gpu_video_decode_accelerator.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 this, make_context_current_)); 271 this, make_context_current_));
272 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) 272 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11)
273 video_decode_accelerator_.reset(new ExynosVideoDecodeAccelerator( 273 video_decode_accelerator_.reset(new ExynosVideoDecodeAccelerator(
274 gfx::GLSurfaceEGL::GetHardwareDisplay(), 274 gfx::GLSurfaceEGL::GetHardwareDisplay(),
275 stub_->decoder()->GetGLContext()->GetHandle(), 275 stub_->decoder()->GetGLContext()->GetHandle(),
276 this, 276 this,
277 weak_factory_for_io_.GetWeakPtr(), 277 weak_factory_for_io_.GetWeakPtr(),
278 make_context_current_, 278 make_context_current_,
279 io_message_loop_)); 279 io_message_loop_));
280 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) 280 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11)
281 #if defined(VAVDA_VATEXTURE_EGL_BACKEND)
282 video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator(
283 gfx::GLSurfaceEGL::GetHardwareDisplay(),
284 stub_->decoder()->GetGLContext()->GetHandle(),
285 this,
286 make_context_current_));
287 #else
281 gfx::GLContextGLX* glx_context = 288 gfx::GLContextGLX* glx_context =
282 static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext()); 289 static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext());
283 GLXContext glx_context_handle = 290 GLXContext glx_context_handle =
284 static_cast<GLXContext>(glx_context->GetHandle()); 291 static_cast<GLXContext>(glx_context->GetHandle());
285 video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator( 292 video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator(
286 glx_context->display(), glx_context_handle, this, 293 glx_context->display(), glx_context_handle, this,
287 make_context_current_)); 294 make_context_current_));
295 #endif
288 #elif defined(OS_ANDROID) 296 #elif defined(OS_ANDROID)
289 video_decode_accelerator_.reset(new AndroidVideoDecodeAccelerator( 297 video_decode_accelerator_.reset(new AndroidVideoDecodeAccelerator(
290 this, 298 this,
291 stub_->decoder()->AsWeakPtr(), 299 stub_->decoder()->AsWeakPtr(),
292 make_context_current_)); 300 make_context_current_));
293 #else 301 #else
294 NOTIMPLEMENTED() << "HW video decode acceleration not available."; 302 NOTIMPLEMENTED() << "HW video decode acceleration not available.";
295 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); 303 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
296 return; 304 return;
297 #endif 305 #endif
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 scoped_refptr<gpu::gles2::TextureRef> texture_ref = it->second; 499 scoped_refptr<gpu::gles2::TextureRef> texture_ref = it->second;
492 GLenum target = texture_ref->texture()->target(); 500 GLenum target = texture_ref->texture()->target();
493 gpu::gles2::TextureManager* texture_manager = 501 gpu::gles2::TextureManager* texture_manager =
494 stub_->decoder()->GetContextGroup()->texture_manager(); 502 stub_->decoder()->GetContextGroup()->texture_manager();
495 DCHECK(!texture_ref->texture()->IsLevelCleared(target, 0)); 503 DCHECK(!texture_ref->texture()->IsLevelCleared(target, 0));
496 texture_manager->SetLevelCleared(texture_ref, target, 0, true); 504 texture_manager->SetLevelCleared(texture_ref, target, 0, true);
497 uncleared_textures_.erase(it); 505 uncleared_textures_.erase(it);
498 } 506 }
499 507
500 } // namespace content 508 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698