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/gpu/media/va_surface.h" | 6 #include "content/common/gpu/media/va_surface.h" |
7 #include "content/common/gpu/media/vaapi_drm_picture.h" | 7 #include "content/common/gpu/media/vaapi_drm_picture.h" |
8 #include "content/common/gpu/media/vaapi_wrapper.h" | 8 #include "content/common/gpu/media/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" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 LOG(ERROR) << "Failed to create VASurface for an Ozone NativePixmap"; | 98 LOG(ERROR) << "Failed to create VASurface for an Ozone NativePixmap"; |
99 return false; | 99 return false; |
100 } | 100 } |
101 | 101 |
102 if (!make_context_current_.Run()) | 102 if (!make_context_current_.Run()) |
103 return false; | 103 return false; |
104 | 104 |
105 gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES, | 105 gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES, |
106 texture_id()); | 106 texture_id()); |
107 gl_image_ = ui::GpuMemoryBufferFactoryOzoneNativeBuffer::CreateImageForPixmap( | 107 gl_image_ = ui::GpuMemoryBufferFactoryOzoneNativeBuffer::CreateImageForPixmap( |
108 pixmap_, size(), gfx::GpuMemoryBuffer::RGBA_8888, GL_RGBA); | 108 pixmap_, size(), gfx::GpuMemoryBuffer::BGRA_8888, GL_RGBA); |
109 if (!gl_image_) { | 109 if (!gl_image_) { |
110 LOG(ERROR) << "Failed to create GLImage"; | 110 LOG(ERROR) << "Failed to create GLImage"; |
111 return false; | 111 return false; |
112 } | 112 } |
113 if (!gl_image_->BindTexImage(GL_TEXTURE_EXTERNAL_OES)) { | 113 if (!gl_image_->BindTexImage(GL_TEXTURE_EXTERNAL_OES)) { |
114 LOG(ERROR) << "Failed to bind texture to GLImage"; | 114 LOG(ERROR) << "Failed to bind texture to GLImage"; |
115 return false; | 115 return false; |
116 } | 116 } |
117 | 117 |
118 return true; | 118 return true; |
119 } | 119 } |
120 | 120 |
121 bool VaapiDrmPicture::DownloadFromSurface( | 121 bool VaapiDrmPicture::DownloadFromSurface( |
122 const scoped_refptr<VASurface>& va_surface) { | 122 const scoped_refptr<VASurface>& va_surface) { |
123 return vaapi_wrapper_->BlitSurface(va_surface->id(), va_surface->size(), | 123 return vaapi_wrapper_->BlitSurface(va_surface->id(), va_surface->size(), |
124 va_surface_->id(), va_surface_->size()); | 124 va_surface_->id(), va_surface_->size()); |
125 } | 125 } |
126 | 126 |
127 scoped_refptr<gfx::GLImage> VaapiDrmPicture::GetImageToBind() { | 127 scoped_refptr<gfx::GLImage> VaapiDrmPicture::GetImageToBind() { |
128 return gl_image_; | 128 return gl_image_; |
129 } | 129 } |
130 | 130 |
131 bool VaapiDrmPicture::AllowOverlay() const { | 131 bool VaapiDrmPicture::AllowOverlay() const { |
132 return true; | 132 return true; |
133 } | 133 } |
134 | 134 |
135 } // namespace | 135 } // namespace |
OLD | NEW |