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

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

Issue 974583002: Change to using an Ozone GLImage for VAAPI DRM video (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 va_surface_ = vaapi_wrapper_->CreateUnownedSurface(VA_RT_FORMAT_RGB32, size(), 95 va_surface_ = vaapi_wrapper_->CreateUnownedSurface(VA_RT_FORMAT_RGB32, size(),
96 va_attribs); 96 va_attribs);
97 if (!va_surface_) { 97 if (!va_surface_) {
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 // Create an EGLImage out of the same buffer. 105 gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES,
106 gl_image_ = new gfx::GLImageLinuxDMABuffer(size(), GL_RGBA); 106 texture_id());
107 if (!gl_image_->Initialize(base::FileDescriptor(dmabuf_fd, false), 107 gl_image_ = ui::GpuMemoryBufferFactoryOzoneNativeBuffer::CreateImageForPixmap(
108 gfx::GpuMemoryBuffer::BGRA_8888, dmabuf_pitch)) { 108 pixmap_, size(), gfx::GpuMemoryBuffer::BGRA_8888, GL_RGBA);
109 LOG(ERROR) << "Failed to create a GLImageLinuxDMABuffer for a NativePixmap"; 109 if (!gl_image_) {
110 LOG(ERROR) << "Failed to create GLImage";
110 return false; 111 return false;
111 } 112 }
112
113 // Bind the EGLImage to the given GL texture.
114 gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES,
115 texture_id());
116 if (!gl_image_->BindTexImage(GL_TEXTURE_EXTERNAL_OES)) { 113 if (!gl_image_->BindTexImage(GL_TEXTURE_EXTERNAL_OES)) {
117 LOG(ERROR) << "Failed to bind texture to GLImage"; 114 LOG(ERROR) << "Failed to bind texture to GLImage";
118 return false; 115 return false;
119 } 116 }
120 117
121 return true; 118 return true;
122 } 119 }
123 120
124 bool VaapiDrmPicture::DownloadFromSurface( 121 bool VaapiDrmPicture::DownloadFromSurface(
125 const scoped_refptr<VASurface>& va_surface) { 122 const scoped_refptr<VASurface>& va_surface) {
126 return vaapi_wrapper_->BlitSurface(va_surface->id(), va_surface->size(), 123 return vaapi_wrapper_->BlitSurface(va_surface->id(), va_surface->size(),
127 va_surface_->id(), va_surface_->size()); 124 va_surface_->id(), va_surface_->size());
128 } 125 }
129 126
130 scoped_refptr<gfx::GLImage> VaapiDrmPicture::GetImageToBind() { 127 scoped_refptr<gfx::GLImage> VaapiDrmPicture::GetImageToBind() {
131 return gl_image_; 128 return gl_image_;
132 } 129 }
133 130
134 bool VaapiDrmPicture::AllowOverlay() const { 131 bool VaapiDrmPicture::AllowOverlay() const {
135 return true; 132 return true;
136 } 133 }
137 134
138 } // namespace 135 } // namespace
OLDNEW
« no previous file with comments | « content/common/gpu/media/vaapi_drm_picture.h ('k') | ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698