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

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

Issue 2717963002: ui: Add gfx::BufferUsage::SCANOUT_CPU_READ_WRITE. (Closed)
Patch Set: SCANOUT_CPU_READ_WRITE as valid shm usage Created 3 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
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(USE_OZONE)
(...skipping 13 matching lines...) Expand all
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 return format == gfx::BufferFormat::BGRA_8888 || 35 return format == gfx::BufferFormat::BGRA_8888 ||
35 format == gfx::BufferFormat::RGBA_8888 || 36 format == gfx::BufferFormat::RGBA_8888 ||
36 format == gfx::BufferFormat::BGRX_8888; 37 format == gfx::BufferFormat::BGRX_8888;
37 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: 38 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
38 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: 39 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT:
39 return format == gfx::BufferFormat::R_8 || 40 return format == gfx::BufferFormat::R_8 ||
40 format == gfx::BufferFormat::BGRA_8888 || 41 format == gfx::BufferFormat::BGRA_8888 ||
41 format == gfx::BufferFormat::UYVY_422 || 42 format == gfx::BufferFormat::UYVY_422 ||
42 format == gfx::BufferFormat::YUV_420_BIPLANAR; 43 format == gfx::BufferFormat::YUV_420_BIPLANAR;
43 } 44 }
44 NOTREACHED(); 45 NOTREACHED();
45 return false; 46 return false;
46 #endif 47 #endif
47 48
48 #if defined(USE_OZONE) 49 #if defined(USE_OZONE)
49 if (!ui::ClientNativePixmapFactory::GetInstance()) { 50 if (!ui::ClientNativePixmapFactory::GetInstance()) {
50 // unittests don't have to set ClientNativePixmapFactory. 51 // unittests don't have to set ClientNativePixmapFactory.
51 return false; 52 return false;
52 } 53 }
53 return ui::ClientNativePixmapFactory::GetInstance()->IsConfigurationSupported( 54 return ui::ClientNativePixmapFactory::GetInstance()->IsConfigurationSupported(
54 format, usage); 55 format, usage);
55 #endif 56 #endif
56 57
57 NOTREACHED(); 58 NOTREACHED();
58 return false; 59 return false;
59 } 60 }
60 61
61 } // namespace gpu 62 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/gpu_memory_buffer_impl_test_template.h ('k') | gpu/ipc/host/gpu_memory_buffer_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698