OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013 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_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_DELEGATE_EGL_H_ | |
6 #define GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_DELEGATE_EGL_H_ | |
7 | |
8 #include <list> | |
9 | |
10 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" | |
11 | |
12 namespace gpu { | |
13 class ScopedSafeSharedMemory; | |
14 | |
15 // Class which handles async pixel transfers using EGLImageKHR and another | |
16 // upload thread | |
17 class AsyncPixelTransferDelegateEGL | |
18 : public AsyncPixelTransferDelegate, | |
19 public base::SupportsWeakPtr<AsyncPixelTransferDelegateEGL> { | |
20 public: | |
21 AsyncPixelTransferDelegateEGL(); | |
22 virtual ~AsyncPixelTransferDelegateEGL(); | |
23 | |
24 // Implement AsyncPixelTransferDelegate: | |
25 virtual AsyncPixelTransferState* CreatePixelTransferState( | |
26 GLuint texture_id, | |
27 const AsyncTexImage2DParams& define_params) OVERRIDE; | |
28 virtual void BindCompletedAsyncTransfers() OVERRIDE; | |
29 virtual void AsyncNotifyCompletion( | |
30 const AsyncMemoryParams& mem_params, | |
31 const CompletionCallback& callback) OVERRIDE; | |
32 virtual void AsyncTexImage2D( | |
33 AsyncPixelTransferState* state, | |
34 const AsyncTexImage2DParams& tex_params, | |
35 const AsyncMemoryParams& mem_params, | |
36 const base::Closure& bind_callback) OVERRIDE; | |
37 virtual void AsyncTexSubImage2D( | |
38 AsyncPixelTransferState* state, | |
39 const AsyncTexSubImage2DParams& tex_params, | |
40 const AsyncMemoryParams& mem_params) OVERRIDE; | |
41 virtual void WaitForTransferCompletion( | |
42 AsyncPixelTransferState* state) OVERRIDE; | |
43 virtual uint32 GetTextureUploadCount() OVERRIDE; | |
44 virtual base::TimeDelta GetTotalTextureUploadTime() OVERRIDE; | |
45 virtual void ProcessMorePendingTransfers() OVERRIDE; | |
46 virtual bool NeedsProcessMorePendingTransfers() OVERRIDE; | |
47 | |
48 private: | |
49 static void PerformNotifyCompletion( | |
50 AsyncMemoryParams mem_params, | |
51 ScopedSafeSharedMemory* safe_shared_memory, | |
52 const CompletionCallback& callback); | |
53 | |
54 // Returns true if a work-around was used. | |
55 bool WorkAroundAsyncTexImage2D( | |
56 AsyncPixelTransferState* state, | |
57 const AsyncTexImage2DParams& tex_params, | |
58 const AsyncMemoryParams& mem_params, | |
59 const base::Closure& bind_callback); | |
60 bool WorkAroundAsyncTexSubImage2D( | |
61 AsyncPixelTransferState* state, | |
62 const AsyncTexSubImage2DParams& tex_params, | |
63 const AsyncMemoryParams& mem_params); | |
64 | |
65 typedef std::list<base::WeakPtr<AsyncPixelTransferState> > TransferQueue; | |
66 TransferQueue pending_allocations_; | |
67 | |
68 scoped_refptr<AsyncPixelTransferUploadStats> texture_upload_stats_; | |
69 bool is_imagination_; | |
70 bool is_qualcomm_; | |
71 | |
72 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferDelegateEGL); | |
73 }; | |
74 | |
75 } // namespace gpu | |
76 | |
77 #endif // GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_DELEGATE_EGL_H_ | |
OLD | NEW |