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

Side by Side Diff: gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.cc

Issue 2705213005: Add NativePixmapDmabufStub to finalize glCreateImageCHROMIUM on Linux. (Closed)
Patch Set: Just rebase Created 3 years, 6 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
« no previous file with comments | « gpu/ipc/service/BUILD.gn ('k') | ui/gfx/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.h" 5 #include "gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.h"
6 6
7 #include "ui/gfx/client_native_pixmap.h" 7 #include "ui/gfx/client_native_pixmap.h"
8 #include "ui/gfx/native_pixmap.h" 8 #include "ui/gfx/native_pixmap.h"
9 #include "ui/gl/gl_image_native_pixmap.h" 9 #include "ui/gl/gl_image_native_pixmap.h"
10 10
11 #if defined(USE_OZONE) 11 #if defined(USE_OZONE)
12 #include "ui/ozone/public/ozone_platform.h" 12 #include "ui/ozone/public/ozone_platform.h"
13 #include "ui/ozone/public/surface_factory_ozone.h" 13 #include "ui/ozone/public/surface_factory_ozone.h"
14 #elif defined(OS_LINUX)
15 #include "ui/gfx/linux/native_pixmap_dmabuf.h"
14 #endif 16 #endif
15 17
16 namespace gpu { 18 namespace gpu {
17 19
18 GpuMemoryBufferFactoryNativePixmap::GpuMemoryBufferFactoryNativePixmap() {} 20 GpuMemoryBufferFactoryNativePixmap::GpuMemoryBufferFactoryNativePixmap() {}
19 21
20 GpuMemoryBufferFactoryNativePixmap::~GpuMemoryBufferFactoryNativePixmap() {} 22 GpuMemoryBufferFactoryNativePixmap::~GpuMemoryBufferFactoryNativePixmap() {}
21 23
22 gfx::GpuMemoryBufferHandle 24 gfx::GpuMemoryBufferHandle
23 GpuMemoryBufferFactoryNativePixmap::CreateGpuMemoryBuffer( 25 GpuMemoryBufferFactoryNativePixmap::CreateGpuMemoryBuffer(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 96 }
95 97
96 // Create new pixmap from handle if one doesn't already exist. 98 // Create new pixmap from handle if one doesn't already exist.
97 if (!pixmap) { 99 if (!pixmap) {
98 #if defined(USE_OZONE) 100 #if defined(USE_OZONE)
99 pixmap = ui::OzonePlatform::GetInstance() 101 pixmap = ui::OzonePlatform::GetInstance()
100 ->GetSurfaceFactoryOzone() 102 ->GetSurfaceFactoryOzone()
101 ->CreateNativePixmapFromHandle(surface_handle, size, format, 103 ->CreateNativePixmapFromHandle(surface_handle, size, format,
102 handle.native_pixmap_handle); 104 handle.native_pixmap_handle);
103 #else 105 #else
104 // TODO(j.isorce): implement this to enable glCreateImageCHROMIUM on Linux. 106 scoped_refptr<gfx::NativePixmapDmabufHelper> pixmap_helper =
105 // On going in http://codereview.chromium.org/2705213005, crbug.com/584248. 107 make_scoped_refptr(
106 NOTIMPLEMENTED(); 108 new gfx::NativePixmapDmabufHelper(handle.native_pixmap_handle));
109
110 pixmap = make_scoped_refptr(
111 new gfx::NativePixmapDmaBuf(size, format, pixmap_helper));
107 #endif 112 #endif
108 if (!pixmap.get()) { 113 if (!pixmap.get()) {
109 DLOG(ERROR) << "Failed to create pixmap from handle"; 114 DLOG(ERROR) << "Failed to create pixmap from handle";
110 return nullptr; 115 return nullptr;
111 } 116 }
112 } else { 117 } else {
113 for (const auto& fd : handle.native_pixmap_handle.fds) { 118 for (const auto& fd : handle.native_pixmap_handle.fds) {
114 // Close the fd by wrapping it in a ScopedFD and letting it fall 119 // Close the fd by wrapping it in a ScopedFD and letting it fall
115 // out of scope. 120 // out of scope.
116 base::ScopedFD scoped_fd(fd.fd); 121 base::ScopedFD scoped_fd(fd.fd);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return nullptr; 159 return nullptr;
155 } 160 }
156 return image; 161 return image;
157 } 162 }
158 163
159 unsigned GpuMemoryBufferFactoryNativePixmap::RequiredTextureType() { 164 unsigned GpuMemoryBufferFactoryNativePixmap::RequiredTextureType() {
160 return GL_TEXTURE_EXTERNAL_OES; 165 return GL_TEXTURE_EXTERNAL_OES;
161 } 166 }
162 167
163 } // namespace gpu 168 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/BUILD.gn ('k') | ui/gfx/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698