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: mdoerr
Backport-of: f7d6d7a04faa704155ee8df33e7d344bb962566f
  • Loading branch information
Amos Shi authored and shipilev committed Mar 11, 2024
1 parent e148b99 commit 4ba565c
Showing 1 changed file with 13 additions and 2 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 convinient 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 comment on commit 4ba565c

@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.