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

Side by Side Diff: ui/ozone/platform/dri/test/mock_dri_wrapper.cc

Issue 641173003: [Ozone-DRI] Fix waiting for page flips in mirror mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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/dri/test/mock_dri_wrapper.h" 5 #include "ui/ozone/platform/dri/test/mock_dri_wrapper.h"
6 6
7 #include <xf86drm.h> 7 #include <xf86drm.h>
8 #include <xf86drmMode.h> 8 #include <xf86drmMode.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 12 matching lines...) Expand all
23 23
24 MockDriWrapper::MockDriWrapper(int fd) 24 MockDriWrapper::MockDriWrapper(int fd)
25 : DriWrapper(""), 25 : DriWrapper(""),
26 get_crtc_call_count_(0), 26 get_crtc_call_count_(0),
27 set_crtc_call_count_(0), 27 set_crtc_call_count_(0),
28 restore_crtc_call_count_(0), 28 restore_crtc_call_count_(0),
29 add_framebuffer_call_count_(0), 29 add_framebuffer_call_count_(0),
30 remove_framebuffer_call_count_(0), 30 remove_framebuffer_call_count_(0),
31 page_flip_call_count_(0), 31 page_flip_call_count_(0),
32 overlay_flip_call_count_(0), 32 overlay_flip_call_count_(0),
33 handle_events_count_(0),
33 set_crtc_expectation_(true), 34 set_crtc_expectation_(true),
34 add_framebuffer_expectation_(true), 35 add_framebuffer_expectation_(true),
35 page_flip_expectation_(true), 36 page_flip_expectation_(true),
36 create_dumb_buffer_expectation_(true), 37 create_dumb_buffer_expectation_(true),
37 current_framebuffer_(0) { 38 current_framebuffer_(0) {
38 fd_ = fd; 39 fd_ = fd;
39 } 40 }
40 41
41 MockDriWrapper::~MockDriWrapper() { 42 MockDriWrapper::~MockDriWrapper() {
42 fd_ = -1; 43 fd_ = -1;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 126 }
126 127
127 bool MockDriWrapper::MoveCursor(uint32_t crtc_id, const gfx::Point& point) { 128 bool MockDriWrapper::MoveCursor(uint32_t crtc_id, const gfx::Point& point) {
128 return true; 129 return true;
129 } 130 }
130 131
131 void MockDriWrapper::HandleEvent(drmEventContext& event) { 132 void MockDriWrapper::HandleEvent(drmEventContext& event) {
132 CHECK(!controllers_.empty()); 133 CHECK(!controllers_.empty());
133 controllers_.front()->OnPageFlipEvent(0, 0, 0); 134 controllers_.front()->OnPageFlipEvent(0, 0, 0);
134 controllers_.pop(); 135 controllers_.pop();
136 handle_events_count_++;
135 } 137 }
136 138
137 bool MockDriWrapper::CreateDumbBuffer(const SkImageInfo& info, 139 bool MockDriWrapper::CreateDumbBuffer(const SkImageInfo& info,
138 uint32_t* handle, 140 uint32_t* handle,
139 uint32_t* stride, 141 uint32_t* stride,
140 void** pixels) { 142 void** pixels) {
141 if (!create_dumb_buffer_expectation_) 143 if (!create_dumb_buffer_expectation_)
142 return false; 144 return false;
143 145
144 *handle = 0; 146 *handle = 0;
145 *stride = info.minRowBytes(); 147 *stride = info.minRowBytes();
146 *pixels = new char[info.getSafeSize(*stride)]; 148 *pixels = new char[info.getSafeSize(*stride)];
147 buffers_.push_back( 149 buffers_.push_back(
148 skia::AdoptRef(SkSurface::NewRasterDirect(info, *pixels, *stride))); 150 skia::AdoptRef(SkSurface::NewRasterDirect(info, *pixels, *stride)));
149 buffers_.back()->getCanvas()->clear(SK_ColorBLACK); 151 buffers_.back()->getCanvas()->clear(SK_ColorBLACK);
150 152
151 return true; 153 return true;
152 } 154 }
153 155
154 void MockDriWrapper::DestroyDumbBuffer(const SkImageInfo& info, 156 void MockDriWrapper::DestroyDumbBuffer(const SkImageInfo& info,
155 uint32_t handle, 157 uint32_t handle,
156 uint32_t stride, 158 uint32_t stride,
157 void* pixels) { 159 void* pixels) {
158 delete[] static_cast<char*>(pixels); 160 delete[] static_cast<char*>(pixels);
159 } 161 }
160 162
161 } // namespace ui 163 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698