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(); | |
128 | 127 |
129 // Compute the budget for a client. Allow at most bytes_above_required_cap | 128 // Compute the budget for a client. Allow at most bytes_above_required_cap |
130 // bytes above client_state's required level. Allow at most | 129 // bytes above client_state's required level. Allow at most |
131 // bytes_above_minimum_cap bytes above client_state's minimum level. Allow | 130 // bytes_above_minimum_cap bytes above client_state's minimum level. Allow |
132 // at most bytes_overall_cap bytes total. | 131 // at most bytes_overall_cap bytes total. |
133 uint64 ComputeClientAllocationWhenVisible( | 132 uint64 ComputeClientAllocationWhenVisible( |
134 GpuMemoryManagerClientState* client_state, | 133 GpuMemoryManagerClientState* client_state, |
135 uint64 bytes_above_required_cap, | 134 uint64 bytes_above_required_cap, |
136 uint64 bytes_above_minimum_cap, | 135 uint64 bytes_above_minimum_cap, |
137 uint64 bytes_overall_cap); | 136 uint64 bytes_overall_cap); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 283 |
285 // Used to disable automatic changes to Manage() in testing. | 284 // Used to disable automatic changes to Manage() in testing. |
286 bool disable_schedule_manage_; | 285 bool disable_schedule_manage_; |
287 | 286 |
288 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); | 287 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); |
289 }; | 288 }; |
290 | 289 |
291 } // namespace content | 290 } // namespace content |
292 | 291 |
293 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | 292 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
OLD | NEW |