Skip to content

Commit 8264178

Browse files
Alexander Zuevpull[bot]
authored andcommitted
8266242: java/awt/GraphicsDevice/CheckDisplayModes.java failing on macOS 11 ARM
Reviewed-by: prr, azvegint, aivanov
1 parent e6bad04 commit 8264178

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsDevice.m

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
3535
#define DEFAULT_DEVICE_HEIGHT 768
3636
#define DEFAULT_DEVICE_DPI 72
3737

38+
static NSInteger architecture = -1;
3839
/*
3940
* Convert the mode string to the more convenient bits per pixel value
4041
*/
@@ -58,7 +59,17 @@ static int getBPPFromModeString(CFStringRef mode)
5859
return 0;
5960
}
6061

61-
static BOOL isValidDisplayMode(CGDisplayModeRef mode){
62+
static BOOL isValidDisplayMode(CGDisplayModeRef mode) {
63+
// Workaround for apple bug FB13261205, since it only affects arm based macs
64+
// and arm support started with macOS 11 ignore the workaround for previous versions
65+
if (@available(macOS 11, *)) {
66+
if (architecture == -1) {
67+
architecture = [[NSRunningApplication currentApplication] executableArchitecture];
68+
}
69+
if (architecture == NSBundleExecutableArchitectureARM64) {
70+
return (CGDisplayModeGetPixelWidth(mode) >= 800);
71+
}
72+
}
6273
return (1 < CGDisplayModeGetWidth(mode) && 1 < CGDisplayModeGetHeight(mode));
6374
}
6475

test/jdk/ProblemList.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,6 @@ java/awt/KeyboardFocusmanager/TypeAhead/MenuItemActivatedTest/MenuItemActivatedT
462462
java/awt/Window/GetScreenLocation/GetScreenLocationTest.java 8225787 linux-x64
463463
java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java 8266243 macosx-aarch64
464464
java/awt/dnd/BadSerializationTest/BadSerializationTest.java 8277817 linux-x64,windows-x64
465-
java/awt/GraphicsDevice/CheckDisplayModes.java 8266242 macosx-aarch64
466465
java/awt/GraphicsDevice/DisplayModes/UnknownRefrshRateTest.java 8286436 macosx-aarch64
467466
java/awt/image/multiresolution/MultiresolutionIconTest.java 8291979 linux-x64,windows-all
468467
java/awt/event/SequencedEvent/MultipleContextsFunctionalTest.java 8305061 macosx-x64

0 commit comments

Comments
 (0)