| 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 "content/common/generic_shared_memory_id_generator.h" |
| 6 #include "content/common/gpu/media/va_surface.h" | 7 #include "content/common/gpu/media/va_surface.h" |
| 7 #include "content/common/gpu/media/vaapi_drm_picture.h" | 8 #include "content/common/gpu/media/vaapi_drm_picture.h" |
| 8 #include "content/common/gpu/media/vaapi_wrapper.h" | 9 #include "content/common/gpu/media/vaapi_wrapper.h" |
| 9 #include "third_party/libva/va/drm/va_drm.h" | 10 #include "third_party/libva/va/drm/va_drm.h" |
| 10 #include "third_party/libva/va/va.h" | 11 #include "third_party/libva/va/va.h" |
| 11 #include "third_party/libva/va/va_drmcommon.h" | 12 #include "third_party/libva/va/va_drmcommon.h" |
| 12 #include "ui/gfx/gpu_memory_buffer.h" | 13 #include "ui/gfx/gpu_memory_buffer.h" |
| 13 #include "ui/gl/gl_bindings.h" | 14 #include "ui/gl/gl_bindings.h" |
| 14 #include "ui/gl/gl_image_ozone_native_pixmap.h" | 15 #include "ui/gl/gl_image_ozone_native_pixmap.h" |
| 15 #include "ui/gl/scoped_binders.h" | 16 #include "ui/gl/scoped_binders.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 pixmap_->SetScalingCallback(base::Bind(&VaapiDrmPicture::CallScalePixmap, | 123 pixmap_->SetScalingCallback(base::Bind(&VaapiDrmPicture::CallScalePixmap, |
| 123 weak_this_factory_.GetWeakPtr())); | 124 weak_this_factory_.GetWeakPtr())); |
| 124 | 125 |
| 125 if (!make_context_current_.Run()) | 126 if (!make_context_current_.Run()) |
| 126 return false; | 127 return false; |
| 127 | 128 |
| 128 gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES, | 129 gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES, |
| 129 texture_id()); | 130 texture_id()); |
| 130 scoped_refptr<gfx::GLImageOzoneNativePixmap> image( | 131 scoped_refptr<gfx::GLImageOzoneNativePixmap> image( |
| 131 new gfx::GLImageOzoneNativePixmap(size(), GL_BGRA_EXT)); | 132 new gfx::GLImageOzoneNativePixmap(size(), GL_BGRA_EXT)); |
| 132 if (!image->Initialize(pixmap_.get(), gfx::BufferFormat::BGRA_8888)) { | 133 if (!image->Initialize(GetNextGenericSharedMemoryId(), pixmap_.get(), |
| 134 gfx::GpuMemoryBuffer::BGRA_8888)) { |
| 133 LOG(ERROR) << "Failed to create GLImage"; | 135 LOG(ERROR) << "Failed to create GLImage"; |
| 134 return false; | 136 return false; |
| 135 } | 137 } |
| 136 gl_image_ = image; | 138 gl_image_ = image; |
| 137 if (!gl_image_->BindTexImage(GL_TEXTURE_EXTERNAL_OES)) { | 139 if (!gl_image_->BindTexImage(GL_TEXTURE_EXTERNAL_OES)) { |
| 138 LOG(ERROR) << "Failed to bind texture to GLImage"; | 140 LOG(ERROR) << "Failed to bind texture to GLImage"; |
| 139 return false; | 141 return false; |
| 140 } | 142 } |
| 141 | 143 |
| 142 return true; | 144 return true; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 195 |
| 194 scoped_refptr<gfx::GLImage> VaapiDrmPicture::GetImageToBind() { | 196 scoped_refptr<gfx::GLImage> VaapiDrmPicture::GetImageToBind() { |
| 195 return gl_image_; | 197 return gl_image_; |
| 196 } | 198 } |
| 197 | 199 |
| 198 bool VaapiDrmPicture::AllowOverlay() const { | 200 bool VaapiDrmPicture::AllowOverlay() const { |
| 199 return true; | 201 return true; |
| 200 } | 202 } |
| 201 | 203 |
| 202 } // namespace | 204 } // namespace |
| OLD | NEW |