Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Side by Side Diff: content/common/gpu/media/vaapi_drm_picture.cc

Issue 1258713002: ozone: unify GpuMemoryBufferFactoryOzoneNativePixmap in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resolve nits Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "third_party/libva/va/va_drmcommon.h" 11 #include "third_party/libva/va/va_drmcommon.h"
12 #include "ui/gfx/gpu_memory_buffer.h" 12 #include "ui/gfx/gpu_memory_buffer.h"
13 #include "ui/gl/gl_bindings.h" 13 #include "ui/gl/gl_bindings.h"
14 #include "ui/gl/gl_image_linux_dma_buffer.h" 14 #include "ui/gl/gl_image_ozone_native_pixmap.h"
15 #include "ui/gl/scoped_binders.h" 15 #include "ui/gl/scoped_binders.h"
16 #include "ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.h"
17 #include "ui/ozone/public/native_pixmap.h" 16 #include "ui/ozone/public/native_pixmap.h"
18 #include "ui/ozone/public/ozone_platform.h" 17 #include "ui/ozone/public/ozone_platform.h"
19 #include "ui/ozone/public/surface_factory_ozone.h" 18 #include "ui/ozone/public/surface_factory_ozone.h"
20 19
21 namespace content { 20 namespace content {
22 21
23 VaapiDrmPicture::VaapiDrmPicture( 22 VaapiDrmPicture::VaapiDrmPicture(
24 VaapiWrapper* vaapi_wrapper, 23 VaapiWrapper* vaapi_wrapper,
25 const base::Callback<bool(void)>& make_context_current, 24 const base::Callback<bool(void)>& make_context_current,
26 int32 picture_buffer_id, 25 int32 picture_buffer_id,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // hence we cannot bind ScalePixmap here. Instead we use a 120 // hence we cannot bind ScalePixmap here. Instead we use a
122 // static function to solve this problem. 121 // static function to solve this problem.
123 pixmap_->SetScalingCallback(base::Bind(&VaapiDrmPicture::CallScalePixmap, 122 pixmap_->SetScalingCallback(base::Bind(&VaapiDrmPicture::CallScalePixmap,
124 weak_this_factory_.GetWeakPtr())); 123 weak_this_factory_.GetWeakPtr()));
125 124
126 if (!make_context_current_.Run()) 125 if (!make_context_current_.Run())
127 return false; 126 return false;
128 127
129 gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES, 128 gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES,
130 texture_id()); 129 texture_id());
131 gl_image_ = ui::GpuMemoryBufferFactoryOzoneNativePixmap::CreateImageForPixmap( 130 scoped_refptr<gfx::GLImageOzoneNativePixmap> image(
132 pixmap_, size(), gfx::GpuMemoryBuffer::BGRA_8888, GL_BGRA_EXT); 131 new gfx::GLImageOzoneNativePixmap(size(), GL_BGRA_EXT));
133 if (!gl_image_) { 132 if (!image->Initialize(pixmap_.get(), gfx::GpuMemoryBuffer::BGRA_8888)) {
134 LOG(ERROR) << "Failed to create GLImage"; 133 LOG(ERROR) << "Failed to create GLImage";
135 return false; 134 return false;
136 } 135 }
136 gl_image_ = image;
137 if (!gl_image_->BindTexImage(GL_TEXTURE_EXTERNAL_OES)) { 137 if (!gl_image_->BindTexImage(GL_TEXTURE_EXTERNAL_OES)) {
138 LOG(ERROR) << "Failed to bind texture to GLImage"; 138 LOG(ERROR) << "Failed to bind texture to GLImage";
139 return false; 139 return false;
140 } 140 }
141 141
142 return true; 142 return true;
143 } 143 }
144 144
145 bool VaapiDrmPicture::DownloadFromSurface( 145 bool VaapiDrmPicture::DownloadFromSurface(
146 const scoped_refptr<VASurface>& va_surface) { 146 const scoped_refptr<VASurface>& va_surface) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 scoped_refptr<gfx::GLImage> VaapiDrmPicture::GetImageToBind() { 194 scoped_refptr<gfx::GLImage> VaapiDrmPicture::GetImageToBind() {
195 return gl_image_; 195 return gl_image_;
196 } 196 }
197 197
198 bool VaapiDrmPicture::AllowOverlay() const { 198 bool VaapiDrmPicture::AllowOverlay() const {
199 return true; 199 return true;
200 } 200 }
201 201
202 } // namespace 202 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698