Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: ui/ozone/platform/drm/gpu/drm_device.cc

Issue 2593513002: Add page flip completion event to trace on CrOS (Closed)
Patch Set: Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ozone/platform/drm/gpu/drm_device.h" 5 #include "ui/ozone/platform/drm/gpu/drm_device.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <sys/mman.h> 8 #include <sys/mman.h>
9 #include <unistd.h> 9 #include <unistd.h>
10 #include <xf86drm.h> 10 #include <xf86drm.h>
11 #include <xf86drmMode.h> 11 #include <xf86drmMode.h>
12 #include <utility> 12 #include <utility>
13 13
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/free_deleter.h" 16 #include "base/memory/free_deleter.h"
17 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
18 #include "base/posix/safe_strerror.h" 18 #include "base/posix/safe_strerror.h"
19 #include "base/task_runner.h" 19 #include "base/task_runner.h"
20 #include "base/threading/thread_task_runner_handle.h" 20 #include "base/threading/thread_task_runner_handle.h"
21 #include "base/trace_event/trace_event.h" 21 #include "base/trace_event/trace_event.h"
22 #include "base/trace_event/trace_event_argument.h"
22 #include "third_party/skia/include/core/SkImageInfo.h" 23 #include "third_party/skia/include/core/SkImageInfo.h"
23 #include "ui/display/types/gamma_ramp_rgb_entry.h" 24 #include "ui/display/types/gamma_ramp_rgb_entry.h"
24 #include "ui/ozone/platform/drm/common/drm_util.h" 25 #include "ui/ozone/platform/drm/common/drm_util.h"
25 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h" 26 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h"
26 27
27 #if defined(USE_DRM_ATOMIC) 28 #if defined(USE_DRM_ATOMIC)
28 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_atomic.h" 29 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_atomic.h"
29 #endif 30 #endif
30 31
31 namespace ui { 32 namespace ui {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 int idx = 0; 85 int idx = 0;
85 while (idx < len) { 86 while (idx < len) {
86 DCHECK_LE(static_cast<int>(sizeof(drm_event)), len - idx); 87 DCHECK_LE(static_cast<int>(sizeof(drm_event)), len - idx);
87 drm_event event; 88 drm_event event;
88 memcpy(&event, &buffer[idx], sizeof(event)); 89 memcpy(&event, &buffer[idx], sizeof(event));
89 switch (event.type) { 90 switch (event.type) {
90 case DRM_EVENT_FLIP_COMPLETE: { 91 case DRM_EVENT_FLIP_COMPLETE: {
91 DCHECK_LE(static_cast<int>(sizeof(drm_event_vblank)), len - idx); 92 DCHECK_LE(static_cast<int>(sizeof(drm_event_vblank)), len - idx);
92 drm_event_vblank vblank; 93 drm_event_vblank vblank;
93 memcpy(&vblank, &buffer[idx], sizeof(vblank)); 94 memcpy(&vblank, &buffer[idx], sizeof(vblank));
95 std::unique_ptr<base::trace_event::TracedValue> drm_data(
96 new base::trace_event::TracedValue());
97 drm_data->SetInteger("frame_count", 1);
98 drm_data->SetInteger("vblank.tv_sec", vblank.tv_sec);
99 drm_data->SetInteger("vblank.tv_usec", vblank.tv_usec);
100 TRACE_EVENT_INSTANT1("benchmark,drm", "DrmEventFlipComplete",
101 TRACE_EVENT_SCOPE_THREAD, "data",
102 std::move(drm_data));
94 callback.Run(vblank.sequence, vblank.tv_sec, vblank.tv_usec, 103 callback.Run(vblank.sequence, vblank.tv_sec, vblank.tv_usec,
95 vblank.user_data); 104 vblank.user_data);
96 } break; 105 } break;
97 case DRM_EVENT_VBLANK: 106 case DRM_EVENT_VBLANK:
98 break; 107 break;
99 default: 108 default:
100 NOTREACHED(); 109 NOTREACHED();
101 break; 110 break;
102 } 111 }
103 112
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 reinterpret_cast<unsigned char*>(ctm_blob_data.get()), 821 reinterpret_cast<unsigned char*>(ctm_blob_data.get()),
813 sizeof(DrmColorCtm))) 822 sizeof(DrmColorCtm)))
814 return false; 823 return false;
815 } 824 }
816 } 825 }
817 826
818 return true; 827 return true;
819 } 828 }
820 829
821 } // namespace ui 830 } // namespace ui
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698