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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 if (texture_id_ != 0 && !make_context_current_cb_.is_null()) { | 72 if (texture_id_ != 0 && !make_context_current_cb_.is_null()) { |
73 if (!make_context_current_cb_.Run()) | 73 if (!make_context_current_cb_.Run()) |
74 return false; | 74 return false; |
75 | 75 |
76 gl::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES, | 76 gl::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES, |
77 texture_id_); | 77 texture_id_); |
78 | 78 |
79 gfx::BufferFormat format = pixmap_->GetBufferFormat(); | 79 gfx::BufferFormat format = pixmap_->GetBufferFormat(); |
80 | 80 |
81 scoped_refptr<gl::GLImageOzoneNativePixmap> image( | 81 scoped_refptr<ui::GLImageOzoneNativePixmap> image( |
82 new gl::GLImageOzoneNativePixmap(size_, | 82 new ui::GLImageOzoneNativePixmap(size_, |
83 BufferFormatToInternalFormat(format))); | 83 BufferFormatToInternalFormat(format))); |
84 if (!image->Initialize(pixmap_.get(), format)) { | 84 if (!image->Initialize(pixmap_.get(), format)) { |
85 LOG(ERROR) << "Failed to create GLImage"; | 85 LOG(ERROR) << "Failed to create GLImage"; |
86 return false; | 86 return false; |
87 } | 87 } |
88 gl_image_ = image; | 88 gl_image_ = image; |
89 if (!gl_image_->BindTexImage(GL_TEXTURE_EXTERNAL_OES)) { | 89 if (!gl_image_->BindTexImage(GL_TEXTURE_EXTERNAL_OES)) { |
90 LOG(ERROR) << "Failed to bind texture to GLImage"; | 90 LOG(ERROR) << "Failed to bind texture to GLImage"; |
91 return false; | 91 return false; |
92 } | 92 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 bool VaapiDrmPicture::DownloadFromSurface( | 136 bool VaapiDrmPicture::DownloadFromSurface( |
137 const scoped_refptr<VASurface>& va_surface) { | 137 const scoped_refptr<VASurface>& va_surface) { |
138 return vaapi_wrapper_->BlitSurface(va_surface, va_surface_); | 138 return vaapi_wrapper_->BlitSurface(va_surface, va_surface_); |
139 } | 139 } |
140 | 140 |
141 bool VaapiDrmPicture::AllowOverlay() const { | 141 bool VaapiDrmPicture::AllowOverlay() const { |
142 return true; | 142 return true; |
143 } | 143 } |
144 | 144 |
145 } // namespace media | 145 } // namespace media |
OLD | NEW |