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 #include "ui/surface/accelerated_surface_win.h" | 5 #include "ui/surface/accelerated_surface_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 TRACE_EVENT0("gpu", "Present"); | 842 TRACE_EVENT0("gpu", "Present"); |
843 hr = swap_chain_->Present(&rect, &rect, window_, NULL, 0); | 843 hr = swap_chain_->Present(&rect, &rect, window_, NULL, 0); |
844 // For latency_tests.cc: | 844 // For latency_tests.cc: |
845 UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete"); | 845 UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete"); |
846 if (FAILED(hr) && | 846 if (FAILED(hr) && |
847 FAILED(present_thread_->device()->CheckDeviceState(window_))) { | 847 FAILED(present_thread_->device()->CheckDeviceState(window_))) { |
848 present_thread_->ResetDevice(); | 848 present_thread_->ResetDevice(); |
849 } | 849 } |
850 } | 850 } |
851 | 851 |
| 852 // Disable call to DwmGetCompositionTimingInfo until we figure out why it |
| 853 // causes a flicker of the last software window during tab switch and |
| 854 // navigate. crbug.com/143854 |
| 855 #if 0 |
852 { | 856 { |
853 TRACE_EVENT0("gpu", "GetPresentationStats"); | 857 TRACE_EVENT0("gpu", "GetPresentationStats"); |
854 base::TimeTicks timebase; | 858 base::TimeTicks timebase; |
855 base::TimeDelta interval; | 859 base::TimeDelta interval; |
856 uint32 numerator = 0, denominator = 0; | 860 uint32 numerator = 0, denominator = 0; |
857 if (GetPresentationStats(&timebase, &numerator, &denominator) && | 861 if (GetPresentationStats(&timebase, &numerator, &denominator) && |
858 numerator > 0 && denominator > 0) { | 862 numerator > 0 && denominator > 0) { |
859 int64 interval_micros = | 863 int64 interval_micros = |
860 1000000 * static_cast<int64>(numerator) / denominator; | 864 1000000 * static_cast<int64>(numerator) / denominator; |
861 interval = base::TimeDelta::FromMicroseconds(interval_micros); | 865 interval = base::TimeDelta::FromMicroseconds(interval_micros); |
862 } | 866 } |
863 scoped_completion_runner.Release(); | 867 scoped_completion_runner.Release(); |
864 completion_task.Run(true, timebase, interval); | 868 completion_task.Run(true, timebase, interval); |
865 TRACE_EVENT2("gpu", "GetPresentationStats", | 869 TRACE_EVENT2("gpu", "GetPresentationStats", |
866 "timebase", timebase.ToInternalValue(), | 870 "timebase", timebase.ToInternalValue(), |
867 "interval", interval.ToInternalValue()); | 871 "interval", interval.ToInternalValue()); |
868 } | 872 } |
| 873 #endif |
869 | 874 |
870 hidden_ = false; | 875 hidden_ = false; |
871 } | 876 } |
872 | 877 |
873 void AcceleratedPresenter::DoSuspend() { | 878 void AcceleratedPresenter::DoSuspend() { |
874 base::AutoLock locked(lock_); | 879 base::AutoLock locked(lock_); |
875 swap_chain_ = NULL; | 880 swap_chain_ = NULL; |
876 } | 881 } |
877 | 882 |
878 void AcceleratedPresenter::DoReleaseSurface() { | 883 void AcceleratedPresenter::DoReleaseSurface() { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 return presenter_->CopyTo(src_subrect, dst_size, buf); | 928 return presenter_->CopyTo(src_subrect, dst_size, buf); |
924 } | 929 } |
925 | 930 |
926 void AcceleratedSurface::Suspend() { | 931 void AcceleratedSurface::Suspend() { |
927 presenter_->Suspend(); | 932 presenter_->Suspend(); |
928 } | 933 } |
929 | 934 |
930 void AcceleratedSurface::WasHidden() { | 935 void AcceleratedSurface::WasHidden() { |
931 presenter_->WasHidden(); | 936 presenter_->WasHidden(); |
932 } | 937 } |
OLD | NEW |