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

Side by Side Diff: gpu/ipc/common/gpu_memory_buffer_support.cc

Issue 2709163004: Rename GpuMemoryBufferFactoryOzoneNativePixmap to GpuMemoryBufferFactoryNativePixmap (Closed)
Patch Set: Rebase and addressed reveman's remark. Created 3 years, 8 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/client/gpu_memory_buffer_impl_native_pixmap.cc ('k') | gpu/ipc/service/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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/common/gpu_memory_buffer_support.h" 5 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #if defined(USE_OZONE) 10 #if defined(OS_LINUX)
11 #include "ui/ozone/public/client_native_pixmap_factory_ozone.h" 11 #include "ui/gfx/client_native_pixmap_factory.h"
12 #endif 12 #endif
13 13
14 namespace gpu { 14 namespace gpu {
15 15
16 gfx::GpuMemoryBufferType GetNativeGpuMemoryBufferType() { 16 gfx::GpuMemoryBufferType GetNativeGpuMemoryBufferType() {
17 #if defined(OS_MACOSX) 17 #if defined(OS_MACOSX)
18 return gfx::IO_SURFACE_BUFFER; 18 return gfx::IO_SURFACE_BUFFER;
19 #endif 19 #endif
20 #if defined(USE_OZONE) 20 #if defined(OS_LINUX)
21 return gfx::NATIVE_PIXMAP; 21 return gfx::NATIVE_PIXMAP;
22 #endif 22 #endif
23 return gfx::EMPTY_BUFFER; 23 return gfx::EMPTY_BUFFER;
24 } 24 }
25 25
26 bool IsNativeGpuMemoryBufferConfigurationSupported(gfx::BufferFormat format, 26 bool IsNativeGpuMemoryBufferConfigurationSupported(gfx::BufferFormat format,
27 gfx::BufferUsage usage) { 27 gfx::BufferUsage usage) {
28 DCHECK_NE(gfx::SHARED_MEMORY_BUFFER, GetNativeGpuMemoryBufferType()); 28 DCHECK_NE(gfx::SHARED_MEMORY_BUFFER, GetNativeGpuMemoryBufferType());
29 DCHECK_NE(gfx::EMPTY_BUFFER, GetNativeGpuMemoryBufferType()); 29 DCHECK_NE(gfx::EMPTY_BUFFER, GetNativeGpuMemoryBufferType());
30 #if defined(OS_MACOSX) 30 #if defined(OS_MACOSX)
31 switch (usage) { 31 switch (usage) {
32 case gfx::BufferUsage::GPU_READ: 32 case gfx::BufferUsage::GPU_READ:
33 case gfx::BufferUsage::SCANOUT: 33 case gfx::BufferUsage::SCANOUT:
34 case gfx::BufferUsage::SCANOUT_CPU_READ_WRITE: 34 case gfx::BufferUsage::SCANOUT_CPU_READ_WRITE:
35 return format == gfx::BufferFormat::BGRA_8888 || 35 return format == gfx::BufferFormat::BGRA_8888 ||
36 format == gfx::BufferFormat::RGBA_8888 || 36 format == gfx::BufferFormat::RGBA_8888 ||
37 format == gfx::BufferFormat::BGRX_8888; 37 format == gfx::BufferFormat::BGRX_8888;
38 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: 38 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
39 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: 39 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT:
40 return format == gfx::BufferFormat::R_8 || 40 return format == gfx::BufferFormat::R_8 ||
41 format == gfx::BufferFormat::BGRA_8888 || 41 format == gfx::BufferFormat::BGRA_8888 ||
42 format == gfx::BufferFormat::RGBA_F16 || 42 format == gfx::BufferFormat::RGBA_F16 ||
43 format == gfx::BufferFormat::UYVY_422 || 43 format == gfx::BufferFormat::UYVY_422 ||
44 format == gfx::BufferFormat::YUV_420_BIPLANAR; 44 format == gfx::BufferFormat::YUV_420_BIPLANAR;
45 } 45 }
46 NOTREACHED(); 46 NOTREACHED();
47 return false; 47 return false;
48 #endif 48 #endif
49 49
50 #if defined(USE_OZONE) 50 #if defined(OS_LINUX)
51 if (!gfx::ClientNativePixmapFactory::GetInstance()) { 51 if (!gfx::ClientNativePixmapFactory::GetInstance()) {
52 // unittests don't have to set ClientNativePixmapFactory. 52 // unittests don't have to set ClientNativePixmapFactory.
53 return false; 53 return false;
54 } 54 }
55 return gfx::ClientNativePixmapFactory::GetInstance() 55 return gfx::ClientNativePixmapFactory::GetInstance()
56 ->IsConfigurationSupported(format, usage); 56 ->IsConfigurationSupported(format, usage);
57 #endif 57 #endif
58 58
59 NOTREACHED(); 59 NOTREACHED();
60 return false; 60 return false;
61 } 61 }
62 62
63 } // namespace gpu 63 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/gpu_memory_buffer_impl_native_pixmap.cc ('k') | gpu/ipc/service/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698