OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef GPU_GLES2_CONFORM_SUPPORT_EGL_DISPLAY_H_ | 5 #ifndef GPU_GLES2_CONFORM_SUPPORT_EGL_DISPLAY_H_ |
6 #define GPU_GLES2_CONFORM_SUPPORT_EGL_DISPLAY_H_ | 6 #define GPU_GLES2_CONFORM_SUPPORT_EGL_DISPLAY_H_ |
7 | 7 |
8 #include <EGL/egl.h> | 8 #include <EGL/egl.h> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 11 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
| 12 #include "gpu/command_buffer/client/gpu_control.h" |
12 #include "gpu/command_buffer/service/command_buffer_service.h" | 13 #include "gpu/command_buffer/service/command_buffer_service.h" |
13 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 15 #include "gpu/command_buffer/service/gpu_control_service.h" |
14 #include "gpu/command_buffer/service/gpu_scheduler.h" | 16 #include "gpu/command_buffer/service/gpu_scheduler.h" |
15 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
16 #include "ui/gl/gl_context.h" | 18 #include "ui/gl/gl_context.h" |
17 #include "ui/gl/gl_surface.h" | 19 #include "ui/gl/gl_surface.h" |
18 | 20 |
19 namespace gpu { | 21 namespace gpu { |
20 class CommandBufferService; | 22 class CommandBufferService; |
21 class GpuControl; | 23 class GpuControl; |
22 class GpuScheduler; | 24 class GpuScheduler; |
23 class TransferBuffer; | 25 class TransferBuffer; |
24 class TransferBufferManagerInterface; | 26 class TransferBufferManagerInterface; |
25 | 27 |
26 namespace gles2 { | 28 namespace gles2 { |
27 class GLES2CmdHelper; | 29 class GLES2CmdHelper; |
28 class GLES2Implementation; | 30 class GLES2Implementation; |
29 } // namespace gles2 | 31 } // namespace gles2 |
30 } // namespace gpu | 32 } // namespace gpu |
31 | 33 |
32 namespace egl { | 34 namespace egl { |
33 | 35 |
34 class Config; | 36 class Config; |
35 class Surface; | 37 class Surface; |
36 | 38 |
37 class Display { | 39 class Display : private gpu::GpuControl { |
38 public: | 40 public: |
39 explicit Display(EGLNativeDisplayType display_id); | 41 explicit Display(EGLNativeDisplayType display_id); |
40 virtual ~Display(); | 42 virtual ~Display(); |
41 | 43 |
42 void SetCreateOffscreen(int width, int height) { | 44 void SetCreateOffscreen(int width, int height) { |
43 create_offscreen_ = true; | 45 create_offscreen_ = true; |
44 create_offscreen_width_ = width; | 46 create_offscreen_width_ = width; |
45 create_offscreen_height_ = height; | 47 create_offscreen_height_ = height; |
46 } | 48 } |
47 | 49 |
(...skipping 17 matching lines...) Expand all Loading... |
65 void SwapBuffers(EGLSurface surface); | 67 void SwapBuffers(EGLSurface surface); |
66 | 68 |
67 // Context routines. | 69 // Context routines. |
68 bool IsValidContext(EGLContext ctx); | 70 bool IsValidContext(EGLContext ctx); |
69 EGLContext CreateContext(EGLConfig config, | 71 EGLContext CreateContext(EGLConfig config, |
70 EGLContext share_ctx, | 72 EGLContext share_ctx, |
71 const EGLint* attrib_list); | 73 const EGLint* attrib_list); |
72 void DestroyContext(EGLContext ctx); | 74 void DestroyContext(EGLContext ctx); |
73 bool MakeCurrent(EGLSurface draw, EGLSurface read, EGLContext ctx); | 75 bool MakeCurrent(EGLSurface draw, EGLSurface read, EGLContext ctx); |
74 | 76 |
| 77 // GpuControl implementation. |
| 78 virtual gpu::Capabilities GetCapabilities() OVERRIDE; |
| 79 virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(size_t width, |
| 80 size_t height, |
| 81 unsigned internalformat, |
| 82 int32* id) OVERRIDE; |
| 83 virtual void DestroyGpuMemoryBuffer(int32 id) OVERRIDE; |
| 84 virtual uint32 InsertSyncPoint() OVERRIDE; |
| 85 virtual void SignalSyncPoint(uint32 sync_point, |
| 86 const base::Closure& callback) OVERRIDE; |
| 87 virtual void SignalQuery(uint32 query, |
| 88 const base::Closure& callback) OVERRIDE; |
| 89 virtual void SetSurfaceVisible(bool visible) OVERRIDE; |
| 90 virtual void SendManagedMemoryStats( |
| 91 const gpu::ManagedMemoryStats& stats) OVERRIDE; |
| 92 virtual void Echo(const base::Closure& callback) OVERRIDE; |
| 93 virtual uint32 CreateStreamTexture(uint32 texture_id) OVERRIDE; |
| 94 |
75 private: | 95 private: |
76 EGLNativeDisplayType display_id_; | 96 EGLNativeDisplayType display_id_; |
77 | 97 |
78 bool is_initialized_; | 98 bool is_initialized_; |
79 bool create_offscreen_; | 99 bool create_offscreen_; |
80 int create_offscreen_width_; | 100 int create_offscreen_width_; |
81 int create_offscreen_height_; | 101 int create_offscreen_height_; |
82 | 102 |
83 scoped_ptr<gpu::TransferBufferManagerInterface> transfer_buffer_manager_; | 103 scoped_ptr<gpu::TransferBufferManagerInterface> transfer_buffer_manager_; |
84 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 104 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
85 scoped_ptr<gpu::GpuScheduler> gpu_scheduler_; | 105 scoped_ptr<gpu::GpuScheduler> gpu_scheduler_; |
86 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; | 106 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; |
87 scoped_ptr<gpu::GpuControl> gpu_control_; | 107 scoped_ptr<gpu::GpuControlService> gpu_control_service_; |
88 scoped_refptr<gfx::GLContext> gl_context_; | 108 scoped_refptr<gfx::GLContext> gl_context_; |
89 scoped_refptr<gfx::GLSurface> gl_surface_; | 109 scoped_refptr<gfx::GLSurface> gl_surface_; |
90 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_cmd_helper_; | 110 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_cmd_helper_; |
91 scoped_ptr<gpu::TransferBuffer> transfer_buffer_; | 111 scoped_ptr<gpu::TransferBuffer> transfer_buffer_; |
92 | 112 |
93 // TODO(alokp): Support more than one config, surface, and context. | 113 // TODO(alokp): Support more than one config, surface, and context. |
94 scoped_ptr<Config> config_; | 114 scoped_ptr<Config> config_; |
95 scoped_ptr<Surface> surface_; | 115 scoped_ptr<Surface> surface_; |
96 scoped_ptr<gpu::gles2::GLES2Implementation> context_; | 116 scoped_ptr<gpu::gles2::GLES2Implementation> context_; |
97 | 117 |
98 DISALLOW_COPY_AND_ASSIGN(Display); | 118 DISALLOW_COPY_AND_ASSIGN(Display); |
99 }; | 119 }; |
100 | 120 |
101 } // namespace egl | 121 } // namespace egl |
102 | 122 |
103 #endif // GPU_GLES2_CONFORM_SUPPORT_EGL_DISPLAY_H_ | 123 #endif // GPU_GLES2_CONFORM_SUPPORT_EGL_DISPLAY_H_ |
OLD | NEW |