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

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

Issue 1831513003: Pull gpu service/client shared memory buffer code to GpuMemoryBufferSupport (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed ifdef mixup Created 4 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
« no previous file with comments | « gpu/ipc/common/gpu_memory_buffer_support.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
6
7 #include "base/logging.h"
8 #include "build/build_config.h"
9
10 #if defined(USE_OZONE)
11 #include "ui/ozone/public/client_native_pixmap_factory.h"
12 #endif
13
14 namespace gpu {
15
16 gfx::GpuMemoryBufferType GetNativeGpuMemoryBufferType() {
17 #if defined(OS_MACOSX)
18 return gfx::IO_SURFACE_BUFFER;
19 #endif
20 #if defined(OS_ANDROID)
dcheng 2016/03/23 23:42:12 elif? Or are these not mutually exclusive?
Fady Samuel 2016/03/23 23:49:54 They are mutually exclusive. Done.
21 return gfx::SURFACE_TEXTURE_BUFFER;
22 #endif
23 #if defined(USE_OZONE)
24 return gfx::OZONE_NATIVE_PIXMAP;
25 #endif
26 return gfx::EMPTY_BUFFER;
27 }
28
29 bool IsNativeGpuMemoryBufferConfigurationSupported(gfx::BufferFormat format,
30 gfx::BufferUsage usage) {
31 #if defined(OS_MACOSX)
32 switch (usage) {
33 case gfx::BufferUsage::GPU_READ:
34 case gfx::BufferUsage::SCANOUT:
35 return format == gfx::BufferFormat::BGRA_8888 ||
36 format == gfx::BufferFormat::RGBA_8888;
37 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
38 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT:
39 return format == gfx::BufferFormat::R_8 ||
40 format == gfx::BufferFormat::BGRA_8888 ||
41 format == gfx::BufferFormat::UYVY_422 ||
42 format == gfx::BufferFormat::YUV_420_BIPLANAR;
43 }
44 NOTREACHED();
45 return false;
46 #endif
dcheng 2016/03/23 23:42:12 Similar comment here about #elif
Fady Samuel 2016/03/23 23:49:54 Done.
47
48 #if defined(OS_ANDROID)
49 switch (usage) {
50 case gfx::BufferUsage::GPU_READ:
51 case gfx::BufferUsage::SCANOUT:
52 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT:
53 return false;
54 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
55 return format == gfx::BufferFormat::RGBA_8888;
56 }
57 NOTREACHED();
58 return false;
59 #endif
60
61 #if defined(USE_OZONE)
62 if (!ui::ClientNativePixmapFactory::GetInstance()) {
63 // unittests don't have to set ClientNativePixmapFactory.
64 return false;
65 }
66 return ui::ClientNativePixmapFactory::GetInstance()->IsConfigurationSupported(
67 format, usage);
68 #endif
69
70 NOTREACHED();
71 return false;
72 }
73
74 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/common/gpu_memory_buffer_support.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698