| 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 "media/gpu/vaapi_drm_picture.h" | 5 #include "media/gpu/vaapi_drm_picture.h" |
| 6 | 6 |
| 7 #include "base/file_descriptor_posix.h" | 7 #include "base/file_descriptor_posix.h" |
| 8 #include "media/gpu/va_surface.h" | 8 #include "media/gpu/va_surface.h" |
| 9 #include "media/gpu/vaapi_wrapper.h" | 9 #include "media/gpu/vaapi_wrapper.h" |
| 10 #include "third_party/libva/va/drm/va_drm.h" | 10 #include "third_party/libva/va/drm/va_drm.h" |
| 11 #include "third_party/libva/va/va.h" | 11 #include "third_party/libva/va/va.h" |
| 12 #include "ui/gfx/gpu_memory_buffer.h" | 12 #include "ui/gfx/gpu_memory_buffer.h" |
| 13 #include "ui/gfx/native_pixmap.h" | 13 #include "ui/gfx/native_pixmap.h" |
| 14 #include "ui/gl/gl_bindings.h" | 14 #include "ui/gl/gl_bindings.h" |
| 15 #include "ui/gl/gl_image_native_pixmap.h" |
| 15 #include "ui/gl/scoped_binders.h" | 16 #include "ui/gl/scoped_binders.h" |
| 16 #include "ui/ozone/gl/gl_image_ozone_native_pixmap.h" | |
| 17 #include "ui/ozone/public/ozone_platform.h" | 17 #include "ui/ozone/public/ozone_platform.h" |
| 18 #include "ui/ozone/public/surface_factory_ozone.h" | 18 #include "ui/ozone/public/surface_factory_ozone.h" |
| 19 | 19 |
| 20 namespace media { | 20 namespace media { |
| 21 | 21 |
| 22 VaapiDrmPicture::VaapiDrmPicture( | 22 VaapiDrmPicture::VaapiDrmPicture( |
| 23 const scoped_refptr<VaapiWrapper>& vaapi_wrapper, | 23 const scoped_refptr<VaapiWrapper>& vaapi_wrapper, |
| 24 const MakeGLContextCurrentCallback& make_context_current_cb, | 24 const MakeGLContextCurrentCallback& make_context_current_cb, |
| 25 const BindGLImageCallback& bind_image_cb, | 25 const BindGLImageCallback& bind_image_cb, |
| 26 int32_t picture_buffer_id, | 26 int32_t picture_buffer_id, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 if (texture_id_ != 0 && !make_context_current_cb_.is_null()) { | 71 if (texture_id_ != 0 && !make_context_current_cb_.is_null()) { |
| 72 if (!make_context_current_cb_.Run()) | 72 if (!make_context_current_cb_.Run()) |
| 73 return false; | 73 return false; |
| 74 | 74 |
| 75 gl::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES, | 75 gl::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES, |
| 76 texture_id_); | 76 texture_id_); |
| 77 | 77 |
| 78 gfx::BufferFormat format = pixmap_->GetBufferFormat(); | 78 gfx::BufferFormat format = pixmap_->GetBufferFormat(); |
| 79 | 79 |
| 80 scoped_refptr<ui::GLImageOzoneNativePixmap> image( | 80 scoped_refptr<ui::GLImageNativePixmap> image(new ui::GLImageNativePixmap( |
| 81 new ui::GLImageOzoneNativePixmap(size_, | 81 size_, BufferFormatToInternalFormat(format))); |
| 82 BufferFormatToInternalFormat(format))); | |
| 83 if (!image->Initialize(pixmap_.get(), format)) { | 82 if (!image->Initialize(pixmap_.get(), format)) { |
| 84 LOG(ERROR) << "Failed to create GLImage"; | 83 LOG(ERROR) << "Failed to create GLImage"; |
| 85 return false; | 84 return false; |
| 86 } | 85 } |
| 87 gl_image_ = image; | 86 gl_image_ = image; |
| 88 if (!gl_image_->BindTexImage(GL_TEXTURE_EXTERNAL_OES)) { | 87 if (!gl_image_->BindTexImage(GL_TEXTURE_EXTERNAL_OES)) { |
| 89 LOG(ERROR) << "Failed to bind texture to GLImage"; | 88 LOG(ERROR) << "Failed to bind texture to GLImage"; |
| 90 return false; | 89 return false; |
| 91 } | 90 } |
| 92 } | 91 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 bool VaapiDrmPicture::DownloadFromSurface( | 134 bool VaapiDrmPicture::DownloadFromSurface( |
| 136 const scoped_refptr<VASurface>& va_surface) { | 135 const scoped_refptr<VASurface>& va_surface) { |
| 137 return vaapi_wrapper_->BlitSurface(va_surface, va_surface_); | 136 return vaapi_wrapper_->BlitSurface(va_surface, va_surface_); |
| 138 } | 137 } |
| 139 | 138 |
| 140 bool VaapiDrmPicture::AllowOverlay() const { | 139 bool VaapiDrmPicture::AllowOverlay() const { |
| 141 return true; | 140 return true; |
| 142 } | 141 } |
| 143 | 142 |
| 144 } // namespace media | 143 } // namespace media |
| OLD | NEW |