1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_CONTROL_SERVICE_H_
#define GPU_COMMAND_BUFFER_SERVICE_GPU_CONTROL_SERVICE_H_
#include <map>
#include "base/memory/linked_ptr.h"
#include "gpu/command_buffer/common/gpu_control.h"
#include "ui/gfx/gpu_memory_buffer.h"
namespace gpu {
class GpuMemoryBufferFactory;
class GpuMemoryBufferManagerInterface;
namespace gles2 {
class MailboxManager;
class QueryManager;
}
class GPU_EXPORT GpuControlService : public GpuControl {
public:
GpuControlService(GpuMemoryBufferManagerInterface* gpu_memory_buffer_manager,
GpuMemoryBufferFactory* gpu_memory_buffer_factory,
gles2::MailboxManager* mailbox_manager,
gles2::QueryManager* query_manager);
virtual ~GpuControlService();
// Overridden from GpuControl:
virtual bool SupportsGpuMemoryBuffer() OVERRIDE;
virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(
size_t width,
size_t height,
unsigned internalformat,
int32* id) OVERRIDE;
virtual void DestroyGpuMemoryBuffer(int32 id) OVERRIDE;
virtual bool GenerateMailboxNames(unsigned num,
std::vector<gpu::Mailbox>* names) OVERRIDE;
virtual uint32 InsertSyncPoint() OVERRIDE;
virtual void SignalSyncPoint(uint32 sync_point,
const base::Closure& callback) OVERRIDE;
virtual void SignalQuery(uint32 query,
const base::Closure& callback) OVERRIDE;
virtual void SendManagedMemoryStats(const ManagedMemoryStats& stats)
OVERRIDE;
// Register an existing gpu memory buffer and get an ID that can be used
// to identify it in the command buffer.
bool RegisterGpuMemoryBuffer(int32 id,
gfx::GpuMemoryBufferHandle buffer,
size_t width,
size_t height,
unsigned internalformat);
private:
GpuMemoryBufferManagerInterface* gpu_memory_buffer_manager_;
GpuMemoryBufferFactory* gpu_memory_buffer_factory_;
gles2::MailboxManager* mailbox_manager_;
gles2::QueryManager* query_manager_;
typedef std::map<int32, linked_ptr<gfx::GpuMemoryBuffer> > GpuMemoryBufferMap;
GpuMemoryBufferMap gpu_memory_buffers_;
DISALLOW_COPY_AND_ASSIGN(GpuControlService);
};
} // namespace gpu
#endif // GPU_COMMAND_BUFFER_SERVICE_GPU_CONTROL_SERVICE_H_
|