229 else//if aThreshold == EGL_PROF_TOTAL_MEMORY_USAGE_GT_NOK |
231 else//if aThreshold == EGL_PROF_TOTAL_MEMORY_USAGE_GT_NOK |
230 { |
232 { |
231 TRACES1("FreeMemThresholdCrossedL : crossed low threshold %d", iLowThreshold); |
233 TRACES1("FreeMemThresholdCrossedL : crossed low threshold %d", iLowThreshold); |
232 iMemAllocationsGrowing->Stop(); |
234 iMemAllocationsGrowing->Stop(); |
233 iMemAllocationsGoingDown->Continue(); |
235 iMemAllocationsGoingDown->Continue(); |
234 if((iTrigger == EGOomTriggerNone) && !NeedToPostponeMemGood() && !iSynchTimer->IsActive() ) |
236 if((iTrigger == EGOomTriggerNone) && !NeedToPostponeMemGood()) |
|
237 { |
|
238 if(iSynchTimer->IsActive()) |
|
239 iSynchTimer->Cancel(); |
235 StartFreeSomeRamL(iGoodThreshold, EGOomTriggerThresholdCrossed); |
240 StartFreeSomeRamL(iGoodThreshold, EGOomTriggerThresholdCrossed); |
|
241 } |
236 } |
242 } |
237 #endif |
243 #endif |
238 } |
244 } |
239 |
245 |
240 void CMemoryMonitor::HandleFocusedWgChangeL(TInt aForegroundAppUid) |
246 void CMemoryMonitor::HandleFocusedWgChangeL(TInt aForegroundAppUid) |
250 iForegroundAppUid = aForegroundAppUid; |
256 iForegroundAppUid = aForegroundAppUid; |
251 |
257 |
252 // Refresh the low and good memory thresholds as they may have changed due to the new foreground application |
258 // Refresh the low and good memory thresholds as they may have changed due to the new foreground application |
253 RefreshThresholds(aForegroundAppUid); |
259 RefreshThresholds(aForegroundAppUid); |
254 |
260 |
255 if(iCurrentTarget) |
261 if(iCurrentTarget || ALWAYS_SW_REND) |
256 { |
262 { |
257 StartFreeSomeRamL(iCurrentTarget, EGOomTriggerFocusChanged); |
263 StartFreeSomeRamL(iCurrentTarget, EGOomTriggerFocusChanged); |
258 } |
264 } |
259 } |
265 } |
260 |
266 |
273 TInt freeMemory; |
279 TInt freeMemory; |
274 TBool freeMemoryAboveCurrentTarget = FreeGraphicsMemoryAboveThresholdL(freeMemory); |
280 TBool freeMemoryAboveCurrentTarget = FreeGraphicsMemoryAboveThresholdL(freeMemory); |
275 |
281 |
276 TRACES2("MemoryMonitor::StartFreeSomeRamL freeMemoryAboveTarget = %d, freeMemory = %d", freeMemoryAboveCurrentTarget, freeMemory); |
282 TRACES2("MemoryMonitor::StartFreeSomeRamL freeMemoryAboveTarget = %d, freeMemory = %d", freeMemoryAboveCurrentTarget, freeMemory); |
277 |
283 |
|
284 if(ALWAYS_SW_REND) |
|
285 { |
|
286 if(iMemMode == EGOomLowMemMode) |
|
287 return; |
|
288 } |
|
289 else |
|
290 { |
278 if (freeMemoryAboveCurrentTarget) |
291 if (freeMemoryAboveCurrentTarget) |
279 { |
292 { |
280 /*if(freeMemory >= iGoodThreshold && !NeedToPostponeMemGood()) |
293 /*if(freeMemory >= iGoodThreshold && !NeedToPostponeMemGood()) |
281 { |
294 { |
282 iGOomActionList->MemoryGood(); |
295 iGOomActionList->MemoryGood(); |
283 } |
296 } |
284 */ |
297 */ |
285 if(!iGOomActionList->UseSwRendering()) |
298 if(!(iGOomActionList->UseSwRendering() && (iMemMode != EGOomLowMemMode))) |
286 { |
299 { |
287 iServer->CloseAppsFinished(freeMemory, ETrue); |
300 iServer->CloseAppsFinished(freeMemory, ETrue); |
288 WaitAndSynchroniseMemoryState(); |
301 WaitAndSynchroniseMemoryState(); |
289 return; |
302 if(aTrigger == EGOomTriggerRequestMemory) |
290 } |
303 User::Leave(KErrCompletion); |
291 } |
304 else |
292 |
305 return; |
|
306 } |
|
307 } |
|
308 } |
293 // update wg list only when actually about to use it |
309 // update wg list only when actually about to use it |
294 //iGOomWindowGroupList->Refresh(); |
310 //iGOomWindowGroupList->Refresh(); |
295 |
311 |
296 #ifdef _DEBUG |
312 #ifdef _DEBUG |
297 iLogger->StartL(); |
313 iLogger->StartL(); |
307 |
323 |
308 iGOomActionList->SetUseSwRendering(ETrue); //Always use SW rendering in low mode .. (for now..) |
324 iGOomActionList->SetUseSwRendering(ETrue); //Always use SW rendering in low mode .. (for now..) |
309 // Run the memory freeing actions |
325 // Run the memory freeing actions |
310 iGOomActionList->FreeMemory(aMaxPriority); |
326 iGOomActionList->FreeMemory(aMaxPriority); |
311 |
327 |
|
328 SwitchMemMode(EGOomLowMemMode); |
|
329 } |
|
330 |
|
331 void CMemoryMonitor::SwitchMemMode(TGOomMemMode aMemMode) |
|
332 { |
|
333 if(iMemMode == aMemMode) |
|
334 return; |
|
335 |
|
336 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS |
|
337 TWsEvent event; |
|
338 |
|
339 if(aMemMode == EGOomLowMemMode) |
|
340 { |
|
341 iLowOnMemWgs.Reset(); |
|
342 iGOomWindowGroupList->GetListOfWindowGroupsWSurfaces(iLowOnMemWgs); |
|
343 event.SetType(KGoomMemoryLowEvent); |
|
344 } |
|
345 else |
|
346 { |
|
347 event.SetType(KGoomMemoryGoodEvent); |
|
348 } |
|
349 |
|
350 for (TInt i = iLowOnMemWgs.Count()-1; i>=0; i--) |
|
351 { |
|
352 iWs.SendEventToWindowGroup(iLowOnMemWgs[i], event); |
|
353 } |
|
354 #endif |
|
355 |
|
356 iMemMode = aMemMode; |
312 } |
357 } |
313 |
358 |
314 void CMemoryMonitor::RunCloseAppActions(TInt aMaxPriority) |
359 void CMemoryMonitor::RunCloseAppActions(TInt aMaxPriority) |
315 { |
360 { |
316 FUNC_LOG; |
361 FUNC_LOG; |
565 TRACES1("eglQueryProfilingData - data size: %d", data_count); |
610 TRACES1("eglQueryProfilingData - data size: %d", data_count); |
566 |
611 |
567 |
612 |
568 /* Allocate room for the profiling data */ |
613 /* Allocate room for the profiling data */ |
569 prof_data = (EGLint*)User::Alloc(data_count * sizeof(EGLint)); |
614 prof_data = (EGLint*)User::Alloc(data_count * sizeof(EGLint)); |
|
615 TRACES("eglQueryProfilingData - alloc for data done"); |
570 if (prof_data == NULL) |
616 if (prof_data == NULL) |
571 { |
617 { |
572 TRACES1("eglQueryProfilingData - could not alloc: %d", data_count * sizeof(EGLint)); |
618 TRACES1("eglQueryProfilingData - could not alloc: %d", data_count * sizeof(EGLint)); |
573 return KErrNoMemory; |
619 return KErrNoMemory; |
574 } |
620 } |
578 EGL_PROF_QUERY_GLOBAL_BIT_NOK | |
624 EGL_PROF_QUERY_GLOBAL_BIT_NOK | |
579 EGL_PROF_QUERY_MEMORY_USAGE_BIT_NOK, |
625 EGL_PROF_QUERY_MEMORY_USAGE_BIT_NOK, |
580 prof_data, |
626 prof_data, |
581 data_count, |
627 data_count, |
582 &data_count); |
628 &data_count); |
583 |
629 |
|
630 TRACES("eglQueryProfilingData - profiling data acquired"); |
|
631 |
584 /* Iterate over the returned data */ |
632 /* Iterate over the returned data */ |
585 while (i < data_count) |
633 while (i < data_count) |
586 { |
634 { |
587 TRACES2("EGL_NOK_resource_profiling - index: %d data: %d", i, prof_data[i]); |
635 TRACES2("EGL_NOK_resource_profiling - index: %d data: %d", i, prof_data[i]); |
588 |
636 |