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 "base/file_descriptor_posix.h" | 5 #include "base/file_descriptor_posix.h" |
6 #include "media/gpu/va_surface.h" | 6 #include "media/gpu/va_surface.h" |
7 #include "media/gpu/vaapi_drm_picture.h" | 7 #include "media/gpu/vaapi_drm_picture.h" |
8 #include "media/gpu/vaapi_wrapper.h" | 8 #include "media/gpu/vaapi_wrapper.h" |
9 #include "third_party/libva/va/drm/va_drm.h" | 9 #include "third_party/libva/va/drm/va_drm.h" |
10 #include "third_party/libva/va/va.h" | 10 #include "third_party/libva/va/va.h" |
11 #include "ui/gfx/gpu_memory_buffer.h" | 11 #include "ui/gfx/gpu_memory_buffer.h" |
12 #include "ui/gl/gl_bindings.h" | 12 #include "ui/gl/gl_bindings.h" |
13 #include "ui/gl/gl_image_ozone_native_pixmap.h" | |
14 #include "ui/gl/scoped_binders.h" | 13 #include "ui/gl/scoped_binders.h" |
| 14 #include "ui/ozone/gl/gl_image_ozone_native_pixmap.h" |
15 #include "ui/ozone/public/native_pixmap.h" | 15 #include "ui/ozone/public/native_pixmap.h" |
16 #include "ui/ozone/public/ozone_platform.h" | 16 #include "ui/ozone/public/ozone_platform.h" |
17 #include "ui/ozone/public/surface_factory_ozone.h" | 17 #include "ui/ozone/public/surface_factory_ozone.h" |
18 | 18 |
19 namespace media { | 19 namespace media { |
20 | 20 |
21 VaapiDrmPicture::VaapiDrmPicture( | 21 VaapiDrmPicture::VaapiDrmPicture( |
22 const scoped_refptr<VaapiWrapper>& vaapi_wrapper, | 22 const scoped_refptr<VaapiWrapper>& vaapi_wrapper, |
23 const MakeGLContextCurrentCallback& make_context_current_cb, | 23 const MakeGLContextCurrentCallback& make_context_current_cb, |
24 const BindGLImageCallback& bind_image_cb, | 24 const BindGLImageCallback& bind_image_cb, |
(...skipping 29 matching lines...) Expand all Loading... |
54 | 54 |
55 pixmap_->SetProcessingCallback( | 55 pixmap_->SetProcessingCallback( |
56 base::Bind(&VaapiWrapper::ProcessPixmap, vaapi_wrapper_)); | 56 base::Bind(&VaapiWrapper::ProcessPixmap, vaapi_wrapper_)); |
57 | 57 |
58 if (texture_id_ != 0 && !make_context_current_cb_.is_null()) { | 58 if (texture_id_ != 0 && !make_context_current_cb_.is_null()) { |
59 if (!make_context_current_cb_.Run()) | 59 if (!make_context_current_cb_.Run()) |
60 return false; | 60 return false; |
61 | 61 |
62 gl::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES, | 62 gl::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES, |
63 texture_id_); | 63 texture_id_); |
64 scoped_refptr<gl::GLImageOzoneNativePixmap> image( | 64 scoped_refptr<ui::GLImageOzoneNativePixmap> image( |
65 new gl::GLImageOzoneNativePixmap(size_, GL_BGRA_EXT)); | 65 new ui::GLImageOzoneNativePixmap(size_, GL_BGRA_EXT)); |
66 if (!image->Initialize(pixmap_.get(), pixmap_->GetBufferFormat())) { | 66 if (!image->Initialize(pixmap_.get(), pixmap_->GetBufferFormat())) { |
67 LOG(ERROR) << "Failed to create GLImage"; | 67 LOG(ERROR) << "Failed to create GLImage"; |
68 return false; | 68 return false; |
69 } | 69 } |
70 gl_image_ = image; | 70 gl_image_ = image; |
71 if (!gl_image_->BindTexImage(GL_TEXTURE_EXTERNAL_OES)) { | 71 if (!gl_image_->BindTexImage(GL_TEXTURE_EXTERNAL_OES)) { |
72 LOG(ERROR) << "Failed to bind texture to GLImage"; | 72 LOG(ERROR) << "Failed to bind texture to GLImage"; |
73 return false; | 73 return false; |
74 } | 74 } |
75 } | 75 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 bool VaapiDrmPicture::DownloadFromSurface( | 117 bool VaapiDrmPicture::DownloadFromSurface( |
118 const scoped_refptr<VASurface>& va_surface) { | 118 const scoped_refptr<VASurface>& va_surface) { |
119 return vaapi_wrapper_->BlitSurface(va_surface, va_surface_); | 119 return vaapi_wrapper_->BlitSurface(va_surface, va_surface_); |
120 } | 120 } |
121 | 121 |
122 bool VaapiDrmPicture::AllowOverlay() const { | 122 bool VaapiDrmPicture::AllowOverlay() const { |
123 return true; | 123 return true; |
124 } | 124 } |
125 | 125 |
126 } // namespace media | 126 } // namespace media |
OLD | NEW |