Skip to content

Commit

Permalink
8266242: java/awt/GraphicsDevice/CheckDisplayModes.java failing on ma…
Browse files Browse the repository at this point in the history
…cOS 11 ARM

Reviewed-by: prr, azvegint, aivanov
  • Loading branch information
Alexander Zuev committed Oct 13, 2023
1 parent e942f36 commit f7d6d7a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsDevice.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -35,6 +35,7 @@
#define DEFAULT_DEVICE_HEIGHT 768
#define DEFAULT_DEVICE_DPI 72

static NSInteger architecture = -1;
/*
* Convert the mode string to the more convenient bits per pixel value
*/
Expand All @@ -58,7 +59,17 @@ static int getBPPFromModeString(CFStringRef mode)
return 0;
}

static BOOL isValidDisplayMode(CGDisplayModeRef mode){
static BOOL isValidDisplayMode(CGDisplayModeRef mode) {
// Workaround for apple bug FB13261205, since it only affects arm based macs
// and arm support started with macOS 11 ignore the workaround for previous versions
if (@available(macOS 11, *)) {
if (architecture == -1) {
architecture = [[NSRunningApplication currentApplication] executableArchitecture];
}
if (architecture == NSBundleExecutableArchitectureARM64) {
return (CGDisplayModeGetPixelWidth(mode) >= 800);
}
}
return (1 < CGDisplayModeGetWidth(mode) && 1 < CGDisplayModeGetHeight(mode));
}

Expand Down
1 change: 0 additions & 1 deletion test/jdk/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ java/awt/KeyboardFocusmanager/TypeAhead/MenuItemActivatedTest/MenuItemActivatedT
java/awt/Window/GetScreenLocation/GetScreenLocationTest.java 8225787 linux-x64
java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java 8266243 macosx-aarch64
java/awt/dnd/BadSerializationTest/BadSerializationTest.java 8277817 linux-x64,windows-x64
java/awt/GraphicsDevice/CheckDisplayModes.java 8266242 macosx-aarch64
java/awt/GraphicsDevice/DisplayModes/UnknownRefrshRateTest.java 8286436 macosx-aarch64
java/awt/image/multiresolution/MultiresolutionIconTest.java 8291979 linux-x64,windows-all
java/awt/event/SequencedEvent/MultipleContextsFunctionalTest.java 8305061 macosx-x64
Expand Down

1 comment on commit f7d6d7a

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.