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

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

Issue 1900563007: 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/config.cc ('k') | gpu/gles2_conform_support/egl/context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef GPU_GLES2_CONFORM_TEST_CONTEXT_H_
6 #define GPU_GLES2_CONFORM_TEST_CONTEXT_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
13 #include "gpu/command_buffer/client/gpu_control.h"
14 #include "gpu/command_buffer/service/command_buffer_service.h"
15 #include "gpu/command_buffer/service/command_executor.h"
16 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
17 #include "gpu/command_buffer/service/gpu_preferences.h"
18 #include "gpu/config/gpu_driver_bug_workarounds.h"
19 #include "ui/gfx/native_widget_types.h"
20 #include "ui/gl/gl_context.h"
21 #include "ui/gl/gl_context.h"
22 #include "ui/gl/gl_surface.h"
23 #include "ui/gl/gl_surface.h"
24 #include <EGL/egl.h>
25
26 namespace gpu {
27 class TransferBuffer;
28 class TransferBufferManagerInterface;
29
30 namespace gles2 {
31 class GLES2CmdHelper;
32 class GLES2Interface;
33 } // namespace gles2
34 } // namespace gpu
35
36 namespace egl {
37 class Display;
38 class Surface;
39 class Config;
40
41 class Context : public base::RefCountedThreadSafe<Context>,
42 private gpu::GpuControl {
43 public:
44 Context(Display* display, const Config* config);
45 bool is_current_in_some_thread() const { return is_current_in_some_thread_; }
46 void set_is_current_in_some_thread(bool flag) {
47 is_current_in_some_thread_ = flag;
48 }
49 void MarkDestroyed();
50 void FlushAndSwapBuffers(Surface* current_surface);
51
52 static bool MakeCurrent(Context* current_context,
53 Surface* current_surface,
54 Context* new_context,
55 Surface* new_surface);
56
57 static bool ValidateAttributeList(const EGLint* attrib_list);
58
59 // GpuControl implementation.
60 void SetGpuControlClient(gpu::GpuControlClient*) override;
61 gpu::Capabilities GetCapabilities() override;
62 int32_t CreateImage(ClientBuffer buffer,
63 size_t width,
64 size_t height,
65 unsigned internalformat) override;
66 void DestroyImage(int32_t id) override;
67 int32_t CreateGpuMemoryBufferImage(size_t width,
68 size_t height,
69 unsigned internalformat,
70 unsigned usage) override;
71 void SignalQuery(uint32_t query, const base::Closure& callback) override;
72 void SetLock(base::Lock*) override;
73 bool IsGpuChannelLost() override;
74 void EnsureWorkVisible() override;
75 gpu::CommandBufferNamespace GetNamespaceID() const override;
76 gpu::CommandBufferId GetCommandBufferID() const override;
77 int32_t GetExtraCommandBufferData() const override;
78 uint64_t GenerateFenceSyncRelease() override;
79 bool IsFenceSyncRelease(uint64_t release) override;
80 bool IsFenceSyncFlushed(uint64_t release) override;
81 bool IsFenceSyncFlushReceived(uint64_t release) override;
82 void SignalSyncToken(const gpu::SyncToken& sync_token,
83 const base::Closure& callback) override;
84 bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override;
85
86 // Called by ThreadState to set the needed global variables when this context
87 // is current.
88 void ApplyCurrentContext(gfx::GLSurface* current_surface);
89 static void ApplyContextReleased();
90
91 private:
92 friend class base::RefCountedThreadSafe<Context>;
93 ~Context() override;
94 bool CreateService(gfx::GLSurface* gl_surface);
95 void DestroyService();
96 // Returns true if the object has GL service, either a working one or one
97 // that has lost its GL context.
98 bool HasService() const;
99 void MarkServiceContextLost();
100 bool WasServiceContextLost() const;
101 bool IsCompatibleSurface(Surface* surface) const;
102 bool Flush(gfx::GLSurface* gl_surface);
103
104 Display* display_;
105 const Config* config_;
106 bool is_current_in_some_thread_;
107 bool is_destroyed_;
108 gpu::GpuPreferences gpu_preferences_;
109 const gpu::GpuDriverBugWorkarounds gpu_driver_bug_workarounds_;
110 std::unique_ptr<gpu::CommandBufferService> command_buffer_;
111 std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_cmd_helper_;
112 std::unique_ptr<gpu::gles2::GLES2Decoder> decoder_;
113 std::unique_ptr<gpu::CommandExecutor> command_executor_;
114 std::unique_ptr<gpu::TransferBuffer> transfer_buffer_;
115
116 scoped_refptr<gfx::GLContext> gl_context_;
117
118 std::unique_ptr<gpu::gles2::GLES2Interface> client_gl_context_;
119 DISALLOW_COPY_AND_ASSIGN(Context);
120 };
121
122 } // namespace egl
123
124 #endif // GPU_GLES2_CONFORM_TEST_CONTEXT_H_
OLDNEW
« no previous file with comments | « gpu/gles2_conform_support/egl/config.cc ('k') | gpu/gles2_conform_support/egl/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698