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

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

Issue 858653002: vaapi plumbing to allow hardware video overlays (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make buildable before cc plumbing is in Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/va_surface.h" 5 #include "content/common/gpu/media/va_surface.h"
6 #include "content/common/gpu/media/vaapi_tfp_picture.h" 6 #include "content/common/gpu/media/vaapi_tfp_picture.h"
7 #include "content/common/gpu/media/vaapi_wrapper.h" 7 #include "content/common/gpu/media/vaapi_wrapper.h"
8 #include "ui/gfx/x/x11_types.h" 8 #include "ui/gfx/x/x11_types.h"
9 #include "ui/gl/gl_bindings.h" 9 #include "ui/gl/gl_bindings.h"
10 #include "ui/gl/gl_image_glx.h" 10 #include "ui/gl/gl_image_glx.h"
11 #include "ui/gl/scoped_binders.h" 11 #include "ui/gl/scoped_binders.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 VaapiTFPPicture::VaapiTFPPicture( 15 VaapiTFPPicture::VaapiTFPPicture(
16 VaapiWrapper* vaapi_wrapper, 16 VaapiWrapper* vaapi_wrapper,
17 const base::Callback<bool(void)> make_context_current, 17 const base::Callback<bool(void)> make_context_current,
18 int32 picture_buffer_id, 18 int32 picture_buffer_id,
19 uint32 texture_id, 19 uint32 texture_id,
20 const gfx::Size& size) 20 const gfx::Size& size)
21 : VaapiPicture(picture_buffer_id, texture_id, size), 21 : VaapiPicture(picture_buffer_id, texture_id, size, false),
22 vaapi_wrapper_(vaapi_wrapper), 22 vaapi_wrapper_(vaapi_wrapper),
23 make_context_current_(make_context_current), 23 make_context_current_(make_context_current),
24 x_display_(gfx::GetXDisplay()), 24 x_display_(gfx::GetXDisplay()),
25 x_pixmap_(0) { 25 x_pixmap_(0) {
26 } 26 }
27 27
28 VaapiTFPPicture::~VaapiTFPPicture() { 28 VaapiTFPPicture::~VaapiTFPPicture() {
29 if (glx_image_.get() && make_context_current_.Run()) { 29 if (glx_image_.get() && make_context_current_.Run()) {
30 glx_image_->ReleaseTexImage(GL_TEXTURE_2D); 30 glx_image_->ReleaseTexImage(GL_TEXTURE_2D);
31 glx_image_->Destroy(true); 31 glx_image_->Destroy(true);
32 DCHECK_EQ(glGetError(), static_cast<GLenum>(GL_NO_ERROR)); 32 DCHECK_EQ(glGetError(), static_cast<GLenum>(GL_NO_ERROR));
33 } 33 }
34 34
35 if (x_pixmap_) 35 if (x_pixmap_)
36 XFreePixmap(x_display_, x_pixmap_); 36 XFreePixmap(x_display_, x_pixmap_);
37 } 37 }
38 38
39 bool VaapiTFPPicture::Initialize() { 39 bool VaapiTFPPicture::Initialize(gpu::gles2::TextureManager* texture_manager,
Pawel Osciak 2015/01/21 13:07:08 Unused parameters should be commented out per codi
40 gpu::gles2::TextureRef* texture_ref) {
40 if (!make_context_current_.Run()) 41 if (!make_context_current_.Run())
41 return false; 42 return false;
42 43
43 XWindowAttributes win_attr; 44 XWindowAttributes win_attr;
44 int screen = DefaultScreen(x_display_); 45 int screen = DefaultScreen(x_display_);
45 XGetWindowAttributes(x_display_, RootWindow(x_display_, screen), &win_attr); 46 XGetWindowAttributes(x_display_, RootWindow(x_display_, screen), &win_attr);
46 // TODO(posciak): pass the depth required by libva, not the RootWindow's 47 // TODO(posciak): pass the depth required by libva, not the RootWindow's
47 // depth 48 // depth
48 x_pixmap_ = XCreatePixmap(x_display_, RootWindow(x_display_, screen), 49 x_pixmap_ = XCreatePixmap(x_display_, RootWindow(x_display_, screen),
49 size().width(), size().height(), win_attr.depth); 50 size().width(), size().height(), win_attr.depth);
(...skipping 18 matching lines...) Expand all
68 return true; 69 return true;
69 } 70 }
70 71
71 bool VaapiTFPPicture::DownloadFromSurface( 72 bool VaapiTFPPicture::DownloadFromSurface(
72 const scoped_refptr<VASurface>& va_surface) { 73 const scoped_refptr<VASurface>& va_surface) {
73 return vaapi_wrapper_->PutSurfaceIntoPixmap(va_surface->id(), x_pixmap_, 74 return vaapi_wrapper_->PutSurfaceIntoPixmap(va_surface->id(), x_pixmap_,
74 va_surface->size()); 75 va_surface->size());
75 } 76 }
76 77
77 } // namespace content 78 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698