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

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: Fix Ozone builds 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
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 // static
17 gfx::GpuMemoryBufferType GpuMemoryBufferSupport::GetNativeType() {
18 #if defined(OS_MACOSX)
19 return gfx::IO_SURFACE_BUFFER;
20 #endif
21 #if defined(OS_ANDROID)
22 return gfx::SURFACE_TEXTURE_BUFFER;
23 #endif
24 #if defined(USE_OZONE)
25 return gfx::OZONE_NATIVE_PIXMAP;
26 #endif
27 return gfx::EMPTY_BUFFER;
28 }
29
30 // static
31 bool GpuMemoryBufferSupport::IsSupported(gfx::BufferFormat format,
32 gfx::BufferUsage usage) {
33 #if defined(OS_ANDROID)
34 switch (usage) {
35 case gfx::BufferUsage::GPU_READ:
36 case gfx::BufferUsage::SCANOUT:
37 return format == gfx::BufferFormat::BGRA_8888 ||
38 format == gfx::BufferFormat::RGBA_8888;
39 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
40 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT:
41 return format == gfx::BufferFormat::R_8 ||
42 format == gfx::BufferFormat::BGRA_8888 ||
43 format == gfx::BufferFormat::UYVY_422 ||
44 format == gfx::BufferFormat::YUV_420_BIPLANAR;
45 }
46 NOTREACHED();
47 return false;
48 #endif
49
50 #if defined(OS_MACOSX)
51 switch (usage) {
52 case gfx::BufferUsage::GPU_READ:
53 case gfx::BufferUsage::SCANOUT:
54 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT:
55 return false;
56 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
57 return format == gfx::BufferFormat::RGBA_8888;
58 }
59 NOTREACHED();
60 return false;
61 #endif
62
63 #if defined(USE_OZONE)
64 if (!ui::ClientNativePixmapFactory::GetInstance()) {
65 // unittests don't have to set ClientNativePixmapFactory.
66 return false;
67 }
68 return ui::ClientNativePixmapFactory::GetInstance()->IsConfigurationSupported(
69 format, usage);
70 #endif
71
72 NOTREACHED();
73 return false;
74 }
75
76 GpuMemoryBufferSupport::GpuMemoryBufferSupport() {
77 NOTREACHED();
78 }
79
80 GpuMemoryBufferSupport::~GpuMemoryBufferSupport() {
81 NOTREACHED();
82 }
83
84 } // namespace gpu
OLDNEW
« gpu/ipc/common/gpu_memory_buffer_support.h ('K') | « 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