OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
reveman
2014/08/11 19:43:06
2014
| |
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 "content/common/gpu/client/gpu_memory_buffer_impl_ozone.h" | |
6 | |
7 #include "base/numerics/safe_math.h" | |
reveman
2014/08/11 19:43:05
I don't think you need this.
achaulk
2014/08/12 19:03:57
Done.
| |
8 #include "content/common/gpu/client/gpu_memory_buffer_factory_host.h" | |
9 #include "ui/gl/gl_bindings.h" | |
10 | |
11 namespace content { | |
12 // static | |
13 uint32_t GpuMemoryBufferImplOzone::next_buffer_id_ = 0; | |
14 | |
15 GpuMemoryBufferImplOzone::GpuMemoryBufferImplOzone(const gfx::Size& size, | |
16 unsigned internalformat, | |
17 int32 client_id) | |
18 : GpuMemoryBufferImpl(size, internalformat) { | |
19 handle_.type = gfx::OZONE_NATIVE_BUFFER; | |
20 handle_.global_id.secondary_id = client_id; | |
21 } | |
22 | |
23 GpuMemoryBufferImplOzone::~GpuMemoryBufferImplOzone() { | |
24 } | |
25 | |
26 // static | |
27 void GpuMemoryBufferImplOzone::AllocateSharedMemoryForChildProcess( | |
28 const gfx::Size& size, | |
29 unsigned internalformat, | |
30 base::ProcessHandle child_process, | |
31 int client_id, | |
32 GpuMemoryBufferFactoryHost* gpu_factory_host, | |
33 const AllocationCallback& callback) { | |
34 gfx::GpuMemoryBufferHandle handle; | |
35 handle.global_id.primary_id = GetNextBufferId(); | |
36 handle.global_id.secondary_id = client_id; | |
37 handle.type = gfx::OZONE_NATIVE_BUFFER; | |
38 gpu_factory_host->CreateGpuMemoryBuffer( | |
39 handle, size, internalformat, GL_IMAGE_SCANOUT_CHROMIUM, callback); | |
reveman
2014/08/11 19:43:05
You should pass usage as a parameter to this funct
achaulk
2014/08/12 19:03:57
Isn't that what IsConfigurationSupported is for?
| |
40 } | |
41 | |
42 // static | |
43 bool GpuMemoryBufferImplOzone::IsLayoutSupported(const gfx::Size& size, | |
44 unsigned internalformat) { | |
45 return true; | |
reveman
2014/08/11 19:43:05
IsFormatSupported instead, if any size is supporte
achaulk
2014/08/12 19:03:57
Done.
| |
46 } | |
47 | |
48 // static | |
49 bool GpuMemoryBufferImplOzone::IsUsageSupported(unsigned usage) { | |
50 switch (usage) { | |
51 case GL_IMAGE_SCANOUT_CHROMIUM: | |
52 return true; | |
53 default: | |
54 return false; | |
55 } | |
56 } | |
57 | |
58 // static | |
59 bool GpuMemoryBufferImplOzone::IsConfigurationSupported(const gfx::Size& size, | |
60 unsigned internalformat, | |
61 unsigned usage) { | |
62 return IsLayoutSupported(size, internalformat) && IsUsageSupported(usage); | |
63 } | |
64 | |
65 bool GpuMemoryBufferImplOzone::Initialize() { | |
66 handle_.global_id.primary_id = GetNextBufferId(); | |
reveman
2014/08/11 19:43:06
I don't understand how this would work. How is the
achaulk
2014/08/12 19:03:57
This is for the browser path which we haven't fina
| |
67 return true; | |
68 } | |
69 | |
70 bool GpuMemoryBufferImplOzone::InitializeFromHandle( | |
71 const gfx::GpuMemoryBufferHandle& handle) { | |
72 handle_ = handle; | |
73 return true; | |
74 } | |
75 | |
76 void* GpuMemoryBufferImplOzone::Map() { | |
77 NOTREACHED(); | |
78 return NULL; | |
79 } | |
80 | |
81 void GpuMemoryBufferImplOzone::Unmap() { | |
82 NOTREACHED(); | |
83 } | |
84 | |
85 uint32 GpuMemoryBufferImplOzone::GetStride() const { | |
86 NOTREACHED(); | |
87 return 0; | |
88 } | |
89 | |
90 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplOzone::GetHandle() const { | |
91 return handle_; | |
92 } | |
93 | |
94 // static | |
95 uint32_t GpuMemoryBufferImplOzone::GetNextBufferId() { | |
96 return next_buffer_id_++; | |
97 } | |
98 | |
99 } // namespace content | |
OLD | NEW |