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" |
(...skipping 20 matching lines...) Expand all Loading... |
31 } // namespace gpu | 31 } // namespace gpu |
32 | 32 |
33 namespace egl { | 33 namespace egl { |
34 | 34 |
35 class Config; | 35 class Config; |
36 class Surface; | 36 class Surface; |
37 | 37 |
38 class Display : private gpu::GpuControl { | 38 class Display : private gpu::GpuControl { |
39 public: | 39 public: |
40 explicit Display(EGLNativeDisplayType display_id); | 40 explicit Display(EGLNativeDisplayType display_id); |
41 virtual ~Display(); | 41 ~Display() override; |
42 | 42 |
43 void SetCreateOffscreen(int width, int height) { | 43 void SetCreateOffscreen(int width, int height) { |
44 create_offscreen_ = true; | 44 create_offscreen_ = true; |
45 create_offscreen_width_ = width; | 45 create_offscreen_width_ = width; |
46 create_offscreen_height_ = height; | 46 create_offscreen_height_ = height; |
47 } | 47 } |
48 | 48 |
49 bool is_initialized() const { return is_initialized_; } | 49 bool is_initialized() const { return is_initialized_; } |
50 bool Initialize(); | 50 bool Initialize(); |
51 | 51 |
(...skipping 15 matching lines...) Expand all Loading... |
67 | 67 |
68 // Context routines. | 68 // Context routines. |
69 bool IsValidContext(EGLContext ctx); | 69 bool IsValidContext(EGLContext ctx); |
70 EGLContext CreateContext(EGLConfig config, | 70 EGLContext CreateContext(EGLConfig config, |
71 EGLContext share_ctx, | 71 EGLContext share_ctx, |
72 const EGLint* attrib_list); | 72 const EGLint* attrib_list); |
73 void DestroyContext(EGLContext ctx); | 73 void DestroyContext(EGLContext ctx); |
74 bool MakeCurrent(EGLSurface draw, EGLSurface read, EGLContext ctx); | 74 bool MakeCurrent(EGLSurface draw, EGLSurface read, EGLContext ctx); |
75 | 75 |
76 // GpuControl implementation. | 76 // GpuControl implementation. |
77 virtual gpu::Capabilities GetCapabilities() override; | 77 gpu::Capabilities GetCapabilities() override; |
78 virtual int32_t CreateImage(ClientBuffer buffer, | 78 int32_t CreateImage(ClientBuffer buffer, |
79 size_t width, | 79 size_t width, |
80 size_t height, | 80 size_t height, |
81 unsigned internalformat) override; | 81 unsigned internalformat) override; |
82 virtual void DestroyImage(int32_t id) override; | 82 void DestroyImage(int32_t id) override; |
83 virtual int32_t CreateGpuMemoryBufferImage(size_t width, | 83 int32_t CreateGpuMemoryBufferImage(size_t width, |
84 size_t height, | 84 size_t height, |
85 unsigned internalformat, | 85 unsigned internalformat, |
86 unsigned usage) override; | 86 unsigned usage) override; |
87 virtual uint32 InsertSyncPoint() override; | 87 uint32 InsertSyncPoint() override; |
88 virtual uint32 InsertFutureSyncPoint() override; | 88 uint32 InsertFutureSyncPoint() override; |
89 virtual void RetireSyncPoint(uint32 sync_point) override; | 89 void RetireSyncPoint(uint32 sync_point) override; |
90 virtual void SignalSyncPoint(uint32 sync_point, | 90 void SignalSyncPoint(uint32 sync_point, |
91 const base::Closure& callback) override; | 91 const base::Closure& callback) override; |
92 virtual void SignalQuery(uint32 query, | 92 void SignalQuery(uint32 query, const base::Closure& callback) override; |
93 const base::Closure& callback) override; | 93 void SetSurfaceVisible(bool visible) override; |
94 virtual void SetSurfaceVisible(bool visible) override; | 94 uint32 CreateStreamTexture(uint32 texture_id) override; |
95 virtual uint32 CreateStreamTexture(uint32 texture_id) override; | |
96 | 95 |
97 private: | 96 private: |
98 EGLNativeDisplayType display_id_; | 97 EGLNativeDisplayType display_id_; |
99 | 98 |
100 bool is_initialized_; | 99 bool is_initialized_; |
101 bool create_offscreen_; | 100 bool create_offscreen_; |
102 int create_offscreen_width_; | 101 int create_offscreen_width_; |
103 int create_offscreen_height_; | 102 int create_offscreen_height_; |
104 | 103 |
105 scoped_ptr<gpu::TransferBufferManagerInterface> transfer_buffer_manager_; | 104 scoped_ptr<gpu::TransferBufferManagerInterface> transfer_buffer_manager_; |
106 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 105 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
107 scoped_ptr<gpu::GpuScheduler> gpu_scheduler_; | 106 scoped_ptr<gpu::GpuScheduler> gpu_scheduler_; |
108 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; | 107 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; |
109 scoped_refptr<gfx::GLContext> gl_context_; | 108 scoped_refptr<gfx::GLContext> gl_context_; |
110 scoped_refptr<gfx::GLSurface> gl_surface_; | 109 scoped_refptr<gfx::GLSurface> gl_surface_; |
111 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_cmd_helper_; | 110 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_cmd_helper_; |
112 scoped_ptr<gpu::TransferBuffer> transfer_buffer_; | 111 scoped_ptr<gpu::TransferBuffer> transfer_buffer_; |
113 | 112 |
114 // TODO(alokp): Support more than one config, surface, and context. | 113 // TODO(alokp): Support more than one config, surface, and context. |
115 scoped_ptr<Config> config_; | 114 scoped_ptr<Config> config_; |
116 scoped_ptr<Surface> surface_; | 115 scoped_ptr<Surface> surface_; |
117 scoped_ptr<gpu::gles2::GLES2Implementation> context_; | 116 scoped_ptr<gpu::gles2::GLES2Implementation> context_; |
118 | 117 |
119 DISALLOW_COPY_AND_ASSIGN(Display); | 118 DISALLOW_COPY_AND_ASSIGN(Display); |
120 }; | 119 }; |
121 | 120 |
122 } // namespace egl | 121 } // namespace egl |
123 | 122 |
124 #endif // GPU_GLES2_CONFORM_SUPPORT_EGL_DISPLAY_H_ | 123 #endif // GPU_GLES2_CONFORM_SUPPORT_EGL_DISPLAY_H_ |
OLD | NEW |