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

Side by Side Diff: ui/ozone/platform/dri/dri_gpu_platform_support.cc

Issue 800743002: [Ozone-DRI] Add support for asynchronous display configuration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@async-refactor6
Patch Set: Remove unneeded code Created 6 years 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/dri_gpu_platform_support.h" 5 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h"
6 6
7 #include "ipc/ipc_message_macros.h" 7 #include "ipc/ipc_message_macros.h"
8 #include "ui/display/types/display_mode.h" 8 #include "ui/display/types/display_mode.h"
9 #include "ui/display/types/display_snapshot.h" 9 #include "ui/display/types/display_snapshot.h"
10 #include "ui/ozone/common/display_util.h" 10 #include "ui/ozone/common/display_util.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 void DriGpuPlatformSupport::OnCursorMove(gfx::AcceleratedWidget widget, 113 void DriGpuPlatformSupport::OnCursorMove(gfx::AcceleratedWidget widget,
114 const gfx::Point& location) { 114 const gfx::Point& location) {
115 window_manager_->GetWindowDelegate(widget)->MoveCursor(location); 115 window_manager_->GetWindowDelegate(widget)->MoveCursor(location);
116 } 116 }
117 117
118 void DriGpuPlatformSupport::OnForceDPMSOn() { 118 void DriGpuPlatformSupport::OnForceDPMSOn() {
119 ndd_->ForceDPMSOn(); 119 ndd_->ForceDPMSOn();
120 } 120 }
121 121
122 void DriGpuPlatformSupport::OnRefreshNativeDisplays( 122 void DriGpuPlatformSupport::OnRefreshNativeDisplays() {
123 const std::vector<DisplaySnapshot_Params>& cached_displays) {
124 std::vector<DisplaySnapshot_Params> displays; 123 std::vector<DisplaySnapshot_Params> displays;
125 std::vector<DisplaySnapshot*> native_displays = ndd_->GetDisplays(); 124 std::vector<DisplaySnapshot*> native_displays = ndd_->GetDisplays();
126 125
127 // If any of the cached displays are in the list of new displays then apply
128 // their configuration immediately.
129 for (size_t i = 0; i < native_displays.size(); ++i) {
130 std::vector<DisplaySnapshot_Params>::const_iterator it =
131 std::find_if(cached_displays.begin(), cached_displays.end(),
132 FindDisplayById(native_displays[i]->display_id()));
133
134 if (it == cached_displays.end())
135 continue;
136
137 if (it->has_current_mode)
138 OnConfigureNativeDisplay(it->display_id, it->current_mode, it->origin);
139 else
140 OnDisableNativeDisplay(it->display_id);
141 }
142
143 for (size_t i = 0; i < native_displays.size(); ++i) 126 for (size_t i = 0; i < native_displays.size(); ++i)
144 displays.push_back(GetDisplaySnapshotParams(*native_displays[i])); 127 displays.push_back(GetDisplaySnapshotParams(*native_displays[i]));
145 128
146 sender_->Send(new OzoneHostMsg_UpdateNativeDisplays(displays)); 129 sender_->Send(new OzoneHostMsg_UpdateNativeDisplays(displays));
147 } 130 }
148 131
149 void DriGpuPlatformSupport::OnConfigureNativeDisplay( 132 void DriGpuPlatformSupport::OnConfigureNativeDisplay(
150 int64_t id, 133 int64_t id,
151 const DisplayMode_Params& mode_param, 134 const DisplayMode_Params& mode_param,
152 const gfx::Point& origin) { 135 const gfx::Point& origin) {
(...skipping 21 matching lines...) Expand all
174 mode = ndd_->FindDisplayMode(mode_param.size, mode_param.is_interlaced, 157 mode = ndd_->FindDisplayMode(mode_param.size, mode_param.is_interlaced,
175 mode_param.refresh_rate); 158 mode_param.refresh_rate);
176 159
177 if (!mode) { 160 if (!mode) {
178 LOG(ERROR) << "Failed to find mode: size=" << mode_param.size.ToString() 161 LOG(ERROR) << "Failed to find mode: size=" << mode_param.size.ToString()
179 << " is_interlaced=" << mode_param.is_interlaced 162 << " is_interlaced=" << mode_param.is_interlaced
180 << " refresh_rate=" << mode_param.refresh_rate; 163 << " refresh_rate=" << mode_param.refresh_rate;
181 return; 164 return;
182 } 165 }
183 166
184 ndd_->Configure(*display, mode, origin); 167 sender_->Send(new OzoneHostMsg_DisplayConfigured(
168 id, ndd_->Configure(*display, mode, origin)));
185 } 169 }
186 170
187 void DriGpuPlatformSupport::OnDisableNativeDisplay(int64_t id) { 171 void DriGpuPlatformSupport::OnDisableNativeDisplay(int64_t id) {
188 DisplaySnapshot* display = ndd_->FindDisplaySnapshot(id); 172 DisplaySnapshot* display = ndd_->FindDisplaySnapshot(id);
189 if (display) 173 if (display)
190 ndd_->Configure(*display, NULL, gfx::Point()); 174 ndd_->Configure(*display, NULL, gfx::Point());
191 else 175 else
192 LOG(ERROR) << "There is no display with ID " << id; 176 LOG(ERROR) << "There is no display with ID " << id;
193 } 177 }
194 178
(...skipping 12 matching lines...) Expand all
207 void DriGpuPlatformSupport::OnRemoveGraphicsDevice(const base::FilePath& path) { 191 void DriGpuPlatformSupport::OnRemoveGraphicsDevice(const base::FilePath& path) {
208 NOTIMPLEMENTED(); 192 NOTIMPLEMENTED();
209 } 193 }
210 194
211 void DriGpuPlatformSupport::RelinquishGpuResources( 195 void DriGpuPlatformSupport::RelinquishGpuResources(
212 const base::Closure& callback) { 196 const base::Closure& callback) {
213 callback.Run(); 197 callback.Run();
214 } 198 }
215 199
216 } // namespace ui 200 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/dri_gpu_platform_support.h ('k') | ui/ozone/platform/dri/dri_gpu_platform_support_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698