diff options
Diffstat (limited to 'dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0112-V4L2VDA-Add-fps-in-SkiaOutputSurfaceImplOnGpu-by-VLO.patch')
-rw-r--r-- | dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0112-V4L2VDA-Add-fps-in-SkiaOutputSurfaceImplOnGpu-by-VLO.patch | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0112-V4L2VDA-Add-fps-in-SkiaOutputSurfaceImplOnGpu-by-VLO.patch b/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0112-V4L2VDA-Add-fps-in-SkiaOutputSurfaceImplOnGpu-by-VLO.patch new file mode 100644 index 00000000..78be7a25 --- /dev/null +++ b/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0112-V4L2VDA-Add-fps-in-SkiaOutputSurfaceImplOnGpu-by-VLO.patch | |||
@@ -0,0 +1,88 @@ | |||
1 | From a49818e6727dc3ec25e438b032b761e668542886 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hou Qi <qi.hou@nxp.com> | ||
3 | Date: Thu, 18 Aug 2022 12:22:20 +0800 | ||
4 | Subject: [PATCH 12/17] V4L2VDA: Add fps in SkiaOutputSurfaceImplOnGpu by | ||
5 | VLOG(1) | ||
6 | |||
7 | Upstream-Status: Inappropriate [NXP specific] | ||
8 | --- | ||
9 | .../skia_output_surface_impl_on_gpu.cc | 18 ++++++++++++++++++ | ||
10 | .../skia_output_surface_impl_on_gpu.h | 1 + | ||
11 | 2 files changed, 19 insertions(+) | ||
12 | |||
13 | diff --git a/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc b/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc | ||
14 | index 946f4f40aaa08..8a05a8c41bd05 100644 | ||
15 | --- a/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc | ||
16 | +++ b/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc | ||
17 | @@ -6,6 +6,7 @@ | ||
18 | |||
19 | #include <memory> | ||
20 | #include <vector> | ||
21 | +#include <sys/time.h> | ||
22 | |||
23 | #include "base/atomic_sequence_num.h" | ||
24 | #include "base/bind.h" | ||
25 | @@ -104,6 +105,15 @@ | ||
26 | #include "components/viz/service/display_embedder/output_presenter_fuchsia.h" | ||
27 | #endif | ||
28 | |||
29 | +static uint64_t start_time = 0; | ||
30 | +static uint64_t stop_time = 0; | ||
31 | + | ||
32 | +uint64_t NowMicros() { | ||
33 | + struct timeval tv; | ||
34 | + gettimeofday(&tv, nullptr); | ||
35 | + return static_cast<uint64_t>(tv.tv_sec) * 1e6 + tv.tv_usec; | ||
36 | +} | ||
37 | + | ||
38 | namespace viz { | ||
39 | |||
40 | namespace { | ||
41 | @@ -320,6 +330,7 @@ SkiaOutputSurfaceImplOnGpu::SkiaOutputSurfaceImplOnGpu( | ||
42 | async_read_result_lock_(base::MakeRefCounted<AsyncReadResultLock>()) { | ||
43 | DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); | ||
44 | |||
45 | + swap_buffers_number_ = 0; | ||
46 | weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); | ||
47 | buffer_presented_callback_ = CreateSafeRepeatingCallback( | ||
48 | weak_ptr_, std::move(buffer_presented_callback)); | ||
49 | @@ -500,10 +511,16 @@ void SkiaOutputSurfaceImplOnGpu::SwapBuffers(OutputSurfaceFrame frame, | ||
50 | TRACE_EVENT0("viz", "SkiaOutputSurfaceImplOnGpu::SwapBuffers"); | ||
51 | DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); | ||
52 | |||
53 | + if ( swap_buffers_number_ == 0) | ||
54 | + start_time = NowMicros(); | ||
55 | if (release_frame_buffer) | ||
56 | output_device_->ReleaseOneFrameBuffer(); | ||
57 | |||
58 | + swap_buffers_number_++; | ||
59 | + stop_time = NowMicros(); | ||
60 | + | ||
61 | SwapBuffersInternal(std::move(frame)); | ||
62 | + VLOG(1) << "total showed " << swap_buffers_number_ << " frames, total time " << (stop_time - start_time) << " ms, fps is " << swap_buffers_number_*1e6/(stop_time - start_time) << std::endl; | ||
63 | } | ||
64 | |||
65 | void SkiaOutputSurfaceImplOnGpu::AllocateFrameBuffers(size_t n) { | ||
66 | @@ -1525,6 +1542,7 @@ bool SkiaOutputSurfaceImplOnGpu::Initialize() { | ||
67 | if (context_state_) | ||
68 | context_state_->AddContextLostObserver(this); | ||
69 | |||
70 | + start_time = NowMicros(); | ||
71 | return true; | ||
72 | } | ||
73 | |||
74 | diff --git a/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.h b/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.h | ||
75 | index febdaebbb740c..be1cedf2babc9 100644 | ||
76 | --- a/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.h | ||
77 | +++ b/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.h | ||
78 | @@ -423,6 +423,7 @@ class SkiaOutputSurfaceImplOnGpu | ||
79 | BufferPresentedCallback buffer_presented_callback_; | ||
80 | ContextLostCallback context_lost_callback_; | ||
81 | GpuVSyncCallback gpu_vsync_callback_; | ||
82 | + size_t swap_buffers_number_; | ||
83 | |||
84 | // ImplOnGpu::CopyOutput can create SharedImages via ImplOnGpu's | ||
85 | // SharedImageFactory. Clients can use these images via CopyOutputResult and | ||
86 | -- | ||
87 | 2.17.1 | ||
88 | |||