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 CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
6 #define CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 void AssignSurfacesAllocationsUniform(); | 117 void AssignSurfacesAllocationsUniform(); |
118 void AssignNonSurfacesAllocations(); | 118 void AssignNonSurfacesAllocations(); |
119 | 119 |
120 // Math helper function to compute the maximum value of cap such that | 120 // Math helper function to compute the maximum value of cap such that |
121 // sum_i min(bytes[i], cap) <= bytes_sum_limit | 121 // sum_i min(bytes[i], cap) <= bytes_sum_limit |
122 static uint64 ComputeCap(std::vector<uint64> bytes, uint64 bytes_sum_limit); | 122 static uint64 ComputeCap(std::vector<uint64> bytes, uint64 bytes_sum_limit); |
123 | 123 |
124 // Compute the allocation for clients when visible and not visible. | 124 // Compute the allocation for clients when visible and not visible. |
125 void ComputeVisibleSurfacesAllocationsNonuniform(); | 125 void ComputeVisibleSurfacesAllocationsNonuniform(); |
126 void ComputeNonvisibleSurfacesAllocationsNonuniform(); | 126 void ComputeNonvisibleSurfacesAllocationsNonuniform(); |
| 127 void DistributeRemainingMemoryToVisibleSurfaces(); |
127 | 128 |
128 // Compute the budget for a client. Allow at most bytes_above_required_cap | 129 // Compute the budget for a client. Allow at most bytes_above_required_cap |
129 // bytes above client_state's required level. Allow at most | 130 // bytes above client_state's required level. Allow at most |
130 // bytes_above_minimum_cap bytes above client_state's minimum level. Allow | 131 // bytes_above_minimum_cap bytes above client_state's minimum level. Allow |
131 // at most bytes_overall_cap bytes total. | 132 // at most bytes_overall_cap bytes total. |
132 uint64 ComputeClientAllocationWhenVisible( | 133 uint64 ComputeClientAllocationWhenVisible( |
133 GpuMemoryManagerClientState* client_state, | 134 GpuMemoryManagerClientState* client_state, |
134 uint64 bytes_above_required_cap, | 135 uint64 bytes_above_required_cap, |
135 uint64 bytes_above_minimum_cap, | 136 uint64 bytes_above_minimum_cap, |
136 uint64 bytes_overall_cap); | 137 uint64 bytes_overall_cap); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 284 |
284 // Used to disable automatic changes to Manage() in testing. | 285 // Used to disable automatic changes to Manage() in testing. |
285 bool disable_schedule_manage_; | 286 bool disable_schedule_manage_; |
286 | 287 |
287 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); | 288 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); |
288 }; | 289 }; |
289 | 290 |
290 } // namespace content | 291 } // namespace content |
291 | 292 |
292 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | 293 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
OLD | NEW |