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

Side by Side Diff: chromeos/display/output_configurator.cc

Issue 12388090: Matching modes for mirroring should preserve interlacing. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Review Created 7 years, 9 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 | « no previous file | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chromeos/display/output_configurator.h" 5 #include "chromeos/display/output_configurator.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include <X11/Xatom.h> 9 #include <X11/Xatom.h>
10 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 bool is_native_aspect_ratio = 1063 bool is_native_aspect_ratio =
1064 external_native_mode->width * external_mode->height == 1064 external_native_mode->width * external_mode->height ==
1065 external_native_mode->height * external_mode->width; 1065 external_native_mode->height * external_mode->width;
1066 if (preserve_aspect && !is_native_aspect_ratio) 1066 if (preserve_aspect && !is_native_aspect_ratio)
1067 continue; // Allow only aspect ratio preserving modes for mirroring 1067 continue; // Allow only aspect ratio preserving modes for mirroring
1068 1068
1069 // Try finding exact match 1069 // Try finding exact match
1070 for (int j = 0; j < internal_info->nmode; j++) { 1070 for (int j = 0; j < internal_info->nmode; j++) {
1071 internal_mode_id = internal_info->modes[j]; 1071 internal_mode_id = internal_info->modes[j];
1072 XRRModeInfo* internal_mode = ModeInfoForID(screen, internal_mode_id); 1072 XRRModeInfo* internal_mode = ModeInfoForID(screen, internal_mode_id);
1073 bool is_internal_interlaced = internal_mode->modeFlags & RR_Interlace;
1074 bool is_external_interlaced = external_mode->modeFlags & RR_Interlace;
1073 if (internal_mode->width == external_mode->width && 1075 if (internal_mode->width == external_mode->width &&
1074 internal_mode->height == external_mode->height) { 1076 internal_mode->height == external_mode->height &&
1077 is_internal_interlaced == is_external_interlaced) {
1075 *internal_mirror_mode = internal_mode_id; 1078 *internal_mirror_mode = internal_mode_id;
1076 *external_mirror_mode = external_mode_id; 1079 *external_mirror_mode = external_mode_id;
1077 return true; // Mirror mode found 1080 return true; // Mirror mode found
1078 } 1081 }
1079 } 1082 }
1080 1083
1081 // Try to create a matching internal output mode by panel fitting 1084 // Try to create a matching internal output mode by panel fitting
1082 if (try_creating) { 1085 if (try_creating) {
1083 // We can downscale by 1.125, and upscale indefinitely 1086 // We can downscale by 1.125, and upscale indefinitely
1084 // Downscaling looks ugly, so, can fit == can upscale 1087 // Downscaling looks ugly, so, can fit == can upscale
1088 // Also, internal panels don't support fitting interlaced modes
1085 bool can_fit = 1089 bool can_fit =
1086 internal_native_mode->width >= external_mode->width && 1090 internal_native_mode->width >= external_mode->width &&
1087 internal_native_mode->height >= external_mode->height; 1091 internal_native_mode->height >= external_mode->height &&
1092 !(external_mode->modeFlags & RR_Interlace);
1088 if (can_fit) { 1093 if (can_fit) {
1089 XRRAddOutputMode(display, internal_output_id, external_mode_id); 1094 XRRAddOutputMode(display, internal_output_id, external_mode_id);
1090 *internal_mirror_mode = *external_mirror_mode = external_mode_id; 1095 *internal_mirror_mode = *external_mirror_mode = external_mode_id;
1091 return true; // Mirror mode created 1096 return true; // Mirror mode created
1092 } 1097 }
1093 } 1098 }
1094 } 1099 }
1095 1100
1096 return false; 1101 return false;
1097 } 1102 }
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 // static 1361 // static
1357 RRMode OutputConfigurator::GetOutputNativeMode( 1362 RRMode OutputConfigurator::GetOutputNativeMode(
1358 const XRROutputInfo* output_info) { 1363 const XRROutputInfo* output_info) {
1359 if (output_info->nmode <= 0) 1364 if (output_info->nmode <= 0)
1360 return None; 1365 return None;
1361 1366
1362 return output_info->modes[0]; 1367 return output_info->modes[0];
1363 } 1368 }
1364 1369
1365 } // namespace chromeos 1370 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698