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

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

Issue 371813004: ozone: gbm: Add overlay support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test build Created 6 years, 5 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 | « ui/ozone/platform/dri/test/mock_dri_wrapper.h ('k') | ui/ozone/public/surface_ozone_egl.h » ('j') | 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/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 "ui/ozone/platform/dri/dri_surface.h" 10 #include "ui/ozone/platform/dri/dri_surface.h"
11 #include "ui/ozone/platform/dri/hardware_display_controller.h" 11 #include "ui/ozone/platform/dri/hardware_display_controller.h"
12 12
13 namespace ui { 13 namespace ui {
14 14
15 namespace { 15 namespace {
16 16
17 template<class Object> Object* DrmAllocator() { 17 template<class Object> Object* DrmAllocator() {
18 return static_cast<Object*>(drmMalloc(sizeof(Object))); 18 return static_cast<Object*>(drmMalloc(sizeof(Object)));
19 } 19 }
20 20
21 } // namespace 21 } // namespace
22 22
23 MockDriWrapper::MockDriWrapper(int fd) 23 MockDriWrapper::MockDriWrapper(int fd)
24 : DriWrapper(""), 24 : DriWrapper(""),
25 get_crtc_call_count_(0), 25 get_crtc_call_count_(0),
26 restore_crtc_call_count_(0), 26 restore_crtc_call_count_(0),
27 add_framebuffer_call_count_(0), 27 add_framebuffer_call_count_(0),
28 remove_framebuffer_call_count_(0), 28 remove_framebuffer_call_count_(0),
29 page_flip_call_count_(0), 29 page_flip_call_count_(0),
30 overlay_flip_call_count_(0),
30 set_crtc_expectation_(true), 31 set_crtc_expectation_(true),
31 add_framebuffer_expectation_(true), 32 add_framebuffer_expectation_(true),
32 page_flip_expectation_(true) { 33 page_flip_expectation_(true) {
33 fd_ = fd; 34 fd_ = fd;
34 } 35 }
35 36
36 MockDriWrapper::~MockDriWrapper() { 37 MockDriWrapper::~MockDriWrapper() {
37 fd_ = -1; 38 fd_ = -1;
38 } 39 }
39 40
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 73 }
73 74
74 bool MockDriWrapper::PageFlip(uint32_t crtc_id, 75 bool MockDriWrapper::PageFlip(uint32_t crtc_id,
75 uint32_t framebuffer, 76 uint32_t framebuffer,
76 void* data) { 77 void* data) {
77 page_flip_call_count_++; 78 page_flip_call_count_++;
78 static_cast<ui::HardwareDisplayController*>(data)->surface()->SwapBuffers(); 79 static_cast<ui::HardwareDisplayController*>(data)->surface()->SwapBuffers();
79 return page_flip_expectation_; 80 return page_flip_expectation_;
80 } 81 }
81 82
83 bool MockDriWrapper::PageFlipOverlay(uint32_t crtc_id,
84 uint32_t framebuffer,
85 const gfx::Rect& location,
86 const gfx::RectF& source,
87 int overlay_plane) {
88 overlay_flip_call_count_++;
89 return true;
90 }
91
82 ScopedDrmPropertyPtr MockDriWrapper::GetProperty(drmModeConnector* connector, 92 ScopedDrmPropertyPtr MockDriWrapper::GetProperty(drmModeConnector* connector,
83 const char* name) { 93 const char* name) {
84 return ScopedDrmPropertyPtr(DrmAllocator<drmModePropertyRes>()); 94 return ScopedDrmPropertyPtr(DrmAllocator<drmModePropertyRes>());
85 } 95 }
86 96
87 bool MockDriWrapper::SetProperty(uint32_t connector_id, 97 bool MockDriWrapper::SetProperty(uint32_t connector_id,
88 uint32_t property_id, 98 uint32_t property_id,
89 uint64_t value) { 99 uint64_t value) {
90 return true; 100 return true;
91 } 101 }
(...skipping 12 matching lines...) Expand all
104 } 114 }
105 115
106 bool MockDriWrapper::MoveCursor(uint32_t crtc_id, int x, int y) { 116 bool MockDriWrapper::MoveCursor(uint32_t crtc_id, int x, int y) {
107 return true; 117 return true;
108 } 118 }
109 119
110 void MockDriWrapper::HandleEvent(drmEventContext& event) { 120 void MockDriWrapper::HandleEvent(drmEventContext& event) {
111 } 121 }
112 122
113 } // namespace ui 123 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/test/mock_dri_wrapper.h ('k') | ui/ozone/public/surface_ozone_egl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698