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

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

Issue 2148983002: gpu: Take surface handle into account when importing buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: avoid crash in DrmDeviceManager::GetDrmDevice when passed invalid widget Created 4 years, 5 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 "media/gpu/va_surface.h" 6 #include "media/gpu/va_surface.h"
7 #include "media/gpu/vaapi_drm_picture.h" 7 #include "media/gpu/vaapi_drm_picture.h"
8 #include "media/gpu/vaapi_wrapper.h" 8 #include "media/gpu/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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 return Initialize(); 116 return Initialize();
117 } 117 }
118 118
119 bool VaapiDrmPicture::ImportGpuMemoryBufferHandle( 119 bool VaapiDrmPicture::ImportGpuMemoryBufferHandle(
120 gfx::BufferFormat format, 120 gfx::BufferFormat format,
121 const gfx::GpuMemoryBufferHandle& gpu_memory_buffer_handle) { 121 const gfx::GpuMemoryBufferHandle& gpu_memory_buffer_handle) {
122 ui::OzonePlatform* platform = ui::OzonePlatform::GetInstance(); 122 ui::OzonePlatform* platform = ui::OzonePlatform::GetInstance();
123 ui::SurfaceFactoryOzone* factory = platform->GetSurfaceFactoryOzone(); 123 ui::SurfaceFactoryOzone* factory = platform->GetSurfaceFactoryOzone();
124 // CreateNativePixmapFromHandle() will take ownership of the handle. 124 // CreateNativePixmapFromHandle() will take ownership of the handle.
125 pixmap_ = factory->CreateNativePixmapFromHandle( 125 pixmap_ = factory->CreateNativePixmapFromHandle(
126 size_, format, gpu_memory_buffer_handle.native_pixmap_handle); 126 gfx::kNullAcceleratedWidget, size_, format,
127 gpu_memory_buffer_handle.native_pixmap_handle);
127 if (!pixmap_) { 128 if (!pixmap_) {
128 DVLOG(1) << "Failed creating a pixmap from a native handle"; 129 DVLOG(1) << "Failed creating a pixmap from a native handle";
129 return false; 130 return false;
130 } 131 }
131 132
132 return Initialize(); 133 return Initialize();
133 } 134 }
134 135
135 bool VaapiDrmPicture::DownloadFromSurface( 136 bool VaapiDrmPicture::DownloadFromSurface(
136 const scoped_refptr<VASurface>& va_surface) { 137 const scoped_refptr<VASurface>& va_surface) {
137 return vaapi_wrapper_->BlitSurface(va_surface, va_surface_); 138 return vaapi_wrapper_->BlitSurface(va_surface, va_surface_);
138 } 139 }
139 140
140 bool VaapiDrmPicture::AllowOverlay() const { 141 bool VaapiDrmPicture::AllowOverlay() const {
141 return true; 142 return true;
142 } 143 }
143 144
144 } // namespace media 145 } // namespace media
OLDNEW
« no previous file with comments | « gpu/ipc/service/gpu_memory_buffer_factory_surface_texture.cc ('k') | ui/gl/gl_image_ozone_native_pixmap_drm_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698