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

Side by Side Diff: gpu/gles2_conform_support/egl/display.h

Issue 1900703002: Revert of command_buffer_gles2: Implement EGL default Display as a global object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@command_buffer_gles2-multiple-contexts
Patch Set: Created 4 years, 8 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
« no previous file with comments | « gpu/gles2_conform_support/egl/context.cc ('k') | gpu/gles2_conform_support/egl/display.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
11 11
12 #include <vector> 12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
15 #include "gpu/command_buffer/client/gpu_control.h"
16 #include "gpu/command_buffer/service/command_buffer_service.h"
17 #include "gpu/command_buffer/service/command_executor.h"
18 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
19 #include "gpu/command_buffer/service/gpu_preferences.h"
20 #include "ui/gfx/native_widget_types.h"
21 #include "ui/gl/gl_context.h"
22 #include "ui/gl/gl_surface.h"
13 23
14 #include "base/macros.h" 24 namespace gpu {
15 #include "base/memory/ref_counted.h" 25 class CommandBufferService;
16 #include "base/memory/scoped_ptr.h" 26 class GpuControl;
17 #include "base/synchronization/lock.h" 27 class CommandExecutor;
28 class TransferBuffer;
29 class TransferBufferManagerInterface;
30
31 namespace gles2 {
32 class GLES2CmdHelper;
33 class GLES2Implementation;
34 } // namespace gles2
35 } // namespace gpu
18 36
19 namespace egl { 37 namespace egl {
20 38
21 class Config; 39 class Config;
22 class Context;
23 class Surface; 40 class Surface;
24 class ThreadState;
25 41
26 class Display { 42 class Display : private gpu::GpuControl {
27 public: 43 public:
28 explicit Display(); 44 explicit Display(EGLNativeDisplayType display_id);
29 ~Display(); 45 ~Display() override;
46
47 void SetCreateOffscreen(int width, int height) {
48 create_offscreen_ = true;
49 create_offscreen_width_ = width;
50 create_offscreen_height_ = height;
51 }
30 52
31 bool is_initialized() const { return is_initialized_; } 53 bool is_initialized() const { return is_initialized_; }
32 54 bool Initialize();
33 void ReleaseCurrentForReleaseThread(ThreadState*);
34
35 // A function for windowless GTF tests.
36 void SetNextCreateWindowSurfaceCreatesPBuffer(EGLint width, EGLint height);
37
38 EGLBoolean Initialize(ThreadState* ts, EGLint* major, EGLint* minor);
39 EGLBoolean Terminate(ThreadState* ts);
40 const char* QueryString(ThreadState* ts, EGLint name);
41 55
42 // Config routines. 56 // Config routines.
43 EGLBoolean GetConfigAttrib(ThreadState* ts, 57 bool IsValidConfig(EGLConfig config);
44 EGLConfig cfg, 58 bool ChooseConfigs(
45 EGLint attribute, 59 EGLConfig* configs, EGLint config_size, EGLint* num_config);
46 EGLint* value); 60 bool GetConfigs(EGLConfig* configs, EGLint config_size, EGLint* num_config);
47 EGLBoolean ChooseConfig(ThreadState* ts, 61 bool GetConfigAttrib(EGLConfig config, EGLint attribute, EGLint* value);
48 const EGLint* attrib_list,
49 EGLConfig* configs,
50 EGLint config_size,
51 EGLint* num_config);
52 EGLBoolean GetConfigs(ThreadState*,
53 EGLConfig*,
54 EGLint config_size,
55 EGLint* num_config);
56 62
57 // Surface routines. 63 // Surface routines.
58 static bool IsValidNativeWindow(EGLNativeWindowType); 64 bool IsValidNativeWindow(EGLNativeWindowType win);
59 EGLSurface CreatePbufferSurface(ThreadState*, 65 bool IsValidSurface(EGLSurface surface);
60 EGLConfig, 66 EGLSurface CreateWindowSurface(EGLConfig config,
61 const EGLint* attrib_list);
62 EGLSurface CreateWindowSurface(ThreadState*,
63 EGLConfig,
64 EGLNativeWindowType win, 67 EGLNativeWindowType win,
65 const EGLint* attrib_list); 68 const EGLint* attrib_list);
66 EGLBoolean DestroySurface(ThreadState*, EGLSurface); 69 void DestroySurface(EGLSurface surface);
67 EGLBoolean SwapBuffers(ThreadState*, EGLSurface); 70 void SwapBuffers(EGLSurface surface);
68 71
69 // Context routines. 72 // Context routines.
70 EGLContext CreateContext(ThreadState*, 73 bool IsValidContext(EGLContext ctx);
71 EGLConfig, 74 EGLContext CreateContext(EGLConfig config,
72 EGLSurface share_ctx, 75 EGLContext share_ctx,
73 const EGLint* attrib_list); 76 const EGLint* attrib_list);
74 EGLBoolean DestroyContext(ThreadState*, EGLContext); 77 void DestroyContext(EGLContext ctx);
78 bool MakeCurrent(EGLSurface draw, EGLSurface read, EGLContext ctx);
75 79
76 EGLBoolean ReleaseCurrent(ThreadState*); 80 // GpuControl implementation.
77 EGLBoolean MakeCurrent(ThreadState*, EGLSurface, EGLSurface, EGLContext); 81 void SetGpuControlClient(gpu::GpuControlClient*) override;
78 82 gpu::Capabilities GetCapabilities() override;
79 uint64_t GenerateFenceSyncRelease(); 83 int32_t CreateImage(ClientBuffer buffer,
80 bool IsFenceSyncRelease(uint64_t release); 84 size_t width,
81 bool IsFenceSyncFlushed(uint64_t release); 85 size_t height,
82 bool IsFenceSyncFlushReceived(uint64_t release); 86 unsigned internalformat) override;
87 void DestroyImage(int32_t id) override;
88 int32_t CreateGpuMemoryBufferImage(size_t width,
89 size_t height,
90 unsigned internalformat,
91 unsigned usage) override;
92 void SignalQuery(uint32_t query, const base::Closure& callback) override;
93 void SetLock(base::Lock*) override;
94 bool IsGpuChannelLost() override;
95 void EnsureWorkVisible() override;
96 gpu::CommandBufferNamespace GetNamespaceID() const override;
97 gpu::CommandBufferId GetCommandBufferID() const override;
98 int32_t GetExtraCommandBufferData() const override;
99 uint64_t GenerateFenceSyncRelease() override;
100 bool IsFenceSyncRelease(uint64_t release) override;
101 bool IsFenceSyncFlushed(uint64_t release) override;
102 bool IsFenceSyncFlushReceived(uint64_t release) override;
103 void SignalSyncToken(const gpu::SyncToken& sync_token,
104 const base::Closure& callback) override;
105 bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override;
83 106
84 private: 107 private:
85 void InitializeConfigsIfNeeded(); 108 EGLNativeDisplayType display_id_;
86 const Config* GetConfig(EGLConfig);
87 Surface* GetSurface(EGLSurface);
88 Context* GetContext(EGLContext);
89 EGLSurface DoCreatePbufferSurface(ThreadState* ts,
90 EGLint width,
91 EGLint height);
92 109
93 base::Lock lock_; 110 gpu::GpuPreferences gpu_preferences_;
94 bool is_initialized_; 111 bool is_initialized_;
112
113 bool create_offscreen_;
114 int create_offscreen_width_;
115 int create_offscreen_height_;
95 uint64_t next_fence_sync_release_; 116 uint64_t next_fence_sync_release_;
96 std::vector<scoped_refptr<Surface>> surfaces_;
97 std::vector<scoped_refptr<Context>> contexts_;
98 scoped_ptr<Config> configs_[2];
99 117
100 // GTF windowless support. 118 scoped_refptr<gpu::TransferBufferManagerInterface> transfer_buffer_manager_;
101 bool next_create_window_surface_creates_pbuffer_; 119 scoped_ptr<gpu::CommandBufferService> command_buffer_;
102 EGLint window_surface_pbuffer_width_; 120 scoped_ptr<gpu::CommandExecutor> executor_;
103 EGLint window_surface_pbuffer_height_; 121 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_;
122 scoped_refptr<gfx::GLContext> gl_context_;
123 scoped_refptr<gfx::GLSurface> gl_surface_;
124 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_cmd_helper_;
125 scoped_ptr<gpu::TransferBuffer> transfer_buffer_;
126
127 // TODO(alokp): Support more than one config, surface, and context.
128 scoped_ptr<Config> config_;
129 scoped_ptr<Surface> surface_;
130 scoped_ptr<gpu::gles2::GLES2Implementation> context_;
104 131
105 DISALLOW_COPY_AND_ASSIGN(Display); 132 DISALLOW_COPY_AND_ASSIGN(Display);
106 }; 133 };
107 134
108 } // namespace egl 135 } // namespace egl
109 136
110 #endif // GPU_GLES2_CONFORM_SUPPORT_EGL_DISPLAY_H_ 137 #endif // GPU_GLES2_CONFORM_SUPPORT_EGL_DISPLAY_H_
OLDNEW
« no previous file with comments | « gpu/gles2_conform_support/egl/context.cc ('k') | gpu/gles2_conform_support/egl/display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698