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

Side by Side Diff: ui/display/chromeos/display_configurator.cc

Issue 296183002: Merge 271252 "Fix HDCP in mirror mode." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1985/src/
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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/display/chromeos/display_configurator.h" 5 #include "ui/display/chromeos/display_configurator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 const bool success = 208 const bool success =
209 EnterStateOrFallBackToSoftwareMirroring(new_state, power_state_); 209 EnterStateOrFallBackToSoftwareMirroring(new_state, power_state_);
210 210
211 // Force the DPMS on chrome startup as the driver doesn't always detect 211 // Force the DPMS on chrome startup as the driver doesn't always detect
212 // that all displays are on when signing out. 212 // that all displays are on when signing out.
213 native_display_delegate_->ForceDPMSOn(); 213 native_display_delegate_->ForceDPMSOn();
214 native_display_delegate_->UngrabServer(); 214 native_display_delegate_->UngrabServer();
215 NotifyObservers(success, new_state); 215 NotifyObservers(success, new_state);
216 } 216 }
217 217
218 bool DisplayConfigurator::IsMirroring() const {
219 return display_state_ == MULTIPLE_DISPLAY_STATE_DUAL_MIRROR ||
220 (mirroring_controller_ &&
221 mirroring_controller_->SoftwareMirroringEnabled());
222 }
223
218 bool DisplayConfigurator::ApplyProtections(const ContentProtections& requests) { 224 bool DisplayConfigurator::ApplyProtections(const ContentProtections& requests) {
219 for (DisplayStateList::const_iterator it = cached_displays_.begin(); 225 for (DisplayStateList::const_iterator it = cached_displays_.begin();
220 it != cached_displays_.end(); 226 it != cached_displays_.end();
221 ++it) { 227 ++it) {
222 uint32_t all_desired = 0; 228 uint32_t all_desired = 0;
223 ContentProtections::const_iterator request_it = 229
224 requests.find(it->display->display_id()); 230 // In mirror mode, protection request of all displays need to be fulfilled.
225 if (request_it != requests.end()) 231 // In non-mirror mode, only request of client's display needs to be
226 all_desired = request_it->second; 232 // fulfilled.
233 ContentProtections::const_iterator request_it;
234 if (IsMirroring()) {
235 for (request_it = requests.begin();
236 request_it != requests.end();
237 ++request_it)
238 all_desired |= request_it->second;
239 } else {
240 request_it = requests.find(it->display->display_id());
241 if (request_it != requests.end())
242 all_desired = request_it->second;
243 }
244
227 switch (it->display->type()) { 245 switch (it->display->type()) {
228 case DISPLAY_CONNECTION_TYPE_UNKNOWN: 246 case DISPLAY_CONNECTION_TYPE_UNKNOWN:
229 return false; 247 return false;
230 // DisplayPort, DVI, and HDMI all support HDCP. 248 // DisplayPort, DVI, and HDMI all support HDCP.
231 case DISPLAY_CONNECTION_TYPE_DISPLAYPORT: 249 case DISPLAY_CONNECTION_TYPE_DISPLAYPORT:
232 case DISPLAY_CONNECTION_TYPE_DVI: 250 case DISPLAY_CONNECTION_TYPE_DVI:
233 case DISPLAY_CONNECTION_TYPE_HDMI: { 251 case DISPLAY_CONNECTION_TYPE_HDMI: {
234 HDCPState new_desired_state = 252 HDCPState new_desired_state =
235 (all_desired & CONTENT_PROTECTION_METHOD_HDCP) ? 253 (all_desired & CONTENT_PROTECTION_METHOD_HDCP) ?
236 HDCP_STATE_DESIRED : HDCP_STATE_UNDESIRED; 254 HDCP_STATE_DESIRED : HDCP_STATE_UNDESIRED;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 uint32_t* protection_mask) { 305 uint32_t* protection_mask) {
288 if (!configure_display_) 306 if (!configure_display_)
289 return false; 307 return false;
290 308
291 uint32_t enabled = 0; 309 uint32_t enabled = 0;
292 uint32_t unfulfilled = 0; 310 uint32_t unfulfilled = 0;
293 *link_mask = 0; 311 *link_mask = 0;
294 for (DisplayStateList::const_iterator it = cached_displays_.begin(); 312 for (DisplayStateList::const_iterator it = cached_displays_.begin();
295 it != cached_displays_.end(); 313 it != cached_displays_.end();
296 ++it) { 314 ++it) {
297 if (it->display->display_id() != display_id) 315 // Query display if it is in mirror mode or client on the same display.
316 if (!IsMirroring() && it->display->display_id() != display_id)
298 continue; 317 continue;
318
299 *link_mask |= it->display->type(); 319 *link_mask |= it->display->type();
300 switch (it->display->type()) { 320 switch (it->display->type()) {
301 case DISPLAY_CONNECTION_TYPE_UNKNOWN: 321 case DISPLAY_CONNECTION_TYPE_UNKNOWN:
302 return false; 322 return false;
303 // DisplayPort, DVI, and HDMI all support HDCP. 323 // DisplayPort, DVI, and HDMI all support HDCP.
304 case DISPLAY_CONNECTION_TYPE_DISPLAYPORT: 324 case DISPLAY_CONNECTION_TYPE_DISPLAYPORT:
305 case DISPLAY_CONNECTION_TYPE_DVI: 325 case DISPLAY_CONNECTION_TYPE_DVI:
306 case DISPLAY_CONNECTION_TYPE_HDMI: { 326 case DISPLAY_CONNECTION_TYPE_HDMI: {
307 HDCPState state; 327 HDCPState state;
308 if (!native_display_delegate_->GetHDCPState(*it->display, &state)) 328 if (!native_display_delegate_->GetHDCPState(*it->display, &state))
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 float width_ratio = static_cast<float>(mirror_mode_info->size().width()) / 962 float width_ratio = static_cast<float>(mirror_mode_info->size().width()) /
943 static_cast<float>(native_mode_info->size().width()); 963 static_cast<float>(native_mode_info->size().width());
944 float height_ratio = static_cast<float>(mirror_mode_info->size().height()) / 964 float height_ratio = static_cast<float>(mirror_mode_info->size().height()) /
945 static_cast<float>(native_mode_info->size().height()); 965 static_cast<float>(native_mode_info->size().height());
946 966
947 area_ratio = width_ratio * height_ratio; 967 area_ratio = width_ratio * height_ratio;
948 return area_ratio; 968 return area_ratio;
949 } 969 }
950 970
951 } // namespace ui 971 } // namespace ui
OLDNEW
« no previous file with comments | « ui/display/chromeos/display_configurator.h ('k') | ui/display/chromeos/display_configurator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698