OLD | NEW |
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" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 XGetWindowAttributes(x_display_, RootWindow(x_display_, screen), &win_attr); | 45 XGetWindowAttributes(x_display_, RootWindow(x_display_, screen), &win_attr); |
46 // TODO(posciak): pass the depth required by libva, not the RootWindow's | 46 // TODO(posciak): pass the depth required by libva, not the RootWindow's |
47 // depth | 47 // depth |
48 x_pixmap_ = XCreatePixmap(x_display_, RootWindow(x_display_, screen), | 48 x_pixmap_ = XCreatePixmap(x_display_, RootWindow(x_display_, screen), |
49 size().width(), size().height(), win_attr.depth); | 49 size().width(), size().height(), win_attr.depth); |
50 if (!x_pixmap_) { | 50 if (!x_pixmap_) { |
51 LOG(ERROR) << "Failed creating an X Pixmap for TFP"; | 51 LOG(ERROR) << "Failed creating an X Pixmap for TFP"; |
52 return false; | 52 return false; |
53 } | 53 } |
54 | 54 |
55 glx_image_ = new gfx::GLImageGLX(size(), GL_RGB); | 55 glx_image_ = new gl::GLImageGLX(size(), GL_RGB); |
56 if (!glx_image_->Initialize(x_pixmap_)) { | 56 if (!glx_image_->Initialize(x_pixmap_)) { |
57 // x_pixmap_ will be freed in the destructor. | 57 // x_pixmap_ will be freed in the destructor. |
58 LOG(ERROR) << "Failed creating a GLX Pixmap for TFP"; | 58 LOG(ERROR) << "Failed creating a GLX Pixmap for TFP"; |
59 return false; | 59 return false; |
60 } | 60 } |
61 | 61 |
62 gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_2D, texture_id()); | 62 gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_2D, texture_id()); |
63 if (!glx_image_->BindTexImage(GL_TEXTURE_2D)) { | 63 if (!glx_image_->BindTexImage(GL_TEXTURE_2D)) { |
64 LOG(ERROR) << "Failed to bind texture to glx image"; | 64 LOG(ERROR) << "Failed to bind texture to glx image"; |
65 return false; | 65 return false; |
66 } | 66 } |
67 | 67 |
68 return true; | 68 return true; |
69 } | 69 } |
70 | 70 |
71 bool VaapiTFPPicture::DownloadFromSurface( | 71 bool VaapiTFPPicture::DownloadFromSurface( |
72 const scoped_refptr<VASurface>& va_surface) { | 72 const scoped_refptr<VASurface>& va_surface) { |
73 return vaapi_wrapper_->PutSurfaceIntoPixmap(va_surface->id(), x_pixmap_, | 73 return vaapi_wrapper_->PutSurfaceIntoPixmap(va_surface->id(), x_pixmap_, |
74 va_surface->size()); | 74 va_surface->size()); |
75 } | 75 } |
76 | 76 |
77 scoped_refptr<gfx::GLImage> VaapiTFPPicture::GetImageToBind() { | 77 scoped_refptr<gl::GLImage> VaapiTFPPicture::GetImageToBind() { |
78 return nullptr; | 78 return nullptr; |
79 } | 79 } |
80 | 80 |
81 } // namespace content | 81 } // namespace content |
OLD | NEW |