Compare commits

..

1269 Commits

Author SHA1 Message Date
Nikita Gubarkov
82280baf36 Added proper choice of sRGB surface formats and spec-conformant sRGB->linear conversion for colors coming from Java. 2024-09-23 21:58:56 +02:00
Nikita Gubarkov
1d81976051 Add dynamic states.
Added VK_EXT_extended_dynamic_state and VK_EXT_extended_dynamic_state3 for:
- Dynamic blending mode.
- Dynamic logicOp.
- Dynamic stencil test.
2024-09-23 21:58:55 +02:00
Nikita Gubarkov
4007a80708 Add VK_KHR_dynamic_rendering.
Added VK_KHR_dynamic_rendering for dynamic render pass parameters - clear, view format, multisampling(?).
2024-09-23 21:58:55 +02:00
Nikita Gubarkov
7c2a59ff04 JBR-7565 Vulkan: Implement clip 2024-09-23 21:58:55 +02:00
Nikita Gubarkov
4f4e7d178c JBR-7645 Vulkan: Implement hash table for pipeline sets 2024-09-23 21:58:55 +02:00
Nikita Gubarkov
b7cba94562 JBR-7563 Vulkan: Implement MASK_FILL
Mask bytes are copied to texel buffer to be used in shader.
Up to 256KiB (configurable) of mask can be rendered in a single draw call, with no limit on number of MASK_FILL operations in a single batch.

Also added dirty implementation of greyscale-AA DRAW_GLYPH_LIST and FILL_AAPARALLELOGRAM over MASK_FILL.
2024-09-23 21:58:55 +02:00
Nikita Gubarkov
c58b58436f JBR-7564 Vulkan: Fix HIDPI and multi-monitor scenarios 2024-09-23 21:58:55 +02:00
Nikita Gubarkov
ce8889425e JBR-7575 Vulkan: Implement composites (blending and XOR mode)
- Implemented dynamic pipeline compilation.
- Added 64-bit per pixel format usage in debug mode for testing.
- Now passing colors from Java to Vulkan with straight alpha.
2024-09-23 21:58:55 +02:00
Nikita Gubarkov
86066fd7ce JBR-7574 Vulkan: Implement memory allocator 2024-09-23 21:58:55 +02:00
Nikita Gubarkov
82ff4c4b2d JBR-7644 Vulkan: Move barrier state tracking from surface into image 2024-09-23 21:58:55 +02:00
Nikita Gubarkov
6a04f79184 JBR-7572 Vulkan: Implement vertex buffer pool
Track and reuse vertex buffers, no need to allocate and bind a new buffer on each draw.
2024-09-23 21:58:55 +02:00
Vitaly Provodin
b54cf88bdd Update README.md 2024-09-19 02:02:55 +02:00
Alexey Ushakov
e64168a512 JBR-7588 Metal: Reuse MTLContext for all GCs of the same GPU
Fixed releaseContext registryID usage
2024-09-19 02:02:55 +02:00
Nikita Gubarkov
63df7aaac2 JBR-7556 Check negative glyphID in HBShaper 2024-09-19 02:02:55 +02:00
Alexey Ushakov
9d2837bfe3 JBR-7588 Metal: Reuse MTLContext for all GCs of the same GPU
Added support for macOS version < 10.13
2024-09-19 02:02:54 +02:00
Maxim Kartashev
e38698a5f7 JBR-7576 Cannot make CDS dump due to whitespaces in paths 2024-09-19 02:02:54 +02:00
bourgesl
3cffbeacd3 JBR-7616: improved MTLRenderQueue exception handling 2024-09-19 02:02:54 +02:00
Maxim Kartashev
23c2c485d0 JBR-7600 Provide ability to add messages to fatal error log
Use JNU_LOG_EVENT(env, msg, ...) to save a message in the internal
JVM ring buffer that gets printed out to the Events section
of the fatal error log if JVM crashed.
2024-09-19 02:02:54 +02:00
Alexey Ushakov
ddebdb69d2 JBR-7588 Metal: Reuse MTLContext for all GCs of the same GPU
Added support of multiple display links per MTLContext
2024-09-19 02:02:54 +02:00
Nikita Provotorov
86e0da2b56 JBR-5673: Wayland: support touch scrolling.
- Adding information to WLPointerEvent about wl_pointer::axis* events along the X axis;
- Introducing 'WLComponentPeer#convertPointerEventToMWEParameters' - a routine for converting WLPointerEvent parameters to parameters required for MouseWheelEvent s;
- Handling both X and Y axes within the WLPointerEvent dispatching routine.

(cherry picked from commit 6afbc34d4b)
2024-09-19 02:02:54 +02:00
Nikita Provotorov
097b0a2933 JBR-7459: Wayland: touchpad scrolling is too sensitive.
- Remaking the mapping of wl_pointer::axis events values to MouseWheelEvent rotations to eliminate the touchpad scrolling behavior "the more slowly the fingers move, the more pixels are scrolled";
- Accumulating the fraction parts of wl_pointer::axis events values to improve the accuracy of touchpad scrolling;
- Distinguishing between wheel scrolling and touchpad scrolling to fine-tune MouseWheelEvent parameters for each of these cases.

(cherry picked from commit 874d5698bc)
2024-09-19 02:02:54 +02:00
Vitaly Provodin
ac7702296c Update README.md 2024-09-19 02:02:54 +02:00
Sergei Tachenov
2b6d3691e5 JBR-7586 Fix title click ungrab when an active user component is clicked
Swing requires that clicking frame decorations should cause the window
to be ungrabbed. However, if a custom title is used, and that title contains
user-provided components, then clicking such components should not
cause the window to be ungrabbed, otherwise a menu located in a custom
title behaves incorrectly.

Fix by using the same logic as for the native actions, such as moving the window.
If the native actions are allowed, then ungrabbing is allowed as well.
Otherwise, do not ungrab, let the component behave like it's located in the client area.

The fix is supplemented with a new regression test "test/jdk/jb/javax/swing/CustomTitleBar/JMenuClickToCloseTest.java".
2024-09-19 02:02:54 +02:00
Nikita Tsarev
4e02fddeae JBR-7594 Check for LWCToolkit in JBR TextInput API 2024-09-19 02:02:54 +02:00
Sergei Tachenov
0d0acd6115 JBR-7484 Update the cursor on mouse entered/exited
AppKit resets the cursor on native mouse entered/exited events. Depending on the order of events, it may end up setting the wrong cursor. So update it forcibly on such events.
2024-09-19 02:02:54 +02:00
Sergei Tachenov
92fb90645b JBR-7481 Work around mouse entered/exited bug
To fix missing mouse entered/exited events when
using rounded corners, we keep track of mouse moved events. When a mouse moved event is detected, and the current peer under the cursor belongs to a different window, we send fake mouse entered/exit events to the old and new windows. We also filter late mouse exited events.

The workaround is enabled by default with the VM option "awt.mac.enableMouseEnteredExitedWorkaround" to disable it in case something breaks.

About the test:
Use the robot to find the points when the mouse
entered event is sent to the popup when the mouse
enters through a rounded corner, and the similar
point for entering the outer window when exiting
through such a corner.

Once the points are found, move the mouse back
and forth to that point, but not beyond.
The correct behavior is that when the mouse
enters the popup, a mouse exited event is sent
to the outer frame and vice versa.
Therefore, every mouse entered/exited event
should be received exactly once.

Use reflection to set the rounded corners,
as JBR API isn't available in tests.
2024-09-19 02:02:54 +02:00
Vitaly Provodin
3bbe436365 Update README.md 2024-09-19 02:02:54 +02:00
Alexey Ushakov
41b95694b6 JBR-7588 Metal: Reuse MTLContext for all GCs of the same GPU
Implemented reference counting for shared MTLContext objects.
2024-09-19 02:02:54 +02:00
Nikita Gubarkov
f2ab3f6c3b JBR-5973 Vulkan: Fix validation errors (#452)
- Added proper synchronization and image layout transitions.
- Refactored VKRenderer to hold per-device rendering context. Isolated surface rendering contexts.
- Implemented reusing of command buffers and semaphores
- Fixed surface resize, made surface initialization more robust.
- Added on-demand pipeline creation for actual surface formats.
- Added missing destruction logic.
- Added macros for easy checking of return codes, logging with source code location.
- Moved implementation details out of headers where possible. Stripped dead code.
- Implemented consistent OOM strategy from dynamic arrays and ring buffers.
2024-09-19 02:02:53 +02:00
Maxim Kartashev
1450d5d87f Wayland: Fixed build errors after rebasing on JDK24 2024-09-19 02:02:53 +02:00
Maxim Kartashev
f84fdae618 JBR-5615 added missing part for WLToolkit 2024-09-19 02:02:53 +02:00
Dominik Matta
baea8c296b JBR-6763 Wayland: application crashes when popup closed
Certain Wayland compositors (wlroots) invalidate xdg_surface after window with popup loses focus. Subsequent attempts to
commit the popup window fail with protocol error "xdg_surface has never been configured".

Handle popup_done event by hiding the popup window. Also emit WINDOW_CLOSING event as otherwise focus remains on the popup parent.

Co-authored-by: Maxim Kartashёv <maxim@kartashev.spb.ru>
2024-09-19 02:02:53 +02:00
Maxim Kartashev
17c989b0a9 JBR-6468 Wayland: java/awt/datatransfer/MimeFormatsTest.java fails by timeout
Excluded the test from jdk_awt_wayland as it can't be made to work
under Wayland.
2024-09-19 02:02:53 +02:00
Maxim Kartashev
9883365c8e Added proper copyright headers 2024-09-19 02:02:53 +02:00
Nikita Gubarkov
cfc93dd256 Fix WindowMoveService on Wayland 2024-09-19 02:02:53 +02:00
Nikita Gubarkov
827e6c05ea JBR-7570 Implemented ring buffer. Added lazy implicit initialization for dynamic arrays. (#451) 2024-09-19 02:02:53 +02:00
Nikita Gubarkov
0b8748f16a JBR-7568 Vulkan: Refactor VKLogicalDevice into VKDevice (#449)
* Renamed VKLogicalDevice to VKDevice for conformance and convenience.
* Refactored device->device to device->handle for clarity.
2024-09-19 02:02:53 +02:00
Nikita Gubarkov
5dd02d9b02 JBR-7569 Removed VMA-Hpp (#450) 2024-09-19 02:02:53 +02:00
Dmitrii Morskii
3e7d15ec52 JBR-7126 add more possible names for cursor arrow icon 2024-09-19 02:02:53 +02:00
Maxim Kartashёv
3db3902d89 JBR-7016 IDEA 2024.2 Wayland: UI Crash when selecting Code and pressing Alt+Enter 2024-09-19 02:02:53 +02:00
Maxim Kartashёv
de0377e204 JBR-7493 Wayland: can't start in maximized state on WSL 2024-09-19 02:02:53 +02:00
Maxim Kartashёv
8b8106b131 JBR-7516 Wayland: DamageList_AddList: Assertion `list != add' failed 2024-09-19 02:02:53 +02:00
Maxim Kartashёv
d9260d9bcf JBR-7501 Wayland: SurfaceData.flush() method is mis-used 2024-09-19 02:02:53 +02:00
Nikita Tsarev
a83c374f33 JBR-7478: Fix wrong timestamps on KEY_TYPED events [WLToolkit] 2024-09-19 02:02:52 +02:00
lbourges
6b78927b5e JBR-7461: Implement VKTexturePool for the linux vulkan pipeline:
- based on common AccelTexturePool
 - new VKTexturePool instance in VKLogicalDevice
 - fixed SIGSEGV in VKImage dispose
 - store device in TPI
 - indentation fixes
 - merged with latest changes for JBR-7460
 - use (ATexturePoolLock_init)(void)
 - fixed logs in lock implementations + fixed indentation
 - fixed MTLTexturePool to pre-processor conditions (not runtime) on USE_ACCEL_TEXTURE_POOL
2024-09-19 02:02:52 +02:00
Maxim Kartashёv
f7fb8ee705 JBR-7313 Wayland: error: xdg_surface buffer does not match the configured maximized state 2024-09-19 02:02:52 +02:00
Maxim Kartashev
3fd132f8dc JBR-7397 Wayland: make certain interfaces optional 2024-09-19 02:02:52 +02:00
Maxim Kartashev
7997392290 JBR-7397 CLion 2024.2-EAP/Wayland crashes on startup with Miriway
Check if all non-optional interfaces are supported before actually
starting to run
2024-09-19 02:02:52 +02:00
Alexey Ushakov
5ea5da09d5 JBR-7452 Vulkan: Reuse VkRenderPass for multiple renderers (#428)
Moved shared VkRenderPass to the logical device
2024-09-19 02:02:52 +02:00
Alexey Ushakov
e689ca0a78 JBR-7420 Vulkan: Implement DRAW_PARALLELOGRAM primitive for flat color rendering (#426)
Refactored rendering code. Provided common implementation for fill and draw operations.
2024-09-19 02:02:52 +02:00
Nikita Gubarkov
27faeb69c7 JBR-7419 Refactor Vulkan code
- Separate instance and device-specific function tables
- Avoid using device from global context when possible
- Set up debug logger
2024-09-19 02:02:52 +02:00
Maxim Kartashёv
6abf6d89b3 JBR-7390 Wayland: need better headless exception message 2024-09-19 02:02:52 +02:00
Maxim Kartashёv
165c11b8fd JBR-7259 Find Usages popup can't be resized under Wayland
Popup's positioner size has to be in sync with popup's buffer size
2024-09-19 02:02:52 +02:00
Maxim Kartashёv
75fff44758 JBR-7254 Impossible to copy/paste files in Project tree 2024-09-19 02:02:52 +02:00
Maxim Kartashev
ed200d0105 JBR-7290 Wayland: window permanently looses focus after invoking Go To Line dialog 2024-09-19 02:02:52 +02:00
Alexey Ushakov
21c15b536d JBR-7308 Vulkan: Build failure in vulkan enabled builds
Added missing header (jni_util.h)
2024-09-19 02:02:52 +02:00
Alexey Ushakov
c085875614 JBR-7305 Vulkan: Implement FILL_SPANS primitive for flat color rendering
Implemented flat color shape rendering
2024-09-19 02:02:52 +02:00
Nikita Gubarkov
92fc7d0930 JBR-7307 Add stub for VKInstance.initNative with disabled Vulkan. 2024-09-19 02:02:52 +02:00
Nikita Gubarkov
a397cac32e JBR-7237 Fix cyclic dependency of Wayland and Vulkan initialization (#396) 2024-09-19 02:02:51 +02:00
Maxim Kartashёv
2354956aac JBR-7072 Wayland: clicks on items of floating context menus are ignored (#405)
JBR-7072 Wayland: clicks on items of floating context menus are ignored
2024-09-19 02:02:51 +02:00
Alexey Ushakov
065bb42ff9 JBR-7256 Vulkan: Implement FILL_PARALLELOGRAM primitive for flat color rendering 2024-09-19 02:02:51 +02:00
Maxim Kartashev
91e5f0e655 JBR-7237 Separate display connect from WLToolkit initialization 2024-09-19 02:02:51 +02:00
Maxim Kartashev
b9d84c61e3 JBR-7202 wayland: memory leak when resizing windows 2024-09-19 02:02:51 +02:00
Maxim Kartashev
46bf1f9540 JBR-7206 Wayland: Stylepad demo flickers when resizing on KDE 2024-09-19 02:02:51 +02:00
Alexey Ushakov
dd75368b08 JBR-6543 Vulkan: migrate current code to pure c (#267)
JBR-6543 Vulkan: migrate current code to pure c

Replaced C++ vulkan rendering with C one
2024-09-19 02:02:51 +02:00
Maxim Kartashev
455cbe7a55 JBR-7209 Wayland: modernize window decorations 2024-09-19 02:02:51 +02:00
Maxim Kartashev
e24e33146a JBR-7201 Wayland: update copyright in files generated by wayland-scanner 2024-09-19 02:02:51 +02:00
Maxim Kartashev
d496a035c7 JBR-7198 Wayland: jvm crashes under KDE
Do not copy the buffer if the drawing buffer has not been resized yet as
the size will not match that of the show buffer.
Also, properly guard against the size change by another thread while
copying.
2024-09-19 02:02:51 +02:00
Maxim Kartashev
20d3be70c0 JBR-7158 Wayland: scale with wp_viewport instead of buffer scale 2024-09-19 02:02:51 +02:00
Maxim Kartashev
dd0fdede6b JBR-7028 Implement FPS counter on Linux
Use -Dawt.window.counters to enable.
To output counters per second to stdout/stderr,
use -Dawt.window.counters=stdout or =stderr.

A counter by the name swing.RepaintManager.updateWindows
is always available for Swing applications, but it does not
accurately correspond to frames per second.

Toolkit-dependent counters provide much better accuracy.
On Wayland with memory buffers as the backend two are available:
java2d.native.frames - frames delivered to the Wayland server
java2d.native.framesDropped - fully formed frames that were not
delivered to the Wayland server
2024-09-19 02:02:51 +02:00
Maxim Kartashev
35537a9ee8 JBR-7047 Deadlock on git fetch on Wayland 2024-09-19 02:02:51 +02:00
Maxim Kartashev
3fc3c8f436 JBR-6576 Wayland: exception when double-clicking dialog title bar 2024-09-19 02:02:51 +02:00
Maxim Kartashev
fcaff9e818 JBR-7058 Wayland: IDE hang on the popup appearance
Clean up the damage list when resizing a surface.
Additionally, clamp the damaged area before copying to its current
actual size in order to safeguard against invalid external input.
2024-09-19 02:02:50 +02:00
tsarn
6f22340e7f JBR-7063: Make .getKeyChar() report chars in KEY_PRESSED/KEY_RELEASED events for compatibility [WLToolkit] (#371) 2024-09-19 02:02:50 +02:00
tsarn
e744edbbb9 JBR-6848: Support extra mouse buttons for navigation [WLToolkit] 2024-09-19 02:02:50 +02:00
tsarn
37f51e4823 JBR-6434: Fix pointer leave also resetting the keyboard modifiers [WLToolkit] (#370) 2024-09-19 02:02:50 +02:00
tsarn
8078864593 JBR-7044: Reset clickCount on mouse moves [WLToolkit] 2024-09-19 02:02:50 +02:00
Maxim Kartashev
d44bde8529 JBR-7010 Wayland: Swing window resizing is not smooth enough 2024-09-19 02:02:50 +02:00
Maxim Kartashev
04a04a0760 JBR-6926 Wayland: fonts are aliased/grainy on first start 2024-09-19 02:02:50 +02:00
Maxim Kartashev
7f21566ec4 JBR-6920 Wayland: some IDEA popups positioned incorrectly 2024-09-19 02:02:50 +02:00
Maxim Kartashev
a7d37c9222 JBR-6895 Wayland: cursor changes to resize at edges even when window is maximized 2024-09-19 02:02:50 +02:00
Maxim Kartashev
b926d23938 JBR-6884 SIGSEGV in Java_sun_java2d_wl_WLSMSurfaceData_pixelsAt 2024-09-19 02:02:50 +02:00
Maxim Kartashev
924493a77f JBR-6448 Wayland: IDEA window looks pixelated after monitors scale was changed 2024-09-19 02:02:50 +02:00
Maxim Kartashev
45a3505061 JBR-6814 Wayland: support sun.java2d.uiScale property 2024-09-19 02:02:50 +02:00
Alexey Ushakov
ee87270cbb JBR-6787 WLToolkit/wsl: crash in WLComponentPeer.setCursor
Added check for unavailable cursor pData
2024-09-19 02:02:50 +02:00
Maxim Kartashev
2927ab6642 JBR-6783 MouseEvent/MenuDragMouseEventAbsoluteCoordsTest/MenuDragMouseEventAbsoluteCoordsTest.java: Found one Java-level deadlock 2024-09-19 02:02:50 +02:00
Maxim Kartashev
f519e00f18 JBR-6504 Wayland: optional Robot capability to peek at current window's pixels 2024-09-19 02:02:50 +02:00
Maxim Kartashev
f4a8f8c898 JBR-6519 Linux: SIGSEGV at [libwayland] wl_proxy_get_version
Guard against passing NULL to libwayland
2024-09-19 02:02:49 +02:00
Maxim Kartashev
07e746498c JBR-6736 libwakefield crashes weston 2024-09-19 02:02:49 +02:00
Maxim Kartashev
599a556524 JBR-6722 OutOfMemoryError: Failed to allocate Wayland surface buffer 2024-09-19 02:02:49 +02:00
Maxim Kartashev
f82587f413 JBR-6617 Wayland: java/awt/Frame/HugeFrame/HugeFrame.java crashes JVM 2024-09-19 02:02:49 +02:00
Maxim Kartashev
417962a73b JBR-6598 Wayland: window gets un-maximized after switching
When the size of the buffer changes, cancel the frame callback
and make sure that the next surface commit happens with the new buffer.
2024-09-19 02:02:49 +02:00
Maxim Kartashev
3df78631af JBR-6469 Wayland: java/awt/image/ColorModel/DrawCustomColorModel.java throws UnsupportedOperationException 2024-09-19 02:02:49 +02:00
Maxim Kartashev
8b22a03ff1 JBR-6467 Wayland: java/awt/GraphicsConfiguration/NormalizingTransformTest/NormalizingTransformTest.java fails 2024-09-19 02:02:49 +02:00
Maxim Kartashev
90be5ec20c JBR-6547 WLToolkit: no app icon in GNOME
Allow to associate the application's window with .desktop file with icon
and other info with -Dawt.app.id=... (DBus application name similar to
WM_CLASS in X
2024-09-19 02:02:49 +02:00
Maxim Kartashev
4775f9f3af JBR-6559 Wayland: popups may stop working after a while
Cancel the frame callback when hiding a window.
2024-09-19 02:02:49 +02:00
Maxim Kartashev
c262d21706 JBR-6452 Wayland: avoid copying entire surface buffers 2024-09-19 02:02:49 +02:00
Maxim Kartashev
4cf30862ba JBR-6452 Wayland: measure and improve surface buffer management
Improved rendering performance by
* reducing memory copy and making it more efficient,
* tying the next frame display to the frame event from Wayland,
  which dramatically reduces load for very quick Swing apps,
* limiting the number of buffers to 2.
2024-09-19 02:02:49 +02:00
Dmitrii Morskii
e840e624cb JBR-6372 Wayland:
-correctly positioning SplashScreen on multiple monitors;
-correctly correctly handles cases of SplashScreen with gif with transparent parts;
-refactoring;
2024-09-19 02:02:49 +02:00
Alexey Ushakov
1f9eea4d1c JBR-6445 Prepare RepaintManager code for displaySync=false
Refactored AWTAccessor code
2024-09-19 02:02:49 +02:00
Dmitry Batrak
bb000b2516 JBR-5961 Wayland: can't switch between projects using menu
fix activation not working on Ubuntu 23 (mutter 45.2), after a mouse button has been pressed in the originally active window
2024-09-19 02:02:49 +02:00
Maxim Kartashev
744fdc1f6b JBR-6416 Wayland: IDEA maximize button out of sync sometimes 2024-09-19 02:02:49 +02:00
Maxim Kartashev
219c70bfe0 JBR-6391 Wayland: memory indicator tooltip flickers 2024-09-19 02:02:48 +02:00
Dmitrii Morskii
adca158774 JBR-6213 Wayland: removed blurring on cursor on multiple monitors with different scales 2024-09-19 02:02:48 +02:00
Maxim Kartashev
e5b27b6cce JBR-6276 Wayland: WLToolkit logs too much
Changed the logging level for such messages to FINE
2024-09-19 02:02:48 +02:00
Maxim Kartashev
cdd0cf416b JBR-6316 Wayland: WLSMSurfaceData.getReplacement() throws UOE
Also fixed the keyboard repeat manager so that it does not prevent
application from shutting down.
Also improved fullscreen support.
2024-09-19 02:02:48 +02:00
Maxim Kartashev
92135ecc47 JBR-6321 Wayland: popup windows do not respect screen bounds 2024-09-19 02:02:48 +02:00
Maxim Kartashev
c27a21a91d JBR-6313 Wayland: pasting from clipboard doesn't always work
Also added a flush-to-server command following each Wayland request
2024-09-19 02:02:48 +02:00
Maxim Kartashev
df24cd8abc JBR-6276 Wayland: WLToolkit logs too much 2024-09-19 02:02:48 +02:00
Nikita Tsarev
afc700b029 JBR-5678: Refactor Wayland keyboard support 2024-09-19 02:02:48 +02:00
Dmitrii Morskii
430afaa683 JBR-5965 Wayland: implement SplashScreen 2024-09-19 02:02:48 +02:00
Maxim Kartashev
f094def40f JBR-6253 Wayland: can't run in weston because of xdg_wm_base version 3 2024-09-19 02:02:48 +02:00
Maxim Kartashev
fb7e5f53e2 JBR-6212 Wayland: app does not terminate upon Wayland protocol error 2024-09-19 02:02:48 +02:00
Maxim Kartashev
c5d9274efe JBR-6209 Wayland: popup windows cannot be moved 2024-09-19 02:02:48 +02:00
Maxim Kartashev
0a5790b408 JBR-5977 Wayland: make undecorated windows natively resizeable 2024-09-19 02:02:48 +02:00
Maxim Kartashev
87ab08fb12 JBR-6207 Wayland: many popup windows positioned incorrectly
When popup's parent is also its top-level window, use that instead of
null
2024-09-19 02:02:48 +02:00
Maxim Kartashev
f55bb934e0 JBR-6183 Wayland: clipboard-related exception in headless environment 2024-09-19 02:02:47 +02:00
Nikita Gubarkov
57989c1aa0 JBR-6144 Build JBR with Vulkan support
1. Update dockerfile to checkout Vulkan headers
2. Fix --with-vulkan-include configure option
2024-09-19 02:02:47 +02:00
Alexey Ushakov
6b5abc9ca9 JBR-6158 Cannot build jbr21 with wayland toolkit on wsl2
Added --with-wayland-lib option to provide custom library path
2024-09-19 02:02:47 +02:00
Maxim Kartashev
2411069dc4 JBR-5857 Wayland: implement clipboard support 2024-09-19 02:02:47 +02:00
Dmitry Batrak
f33491ff76 JBR-6145 [Wayland toolkit] Popup windows aren't focusable
A partial solution. Cases not still covered:
* Alt+tab from the app and back should keep popup focused if it was focused initially
* Mouse clicks between popup and owner should transfer focus as expected
2024-09-19 02:02:47 +02:00
Maxim Kartashev
156a806b10 JBR-6138 Wayland: utilize gtk_shell1 protocol to mark dialogs as modal 2024-09-19 02:02:47 +02:00
Maxim Kartashev
776ffaf55d JBR-6117 Wayland: JVM shutdown hang 2024-09-19 02:02:47 +02:00
Dmitry Batrak
0dede447bd JBR-5961 Wayland: can't switch between projects using menu
prevent using a pointer to destroyed surface
2024-09-19 02:02:47 +02:00
Dmitry Batrak
7f4aa0cc85 JBR-5961 Wayland: can't switch between projects using menu
fix typo
2024-09-19 02:02:47 +02:00
Dmitry Batrak
5504c30d97 JBR-5961 Wayland: can't switch between projects using menu
support Window.toFront in Wayland toolkit
2024-09-19 02:02:47 +02:00
Maxim Kartashev
ee3f9e715e JBR-6071 Alpine Linux compilation: error: implicit declaration of function 'pthread_getname_np' 2024-09-19 02:02:47 +02:00
Maxim Kartashev
f5e9b57736 JBR-5989 Wayland: jdk_awt_wayland test group 2024-09-19 02:02:47 +02:00
Maxim Kartashev
56c3d092cb JBR-6025 Wayland: miscellaneous small improvements 2024-09-19 02:02:47 +02:00
Alexey Ushakov
bc2e7351fb JBR-6045 WLToolkit(Vulkan): Add options to select physical device
Changed access to _name field, minor corrections in verbose print
2024-09-19 02:02:47 +02:00
Alexey Ushakov
f5121f459f JBR-6045 WLToolkit(Vulkan): Add options to select physical device
Implemented -Dsun.java2d.vulkan=True and -Dsun.java2d.vulkan.deviceNumber=n VM options
2024-09-19 02:02:47 +02:00
Maxim Kartashev
009bc5676d JBR-6036 Wayland: Cannot invoke "java.awt.Component.getWidth()" because "popupParent" is null
Not all POPUP Window's have their parent set. And only those who do
shall be treated as popups in the Wayland's sense.
2024-09-19 02:02:46 +02:00
Nikita Gubarkov
e7c82aab20 JBR-5973 Implement rendering of no-AA shapes with Vulkan pipeline
Get rid of maxTextureSize in Vulkan code. This concept was introduced to fix macOS-specific bugs and don't map well to Vulkan implementation, as this value is tied to specific device and texture format, so get rid of it for now and see whether we need it at all.

Refactored native surface data hierarchy. There was a C-style "inheritance" model with VKSDOps having an SurfaceDataOps as its first member and conversions back and forth between them. And then also privOps - pointer to the platform-specific part (WLVK). This was refactored into plain inheritance: SurfaceDataOps -> VKSurfaceData -> VKSwapchainSurfaceData -> WLVKSurfaceData

State management, synchronization & layout transition. Now using dynamic rendering and synchronization2 extensions.
Each device has a single timeline semaphore (basically 64-bit counter), monotonically increasing as device executes our commands, allowing us to track the state of the submitted batches and reuse resources which are no longer in use.

Split command recording into primary and secondary command buffers.
This allows us to record commands "in the past", before current render pass started, which gives possibility for some heavy optimizations:
1. When we suddenly need some texture in the middle of the render pass - no need to stop render pass in order to insert necessary synchronization - we can do it as if we knew it beforehand.
2. When we draw something and then clear the surface - just erase all commands inside current render pass we recorded earlier, so the actual drawing will never happen.

Shaders are compiled with glslc or glslangValidator and bytecode is inlined directly into libawt_wlawt

Memory management via VMA, vertex buffer pool, shader push constants.

Other refactoring.
2024-09-19 02:02:46 +02:00
Alexey Ushakov
66308be7c3 JBR-6032 WLToolkit: Uninitialized WLComponentPeer sends paint requests
Protected surfaceAssigned from MT access
2024-09-19 02:02:46 +02:00
Alexey Ushakov
0433150cf7 JBR-6032 WLToolkit: Uninitialized WLComponentPeer sends paint requests
Skip sending paint events for not configured peers
2024-09-19 02:02:46 +02:00
Maxim Kartashev
aea7874354 JBR-5968 Wayland: support PERPIXEL_TRANSLUCENT 2024-09-19 02:02:46 +02:00
Nikita Tsarev
4abaf65d30 JBR-5963: Fix RobotKeyboard test and implement getLockingKeyState 2024-09-19 02:02:46 +02:00
Maxim Kartashev
b9245534f8 JBR-5962 Wayland: fix the main event loop to allow for secondary queues
Return READ_RESULT_FINISHED_NO_EVENTS from WLToolkit.readEvents() in
case of poll returning with no new data (i.e. via timeout).
2024-09-19 02:02:46 +02:00
Nikita Tsarev
c137a175be Regenerate wakefield-client-protocol using an older wayland-scanner to temporarily fix build problems 2024-09-19 02:02:46 +02:00
Nikita Tsarev
049fc3dccf JBR-5676: Support emulating input events in Wakefield 2024-09-19 02:02:46 +02:00
Nikita Tsarev
2aa5b17f8f JBR-5900: Fix deadlock when enabling the Wakefield extension 2024-09-19 02:02:46 +02:00
Nikita Tsarev
ccd16d5967 JBR-5896: Fix WLToolkit being instantiated twice 2024-09-19 02:02:46 +02:00
Maxim Kartashev
d11ae58fb8 JBR-5861 Wayland: minimum necessary stubs to run IDEA 2024-09-19 02:02:46 +02:00
Alexey Ushakov
27059c0e74 JBR-5645 Provide basic classes for Vulkan rendering pipeline
Implemented shared classes for cross-platform vulkan implementation and some support for wayland toolkit
2024-09-19 02:02:46 +02:00
Maxim Kartashev
dec35455e1 JBR-5661 Wayland: implement heavy-weight popup windows 2024-09-19 02:02:46 +02:00
Maxim Kartashev
4570707b2a JBR-5666 Wayland: WLToolkit doesn't work with weston
Multiple Wayland buffers support.
2024-09-19 02:02:45 +02:00
Maxim Kartashev
4c29c7c280 JBR-5658 Wayland: incorrect scaling of window content
The buffer scale is changed atomically with the size.
WLGraphicsConfig made immutable and is re-created when scaling changes.
WLGraphicsDevice is also re-created when its position changes.
2024-09-19 02:02:45 +02:00
Maxim Kartashev
092abfd43f JBR-5657 Wayland: sometimes there's a deadlock at the start
Don't exit from toolkit initialization until all the necessary
information has been received from the Wayland server.
2024-09-19 02:02:45 +02:00
Maxim Kartashev
95b06ec4bd JBR-5655 java/awt/Toolkit/Wayland/WaylandToolkit.java: WLToolkit not found
WLToolkit made operational in headless mode
2024-09-19 02:02:45 +02:00
Maxim Kartashev
bf9142130e Wayland: fix AWT initialization on macOS 2024-09-19 02:02:45 +02:00
Maxim Kartashev
e5922d8349 Wayland: fixed build errors on macOS 2024-09-19 02:02:45 +02:00
Maxim Kartashev
31125ee005 Wayland: fixed build errors with older versions of Wayland 2024-09-19 02:02:45 +02:00
Alexey Ushakov
5fbf93be95 Initial version of WLToolkit and Vulkan support
Co-authored-by: Dmitry Batrak <Dmitry.Batrak@jetbrains.com>
Co-authored-by: Nikita Gubarkov <nikita.gubarkov@jetbrains.com>
Co-authored-by: Maxim Kartashev <maxim.kartashev@jetbrains.com>
2024-09-19 02:02:45 +02:00
Konstantin Nisht
5d33a2d8bf JBR-7466 Exception on VM startup with -Djava.util.zip.use.nio.for.zip.file.access=true 2024-09-19 02:02:45 +02:00
Konstantin Nisht
93fef85bbb JBR-7392: Use NIO FS in ZipFile 2024-09-19 02:02:45 +02:00
Vitaly Provodin
55c02a47dd Update README.md 2024-09-19 02:02:45 +02:00
Vitaly Provodin
d99942b6fe JBR-7532 upgrade alpine up to 3.14, specify versions of installing packages, and deploy the latest available jdk20 (same as in jbr21) 2024-09-19 02:02:45 +02:00
Vitaly Provodin
708140ec85 JBR-7456 add regression test checking if implementations of all available the random number generator algorithms can be instantiated, including the default one 2024-09-19 02:02:45 +02:00
Nikita Tsarev
7aaeda659e JBR-7529: Explicitly check for press-and-hold in performKeyEquivalent 2024-09-19 02:02:45 +02:00
Vitaly Provodin
8ae7db6e33 JBR-7517 build JBR artefacts with CDS archives 2024-09-19 02:02:44 +02:00
Sergey Shelomentsev
daf94fb714 JBR-5318 add Github workflow usage for pull requests pre-commit testing 2024-09-19 02:02:44 +02:00
Vitaly Provodin
0816566eaa Update README.md 2024-09-19 02:02:44 +02:00
bourgesl
c3b31e065c JBR-7460: fixed (macos) MTLTexturePool GC implementation: minor syntax updates from JBR-7461 2024-09-19 02:02:44 +02:00
Nikita Tsarev
ad267b1e7d JBR-7426: Fix cancelling press-and-hold causing some future key events being swallowed 2024-09-19 02:02:44 +02:00
bourgesl
252c0a155f JBR-7460: fixed (macos) MTLTexturePool GC implementation to release texture memory more promptly (regular young GC freeing not reused textures since 15s) + unified API with new generic AccelTexturePool (C) to be shared with the coming vulkan pipeline (linux) 2024-09-19 02:02:44 +02:00
Dmitrii Morskii
9111218ecf JBR-6772 handled case with adding new timers after VM was suspended 2024-09-19 02:02:44 +02:00
Maxim Kartashёv
8faf394112 JBR-5956 Provide more details on assertion failure
Use JNU_RUNTIME_ASSERT(env, cond, msg) defined in jni_util.h
to crash JVM when 'cond' is not true with the given message
and source location information in the fatal error log.
2024-09-19 02:02:44 +02:00
Sergey Shelomentsev
7333fd385d Update jbr-api version to 1.0.2 2024-09-19 02:02:44 +02:00
Stanislav Dombrovsky
49e3c75b44 Fix rendering of HTML list dots + better vertical align for them.
(cherry picked from commit fa4a404533ba1ef638fe523adc74391aee8a3ebf)

(cherry picked from commit 9f079c66e9)
2024-09-19 02:02:44 +02:00
Nikita Tsarev
3237ae4219 JBR-6588: JBR API for inspecting certain properties of KeyEvents 2024-09-19 02:02:44 +02:00
Nikita Tsarev
7e4fde6c3d JBR-7449: Fix press-and-hold cancel keys not being swallowed by JBR 2024-09-19 02:02:44 +02:00
Dmitrii Morskii
3d3d28a34f JBR-7438 tune updateCursorImmediately method 2024-09-19 02:02:44 +02:00
Alexey Ushakov
93b5e1ccde JBR-6545 java/awt/Mixing/AWT_Mixing/JProgressPaneOverlapping.java fails by time out (sun.java2d.metal.MTLLayer.blitTexture)
Moved test frame by some offset to avoid interaction with mac menu bar
2024-09-19 02:02:44 +02:00
Artem Bochkarev
adf693318a JBR-5405: supported BufImgSurfaceData 2024-09-19 02:02:44 +02:00
Maxim Kartashev
1991ced983 JBR-6830 Poor performance with KDE Plasma 6 X11
Use -Dwatch.desktop.geometry=false as a workaround until the KWin issue
is fixed
2024-09-19 02:02:43 +02:00
Maxim Kartashev
ac322505fe JBR-3323 Exclude parts of VM code from sanitizer checks
Exclude VM error-reporting code that treats memory as a raw sequence of
bytes from address sanitizer checks. This is needed to only get true
reports when running tests against the --enable-asan build.
2024-09-19 02:02:43 +02:00
Artem Bochkarev
8f95839013 JBR-4430 Fixed execution permissions on Linux 2024-09-19 02:02:43 +02:00
Vitaly Provodin
2fdc0eed31 update exclude list on results of 21.0.3_b517.1 test runs 2024-09-19 02:02:43 +02:00
Vitaly Provodin
5092333989 Update README.md 2024-09-19 02:02:43 +02:00
bourgesl
53cd9e529c JBR-4530: make opengl & metal handle colorMatching on non-SRGB profile consistently (controlled by the system property 'sun.java2d.osx.colorMatching') + updated MacOSLayerColorTest to test color matching setting on OpenGL & Metal pipelines 2024-09-19 02:02:43 +02:00
Vitaly Provodin
509c694314 Update README.md 2024-09-19 02:02:43 +02:00
Vitaly Provodin
231912fa1a JBR-6696: fix drawableId usage + revert PrinterJob changes (non-appkit thread) 2024-09-19 02:02:43 +02:00
Vitaly Provodin
5865e4a6b6 Update README.md 2024-09-19 02:02:43 +02:00
Vitaly Provodin
b504dfae8f Update README.md 2024-09-19 02:02:43 +02:00
bourgesl
fb68fd6e7d JBR-6696: added MTLContext CVDisplayLink checks, improved MTLLayer drawable lifecycle, hardened appkit main thread usage with ThreadUtilities instrumentation to monitor all performOnMainThread usages and report high latency tasks in LWCToolkit platform logger (use system property 'sun.awt.mac.mainThreadLatency=xx' in milliseconds), fixed few MainThread violations (PrinterView init) 2024-09-19 02:02:43 +02:00
Alexey Ushakov
c38e069578 JBR-5063 macOS: SIGILL at [libsystem_kernel] __kill in java.lang.IllegalStateException: Error - unable to initialize Metal after recreation of graphics device. Cannot load metal library...
Add fallback to MTLCreateSystemDefaultDevice for main display
2024-09-19 02:02:43 +02:00
Nikita Tsarev
08feeb2a6e JBR-6764: Add null check on hostAdapterLocator 2024-09-19 02:02:43 +02:00
Sergey Shelomentsev
8a24f29727 JBR-4912 test moved from JBR repository 2024-09-19 02:02:43 +02:00
Nikita Provotorov
cdd1baae53 JBR-7157: Alt+Shift+Enter sends KEY_TYPED Event.
JBR-7336 Any keyboard shortcut with Alt produces a Windows system sound.

* X11 Linux part: disable posting KEY_TYPED events for VK_ENTER if any modifier except { Shift, Control, Lock, Mode Switch (a.k.a. AltGr), NumLock } is being pressed.
* Windows part: begin ignoring WM_SYSCHAR messages as MSDN instructs.
* Add a regression test.
2024-09-19 02:02:42 +02:00
Nikita Tsarev
1a4ededbe8 JBR-6764: Work around IMEs breaking on macOS due to macOS JavaRuntimeSupport not reporting the correct locale in IMEs once after application startup 2024-09-19 02:02:42 +02:00
Vitaly Provodin
dfac21b942 Update README.md 2024-09-19 02:02:42 +02:00
Artem Bochkarev
8917dce3bc JBR-5405: implementation of direct raster loading for VolatileImage 2024-09-19 02:02:42 +02:00
Vitaly Provodin
5f9bfd6bcc update exclude list on results of 21.0.3_b479 test runs 2024-09-19 02:02:42 +02:00
Vitaly Provodin
677d68782a fixup! JBR-7263 introduce /othervm for the tests specifying -Djetbrains.runtime.api.extendRegistry=true 2024-09-19 02:02:42 +02:00
bourgesl
1a85706263 JBR-7170: fixed NPE if peer is null 2024-09-19 02:02:42 +02:00
Sergey Shelomentsev
db9f22c035 Set jbr-api version to 1.0.0 2024-09-19 02:02:42 +02:00
Nikita Tsarev
0f8eecd8c7 JBR-7133: JBR API for IME replacement range on macOS 2024-09-19 02:02:42 +02:00
Vitaly Provodin
949a9e8b0b update exclude lists removing lines related to fixed issues 2024-09-19 02:02:42 +02:00
Vitaly Provodin
3ef5ea3863 Update README.md 2024-09-19 02:02:42 +02:00
Maxim Kartashev
319fec058b JBR-5761 Make error printing more robust during early stages of VM initialization 2024-09-19 02:02:42 +02:00
bourgesl
4100fa6092 JBR-7170: added explicit @available for addPresentedHandler() 2024-09-19 02:02:42 +02:00
bourgesl
24828a2cf1 JBR-7170: implement FPS counters for metal using callbacks from MTLLayer presentHandler 2024-09-19 02:02:42 +02:00
Nikita Gubarkov
bd2408fe70 JBR-5615 add sun.java2d.logDisplays VM option
It prints to stdout whenever display configuration is changed.
2024-09-19 02:02:42 +02:00
Nikita Gubarkov
29eddb9f5c JBR-6357 JBR API v3
JBR API frontend is moved into a separate repository.
Rewritten proxy generation, bridges removed, invokedynamic is used instead.
Mapping is now specified using annotations.
Support for extension methods.
Support for arrays and generics.
Added JBR API implementation version.

JBR-7232 Refactor deriveFontWithFeatures & JBRFileDialog JBR API
2024-09-19 02:02:41 +02:00
Roman Shevchenko
8454792e7c JBR-7194: extension-based filters in native file dialogs 2024-09-19 02:02:41 +02:00
Nikita Tsarev
0e95d10315 JBR-7134: Fix InputMethodTests on macOS 2024-09-19 02:02:41 +02:00
Vitaly Provodin
c56348b08c Update README.md 2024-09-19 02:02:41 +02:00
Dmitrii Morskii
c24ad2addb JBR-7128 Use the correct WmSize event type for JFrame moved to another monitor
author: Sergei Tachenov
2024-09-19 02:02:41 +02:00
Vitaly Provodin
3180044d51 Update README.md 2024-09-19 02:02:41 +02:00
Vitaly Provodin
c1a5e6bcfe update exclude list on results of 21.0.3_b453.2 test runs 2024-09-19 02:02:41 +02:00
Sergey Shelomentsev
6efa11918c JBR-7117 Set initial display mode after test execution 2024-09-19 02:02:41 +02:00
Vitaly Provodin
9fedc00ef6 Update README.md 2024-09-19 02:02:41 +02:00
Maxim Kartashev
87c9883500 JBR-7151 Test PropertyPermissionOnEDT and others fail with ExceptionInInitializerError 2024-09-19 02:02:41 +02:00
Maxim Kartashev
82a2b74da8 JBR-7028 Implement FPS counter on Linux
Use -Dawt.window.counters to enable.
To output counters per second to stdout/stderr,
use -Dawt.window.counters=stdout or =stderr.

A counter by the name swing.RepaintManager.updateWindows
is always available for Swing applications, but it does not
accurately correspond to frames per second.

Toolkit-dependent counters provide much better accuracy.
On Wayland with memory buffers as the backend two are available:
java2d.native.frames - frames delivered to the Wayland server
java2d.native.framesDropped - fully formed frames that were not
delivered to the Wayland server
2024-09-19 02:02:41 +02:00
Vitaly Provodin
538974a9ca Update README.md 2024-09-19 02:02:41 +02:00
Dmitry Drobotov
a98d405def JBR-6808 Don't create AccessibleJTreeNode for the tree root if it's not visible
* This fixes an issue with AccessibleJTreeNode#getBounds, which adjusts the node's bounds according to the parent node. For nodes whose parent is the invisible root, getBounds was returning null, and it caused issues with assistive technology like macOS Accessibility Zoom.
* Additionally, NVDA will now report correct tree depth levels because the root node won't add to the levels count (JDK-8249806).

(cherry picked from commit f7c47bf3cf)
2024-09-19 02:02:41 +02:00
Vitaly Provodin
2369427918 Update README.md 2024-09-19 02:02:41 +02:00
Vitaly Provodin
e537c4d603 Update README.md 2024-09-19 02:02:40 +02:00
Vitaly Provodin
a42cfed995 update exclude list on results of 21.0.3_b446.1 test runs 2024-09-19 02:02:40 +02:00
Nikita Provotorov
7f6f054051 JBR-6456 Sudden keyboard death on Linux using iBus.
Add a workaround for the iBus's bug which leads to the issue.

(cherry picked from commit b8e9dbf8c9)
2024-09-19 02:02:40 +02:00
Nikita Tsarev
b14b331d43 JBR-7119: respect replacementRange in IME events on macOS 2024-09-19 02:02:40 +02:00
Dmitrii Morskii
2e1031df1d JBR-6376: implement detecting of OS theme on linux 2024-09-19 02:02:40 +02:00
Dmitrii Morskii
9571fd547b Revert "JBR-6372: implement detecting of OS theme on linux"
This reverts commit a657e4e2cbce139f2c5b53c7fb5f30d81f99e311.
2024-09-19 02:02:40 +02:00
Nikita Gubarkov
65fdaaf3a4 JBR-7046 Tolerate subpixelResolution=0 in Metal and OGL 2024-09-19 02:02:40 +02:00
Maxim Kartashev
72c3114ca1 JBR-5611 Window header is visible but body not on Linux Ubuntu with external display 2024-09-19 02:02:40 +02:00
Nikita Gubarkov
38684a5166 JBR-7020 Reorder LCD glyph cache freeing and validation
1. As we started committing the command buffer on glyph cache flush, this invalidates the current encoder. We need to `MTLTR_ValidateGlyphCache` after the flush, not before.
2. There's no reason to maintain separate glyph cache invalidation logic for this singe case (which is a no-op in reality), so just free the cache instead.
2024-09-19 02:02:40 +02:00
Nikita Tsarev
6a9c47b4f7 Disable flappy KeyCodesTest assertions, see JBR-6888 2024-09-19 02:02:40 +02:00
Sergei Tachenov
182e5efe85 JBR-6984 Fix BoxLayout/NPECheckRequests test
It was initially written and tested on Linux, but it turns out that
on other systems validate() can be called in between init() and start()
calls, which would break the test even though BoxLayout isn't broken.
2024-09-19 02:02:40 +02:00
Ajit Ghaisas
190b1c0206 update exclude list on results of main.2176 test runs 2024-09-19 02:02:40 +02:00
Vitaly Provodin
89ef4307ad introduce jbMuslProblemList.txt exclude list 2024-09-19 02:02:40 +02:00
Vitaly Provodin
1494cc93e7 update exclude list on results of 21.0.2_b427.6 test runs 2024-09-19 02:02:40 +02:00
Sergei Tachenov
81147239c6 JBR-6771 BoxLayout throws mysterious NPEs due to previous exceptions
The checkRequests method only does layout initialization
if it isn't initialized already. However, when an exception
is thrown during the initialization, the layout may end up
in a half-initialized state.

Fix this by using the field that is initialized the last to check
if the layout is initialized. If that field is null, it may mean
that the layout isn't initialized or that the last attempt
failed midway. Then we try again. This attempt can,
of course, break for the same reason as the previous one,
but in that case we'll at least get a stack trace pointing
to a real cause of the error and not some mysterious NPE
that seems to be impossible from the logic.

The bug is that if we add a component that throws an exception
in one of its methods called by BoxLayout, then the layout may
end up in a half-initialized state that would mistakenly be considered
fully initialized. Then it would try to access some fields
and throw NPE with a stack trace that tells exactly nothing
about what went wrong and where.

This test checks for the presence of this bug by adding a broken
component to a BoxLayout and then un-breaking this component
and checking that an exception is thrown even though the component
is no longer broken.
2024-09-19 02:02:40 +02:00
Maxim Kartashev
e5a567f97a JBR-6769 Make it possible to get info whether IDE is running in a virtual env
Added system property intellij.os.virtualization with possible values
"none", "Xen", "KVM", "VMWare", "HyperV"
2024-09-19 02:02:39 +02:00
Nikita Gubarkov
ce9bc56b5d JBR-6927 Safe asynchronous destruction of Metal graphics config. 2024-09-19 02:02:39 +02:00
Nikita Gubarkov
5cb83fbcf7 Fix Windows AWT compilation errors
Frame, Window, FileDialog, CustomTitleBar
2024-09-19 02:02:39 +02:00
Vitaly Provodin
ace45ead3d Update README.md 2024-09-19 02:02:39 +02:00
Vitaly Provodin
8a33cfaddd JBR-6639 Docker images for JBR/JCEF testing 2024-09-19 02:02:39 +02:00
Vitaly Provodin
963916fdac JBR-6915 add the option -w into mkimages scripts 2024-09-19 02:02:39 +02:00
Alexey Ushakov
2c1dd010bb JBR-6911 IDE crashes (EXC_BAD_ACCESS) after disconnecting the secondary display if a markdown file is opened (macOS Sonoma 14.4.1)
Corrected invalid usage of dealloc method, fixed memory leaks.
2024-09-19 02:02:39 +02:00
Dmitrii Morskii
3a6a475b13 JBR-6171 removing deadlock related to calling getCurrentServerTime 2024-09-19 02:02:39 +02:00
Maxim Kartashev
a925c92d66 JBR-6847 Improve locking performance on Windows
Use -XX:+UnlockExperimentalVMOptions -XX:-UseCriticalSection
to revert to the old behavior
2024-09-19 02:02:39 +02:00
Vitaly Provodin
e1eb95d6b3 update exclude list on results of 21.0.2_b417.1 test runs 2024-09-19 02:02:39 +02:00
Dmitrii Morskii
e112b49568 JBR-6372: implement detecting of OS theme on linux 2024-09-19 02:02:39 +02:00
Vitaly Provodin
03ca9f2c54 JBR-1668: minor fixes - temporary fix for compilation issue SystemHotkey.m:74:29: error: format string is not a string literal 2024-09-19 02:02:39 +02:00
Nikita Gubarkov
e053d9de2d JBR-6723 Deal with integer overflow in DrawGlyphList with enabled subpixelResolution 2024-09-19 02:02:39 +02:00
Vitaly Provodin
544a054f6e Update README.md 2024-09-19 02:02:39 +02:00
Nikita Provotorov
2ebd362909 JBR-3112 Linux: Last character issue with Korean.
- Ignores the IM text returned from XmbLookupString/XwcLookupString if the KeyPress event which XmbResetIC was called with was synthetic and the first after a call of XmbResetIC/XwcResetIC.
- Only for the new mode introduced in JBR-2460 (-Djb.awt.newXimClient.preferBelowTheSpot=true): cancel text composing on each mouse press, so that preedit text stops following the caret if it's moving in response to mouse clicks.

(cherry picked from commit 43a9a3a17a)
(cherry picked from commit 156e5d9b65)
2024-09-19 02:02:39 +02:00
Dmitrii Morskii
b5ed8b936a JBR-6541 Added ability to get supported features and stylistic sets for font 2024-09-19 02:02:38 +02:00
Nikita Tsarev
7b82eead5f increase delay in InputMethodTest 2024-09-19 02:02:38 +02:00
Nikita Tsarev
ec5d56dee0 JBR-6704: Fix extra IME events when a ctrl shortcut causes window focus switch [macOS] 2024-09-19 02:02:38 +02:00
Nikita Tsarev
6709825af2 JBR-6331: Fix some memory safety issues in macOS keyboards 2024-09-19 02:02:38 +02:00
Nikita Tsarev
584438ed23 JBR-6028: Check before attempting to switch to a layout that might not exist in KeyCodesTest 2024-09-19 02:02:38 +02:00
Nikita Tsarev
9c20b42498 InputMethodTest: fix certain IMEs not being added properly 2024-09-19 02:02:38 +02:00
Nikita Tsarev
4e05345082 JBR-5379: Ignore input events only on permament focus loss 2024-09-19 02:02:38 +02:00
Nikita Tsarev
cb7ee0e614 JBR-5630: vmoption to change dead key reporting behavior on macOS 2024-09-19 02:02:38 +02:00
Nikita Tsarev
208ec1f369 JBR-5469: Fix NextAppWinKey behavior with certain keys 2024-09-19 02:02:38 +02:00
Nikita Tsarev
86ca997ce1 JBR-5558: macOS keyboard rewrite 2 2024-09-19 02:02:38 +02:00
Nikita Tsarev
57539438b1 JBR-5295: Fix wrong keycodes for non-letter keys that lack a corresponding VK_ constant on macOS 2024-09-19 02:02:38 +02:00
Nikita Tsarev
1b8e3236cd JBR-5254: Fix Caps Lock not working properly on certain Chinese IMs
with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:02:38 +02:00
Nikita Tsarev
a11ef2213d Revert "8230926: [macosx] Two apostrophes are entered instead of one with "U.S. International - PC" layout"
This reverts commit 5049cad2b0.

After JBR-5173 this workaround is no longer necessary
2024-09-19 02:02:38 +02:00
Nikita Tsarev
c7484a29f0 JBR-5233 Setup/teardown necessary keyboard layouts in macOS keyboard tests 2024-09-19 02:02:38 +02:00
Nikita Tsarev
1dbcb57948 JBR-5173 macOS keyboard support rewrite
with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:02:37 +02:00
Nikita Tsarev
497cc25321 Revert "macOS national keyboard support"
This reverts commit 21bffd06bc.
2024-09-19 02:02:37 +02:00
Nikita Provotorov
3123734fa2 JBR-5107, JBR-5114: SIGILL/OOM from Java_sun_lwawt_macosx_LWCToolkit_getKeyboardLayoutNativeId.
A theoretical fix, it should:
- Catch any NSException (as it was initially expected);
- Probably fix possible memory leaks (by moving the layoutId var inside autoreleasepool).
2024-09-19 02:02:37 +02:00
Nikita Tsarev
8a9eb07237 JBR-4990: Undo changes to ExtendedKeyCodes 2024-09-19 02:02:37 +02:00
Nikita Tsarev
8d9586be58 JBR-3860: Fix shortcut behavior when Shift is the only modifier 2024-09-19 02:02:37 +02:00
Nikita Tsarev
3ce0c2645c JBR-4990: Fix regression tests for national keyboard layouts on macOS 2024-09-19 02:02:37 +02:00
Denis Konoplev
6fe38bbf56 fixup! macOS national keyboard support
Remove unused import that broke compilation
2024-09-19 02:02:37 +02:00
Denis Fokin
a3511be540 macOS national keyboard support 2024-09-19 02:02:37 +02:00
Nikita Gubarkov
7b18e67cdc JBR-6387 Revert "8315701: [macos] Regression: KeyEvent has different keycode on different keyboard layouts" 2024-09-19 02:02:37 +02:00
Vitaly Provodin
31eed10556 update exclude list on results of 21.0.2_b393.7 test runs 2024-09-19 02:02:37 +02:00
Nikita Gubarkov
9957583b24 JBR-6723 flush vertex cache and command buffer before freeing glyph cache. (#334) 2024-09-19 02:02:37 +02:00
Alexey Ushakov
e1fc4fa8b9 JBR-6785 wsl: update build scripts for linux target
Added explicit platform target
2024-09-19 02:02:37 +02:00
Vitaly Provodin
93deac8306 Update README.md 2024-09-19 02:02:37 +02:00
Vitaly Provodin
733f0b8714 Update README.md 2024-09-19 02:02:37 +02:00
Maxim Kartashev
5b8a97ef92 JBR-6742 Record resident set size in JVM fatal error log 2024-09-19 02:02:37 +02:00
Alexey Ushakov
ddd0ffcf08 JBR-6522 macOS: SIGSEGV at [libawt_lwawt.dylib+0x8eaa8] MTLGC_DestroyMTLGraphicsConfig
Fix of MT access to shared data in MTLGraphicsConfigInfo
2024-09-19 02:02:36 +02:00
Dmitry Drobotov
5c8f69f063 JBR-6593 Fix UI freezes with JAWS announcements
* Execute AccessibleAnnouncer.nativeAnnounce on a background thread on Windows to fix UI freezes. IntelliJ calls this method from EDT, but it doesn't need to run on EDT because on Windows it simply calls screen readers API without interacting with UI components. Additionally, when using a background thread, the JAWS SayString method, which previously could have been running for multiple seconds, is now executed immediately as expected, but the root cause of previous delays is unclear.
* In JawsAnnouncer, initialize COM library with the multithreaded model to allow executing it from different threads. Now COM is initialized and uninitialized on every call of the method as required by the [documentation](https://learn.microsoft.com/en-us/windows/win32/learnwin32/initializing-the-com-library): "Each thread that uses a COM interface must make a separate call to this function. For every successful call to CoInitializeEx, you must call CoUninitialize before the thread exits". IJawsApi COM object is still static and reused by different threads, which is allowed with a multithreaded concurrency model. It shouldn't cause issues because it has no state and only forwards calls to JAWS.

(cherry picked from commit 8cc4cd5cfd)
(cherry picked from commit d7d8d9b8e4)
2024-09-19 02:02:36 +02:00
Vitaly Provodin
0a2959585c update exclude list linux-x86 failures 2024-09-19 02:02:36 +02:00
Vitaly Provodin
a3e4d1c0e7 update exclude list on results of 22_b2075 test runs 2024-09-19 02:02:36 +02:00
Vitaly Provodin
e4af055849 update exclude list - remove failures no having tickets 2024-09-19 02:02:36 +02:00
Nikita Provotorov
ab2d3e7384 JBR-3697: Letter-based command mode actions are not triggered when using Chinese input method.
Fixes different platform-specific issues with disabling/enabling input methods support via java.awt.Component#enableInputMethods(boolean):
* Windows: disabling used to require to deactivate and then activate back the app window to be performed completely ;
* macOS: disabling used to leave the input method window visible (however, it wasn't affecting the input) ;
* Linux: with fcitx5 IMF (may not be reproduced with iBus) disabling and then enabling back the input method support used to reset the used input source (keyboard layout) to a default one. It's done via disabling the current XIM when the input method support is disabled instead of disposing it .

(cherry picked from commit 2933ea89f0)

The patch also contains the fix for "JBR-6711: java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java: JButton JPanel not collected."

It unsets its references to tracked components thus not preventing GC from collecting them.

(cherry picked from commit e9aab98a6c)
2024-09-19 02:02:36 +02:00
Dmitry Drobotov
e9876b18f8 JBR-6325 Implement keyboard focus tracking for macOS Accessibility Zoom
* Call UAZoomChangeFocus function when the keyboard focus is changed or when an accessible selection event is fired. Zoom viewport fill follow the accessible frame of the newly focused component, and if it has a selected child, its frame will be passed as part that needs to be highlighted.
* Fix an exception in ComboBoxAccessibility.accessibilitySelectedChildren when its selection is nil. This happens when a combo box doesn't have a selected item, and it this case Zoom wouldn't be able to follow the combo box location.
* Move the native handler of CAccessibility.focusChanged method from the legacy JavaComponentAccessibility to the new CommonComponentAccessibility class. It calls a class method (like a static method in Java), so there is no difference in which specific class it's located, but it allows to write the new code in the appropriate class.

(cherry picked from commit 75b06421ff)
2024-09-19 02:02:36 +02:00
Vitaly Provodin
eda9d57bcd Update README.md 2024-09-19 02:02:36 +02:00
Dmitrii Morskii
66b9b33203 JBR-5500 Handled situation of processing WM_ENDSESSION in process of closing application 2024-09-19 02:02:36 +02:00
Vitaly Provodin
8e7db0e4b3 Update README.md 2024-09-19 02:02:36 +02:00
Maxim Kartashev
d9ab9daed9 JBR-3572 Wayland: java/awt/Window/WindowTitleVisibleTest/WindowTitleVisibleTestLinuxGnome.java: title bar shown and hidden are the same.
Exclude the test when running under XWayland that doesn't implement
screen capture necessary for the test to function.
2024-09-19 02:02:36 +02:00
Dmitry Drobotov
ef2305967f JBR-6472 Add default value in CAccessibility.isComboBoxEditable to avoid NPE
(cherry picked from commit 93937603b3)
2024-09-19 02:02:36 +02:00
Alexey Ushakov
a14ea8784f JBR-6612 Provide standard scripts for performance measurements
run_rp.sh - additional checks
2024-09-19 02:02:36 +02:00
Maxim Kartashev
9b9a61e08f JBR-6246 Do not overwrite CDS archives after created with jlink 2024-09-19 02:02:36 +02:00
Alexey Ushakov
d89b2e73a3 JBR-6612 Provide standard scripts for performance measurements
Initial implementation for linux and macOS
2024-09-19 02:02:36 +02:00
Egor Ushakov
1425763eb7 JBR-1354 com/sun/tools/attach/PermissionTest.java: access denied ("java.util.PropertyPermission" "sun.tools.attach.tmp.only" "read")
(cherry picked from commit 3a09f6c1db)
2024-09-19 02:02:35 +02:00
Egor Ushakov
1d443f1aa0 JBR-1061 .attach_pid files in the working dir - flag to put .attach file in tmp dir only
(cherry picked from commit 4bd3f7835e)
2024-09-19 02:02:35 +02:00
Nikita Tsarev
b94741b03d JBR-6297: Don't check for NSInputManager wantsToHandleMouseEvents in mouseDown by default 2024-09-19 02:02:35 +02:00
Maxim Kartashev
262709eca1 Update README.md with up-to-date build instructions 2024-09-19 02:02:35 +02:00
Maxim Kartashev
e2684a4394 JBR-6247 Update JBR-specific tests after JDK-8314823 2024-09-19 02:02:35 +02:00
Maxim Kartashev
e7869e6659 JBR-1430 (8195129) Windows: use UTF16 version of Win32 API to load DLL
Also correct library name encoding in exception messages.

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:02:35 +02:00
Vitaly Provodin
353091cf5e Update README.md 2024-09-19 02:02:35 +02:00
Vitaly Provodin
d5f56398bf Update README.md 2024-09-19 02:02:35 +02:00
Alexey Ushakov
1df3a57a51 JBR-6522 macOS: SIGSEGV at [libawt_lwawt.dylib+0x8eaa8] MTLGC_DestroyMTLGraphicsConfig
Performing flush of pending rendering operation before destroying MTLGraphicsConfig
2024-09-19 02:02:35 +02:00
Nikita Gubarkov
4cb0531f3e JBR-4618 Force window size update after display reconfiguration
- Re-create all GraphicsDevices on displayChanged()
2024-09-19 02:02:35 +02:00
Dmitrii Morskii
7426aa213c JBR-6671 added option 'freetype.font.rendering' 2024-09-19 02:02:35 +02:00
Dmitrii Morskii
6bf08412e3 Revert "JBR-6346 update Inter font version"
This reverts commit 7712e529330674b83e39c8e81701db32436d42dc.
2024-09-19 02:02:35 +02:00
bourgesl
cc776ec254 Revert "JBR-6522: ensure thread-safety in MTLGC_DestroyMTLGraphicsConfig (pthread_mutex_t)"
This reverts commit e7e3638c52.
2024-09-19 02:02:35 +02:00
bourgesl
21d9abc610 JBR-6522: ensure thread-safety in MTLGC_DestroyMTLGraphicsConfig (pthread_mutex_t) 2024-09-19 02:02:35 +02:00
Vitaly Provodin
48d94f9ff6 JBR-6649 add synchronization for creating UI 2024-09-19 02:02:34 +02:00
Nikita Gubarkov
27c0e4645c JBR-6651 Exclude keycap emoji from EmojiVariation test. 2024-09-19 02:02:34 +02:00
Vitaly Provodin
d553577489 update exclude list on results of 22_b2014 test runs 2024-09-19 02:02:34 +02:00
Vitaly Provodin
ffea2f5c5e JBR-6620 restore displayMode to the state that was before running the test 2024-09-19 02:02:34 +02:00
Dmitrii Morskii
490c3e7458 JBR-6346 update Inter font version 2024-09-19 02:02:34 +02:00
Vitaly Provodin
43881c93ea Update README.md 2024-09-19 02:02:34 +02:00
Vitaly Provodin
646ba50228 remove resolved issues from exclude list 2024-09-19 02:02:34 +02:00
Vitaly Provodin
37b3a44a48 Update README.md 2024-09-19 02:02:34 +02:00
Dmitrii Morskii
07739ec1a6 JBR-6604 supported case when fonts directory is missing 2024-09-19 02:02:34 +02:00
Aleksey Shipilev
854dd3d5e1 update exclude list on results of main.2003 test runs 2024-09-19 02:02:34 +02:00
Vitaly Provodin
99c756663f JBR-6591 specify values for the configure options --with-vendor-url and --with-vendor-bug-url 2024-09-19 02:02:34 +02:00
Maxim Kartashev
6c491d947e JBR-4173 Tier1 test failures in jdk/javadoc/doclet/testModules
Introduction of JBR API changed the order of modules appearing in Java
Doc. This commit updates the corresponding tests to match the current
output with JBR API.
2024-09-19 02:02:34 +02:00
Dmitry Batrak
e6d594e26a JBR-6449 Introduce FontMetricsAccessor into JBR API
JBRE-MR-368

(cherry picked from commits f0d5a907ac, 5befaea6af, ea2c4bfc83, 04601189604827c115a5a3b36aa268ba5c39ef3dб 20468cf28b)
2024-09-19 02:02:34 +02:00
Vitaly Provodin
f2038fb9a1 JBR-6558 synchronize drawing and the test checking 2024-09-19 02:02:34 +02:00
Vitaly Provodin
474bb0ac22 JBR-6556 add saving screenshots for analysis of test failures 2024-09-19 02:02:33 +02:00
Vitaly Provodin
649a71fe1e update exclude list on results of 21.0.1_b334 test runs 2024-09-19 02:02:33 +02:00
Dmitrii
35442798f2 JBR-3098 move repaintPeer event from AppKit thread to EDT on macos 2024-09-19 02:02:33 +02:00
Nikita Gubarkov
d7e22f4a94 JBR-6264 Improved coordinate conversion in XWayland mode 2024-09-19 02:02:33 +02:00
bourgesl
69d80d4c8a JBR-6505: removed extra setNeedDisplay() in startRedrawIfNeeded() to restore JavaDraw performance (more frames rendered than real vsync FPS) 2024-09-19 02:02:33 +02:00
Vitaly Provodin
d3cd46a13a update exclude list on results of 21.0.1_b331.1 test runs 2024-09-19 02:02:33 +02:00
Vitaly Provodin
ff74d9dfb2 JBR-5863 add verbose mode thata saves the captured image 2024-09-19 02:02:33 +02:00
Vitaly Provodin
0006f887d6 JBR-6493 add jtreg test 2024-09-19 02:02:33 +02:00
Vitaly Provodin
53d45da603 update exclude list on results of 23_b1960 test runs 2024-09-19 02:02:33 +02:00
Dmitrii Morskii
91fd3399ef Revert "JBR-6346 update Inter font version"
This reverts commit 9aa690a94e.
2024-09-19 02:02:33 +02:00
bourgesl
be4c541834 JBR-6241: RenderPerf 23.12: remove older RenderPerfTest in src 2024-09-19 02:02:33 +02:00
Vitaly Provodin
5c5f87ef61 JBR-6454 add synchronization at disposing windows 2024-09-19 02:02:33 +02:00
bourgesl
a7a6eaf3b5 JBR-6377: fixed MTLLayer.redrawCount = 1 to avoid extra redraws with multiple windows 2024-09-19 02:02:33 +02:00
Maxim Kartashev
46c7ed7508 JBR-6340 Popups displayed shifted after moving IDE to another monitor via shortcut with auto-maximize enabled in Mutter
Windows no longer change their "native" size when moved between monitors
with different scale on Linux. Use -Dresize.with.scale=true to revert
that.
2024-09-19 02:02:33 +02:00
Nikita Gubarkov
0ff1f6d8ee JBR-5837 retrieve up-to-date default screen device in FullscreenWindowProps test.
Calling setDisplayMode() or setFullScreenWindow() may cause display reconfiguration.
2024-09-19 02:02:33 +02:00
Alexey Ushakov
daa97ccd47 JBR-6433 Rounded corners of popups disappear after a while
Removed opacity from CAMetalLayer for layers with rounded corners
2024-09-19 02:02:32 +02:00
Alexey Ushakov
60e3e1ff42 JBR-5621 Test failures with -Dsun.java2d.metal.displaySync=false
Created intermediate buffer in the MTLLayer
Implemented frame separation of window updates for AWT and Swing
Remove frame delays as they greatly affect throughput
Fixed test/jdk/sun/java2d/GdiRendering/ClipShapeRendering.java
Resolved crash on multi-GPU systems
2024-09-19 02:02:32 +02:00
Dmitrii Morskii
cbcddb8c38 JBR-6346 update Inter font version 2024-09-19 02:02:32 +02:00
Nikita Provotorov
189a29d1d2 JBR-4687: Japanese IME input window hides what is being typed.
Uses CFS_EXCLUDE instead of CFS_CANDIDATEPOS in the ::ImmSetCandidateWindow() native API, which is more powerful and allows to take into account the issue's case.

(cherry picked from commit 0afe6c37bb)
2024-09-19 02:02:32 +02:00
Vitaly Provodin
4b132fe515 JBR-6404 synchronize drawing and the test checking 2024-09-19 02:02:32 +02:00
Vitaly Provodin
22c88741da JBR-3902 create jbr_all test group 2024-09-19 02:02:32 +02:00
Maxim Kartashev
c8323a93b1 JBR-6002 Linux: maximized window goes fullscreen after being moved between monitors
(cherry picked from commit 83c4c0364698f5bfb682d715bbe4ac70d50f11b3)
2024-09-19 02:02:32 +02:00
ngubarkov
e77fa6b3f8 JBR-5605 ignore empty client area when syncing bounds in XDecoratedPeer.
(cherry picked from commit d2301edbd0de04747817a2d382f587056d954627)
2024-09-19 02:02:32 +02:00
ngubarkov
9ee1aa8080 JBR-5438 Fix window bounds in XWM#setShellResizable
(cherry picked from commit 0aee99ac703f3b360277293e6e7a2e1aadfaba33)
2024-09-19 02:02:32 +02:00
ngubarkov
2b8a94c779 JBR-5265 Workaround incorrect position of content window in queryXLocation.
(cherry picked from commit 26684fd4c761dcd2a4c93673d7732095a2050c9b)
2024-09-19 02:02:32 +02:00
ngubarkov
3df4064bcb JBR-5417 Fix flickering in multi-monitor setups on Linux.
(cherry picked from commit 9b813e21c361e9e4b97c52bdd8eccef0030a7763)
2024-09-19 02:02:32 +02:00
Dmitry Batrak
f2fea98430 JBR-5095 Incorrect initial window's location under GNOME
(cherry picked from commit 6995ce47fd)

with fix for JBR-5189 Can't exit fullscreen mode on ubuntu 22.10

(cherry picked from commit b933660cf1)
(cherry picked from commit f4ea24e18d8e6f4cb0420e30344a5cd3f000c021)
2024-09-19 02:02:32 +02:00
Sergey Shelomentsev
7b881bdb3b JBR-6354 fix custom title bar tests to avoid failure in MacOS 14 fullscreen mode
- moved common logic to a separate part
- moved parts of tests to swing package

(cherry picked from commit 80b6e4ba8cad4c19b0f306ccd64dad9c085a8bab)
2024-09-19 02:02:32 +02:00
Nikita Provotorov
86d998446c JBR-6125: macOS14 java/awt/Window/Grab/GrabTest.java Frame can't be focused.
Fixes a data race in the test.

(cherry picked from commit ca5562225a)
(cherry picked from commit 1ba73c8aaf430ca4c6e8302d1bcee8681aa8584d)
2024-09-19 02:02:32 +02:00
Vitaly Provodin
4c116de9cd update exclude list on results of 22_b1930 test runs
(cherry picked from commit def4d8ad64e4b1fea76ace0d9014c1a063e44891)
2024-09-19 02:02:31 +02:00
Vladimir Kharitonov
87610bf416 RDCT-766 add libwayland-cursor.so to ResolveSymbolsTestMinEnv
(cherry picked from commit 9626cc17447b96e8b4a16908f349e682525e3090)
(cherry picked from commit 09d1ab6ca20b51a46dad120ac044346bb2a8d48e)
2024-09-19 02:02:31 +02:00
Vladimir Kharitonov
3934112d10 JBR-6272 add resolve symbols tests
(cherry picked from commit a4acdf005c53b1765ad356a740d4569db70e8b02)
(cherry picked from commit 9178b241d5d706c7628d5ebfac0fff8b54029b97)
2024-09-19 02:02:31 +02:00
Vitaly Provodin
c66f1ad56b JBR-6246 add (re)generating cds archives at jlink step 2024-09-19 02:02:31 +02:00
Nikita Gubarkov
7a3dfec921 Emoji PR sync (experimental)
- Removed font fallback hacks.
- Changed composite font glyph code encoding scheme, refactored to use Font2D instead of PhysicalFont.
- New Emoji logical font type with 2 underlying physical fonts.
- Removed getGlyphVectorOutline - it's unused and broken.
- Got rid of charsToGlyphs[NS] boilerplate.
- Moved emoji tests to separate directory.
2024-09-19 02:02:31 +02:00
Nikita Gubarkov
e9166c8a30 Added Clion project setup 2024-09-19 02:02:31 +02:00
Nikita Gubarkov
9f9b689945 Updated IDEA project setup 2024-09-19 02:02:31 +02:00
Sergey Shelomentsev
90369cb12d Don't trigger workflow on push 2024-09-19 02:02:31 +02:00
Dmitrii Morskii
094128732d JBR-5724: fixed serialization and backward compatibility of Font 2024-09-19 02:02:31 +02:00
Alexander Lobas
dd1a38016f JBR-4834 JBR-5139 Rounded corners on Mac OS and Windows: support custom border color 2024-09-19 02:02:31 +02:00
Dmitrii Morskii
fb4bab613c JBR-6044 handle absence of fontConfig library in setupRenderingFontHints 2024-09-19 02:02:31 +02:00
Dmitrii Morskii
89ca9f680d JBR-6041 started using correct type inside FcPatternGetValueFuncType 2024-09-19 02:02:31 +02:00
Dmitrii Morskii
96c24decff JBR-6018 removed incorrect test testFeaturesZeroFrac 2024-09-19 02:02:31 +02:00
Dmitrii
0f6afca6fc JBR-5502: optimize stringWidth & charsWidth methods of FontDesignMetrics 2024-09-19 02:02:31 +02:00
Dmitrii Morskii
9128bbd223 JBR-5844: fixed other part of issue. Added missing implementation of native methods in fontconfigmanager 2024-09-19 02:02:30 +02:00
Alexey Ushakov
b45320e35d 8311917: MAP_FAILED definition seems to be obsolete in src/java.desktop/unix/native/common/awt/fontpath.c
Reviewed-by: prr
2024-09-19 02:02:30 +02:00
Dmitrii Morskii
faea6364f5 JBR-5844: fix case with non-scalable face 2024-09-19 02:02:30 +02:00
Dmitrii Morskii
30a5e617f9 JBR-5804: refactoring of freetypeScaler and moving fontconfig's logic in separate file 2024-09-19 02:02:30 +02:00
Dmitrii
deefebd7bf JBR-5246 add OpenType's features support 2024-09-19 02:02:30 +02:00
Dmitry Batrak
ff9c6d8d2b JBR-5751 java/awt/Focus/RowToleranceTransitivityTest.java: Focus got stuck while traversing. 2024-09-19 02:02:30 +02:00
Vitaly Provodin
ed015b86f4 JBR-5286 make windows-aarch64 building script identical to the same script in jbr17 2024-09-19 02:02:30 +02:00
Vitaly Provodin
f8d5af9197 update jetbrains.api hash and API version 2024-09-19 02:02:30 +02:00
Vitaly Provodin
16d580c991 Revert "JBR-5724: fixed serialization and backward compatibility of Font"
This reverts commit c5cc5b4dedbdf73871f14db92afaac15fd985d86.
2024-09-19 02:02:30 +02:00
Vitaly Provodin
4ac34d555c JBR-6246 add default CDS archives into jbrsdk distributions 2024-09-19 02:02:30 +02:00
Dmitry Drobotov
9fb40bd6b0 JBR-4479 Add text caret tracking for macOS Accessibility Zoom
(cherry picked from commit 0dfbf34b37)
2024-09-19 02:02:30 +02:00
Dmitry Drobotov
0c577fef21 JBR-6194 Fix VoiceOver reading old JComboBox value after changing it
1. Remove `value == nil` check in ComboBoxAccessiblity.accessibilityValue to fix the issue with not updated value of combo box. With `value == nil` check, the value was not reassigned on every get request of `accessibilityValue`, but only on get `accessibilitySelectedChildren`. When changing focus by Tab, only get `accessibilityValue` is called, and because `value` is already not nil, an old value was returned.

2. Set combo box role to NSAccessibilityPopUpButtonRole if it's not editable. Setting role to popup button fixes the bug when combo box value was not updated when using VO cursor navigation. Native MacOS non-editable combo boxes and non-editable HTML <select> elements also have the "popup button" role instead of "combo box", so the role should become more clear. Popup button role additionally enables opening the combo box menu with VO+Space shortcut, and changes VO instructions to be more appropriate when combo box is focused.

3. Add test for VoiceOver-specific issues of JComboBox.

(cherry picked from commit 8982db51d7)
2024-09-19 02:02:30 +02:00
Vitaly Provodin
903dd9dced Update README.md 2024-09-19 02:02:30 +02:00
Maxim Kartashev
f7f2cd357b JBR-6220 javax/swing/GraphicsConfigNotifier/StalePreferredSize.java became failing by time out on Linux 2024-09-19 02:02:30 +02:00
Maxim Kartashev
1d182871b8 JBR-6142 Impossible to move/resize IDE window after restart if several projects were initially opened on secondary monitor
Announce to Mutter that we are "client-decorated" when a Frame is
undecorated by setting _GTK_FRAME_EXTENTS to all zeroes.
This prevents Mutter from applying certain harmful heuristics.
2024-09-19 02:02:29 +02:00
Maxim Kartashev
097caa6653 JBR-5971 Wayland: support WindowMove JBR API
Updated the XToolkit implementation to match API changes required for
WLToolkit
2024-09-19 02:02:29 +02:00
Maxim Kartashev
e6b865fcaf JBR-5777 isWindowMoveSupported() doesn't work with non-default GraphicsEnvironment
Co-authored-by: Nikita Gubarkov <nikita.gubarkov@jetbrains.com>
2024-09-19 02:02:29 +02:00
Maxim Kartashev
3f64d2880d JBR-5637 Linux: implement window position change with WM help
Introduced JBR.isWindowMoveSupported() and
JBR.getWindowMove().startMovingTogetherWithMouse()
2024-09-19 02:02:29 +02:00
Maxim Kartashev
1f22a2b92c JBR-5084 Add ability to log additional data to jstack output
The data can be provided via this JBR API call:
JBR.getJstack().includeInfoFrom(Supplier<String>)
2024-09-19 02:02:29 +02:00
Alexander Lobas
8775dcb098 JBR-5546 Iterating open windows with cmd backtick on Mac forces minimized windows to un-minimize 2024-09-19 02:02:29 +02:00
Alexander Lobas
1a519268d3 JBR-5478 IDEA window doesn't fit the screen properly on turning off/on an external monitor 2024-09-19 02:02:29 +02:00
Alexander Lobas
a972739623 JBR-5384 New UI: window header is hard to resize on the top edge, top/right corner 2024-09-19 02:02:29 +02:00
Alexander Lobas
8cd82637c3 JBR-5174 Opening project as tabs in Mac OS (version2)
JBR-5023 Configure TabbingIdentifier during create native window
JBR-5256 IDEA window resizes to zero height when exit full-screen mode with new window controls enabled
JBR-5197 Window control buttons are not visible in full-screen mode in dark themes when IDE window is focused
JBR-5175 jb/java/awt/Window/FullScreenTwoFrames.java: -[AWTWindow resetWindowFullScreeControls]: unrecognized selector sent to instance 0x60000232d5f0
JBR-5499 Window control buttons bugfix
JBR-4462 BigSur: project tab does not gain focus when click it after focusing another app
2024-09-19 02:02:29 +02:00
Dmitry Batrak
ec39fd98ec JBR-5300 Change source code and test files to use GPL license
fix copyright profile in generated IDE project

(cherry picked from commit 43ebbe3cd1)
2024-09-19 02:02:29 +02:00
Nikita Gubarkov
f528f0b89c JBR-5124 Rewrite custom decorations support
JBR API v0.0.8
Added new WindowDecorations API, deprecated old CustomWindowDecoration.

JBR-4641 JBR-4630 Fix client area calculation with custom decorations on Windows.

- Window insets are rounded up, which causes visible & unusable border in fullscreen on some scales, round down instead.

- Clipping in Swing components sometimes cuts what it shouldn't, fixed.
2024-09-19 02:02:29 +02:00
Vitaly Provodin
c3c92395fb update exclude list on results of 21.0.1_b293.1 test runs 2024-09-19 02:02:29 +02:00
Nikita Provotorov
29def31559 JBR-6282: java/awt/TextArea/TextAreaEditing/TextAreaEditing.java intermittently fails due to deadlock.
Makes the test invoke any UI-operation on EDT only (since AWT doesn't guarantee thread-safety of UI operations, see more at https://mail.openjdk.org/pipermail/client-libs-dev/2023-November/016172.html).

(cherry picked from commit 8dbb889509)
2024-09-19 02:02:29 +02:00
Maxim Kartashev
7f04a8a94c JBR-6291 runtime/cds/appcds/dynamicArchive/TestDynamicDumpAtOom.java: Attempting to acquire lock OOMEStacks_lock/safepoint out of order 2024-09-19 02:02:29 +02:00
Alexander Lobas
959d57cc79 JBR-5409 "No Print Service Found" Error when saving to PDF 2024-09-19 02:02:28 +02:00
Alexey Ushakov
2362b6d08b JBR-6281 Remove MTLEvent sync from Metal rendering code
Removed sync code
2024-09-19 02:02:28 +02:00
Nikita Provotorov
7581b85aef JBR-2460: Wrong position of input window and no input preview with fcitx and ubuntu 13.04.
This patch makes the fix of JBR-1573 (which caused JBR-4394) disabled by default, because it's incompatible with the native below-the-spot mode (a.k.a. over-the-spot in the X11's terminology).

(cherry picked from commit 3fe2a97aa0)
2024-09-19 02:02:28 +02:00
Nikita Provotorov
634dd7139b JBR-2460: Wrong position of input window and no input preview with fcitx and ubuntu 13.04.
- introduces and integrates jbNewXimClient: a new implementation of XIC creation routine (it's mostly refactoring and generalizing of AWT's existed code). Enabled by default and can be disabled via a new system property -Djb.awt.newXimClient.enabled=false ;
- introduces support of the X11's native over-the-spot input method style (it's almost the same as AWT's below-the-spot mode, but the input method's windows are drawn externally, not by AWT). Enabled by default and can be disabled via a new system property -Djb.awt.newXimClient.enabled=false. Doesn't work if -Djb.awt.newXimClient.enabled=false is set ;
- introduces sun.awt.X11.XInputMethod.ClientComponentCaretPositionTracker class that tracks all kind of events for the current client component that can lead to the caret position changing ;
- makes the XInputMethod class to update the input window's position (whenever the ClientComponentCaretPositionTracker discovers that's necessary) by setting the X11's XNSpotLocation property .

Check out the branch nprovotorov/backups/JBR-2460_wrong-position-of-input-window-and-no-input-preview for more granular patches.

(cherry picked from commit c57030a2ef)
2024-09-19 02:02:28 +02:00
Maxim Kartashev
4350ae8884 JBR-6193 Impossible to resize snapped IDE when native header is turned off
Drop the maximized state right before the resize operation for
undecorated windows.

Also fixes setExtendedState() to work when changing snapped window's state
(MAXIMIZED_HORIZ or MAXIMIZED_VERT) to NORMAL.
2024-09-19 02:02:28 +02:00
Nikita Provotorov
5de8d79bde JBR-5980: Pasting from clipboard not working reliably in Windows.
(also contains the fix of JBR-6267 Image retreived from the Clipboard is not the same image that was set to the Clipboard)

- Adds a way to disable caching of the data placed into the clipboard. The behavior is controlled by the system property "awt.windows.clipboard.cache.disabled" (=false by default) ;
- Whenever the app gets focus additionally checks if another app has modified the clipboard. The behavior is controlled by the system property "awt.windows.clipboard.extraOwnershipChecksEnabled" (=true by default) .
2024-09-19 02:02:28 +02:00
Nikita Provotorov
10edd00577 JBR-5980: Pasting from clipboard not working reliably in Windows.
Marks the native flag AwtClipboard::isGettingOwnership as volatile and adds memory barriers around it to avoid inconsistencies of CPU caches.
2024-09-19 02:02:28 +02:00
Vitaly Provodin
4109a92480 JBR-6255 improve calculation JDK_BUILD_NUMBER 2024-09-19 02:02:28 +02:00
Nikita Gubarkov
27d1577223 JBR-5274 recreate CGraphicsDevice if it was changed.
- AWT code heavily relies on reference comparison when updating graphics devices & configurations, so we need to actually re-create CGraphicsDevice if it was changed.

- Also do not rely on graphicsConfig.getDefaultTransform() when firing `graphicsContextScaleTransform` property change, as graphics devices are mutable and returned default transform may change over time, e.g. when device is invalidated.
2024-09-19 02:02:28 +02:00
Alexey Ushakov
e3ffd69c7e JBR-5025 Reduce latency during display reconfiguration in Metal
Moved metal load library checks to CGraphicsEnvironment
2024-09-19 02:02:28 +02:00
Alexey Ushakov
758cfc650f JBR-4666 java.lang.InternalError: Error - unable to initialize Metal after recreation of graphics device.
Reverted fix of the JRE-359 (CGraphicsEnvironment.getDefaultScreenDevice() returns null)
Logged exception after first attempt to create graphics device
2024-09-19 02:02:28 +02:00
Alexey Ushakov
4c2a4be75e JBR-4588 macOS: SIGILL at [libsystem_kernel] __kill in CCE: class sun.java2d.opengl.CGLGraphicsConfig cannot be cast to class sun.java2d.metal.MTLGraphicsConfig
Prevent fall back to OpenGL if Metal has been used before
Added more diagnostics.
2024-09-19 02:02:28 +02:00
Vitaly Provodin
eed99179c7 Update README.md 2024-09-19 02:02:28 +02:00
Vladimir Kharitonov
eeb30ded40 JBR-6239 sign frameworks in cef_server.app 2024-09-19 02:02:28 +02:00
Maxim Kartashev
5be2a589e1 JBR-4020 Test ObsoleteFlagErrorMessage fails after +IgnoreUnrecognizedVMOptions has become the default
(cherry picked from commit ae5963a094)
2024-09-19 02:02:28 +02:00
Maxim Kartashev
c940c78d0d JBR-5722 vmTestbase/vm/gc/compact/Compact_TwoFields_InternedStrings: SIGSEGV at Symbol::as_klass_external_name(char*, int)
Do not use print_native_stack() when recording OOME stacks as it is
designed to be used only in the context of a fatal error reporting where
induced crashes are tolerated.
2024-09-19 02:02:27 +02:00
Alexey Ushakov
e809a4f05d JBR-5741 broken build in main because of hotspot changes (JDK-8309613)
Added missing parameter
2024-09-19 02:02:27 +02:00
Maxim Kartashev
87981b3521 JBR-5480 Include more information in OOME crash reports 2024-09-19 02:02:27 +02:00
Maxim Kartashev
7cedff39a2 JBR-5466 jb/hotspot/JNIRefsInCrashLog.java: 'hs_err_42.txt' missing from stdout/stderr 2024-09-19 02:02:27 +02:00
Maxim Kartashev
6e453cb088 JBR-5431 Include memory used by JNI references into crash reports 2024-09-19 02:02:27 +02:00
Vitaly Provodin
057bbef439 Update README.md 2024-09-19 02:02:27 +02:00
bourgesl
9bc37fad02 JBR-5638: improved renderer performance for simple rectangular area (see BBoxAATileGenerator), added new statistics in Renderer 2024-09-19 02:02:27 +02:00
Nikita Tsarev
387735499e JBR-6215: Override XToolkit's default nonintuitive behavior when translating F13-F24 keys 2024-09-19 02:02:27 +02:00
Konstantin Bulenkov
909487e01b JBR-6214 [fwp jbr21] IDEA-299292 Use Inter semibold instead of Inter bold
Replaced Inter bold with semi-bold fonts
2024-09-19 02:02:27 +02:00
Nikita Gubarkov
4b469e42bd JBR-6208 Extended glyph cache for Metal 2024-09-19 02:02:27 +02:00
Vitaly Provodin
505ff3a9f2 JBR-6181 add Linux executables with bundled FreeType 2024-09-19 02:02:27 +02:00
Vitaly Provodin
451411d965 Update README.md 2024-09-19 02:02:27 +02:00
Alexey Ushakov
454e135a50 JBR-4983 MacOS Ventura - External monitor lagging
Restored REDRAW_INC to 2. Enabled the fix by default only for M2 and spans displays property enabled (Displays have separate spaces OFF)
2024-09-19 02:02:27 +02:00
Dmitrii Morskii
c983531070 JBR-6135 removed dependence on process reading TTF in fixed size chunks 2024-09-19 02:02:27 +02:00
Alexey Ushakov
d68c452114 JBR-6132 Crash in [MTLLayer blitTexture] when MTL_DEBUG_LAYER enabled
Blit operation should not be performed on textures with MTLTextureUsageRenderTarget only, so changing framebufferOnly to NO
2024-09-19 02:02:26 +02:00
Vitaly Provodin
9879249003 Update README.md 2024-09-19 02:02:26 +02:00
Nikita Provotorov
de9a4ea94b JBR-5984: IM's candidate window is placed under popup windows.
- Implements the optional method [NSTextInputClient windowLevel] to tell the macOS IM subsystem correct level of the window;
- Adds a regression test ImWindowIsPlacedUnderPopup5984.java.

(cherry picked from commit 5a91aae9c2)
2024-09-19 02:02:26 +02:00
Vitaly Provodin
5de26a6797 JBR-6130 add VK_TAB release action 2024-09-19 02:02:26 +02:00
Alexey Ushakov
2787b2547d JBR-4983 MacOS Ventura - External monitor lagging
Added extra redraw request
2024-09-19 02:02:26 +02:00
ghostflyby
ecb2e434d1 JBR-6124 Fix macOS services writing text back to textfield 2024-09-19 02:02:26 +02:00
Sergey Shelomentsev
ced0803345 exclude FocusTraversalOrderTest 2024-09-19 02:02:26 +02:00
Sergey Shelomentsev
e1bd6e5301 JBR-6060 add focus traversal order test 2024-09-19 02:02:26 +02:00
Nikita Gubarkov
297aed76d7 JBR-6016 doPrivileged for JBR API internal services. 2024-09-19 02:02:26 +02:00
Vitaly Provodin
f52bb85258 JBR-6008 Update JetBrains Mono fonts to v2.304 2024-09-19 02:02:26 +02:00
Vitaly Provodin
257ae59186 Update README.md 2024-09-19 02:02:26 +02:00
Dmitry Batrak
9d9a76f10d JBR-3353 Sibling popup window is shown below dialog on macOS
(cherry picked from commit 4c6f3e4510)
2024-09-19 02:02:26 +02:00
Dmitry Batrak
4d0787a0d9 JBR-5953 If hieroglyph typing isn't finalised, focusing another component inserts the composed text there 2024-09-19 02:02:26 +02:00
Dmitry Batrak
41ed9b0afe JBR-5946 Allow to disable painting of composed text in Swing text components using TextLayout.draw 2024-09-19 02:02:26 +02:00
Dmitry Batrak
fb69e24d52 JBR-5823 IDEA crashes when '-Dmain.thread.as.edt=true' vmoption is set and VoiceOver is enabled
done as part of JBR-4993 Support using 'main' thread as EDT on macOS

(cherry picked from commit 55598693c3)
2024-09-19 02:02:25 +02:00
ngubarkov
c20d122a20 JBR-5240 Fix XToolkit#getScreenInsets in Xinerama mode. 2024-09-19 02:02:25 +02:00
ngubarkov
d6a7edb851 JBR-5316 Fix fractional scaling HIDPI. 2024-09-19 02:02:25 +02:00
Nikita Gubarkov
8ad2acd985 JBR-5186 Make MouseInfo.getPointerInfo more robust
Do not search for the containing monitor in MouseInfo.getPointerInfo, this must be handled by peers (yes, this goes against the spec of MouseInfoPeer.fillPointWithCoords).

JBR-5268 Fix coordinates conversion in XMouseInfoPeer.fillPointWithCoords
2024-09-19 02:02:25 +02:00
Nikita Gubarkov
6355ddf4fb IDEA-141456 Multimonitor HIDPI support for Linux 2024-09-19 02:02:25 +02:00
Dmitrii Morskii
9fb60dc8ad JBR-5724: fixed serialization and backward compatibility of Font 2024-09-19 02:02:25 +02:00
Dmitrii Morskii
41093d83a7 JBR-5259: fixed Canvas mispositioning after dragging JFrame to a monitor with different scale 2024-09-19 02:02:25 +02:00
Vitaly Provodin
cbac5682b1 Update README.md 2024-09-19 02:02:25 +02:00
Maxim Kartashev
0e2eef6382 JBR-5815 javax/swing/AbstractButton/6711682/bug6711682.java: Row #2 checkbox is not selected
Fixed the test to use proper cell coordinates when clicking.
2024-09-19 02:02:25 +02:00
Alexey Ushakov
8dd298c55c JBR-5807 java/awt/Frame/FrameVisible/FrameContentAppearanceTest.java: Failed: OpenGL 26 image rendering failure(s)
Added synchronisation for rendering and appearance
2024-09-19 02:02:25 +02:00
bourgesl
6687762465 JBR-5625: disable color-matching (colorspace = nil) in MTLLayer by default (see new system property 'sun.java2d.metal.colorMatching=true/false') + added new MetalLayerColorTest
Use CGColorSpaceCopyName() available since macOS 10.6 in MTLLayer

Use sun.java2d.metal.colorMatching=true by default (current metal behaviour)
2024-09-19 02:02:25 +02:00
Nikita Provotorov
928836fdca JBR-5762 Sometimes naturally generated MOUSE_DRAGGED events don't contain the pressed button's modifier.
Enforce keeping the pressed button in the modifiers for MOUSE_DRAGGED events. This is under a (default enabled) system property "awt.mac.enforceMouseModifiersForMouseDragged".

(cherry picked from commit fb12990a98)
2024-09-19 02:02:25 +02:00
Dmitrii Morskii
6cd57cf0b6 JBR-5548 fix BadSerializationTest 2024-09-19 02:02:25 +02:00
Vitaly Provodin
64ab30cce0 Update README.md 2024-09-19 02:02:25 +02:00
Sergey Shelomentsev
02b0fd7be3 JBR-5746 wait for menu visibility of fail the test
add mouse events logging
2024-09-19 02:02:25 +02:00
Dmitry Batrak
c95a49b583 JBR-5720 Wrong modifiers are reported for mouse middle and right buttons' release/clicked events 2024-09-19 02:02:24 +02:00
Dmitry Batrak
d719668f00 JBR-5684 Focus state is broken after closing of modal dialog in an inactive application 2024-09-19 02:02:24 +02:00
Vitaly Provodin
2c8f95bf10 update exclude list 2024-09-19 02:02:24 +02:00
Vitaly Provodin
64256ea898 Update README.md 2024-09-19 02:02:24 +02:00
Alexey Ushakov
c4dc0d6e0b JBR-5151 Test failures caused by -Dsun.java2d.metal.displaySync=false
Removed display sync from window layer, provide layer content updates only when necessary
2024-09-19 02:02:24 +02:00
Dmitrii Morskii
a9877e8923 JBR-1775: improved logic for choosing newer font between system and bundled ones 2024-09-19 02:02:24 +02:00
Sergey Shelomentsev
a2127979a1 JBR-2870 add resression test for JPopupMenu
- verify that the popup menu is usable if overlaps WM's dock panel of the bottom of screen
2024-09-19 02:02:24 +02:00
Vitaly Provodin
dd7bfa8b44 Update README.md 2024-09-19 02:02:24 +02:00
Alexey Ushakov
3869e9e6d5 JBR-5693 Debug build failure in main branch
Corrected printf format and muted unused-function option for keycode_cache.c
2024-09-19 02:02:24 +02:00
Alexey Ushakov
47e9dd6568 JBR-5704 displaySyncOFF: javax/swing/JDialog/Transparency/TransparencyTest.java: JDialog transparency lost upon iconify/deiconify sequence
Corrected startRedraw method to call setNeedsDisplay in displaySync=false mode
2024-09-19 02:02:24 +02:00
Sergey Shelomentsev
bf9d4e1a00 JBR-5670 restore initial display mode after test execution
restore original display mode
2024-09-19 02:02:24 +02:00
Sergey Shelomentsev
7ef5d680d6 JBR-4880 Fix DeadKeySystemAssertionDialog to avoid receiving key event out of the window 2024-09-19 02:02:24 +02:00
Vladislav Rassokhin
21f456cef1 JBR-5600 Reduce noise in signing scripts output 2024-09-19 02:02:24 +02:00
Vladislav Rassokhin
ca8ea813dc JBR-5600 Sign frameworks as whole, verify framework signature before full app sign 2024-09-19 02:02:24 +02:00
Nikita Provotorov
1e35994dac JBR-5668: The implementation of a11y announcing for macOS crashes with -Xcheck:jni.
- Create a global reference of the passed to EDT accessible object (the local reference) to use it in the AppKit thread ;
- Enable -Xcheck:jni in the tests ;
- Make the tests handle the problematic case .

(cherry picked from commit cba981df4b)
2024-09-19 02:02:24 +02:00
Vladislav Rassokhin
57f50f34e7 tools/mac/scripts: minor improvements
* don't move into itself
* use `PKG_NAME` variable instead of `${APP_NAME}.pkg`
* cleanup sign.sh
* add `SCRIPT_VERBOSE` env variable to control `set -x`
2024-09-19 02:02:23 +02:00
Vladislav Rassokhin
4e2315e1ee JBR-5600 Staple .pkg with signature 2024-09-19 02:02:23 +02:00
Vladislav Rassokhin
e9aa09d162 JBR-5600 Notarize macOS binaries using notarytool 2024-09-19 02:02:23 +02:00
Vladislav Rassokhin
ad03ad8816 JBR-5600 Sign macOS binaries using jet-sign 2024-09-19 02:02:23 +02:00
Sergey Shelomentsev
ad933e57ab JBR-5579 Update mouse location checks, set window always on top for ActionListenerTest 2024-09-19 02:02:23 +02:00
Sergey Shelomentsev
674308b6cc JBR-5551 update hit tests on custom title bar
- set windows always on top
- verify mouse location before clicking
2024-09-19 02:02:23 +02:00
Sergey Shelomentsev
0b7e628c88 JBR-5577 fix MouseEventsOnClientArea test
- add Swing/AWT specific Task runners
- split MouseEventsOnClientArea to separate AWT/Swing tests
- use CountDownLatch for tracking mouse events
2024-09-19 02:02:23 +02:00
Sergey Shelomentsev
6d09d2f993 remove jb/java/awt/Window/ZOrderOnModalDialogActivation.java 2024-09-19 02:02:23 +02:00
Sergey Shelomentsev
798ec0540b JBR-4494 pass ui scale options for child process 2024-09-19 02:02:23 +02:00
Maxim Kartashev
86be13e312 JBR-5656 Builds of JDK 21 are reproducible by default
(cherry picked from commit 0d663a139acf3d5cdb19b33494ab9f6273c4ebfa)
2024-09-19 02:02:23 +02:00
bourgesl
730dab0449 JBR-5651: Improved MTLVertexCache to merge consecutive full-tiles ie use 1 larger quad instead of many quads per row, full-tile is only using 1x1 pixel (full), applied to color, gradient & texture paints + fixed clang warnings 2024-09-19 02:02:23 +02:00
Alexey Ushakov
edb9386788 JBR-5649 Flickering in multi-monitor configuration
Provided corrected initial value for currentDisplayID
2024-09-19 02:02:23 +02:00
Vitaly Provodin
6ec2d9e640 JBR-5627 add regression test AsyncProfilerRunnerTest 2024-09-19 02:02:23 +02:00
Maxim Kartashev
384f1b8e1e JBR-5631 Refactor Dockerfile for x64 builds 2024-09-19 02:02:23 +02:00
Vitaly Provodin
e68114dd6d JBR-5603 build aarch64 Linux from arm64v8/centos:7 and check glibc to be not higher 2.17 2024-09-19 02:02:23 +02:00
Alexey Ushakov
9328c78887 JBR-5580 J2DBench: ~15% drop performance  because of non optimal synchronization in metal (MBP 16'' x64)
Replaced NSMutableArray with NSMutableSet, removed unnecessary __block modifier.
2024-09-19 02:02:22 +02:00
Sergey Shelomentsev
855c9077dc update a11y exclude list 2024-09-19 02:02:22 +02:00
Alexey Ushakov
e055c92669 JBR-5580 J2DBench: ~15% drop performance because of non optimal synchronization in metal (MBP 16'' x64)
Removed NSLock and moved all operations to the AppKit thread
2024-09-19 02:02:22 +02:00
bourgesl
4a292ea419 JBR-5170: improved color maskFill performance: using a new MaskColorBuffer and a specific shader (vert_txt_col)
fix crash in J2DDemo with advanced paints + artefacts with texture background
2024-09-19 02:02:22 +02:00
Alexey Ushakov
bcef5b8b40 JBR-5559 SwingMark performance drop after removing additional command queue
Added command queue and provided synchronization between the command queues
2024-09-19 02:02:22 +02:00
Nikita Provotorov
220502469c JBR-5536: Crash on macOS bad JNI lookup in Java_sun_swing_AccessibleAnnouncer_nativeAnnounce
Stop using the JNIEnv instance bound to EDT in the AppKit thread.

(cherry picked from commit 0f49341f4d)
2024-09-19 02:02:22 +02:00
Alexey Ushakov
1bf5ddbeee JBR-4883 macOS: SIGSEGV at MTLVertexCache_FlushGlyphVertexCache
Use separate glyph cache for each MTLContext instance. Refactored MTLGlyphCache
2024-09-19 02:02:22 +02:00
Alexey Ushakov
66f90f9f85 JBR-5193 Do not use extra commandQueue in metal pipeline
Removed extra command queue
2024-09-19 02:02:22 +02:00
Alexey Ushakov
3aa4d0c8f0 JBR-4959 [macOS Ventura] Screen flickering after OS update when IDE is full screen
This includes displaySync changes as well as fixes for JBR-5157 and JBR-5321.
2024-09-19 02:02:22 +02:00
Vitaly Provodin
56fb7b84e5 Update README.md 2024-09-19 02:02:22 +02:00
Maxim Kartashev
7a0db2b21a jb/branchdiff.py is a lot faster 2024-09-19 02:02:22 +02:00
Sergey Shelomentsev
efe48e9f08 JBR-5505 update exclude list for a11y testing on Windows 2024-09-19 02:02:22 +02:00
Sergey Shelomentsev
cc8dfd69a0 JBR-5397 update exclude list for a11y testing on MacOS 2024-09-19 02:02:22 +02:00
Maxim Kartashev
b95118e2bf JBR-5483 MacOSXWatchService assumes that the default file system is the UnixFileSystem, which might not be the case 2024-09-19 02:02:22 +02:00
Sergey Shelomentsev
f735d11d30 JBR-5441 fix wait for idle 2024-09-19 02:02:22 +02:00
Maxim Kartashev
c526fd6bd7 jb/branchdiff.py to warn if it can't differentiate between commits 2024-09-19 02:02:21 +02:00
Sergey Shelomentsev
f402edfa3d JBR-5440 fix calculations for double click location 2024-09-19 02:02:21 +02:00
Artem Bochkarev
d7dc454ffa JBR-5426 write JCEF version info inside release file 2024-09-19 02:02:21 +02:00
Maxim Kartashev
ee18557c10 JBR-5445 JBRApiTest test fails on development builds 2024-09-19 02:02:21 +02:00
Sergey Shelomentsev
a952fe69d9 JBR-5433 add typing latency text for JTextArea 2024-09-19 02:02:21 +02:00
Vitaly Provodin
b810c7a901 JBR-5432 increase setAutoDelay for Robot 2024-09-19 02:02:21 +02:00
Maxim Kartashev
20fb063e60 JBR-5230 Wanted: an ability to use Unix Domain sockets with overridden default NIO file system 2024-09-19 02:02:21 +02:00
Sergey Shelomentsev
33e55dc7dc fixup! JBR-4875 set proper OS to run ComboBoxTransparentTittleBarTest 2024-09-19 02:02:21 +02:00
Sergey Shelomentsev
a7d7412273 fix controls width calculation 2024-09-19 02:02:21 +02:00
Sergey Shelomentsev
41160084da split ActionListenerTest 2024-09-19 02:02:21 +02:00
Sergey Shelomentsev
2298abaffd JBR-5345 native controls detection and scale fixes 2024-09-19 02:02:21 +02:00
Maxim Kartashev
682e09372c README.md: spelled out JBR distinctive features 2024-09-19 02:02:21 +02:00
Vitaly Provodin
8247a2bcd9 update exclude list on results of 21_b28.1 test runs 2024-09-19 02:02:21 +02:00
Alexey Ushakov
8e3e41344a JBR-5330 Blank Welcome screen after moving to another display
Initialize currentDisplayID on AWTWindow creation
2024-09-19 02:02:21 +02:00
Nikita Tsarev
2bb4f33daa JBR-5369: Update failing tests list in response to macOS keyboard support rewrite 2024-09-19 02:02:21 +02:00
Vitaly Provodin
9ba1ed2943 Update README.md 2024-09-19 02:02:20 +02:00
Vitaly Provodin
6d59ed5896 update exclude list on results of 21_b24.2 test runs 2024-09-19 02:02:20 +02:00
Vitaly Provodin
6788101aba Update README.md 2024-09-19 02:02:20 +02:00
Sergey Shelomentsev
e4ecf9a852 JBR-5350 Separate test for Mac OS 2024-09-19 02:02:20 +02:00
Sergey Shelomentsev
35247f175f JBR-5346 run MaximizedCustomDecorationsTest on windows/mac only 2024-09-19 02:02:20 +02:00
Sergey Shelomentsev
ac39b444a7 JBR-5350 fix FrameNativeControlTest checks on MacOS 2024-09-19 02:02:20 +02:00
Sergey Shelomentsev
3f4a2860da JBR-5344 fix incorrectly specified VM options 2024-09-19 02:02:20 +02:00
Vitaly Provodin
0317342c40 Update README.md 2024-09-19 02:02:20 +02:00
Vitaly Provodin
626f756a9a update exclude list on results of 17.0.6_b855.1 test runs 2024-09-19 02:02:20 +02:00
Sergey Shelomentsev
51c4197328 JBR-5313 fix broken custom decoration tests on Windows 2024-09-19 02:02:20 +02:00
Sergey Shelomentsev
79634ad7e3 JBR-5253 Use new JBR API for custom decorations 2024-09-19 02:02:20 +02:00
Vitaly Provodin
5952ed165e JBR-5300 move jbr-api.jar into test artefact 2024-09-19 02:02:20 +02:00
Vitaly Provodin
293e9cad67 update exclude list on results of 17.0.6_b837.3 test runs 2024-09-19 02:02:20 +02:00
Maxim Kartashev
3d7044356a JBR-4544 Enable OpenGL pipeline by default for Wayland sessions
The OpenGL pipeline is enabled only if all of the following is true:
- WAYLAND is detected,
- VMWare virtualization is detected,
- rendering pipeline is not a software one (llvmpipe).
As a side effect, a system property 'jbr.virtualization.information'
is set to the value of detected virtualization type. The value is the
same as provided by JFR.
2024-09-19 02:02:20 +02:00
Sergey Shelomentsev
0d2d5c47a8 set version for building jbr-api 2024-09-19 02:02:20 +02:00
Sergey Shelomentsev
6f4eda0874 get rid of build-jbr-api scripts 2024-09-19 02:02:19 +02:00
Vitaly Provodin
038975488d clean up exclude lists 2024-09-19 02:02:19 +02:00
Sergey Shelomentsev
bcfbb821d8 JBR-5194 add regressions tests for custom decorations support
with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:02:19 +02:00
Sergey Shelomentsev
8561640d07 build jbr-api as a part of bundle build 2024-09-19 02:02:19 +02:00
Vitaly Provodin
4456a27dc2 Update README.md 2024-09-19 02:02:19 +02:00
Vitaly Provodin
d8f15628d4 Update README.md 2024-09-19 02:02:19 +02:00
Artem Semenov
a392112bb6 JBR-5289 If the label has the role of a hyperlink, VO still pronounces it as plain text (#215) 2024-09-19 02:02:19 +02:00
Alexey Ushakov
06d8944695 JBR-5279 restore saving jbr native symbols bin/server/jvm.pdb 2024-09-19 02:02:19 +02:00
Sergey Shelomentsev
fbaf4a4cac JBR-4875 update test to use new JBR API window custom decorations 2024-09-19 02:02:19 +02:00
Vitaly Provodin
8f5cdab9f6 Update README.md 2024-09-19 02:02:19 +02:00
Artem Semenov
a99eb3ced5 JBR-5269 Announcement priorities not set correctly (#214) 2024-09-19 02:02:19 +02:00
Vitaly Provodin
ccaae394df Update README.md 2024-09-19 02:02:19 +02:00
Artem Semenov
a79744de97 JBR-5248 exception in accessible announcing 2024-09-19 02:02:19 +02:00
Vitaly Provodin
2d5f3348a0 update exclude list on results of 21_b9 test runs 2024-09-19 02:02:19 +02:00
Vitaly Provodin
4343ce6a77 JBR-5217 enable NVDA support in Windows builds 2024-09-19 02:02:19 +02:00
Vitaly Provodin
bb496093ba Update README.md 2024-09-19 02:02:18 +02:00
AMPivovarov
ea1111a57e JBR-5213 JBR API v0.0.9 - add GraphicsUtils (#208)
* relax type constraints in BltBufferStrategy.getDrawGraphics
2024-09-19 02:02:18 +02:00
Artem Semenov
d51bfe0ae4 JBR-5221 Add announcing to JBRAPI 2024-09-19 02:02:18 +02:00
Vitaly Provodin
b6821d4053 update exclude list on results of 21_b8 test runs 2024-09-19 02:02:18 +02:00
Artem Semenov
8b9f8cb2c6 JBR-4170 Implement API for announcing 2024-09-19 02:02:18 +02:00
Vitaly Provodin
14b8bb91dc update exclude list on results of 21_b7 test runs 2024-09-19 02:02:18 +02:00
Vitaly Provodin
4c69e6b518 update exclude list on results of stability checking runs due to 8253184 2024-09-19 02:02:18 +02:00
Artem Bochkarev
261ce978c5 JBR-3575 use flag processEvents in LWCToolkit.invokeAndWait 2024-09-19 02:02:18 +02:00
Vitaly Provodin
936645dc0e exclude several tests from runs on machines with enabled VoiceOver 2024-09-19 02:02:18 +02:00
Anton Tarasov
045bf6952e JBR-4355 javax/swing/GraphicsConfigNotifier/StalePreferredSize.java: # C [libobjc.A.dylib+0x90ff] objc_release+0x1f
(cherry picked from commit c0b2b59d4a)
2024-09-19 02:02:18 +02:00
Anton Tarasov
80267b4e75 JBR-4362 [mac] system menu opens with duplicated items
(cherry picked from commit e32defe49d)
2024-09-19 02:02:18 +02:00
Anton Tarasov
ba091a94dc JBR-4328 remove LWCToolkit.unsafeNonblockingExecute
(cherry picked from commit 9a3f31a6c4)
2024-09-19 02:02:18 +02:00
Anton Tarasov
ad88262608 JBR-4134 PyCharm is slow and unusable on MacBook Pro with M1
(cherry picked from commit 36190505f5)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:02:18 +02:00
Anton Tarasov
76611b760e JBR-4284 Sub items of main menu options are not displayed
A regression of JBR-4208 LWCToolkit.invokeAndWait should not stuck on invocation loss

(cherry picked from commit c464e4748e)
2024-09-19 02:02:18 +02:00
Anton Tarasov
a1562bdcb5 JBR-4119 UI freezes at sun.lwawt.macosx.CAccessibility.getChildrenAndRoles
(cherry picked from commit 6ba79774d8)
2024-09-19 02:02:18 +02:00
Anton Tarasov
c0aa84fbca JBR-4106 PyCharm hangs with 100% CPU usage on one core
with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:02:17 +02:00
Anton Tarasov
2055901bf8 JBR-4208 LWCToolkit.invokeAndWait should not stuck on invocation loss
including JBR-4543 (NPE: IdeEventQueue.lambda$getNextEvent$0)
2024-09-19 02:02:17 +02:00
Anton Tarasov
31ffc379bf JBR-3413 use timeout in CAccessibility.invokeAndWait
(cherry picked from commit e7009db076)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:02:17 +02:00
Vitaly Provodin
1b38f18491 update exclude list on results of 21_b1447 test runs 2024-09-19 02:02:17 +02:00
Vitaly Provodin
7d2a5622a0 Update README.md 2024-09-19 02:02:17 +02:00
Vitaly Provodin
826d1a7d90 update exclude list on results of main.1441 test runs 2024-09-19 02:02:17 +02:00
Alexey Ushakov
522fb5e075 JBR-5112 Large bold square whitespaces after waking up the laptop / connecting display
Clear primary surface data of VolatileSurfaceManager on display change event
2024-09-19 02:02:17 +02:00
Artem Semenov
e6c31924b0 JBR-5118 VoiceOver does not speak the label associated with the combobox (#194)
JBR-5118 VoiceOver does not speak the label associated with the combobox
2024-09-19 02:02:17 +02:00
Artem Semenov
625568d4b8 JBR-4235 Context menu not readable after opening on Mac OS 2024-09-19 02:02:17 +02:00
Artem Semenov
4c672e5dab JBR-4012 On Idea Vo often speeks selected element of tables, lists, and trees. 2024-09-19 02:02:17 +02:00
Artem Semenov
08aecd7aa1 JBR-3868 Combobox list is not voiced of VoiceOver 2024-09-19 02:02:17 +02:00
Alexey Ushakov
114f580a88 JBR-5041 macOS: SIGSEGV at [libawt_lwawt] getRenderEncoder:(dstOps == NULL)
Protected code from using NULL dstOps
2024-09-19 02:02:17 +02:00
Alexey Ushakov
de9d20e486 JBR-4856 macOS: SIGSEGV at [libawt_lwawt] MTLTR_DrawGlyphList
Clear glyph caches after switching contexts. Keep encoders in sync with graphics devices. Minor refactoring
2024-09-19 02:02:17 +02:00
Dmitry Batrak
3c50f132f0 JBR-5109 New frame doesn't get focused sometimes if it's shown right after popup is closed
(cherry picked from commit 693d317c0c)
2024-09-19 02:02:17 +02:00
Vitaly Provodin
e572538a0f Update README.md 2024-09-19 02:02:17 +02:00
Alexey Ushakov
736dce3743 JBR-4959 [macOS Ventura] Screen flickering after OS update when IDE is full screen
Do not fire deliverChangeBackingProperties notification for the view if there is no change between layer and window scales. Also, do not fire displayChanged for display profile only changes.
2024-09-19 02:02:16 +02:00
Nikita Provotorov
206f0b8dac JBR-5075: macOS: KEY_PRESSED event for "Cmd N" is not emitted if used as a JMenuItem accelerator and apple.laf.useScreenMenuBar=true.
- Improves the fix of JBR-3544 to allow "Cmd N" and "Ctrl N" to reach AWT if they're actually the ones which were pressed.
- Adds a regression test.

(cherry picked from commit 61a1b70d73)
2024-09-19 02:02:16 +02:00
Victor Kropp
4ecb656116 Update README.md
Mention Toolbox App in the list of applications built on JetBrains Runtime.

(cherry picked from commit cfa9789515)
2024-09-19 02:02:16 +02:00
Nikita Provotorov
0c18730822 Update README.md
Replaced jbr-dev to main and other minor fixes.
2024-09-19 02:02:16 +02:00
Vitaly Provodin
63fdc04754 update exclude list on results of 17.0.5_b721.3 test runs 2024-09-19 02:02:16 +02:00
Alexey Ushakov
6944b45446 JBR-5073 [Double-Monitor] java/awt/Window/LocationAtScreenCorner/LocationAtScreenCorner.java: Wrong location
Added check for nil displayID of the window
2024-09-19 02:02:16 +02:00
Vitaly Provodin
61000e7ae5 update exclude list on results of 17.0.5_b712.2 test runs 2024-09-19 02:02:16 +02:00
Vitaly Provodin
cb1aff899c JBR-4956 reduce width of screenshot by one pixel to exclude caret 2024-09-19 02:02:16 +02:00
ngubarkov
1eb25ebf98 JBR-4840 cache screen resolution in XToolkit 2024-09-19 02:02:16 +02:00
Alexey Ushakov
f03bea472d JBR-4959 [macOS Ventura] Screen flickering after OS update when IDE is full screen
Moving NSWindowDidChangeScreenNotification handler to AWTWindow

fixup! JBR-4959 [macOS Ventura] Screen flickering after OS update when IDE is full screen
2024-09-19 02:02:16 +02:00
Dmitry Batrak
17921d9783 JBR-5045 Invisible component can break focus cycle
(cherry picked from commit 0f57a27879)
2024-09-19 02:02:16 +02:00
Vitaly Provodin
d4811eb592 Update README.md 2024-09-19 02:02:16 +02:00
Vitaly Provodin
1a3fe78340 Update README.md 2024-09-19 02:02:16 +02:00
Vitaly Provodin
3b2a7a7db5 update exclude list on results of 17.0.5_b691.6 test runs 2024-09-19 02:02:16 +02:00
Vitaly Provodin
8ab918db7c Update README.md 2024-09-19 02:02:16 +02:00
Alexey Ushakov
cf79e2cb8f JBR-4959 [macOS Ventura] Screen flickering after OS update when IDE is full screen
Replace multiple CHANGE_SCREEN notifications fired around the same time with just one
2024-09-19 02:02:15 +02:00
Dmitry Batrak
28be4914ae JBR-4988 Transient Z-order violations on macOS
(cherry picked from commit bcba97511c)
2024-09-19 02:02:15 +02:00
Vitaly Provodin
5b9860b5ab JBR-4947 update alpine x64 image up to 3.14 2024-09-19 02:02:15 +02:00
Vitaly Provodin
884d56a448 update exclude list on results of 17.0.5_b469.67 test runs 2024-09-19 02:02:15 +02:00
Vitaly Provodin
607d937d46 Update README.md 2024-09-19 02:02:15 +02:00
Alexey Ushakov
3c382f4c84 JBR-4950 src\java.desktop\windows\native\libawt\windows\awt_FileDialog.cpp: warning C4267: '+=': conversion from 'size_t' to 'UINT', possible loss of data
Added casts to resolve warnings
2024-09-19 02:02:15 +02:00
Vitaly Provodin
28202c57fa update Commit and Full testing exclude list on results of jbr17.668 test runs 2024-09-19 02:02:15 +02:00
Maxim Kartashev
73c19e20d4 JBR-4951 In function 'convert_to_java_array': error: comparison of integer expressions of different signedness 2024-09-19 02:02:15 +02:00
Vitaly Provodin
ae29580248 JBR-4089 add modules sun.awt sun.awt.image sun.java2d 2024-09-19 02:02:15 +02:00
Vitaly Provodin
ba84293d4f update exclude list for Commit testing 2024-09-19 02:02:15 +02:00
Vitaly Provodin
00fc3cd1de exclude tests failing because of JBR-4933, JBR-4934 2024-09-19 02:02:15 +02:00
Alexey Ushakov
6033a5795b JBR-4731 SIGILL caused by NPE Cannot invoke "java.awt.GraphicsConfiguration.getDevice()" because "config" is null
Handled null device in platform window
2024-09-19 02:02:15 +02:00
Maxim Kartashev
3a97fe4134 Move JBR README.md to .github/ 2024-09-19 02:02:15 +02:00
Svyatoslav Vlasov
48238cd929 Add ProjectorUtils to jbr-api (#181)
* Add ProjectorUtils to jbr-api

Co-authored-by: Sviatoslav Vlasov <Sviatoslav.Vlasov@jetbrains.com>
2024-09-19 02:02:15 +02:00
Nikita Tsarev
34eb9f5b8e JBR-3941 Make apple.awt.captureNextAppWinKey default to false 2024-09-19 02:02:15 +02:00
Vitaly Provodin
50c5a1f9b2 JBR-4912 jb/java/api/frontend/CustomTitleBarDoubleClick.java intermittently throws java.awt.AWTError 2024-09-19 02:02:14 +02:00
Maxim Kartashev
336870c952 exclude java/awt/dnd/AcceptDropMultipleTimes/AcceptDropMultipleTimes.java due to JBR-4880 on windows 2024-09-19 02:02:14 +02:00
Alexey Ushakov
53224b4fef JBR-4710 macOS: SIGSEGV at sun.java2d.metal.MTLLayer.blitTexture
Added check for disposed texture in the MTLLayer
2024-09-19 02:02:14 +02:00
Nikita Gubarkov
6b6f0efc59 JBR-4890 Fix variation selectors font fallback on macOS
If font for a given variation selector not found, try without variation selector
2024-09-19 02:02:14 +02:00
Artem Bochkarev
bf5fcc1c0b JBR-4907 remove custom view for osx system menu items
Just revert "JBR-3131: support custom view for system menu items"
2024-09-19 02:02:14 +02:00
Vitaly Provodin
88a1874179 exclude java/awt/FullScreen/AltTabCrashTest/AltTabCrashTest.java due to JBR-4905 on windows&linux 2024-09-19 02:02:14 +02:00
Alexey Ushakov
f1622c6781 JBR-4897 Reconnecting multiscreen monitor displays blank IDE
Handled NSWindowDidChangeScreenNotification, resolved race condition in window peer displayChanged listener
2024-09-19 02:02:14 +02:00
Vitaly Provodin
2849311d3d exclude jb/java/jcef/HandleJSQueryTest3314.sh due to JBR-4866 on linux 2024-09-19 02:02:14 +02:00
Vitaly Provodin
3e19f53180 exclude some tests due to JBR-4880 on windows 2024-09-19 02:02:14 +02:00
Vitaly Provodin
1a2b4419b2 exclude javax/swing/JInternalFrame/8020708/bug8020708.java due to JBR-4879 on windows 2024-09-19 02:02:14 +02:00
Vitaly Provodin
4e21d87ad2 exclude java/awt tests which do not close child processes/windows 2024-09-19 02:02:14 +02:00
Vitaly Provodin
c4ae907654 exclude java/awt/FullScreen/NoResizeEventOnDMChangeTest/NoResizeEventOnDMChangeTest.java and java/awt/FullScreen/UninitializedDisplayModeChangeTest/UninitializedDisplayModeChangeTest.java due to 7188711 on linux-all
j
2024-09-19 02:02:14 +02:00
Maxim Kartashev
13a0f248ca JBR-4877 WARNING: JNI local refs: 33, exceeds capacity: 32 2024-09-19 02:02:14 +02:00
Artem Bochkarev
f1ad00d739 JBR-4876 remove test duplicates
Since next jcef tests were moved into junit suite (inside jcef repository):
 HandleJSQueryTest
 JCEFStartupTest
 LoadPageWithoutUI
 MouseEventAfterHideAndShowBrowserTest
 MouseEventScenario
 MouseEventTest
2024-09-19 02:02:14 +02:00
Vitaly Provodin
fa4547ff3c JBR-4875 jb/javax/swing/JComboBox/ComboBoxTransparentTittleBarTest.java checks dragging JFrame with Combobox 2024-09-19 02:02:14 +02:00
Dmitry Batrak
007fc0c89d JBR-4871 Closed project leaked via KeyboardFocusManager#newFocusOwner
(cherry picked from commit 50c0ce58d3)
2024-09-19 02:02:13 +02:00
Maxim Kartashev
1eb1a2994c JBR-4839 Report if wrong shared library is detected at run time 2024-09-19 02:02:13 +02:00
Maxim Kartashev
0ccb668875 JBR-4848 Cannot invoke "javax.swing.JTextField.getCaret()" because the return value of "java.lang.ref.WeakReference.get()" is null 2024-09-19 02:02:13 +02:00
Alexey Ushakov
28664260b3 JBR-4590 macOS: SIGSEGV at [libawt_lwawt] MTLTR_DrawGlyphList
Invalidate glyph cache cell info after switching MTLContext
2024-09-19 02:02:13 +02:00
Nikita Gubarkov
7abc4482e3 JBR-4815 force hinting for non-antialiased text 2024-09-19 02:02:13 +02:00
Maxim Kartashev
33d61c71bc jb/branchdiff.py script to help with release branches 2024-09-19 02:02:13 +02:00
Nikita Gubarkov
cc4a92fc05 JBR-3677 check AppleActionOnDoubleClick property for custom window decorations on macOS
with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:02:13 +02:00
Alexander Lobas
f43a7a9ffe JBR-4787 Rounded corners for native windows
with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:02:13 +02:00
Vitaly Provodin
2f0144f23e updated JTreg exclude list 2024-09-19 02:02:13 +02:00
Maxim Kartashev
7a2e67e670 JBR-3862 Implement native WatchService on MacOS
The watch service is based on FSEvents API that notifies about file
system changes at a directory level. It is possible to go back to
using the old polling watch service with -Dwatch.service.polling=true.

Features include:
- support for FILE_TREE option (recursive directory watching),
- minimum necessary I/O (no filesystem access more than once
  unless needed),
- one thread ("run loop") per WatchService instance,
- changes are detected by comparing file modification times with
  millisecond precision,
- a directory tree snapshot is taken at the time of WatchKey creation
  and can take a long time (proportional to the number of files).
2024-09-19 02:02:13 +02:00
Alexey Ushakov
5a958ea57f JBR-4696 macOS: NPE in -[AWTView viewDidChangeBackingProperties]
Added null pointer checks
2024-09-19 02:02:13 +02:00
MonoBot
d2b45e8e3e JBR-4809 Update the bundled JetBrains Mono font version
Fonts release 2.242

(cherry picked from commit 641424a3e3)
2024-09-19 02:02:13 +02:00
Alexey Ushakov
69e646d411 JBR-4680 idea window flickers while changing the screen brightness
Update insets in separate notification
2024-09-19 02:02:13 +02:00
Maxim Kartashev
86f3591edf JBR-4562 JBR-4610 Generate hs_err file on SIGABRT
Supported on Linux and MacOS only.
Controlled by -Djbr.catch.SIGABRT=true option; off by default.

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:02:12 +02:00
Maxim Kartashev
5fe963deeb JBR-4626 MacOS aarch64: SIGSEGV at RenderCache.get / ScaledBlit.getFromCache
Avoid C2-compiled loop crashes by replacing the handcrafted MRU cache
with a more modern LinkedHashMap-based one.
2024-09-19 02:02:12 +02:00
Nikita Gubarkov
1973b84af1 Allow registering multiple implementations for JBR API services
This greatly reduces boilerplate when dealing with platform-specific code, one can specify multiple target implementation classes, one per platform. First found will be used.

Also added JBRApi.ServiceNotAvailableException to give services ability to validate any custom condition they want.
2024-09-19 02:02:12 +02:00
Denis Fokin
c0b7875d34 JBR-4788 "Activate window by mouse hover" Windows option isn't supported by JBR 17
backport JBR-1991 (Focus problems in Windows with X-Mouse style focus) from JBR 11

(cherry picked from commit c8ad353f45)
(cherry picked from commit a52ed88377)
2024-09-19 02:02:12 +02:00
Alexey Ushakov
f086f92043 JBR-4784 Extra allocations of MTLRenderPipelineDescriptor affects performance in metal pipeline
Remove extra allocations
2024-09-19 02:02:12 +02:00
Alexey Ushakov
113f5d4157 JBR-4774 macOS: SIGILL at [libsystem_kernel] __kill in NPE / VolatileSurfaceManager.displayChanged / __displaycb_handle_block_invoke
Guarded against multiple displayChanged() notifications
2024-09-19 02:02:12 +02:00
Dmitry Batrak
a4de7af612 JBR-4782 Synergy keyboard/mouse input: window disabled after bringing IntelliJ into focus
(cherry picked from commit f863a14b19)
2024-09-19 02:02:12 +02:00
Alexey Ushakov
af4fb47b35 JBR-4363 Changes in fonts rendering between JBR11 and JBR17
Do not use hinting for generating outlines
2024-09-19 02:02:12 +02:00
Alexey Ushakov
6c303392e4 JBR-3100 Exception in NSApplicationAWT: java.lang.NullPointerException at java.desktop/sun.lwawt.LWComponentPeer.windowToLocal
Added null check
2024-09-19 02:02:12 +02:00
Alexey Ushakov
daf0715e3b JBR-4774 macOS: SIGILL at [libsystem_kernel] __kill in NPE / VolatileSurfaceManager.displayChanged / __displaycb_handle_block_invoke
Added null check
2024-09-19 02:02:12 +02:00
Alexey Ushakov
c298cd91a1 JBR-3102 Exception in NSApplicationAWT: Invalid parameter not satisfying: !isnan(newOrigin.y)
Handled NAN values with some defaults
2024-09-19 02:02:12 +02:00
Vladislav Rassokhin
51b2558cfa JBR-4263 Improve check_jbr_size.sh
* Fix shellcheck inspections
* Don't silently fail if TOKEN is incorrect
2024-09-19 02:02:12 +02:00
Maxim Kartashev
1433e70ea4 JBR API v0.0.4
JBR-4746 Added jetbrains.api.verifyBytecode VM option for generated bytecode verification

JBR-4753 Added JBR API for custom desktop actions

Added jetbrains.api.verbose system property for easier JBR API troubleshooting

Also fixed dependency scanning optimization by allowing search in known proxy interfaces outside com.jetbrains

JBR-3511 Way to customize implementation of java.awt.Desktop.browse()

Provided Desktop.setDesktopActionsHandler() and DesktopActionsHandler
interface, which methods will be invoked instead of the standard actions
provided that DesktopActionsHandler.isSupported() is true for the
corresponding action.
2024-09-19 02:02:12 +02:00
Maxim Kartashev
798d24d64a JBR-3101 Exception in NSApplicationAWT: java.lang.NullPointerException at java.desktop/sun.lwawt.macosx.CPlatformComponent.setBounds
After CPlatformComponent.setBounds() was changed to allow for platformWindow.getPeer() == null, a few exceptions appeared that suggest platformWindow can also be null. This commit safeguards against this situation as well.

It seems that this can only be the case if the instance is created from outside of JDK, so Objects.requireNonNull() may help to catch the perpetrator.
2024-09-19 02:02:12 +02:00
Dmitry Batrak
606a78e19d JBR-4720 Focus state is broken after certain operations when VoiceOver is enabled
(cherry picked from commit dc1b49b5a6)
2024-09-19 02:02:12 +02:00
Dmitry Batrak
74ec53229f JBR-4673 Focus moves to another application on file dialog closing
(cherry picked from commit 7468974488)
2024-09-19 02:02:11 +02:00
Dmitry Batrak
22bc50e4fc JBR-4665 Focus 'jitter' on window showing in WSLg
(cherry picked from commit 9b32c2a577)
2024-09-19 02:02:11 +02:00
Nikita Gubarkov
2ca97269ab JBR-2523 JBR-2917 Fix emoji, ZWJ and font fallback
Implement rendering of colored outlines and bitmap glyphs in OutlineTextRenderer
Add Segoe UI Emoji to font fallback on Windows
Require layout for some emoji-related unicodes
Fix variation selectors and ZWJ
2024-09-19 02:02:11 +02:00
Alexey Ushakov
b165178dca JBR-2210 IDEA fails to start (JVM crashes) when using the -Dfile.encoding=UTF-8in IDEA's vmoptions file
Returning devanagari subset back for ja.UTF-8 to get non-null font name from WFontConfiguration.getTextComponentFontName(). It is a regression from JDK-8208179.

(cherry picked from commit b51254a975)
2024-09-19 02:02:11 +02:00
Dmitry Batrak
9a0e4cfb15 JBR-1987 Korean/Thai characters not printed properly in annotation tooltip (e.g. spellchecker)
This changes the fonts JDK uses for font fallback on Windows. These used to be DokChampa (for Thai) and Batang/Gulim/Gulim (for Korean).
Those fonts are not available by default on Windows 10, user needs to install supplementary font language packs to get them.
Now the following fonts will be used - Tahoma (for Thai) and Malgun Gothic (for Korean). They are available by default
on Windows 7, 8 and 10.

port from JBR 11 to JBR 15 (cherry picked from commit 850653192b)

cherry picked from commit 2bf43a57ab

Kept only Thai-related changes - Korean-related issues are now fixed in OpenJDK as per JDK-8190907
2024-09-19 02:02:11 +02:00
artem.bochkarev
0c32b54f67 JBR-4581 JCEF tests fail due to compilation errors
The problem was in commit "JBR-4512 windows: include pdb-files into jbrsdk": rsync can replace file lib/modules.
rsync is replaced with cp
2024-09-19 02:02:11 +02:00
Vitaly Provodin
6c2cfa1c44 exclude sun/java2d/DirectX/RenderingToCachedGraphicsTest/RenderingToCachedGraphicsTest.java on linux-all due to 8252812 2024-09-19 02:02:11 +02:00
Vitaly Provodin
de893790eb exclude sanity/client/SwingSet/src/ColorChooserDemoTest.java on windows-all due to 8278582 2024-09-19 02:02:11 +02:00
Alexey Ushakov
a30f7da79a JBR-4636 Some JWindow tests failed due to wrong scaling
Take into account custom scale via sun.java2d.uiScale
2024-09-19 02:02:11 +02:00
Nikita Gubarkov
54aeb5fa3e 8289189: Fix ./configure on WSL1 2024-09-19 02:02:11 +02:00
Alexey Ushakov
7225c533f6 JBR-4619 Window content scale wrong after disconnecting external display / waking OS from sleep
Use viewDidChangeBackingProperties notification to adjust a window layer scale
2024-09-19 02:02:11 +02:00
Vitaly Provodin
c2c402e608 exclude vmTestbase/vm/jit/LongTransitions due to 8271615 on macOS 2024-09-19 02:02:11 +02:00
Maxim Kartashev
67682c65ce JBR-4602 Unexpected NoSuchFileException running Rider test
This reverts commits for JBR-3680, JBR-4118, and JBR-4485.
2024-09-19 02:02:11 +02:00
Nikita Gubarkov
a347735793 JBR-4373 Add mapping for .NewYork-* and .SFArabic-* system fonts 2024-09-19 02:02:11 +02:00
Alexander Lobas
e787e73c1f JBR-4563 Rounded corners for native Window on Mac OS (#156)
* JBR-4563 Rounded corners for native Window on Mac OS
2024-09-19 02:02:11 +02:00
Alexander Lobas
a90eb6cb11 JBR-4563 Rounded corners for native Window on Mac OS 2024-09-19 02:02:10 +02:00
Alexander Lobas
02c1f3a373 JBR-4305 (#119)
* IDEA-283934 Top panel (toolbar, Editor tabs) hides under the Mac menu in full-screen mode

* IDEA-283934 Top panel (toolbar, Editor tabs) hides under the Mac menu in full-screen mode

* JBR-4305 IDEA-283934 Top panel (toolbar, Editor tabs) hides under the Mac menu in full-screen mode

* JBR-4305 IDEA-283934 Top panel (toolbar, Editor tabs) hides under the Mac menu in full-screen mode
2024-09-19 02:02:10 +02:00
Alexey Ushakov
dd2e72ddb2 JBR-4591 macOS: SIGILL at [libsystem_kernel] __kill in -[__NSMallocBlock__ removeFromSuperview]: unrecognized selector sent to instance
Verified if windowDragView is present
2024-09-19 02:02:10 +02:00
Artem Bochkarev
46b69ed183 JBR-4475: fixed browsers numeration in test
theoretically it can cause 2 requests with the same query_id: "cef_query_2" (when first browser finishes loading after the creation of second one)
2024-09-19 02:02:10 +02:00
Artem Bochkarev
2dad384359 JBR-4456: fixed HandleJSQueryTest
first invocation of dispatch(WindowEvent.WINDOW_CLOSING) calls System.exit() internally (because of setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE))
2024-09-19 02:02:10 +02:00
Vitaly Provodin
81173d47a5 exclude javax/swing/JToolBar/4529206/bug4529206.java due to 8288707 on linux 2024-09-19 02:02:10 +02:00
Vitaly Provodin
29a0c17bcd enabling dtrace-tests: added dtrace keyword
(cherry picked from commit 0b5119ca89)
2024-09-19 02:02:10 +02:00
Maxim Kartashev
611cc1d503 JBR-3101 Exception in NSApplicationAWT: java.lang.NullPointerException at java.desktop/sun.lwawt.macosx.CPlatformComponent.setBounds
CWarningWindow doesn't have a peer, so accomodated for that in
CPlatformComponent.setBounds().
2024-09-19 02:02:10 +02:00
Maxim Kartashev
4c9960b47d JBR-4485 Windows: EXCEPTION_ACCESS_VIOLATION at sun.nio.fs.WindowsDirectoryStream$WindowsDirectoryIterator.readNextEntry
As a precaution, range-check the offset returned by WinAPI before
using it to read raw memory with Unsafe.
2024-09-19 02:02:10 +02:00
Vitaly Provodin
22a90e1201 JBR-4570 improve synchronization and increase waiting time 2024-09-19 02:02:10 +02:00
Dmitry Batrak
721c6c7be8 JBR-4552 Windows revert back after initial move/resize in Cygwin/X
(cherry picked from commit 6dc194e089)
2024-09-19 02:02:10 +02:00
Manuel Unterhofer
1a5b937df6 FL-11598 Fix accidental reset of window configuration for custom decoration on macOS
This also aligns the handling of the style mask with how the other settings are applied: It uses a client property now. This property is now also applied directly on peer initialization so that there is no need to re-apply, and the window directly appears in the correct configuration.
2024-09-19 02:02:10 +02:00
Nikita Provotorov
ea5a546144 JBR-4394, IDEA-246833: refactoring and blocking the fix of JBR-1573 to recreate IMs and ICs during preediting.
(cherry picked from commits 7a36587db8d3d5a63c5691243cd5bf56733c06e6, 321a4a3f83)
2024-09-19 02:02:10 +02:00
Nikita Provotorov
7139c91b3e JBR-4394, IDEA-246833: fixup of JBR-2444.
(cherry picked from commit ef262dc8bb)
2024-09-19 02:02:10 +02:00
Dmitry Batrak
b006f8a982 JBR-4537 Popup windows shown for a background window cause app icon to blink in taskbar on KDE 2024-09-19 02:02:10 +02:00
Dmitry Batrak
6c33d08a6c JBR-4535 Popup windows disappear on mouse hover when 'Focus strictly under mouse' policy is used in KDE 2024-09-19 02:02:09 +02:00
Alexey Ushakov
7c6748d64b JBR-3828 restore details for Java exceptions in crash dumps handled by ObjC
Added exception.toString() to jbr_err_* log

(cherry picked from commit 478bd6cdd7)

Added java stack of the exception to jbr_err_* log

(cherry picked from commit e97f728e93)

Also return the static string "OutOfMemoryError" in case of that
exception has been thrown in order to avoid crashing while reporting an
exception in an out-of-memory situation.
2024-09-19 02:02:09 +02:00
Vitaly Provodin
38a671db87 exclude jb/java/awt/Window/ZOrderOnModalDialogActivation.java from S2 runs on Windows and Linux 2024-09-19 02:02:09 +02:00
Vitaly Provodin
5a7417bd12 exclude javax/swing/plaf/nimbus/TestNimbusOverride.java on windows due to 8253184 2024-09-19 02:02:09 +02:00
Vitaly Provodin
0d0f91edf5 exclude java/awt/Graphics2D/DrawString/DrawRotatedStringUsingRotatedFont.java on linux-aarch64 only due to 8266283 2024-09-19 02:02:09 +02:00
Artem Bochkarev
2999bc0423 JBR-4473: fixed native part of SystemHotkeyReader 2024-09-19 02:02:09 +02:00
Dmitry Batrak
8b7622515f JBR-1740 Menu remains open when application loses focus
(cherry picked from commit f987d22cd2)
2024-09-19 02:02:09 +02:00
Vitaly Provodin
db45726bfe exclude Frame/RestoreToOppositeScreen/RestoreToOppositeScreen.java from S2 runs due to 8286840 2024-09-19 02:02:09 +02:00
Vitaly Provodin
22406bc225 exclude java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java due to 8282232 2024-09-19 02:02:09 +02:00
Maxim Kartashev
b43cecc3c1 JBR-4471 Linux: popup appears on wrong screen after desktop scale change
When screen scale changes, the cached screen bounds must be explicitly
updated. Call resetBoundsCache() whenever X11GraphicsDevice.scale has
changed.
2024-09-19 02:02:09 +02:00
Manuel Unterhofer
0add624822 Merge fullscreen handlers for transparent title bar into existing ones 2024-09-19 02:02:09 +02:00
Manuel Unterhofer
077fc56090 FL-11420 Fix view hierarchy restoration for full-screen mode on macOS 2024-09-19 02:02:09 +02:00
Nikita Gubarkov
3311e337b8 JBR-4364 Port macOS native file dialog patches
IDEA-146669 Enable Mac native file dialogs
IDEA-159507 Mac native dialogs: multiple open dialogs are possible
JBR-1784 File dialogs aren't themed on macOS
JBR-1752 Floating windows overlap modal dialogs
JBR-2005: don't set appearance of file chooser if OSX version < 10.14
JBR-4546 Focus is not returned back to IDE after closing "Open" dialog
2024-09-19 02:02:09 +02:00
Dmitry Batrak
61af1f122a JBR-4463 Activating app-modal dialog brings all app windows to front
(cherry picked from commit 2b05925276)

includes fix for JBR-4642 regression: "focus follows mouse" broken for modals, I need to click into them

(cherry picked from commits c55bf03680, ec748f84fb)

includes fix for JBR-4957 regression: "Modal dialog is hidden by sibling popup on Linux"

(cherry picked from commit ea8da3cbe5)

includes fix for JBR-4968: jb/java/awt/Window/ModalDialogAndPopup.java intermittently fails by TimeoutException

(cherry picked from commit 2e9ab0cb06)
2024-09-19 02:02:09 +02:00
Maxim Kartashev
99f84f9bff JBR-4464 Error building latest jbr-dev after JDK-8285730 2024-09-19 02:02:09 +02:00
Maxim Kartashev
cb3635823f JBR-4118 NIO methods fail on Google Drive's virtual volume
If NtQueryDirectoryFile() failed with STATUS_INVALID_PARAMETER,
try again asking for less information with the FileDirectoryInformation
option as "information class". This option works on a mounted
Google Drive, but it doesn't provide file ids, which speed
up file listing. So it is used only as a fall-back solution.

(cherry picked from commit 82693aa985)
2024-09-19 02:02:08 +02:00
Maxim Kartashev
de45f7bf83 JBR-3680 Cherry-pick Google's NIO patches to get faster file listing
Fix regression introduced by Google's NIO patches:
- do not attempt to get the next entry after the directory stream has
been closed already,
- fix FaultyFileSystem that is used in StreamTest.java to throw
the right exception even when getFileAttributeView() is used instead of
readAttributes(),
- removed unnecessary type cast that caused a compilation warning.

Added a test for walking a directory with a non-latin name.

(cherry picked from commit 152a4e886d)
2024-09-19 02:02:08 +02:00
Renaud Paquay
43a7a8aea5 JBR-3680 Improve performance of WindowsDirectoryStream
Use `NtQueryDirectoryInformation` instead of `FindFirst/FindNext` to
retrieve the list of entries of a directory.

`NtQueryDirectionInformation` has 2 main benefits over
`FindFist`/`FindNext`:

* Performance is about 40% faster

* Each retrieved entry retrieved contains a 64-bit `FileId` in addition
  to the usual attributes, ensuring that returned `java.nio.Path`
  instances hold onto a `BasicFileAttributes` instance that exposes a
  non-null `java.nio.file.attribute.BasicFileAttributes.fileKey()`.

This change also requires creating a new WindowsFileKey class, similar
to UnixFileKey class, so that
`java.nio.file.attribute.BasicFileAttributes.fileKey()` can return an
Object instance that can be used to compare files for equality.

With this change, the Windows implementation of Files.walkFileTree is
about 40% faster when the FOLLOW_LINKS option is not used, and about
2.5x faster when the FOLLOW_LINKS option is used.

When the FOLLOW_LINKS option is used, most calls to
`Files.isSameFile`, which is expensive as it requires 2 file I/O
operations, are avoided because the Path entries returned by the
new WindowsDirectoryStream implementation now contain a non-null
BasicFileAttributes.fileKey(). The remaining calls to
`Files.isSameFile` are performed when Files.walkFileTree need
to compare the initial directory with other entries.

Change-Id: Id79d89d477a6d5dcf151c63a9d6072c6f7ef43b2

(AKA JBR-3680 Cherry-pick Google's NIO patches to get faster file listing)

(cherry picked from commit 7c2d7541ba)
2024-09-19 02:02:08 +02:00
Maxim Kartashev
2a69c2c811 JBR-3498 Windows: exception when trying to delete a directory with a trailing space
Allow Windows Path to have a trailing space despite Windows naming conventions
discouraging it. Many programs - including Explorer - successfully work
with such files or directories.
2024-09-19 02:02:08 +02:00
Dmitry Batrak
61e49d3e8f JBR-1518 JBR 11 does not support chain of popups on Linux
(cherry picked from commit 849356ee01)
2024-09-19 02:02:08 +02:00
Dmitry Batrak
2e2ec6b0c3 JBR-4306 Robot doesn't work as expected in some cases on macOS
(cherry picked from commits 7d69734465, 0f33031484, 3b5ded0d02)
2024-09-19 02:02:08 +02:00
Ryan Osial
a540efa64c Cache results of font-config pattern search for reuse
(cherry picked from commit 432f637904)
(cherry picked from commit 17bc232f6f)
2024-09-19 02:02:08 +02:00
Maxim Kartashev
85ac9a627a JBR-3948 Linux: SIGSEGV at [libawt_xawt] Java_sun_awt_X11_XInputMethod_createXICNative
The crashes begin with the call to getDefaultConfig() in
createStatusWindow() returning garbage. With 8280468 fixed, there aren't
many reasons left for it to do so; it must be that the argument to the
call (the screen number) is out of range.

This change eliminates the possibilities to get an absolutely incorrect
screen number by checking the return values of several Xlib functions,
which, when fail, will leave their outgoing arguments uninitialized.
This, in turn, can lead to reading some random memory resulting in
equally random screen number that is later being fed to
getDefaultConfig().

Although on modern systems with Xinerama there should really be no
screen other than zero, as the last resort, this number is also
range-checked in getDefaultConfig() itself.
2024-09-19 02:02:08 +02:00
Anton Tarasov
2f38247cb8 JBR-4389 [update_1] IDEA UI font becomes too large after disconnecting the external monitor / sleep 2024-09-19 02:02:08 +02:00
Anton Tarasov
23f3768e0e JBR-4389 IDEA UI font becomes too large after disconnecting the external monitor / sleep 2024-09-19 02:02:08 +02:00
Dmitry Batrak
f0230f50cc remove duplicate bundled JetBrains Mono bold italic font
following JBR-4402

(cherry picked from commit b7e5d3cfcf)
2024-09-19 02:02:08 +02:00
Dmitry Batrak
d808d7a9b8 JBR-4402 The wrong text is rendered in editor 2024-09-19 02:02:08 +02:00
Vitaly Provodin
11adf933a1 JBR-4297 add a regression test
(cherry picked from commit 8e94fff6aa)
2024-09-19 02:02:08 +02:00
Konstantin Bulenkov
2b57879654 Update JetBrains Mono font to 2.225 2024-09-19 02:02:08 +02:00
Alexey Ushakov
5c8b74f344 JBR-4363 Changes in fonts rendering between JBR11 and JBR17
Resolved merge artifact after applying IDEA-57233 fix
2024-09-19 02:02:07 +02:00
Alexey Ushakov
d41ff5eb91 JBR-3843 IDE text is misaligned vertically when using Consolas font
Use usWinAscent/usWinDescent for metrics on Windows
2024-09-19 02:02:07 +02:00
Alexey Ushakov
9dda324792 JBR-1110 [JDK11] java/awt/font/Outline/OutlineInvarianceTest.java: Failed for font java.awt.Font[family=Dialog,name=MS Gothic,style=bold,size=30]
Replaced FT_LOAD_NO_HINTING mode for non AA rendering with FT_LOAD_TARGET_LIGHT

(cherry picked from commit 3368768244)
2024-09-19 02:02:07 +02:00
Alexey Ushakov
8a03a48b26 JBR-2000 RM 2019.3.1 font rendering regression, normal text is heavier
Added -Djava2d.font.loadFontConfig=bundled to force loading bundled font.conf

(cherry picked from commit 788e078f64)
2024-09-19 02:02:07 +02:00
Dmitry Batrak
6fdf9f94f8 JBR-4346 [Xfce] Windows are moved unexpectedly between workspaces when modal dialog is shown
(cherry picked from commits ad299f1e74, 800220af16)
2024-09-19 02:02:07 +02:00
Alexey Ushakov
ca7f9818ad JBR-3827 SIGILL at [libsystem_kernel] __kill in Java Exception at -[CDragSource convertData:]
Added check for drag source
2024-09-19 02:02:07 +02:00
Alexey Ushakov
b060fb1a84 JBR-3366 SIGILL at [libsystem_kernel] __kill in NSWindowStyleMaskFullScreen cleared on a window outside of a full screen transition
Wrapped the native exception and added logging

JBR-4882 Unable to exit fullscreen mode after Presentation mode was entered (and exited) on macOS

(cherry picked from commit d57e8b631b)
2024-09-19 02:02:07 +02:00
Alexey Ushakov
6bb4bd5f0e JBR-3365 SIGILL at [libsystem_kernel] __kill in java.lang.RuntimeException: Failed to convert, no screen / primaryScreen
Wrapped the native exception and added logging
2024-09-19 02:02:07 +02:00
Dmitry Batrak
74be2a95fe JBR-3751 Window content isn't rendered with some window managers on Linux
(cherry picked from commit 8d22e4dcb0)

includes fix for JBR-5046 Incorrect initial window's location in Xfce

(cherry picked from commits 234e705134, 02bc54f864)

includes fix for JBR-5458 Exception at dialog closing

(cherry picked from commit acde759572)
2024-09-19 02:02:07 +02:00
Vitaly Provodin
8ac2d0c4d4 JBR-4294 split desktop tests to more groups for Commit testing 2024-09-19 02:02:07 +02:00
Dmitry Batrak
aeb9ac743a JBR-4281 Window losing focus isn't detected in some cases on macOS
(cherry picked from commit 363650bbf4)

with JBR-4638 Regression: Unable to enter emoji in editor via Emoji & Symbols on macOS

(cherry picked from commit 8b9a00915d)

with JBR-4652 With multiple projects open non-fullscreen, right-click on Dock icon to select the project from the context menu doesn't switch to that project

(cherry picked from commit e34677587d)

with JBR-5134 Input methods can't be dynamically disabled on a focused JComponent

(cherry picked from commit 0a3f4b206d)
2024-09-19 02:02:07 +02:00
greg
10f10f8571 macOS: add methods to setup transparent titlebar with custom height (#100)
* macOS: add methods to setup transparent titlebar with custom height

* make windowTransparentTitleBarHeight CPlatfromWindow property

* add windowTransparentTitleBarHeight test

* Prevent mouseUp events on the transparent header on macOS when the window is being dragged

Co-authored-by: Manuel Unterhofer <manuel.unterhofer@jetbrains.com>

Custom macOS window decorations via JBR API

JBR-4460 Fix window drag with custom decorations on macOS

JBR-4553 Add logging to setUpTransparentTitleBar and resetTitleBar
2024-09-19 02:02:07 +02:00
Denis Fokin
19e23aed01 JBR-4038 [JBR17] Force Touch events are not supported on macOS
Added missing files and handlers from JBR11
2024-09-19 02:02:07 +02:00
Alexey Ushakov
bc0565c6cd JBR-3901 jbr-dev compile problem
Added transient keyword
2024-09-19 02:02:07 +02:00
Alexander Lobas
93e9d1f643 JBR-2893 Big Sur: Add support of opening project as tabs IDEA-257932 Big Sur: IDEA hangs after closing a project tab after exiting and entering full screen
Converted JNF to JNIUtilites

(cherry picked from commit f02e31a440)
(cherry-picked from commit a84736ebcc)
2024-09-19 02:02:07 +02:00
Dmitry Batrak
9f50669d7c JBR-3676 WINDOW_ACTIVATED/DEACTIVATED events sent to a frame when child window closes on macOS
(cherry-picked from commit 824f9ebec3)
2024-09-19 02:02:06 +02:00
Dmitry Batrak
766333906f JBR-3611, JBR-3633, JBR-3666, JBR-3663, JBR-3671, JBR-3673, JBR-4181, JBR-4186, JBR-4893 Interoperability with macOS desktop spaces
(cherry-picked from commits 43fdd6cd26, 75335543f2, a156c6b9bf, 9fdc75969b, 1dcc612a81, 93588d0738, 94a3885bbe, c040e05703, 67b6cd871f, 9040fd56cd, 6349b86b7f)
2024-09-19 02:02:06 +02:00
Dmitry Batrak
6584c9e6af refactor nativeCreateNSWindow call wrapping
as part of JBR-3017

(cherry picked from commit eeef67a335)
2024-09-19 02:02:06 +02:00
Dmitry Batrak
f4877be24f remove excessive wrapping with AccessController (AWTThreading does it internally now)
as part of JBR-3017

(cherry picked from commit f1dd523ba8)
2024-09-19 02:02:06 +02:00
Dmitry Batrak
4861bd7ead JBR-2971 Log more information about window creation and property changes
(cherry picked from commit 9d86b4d235)
2024-09-19 02:02:06 +02:00
Dmitry Batrak
714c27d04c JBR-2533 Popup is not focused on click when switching from another application on macOS
(cherry picked from commits d9ff151211, 67b174dc8c, 72b0add80c, 21af1eba85, 2f1d317d87, 6dd334f9f0, cd863bac0d, 010f6fc951, 25e087d269, parts of 7d5ac56b6c, cd6dd5c3cf, e8bbd8ffdd, abfc3e2e79, 50933cd23e)

with fix for JBR-3640 (java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFAppModalTest.java: window Open button lost focus when it should not) and JBR-3979 (Focus is not transferred to parent window)

with fix for JBR-5300 Change source code and test files to use GPL license

with fix for JBR-2651 jb/java/awt/Focus/PopupIncomingFocusTest.java intermittently fails by java.util.concurrent.TimeoutException
2024-09-19 02:02:06 +02:00
Nikita Provotorov
b635b901cf JBR-4271: JBR17 and dev built without --with-vendor-name parameter have invalid value of the java.vm.vendor property.
Changes the default JBR's vendor from "Oracle Corporation" to "JetBrains s.r.o.".

(cherry picked from commit 0cb7b4565c)
2024-09-19 02:02:06 +02:00
Nikita Gubarkov
711bfacd68 JBR API v0.0.3
JBR-4228 report HTMINBUTTON, HTMAXBUTTON, HTCLOSE, HTMENU, HTCAPTION targets via JBR API & handle corresponding non-client mouse events for windows with custom decoration
2024-09-19 02:02:06 +02:00
Alexey Ushakov
36bc65242b JBR-4224 java/awt/image/VolatileImage/GradientPaints.java: Number of mismatches (300000) exceeds limit (54000) with tolerance=5
Updated reg test to handle contentLost event
2024-09-19 02:02:06 +02:00
Vitaly Provodin
886c0ec6fb exclude javax/swing/border/TestTitledBorderLeak.java on windows due to 8213531 2024-09-19 02:02:06 +02:00
Ivan Lopatin
ff89319040 Scale2: exclude java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java due to 8279190 on macosx-all 2024-09-19 02:02:06 +02:00
Nikita Provotorov
b3608e6dea JBR-3299: The test /jb/sun/awt/macos/NationalLayoutTest/Layout_ABC.java fails on MacOS.
Fixes the Layout_*.java tests by giving them to know the <Ctrl + key> combinations can generate KEY_TYPED event.

(cherry picked from commit eae5198b20)
2024-09-19 02:02:06 +02:00
Vitaly Provodin
8cce18a2b2 exclude java/awt/Frame/FrameSetSizeStressTest/FrameSetSizeStressTest.java on Wayland
sun/security/pkcs11/Signature/TestDSAKeyLength.java                                 8279941 linux-all
2024-09-19 02:02:06 +02:00
Alexey Ushakov
4ca53def92 JBR-4112 macOS: SIGILL at [libsystem_kernel] __kill in OOME: Java heap space at java.awt.image.DataBufferInt.<init>
Reg test update: replace management api with jfr
2024-09-19 02:02:06 +02:00
Nikita Provotorov
9228103f73 JBR-4207, IDEA-287559: IDEA incorrectly handles AltGr key modifier.
This commit reverts the fix of JDK-8041928 and disables its regression tests.

(cherry picked from commit ba5209ec06)
2024-09-19 02:02:06 +02:00
Nikita Provotorov
52bf3de7ca JBR-4207, IDEA-287559: IDEA incorrectly handles AltGr key modifier.
Renames the test AltGrMustGenerateAltGrModifierTest3838.java to AltGrMustGenerateAltGrModifierTest4207.java.

(cherry picked from commit ed60a9c2bd)
2024-09-19 02:02:05 +02:00
Vitaly Provodin
5016a531fc exclude sun/security/pkcs11/Signature/TestDSAKeyLength.java on Ubuntu 21.04 due to 8279941 2024-09-19 02:02:05 +02:00
Anton Tarasov
9070e59851 JBR-4204 provide an option to disable a11y support on macOS
(cherry picked from commit ee3c56abdc)
2024-09-19 02:02:05 +02:00
Vitaly Provodin
0f31f8ca10 exclude two swing tests on Windows due to JBR-4197 2024-09-19 02:02:05 +02:00
Alexey Ushakov
640415cb14 JBR-4112 macOS: SIGILL at [libsystem_kernel] __kill in OOME: Java heap space at java.awt.image.DataBufferInt.<init>
Removed double allocation of surface data
2024-09-19 02:02:05 +02:00
Alexey Ushakov
fcc6afeeb8 JBR-4187 java/awt/GraphicsDevice/DisplayModes/UnknownRefrshRateTest.java.UnknownRefrshRateTest fails on mac
Constrained display modes count used by the test
2024-09-19 02:02:05 +02:00
Alexey Ushakov
6677e6730c JBR-4177 libc++abi: terminating with uncaught exception of type NSException
Added check for AppContext
2024-09-19 02:02:05 +02:00
Alexey Ushakov
4e8b61664d JBR-4174 java/awt/FullScreen/FullScreenInsets/FullScreenInsets.java fails on mac aarch64
Hide cursor to fix OGL&Metal Robot issue (it reads cursor image). Added tolerance to fix Metal Robot inaccuracy.
2024-09-19 02:02:05 +02:00
Artem Semenov
ef159b871d JBR-4167 [JCK] AccassibleJTree tests fail on Ubuntu 2024-09-19 02:02:05 +02:00
Alexey Ushakov
9110749924 JBR-4164 IDEs cannot be launched via launch configuration
Moved execution of displayChanged() to EDT
2024-09-19 02:02:05 +02:00
Vitaly Provodin
f8a4cf297a JBR-4169 add jdk.javadoc into JBR 2024-09-19 02:02:05 +02:00
Alexey Ushakov
c4759988e7 JBR-4150 IDE regularly locks up at sun.lwawt.macosx.LWCToolkit.getScreenInsets
Restored caching screen insets. Added handling of dock resize.
2024-09-19 02:02:05 +02:00
Vitaly Provodin
407e8169c1 exclude java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowBlockingTest.java on Wayland configs due to 8279256 2024-09-19 02:02:05 +02:00
Vitaly Provodin
a457870fc3 exclude java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java on Scale2 configs due to 8279190 2024-09-19 02:02:05 +02:00
Vitaly Provodin
a02db1c7c4 exclude java/awt/FullScreen/UninitializedDisplayModeChangeTest/UninitializedDisplayModeChangeTest.java due to 827361 2024-09-19 02:02:05 +02:00
Vitaly Provodin
ad0a53aa73 add exclude list for Wayland failures 2024-09-19 02:02:04 +02:00
Vitaly Provodin
1518bbae2c exclude javax/swing/plaf/basic/BasicComboPopup/JComboBoxPopupLocation /JComboBoxPopupLocation.java on macOS due to 8194945 2024-09-19 02:02:04 +02:00
Vitaly Provodin
eb55eb56b5 exclude sun/java2d/SunGraphics2D/EmptyClipRenderingTest.java on windows due to 8144029 2024-09-19 02:02:04 +02:00
Maxim Kartashev
17eda59566 JBR-3948 Linux: SIGSEGV at [libawt_xawt] Java_sun_awt_X11_XInputMethod_createXICNative
The problem: the crashes occur in createStatusWindow() when calls like
adata->AwtColorMatch() end up going to 0x0 pc or some random inaccessible
memory. The only reason for that seems to be the
getDefaultConfig(screen) returning either NULL or garbage. That, in turn, probably
happens because of the wrong screen number provided. Before JBR-3623 was
fixed, awt_numScreens could've changed between the time the screen
number was chosen and the getDefaultConfig() call. After JBR-3623 was
fixed, this change is protected with the AWT lock, which this code
holds.
The fix: obtain the screen number via the Xlib API rather than the
ad-hoc loop though the root windows and return NULL if
getDefaultConfig() doesn't return useable data.

(cherry picked from commit 3d23e8d6a5)
2024-09-19 02:02:04 +02:00
Vitaly Provodin
578db782a9 add exclude list for Scale2 test runs 2024-09-19 02:02:04 +02:00
Vitaly Provodin
1d432330fc exclude java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java due to 8134231 2024-09-19 02:02:04 +02:00
Alexey Ushakov
20fe0945f4 JBR-3773 M1 java/awt/Window/WindowAppearanceTest/WindowAppearanceTest.java: : Incorrect color java.awt.Color[r=75,g=74,b=72]at (140,5)
Added more variants of colors for unfocused and focused titles
2024-09-19 02:02:04 +02:00
Artem Semenov
83a8a5bb7d JBR-3775 Optimize the algorithm for obtaining tree elements 2024-09-19 02:02:04 +02:00
Nikita Gubarkov
719dbcd5a7 JBR API v0.0.2
Added file dialog customization via JBR API & fixed bugs in windows common item dialog

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:02:04 +02:00
Vitaly Provodin
cca02887a5 JBR-3931 add the module jdk.unsupported.desktop into jbr
(cherry picked from commit 32def2fd42)
2024-09-19 02:02:04 +02:00
Alexey Ushakov
e74473d355 JBR-4111 [JBR17] Make possible to select files and directories independently
Implemented apple.awt.fileDialogForFiles property
2024-09-19 02:02:04 +02:00
Vitaly Provodin
bc6ec30e2e enable fixed tests to regular runs 2024-09-19 02:02:04 +02:00
Vitaly Provodin
cc975102e0 exclude javax/swing tests on mac-aarch64 due to 8277816 2024-09-19 02:02:04 +02:00
Aleksandr Veselov
f58f72171f JBR-4107 A11y: macOS - wrong frame position if window is not on primary screen 2024-09-19 02:02:04 +02:00
Alexey Ushakov
20f87fcef5 JBR-4060 [JBR17+Metal] Flickering on button's shadow
Removed unnecessary global flag. Optimized mask cache texture clearing code.
2024-09-19 02:02:04 +02:00
Alexey Ushakov
d9afd0d5df JBR-3954 Transparent text color rendering (needed for experimental UI)
Performed conversion from ARGB_PRE to ARGB in the grayscale text shader
2024-09-19 02:02:03 +02:00
Alexey Ushakov
8fe0cdf324 JBR-3872 [JBR17+Metal] Wrong color for scrollbars and inlay hints
Corrected typo in setTxtUniforms and fixed alpha blending in frag_gmc_text shader
2024-09-19 02:02:03 +02:00
Alexey Ushakov
a518ad699b JBR-3820 Gamma correction for grayscale text in Metal rendering pipeline
Implemented gamma correction using the same approach that we did for OGL grayscale text rendering (OGLTextRenderer.c)
Optimized shader performance
2024-09-19 02:02:03 +02:00
Alexey Ushakov
6281d0fe92 JBR-4104 jbr-dev compilation failure
Corrected suppress warnings
2024-09-19 02:02:03 +02:00
Dmitry Batrak
88bc663078 JBR-4084 Default font '. AppleSystemUIFont' does not have bold weight on Chinese characters
(cherry picked from commit 4fde082d53)
2024-09-19 02:02:03 +02:00
Maxim Kartashev
392b1162c3 JBR-3899 SIGSEGV at [libjvm] _ZN23JfrNetworkInterfaceName11on_rotationEv
Prevent JfrNetworkInterfaceName::on_rotation() to dereference a
potentially NULL pointer.

(cherry picked from commit b2a9372d70)
2024-09-19 02:02:03 +02:00
Dmitry Batrak
d4d7379fd6 JBR-4021 Unexpected focus event order on window showing
(cherry picked from commit 2a398ebb24)

includes fix for JBR-4131 Popup doesn't get focus if created from context menu

(cherry picked from commit 685562aafc)
2024-09-19 02:02:03 +02:00
Maxim Kartashev
577659db00 JBR-3923 Internal Error in c1_Instruction.cpp
Make C1 hotspot compiler bail out during CFG construction if there's a
cycle in the graph that isn't a natural loop and that has led to an
unexpected state of stack/locals like missing a phi function.

This is a temporary measure that lets hotspot continue working
even after encountering such bytecode patterns. The full solution
will probably involve more sophisticated CFG checks.

(cherry picked from commit aa0b61cb75)
2024-09-19 02:02:03 +02:00
Vitaly Provodin
52b8d897de exclude tests spontaneously creating windows during test execution 2024-09-19 02:02:03 +02:00
Maxim Kartashev
fc4181aa4f JBR-2755 IDE UI became slow via remote X Server connection from Windows
When XGetImage() calls become slow in a remote X11 session, fake
XGetImage() with client-side XCreateImage() that is filled with some
background color. The color is chosen from several top left corner
pixels of the "slow" images obtained with XGetImage().

This feature activates in a remote X11 session only and is
controlled with -Dremote.x11.workaround={true|false|auto}.
2024-09-19 02:02:03 +02:00
Alexey Ushakov
c9416e8c69 JBR-3924 CMD+Tilda does not switch app windows
Introduced vm property to disable capturing of next app window shortcut
2024-09-19 02:02:03 +02:00
Nikita Gubarkov
714be6f950 JBR-2917 Added emoji support for Windows
JBR-3951 Pass real glyph type from native code instead of guessing it by rowBytes & width
2024-09-19 02:02:03 +02:00
Pavel
cf4694239e JBR-3926 make AwtComponent transparent for hit events by default
* JBR-3926 make AwtComponent transparent for hit events by default

* [WIP] pass hittest event to frame only if custom decoration is enabled and frame ready to handle it
(cherry picked from commit c0e26ff5d5)
2024-09-19 02:02:03 +02:00
Maxim Kartashev
fab200c793 JBR-3896 Abysmally slow input and UI performance since upgrade to IU-213.4928.7 from previous 2021.3 EAP version
The slowness was the result of XWM.getInsetsFromExtents() repeated
attempts to acquire frame extents from a property that under Sway is
simply unavailable. Each attempt added at least 20ms to every re-draw.

Prior to (repeatedly) checking for NET_FRAME_EXTENTS property of a
window, check that the property is supported by the window manager.

(cherry picked from commit b40cc1c791)
2024-09-19 02:02:02 +02:00
Dmitry Batrak
53aa647dcb log LWCToolkit invokeAndWait requests
as part of JBR-3017, to make investigation of similar issues simpler in the future

(cherry-picked from commit a7fd723e43)
2024-09-19 02:02:02 +02:00
Alexey Ushakov
5e46221911 JRE-202 Deadlock in CGLGraphicsConfig.getCGLConfigInfo
Added processing system events while waiting for OGLRenderQueue.lock
Moved getCGLConfigInfo logic execution to AppKit thread so, awt lock is
 taken on one thread

(cherry picked from commit d1c8bf03e1bd41cb075aa73cc39558103af7fe1a)
(cherry picked from commit 6bf9f31986be64acf3755b34568802f9960a66ec)
(cherry picked from commit 4e21d67e0369bffac45662c63699b39946218a7a)
2024-09-19 02:02:02 +02:00
Alexey Ushakov
cc64cd94be JRE-193 UI freeze and 12/second thread dumps
Moved CStrikeDisposer dispose code to AppKit

(cherry picked from commit 28774d6878)
2024-09-19 02:02:02 +02:00
Alexander Lobas
13107675f7 JBR-3660 PhpStorm 2021.2 crashes on selecting iCloud Drive directory in Open dialog
(cherry picked from commit f5434bcaaf)
2024-09-19 02:02:02 +02:00
Alexander Lobas
6de50da41b JBR-3629 SIGILL at [libsystem_kernel] __kill NPE at com.intellij.openapi.options.SchemeImportUtil$1.isFileSelectable / -[CFileDialog askFilenameFilter:]
(cherry picked from commit 86c13ecaed)
2024-09-19 02:02:02 +02:00
Alexander Lobas
c226f56037 JBR-3443 Native file dialog on OSX enable filename filter by VM option
(cherry-picked from commit f10e324538)
2024-09-19 02:02:02 +02:00
Alexander Lobas
7910a73b9c JBR-3442 Native file dialog on OSX (for open file) doesn't allow pasting path
(cherry-picked from commit 7d8cc524ca)
2024-09-19 02:02:02 +02:00
Maxim Kartashev
deeea787dc Revert "JBR-2755 IDE UI became slow via remote X Server connection from Windows"
This reverts commit cd9138844da770ae60806fd7dbc1e85c773882a8.
2024-09-19 02:02:02 +02:00
Konstantin Aleev
6471792a1e fix memory leaks in AccessibleJTree
(cherry picked from commit 561a7b8def)
2024-09-19 02:02:02 +02:00
Maxim Kartashev
54fd4f372e JBR-3835 Cropped messages in all Message Dialogs in Idea on Ubuntu 18.04.5 LTS with swing alerts enabled
The _NET_FRAME_EXTENTS property that is used to obtain the initial
insets of a dialog window does not immediately get its value and may be
returned as 0 if queried too soon after the window creation.

In order to avoid (incorrect) guessing of dialog's insets, make 3
attempts at getting the insets with a small but increasing pause
in between them.
2024-09-19 02:02:02 +02:00
Maxim Kartashev
d14dc9cb69 Revert "JBR-3835 Cropped messages in all Message Dialogs in Idea on Ubuntu 18.04.5 LTS with swing alerts enabled"
This reverts commit 8e7aed70976ec0f90c736d86b9cd3e9cf09ff6d4.
2024-09-19 02:02:02 +02:00
Nikita Provotorov
10c29d9c1a JBR-3838 AltGr on Polish keyboard triggers Ctrl+Alt shortcut.
Add regression test.

(cherry picked from commit 8df43eef4b)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:02:02 +02:00
Maxim Kartashev
fd2a25ab3a JBR-3835 Cropped messages in all Message Dialogs in Idea on Ubuntu 18.04.5 LTS with swing alerts enabled
The _NET_FRAME_EXTENTS property that is used to obtain the initial
insets of a dialog window does not immediately get its value and may be
returned as 0 if queried too soon after the window creation.

In order to avoid (incorrect) guessing of dialog's insets, add an
artificial delay if getInsets() is called too soon.
2024-09-19 02:02:02 +02:00
Alexey Ushakov
514830b3bc JBR-3820 Gamma correction for grayscale text in Metal rendering pipeline
Added regression test to compare OGL and Metal text rendering
2024-09-19 02:02:02 +02:00
Artem Bochkarev
788c5eba3e JBR-1762: request focus of immediate parent when dispose popup
because requesting focus for frame-parent causes to close whole popup chain

(cherry picked from commit 7a2ccfc521)

JBR-1762: fixed review comments

(cherry picked from commit 0efbe5d9b9)
2024-09-19 02:02:01 +02:00
Dmitry Batrak
1cfe2ac330 JBR-2759 Typeahead issue on Linux
(cherry picked from commits 76bdaf1131, b20c56ff3e, c9609330f2, a170b4e4ae)
2024-09-19 02:02:01 +02:00
Artem Bochkarev
f6cde48a32 JBR-1762: request focus of immediate parent when dispose popup
because requesting focus for frame-parent causes to close whole popup chain

(cherry picked from commit 7a2ccfc521)

JBR-1762: fixed review comments

(cherry picked from commit 0efbe5d9b9)
2024-09-19 02:02:01 +02:00
Renaud Paquay
3a0d546acc Add BasicWithKeyFileAttributeView interface
This new interface is similar to `BasicFileAttributeView` except it
gives implementations a hint that the fileKey() should be acquired
even at some performance cost.

`FileTreeWalker` uses this new interface to request a file key
in addition to regular file attributes so that file equality can
be efficiently performed when checking for loops during file
tree traversal.

This makes `FileTreeWalker` about 2x faster when traversing non
trivial file system trees with the FOLLOW_LINKS option.

Change-Id: I8de047c8fc241dbab9ad57c5e361118a3a94893d

(AKA JBR-3680 Cherry-pick Google's NIO patches to get faster file listing)

(cherry picked from commit 6d1c3f06c4)
2024-09-19 02:02:01 +02:00
Ivan Migalev
a3f055960d JBR-3785: don't touch the active keyboard layout on input method activation / deactivation.
origin PR: github.com/JetBrains/JetBrainsRuntime/pull/78.

(cherry picked from commit 2f772fd1a2)
2024-09-19 02:02:01 +02:00
Dmitry Batrak
27dd58a803 JBR-3779 Unexpected Alt+Tab behaviour for Java frames on Cinnamon DE
(cherry picked from commit 0bf13985d5)
2024-09-19 02:02:01 +02:00
Maxim Kartashev
79cc5caf26 JBR-3772 java/beans/PropertyEditor/TestFontClass.java: access denied ("java.util.PropertyPermission" "sun.awt.x11.trace" "read")
Instead of using System.getProperty() directly, wrap the call into
GetPropertyAction and use AccessController to execute it.
2024-09-19 02:02:01 +02:00
Dmitry Batrak
9bf02a2d66 JBR-3504 a11y focus is set on the wrong element when opening popups
(cherry-picked from commit a69e12e0d2)
2024-09-19 02:02:01 +02:00
Maxim Kartashev
9d6d754535 JBR-3665 Typing is slow in remote X session
Only call XGetKeyboardMapping() once for all valid codes and cache the
resulting table. Use the cache on the subsequent calls to
keycodeToKeysym().
2024-09-19 02:02:01 +02:00
Maxim Kartashev
f3624b3bed JBR-2273 JBR musl port
Detect if we're running on a musl-based system by checking for the presence
of the libgcompat.so glibc compatibility library in the process' map.
If so, java is re-started with LD_LIBRARY_PATH set to point to the right
directory with libjvm.so. This works around the problem with the musl
dynamic library loader.

(based on commit 13a904ddb5)
2024-09-19 02:02:01 +02:00
Alexey Ushakov
538f79319d Added support for otf into the build scripts. Updated prebuild maps.
Applied code from jbr-dev
2024-09-19 02:02:01 +02:00
Konstantin Bulenkov
9532818d58 bundle Inter font 2024-09-19 02:02:01 +02:00
Maxim Kartashev
2c33bad437 JBR-3664 Logging for communications with X server
Introduced logging controlled with -Dsun.awt.x11.trace.
Currently, only looks at the AWT lock and reports methods holding it
sorted by average hold time.

(based on commit 792a58ea0e)
(based on commit 770b4dc9c1)
2024-09-19 02:02:01 +02:00
Dmitry Batrak
d74dd5dc07 JBR-3726 Modal windows 'disappear' on minimize in KDE
(cherry picked from commits d9baf2d9db, 9c2841028f, 5c4fd9ceaf, f0ed32fca4)
2024-09-19 02:02:01 +02:00
Maxim Kartashev
104b9ce3e9 JBR-3542 Fix -Xcheck:jni warnings
Fixes warnings coming from JBR-specific code in addition to those fixed
by 8269223.
2024-09-19 02:02:00 +02:00
Dmitry Batrak
4ce32f8895 JBR-3706 Toggling full screen mode for two frames doesn't work on macOS if invoked without delay
(cherry picked from commit 28cfc4815f)
2024-09-19 02:02:00 +02:00
Dmitry Batrak
5a30dbb18d JBR-3686 Background window steals focus when converted to full screen on macOS
(cherry-picked from commit 07a5b9672e)

with fix for JBR-6436 crash in jb/java/awt/Focus/FullScreenFocusStealing.java and jb/java/awt/Window/FullScreenTwoFrames.java

(cherry picked from commit 98b3ac5221)

with fix for JBR-6569 macOS: SIGILL at [libsystem_kernel] __kill in This decoder will only decode classes that adopt NSSecureCoding. Class 'AWTView' does not adopt it.

(cherry picked from commit 7af653070f)
2024-09-19 02:02:00 +02:00
Dmitry Batrak
0eb77d5c3c JBR-3662, JBR-3672 Focus jumps to another project tab after closing modal dialog
(cherry picked from commit bfd01081c3, 2a71dc5981)
2024-09-19 02:02:00 +02:00
Nikita Gubarkov
844f21f576 JBR-3648 Replace CacheCellInfo usages with MTLCacheCellInfo in metal rendering code 2024-09-19 02:02:00 +02:00
Dmitry Batrak
4665b0d7e0 JBR-3642 java/awt/Window/8159168/SetShapeTest.java fails on macOS-x64 & macOS-aarch64
make sure jb/java/awt/Focus/Typeahead* tests still pass

includes fixes for JBR-3786 javax/swing/plaf/aqua/CustomComboBoxFocusTest.java fails on MacOS by timeout
(cherry picked from commit f5c5388fb5)

and JBR-4113 java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java fails by time out on macOS

(cherry picked from commit d8d4c55a61)
2024-09-19 02:02:00 +02:00
Anton Tarasov
b7ee1b4125 JBR-1834 [linux] runtime hidpi switch is broken
(cherry picked from commit eaa04303a7)
2024-09-19 02:02:00 +02:00
Anton Tarasov
2be408ea67 JBR-1429 Scale is huge due to GDK_SCALE
(cherry-picked from commit 1c3477df2e)
2024-09-19 02:02:00 +02:00
Anton Tarasov
b3e54cf66c JBR-1365 force IDE-managed HiDPI on Linux for fractional scales
(cherry picked from commit f092ff3962)
2024-09-19 02:02:00 +02:00
Anton Tarasov
6166391622 Allow HiDPI mode on Linux 2024-09-19 02:02:00 +02:00
Anton Tarasov
fbe83c02a4 JRE-489 -Dswing.bufferPerWindow is fractional scale unfriendly 2024-09-19 02:02:00 +02:00
Anton Tarasov
fe7549bc0e JRE-310 check for Windows8.1 when enabling ui scale
Was "don't fallback on fractional scale" in JBSDK9.
2024-09-19 02:02:00 +02:00
Vitaly.Provodin
e7b3773f78 add 32-sizes for native data types
(cherry picked from commit 3a79870da8)
2024-09-19 02:02:00 +02:00
Nikita Gubarkov
3495fce534 Added JBR-specific .idea project files 2024-09-19 02:02:00 +02:00
Alexey Ushakov
12814f52ea JBR-3344 "Exit Full Screen" action doesn't work, the only way is mouse click on window's native "green" button.
Restored JBR-1931 fix partially reverted by JBR-1718

(cherry picked from commit c0be778e20)
2024-09-19 02:02:00 +02:00
Anton Tarasov
6371134388 JBR-3337 jb/java/jcef/HandleJSQueryTest3314.sh: fails on macOS-aarch64 with "JS Query was not handled in 2nd opened browser"
(cherry picked from commit 8678f41971)
2024-09-19 02:01:59 +02:00
Anton Tarasov
9a1185f1d6 JBR-3545 Window.setMinimumSize does not respect DPI scaling
(cherry picked from commit 9b4f72ad18)
2024-09-19 02:01:59 +02:00
Denis Fokin
69f9470d13 JRE-408 JBR-3515 fix NullPointerException in MetalRootPaneUI.installWindowListeners
(cherry picked from commit 584d554af529cff445b0f09bc2d57be55e138b7a)
(cherry picked from commit 6a42bb54bd)
2024-09-19 02:01:59 +02:00
Elena Sayapina
ef36549f22 JBR-2657 [TESTBUG] ChainOfPopupsFocusTest misbehaving on Windows
- changed open popup shortcut from Ctrl+N to Ctrl+M, so no new explorer windows appear if desktop gets focused by error
- added a click on the main test frame, so it gets focus when running from background cygwin process on Windows, otherwise it just flashes on the taskbar

(cherry picked from commit eda8e4d50e)
2024-09-19 02:01:59 +02:00
Denis Konoplev
eb40246e62 EA-252361: Check window for null
(cherry picked from commit 23a7dbd486)
2024-09-19 02:01:59 +02:00
Artem Bochkarev
555c7c67d9 JBR-3131: support custom view for system menu items
(cherry picked from commit 78d509ac0f)
2024-09-19 02:01:59 +02:00
Artem Bochkarev
5943cf4c95 JBR-3127: set NSWindowAllowsImplicitFullScreen=NO
fixed JBR-3127 Modal dialogs invoked from modal or floating dialogs are opened in full screen

(cherry picked from commit 0b8ff1a7e6)

JBR-3127: add possibility to load NSJavaVirtualMachine

JavaVM framework is deprecated but this class is still checked by AppKit, see https://youtrack.jetbrains.com/issue/JBR-3127#focus=Comments-27-4684465.0-0

(cherry picked from commit be6a2c4f0c)
2024-09-19 02:01:59 +02:00
Nikita Gubarkov
c07042b3a2 JBR-3376 Added check for -1 glyph info pointer in OGLTextRenderer.c 2024-09-19 02:01:59 +02:00
Dmitry Batrak
83adf83ac4 JBR-3024 Popups are shown with 1x1 size sometimes
test case only

(cherry picked part of commit ee298f5287)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:59 +02:00
Vitaly Provodin
8549a2fe72 JBR-3314 add regression test
(cherry picked from commit c81adfed61)
2024-09-19 02:01:59 +02:00
Ivan Migalev
4d47593b5d JBR-3227 Reload type of required native file dialogs each time a file dialog is requested
(cherry picked from commit 26dd87ab7c)
2024-09-19 02:01:59 +02:00
Ivan Migalev
24a5449086 JBR-3068 Update path selector behavior when sun.awt.windows.useCommonItemDialog is enabled
(cherry picked from commit 442bb7eecc)
2024-09-19 02:01:59 +02:00
Alexey Ushakov
aa750c4b61 JBR-2996 M1 warnings: CoreText note: Client requested name “.SFCompact-Black”, it will get Times-Roman rather than the intended font
Cached system fonts family names

(cherry picked from commit 56629e4c90)
2024-09-19 02:01:59 +02:00
Alexey Ushakov
d5a37f4610 JBR-3023 Gray idea frame after project open with ide.mac.transparentTitleBarAppearance.
Initiate move/resize event on first appearance of window having FULL_WINDOW_CONTENT property set

(cherry picked from commit a6ea081ba2)
2024-09-19 02:01:59 +02:00
Dmitry Batrak
fd070b0be3 JBR-3017 Focus issue in presence of third-party accessibility tool
use the new invocation approach for 'makeKeyAndOrderFront' as well, as it can also cause synchronous back-calls to accessibility subsystem, and change the global call order unexpectedly

this commit fixes TypeaheadSetVisibleTest and TypeaheadToFrontTest, when they are run with AltTab active

Guard against possible deadlocks, if UI-related methods are invoked not on EDT.
Sample deadlock scenario:
* Application thread attempts to show the window, this involves calling CWrapper.NSWindow.makeKeyAndOrderFront under AWT tree lock, which blocks till 'makeKeyAndOrderFront' completes on AppKit thread
* AppKit thread, while executing 'makeKeyAndOrderFront' performs 'back-call' to CAccessibility.getFocusOwner, which waits for execution on EDT
* EDT performs some activity requiring AWT tree lock (e.g. processing of PaintEvent)

(cherry picked from commits e3aaff5db4, 09941119e1)
2024-09-19 02:01:59 +02:00
Dmitry Batrak
b57cd45ee2 JBR-3072 Deadlock on nested dialog hiding
(cherry picked from commits 99242748ee, ad1595b5c2)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:58 +02:00
Dmitry Batrak
b61d354d5f fix occasional freezes of JBR-3017 reproducer after the fix
(cherry picked from commit 7e6db54f77)
2024-09-19 02:01:58 +02:00
Dmitry Batrak
018f1ae249 JBR-2819 Create API to determine typographic family/subfamily for available fonts
(cherry picked from commit 89e519a4ef)
2024-09-19 02:01:58 +02:00
Nikita Gubarkov
f455a45118 JBR-2924 Do not try to create native italic font when we're going to make it fake italic 2024-09-19 02:01:58 +02:00
Nikita Gubarkov
8903d9e7a0 JBR-3982 Fixed non-antialiased text rendering on macOS
JBR-3269 Disabled subpixel antialiasing for macOS Mojave and newer
2024-09-19 02:01:58 +02:00
Dmitry Batrak
f64c4a21c4 JBR-3017 Focus issue in presence of third-party accessibility tool
(cherry picked from commit 88ead5d9e3)
2024-09-19 02:01:58 +02:00
Vitaly Provodin
f77115ab9c JBR-1718 add a regression test
(cherry picked from commit 84ff4eab21)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:58 +02:00
Elena Sayapina
08886867d9 JBR-2890 [TESTUPDATE] Enable jcef tests on macOS aarch64 platform
(cherry picked from commit 1714d7b627)
2024-09-19 02:01:58 +02:00
Nikita Gubarkov
fe9e07fba5 Added JBR API
with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:58 +02:00
Artem Bochkarev
50b26620cb JBR-2562: fixed invokation of parent method
(cherry picked from commit 93cbab2f2d)

JBR-2562: suppress exceptions from [NSWindow _changeJustMain]

temporary workaround to prevent crashes

(cherry picked from commit dd055b5970)
2024-09-19 02:01:58 +02:00
Mikhail Grishchenko
281738e830 JBR-2890 Disable jcef tests on 32-bit and aarch64 platforms
(cherry picked from commit d34d6528fe)
2024-09-19 02:01:58 +02:00
Alexey Ushakov
7f69d18dcb JBR-2879 Big Sur: Opening project in new window results in opening project in another tab
Disabled Tabbing mode for all NSWindows

(cherry picked from commit 8cb0377a31)
2024-09-19 02:01:58 +02:00
Nikita Gubarkov
6edea7b1dc JBR-2910 Implemented extended glyph cache for macOS
JBR-3976 Fixed text spacing & emoji scaling on macOS

JBR-3638 Adjust subpixel glyph positions for correct rounding in CStrike#getGlyphImageBounds
2024-09-19 02:01:58 +02:00
Alexey Ushakov
bd3af7a3f9 JBR-2617 Text with opacity renders black
Implemented alpha blending in grayscale text rendering (UX-1320)
Corrected bright text thickness (smooth on), bright and dark text thickness (smooth off)
Added JVM properties for fine tuning

(cherry picked from commit c30306f779)
(cherry picked from commit c95adeb8f2)
(cherry picked from commit 269c9580fb)
(cherry picked from commit 55c7be5fe9)
(cherry picked from commit e28ff71e97)
2024-09-19 02:01:58 +02:00
Alexey Ushakov
f68a9e65ed JBR-2521 Ugly font in all 2020.2 EAPs on macOS
Provide gamma correction for both light and dark text

(cherry picked from commit 5953202a7e)
2024-09-19 02:01:58 +02:00
Alexey Ushakov
0fb0d994a1 JBR-2591 Repainting is broken (was: Icons in tree list widgets became dark)
Save current blend mode before cached grayscale rendering

(cherry picked from commit 7beb75ccec)
(cherry picked from commit ed52fde57d)
2024-09-19 02:01:57 +02:00
Alexey Ushakov
5c63babbab JBR-1986 Enabling fractional metrics causes visual artifacts in font rendering on macOS 10.14+
Disable subpixel positioning for macOS 10.13+ if legacy LCD rendering is disabled

(cherry picked from commit dbd24232e4)
2024-09-19 02:01:57 +02:00
Vitaly Provodin
e05d827f1c exclude bug7154030 on macosx-aarch64 due to 8268284 2024-09-19 02:01:57 +02:00
Vitaly Provodin
0d62698f1d exclude SharedMemoryPixmapsTest on macosx-all due to 8221451 2024-09-19 02:01:57 +02:00
Vyacheslav Moklev
905f2c25c2 JBR-2442 fix memory leak of fileBuffer
fix was suggested by Nikita Gubarkov
2024-09-19 02:01:57 +02:00
Sergey Malenkov
2e92c6312f EA-235126 - CME: HighlightableComponent.getPreferredSize
(cherry picked from commit 523d80cafd)
2024-09-19 02:01:57 +02:00
Kirill Kirichenko
f7f001309e JBR-2667 Post review: rename win.darkTheme.on to win.lightTheme.on and reversed the logic
(cherry picked from commit eeab5252e6)
2024-09-19 02:01:57 +02:00
Kirill Kirichenko
5722384180 JBR-2667 Add new AWT desktop property for light/dark theme detection on Windows 10
(cherry picked from commit 0e4ad056dd)
2024-09-19 02:01:57 +02:00
Alexey Ushakov
8cab653f9f JBR-2593 Wide ligatures not rendered in Grayscale mode
Added missing flush of cached vertices

(cherry picked from commit ad409b4370)
2024-09-19 02:01:57 +02:00
Nikita Gubarkov
3868f7813c JBR-2910 Implemented extended glyph cache for Linux 2024-09-19 02:01:57 +02:00
Nikita Gubarkov
5dbb19e340 JBR-2910 Implemented extended glyph cache for Windows 2024-09-19 02:01:57 +02:00
Nikita Gubarkov
a0e16dbfdd JBR-2614 Fixed LCD glyph width to include both left & right padding, so that rowBytes = width * 3 2024-09-19 02:01:57 +02:00
Alexey Ushakov
4048d92c69 JBR-2463 Font rendering problem on macOS Mojave
Use adjusted advances for glyphs

(cherry picked from commit 1af5dd4aae)
2024-09-19 02:01:57 +02:00
Denis Konoplev
4ff8e75a66 JBR-3544: Generate popup invoked instead of New in this directory.
- A fix
- A regression test (cherry picked from commit 7995574c09)
2024-09-19 02:01:57 +02:00
Vitaly Provodin
68c5ccc65b JBR-2545 Clean up the list of ignored Render tests
(cherry picked from commit f7b4c42e1d)
2024-09-19 02:01:57 +02:00
Jayathirth D V
44bf89594d 8241490: Add large text performance tests in RenderPerfTest
(cherry picked from commit 803ee2f2b5)
2024-09-19 02:01:56 +02:00
Alexey Ushakov
44ad8f5aad 8230657: Create fine grained render perf test for metal pipeline
Converted gradle JUnit test to plain java for ant and gnumake

To run the tests:
cd src/demo/share/java2d/RenderPerfTest

ant run
or
java -jar dist/RenderPerfTest.jar
or
java -jar dist/RenderPerfTest.jar testWhiteTextBubblesGray

(cherry picked from commit 356121b18f)
(cherry picked from commit 8bd8d2d132)
2024-09-19 02:01:56 +02:00
Konstantin Bulenkov
12d3eeb84e Update FiraCode to 5.2
(cherry picked from commit 71e2a8d8ad)
2024-09-19 02:01:56 +02:00
Alexey Ushakov
0188ea16c8 JBR-1929 Improve rendering of San Francisco font of macOS Catalina
Reverting gamma correction because of rendering artifacts in the light theme

This reverts commit 5016db51

(cherry picked from commit c1d644a004)
2024-09-19 02:01:56 +02:00
Alexey Ushakov
bea35868cf JBR-1929 Improve rendering of San Francisco font of macOS Catalina
Added gamma correction to match grayscale rendering with subpixel one

(cherry picked from commit 5016db518a)
2024-09-19 02:01:56 +02:00
Alexey Ushakov
7ff968881c JBR-2463 Font rendering problem on macOS Mojave
Use adjusted advances for glyphs

(cherry picked from commit 1af5dd4aae)
2024-09-19 02:01:56 +02:00
Anton Tarasov
899161d009 revert: JBR-1434 "New file dialog" popup remains above all windows on switching application
java.awt.peer.WindowPeer.isLightweightDialog() method does not exist.

(cherry picked from commit 7d8aeaf7de)
2024-09-19 02:01:56 +02:00
Anton Tarasov
633ae6c3f0 JBR-2872 improve: JBR-2866 JCEF: Markdown editor steals focus from a different frame
(cherry picked from commit bad748e3d0)
2024-09-19 02:01:56 +02:00
Anton Tarasov
229726c2d1 JBR-2866 JCEF: Markdown editor steals focus from a different frame
with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:56 +02:00
Anton Tarasov
5c8248ded7 JBR-2645 enable CefBrowser.close(true) in jcef reg tests
(cherry picked from commit 492c217125)
2024-09-19 02:01:56 +02:00
Anton Tarasov
5217a7507c JBR-2259 WebSite isn't loaded with .loadUrl method if browser isn't shown in UI
(cherry picked from commit 57bbddf071)
2024-09-19 02:01:56 +02:00
Anton Tarasov
4a686f2df7 JBR-2557 use com.jetbrains.cef.JCefAppConfig in JCEF tests
(cherry picked from commit e30a309f92)
2024-09-19 02:01:56 +02:00
Anton Tarasov
44a6553efc JBR-2489 Git branch operations (switch to another branch, rebase) sometimes crash WebStorm 202.5428.27
(cherry picked from commit 81d2156fb1)
2024-09-19 02:01:56 +02:00
Anton Tarasov
75c474d035 JBR-2282 [jcef] update to JCEF/80.0.4+g74f7b0c+chromium-80.0.3987.122
(cherry picked from commit a5adc725df)
2024-09-19 02:01:56 +02:00
Anton Tarasov
34f19db50b JBR-2305 jcef: jb/java/jcef/JCEFStartupTest.java throws java.lang.ExceptionInInitializerError
(cherry picked from commit f0385f01ec)
2024-09-19 02:01:56 +02:00
Anton Tarasov
9334cc8c94 JBR-2306 jcef: jb/java/jcef/JCEFStartupTest.java unexpectedly exits with the exit code: 0
(cherry picked from commit ff7d7bd43c)
2024-09-19 02:01:55 +02:00
Anton Tarasov
da1e86a8f0 JBR-2299 [mac] jcef requests for "chromium safe storage" keychain access
(cherry picked from commit dd1334a352)
2024-09-19 02:01:55 +02:00
Anton Tarasov
09664702bd JBR-2222 Crash during closing IDE
(cherry picked from commit d0c367b31f)
2024-09-19 02:01:55 +02:00
Anton Tarasov
73d1f5a851 JBR-2287 [jcef] add CefBrowser wrapper to jtreg tests
(cherry picked from commit fa961d1769)
2024-09-19 02:01:55 +02:00
Anton Tarasov
e66b10a603 JBR-2169 AWTThreading: remove tracked invocation event from completion listener
(cherry picked from commit a855f3b835)
2024-09-19 02:01:55 +02:00
Anton Tarasov
a681f23954 JBR-2159 Native crash in thread AWT-EventQueue-0 when trying to push commit
(cherry picked from commit bba297b4a4)
2024-09-19 02:01:55 +02:00
Anton Tarasov
4e74368c75 JBR-2148 JCEF: JBR bundle has invalid app structure
(cherry picked from commit f45f84d7ed)
2024-09-19 02:01:55 +02:00
Anton Tarasov
523484ad70 JBR-2146 improve InvokeOnToolkitHelper to cover more generic case 2024-09-19 02:01:55 +02:00
Anton Tarasov
7dc410601b JBR-2139 Idea freeze on dynamic plugin unloading
(cherry picked from commit e57bae4f66)
2024-09-19 02:01:55 +02:00
Anton Tarasov
023682fa74 JBR-2099 jb/java/jcef/JCEFStartupTest.java fails on Windows, Linux
(cherry picked from commit 3dfb0aa16a)
2024-09-19 02:01:55 +02:00
Anton Tarasov
18eda99cae JBR-2093 create reg test for JCEF startup
(cherry picked from commit e8c2761f5b)
2024-09-19 02:01:55 +02:00
Anton Tarasov
83bd1f6cb1 JBR-2082 Revealing taskbar does not work when "Automatically hide the taskbar"
(cherry picked from commit b31a41fb2f)
2024-09-19 02:01:55 +02:00
Mikhail Grishchenko
f5fabd3515 JBR-2639, JBR-2412 [jcef] Tests that checks mouse events
JBR-2412 [windows] mouse listener does not work for jcef

(cherry picked from commit 66ad6472ae)
(cherry picked from commit 04246aac57)
(cherry picked from commit b7cde4fd05)
2024-09-19 02:01:55 +02:00
Mikhail Grishchenko
31dcae4b35 JBR-2639 [win] jcef does not recognize vertical mouse wheel events
added regression test

(cherry picked from commit e8e4741bb0)
2024-09-19 02:01:55 +02:00
Mikhail Grishchenko
f19eb43439 JBR-2412 [windows] mouse listener does not work for jcef
added regression test

(cherry picked from commit d1479872f2)
2024-09-19 02:01:55 +02:00
Elena Sayapina
30d79a0550 JBR-2630 Typing speed in IDE editor was dropped after switching to 11.0.8
Introduced sun.awt.osx.RobotSafeDelayMillis property to control macOS specific safe delay for Robot methods.
50 ms safe delay was initially hardcoded in 3862142d (JDK-8242174: [macos] The NestedModelessDialogTest test make the macOS unstable) which affected performance tests execution.

(cherry picked from commit 5f691bb788)
2024-09-19 02:01:54 +02:00
Mikhail Grishchenko
790dfb3e36 JBR-2430 [jcef] Added Regression test
Checks that JS Query is handled in 2nd opened browser

(cherry picked from commit 404ff84565)

Refactoring + changed EDT awaiting method

(cherry picked from commit dc24658b31)
2024-09-19 02:01:54 +02:00
Vitaly Provodin
79f991814d exclude the new printer test 8262731 2024-09-19 02:01:54 +02:00
Alexey Ushakov
c40f8d617b JBR-2419 Improve performance of CStrike.getNativeGlyphOutlineBounds
Do not pass the result via java object. Use more straight api.

(cherry picked from commit 9f91fe91f5)
(cherry picked from commit c0fd2daf5c)
2024-09-19 02:01:54 +02:00
Alexey Ushakov
20da2138de JBR-2382 Provide detailed stack trace in crash dumps for unhandled ObjC exceptions
Used user home dir for jbr_err files. Removed logging with reportException method

(cherry picked from commit 2c8cdb221b)

JBR-2382 Provide detailed stack trace in crash dumps for unhandled ObjC exceptions

Used process workdir for jbr_err files. Added one more logging to reportException method

(cherry picked from commit 95a47810d5)

JBR-2382 Provide detailed stack trace in crash dumps for unhandled ObjC exceptions

Generate jbr_err_pidXX.log file with detailed stack trace of the exception

(cherry picked from commit 4c42f75021)
2024-09-19 02:01:54 +02:00
Artem Bochkarev
3020799e75 JBR-2253: unset LD_PRELOAD just after VM loaded
workaround for JBR-2253 Preload libjsig.so to fix JNA crashes

(cherry picked from commit 127a2deddf)
2024-09-19 02:01:54 +02:00
Kirill Kirichenko
991cafa451 JBR-1874 Cursor not changing from 'default' to 'text'. Additional fix after reopening.
(cherry picked from commit 5a29d4ade9)
2024-09-19 02:01:54 +02:00
Elena Sayapina
69bcb9bddf JBR-2585 [TESTBUG] TouchScreenEvent tests affect tests simulating mouse actions
- added workaround for JBR-2585
- added README.md about manual test run
- made an update to close LinuxTouchScreenDevice properly
- added an error exit from linux shell script if sudo password is empty or chown fails

(cherry picked from commit 4deb3bbe61)
2024-09-19 02:01:54 +02:00
Elena Sayapina
2e63ea4261 IDEA-165950 [TESTUPDATE] National keyboard layouts support
Update regression test after the following commits:

02fad83c: Remove public constants from KeyEvent
f4227faf: Impossible to assign cmd+ß shortcuts
(cherry picked from commit 264802cf4b)
2024-09-19 02:01:54 +02:00
Elena Sayapina
d4d54537bb JBR-2328 [TESTBUG] Regression test java/awt/keyboard/AllKeyCode/AllKeyCode.java is not correct
(cherry picked from commit 861f73c393)
(cherry picked from commit bfab6a9364)
(cherry picked from commit e9fa7a0882)
2024-09-19 02:01:54 +02:00
Mikhail Grishchenko
cc73719b01 JBR-2259 WebSite isn't loaded with .loadUrl method if browser isn't shown in UI
Added reproducer

(cherry picked from commit e875bf72c9)
2024-09-19 02:01:54 +02:00
Denis Konoplev
be10f4c209 JBR-2490 Add option to work with Surface Pen
(cherry picked from commit 5acc7680a1)
2024-09-19 02:01:54 +02:00
Denis Konoplev
7bfed9f20d JBR-2669: set unicode for both keyCode and extendedKeyCode
(cherry picked from commit ba3f14c83a)
2024-09-19 02:01:54 +02:00
Denis Konoplev
be12d4480c JBR-2554: Proper unicode values in KeyEvent.keyCode
(cherry picked from commit 703d77a927)
2024-09-19 02:01:54 +02:00
Denis Konoplev
916da19de9 JBR-215: Remove SystemInfo
(cherry picked from commit 9adf77a512)
2024-09-19 02:01:54 +02:00
Denis Konoplev
2040a685dd JBR-215: Separate LatinNonAlphaNumKeycodes option
(cherry picked from commit caf366f6f3)
2024-09-19 02:01:53 +02:00
Denis Konoplev
280fc65eb1 JBR-215: Windows non-alphanumeric shortcuts
(cherry picked from commit 4f60efebe2)
2024-09-19 02:01:53 +02:00
Denis Konoplev
ecfe80bf94 JBR-2280: Fix regression. Mode compatible with old option.
(cherry picked from commit a3e3c23cb1)
2024-09-19 02:01:53 +02:00
Sergey Malenkov
dee5f5fabc JBR-1929 FractionalMetricsSupport
(cherry picked from commit bbdc159762)
2024-09-19 02:01:53 +02:00
Mikhail Grishchenko
3e46b5f600 JBR-2256 JEditorPane with test/html type and zero margins is not shown
Updated reproducer

(cherry picked from commit 529a188b8b)

JBR-2256 JEditorPane with test/html type and zero margins is not shown

Added reproducer

(cherry picked from commit 41578a40b5)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:53 +02:00
Mikhail Grishchenko
e6a22dbc74 JBR-2210 IDEA fails to start (JVM crashes) when using the -Dfile.encoding=UTF-8in IDEA's vmoptions file
Added regression test

(cherry picked from commit 4e1f5a43b3)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:53 +02:00
Mikhail Grishchenko
40c779fcd7 JBR-1414 [Test] downscale frames to run on low-dpi screens
(cherry picked from commit b46e74fe6f)
2024-09-19 02:01:53 +02:00
Elena Sayapina
1de1a2398f JBR-1905 [TESBUG] java/awt/TextArea/DisposeTest/TestDispose.java: frame is not disposed
- java/awt/TextArea/DisposeTest/TestDispose.java, java/awt/TextField/DisposeTest/TestDispose.java: fixed test frame disposal
- java/awt/Frame/DisposeStressTest/DisposeStressTest.java: decreased test timeout from 2h to 10 min, added minor diagnostic logging

(cherry picked from commit 7f025f4e16)
(cherry picked from commit dda7f3d871)
(cherry picked from commit bc09aadadb)
2024-09-19 02:01:53 +02:00
Alexey Ushakov
b624b85c22 JBR-2135 Use CoreText api to select the font with the most recent version
Added a property to force loading bundled fonts: -Djava2d.font.noVersionCheck=true

(cherry picked from commit cbb148dff4)
2024-09-19 02:01:53 +02:00
Alexey Ushakov
6443683f19 JBR-2137 JetBrainsMono fonts update to v1.0.3
(cherry picked from commit a6e441828a)
2024-09-19 02:01:53 +02:00
Mikhail Grishchenko
8cdee6bd5e JBR-1414: Added regression test for dnd with HiDPI scaling
(cherry picked from commit 1f4ab12fbb)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:53 +02:00
Elena Sayapina
b222c94961 JBR-2041 [TEST] Added new regression test (Touchscreen devices support)
(cherry picked from commit 2d587b3728)
(cherry picked from commit 92606f2c7f)
(cherry picked from commit 05af375909)
(cherry picked from commit 0f895bf1b2)
(cherry picked from commit 08aa0852b7)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:53 +02:00
Konstantin Bulenkov
048dd63688 Update JetBrains Mono to 1.0.2
(cherry picked from commit 6f4a13e46f)
2024-09-19 02:01:53 +02:00
Ivan Migalev
0816f1b72c Extract the DWM colorization parameters from registry (JBR-2070)
(cherry picked from commit 0330cab60b)
2024-09-19 02:01:53 +02:00
Ivan Migalev
89f1d6d2d5 Refresh desktop properties on WM_DWMCOLORIZATIONCOLORCHANGED (JBR-2070)
(cherry picked from commit 06086f4a7e)
2024-09-19 02:01:52 +02:00
Ivan Migalev
699fef0ac8 Fix a possible resource leak in ColorizationColorAffectsBorders
(cherry picked from commit 0c911b6ffe)
2024-09-19 02:01:52 +02:00
Elena Sayapina
4d0a0b4611 JBR-2086 JetBrainsMono fonts update to v1.0.1
(cherry picked from commit a4b373e631)
2024-09-19 02:01:52 +02:00
Konstantin Bulenkov
388c3d51eb JetBrains Mono 1.0
(cherry picked from commit d514f7a982)
2024-09-19 02:01:52 +02:00
Denis Konoplev
e1f9906dd3 JBR-3444: Return NullSurfaceData when gc == null
(cherry picked from commit 01ad15e61c)
2024-09-19 02:01:52 +02:00
Denis Konoplev
87df900699 JBR-1995: Last character issue with korean
Fix for JTextComponent

(cherry picked from commit a7c8b0b535)
2024-09-19 02:01:52 +02:00
Denis Konoplev
57c98097ee JBR-2891: Post PhaseEvents in the begin and end of Magnify and Rotate
(cherry picked from commit c811c295c2)
2024-09-19 02:01:52 +02:00
Denis Konoplev
35cb58a7a9 JBR-2444: Turn on IM workaround by default
(cherry picked from commit 15c4ce1d3e)
2024-09-19 02:01:52 +02:00
Denis Konoplev
d3309b4a11 Fix build: add import & fix jwhen 2024-09-19 02:01:52 +02:00
Denis Konoplev
d08d9ecfee JBR-2795: Add explicit conversion
(cherry picked from commit bf3e1c0c31)
2024-09-19 02:01:52 +02:00
Denis Konoplev
bb986d7319 IDEA-237231: Correct signarute mask
(cherry picked from commit 6974131eec)
2024-09-19 02:01:52 +02:00
Denis Konoplev
13cd5a50ef IDEA-237231: Possible fix for pen interraction
(cherry picked from commit 33a8c95d39)
2024-09-19 02:01:52 +02:00
Denis Konoplev
a5c42990e5 JBR-2041: Project view tap fix, recovery? constants & logging
(cherry picked from commit 1e904db3b0)
2024-09-19 02:01:52 +02:00
Denis Konoplev
5e817b7369 IDEA-229135: Fling animation stop on tap
(cherry picked from commit 7ce0f79561)
2024-09-19 02:01:52 +02:00
Denis Konoplev
a4c0cb1dbd Windows touch screen support
(cherry picked from commit cab3f28907)
2024-09-19 02:01:52 +02:00
Denis Konoplev
d477a91707 Turn off multitouch
(cherry picked from commit a2576ffa9a)
2024-09-19 02:01:51 +02:00
Denis Konoplev
e5eca6ad20 Check XInput extension && touch inertia
(cherry picked from commit cca7fb97f4)
2024-09-19 02:01:51 +02:00
Denis Konoplev
26d7333180 Touch scroll handling
(cherry picked from commit 6dcec3dc31)
2024-09-19 02:01:51 +02:00
Denis Konoplev
0a3ec3f62b XI2 Constants
(cherry picked from commit 588cd6ee73)
2024-09-19 02:01:51 +02:00
Denis Konoplev
048fcb6727 XLibWrapper XI2 functions
(cherry picked from commit d6bd1bfa2b)
2024-09-19 02:01:51 +02:00
Denis Konoplev
a1ae4b40c1 X11 native get put double
(cherry picked from commit f101bc1108)
2024-09-19 02:01:51 +02:00
Denis Konoplev
fc56914b83 Native data types
(cherry picked from commit 9504574dbb)
2024-09-19 02:01:51 +02:00
Denis Konoplev
aa20e05912 XI2 headers in xlib wrapper generator
(cherry picked from commit ef108067a1)
2024-09-19 02:01:51 +02:00
Denis Konoplev
50b6d965b9 Revert "Turn off multitouch"
This reverts commit 90ea3bf57e4c687e9d9bf0a37f2f64c82a81f4eb.
2024-09-19 02:01:51 +02:00
Denis Konoplev
e2a0791971 Turn off multitouch
(cherry picked from commit a2576ffa9a)
2024-09-19 02:01:51 +02:00
Alexey Ushakov
89fbbcd94a JBR-1962 Allow to change font config
Replaced several privileged blocks with just one

(cherry picked from commit faa8d3d258)
2024-09-19 02:01:51 +02:00
Vitaly Provodin
5e0084793c JBR-572: Regression test on the crash caused by the fix
(cherry picked from commit 6cc380ffb5)
(cherry picked from commit 958e25ed21)
(cherry picked from commit a7de601d5f)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:51 +02:00
Dennis Ushakov
114a4ff0d4 JBR-1863, JBR-1868 correct advances on Catalina 2024-09-19 02:01:51 +02:00
Dennis Ushakov
77e5a210d4 JBR-1850: on macOS fonts should be sorted by weight to ensure proper population of the families 2024-09-19 02:01:51 +02:00
Dennis Ushakov
03affbfb37 faster font family loading & lazy font family population
1. NSFont.familyName is faster than loading allFamilyNames
2. Prebuilt list of system fonts
3. Cleanup San Francisco family loading
4. Avoid calling expensive native getWidth on font when creating font family, load styles only when they would be used.
2024-09-19 02:01:51 +02:00
Dennis Ushakov
4752beb6ac JBR-1756 use CoreText for all font rendering on Catalina 2024-09-19 02:01:50 +02:00
Nikita Gubarkov
73d3aa8446 JBR-410 Added emoji support for Linux 2024-09-19 02:01:50 +02:00
Alexey Ushakov
9331c36b7b JBR-1997 JetBrainsMono fonts update to v0.22
(cherry picked from commit 41f4fddd34)
(cherry picked from commit f5302a02f4)
(cherry picked from commit 5d7fd2e1e5)
2024-09-19 02:01:50 +02:00
Anton Tarasov
5a6ee41ed4 JRE-729 [windows] unreasonable IME activity consumes CPU 2024-09-19 02:01:50 +02:00
Dmitry Batrak
1889ca5f1a JBR-3119 Application's panel in KDE taskbar blinks when popup window is shown
this re-fixes JBR-2934 in a different way

(cherry picked from commit 63134e091b)
2024-09-19 02:01:50 +02:00
Dmitry Batrak
c728565463 JBR-3038 Unexpected windows z-order change on workspace switch
(cherry picked from commit ddda860f42)
2024-09-19 02:01:50 +02:00
Dmitry Batrak
2b3625bd53 JBR-3035 The Confirm Exit pop-up window remains hidden behind a window of another application
(cherry picked from commit 470c3bd1b5)
2024-09-19 02:01:50 +02:00
Dmitry Batrak
30c47470b5 JBR-2934 Serious usability issue with GoLand 2020.3 caused by JBR
(cherry picked from commit 95be4351d4)
2024-09-19 02:01:50 +02:00
Dmitry Batrak
b754164ccf JBR-2977 Opening a recent project in a new window doesn't bring this window to the front
(cherry picked from commit 2d9fb9e7b8)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:50 +02:00
Dmitry Batrak
557b02b903 JBR-2698 setAutoRequestFocus(false) breaks focus logic under i3 window manager on Linux
(cherry picked from commit ebcdeb7d80)
2024-09-19 02:01:50 +02:00
Dmitry Batrak
83d2a1a1b1 JBR-2696 Log focus API invocations with stack traces
(cherry picked from commits 0f038754e5, a507cab6d3)
2024-09-19 02:01:50 +02:00
Dmitry Batrak
57696073bb JBR-2496 Prevent JVM stealing focus from other applications on Linux (JBR-2497, JBR-2499, JBR-2503, JBR-2652)
(cherry picked from commits 87525d1d2a, 66381f0dec, 8a789e04e9, 665ebc5d47, 98a9219c23)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:50 +02:00
Alexey Ushakov
288a0a3fe3 JBR-3509 Extend JDK-8267521 (Post JEP 411 refactoring: maximum covering > 50K) to JBR specific changes
Marked all the usages of SecurityManager related api
2024-09-19 02:01:50 +02:00
Artem Bochkarev
dbdd7192f9 JBR-1851: check NSArray length
and make more exception-safe
and minor optimization for logging (cache jobjects)

(cherry picked from commit 5839539379)
2024-09-19 02:01:50 +02:00
Artem Bochkarev
1dcb3c51c4 JBR-1841: allow deferred disabling of InputMethods-support
(cherry picked from commit 969255904b)
2024-09-19 02:01:50 +02:00
Artem Bochkarev
d6a5fc20e6 JBR-1668: add hardcoded default values for preferences node NSServicesStatus
(cherry picked from commit 8445f53d85)
2024-09-19 02:01:49 +02:00
Artem Bochkarev
4772b419b1 JBR-1515: obtain shortcut from OS to check inside AWTView.performKeyEquivalent
(cherry picked from commit 30d479fbd4)

JBR-4899 Activate Previous Window doesn't work sometimes

(cherry picked from commit 63cb726f3c)
2024-09-19 02:01:49 +02:00
Artem Bochkarev
924b5e7d66 JBR-1668: add hardcoded descriptions of system actions
and minor fixes

fix memory management

(cherry picked from commit 15f7368309)
2024-09-19 02:01:49 +02:00
Elena Sayapina
d9dca1840d JBR-1417 [TEST] Added new regression test (JBR 11 does not support chain of popups)
(cherry picked from commit 41e89505be)
(cherry picked from commit 9fe5c778d9)
(cherry picked from commit 6ea9530d9f)
(cherry picked from commit d757108517)
(cherry picked from commit b99c1e7b5c)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:49 +02:00
Alexey Ushakov
6c7c4d4626 JBR-1690 Bundle new fonts
Test correction
Restored RenderUtil.java
Removed obsolete golden images
(cherry picked from commits:
aa13c8b4ea
943b1472c7
cab6dd5087
7997c7a5ee
cab6dd5087
7997c7a5ee
d3731df79d)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:49 +02:00
Dmitry Batrak
db99f5bcaf IDEA-257525 Unable to show Chinese when using IDEA mac ARM version
The proposed solution is to use a 'normal' font as a base for 'San Francisco' font fallback.
Most of its fallback components/candidates (provided by the OS) are expected to be normal
fonts as well, and so the resulting coverage of Unicode character repertoire should be much better.

(cherry picked from commits 9b7113a6cf, 92b00d50b5, 53489fab27)
2024-09-19 02:01:49 +02:00
Dmitry Batrak
bae5ec55a3 JRE-469 Console with emoji output becomes slow
The fix consists of two parts:
* Making CCharToGlyphMapper remember that a particular character cannot be displayed (isn't mapped to glyph with given font). Checking this repeatedly in native code is very slow.
* Make CCompositeGlyphMapper remember the results of char-to-glyph mapping, this was missing in previous implementation. This reuses caching code in CompositeGlyphMapper, extending the range of characters for which the results are cached to include Supplementary Multilingual Plane (most emoji characters belong to it).

port commit 4e0ccde2 from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit 394e055ae6)

cherry picked from commit 0db7e948af
2024-09-19 02:01:49 +02:00
Dmitry Batrak
306f8dcd1c reimplement JDK-7162125 to fix JDK-8147002
port commit ba38e5c4 from JBR 9

port from JBR 11 to JBR 15(cherry picked from commit a949f9d220)

cherry-picked from commit f309844f75

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:49 +02:00
Artem Bochkarev
29b3986ced JBR-1771: fixed compilation errors (macosx-x86_64-normal-server-fastdebug)
(cherry picked from commit 1acada7cac)
2024-09-19 02:01:49 +02:00
Artem Bochkarev
7c6eb81a3a JBR-1668: minor fixes
fixed review comments

(cherry picked from commit 9dbcf194c9)
2024-09-19 02:01:49 +02:00
Vitaly Provodin
a62467e35e JBR-1618: fixed misprint, added saving screenshots in case of failure
(cherry picked from commit e4a3889cf0)
2024-09-19 02:01:49 +02:00
Alexey Ushakov
82c3d61548 JBR-1624 Fonts rendering is broken in the 2019.2 EAP (Fira Code)
Corrected lookup for bold fonts

(cherry picked from commit 114b8af38f)
2024-09-19 02:01:49 +02:00
Alexey Ushakov
f624f3372a JBR-1399 Improve font discovery and loading by introducing font cache
Added unit test

(cherry picked from commit b4f5bf8bd3)
2024-09-19 02:01:49 +02:00
Elena Sayapina
24135f4a9e IDEA-165950 [TEST] Added new regression test (National keyboard layouts support)
(cherry picked from commit 0900a705bc)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:49 +02:00
Artem Bochkarev
4421766dbf JBR-1668: read system keyboard shortcuts
initial support for OS X

(cherry picked from commit 6bbe7102e2)
2024-09-19 02:01:49 +02:00
Artem Bochkarev
ad43397419 JBR-1573: restore current input context after cleanup
(cherry picked from commit b7acd7f6f6)
2024-09-19 02:01:48 +02:00
Alexey Ushakov
baa71299c0 JBR-1624 Fonts rendering is broken in the 2019.2 EAP (Fira Code)
Restored old behaviour of registerFontsInDir as it does not affect idea bundled fonts

(cherry picked from commit cef29e8100)
2024-09-19 02:01:48 +02:00
Alexey Ushakov
212be27d9f JBR-1874 Cursor not changing from 'default' to 'text'
Prevent OS from changing cursor

(cherry picked from commit 94a4eb7002)
2024-09-19 02:01:48 +02:00
Alexey Ushakov
fc34127737 JBR-1778 Font in editor incorrect (always italics)
Added -it pattern into italic detection code
Added some more patterns to bold and italic detection code
'Anka/Coder' font support

(cherry picked from commit 5119eeee12)
(cherry picked from commit ec241e4a0a)
(cherry picked from commit 251068294e)
(cherry picked from commit 08ae9ff034)
2024-09-19 02:01:48 +02:00
Alexey Ushakov
77455b64b1 JBR-1699 Use platform font rendering for bundled fonts on MacOS
Use different family for specific font faces. Refactoring

JBR-3071 Remove naming workaround for Fira Code

(cherry picked from commits c423003bd4, aee4b48d20)
2024-09-19 02:01:48 +02:00
Alexey Ushakov
8c64a8cd21 JBR-1624 Fonts rendering is broken in the 2019.2 EAP (Fira Code)
Lower priority for idea bundled fonts to pickup platform ones
(if installed)

(cherry picked from commit e838103a24)
2024-09-19 02:01:48 +02:00
Alexey Ushakov
09553b6eb9 JBR-1885 JetBrainsMono fonts update to v0.19
Updated the fonts to v0.19. Bundled italic fonts

(cherry picked from commit 7f032e3fe7)
(cherry picked from commit a7b4c9449a)
2024-09-19 02:01:48 +02:00
Alexey Ushakov
fd80181a45 JBR-1624 Fonts rendering is broken in the 2019.2 EAP (Fira Code)
Lower priority for idea bundled fonts to pickup platform ones
(if installed)

(cherry picked from commit e838103a24)
2024-09-19 02:01:48 +02:00
Alexey Ushakov
d6ea0b1972 JBR-1699 Use platform font rendering for bundled fonts on MacOS
Used CFont instead of TrueTypeFont for bundled fonts on mac
Use different family for specific font faces. Refactoring

(cherry picked from commit 8c86ad3e96)
(cherry picked from commit c423003bd4)
(cherry picked from commit bcae402dc8)
2024-09-19 02:01:48 +02:00
Alexey Ushakov
fca3ad71bc JBR-1690 Bundle new fonts
Update family name for JetBrainsMono-Thin

(cherry picked from commit 0d2326ff34)
(cherry picked from commit 83843f9124)
(cherry picked from commit 2a2e1cfb36)
(cherry picked from commit 76abb69262)
2024-09-19 02:01:48 +02:00
Alexey Ushakov
b10c915b7a JBR-1645 javax/swing/JTextArea/TestTabSize.java: Tab width calculation wrong
Corrected idea font filter

(cherry picked from commit 62f9d1f46a)
2024-09-19 02:01:48 +02:00
Artem Bochkarev
de5b4a9ea0 JBR-1573: workaround for 'Sudden keyboard death on Ubuntu 18'
recreate instance of system InputMethod when starts filter all events

(cherry picked from commit 3ad94911af)

(cherry picked from commit c8533a1219)
2024-09-19 02:01:48 +02:00
Alexey Ushakov
82caae237d JBR-1399 Improve font discovery and loading by introducing font cache
Bundle IDEA fonts to improve startup performance

(cherry picked from commit 350a3fdef3)
2024-09-19 02:01:48 +02:00
Artem Bochkarev
8f1c9fb3cd JBR-1541: activate menu in completion handler of modal dialog
(cherry picked from commit e57384c1d6)
2024-09-19 02:01:48 +02:00
Alexey Ushakov
eb1bd3f44e JBR-1314 Font difference in pycharm 2019.1 on Ubuntu
Removed disabling hints on MAX_FCSIZE_LTL_DISABLED font size

(cherry picked from commit 2b99dfed40)
2024-09-19 02:01:47 +02:00
Alexey Ushakov
3c96fd4c57 JBR-1412 [fwp to JBR11] JBR-1393 RubyMine is hanging after log in (macOS)
Modified version of JBR8 fix

(cherry picked from commit 434166fe63)
2024-09-19 02:01:47 +02:00
Alexey Ushakov
d38902c697 JBR-1394 JBR11 does not support LCD text on Mac
Enable LCD rendering for transparent destinations

(cherry picked from commit 207c6b92ff)
2024-09-19 02:01:47 +02:00
Elena Sayapina
8d8bc7a0cc JBR-1372: [TESTBUG] JDialog1054.java, MoveFocusShortcutTest.java regression tests need update
(cherry picked from commit a5948894bf)
2024-09-19 02:01:47 +02:00
Maxim Kartashev
6d1a8fa1f4 JBR-2755 IDE UI became slow via remote X Server connection from Windows
When XGetImage() calls become slow in a remote X11 session, fake
XGetImage() with client-side XCreateImage() that is filled with some
background color. The color is chosen from several top left corner
pixels of the "slow" images obtained with XGetImage().

This feature activates in a remote X11 session only and is
controlled with -Dremote.x11.workaround={true|false|auto}.
2024-09-19 02:01:47 +02:00
Vyacheslav Moklev
adc8dbbabe Fix const pointer after JDK-8225032 fix 2024-09-19 02:01:47 +02:00
Vyacheslav Moklev
4f04a6de8f Fix compilation on windows platform: awt_ole.h must be included before awt.h 2024-09-19 02:01:47 +02:00
Vyacheslav Moklev
5bdb619bc2 JBR-1269 Common Item Dialog does not appear on Alt+Tab or click in windows toolbar
JBR-1270 Common Item Dialog does not have an icon

Select a proper window handle
2024-09-19 02:01:47 +02:00
Vyacheslav Moklev
4496444a87 JBR-1271 Wrong parent of native windows dialogs
Set a proper parent to a dialog window
2024-09-19 02:01:47 +02:00
Vyacheslav Moklev
43abc7f274 JBR-1273 Common Item Dialog does not open when wrong path to directory is passed
Handle set directory / set file properly
2024-09-19 02:01:47 +02:00
Vyacheslav Moklev
cb3024ebe9 JBR-1274 Common Item Dialog sometimes crash the process
Prevent from freeing memory with CoTaskMemFree twice
2024-09-19 02:01:47 +02:00
Vyacheslav Moklev
2cf6cf93ee JBR-1257 CommonItemDialog modal window has no owner
Fix modality for Common Item Dialog

squash! JBR-1257 CommonItemDialog modal window has no owner

JBR-2478 java/awt/Modal/FileDialog/FileDialogNonModal7Test.java: DummyButton on Dialog did not gain focus when clicked

revert part of JBR-1271, that's related to 'old' file dialogs
2024-09-19 02:01:47 +02:00
Vyacheslav Moklev
c141aef03a JBR-1258 CommonItemDialog ignores directory to open
Fix parsing of directory path / file path
2024-09-19 02:01:47 +02:00
Vyacheslav Moklev
3caccbc9db JRE-1216 Implement Windows native file dialogs with the new Common Item Dialog API
Add implementation of file dialogs with the new Common Items Dialog API
2024-09-19 02:01:47 +02:00
Alexey Ushakov
872e8ce00a JBR-1144 [JDK11] [macos] Held down key is not deleted when press backspace after accent menu popup (Mojave)
Handled both Delete and ForwardDelete keys

(cherry picked from commit e3ba0bd651)
2024-09-19 02:01:47 +02:00
Alexey Ushakov
bc0bca440e JBR-1144 [JDK11] [macos] Held down key is not deleted when press backspace after accent menu popup (Mojave)
Handled backspace separately

(cherry picked from commit 81916a92af)
2024-09-19 02:01:46 +02:00
Elena Sayapina
7df536ed5e JBR-1102: [TESTBUG] java/awt/Paint/ComponentIsNotDrawnAfterRemoveAddTest/ComponentIsNotDrawnAfterRemoveAddTest.java: 'paint' method of 60 components was not called
(cherry picked from commit dc7abebe17)
(cherry picked from commit c8d631a142)
2024-09-19 02:01:46 +02:00
Elena Sayapina
5397060922 JBR-998: [TEST] Added new regression test (Input freezes after MacOS key-selector on Mojave)
(cherry picked from commit 3d898a8024)
(cherry picked from commit f368f0f101)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:46 +02:00
Elena Sayapina
667505674a JBR-318: [TEST] Added new regression test (Cmd+` doesn't work after update to JDK 152_*)
(cherry picked from commit 0be0a018b5)
(cherry picked from commit 5bb4c2a1d6)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:46 +02:00
Elena Sayapina
2ac9514c50 JBR-1054: [TEST] Added new regression test (Weird non-modal dialog above modal dialog behaviour)
(cherry picked from commit b808be6a6a)
(cherry picked from commit 48b7dd874f)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:46 +02:00
Vitaly Provodin
2e148b0c8c JRE-1117 J2DBench: introduced result reader for TC's charts (follow up)
separated printing values fo TC charts and values for comparisons

(cherry picked from commit bbdbe17e2a)
2024-09-19 02:01:46 +02:00
Vitaly Provodin
83c6a26f92 JRE-1117 J2DBench: introduced result reader for TC's charts
(cherry picked from commit 422fa59643)
2024-09-19 02:01:46 +02:00
Alexey Ushakov
a134ee09d7 JRE-60 Editor font is distorted on Kubuntu Linux 16.04 with HiDPI
Override FC_HINT_SLIGHT only for small font sizes

(cherry picked from commit 0e1d23c807)
2024-09-19 02:01:46 +02:00
Alexey Ushakov
bc5be21577 JRE-471 Crash on macOS Sierra after Sleep
Replaced [NSScreen screens] 'objectAtIndex' with 'firstObject' to get nil instead of NSRangeException. Added nil checks

(cherry picked from commit d6b98511262055c01522d9ec8024253af7e91564)
(cherry picked from commit cef970e1ba)
2024-09-19 02:01:46 +02:00
Alexey Ushakov
c93371b5a2 JRE-608 J2DBench metrics: up to 20x degradation
Increased rendering queue buffer up to 6.4 MB

(cherry picked from commit 9ef00f00a7fb6e14835393f8d3944157c6800727)
(cherry picked from commit 2a61e9e997a880a60c5acb361849205170501b91)
(cherry picked from commit 68ca9f00ded004c970b94bd047a04b9f09237047)
(cherry picked from commit 2fe5289178)
2024-09-19 02:01:46 +02:00
Alexey Ushakov
e5ae9087f6 JRE-1028 fwport(9): JRE-1008 Do not use LCD shader on macOS 10.14+ in font rendering
Disable LCD text shader on macOS 10.14+ if LCD rendering is not explicitly specified

(cherry picked from commit dffea9d701)
2024-09-19 02:01:46 +02:00
Konstantin Bulenkov
c8fa0e9a8e update icons
(cherry picked from commit dfe387ff5037deda29d8d522cba6cc5370796ff4)
(cherry picked from commit de1e4a9d71)
2024-09-19 02:01:46 +02:00
Vitaly Provodin
d4af89f999 Update README.md 2024-09-19 02:01:46 +02:00
Vitaly Provodin
19b9e87bc6 Regression test on https://bugs.openjdk.java.net/browse/JDK-8139176
JBR-5008 remove extra file jb/java/awt/font/DrawTest.java from colliding group

(cherry picked from commit 6f1c0a6)
(cherry picked from commit 63130fd461)

add regression test on https://bugs.openjdk.java.net/browse/JDK-8139176

(cherry picked from commit 380c17456c)

(cherry picked from commit 6f1c0a6)
(cherry picked from commit 63130fd461)
2024-09-19 02:01:46 +02:00
Vitaly Provodin
3ac45b06f2 not for upstream: added disposing frames in order to provide the test with the chance on the second run
(cherry picked from commit 8170635)
(cherry picked from commit 7fc924f065)
2024-09-19 02:01:46 +02:00
Vitaly Provodin
c05604fd8e JRE-9: added regression test
(cherry picked from commit 4ffb665)
(cherry picked from commit 00a29ad129)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:45 +02:00
Sergey Malenkov
a8c11864f7 JRE-100 Scroll with inertia (Mac os) should only work in the initial component
(cherry picked from commit e79502c708)
2024-09-19 02:01:45 +02:00
Sergey Malenkov
c73caf1acc IDEA-161965 ignore dragged event that does not change mouse location Sierra is more sensit
(cherry picked from commit ef490fa465)
2024-09-19 02:01:45 +02:00
Dmitry Batrak
af5614943d JBR-3339 Window requests focus on horizontal scroll (on Linux)
(cherry picked from commit 8d74e8e30b)
2024-09-19 02:01:45 +02:00
Anton Tarasov
28083c429b JRE-166 [macOS] deadlock with JFXPanel
(cherry picked from commit a9dbb6990fac0c659297487a261ba9170e5fb3ad)

(cherry picked from commit 8a44e1bb37)
2024-09-19 02:01:45 +02:00
Alexey Ushakov
944fb1308f 8265445: Introduce the new client property for mac: apple.awt.windowAppearance
Implemented apple.awt.windowAppearance client property
2024-09-19 02:01:45 +02:00
Anton Tarasov
0f903c1dba JBR-3306 jbr-dev warnings: incompatible pointer to integer conversion returning 'void *' from a function with result type 'jlong' 2024-09-19 02:01:45 +02:00
Dmitry Batrak
2838cb8758 JBR-2498 Fix unexpected window raising under Mutter WM
re-implement the fix, so that ChildAlwaysOnTopTest isn't failing
2024-09-19 02:01:45 +02:00
Alexey Ushakov
e9ca91f0ed JBR-3327 [jbr-dev] Adjust mac window appearance according to AppleInterfaceStyle property
Set window appearance according to AppleInterfaceStyle default
2024-09-19 02:01:45 +02:00
Alexey Ushakov
4be5f90b8c JRE-238 [736] java.awt.AWTError: access denied ("java.lang.RuntimePermission" "canInvokeInSystemThreadGroup")
Moved task execution on AppKit to the privileged block. Minor refactoring

(cherry picked from commit 5dbb88471115c9e4a536ae37d0e6794de9e5ac9c)
2024-09-19 02:01:45 +02:00
Alexey Ushakov
65b1d5acd2 JRE-359 CGraphicsEnvironment.getDefaultScreenDevice() returns null
Moved CG api calls to AppKit thread

(cherry picked from commit fd0210f035199e8612097a2c1d42b90cfd2111f8)
(cherry picked from commit 5e99e376d9dfe477401121878704630c3c13f9f7)

(cherry picked from commit 6d73b25130)
2024-09-19 02:01:45 +02:00
Dmitry Batrak
f129fe6da6 JBR-2973 Copy/Move dialog not in the focus on drag-n-drop to Project Tool window from external application
(cherry picked from commit 20fe78b650)
2024-09-19 02:01:45 +02:00
Alexey Ushakov
d6759e26fa JRE-444 CPlatformWindow.nativeGetTopmostPlatformWindowUnderMouse is slow
Replaced number of CGWindowListCopyWindowInfo for each window layer with [NSWindow windowNumberAtPoint: belowWindowWithWindowNumber:]

(cherry picked from commit 2a143af4d62340acdfd9c94d876f684385febbc8)
(cherry picked from commit 6fc369e8bf)
2024-09-19 02:01:45 +02:00
Alexey Ushakov
f211e8dc7f JRE-482 Java_sun_font_CStrike_getNativeGlyphOutline takes too much time in scrolling
Replaced glyph outlines with bounding boxes for glyph boundaries calculation for most common usages. Also, skipped unnecessary OGL flushes in OGL rendering queue

(cherry picked from commit c58dc052af48887338a38beb0c721eddca3af481)
(cherry picked from commit 7f6be7cfb907bbf1c3572b911df5690fa3039fde)
(cherry picked from commit c68913d82c0ba4b4c509179123f0a4bf7971f857)
(cherry picked from commit 9cfa04c93ad416a8177d9e7ca410850bd3ff880f)
(cherry picked from commit 0e930841704e4e98ecc0c888b144245e74218799)
(cherry picked from commit 8ffc190fbdb059d5a24842115c0bc3ade8b351b9)
(cherry picked from commit 0f7c26186a)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:45 +02:00
Alexey Ushakov
c2c7ff68e8 JBR-3316 Reimplement CThreading functionality on top of OpenJDK17 sourcebase
Adopted CThreading related code to OpenJDK17 source base

(cherry picked from commit 5dfb30ae68b2c54d58c98a9195709c031f823581)
(cherry picked from commit 94163bd69f64616836523e81567aa1141480d841)
2024-09-19 02:01:45 +02:00
Alexey Ushakov
961b3504ea JBR-3304 jbr-dev warnings: 'getPhysFontName' defined but not used [-Werror=unused-function]
Removed unused code
2024-09-19 02:01:44 +02:00
Vitaly Provodin
d6eb621c76 exclude javax/swing/JTabbedPane/4624207/bug4624207.java failing on windows due to 8197552 2024-09-19 02:01:44 +02:00
Alexey Ushakov
a6f9745129 JRE-366 Add support for Awesome WM
Added detection of Awesome WM and handled similar to Sawfish WM

(cherry picked from commit 6742077ed198975949af567e8ef543f853397351)
(cherry picked from commit 2847be73c6)
2024-09-19 02:01:44 +02:00
Alexey Ushakov
832b58df82 JRE-353 Fedora 25 + XMonad rendering issues
Added support for Xmonad WM

(cherry picked from commit c690c3c7fdf1390e6b1a8d388ff752a09391ae3c)
(cherry picked from commit 6851dc3441)
2024-09-19 02:01:44 +02:00
Denis Konoplev
050db7db72 8264143: Change uint8_t to unsigned char 2024-09-19 02:01:44 +02:00
Dmitry Batrak
457e836175 JBR-3255 Applying 'incline' transform might change character's advance
(cherry picked from commit b37f7cfdb1)
2024-09-19 02:01:44 +02:00
Dmitry Batrak
6a87237f26 JBR-3215 'deriveFont(float)' can return a different font (not just change the size)
(cherry picked from commit 8eafcaab24)
2024-09-19 02:01:44 +02:00
Dmitry Batrak
2eff5e9565 JBR-3157 Maximized window with custom decorations isn't focused on showing
(cherry picked from commit 62b04983f2)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:44 +02:00
Dmitry Batrak
953a405c66 JBR-1752 Floating windows overlap modal dialogs
(cherry picked from commit 0161050077)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:44 +02:00
Dmitry Batrak
d828826c2a JBR-3054 Focus is not returned to frame after closing of second-level popup on Windows
(cherry picked from commit 0c2b6e1c04)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:44 +02:00
Dmitry Batrak
c36175c39d JBR-2702 Tooltips display through other applications on hover
(cherry picked from commits 11732c2469, 0ed7deabaa)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:44 +02:00
Dmitry Batrak
89c603778d added RobotSmokeTest
this test failing in jtreg launch most probably indicates either some problem with the environment (e.g. some windows left open from previously launched processes) or with java.awt.Robot implementation

(cherry picked from commit 1d525a2d2f)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:44 +02:00
Dmitry Batrak
16d582e72b JBR-2847 Always dispatch KEY_TYPED event to the same component as KEY_PRESSED event
also fixes JBR-2834, IDEA-254466, IDEA-254466
squashed with fixes for JBR-3291, JBR-3307, JBR-3598

(cherry picked from commits e94f6057a4, ba6b9c085e, 2ccf6b65a7, 3b0708af7d, 3674766d65)
2024-09-19 02:01:44 +02:00
Dmitry Batrak
14bfaae7ad JBR-2712 Typeahead mechanism doesn't work on Windows
(cherry picked from commits 1a9838082e, f5b6222835, acd7e3b2da, cd6dd5c3cf8556f97f3113cb7d615a92393b57bf(partially), e8bbd8ffdd90f57cd12d7d7e89188be97ee4be0b(partially), 37901295e1, cafb374afc, 12034dcf61)

includes fix for JBR-4974 jb/java/awt/Focus/ModalDialogFromMenuTest.java intermittently clicks at tittle bar

Pause before getting the coordinates of the component to be clicked on,
not right before the click itself.

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:44 +02:00
Denis Konoplev
3e4caacafc 8264143: Lanai: RenderPerfTest.BgrSwBlitImage has artefacts on apple M1
Add stdint include to fix x64 build
2024-09-19 02:01:43 +02:00
Dmitry Batrak
3f2598d6d8 JBR-2498 Fix unexpected window raising under Mutter WM
(cherry picked from commit 73b45fb899)
2024-09-19 02:01:43 +02:00
Dmitry Batrak
6c8c642e4b JBR-2248 Support text wrapping in a <pre> tag in JEditorPane
port from JBR 11 to JBR 15 (cherry picked from commit ff2e915371)

cherry picked from commit 6a30c56138
2024-09-19 02:01:43 +02:00
Dmitry Batrak
4ec44b8080 JBR-2234 Support CSS setting overflow-wrap:anywhere in JEditorPane
port from JBR 11 to JBR 15 (cherry picked from commits b6583d0a71, 6003abc15f)

cherry picked from commit 93ad4f06dd

also includes JBR-4006 [JCK] javax.swing.text.html.CSS$Attribute.OVERFLOW_WRAP field breaks public API
(cherry picked from commit f20a3d8679)
and JBR-4007 [JCK] javax.swing.text.GlyphView.calcBreakSpots method breaks public API
(cherry picked from commit 1002eff4f3)
2024-09-19 02:01:43 +02:00
Dmitry Batrak
2023008c63 JBR-2050 Issue with keycap emojis
port from JBR 11 to JBR 15 (cherry picked from commit ae91e1d7f1)

cherry picked from commit d3018a1837
2024-09-19 02:01:43 +02:00
Dmitry Batrak
e4f8f23219 JBR-1714 Italic text is displayed using incorrect glyphs on Windows
port from JBR 11 to JBR 15 (cherry picked from commits 46e4cdfcbd, 9cc5cbc99b)

cherry picked from commit 6769b27e53
2024-09-19 02:01:43 +02:00
Dmitry Batrak
9ff22cb00e JBR-1689 Incorrect painting of long strings on linux
port from JBR 11 to JBR 15 (cherry picked from commits e12c1d6f0d, 0429e74e9d)

cherry picked from commit e43cfd198f
2024-09-19 02:01:43 +02:00
Dmitry Batrak
a27bcb5413 JBR-1248 Exception caused by broken font
port from JBR 11 to JBR 15 (cherry picked from commit 4efa7eab3e)

cherry picked from commit 6e1c514c6c
2024-09-19 02:01:43 +02:00
Dmitry Batrak
69b9e4e9d3 JBR-1245 [JDK 11] There are different letter spacings in some controls
port from JBR 11 to JBR 15 (cherry picked from commit a26b70568a)

cherry picked from commit e2637199e9
2024-09-19 02:01:43 +02:00
Dmitry Batrak
279eb10898 JRE-927 Unexpected wrapping of bidirectional text in JEditorPane on HiDPI screens
port commit 11a5a4a2 from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit 65a5e450d5)

cherry picked from commit 47ff31ae82
2024-09-19 02:01:43 +02:00
Dmitry Batrak
2804129636 JRE-774 Don't paste BOM from clipboard on Mac
port commit ea9b75b3 from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit c6fed2cf58)

cherry picked from commit a5e25d1ef9
2024-09-19 02:01:43 +02:00
Dmitry Batrak
b30fef8efc JRE-847 Box drawing characters have different widths with Monospaced font on Windows
port commit 778cef18 from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit 9caaac4a5a)

cherry picked from commit eea293f4a4
2024-09-19 02:01:43 +02:00
Dmitry Batrak
c60470601d JRE-748 Strange dots with fractional metrics turned on
port commit 82e7c82d from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit e9bd5f5dad)

cherry picked from commit e0475e9ba2
2024-09-19 02:01:43 +02:00
Dmitry Batrak
31fca718d5 JRE-593 Wrong italic font rendering for Source Code Pro
port commit 1f6bd200 from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit 32ce109355)

cherry picked from commit 087ff34c2e
2024-09-19 02:01:43 +02:00
Dmitry Batrak
2c58a44930 JRE-430 Font fallback sometimes doesn't work in Swing text components
port commit fc8003ad from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit 5b814d6b34)

cherry picked from commits b871188f44, 0a9f16dc90, 9cc82c39d9
2024-09-19 02:01:43 +02:00
Alexey Ushakov
77c6b1bf4e JRE-303 2017.1.1 update breaks linux fonts
Corrected rendering hints for Non-AA text rendering

(cherry picked from commit b923aa7a0729a10ea47d3438622d659fbead44c9)
(cherry picked from commit b6bdd04e41)
2024-09-19 02:01:42 +02:00
Alexey Ushakov
aaf7f81ec6 JRE-205 Font is wrong and without anti aliasing in 2017.1 EAP
Added property to disable bundled font config:
  java2d.font.loadFontConf=false
Do not load custom font.conf by default

Moved hints adjusting logic from code to bundled font.conf file
Applied correction only for regular fonts with platform sizes less than 12
Some fonts are not corrected at all: Consolas, Noto Sans Mono
Used family name instead of physical one in requests to Fontconfig
Removed redundant call to FcConfigBuildFonts
Added privileged access to the properties (JRE-235,JRE-235)

(cherry picked from commit 4d4c915047077ebd966b0e3be056566d56ba11a4)
(cherry picked from commit 9d6f325f72482405264852f3ee2636f5fedaeaf0)
(cherry picked from commit e7e3372bf8db539c0f6bc85db9f1093f8fa4c380)
(cherry picked from commit 3e724caed2f199be50d25d1ecb20b7819c86be2e)
(cherry picked from commit d372b35963c096a32331b05b257e26841ace5d94)
(cherry picked from commit 18a5f5de03eb107f89dca138a44b9aab2151235c)
(cherry picked from commit 9ba320efef0539f75aa93fd1b5dd80266c954d0a)
(cherry picked from commit b8c38f419972af61291953f7f452c1698f7a1624)
(cherry picked from commit debba0128e200be60adc9a339d5985590ef4e230)
(cherry picked from commit 2fa17b1bd7d6524e4b5fa4d0b3ce2bf02a8fcc78)
(cherry picked from commit 09b4f61db0d4f5beea0e16ce9136c99e2185c10b)
(cherry picked from commit 3b6782dd742f9c74a9535145db2f9f7ffaccf7c8)
(cherry picked from commit f1b68149528c13a22fa64468c130b1405bf3d081)
(cherry picked from commit db5cf5a2b9cb454630fb86783c2d58cd5446cba6)
(cherry picked from commit 32140948578bc3c2a0c5f8adb537660421efe5e7)
(cherry picked from commit b978e3d0b131ed642774c5a14a649e13f764c20b)

(cherry picked from commit c75c1ef8b2)

(cherry picked from commit a29f19e6a2)
2024-09-19 02:01:42 +02:00
Dmitry Batrak
d23c070749 an option to disable native rendering for rotated text (following JRE-19)
port commit ccc1ded6 from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit 72fb9ff7c4)

cherry picked from commit a5bd092449
2024-09-19 02:01:42 +02:00
Dmitry Batrak
8e68a83352 JRE-11 Support text rendering via DirectWrite API on Windows 2024-09-19 02:01:42 +02:00
Dmitry Batrak
ae6ba45319 IDEA-150876 OpenJDK fonts for toolwindow names look worse than Oracles's
don't apply FreeType-returned glyph advance for rotated glyphs rendered by GDI

This seems to produce a better looking text (more evenly spaced). Fractional metrics won't be respected by this code, but we can address this later if needed.

port commits c9debd5e, ed78cd00, 4c7e1619, 7aa0429c, 7bd6c17c from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commits d6b588bdab, dbc15fb84e)

cherry picked from commit 2c0d6150d0
2024-09-19 02:01:42 +02:00
Vitaly Provodin
ee76fe95c2 JRE-186 added regression test (Modal dialogs (Messages) shouldn't popup IDEA when another application is active)
(cherry picked from commit 236bd38d1b)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:42 +02:00
Vitaly Provodin
eb1a082dcc JRE-269 added regression (JLabel doesn't scale <code>text</code> HTML fragments.)
(cherry picked from commit 1f4ad38d23)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:42 +02:00
Alexey Ushakov
dce594acc3 JRE-307 Wrong dpi reported on Wayland
(cherry picked from commit 15693661cc)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:42 +02:00
Vitaly Provodin
cdc32b9c05 JRE-392 added regression (Tip of the day is not hidden while another modal window is shown)
(cherry picked from commit c7b0ac686f)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:42 +02:00
Vitaly Provodin
84db3cea50 JRE-394 added regression test (System getenv doesn't return env var set in JNI code)
(cherry picked from commit 3a7b3c67b0)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:42 +02:00
Vitaly Provodin
47aa472f25 JRE-401 added regression test (AppCode freezes during autocomplete and other operations)
(cherry picked from commit cb4453b1d1)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:42 +02:00
Vitaly Provodin
094cce93eb JRE-422 added new regression test (AWTView deliverJavaMouseEvent leaks jEvent)
(cherry picked from commit 37dc13c603)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:42 +02:00
Vitaly Provodin
06c0342084 JRE-430 added new regression test (Font fallback sometimes doesn't work in Swing text components)
(cherry picked from commit d04debc847)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:42 +02:00
Vitaly Provodin
5229c2364f JRE-457 added new regression test (OGLTR_DisableGlyphModeState is slow)
(cherry picked from commit 3a43f4557f)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:42 +02:00
Vitaly Provodin
6c5d3feb9e JRE-458 added new regression test (Insufficient and inconsistent permissions on some files in Linux build)
(cherry picked from commit 82adbe9c25)
2024-09-19 02:01:42 +02:00
Vitaly Provodin
2f26f0582c JRE-467 added new regression test (Wrong rendering of variation sequences)
(cherry picked from commit 0026095202)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:41 +02:00
Vitaly Provodin
e1bc1e1392 JRE-468 added new regression test (Idea freezes on project loading)
(cherry picked from commit 1ce8c3ce82)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:41 +02:00
Vitaly Provodin
b16fb9c7ac JRE-501 added new regression test (Live resize is jerky for heavy java applications on Mac)
(cherry picked from commit c4a1277c1b)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:41 +02:00
Vitaly Provodin
d64acb6a79 JRE-638 added new regression test (enable unlimited cryptographic policy by default)
(cherry picked from commit 4a14c6f15a)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:41 +02:00
Vitaly Provodin
16a77c0287 JRE-705 added new regression test (Z-order of child windows is broken on Mac OS)
(cherry picked from commit 82cd480619)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:41 +02:00
Vitaly Provodin
92717a42fe JRE-624 CThreading isAppKit() fails to detect main app thread if it was renamed
(cherry picked from commit c8f248a936)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:41 +02:00
Alexey Ushakov
34949a1a8f IDEA-166173 IntelliJ freezes when returning from sleep
Fixed deadlock by removing unnecessary getScreenResolution call

(cherry picked from commit cec93cf1fd)
2024-09-19 02:01:41 +02:00
Alexey Ushakov
b17fa0f268 Added missing fontconfig defines
(cherry picked from commit 2ac273a456)
2024-09-19 02:01:41 +02:00
Alexey Ushakov
31f173a907 JRE-43 Font.getFamily() does not work in headless mode
Removed unused code

(cherry picked from commit 5b523f049e)
2024-09-19 02:01:41 +02:00
Alexey Ushakov
ce315e39f6 JRE-43 Font.getFamily() does not work in headless mode
Bundled Droid fonts to fallback in headless mode

(cherry picked from commit 5b523f049e)
2024-09-19 02:01:41 +02:00
Alexey Ushakov
0c84b0b78a JRE-15 Greyscale text is too dark comparing with subpixel AA
Adjusted default value for greyscale text rendering in freetype

(cherry picked from commit f80497c4f0)
2024-09-19 02:01:41 +02:00
Alexey Ushakov
754a22efdf IDEA-155347 On Ubuntu with High DPI tooltip font is too thick when the tooltip is fading in and out
Handled missing FC_RGBA_NONE value

(cherry picked from commit 44fcbdabf8)
2024-09-19 02:01:41 +02:00
Alexey Ushakov
1c72234fea IDEA-149882 Issue with fonts in Ubuntu 12.04
Provided fallback to default font rendering settings if libfontconfig unable to
match font pattern

(cherry picked from commit d93a5f1598)
2024-09-19 02:01:41 +02:00
Alexey Ushakov
04659912ba IDEA-151619 CLion EAP fails to start with missing symbol: FT_Library_setLcdFilter
Skip FT_Library_setLcdFilter call if the symbol is not there
Cache negative FT_Library_setLcdFilter symbol lookup result
Used RTLD_DEFAULT handler for process symbols lookup

(cherry picked from commit e6f0055704)
2024-09-19 02:01:41 +02:00
Alexey Ushakov
60a15b7655 JRE-29 fontconfig lib crashes CLion on OSX
Disabled fontconfig usage on OSX

(cherry picked from commit 431e14429c)
2024-09-19 02:01:41 +02:00
Vitaly Provodin
ee18e0fdc3 exclude tests spontaneously creating windows during test execution 2024-09-19 02:01:40 +02:00
Alexey Ushakov
b5d6595eaf JRE-48 built-in jre renders fonts abnormally heavier (normal text looks bold) than the oracle jre
Disable FT_LOAD_TARGET_LIGHT for fonts with FC_AUTOHINT=false (this target implicitly enables  FC_AUTOHINT)
Reused setupLoadRenderFlags for all rendering cases

(cherry picked from commit f3f2667a4c)
2024-09-19 02:01:40 +02:00
Alexey Ushakov
4097d25226 Added logging for freetypeScaler via env variable OPENJDK_LOG_FFS=yes
and for screen resolution in freetypeScaler

(cherry picked from commit 091d74a791)
2024-09-19 02:01:40 +02:00
Alexey Ushakov
be3aa82934 JRE-34 IDE Crashes During Startup
Added validation of dpi settings coming from xserver

(cherry picked from commit b1c49c3b27)
2024-09-19 02:01:40 +02:00
Anton Tarasov
04ef8a15a5 JBR-2031 [mac] jcef deadlocks with a11y on start
(cherry picked from commit 4f44b37f08)
2024-09-19 02:01:40 +02:00
Alexey Ushakov
403fb55674 JRE-1083 [JDK11] Test com/sun/java/accessibility/util/8051626/Bug8051626.java fails on macOS on JB JDK11b
Wrapped SelectorPerformer invocation into privileged action

(cherry picked from commit 48e7b547ae)
2024-09-19 02:01:40 +02:00
Anton Tarasov
1e098909f3 JBR-2019 provide getWindowHandle method for jcef
(cherry picked from commit 7ae706b629)
2024-09-19 02:01:40 +02:00
Anton Tarasov
87661d5d53 Comment assertion (originally JRE-965)
The assert line crashes debug hotspot.

(cherry picked from commit a00074a86c)
2024-09-19 02:01:40 +02:00
Anton Tarasov
c3e645f12b JBR-1976 [jcef] need mouse-transparent window on Windows
(cherry picked from commit b60fac96b4)
2024-09-19 02:01:40 +02:00
Anton Tarasov
d691c14bfa JBR-1824 export NSWindow::setIgnoresMouseEvents to java internal API
(cherry picked from commit 4399dc382c)
2024-09-19 02:01:40 +02:00
Anton Tarasov
8c8fbcbaec JBR-1802 com/sun/java/accessibility/util/8051626/Bug8051626.java: access denied ("java.lang.RuntimePermission" "getClassLoader")
(cherry picked from commit eae772aca9)
2024-09-19 02:01:40 +02:00
Anton Tarasov
6b3eec2a4c JBR-1795 Project opened from Welcome screen goes to backgound after loading
(cherry picked from commit 322526458a)
2024-09-19 02:01:40 +02:00
Anton Tarasov
3d520bd309 JBR-1609 Jupyter Notebook eventually causes IDEA to become unresponsive on Mac OSX
(cherry picked from commit 8ae0be8eb6)
2024-09-19 02:01:40 +02:00
Anton Tarasov
3a6617f9a0 JBR-1786 Weird white border for IDE window
(cherry picked from commit 4b09614a0e)
2024-09-19 02:01:40 +02:00
Vyacheslav Moklev
7c12cff52a JBR-1552 Invalid screen bounds in full screen mode
Check is window is not in undecorated state

(cherry picked from commit 5547701e2c)
2024-09-19 02:01:40 +02:00
Vyacheslav Moklev
e560a057d5 JBR-1509 Client area size is wrong in Borderless mode
Fix client area size

(cherry picked from commit 00d32e58dc)
2024-09-19 02:01:39 +02:00
Anton Tarasov
7bee90e3eb JBR-1770 [windows] frame does not open as maximized
(cherry picked from commit d9dfc3c6c5)
2024-09-19 02:01:39 +02:00
Anton Tarasov
3db108446a JBR-1693 difficult to input Japanese text with "Fast" Key Repeat
(cherry picked from commit 12de3e287e)
2024-09-19 02:01:39 +02:00
Anton Tarasov
e1972a90e2 JBR-1669 IDE-managed HiDPI mode is broken
(cherry picked from commit 461b0b5cd4)
2024-09-19 02:01:39 +02:00
Anton Tarasov
cd1d4c3731 JBR-1650 propagate custom decoration title bar height to native
(cherry picked from commit f6fc65d014)
2024-09-19 02:01:39 +02:00
Anton Tarasov
4f19c053eb JBR-1629 Maximized window cut at the right and bottom
(cherry picked from commit 9e768377db)
2024-09-19 02:01:39 +02:00
Anton Tarasov
109e332ed3 JBR-1492 Not able to start Intellij Idea 2017.2.5 with modified vmoptions
(cherry picked from commit e7ca6db66b)
2024-09-19 02:01:39 +02:00
Anton Tarasov
f4cd964a6c JBR-1427 pycharm jupyter preview stuck and no response when click on preview.
(cherry picked from commit 1746b04686)
2024-09-19 02:01:39 +02:00
Anton Tarasov
946d1bd6bb IDEA-210154 Borderless UI: Top frame of IDEA window is blue
(cherry picked from commit 2dd4163bc4)
2024-09-19 02:01:39 +02:00
Anton Tarasov
6ffc40bd5d JBR-1351 Borderless UI: Bold frame around IDEA window appears on non-HiDPI display
(cherry picked from commit 06d35de069)
2024-09-19 02:01:39 +02:00
Anton Tarasov
9a9319f993 JBR-1313 wrong insets for non-resizable custom-decorated frame
(cherry picked from commit 9179718cb6)
2024-09-19 02:01:39 +02:00
Anton Tarasov
4f28db4dd4 JBR-1293 do not modify client bounds when custom-decorated frame is set undecorated
(cherry picked from commit cb188edaab)
2024-09-19 02:01:39 +02:00
Anton Tarasov
b304c4accb JBR-1278 allow native border and shadow for custom decoration mode 2024-09-19 02:01:39 +02:00
Anton Tarasov
e9cd5c4d11 JRE-1232 forwardport: JRE-1228 support custom frame decoration
(cherry picked from commit d2820524a1)
2024-09-19 02:01:39 +02:00
Anton Tarasov
598b9edd48 JRE-1162 [jdk11] support on-the-fly DPI change on linux
(cherry picked from commit c06c4c69d3)
2024-09-19 02:01:38 +02:00
Anton Tarasov
8c23019080 JRE-1142 [jdk11] hidpi is not detected since Ubuntu 18.04
(cherry picked from commit be4f8c0d9d)
2024-09-19 02:01:38 +02:00
Anton Tarasov
189be5d154 JRE-1111 [JDK11] java/beans/Beans/TypoInBeanDescription.java crashes at libawt_xawt.so+0x4a30d
(cherry picked from commit b89e6aed0b)
2024-09-19 02:01:38 +02:00
Anton Tarasov
56b4cfc7aa fix JNI_OnUnload definition
(cherry picked from the commit  3571e39071)

(cherry picked from commit 1019d8f0f2)
2024-09-19 02:01:38 +02:00
Anton Tarasov
49e7f64a31 JRE-981 IM workaround does not work anymore
forward port of 2d7c29b in JetBrains/jdk8u_jdk

(cherry picked from commit f3ccc53e02)
2024-09-19 02:01:38 +02:00
Anton Tarasov
a27a21c20a JRE-938 [windows] Frame.setMaximizedBounds not hidpi-aware
(cherry picked from commit cc97899923320e1fa17f5e44975c4a0f0ba51014)
(cherry picked from commit ccfe65be7f)
2024-09-19 02:01:38 +02:00
Anton Tarasov
b1e7fdb2e3 JRE-907 macOS: add ability to check for scaled display mode
(cherry picked from commit e496262aa1)
2024-09-19 02:01:38 +02:00
Anton Tarasov
fa34123f15 JRE-934 Diff viewer errors are not visible on HiDPI Linux
(cherry picked from commit 641a09dd52)
2024-09-19 02:01:38 +02:00
Anton Tarasov
9d52a4b267 [jdk9] HiDPI scale is not detected on some linux desktops
(cherry picked from commit 9279d80110)
2024-09-19 02:01:38 +02:00
Anton Tarasov
a3e99b927d JRE-681 [windows] direct drawing into frame graphics may have wrong translate
(cherry picked from commit 6ea1d45fd1)
2024-09-19 02:01:38 +02:00
Anton Tarasov
f1aa2cd12e Read org.gnome.desktop.interface/scaling-factor
(cherry picked from commit 277357ae73)
2024-09-19 02:01:38 +02:00
Anton Tarasov
07d2d3c0bd Revert "8239894: Xserver crashes when the wrong high refresh rate is used"
This code is needed for "Read org.gnome.desktop.interface/scaling-factor".
Keep it until "JDK-8260270 Implement the HiDPI scale factor reading" is fixed.

This reverts commit a7c2ebc7
2024-09-19 02:01:38 +02:00
Anton Tarasov
98c7f1c297 Do not scale base font in HiDPI mode on Linux
(cherry picked from commit 6fb2c36529)
2024-09-19 02:01:38 +02:00
Anton Tarasov
1b0bdbcf27 JRE-772 swing returns incorrect FRC when AA is off
(cherry picked from commit a161897d908aa10da6306c06452c5d6317fed2f0)
(cherry picked from commit 2bf5a7ca5c)
2024-09-19 02:01:38 +02:00
Anton Tarasov
52ab00aec2 JRE-681 [windows] direct drawing into frame graphics may have wrong translate
(cherry picked from commit ab6dee4c1fc453ad3cb5adb69fc243e550d184ae)

(cherry picked from commit 6ea1d45fd1)
2024-09-19 02:01:38 +02:00
Anton Tarasov
d426700ec3 JRE-665 Navigate Class/File/Symbol, Find in Path popup windows don't pick characters from input method
(cherry picked from commit 676f305b2b3b278e305bd4d9bde4269f27b3d676)
(cherry picked from commit 6ce31e0a32)
2024-09-19 02:01:37 +02:00
Anton Tarasov
1bab1e0dc9 JRE-616 [linux] notify when dpi correction factor is applied to fonts
(cherry picked from commit f57d41f3118bfd773c99ce32d58cfae16931be6a)
(cherry picked from commit 6246abc72f)
2024-09-19 02:01:37 +02:00
Anton Tarasov
64fc41e183 JRE-612 [windows] icon in frame title is not dpi-aware
(cherry picked from commit dec04385177a2abb677add909d3b94f94c62a14e)

(cherry picked from commit 38466cbab0)
2024-09-19 02:01:37 +02:00
Anton Tarasov
d3617a80e8 JRE-604 [fps] frame's client area is one pixel beneath frame's borders
Adopted.

(cherry picked from commit ef2870ee38)
2024-09-19 02:01:37 +02:00
Anton Tarasov
215217a49e JRE-596 [windows] popup positioning is broken with JRE-573
Adopted: moved to AwtWindow::Reshape

(cherry picked from commit c5cc28d85d)
2024-09-19 02:01:37 +02:00
Anton Tarasov
ce810929ba JRE-577 Goland 18 displays out of memory
(cherry picked from commit 2daaf21e420d4af15d3b1bfeb3f896074bea1e61)

(cherry picked from commit 9ea2011948)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:37 +02:00
Anton Tarasov
85610a7111 JRE-573 [windows] window client area bounds mismatch
Apply only WmEraseBkgnd

(cherry picked from commit afa68f7ad6440303c6417be3f675b1c4644b6014)

(cherry picked from commit 0651b45e13)
2024-09-19 02:01:37 +02:00
Anton Tarasov
17b197a6da JRE-382 Three AWT-tests become hanging starting since master-875
(cherry picked from commit 7d492101db8fcbb3d285fd8e9669f74b0e0fce8f)
(cherry picked from commit b965f85c1b)
2024-09-19 02:01:37 +02:00
Anton Tarasov
2714a38072 JRE-373 [macos] nativeCreateNSWindow deadlocks with a11y
(cherry picked from commit 72c77a992bbf1b95b82ffc08cb2f4f3bc36b3657)

(cherry picked from commit aa09fa2c85)
2024-09-19 02:01:37 +02:00
Anton Tarasov
d6023482ed IDEA-172422 Popup at the wrong place on the second monitor (new hidpi)
Adopted: moved to AwtWindow::Reshape

(cherry picked from commit 11a0911d65)
2024-09-19 02:01:37 +02:00
Anton Tarasov
e9c03a1b14 JRE-309 [windows] on-screen position of a component is not pixel-perfect in user space in JRE-HiDPI mode
Adopted: moved to AwtWindow::Reshape

(cherry picked from commit 985908cf10)
2024-09-19 02:01:37 +02:00
Anton Tarasov
50a53edd07 JRE-269 JLabel doesn't scale <code>text</code> HTML fragments.
(cherry picked from commit 9ef72b6c3a477e4225f9b98e30fa9190613520e4)
(cherry picked from commit c17bc728ee)
2024-09-19 02:01:37 +02:00
Anton Tarasov
281e2fd3d3 JRE-225 [macos] IDEA hangs on attempt to call getDefaultScreenDevice() from EDT
(cherry picked from commit 76aba25)

(cherry picked from commit df11dcc97bb5556ac5d0299b773a512b4f0bb5bb)
(cherry picked from commit aeea6c1ca3)
2024-09-19 02:01:37 +02:00
Anton Tarasov
8ed12616ed JRE-210 JEditorPane may return wrong preferred size as it moves b/w monitors of different scale
(cherry picked from commit 6c3087e6bda32ae9b095e069d8bea614502f5c03)
(cherry picked from commit adb3a4be16)

with fix for JBR-5300 Change source code and test files to use GPL license
2024-09-19 02:01:37 +02:00
Anton Tarasov
bd24e69db9 JRE-119 [suppress updateGC() for WFileDialogPeer/WPrintDialogPeer]
updateGC() is called from WWindowPeer.<init> though it's not applicable to the named dialogs
as they don't have native AwtWindow peer required for the method.

(cherry picked from commit 72ed9f653177e273b811cfe70c2dba102a8636e4)
(cherry picked from commit cec49aaa38)
2024-09-19 02:01:37 +02:00
Anton Tarasov
4fe4ed4cd7 JRE-119 [use default "sun.java2d.dpiaware=true" to be dpi-aware on Window 7]
This lets awt_Win32GraphicsEnv.cpp SetProcessDPIAwareProperty() call Win7 specific ::SetProcessDPIAware() API func.

(cherry picked from commit 5e7a766090810d839f4352d06fc2812499d766f8)
(cherry picked from commit 7d1d43bfa1)
2024-09-19 02:01:36 +02:00
Anton Tarasov
b25807a6f7 JRE-119 [Dynamically set DPI-awareness level to enable backward compatible HiDPI behavior]
Adopted: rely on java.manifest

(cherry picked from commit d00cfa4dc62a14a4cf89df9d4c4899970c9fc9e8)

Adopted

(cherry picked from commit 60be76b725)
2024-09-19 02:01:36 +02:00
Anton Tarasov
0983318b2f JRE-119 [ask if ui scale is enabled natively]
(cherry picked from commit 801f45875fd8699edcbda5896210cec191062261)
(cherry picked from commit 20edebdefa)
2024-09-19 02:01:36 +02:00
Anton Tarasov
402f2da300 IDEA-153474 let JDK detect Xft.dpi value on non-GTK Linux DEs
Use the GTK method:

https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#g-object-get

to retrieve "gtk-xft-dpi" integer property of the X settings.

Add the property to JDK's GtkEngine & gtk2-interface.
Then read the property via GtkEngine from GTK LaF when "gnome.Xft/dpi" is undefined. It's assumed GTK LaF is forcedly installed.

(cherry picked from commit e05fc391ae0a3cc389e836441f882c0cf6ab3b99)
(cherry picked from commit fd615a5b45)
2024-09-19 02:01:36 +02:00
Anton Tarasov
0dfdf9b7f5 IDEA-148854: AppCode crashes randomly every 15 mins or so
(cherry picked from commit 02f9a5fbb4924ff67c8a04c15e490acfcc750003)
(cherry picked from commit b8f4b4a9ed)
2024-09-19 02:01:36 +02:00
Vitaly Provodin
7e4768ef44 updated JTreg exclude list 2024-09-19 02:01:36 +02:00
Alexey Ushakov
214adb0b1e IDEA-57233, IDEA-152816, IDEA-152454 Editor font antialising/appearance problems on Linux
Used desktop DPI instead of hard-coded 72
Compensated increased glyph bitmap size by adjusting font size
Added LCD filter for sub-pixel rendering
Use fontconfig library to provide right rendering options for fonts
Corrected sizes passed to fontconfig library and hinting disabling policy
Added logging and versioned fontconfig lib loading
Resolved font rendering problem in lenses
fix text rendering issues (text cutoff and incorrect rendering in editor fragment components)
FcMatchFont-type pattern substitutions shouldn't be invoked before specific font is selected - it can apply unrelated rules
port commit e21cd635 from JBR 9
partially rollback JBR-363 fix, to apply corresponding change from OpenJDK 12

(cherry picked from commit 5d704a963b)
(cherry picked from commit 3d7ac30072)
(cherry picked from commit 0456745afb)
(cherry picked from commit 3d7ac30072)
(cherry picked from commit 4c8351fecf)
(cherry picked from commit 5faebc73d5)
(cherry picked from commit d1ed8ab118)
2024-09-19 02:01:36 +02:00
Vitaly Provodin
e69bbe425d JBR-3398 remove the Experimental AOT and JIT Compiler (JEP 410) 2024-09-19 02:01:36 +02:00
Alexey Ushakov
151033ae12 JBR-2807: JDK15: update modules.list to resolve jbr build failure
removed nashorn modules
2024-09-19 02:01:36 +02:00
Vitaly Provodin
a074805ee5 JBR-2130 remove module jdk.pack 2024-09-19 02:01:36 +02:00
Vitaly Provodin
92ae5543be JBR-4810 add VERSION_PATCH into version number string 2024-09-19 02:01:36 +02:00
Vitaly Provodin
3c0d6d35c5 JBR-4754 make root directory with the same name as archive name 2024-09-19 02:01:36 +02:00
Nikita Provotorov
668f68107f JBR-2074 Windows 10 AArch64 support: make the build scripts use custom build-jdk. 2024-09-19 02:01:36 +02:00
Nikita Provotorov
3ec9ed19c6 JBR-2074 Windows 10 AArch64 support: build fixes. 2024-09-19 02:01:36 +02:00
Vitaly Provodin
ea57a1f3dc JBR-4567 replace comma with point in RenderPerf scores 2024-09-19 02:01:36 +02:00
Vitaly Provodin
2f9473c4b6 JBR-4520 set file permissions after signing 2024-09-19 02:01:35 +02:00
Vitaly Provodin
3198d756d6 JBR-4512 windows: include pdb-files into jbrsdk 2024-09-19 02:01:35 +02:00
Vitaly Provodin
8f046f3008 JBR-4087 add version info into the name of root directory in JBR tar.gz-distributions 2024-09-19 02:01:35 +02:00
Vitaly Provodin
82678ab083 JBR-4511 remove --disable options from configure mac-aarch64 builds & unify configure for x64 and aarch64 2024-09-19 02:01:35 +02:00
Maxim Kartashev
1e12eed380 JBR-4064 Windows: update build scripts to produce more deterministic output
Passed the configure script options necessary to enable reproducible builds
on Windows. With this options, the resulting jars are reproducible, but
native executables and libraries aren't.
2024-09-19 02:01:35 +02:00
Vladislav Rassokhin
98b3c95526 JBR-4451 Make bash scripts safer 2024-09-19 02:01:35 +02:00
Vitaly Provodin
a6b2d74491 JBR-4487 enable Linux 32 builds 2024-09-19 02:01:35 +02:00
Vitaly Provodin
1dbb789555 JBR-4458 enable JBR17 windows 32 bit builds 2024-09-19 02:01:35 +02:00
Vitaly Provodin
1893d40813 JBR-4272 generate and save debug symbols for JBR on macos/linux 2024-09-19 02:01:35 +02:00
Vitaly Provodin
d82f016f1c JBR-4053 integrate DCEVM patches as usual commits 2024-09-19 02:01:35 +02:00
Vitaly Provodin
1327cd42a3 JBR-4370 create a test checking all JBR artifacts exist - add exit code 2024-09-19 02:01:35 +02:00
Nikita Provotorov
2bb784cc8d JBR-2074 Windows 10 AArch64 support: add build and pack scripts. 2024-09-19 02:01:35 +02:00
Vladimir Kempik
08ce5ebb4f JBR-4452: Update crash report message with JBR youtrack link
instead of bugreport.java.com
2024-09-19 02:01:35 +02:00
Vitaly Provodin
69ee800ab7 JBR-4437 add sources to JBRSDK distributions for Windows and Linux 2024-09-19 02:01:35 +02:00
Vitaly Provodin
56b4ff2fb6 JBR-4437 add sources to JBRSDK distributions 2024-09-19 02:01:35 +02:00
Anton Tarasov
87e1f9c6e8 JBR-3906 JBR for Linux aarch64 with JCEF is missing, is there any support plan? 2024-09-19 02:01:34 +02:00
Vitaly Provodin
e3bc135274 JBR-4188 add script comparing performance results
add exec permissions && fix misprint in checking if headers exist

move the script comparing performance results from jdk8u_test
2024-09-19 02:01:34 +02:00
Vladimir Kempik
a839ef2263 JBR-4283: Provide native JBR builds for alpine Linux-aarch64 2024-09-19 02:01:34 +02:00
Vladimir Kempik
4b7706d8de JBR-4242:Provide native JBR builds for alpine Linux 2024-09-19 02:01:34 +02:00
Maxim Kartashev
fe30e176ec JBR-3917 Problem using windows certificate store (trustStoreType=Windows-ROOT not recognized) 2024-09-19 02:01:34 +02:00
Maxim Kartashev
48a3baa495 JBR-4145 Make builds independent from build directory
Supplied the --disable-absolute-path-in-output option to the configure script
when building JBR.
2024-09-19 02:01:34 +02:00
Vitaly Provodin
4a23139d0a JBR-4154 extract version info from sources & JBR-4099 make test-image on jbrsdk_jcef step 2024-09-19 02:01:34 +02:00
Vitaly Provodin
b6b2afa3c3 JBR-4067 fix misprint with applying obsolete exclude_jcef_module.patch 2024-09-19 02:01:34 +02:00
Vitaly Provodin
c47e299586 JBR-3756 remove JNF from mac-aarch64 binaries 2024-09-19 02:01:34 +02:00
Vitaly Provodin
26abab3c24 JBR-4082 create JBR & JBRSDK installer packages 2024-09-19 02:01:34 +02:00
Maxim Kartashev
f513e80b4b JBR-4061 Specify build user for the build 2024-09-19 02:01:34 +02:00
Maxim Kartashev
691ac4b503 JBR-4063 macOS: update build scripts to produce more deterministic output
Make mkimages.sh produce more deterministic .tar.gz archives on MacOS.
NB: build notarization is not in the scope of this change.

(cherry picked from commit e1a1b6814d)
2024-09-19 02:01:34 +02:00
Maxim Kartashev
ac871a1012 JBR-4033 Linux: update build scripts to produce more deterministic output
This commits achieves almost the same build output with the same build
input on Linux. Exceptions are:
- class files timestamps differ in jrt-fs.jar (for all output),
- class files timestamps differ in all the jmod files (for
  jbrsdk...tar.gz).
NB: jbrsdk...test...tar.gz does not need to be deterministic.

This was achieved mainly by
- setting several environment variables (SOURCE_DATE_EPOCH, TZ),
- providing the necessary options to the configure script,
- setting the timestamp of all files that make up the resulting
  archive to SORUCE_DATE_EPOCH and normalizing the list of said
  files before archiving.

(cherry picked from commit ffded82734)
2024-09-19 02:01:34 +02:00
Maxim Kartashev
265714c4d2 JBR-4059 Create Dockerfile for building on AArch64 Linux 2024-09-19 02:01:34 +02:00
Vitaly Provodin
a80c32f400 JBR-3905 add incremental JBR building 2024-09-19 02:01:34 +02:00
Vitaly Provodin
91fc012b8b JBR-3904 fix the image directory name of macos builds 2024-09-19 02:01:34 +02:00
Vitaly Provodin
a99bc6c6d8 configure BOOT_JDK to use JDK 17 2024-09-19 02:01:33 +02:00
Anton Tarasov
a095f86d68 JBR-3655 jbr-dev build fails to find jcef modules on Windows 2024-09-19 02:01:33 +02:00
Maxim Kartashev
b37a12c695 JBR-3645 Tool to support keeping JBR in sync with OpenJDK 2024-09-19 02:01:33 +02:00
Vitaly Provodin
3a1d05fb17 JBR-3639 add jbrsdk tarballs for dcevm, jcef builds 2024-09-19 02:01:33 +02:00
Anton Tarasov
6168eb361d JBR-3627 include jmods in jbrsdk bundle for jbr-dev 2024-09-19 02:01:33 +02:00
Vitaly.Provodin
0eb13fb50a add dockerfile for x86
(cherry picked from commit 8fb2341ea8)
2024-09-19 02:01:33 +02:00
Vitaly Provodin
e2ef5bd9cc JBR-1505 add jdk.jcmd module into JBR
(cherry picked from commit c40b9c8b9e)
2024-09-19 02:01:33 +02:00
Vitaly Provodin
7f11989c71 JBR-2957 notarize JBR and JBRSDK as APPL
(cherry picked from commit 0e7f9ce4ca)
2024-09-19 02:01:33 +02:00
Vitaly Provodin
2d049a5527 JBR-667 add shenandoahgc feature
(cherry picked from commit e15dad04)
2024-09-19 02:01:33 +02:00
Vitaly Provodin
91ac2e54fc configure BOOT_JDK to use JDK 16 2024-09-19 02:01:33 +02:00
Anton Tarasov
f106d3955b Add build.gradle 2024-09-19 02:01:33 +02:00
Vitaly Provodin
89ceb839ce JBR-3401 enable macos-aarhc64 builds 2024-09-19 02:01:33 +02:00
Vitaly Provodin
e53c0ca235 JBR-3305 remove the option --disable-warnings-as-errors from configure 2024-09-19 02:01:33 +02:00
Vitaly Provodin
4d984d7c24 JBR-2922 add JCEF to jbrsdk binaries
& fix a misprint in get_mods_list

JBR-2922 add JCEF to jbrsdk binaries

& fix a misprint in get_mods_list
2024-09-19 02:01:33 +02:00
Vitaly Provodin
7a1ea86e6d JBR-2912 add JBR 15 builds with DCEVM 2024-09-19 02:01:33 +02:00
Vitaly Provodin
04dd13b11c JBR-2864 initial commit of DCEVM patches reworked for 15 2024-09-19 02:01:32 +02:00
Vitaly Provodin
43076bb2b5 JBR-2812 remove --with-import-modules from configure for aarch64 2024-09-19 02:01:32 +02:00
Anton Tarasov
75a3e354f3 JBR-2812 bundle jcef in jmod format instead of modular-sdk
Build test-image with non-jcef build target
2024-09-19 02:01:32 +02:00
Vitaly Provodin
b259840fcd JBR-2787 fix copying jcef files into jbr/jbrsdk binaries 2024-09-19 02:01:32 +02:00
Vitaly Provodin
8b6dc55af8 JBR-2758 refactor building scripts to apply patches adding required modules instead of excluding
Add jogl and gluegen modules to support jcef osr mode
2024-09-19 02:01:32 +02:00
Anton Tarasov
74617522e1 JBR-2016 add jcef module and export packages to it
(cherry picked from commit cf997f71c6)
2024-09-19 02:01:32 +02:00
Vitaly Provodin
ba756aa7e8 JBR-2473 modify building scripts to add dcevm clauses, add git config to docker image
(cherry picked from commit 2620c62848)
2024-09-19 02:01:32 +02:00
Vitaly Provodin
1a645fded7 JBR-2395 eliminate JavaFX from JBR 2024-09-19 02:01:32 +02:00
Vitaly Provodin
a66ba420fa JBR-2409 fix prameters for configure 2024-09-19 02:01:32 +02:00
Vitaly Provodin
28b5e0785e JDK14: exclude dependencies on jcef in x86, fastdebug builds 2024-09-19 02:01:32 +02:00
Vitaly Provodin
5044daa5bf JBR-2396 fix CONF names 2024-09-19 02:01:32 +02:00
Vitaly Provodin
7b404b6bc9 JBR-2394 replace --disable-debug-symbols with --with-native-debug-symbols=none 2024-09-19 02:01:32 +02:00
Vitaly Provodin
66514b0621 add exec permitions to configure 2024-09-19 02:01:32 +02:00
Vitaly Provodin
fdd5b02125 split checkout before building JBR+JFX or JBR+JCEF on two separate commands 2024-09-19 02:01:32 +02:00
Vitaly Provodin
88797bd644 change BOOT_JDK, fix target names 2024-09-19 02:01:32 +02:00
Vitaly Provodin
7068b7d318 JBR-2291 add vendor info into bundles 2024-09-19 02:01:31 +02:00
Vitaly Provodin
64cd61139b JBR-2324 address new layout in mac jcef 80.0.4+g74f7b0c+chromium-80.0.3987.122 2024-09-19 02:01:31 +02:00
Vitaly Provodin
459412e97b JBR-2320 add jdk.attach module into JBR 2024-09-19 02:01:31 +02:00
Vitaly Provodin
a7da9866ec JBR-2217 provide JCEF-only (no JavaFX) bundle for master/202 branches 2024-09-19 02:01:31 +02:00
Vitaly Provodin
c3ee891f5c JBR-2212 add scripts for linux_x86, linux_aarch64, linux_x64_fastdebug, osx_fastdebug, windows_x86 2024-09-19 02:01:31 +02:00
Vitaly Provodin
c8e8f2aaf6 JBR-1643 fix intermittent fialures of Windows builds at make/Init.gmk:304
combine images and test-image into one make invocation
2024-09-19 02:01:31 +02:00
Vitaly Provodin
b197e2481d JBR-2181 create two separate JBR bundles with JFX and JFX+JCEF 2024-09-19 02:01:31 +02:00
Vitaly Provodin
12686a52fa JBR-2148 modify signapp&build scripts to match to the new layout 2024-09-19 02:01:31 +02:00
Vitaly Provodin
e09c97c972 JBR-2084 modify scripts to sign Contents/MacOS/libjli.dylib as a a normal file 2024-09-19 02:01:31 +02:00
Vitaly Provodin
3ca16571e3 JBR-1821 notarize JBR bundles as a standalone app 2024-09-19 02:01:31 +02:00
Vitaly Provodin
0c43ee55cf JBR-2162 move building scripts from TC to JBR repo 2024-09-19 02:01:31 +02:00
Anton Tarasov
ea9fc3e826 JBR-2016 add jcef module and export some sun.* packages to it 2024-09-19 02:01:31 +02:00
Vitaly Provodin
11792c9cfb JBR-2014 add jdk.hotspot.agent module to jbr 2024-09-19 02:01:31 +02:00
Vitaly Provodin
498848d0f6 JBR-1286 add jdk.compiler into JBR 2024-09-19 02:01:31 +02:00
Vitaly Provodin
34a346eeb7 JBR-1199 add JBR modules list for jlink 2024-09-19 02:01:31 +02:00
Vitaly Provodin
2205fafb79 Update docker script to create jdk15 build env 2024-09-19 02:01:31 +02:00
Vitaly Provodin
f4ec5cd0f3 JBR-3045 add pressing ESC to close the dialog after test completion
(cherry picked from commit 44d8b28b0b)
2024-09-19 02:01:30 +02:00
Vitaly Provodin
49e4723354 JBR-3040 press the button END at the beggining in order to avoid text selection
(cherry picked from commit 1c2bf33db2)
2024-09-19 02:01:30 +02:00
Vitaly.Provodin
85c4791276 updated JTreg exclude list 2024-09-19 02:01:30 +02:00
Phil Race
88a1c0550e 8340078: Open source several 2D tests
Reviewed-by: honkar
2024-09-18 20:39:40 +00:00
Harshitha Onkar
31849127a0 8339962: Open source AWT TextField tests - Set1
Reviewed-by: jdv, dnguyen, prr
2024-09-18 19:25:11 +00:00
Kevin Walls
9cfc03aa81 8340391: Windows jcmd System.map and System.dump_map tests failing
Reviewed-by: cjplummer
2024-09-18 19:17:26 +00:00
Leonid Mesnik
6ff287ad9a 8340233: Missed ThreadWXEnable in jfrNativeLibraryLoadEvent.cpp
Reviewed-by: mgronlun
2024-09-18 15:57:41 +00:00
Hamlin Li
ae39a6603c 8339992: RISC-V: some minor improvements of base64_vector_decode_round
Reviewed-by: fyang, luhenry
2024-09-18 14:38:06 +00:00
Stefan Karlsson
471a51a5a4 8340368: windows-x64-slowdebug build fails after JDK-8319873
Reviewed-by: jpai, kevinw, aboldtch, eosterlund
2024-09-18 13:46:19 +00:00
Hamlin Li
08a2f841ec 8339738: RISC-V: Vectorize crc32 intrinsic
Reviewed-by: fyang, luhenry
2024-09-18 12:37:02 +00:00
Rafael Winterhalter
1d070a3238 8337302: Undefined type variable results in null
Reviewed-by: liach
2024-09-18 12:33:56 +00:00
Emanuel Peter
aeba1ea7c4 8340272: C2 SuperWord: JMH benchmark for Reduction vectorization
Reviewed-by: kvn, jkarthikeyan
2024-09-18 12:03:00 +00:00
Kevin Walls
19b2cee420 8340113: Remove JULONG as a Diagnostic Command argument type (jcmd JFR.view)
Reviewed-by: lmesnik, egahlin
2024-09-18 11:44:14 +00:00
Nizar Benalla
45e438f3f4 8339845: Update color.org and wapforum.org links to use HTTPS instead of HTTP
Reviewed-by: prr, honkar, aivanov
2024-09-18 11:08:13 +00:00
Simon Tooke
4ff17c14a5 8319873: Add windows implementation for jcmd System.map and System.dump_map
Co-authored-by: Simon Tooke <stooke@openjdk.org>
Reviewed-by: stuefe, kevinw, szaldana
2024-09-18 09:11:40 +00:00
Martin Doerr
3895b8fc0b 8340230: Tests crash: assert(is_in_encoding_range || k->is_interface() || k->is_abstract()) failed: sanity
Reviewed-by: thartmann, kvn
2024-09-18 08:26:33 +00:00
Roland Westrelin
5381f553ad 8333258: C2: high memory usage in PhaseCFG::insert_anti_dependences()
Reviewed-by: kvn, epeter
2024-09-18 07:07:45 +00:00
Claes Redestad
d23c59e408 8340280: Avoid calling MT.invokerType() when creating LambdaForms
Reviewed-by: liach, jvernee
2024-09-18 07:01:13 +00:00
Prasanta Sadhukhan
147e30070d 8340015: Open source several AWT focus tests - series 7
Reviewed-by: honkar
2024-09-18 04:33:28 +00:00
84 changed files with 17654 additions and 1343 deletions

View File

@@ -1454,6 +1454,103 @@ void MacroAssembler::update_word_crc32(Register crc, Register v, Register tmp1,
xorr(crc, crc, tmp2);
}
// This improvement (vectorization) is based on java.base/share/native/libzip/zlib/zcrc32.c.
// To make it, following steps are taken:
// 1. in zcrc32.c, modify N to 16 and related code,
// 2. re-generate the tables needed, we use tables of (N == 16, W == 4)
// 3. finally vectorize the code (original implementation in zcrc32.c is just scalar code).
// New tables for vector version is after table3.
void MacroAssembler::vector_update_crc32(Register crc, Register buf, Register len,
Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5,
Register table0, Register table3) {
assert_different_registers(t1, crc, buf, len, tmp1, tmp2, tmp3, tmp4, tmp5, table0, table3);
const int N = 16, W = 4;
const int64_t single_table_size = 256;
const Register blks = tmp2;
const Register tmpTable = tmp3, tableN16 = tmp4;
const VectorRegister vcrc = v4, vword = v8, vtmp = v12;
Label VectorLoop;
Label LastBlock;
add(tableN16, table3, 1*single_table_size*sizeof(juint), tmp1);
mv(tmp5, 0xff);
if (MaxVectorSize == 16) {
vsetivli(zr, N, Assembler::e32, Assembler::m4, Assembler::ma, Assembler::ta);
} else if (MaxVectorSize == 32) {
vsetivli(zr, N, Assembler::e32, Assembler::m2, Assembler::ma, Assembler::ta);
} else {
assert(MaxVectorSize > 32, "sanity");
vsetivli(zr, N, Assembler::e32, Assembler::m1, Assembler::ma, Assembler::ta);
}
vmv_v_x(vcrc, zr);
vmv_s_x(vcrc, crc);
// multiple of 64
srli(blks, len, 6);
slli(t1, blks, 6);
sub(len, len, t1);
sub(blks, blks, 1);
blez(blks, LastBlock);
bind(VectorLoop);
{
mv(tmpTable, tableN16);
vle32_v(vword, buf);
vxor_vv(vword, vword, vcrc);
addi(buf, buf, N*4);
vand_vx(vtmp, vword, tmp5);
vsll_vi(vtmp, vtmp, 2);
vluxei32_v(vcrc, tmpTable, vtmp);
mv(tmp1, 1);
for (int k = 1; k < W; k++) {
addi(tmpTable, tmpTable, single_table_size*4);
slli(t1, tmp1, 3);
vsrl_vx(vtmp, vword, t1);
vand_vx(vtmp, vtmp, tmp5);
vsll_vi(vtmp, vtmp, 2);
vluxei32_v(vtmp, tmpTable, vtmp);
vxor_vv(vcrc, vcrc, vtmp);
addi(tmp1, tmp1, 1);
}
sub(blks, blks, 1);
bgtz(blks, VectorLoop);
}
bind(LastBlock);
{
vle32_v(vtmp, buf);
vxor_vv(vcrc, vcrc, vtmp);
mv(crc, zr);
for (int i = 0; i < N; i++) {
vmv_x_s(tmp2, vcrc);
// in vmv_x_s, the value is sign-extended to SEW bits, but we need zero-extended here.
zext_w(tmp2, tmp2);
vslidedown_vi(vcrc, vcrc, 1);
xorr(crc, crc, tmp2);
for (int j = 0; j < W; j++) {
andr(t1, crc, tmp5);
shadd(t1, t1, table0, tmp1, 2);
lwu(t1, Address(t1, 0));
srli(tmp2, crc, 8);
xorr(crc, tmp2, t1);
}
}
addi(buf, buf, N*4);
}
}
/**
* @param crc register containing existing CRC (32-bit)
* @param buf register pointing to input byte buffer (byte*)
@@ -1465,21 +1562,28 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len,
Register table0, Register table1, Register table2, Register table3,
Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5, Register tmp6) {
assert_different_registers(crc, buf, len, table0, table1, table2, table3, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6);
Label L_by16_loop, L_unroll_loop, L_unroll_loop_entry, L_by4, L_by4_loop, L_by1, L_by1_loop, L_exit;
Label L_by16_loop, L_vector_entry, L_unroll_loop, L_unroll_loop_entry, L_by4, L_by4_loop, L_by1, L_by1_loop, L_exit;
const int64_t single_table_size = 256;
const int64_t unroll = 16;
const int64_t unroll_words = unroll*wordSize;
mv(tmp5, right_32_bits);
subw(len, len, unroll_words);
andn(crc, tmp5, crc);
const ExternalAddress table_addr = StubRoutines::crc_table_addr();
la(table0, table_addr);
add(table1, table0, 1*256*sizeof(juint), tmp1);
add(table2, table0, 2*256*sizeof(juint), tmp1);
add(table3, table2, 1*256*sizeof(juint), tmp1);
add(table1, table0, 1*single_table_size*sizeof(juint), tmp1);
add(table2, table0, 2*single_table_size*sizeof(juint), tmp1);
add(table3, table2, 1*single_table_size*sizeof(juint), tmp1);
if (UseRVV) {
const int64_t tmp_limit = MaxVectorSize >= 32 ? unroll_words*3 : unroll_words*5;
mv(tmp1, tmp_limit);
bge(len, tmp1, L_vector_entry);
}
subw(len, len, unroll_words);
bge(len, zr, L_unroll_loop_entry);
addiw(len, len, unroll_words-4);
bge(len, zr, L_by4_loop);
addiw(len, len, 4);
@@ -1539,6 +1643,19 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len,
andi(tmp2, tmp2, right_8_bits);
update_byte_crc32(crc, tmp2, table0);
// put vector code here, otherwise "offset is too large" error occurs.
if (UseRVV) {
j(L_exit); // only need to jump exit when UseRVV == true, it's a jump from end of block `L_by1_loop`.
bind(L_vector_entry);
vector_update_crc32(crc, buf, len, tmp1, tmp2, tmp3, tmp4, tmp6, table0, table3);
addiw(len, len, -4);
bge(len, zr, L_by4_loop);
addiw(len, len, 4);
bgt(len, zr, L_by1_loop);
}
bind(L_exit);
andn(crc, tmp5, crc);
}

View File

@@ -1319,6 +1319,9 @@ public:
Register table0, Register table1, Register table2, Register table3,
bool upper);
void update_byte_crc32(Register crc, Register val, Register table);
void vector_update_crc32(Register crc, Register buf, Register len,
Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5,
Register table0, Register table3);
#ifdef COMPILER2
void mul_add(Register out, Register in, Register offset,

View File

@@ -5331,7 +5331,7 @@ class StubGenerator: public StubCodeGenerator {
* NOTE: each field will occupy a single vector register group
*/
void base64_vector_decode_round(Register src, Register dst, Register codec,
Register size, Register stepSrc, Register stepDst, Register failedIdx, Register minusOne,
Register size, Register stepSrc, Register stepDst, Register failedIdx,
VectorRegister inputV1, VectorRegister inputV2, VectorRegister inputV3, VectorRegister inputV4,
VectorRegister idxV1, VectorRegister idxV2, VectorRegister idxV3, VectorRegister idxV4,
VectorRegister outputV1, VectorRegister outputV2, VectorRegister outputV3,
@@ -5358,8 +5358,11 @@ class StubGenerator: public StubCodeGenerator {
__ vor_vv(outputV1, outputV1, outputV2);
__ vmseq_vi(v0, outputV1, -1);
__ vfirst_m(failedIdx, v0);
Label NoFailure;
__ beq(failedIdx, minusOne, NoFailure);
Label NoFailure, FailureAtIdx0;
// valid value can only be -1 when < 0
__ bltz(failedIdx, NoFailure);
// when the first data (at index 0) fails, no need to process data anymore
__ beqz(failedIdx, FailureAtIdx0);
__ vsetvli(x0, failedIdx, Assembler::e8, lmul, Assembler::mu, Assembler::tu);
__ slli(stepDst, failedIdx, 1);
__ add(stepDst, failedIdx, stepDst);
@@ -5382,6 +5385,7 @@ class StubGenerator: public StubCodeGenerator {
// dst = dst + register_group_len_bytes * 3
__ add(dst, dst, stepDst);
__ BIND(FailureAtIdx0);
}
/**
@@ -5501,7 +5505,7 @@ class StubGenerator: public StubCodeGenerator {
// Assembler::m2
__ BIND(ProcessM2);
base64_vector_decode_round(src, dst, codec,
size, stepSrcM2, stepDst, failedIdx, minusOne,
size, stepSrcM2, stepDst, failedIdx,
v2, v4, v6, v8, // inputs
v10, v12, v14, v16, // indexes
v18, v20, v22, // outputs
@@ -5521,7 +5525,7 @@ class StubGenerator: public StubCodeGenerator {
__ srli(size, size, 1);
__ srli(stepDst, stepDst, 1);
base64_vector_decode_round(src, dst, codec,
size, stepSrcM1, stepDst, failedIdx, minusOne,
size, stepSrcM1, stepDst, failedIdx,
v1, v2, v3, v4, // inputs
v5, v6, v7, v8, // indexes
v9, v10, v11, // outputs

View File

@@ -276,4 +276,219 @@ ATTRIBUTE_ALIGNED(4096) juint StubRoutines::riscv::_crc_table[] =
0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
0xde0506f1UL,
// Tables for vector version
// This improvement (vectorization) is based on java.base/share/native/libzip/zlib/zcrc32.c.
// To make it, following steps are taken:
// 1. in zcrc32.c, modify N to 16 and related code,
// 2. re-generate the tables needed, we use tables of (N == 16, W == 4)
// 3. finally vectorize the code (original implementation in zcrc32.c is just scalar code).
0x00000000, 0x8f352d95, 0xc51b5d6b, 0x4a2e70fe, 0x5147bc97,
0xde729102, 0x945ce1fc, 0x1b69cc69, 0xa28f792e, 0x2dba54bb,
0x67942445, 0xe8a109d0, 0xf3c8c5b9, 0x7cfde82c, 0x36d398d2,
0xb9e6b547, 0x9e6ff41d, 0x115ad988, 0x5b74a976, 0xd44184e3,
0xcf28488a, 0x401d651f, 0x0a3315e1, 0x85063874, 0x3ce08d33,
0xb3d5a0a6, 0xf9fbd058, 0x76cefdcd, 0x6da731a4, 0xe2921c31,
0xa8bc6ccf, 0x2789415a, 0xe7aeee7b, 0x689bc3ee, 0x22b5b310,
0xad809e85, 0xb6e952ec, 0x39dc7f79, 0x73f20f87, 0xfcc72212,
0x45219755, 0xca14bac0, 0x803aca3e, 0x0f0fe7ab, 0x14662bc2,
0x9b530657, 0xd17d76a9, 0x5e485b3c, 0x79c11a66, 0xf6f437f3,
0xbcda470d, 0x33ef6a98, 0x2886a6f1, 0xa7b38b64, 0xed9dfb9a,
0x62a8d60f, 0xdb4e6348, 0x547b4edd, 0x1e553e23, 0x916013b6,
0x8a09dfdf, 0x053cf24a, 0x4f1282b4, 0xc027af21, 0x142cdab7,
0x9b19f722, 0xd13787dc, 0x5e02aa49, 0x456b6620, 0xca5e4bb5,
0x80703b4b, 0x0f4516de, 0xb6a3a399, 0x39968e0c, 0x73b8fef2,
0xfc8dd367, 0xe7e41f0e, 0x68d1329b, 0x22ff4265, 0xadca6ff0,
0x8a432eaa, 0x0576033f, 0x4f5873c1, 0xc06d5e54, 0xdb04923d,
0x5431bfa8, 0x1e1fcf56, 0x912ae2c3, 0x28cc5784, 0xa7f97a11,
0xedd70aef, 0x62e2277a, 0x798beb13, 0xf6bec686, 0xbc90b678,
0x33a59bed, 0xf38234cc, 0x7cb71959, 0x369969a7, 0xb9ac4432,
0xa2c5885b, 0x2df0a5ce, 0x67ded530, 0xe8ebf8a5, 0x510d4de2,
0xde386077, 0x94161089, 0x1b233d1c, 0x004af175, 0x8f7fdce0,
0xc551ac1e, 0x4a64818b, 0x6dedc0d1, 0xe2d8ed44, 0xa8f69dba,
0x27c3b02f, 0x3caa7c46, 0xb39f51d3, 0xf9b1212d, 0x76840cb8,
0xcf62b9ff, 0x4057946a, 0x0a79e494, 0x854cc901, 0x9e250568,
0x111028fd, 0x5b3e5803, 0xd40b7596, 0x2859b56e, 0xa76c98fb,
0xed42e805, 0x6277c590, 0x791e09f9, 0xf62b246c, 0xbc055492,
0x33307907, 0x8ad6cc40, 0x05e3e1d5, 0x4fcd912b, 0xc0f8bcbe,
0xdb9170d7, 0x54a45d42, 0x1e8a2dbc, 0x91bf0029, 0xb6364173,
0x39036ce6, 0x732d1c18, 0xfc18318d, 0xe771fde4, 0x6844d071,
0x226aa08f, 0xad5f8d1a, 0x14b9385d, 0x9b8c15c8, 0xd1a26536,
0x5e9748a3, 0x45fe84ca, 0xcacba95f, 0x80e5d9a1, 0x0fd0f434,
0xcff75b15, 0x40c27680, 0x0aec067e, 0x85d92beb, 0x9eb0e782,
0x1185ca17, 0x5babbae9, 0xd49e977c, 0x6d78223b, 0xe24d0fae,
0xa8637f50, 0x275652c5, 0x3c3f9eac, 0xb30ab339, 0xf924c3c7,
0x7611ee52, 0x5198af08, 0xdead829d, 0x9483f263, 0x1bb6dff6,
0x00df139f, 0x8fea3e0a, 0xc5c44ef4, 0x4af16361, 0xf317d626,
0x7c22fbb3, 0x360c8b4d, 0xb939a6d8, 0xa2506ab1, 0x2d654724,
0x674b37da, 0xe87e1a4f, 0x3c756fd9, 0xb340424c, 0xf96e32b2,
0x765b1f27, 0x6d32d34e, 0xe207fedb, 0xa8298e25, 0x271ca3b0,
0x9efa16f7, 0x11cf3b62, 0x5be14b9c, 0xd4d46609, 0xcfbdaa60,
0x408887f5, 0x0aa6f70b, 0x8593da9e, 0xa21a9bc4, 0x2d2fb651,
0x6701c6af, 0xe834eb3a, 0xf35d2753, 0x7c680ac6, 0x36467a38,
0xb97357ad, 0x0095e2ea, 0x8fa0cf7f, 0xc58ebf81, 0x4abb9214,
0x51d25e7d, 0xdee773e8, 0x94c90316, 0x1bfc2e83, 0xdbdb81a2,
0x54eeac37, 0x1ec0dcc9, 0x91f5f15c, 0x8a9c3d35, 0x05a910a0,
0x4f87605e, 0xc0b24dcb, 0x7954f88c, 0xf661d519, 0xbc4fa5e7,
0x337a8872, 0x2813441b, 0xa726698e, 0xed081970, 0x623d34e5,
0x45b475bf, 0xca81582a, 0x80af28d4, 0x0f9a0541, 0x14f3c928,
0x9bc6e4bd, 0xd1e89443, 0x5eddb9d6, 0xe73b0c91, 0x680e2104,
0x222051fa, 0xad157c6f, 0xb67cb006, 0x39499d93, 0x7367ed6d,
0xfc52c0f8,
0x00000000, 0x50b36adc, 0xa166d5b8, 0xf1d5bf64, 0x99bcad31,
0xc90fc7ed, 0x38da7889, 0x68691255, 0xe8085c23, 0xb8bb36ff,
0x496e899b, 0x19dde347, 0x71b4f112, 0x21079bce, 0xd0d224aa,
0x80614e76, 0x0b61be07, 0x5bd2d4db, 0xaa076bbf, 0xfab40163,
0x92dd1336, 0xc26e79ea, 0x33bbc68e, 0x6308ac52, 0xe369e224,
0xb3da88f8, 0x420f379c, 0x12bc5d40, 0x7ad54f15, 0x2a6625c9,
0xdbb39aad, 0x8b00f071, 0x16c37c0e, 0x467016d2, 0xb7a5a9b6,
0xe716c36a, 0x8f7fd13f, 0xdfccbbe3, 0x2e190487, 0x7eaa6e5b,
0xfecb202d, 0xae784af1, 0x5fadf595, 0x0f1e9f49, 0x67778d1c,
0x37c4e7c0, 0xc61158a4, 0x96a23278, 0x1da2c209, 0x4d11a8d5,
0xbcc417b1, 0xec777d6d, 0x841e6f38, 0xd4ad05e4, 0x2578ba80,
0x75cbd05c, 0xf5aa9e2a, 0xa519f4f6, 0x54cc4b92, 0x047f214e,
0x6c16331b, 0x3ca559c7, 0xcd70e6a3, 0x9dc38c7f, 0x2d86f81c,
0x7d3592c0, 0x8ce02da4, 0xdc534778, 0xb43a552d, 0xe4893ff1,
0x155c8095, 0x45efea49, 0xc58ea43f, 0x953dcee3, 0x64e87187,
0x345b1b5b, 0x5c32090e, 0x0c8163d2, 0xfd54dcb6, 0xade7b66a,
0x26e7461b, 0x76542cc7, 0x878193a3, 0xd732f97f, 0xbf5beb2a,
0xefe881f6, 0x1e3d3e92, 0x4e8e544e, 0xceef1a38, 0x9e5c70e4,
0x6f89cf80, 0x3f3aa55c, 0x5753b709, 0x07e0ddd5, 0xf63562b1,
0xa686086d, 0x3b458412, 0x6bf6eece, 0x9a2351aa, 0xca903b76,
0xa2f92923, 0xf24a43ff, 0x039ffc9b, 0x532c9647, 0xd34dd831,
0x83feb2ed, 0x722b0d89, 0x22986755, 0x4af17500, 0x1a421fdc,
0xeb97a0b8, 0xbb24ca64, 0x30243a15, 0x609750c9, 0x9142efad,
0xc1f18571, 0xa9989724, 0xf92bfdf8, 0x08fe429c, 0x584d2840,
0xd82c6636, 0x889f0cea, 0x794ab38e, 0x29f9d952, 0x4190cb07,
0x1123a1db, 0xe0f61ebf, 0xb0457463, 0x5b0df038, 0x0bbe9ae4,
0xfa6b2580, 0xaad84f5c, 0xc2b15d09, 0x920237d5, 0x63d788b1,
0x3364e26d, 0xb305ac1b, 0xe3b6c6c7, 0x126379a3, 0x42d0137f,
0x2ab9012a, 0x7a0a6bf6, 0x8bdfd492, 0xdb6cbe4e, 0x506c4e3f,
0x00df24e3, 0xf10a9b87, 0xa1b9f15b, 0xc9d0e30e, 0x996389d2,
0x68b636b6, 0x38055c6a, 0xb864121c, 0xe8d778c0, 0x1902c7a4,
0x49b1ad78, 0x21d8bf2d, 0x716bd5f1, 0x80be6a95, 0xd00d0049,
0x4dce8c36, 0x1d7de6ea, 0xeca8598e, 0xbc1b3352, 0xd4722107,
0x84c14bdb, 0x7514f4bf, 0x25a79e63, 0xa5c6d015, 0xf575bac9,
0x04a005ad, 0x54136f71, 0x3c7a7d24, 0x6cc917f8, 0x9d1ca89c,
0xcdafc240, 0x46af3231, 0x161c58ed, 0xe7c9e789, 0xb77a8d55,
0xdf139f00, 0x8fa0f5dc, 0x7e754ab8, 0x2ec62064, 0xaea76e12,
0xfe1404ce, 0x0fc1bbaa, 0x5f72d176, 0x371bc323, 0x67a8a9ff,
0x967d169b, 0xc6ce7c47, 0x768b0824, 0x263862f8, 0xd7eddd9c,
0x875eb740, 0xef37a515, 0xbf84cfc9, 0x4e5170ad, 0x1ee21a71,
0x9e835407, 0xce303edb, 0x3fe581bf, 0x6f56eb63, 0x073ff936,
0x578c93ea, 0xa6592c8e, 0xf6ea4652, 0x7deab623, 0x2d59dcff,
0xdc8c639b, 0x8c3f0947, 0xe4561b12, 0xb4e571ce, 0x4530ceaa,
0x1583a476, 0x95e2ea00, 0xc55180dc, 0x34843fb8, 0x64375564,
0x0c5e4731, 0x5ced2ded, 0xad389289, 0xfd8bf855, 0x6048742a,
0x30fb1ef6, 0xc12ea192, 0x919dcb4e, 0xf9f4d91b, 0xa947b3c7,
0x58920ca3, 0x0821667f, 0x88402809, 0xd8f342d5, 0x2926fdb1,
0x7995976d, 0x11fc8538, 0x414fefe4, 0xb09a5080, 0xe0293a5c,
0x6b29ca2d, 0x3b9aa0f1, 0xca4f1f95, 0x9afc7549, 0xf295671c,
0xa2260dc0, 0x53f3b2a4, 0x0340d878, 0x8321960e, 0xd392fcd2,
0x224743b6, 0x72f4296a, 0x1a9d3b3f, 0x4a2e51e3, 0xbbfbee87,
0xeb48845b,
0x00000000, 0xb61be070, 0xb746c6a1, 0x015d26d1, 0xb5fc8b03,
0x03e76b73, 0x02ba4da2, 0xb4a1add2, 0xb0881047, 0x0693f037,
0x07ced6e6, 0xb1d53696, 0x05749b44, 0xb36f7b34, 0xb2325de5,
0x0429bd95, 0xba6126cf, 0x0c7ac6bf, 0x0d27e06e, 0xbb3c001e,
0x0f9dadcc, 0xb9864dbc, 0xb8db6b6d, 0x0ec08b1d, 0x0ae93688,
0xbcf2d6f8, 0xbdaff029, 0x0bb41059, 0xbf15bd8b, 0x090e5dfb,
0x08537b2a, 0xbe489b5a, 0xafb34bdf, 0x19a8abaf, 0x18f58d7e,
0xaeee6d0e, 0x1a4fc0dc, 0xac5420ac, 0xad09067d, 0x1b12e60d,
0x1f3b5b98, 0xa920bbe8, 0xa87d9d39, 0x1e667d49, 0xaac7d09b,
0x1cdc30eb, 0x1d81163a, 0xab9af64a, 0x15d26d10, 0xa3c98d60,
0xa294abb1, 0x148f4bc1, 0xa02ee613, 0x16350663, 0x176820b2,
0xa173c0c2, 0xa55a7d57, 0x13419d27, 0x121cbbf6, 0xa4075b86,
0x10a6f654, 0xa6bd1624, 0xa7e030f5, 0x11fbd085, 0x841791ff,
0x320c718f, 0x3351575e, 0x854ab72e, 0x31eb1afc, 0x87f0fa8c,
0x86addc5d, 0x30b63c2d, 0x349f81b8, 0x828461c8, 0x83d94719,
0x35c2a769, 0x81630abb, 0x3778eacb, 0x3625cc1a, 0x803e2c6a,
0x3e76b730, 0x886d5740, 0x89307191, 0x3f2b91e1, 0x8b8a3c33,
0x3d91dc43, 0x3cccfa92, 0x8ad71ae2, 0x8efea777, 0x38e54707,
0x39b861d6, 0x8fa381a6, 0x3b022c74, 0x8d19cc04, 0x8c44ead5,
0x3a5f0aa5, 0x2ba4da20, 0x9dbf3a50, 0x9ce21c81, 0x2af9fcf1,
0x9e585123, 0x2843b153, 0x291e9782, 0x9f0577f2, 0x9b2cca67,
0x2d372a17, 0x2c6a0cc6, 0x9a71ecb6, 0x2ed04164, 0x98cba114,
0x999687c5, 0x2f8d67b5, 0x91c5fcef, 0x27de1c9f, 0x26833a4e,
0x9098da3e, 0x243977ec, 0x9222979c, 0x937fb14d, 0x2564513d,
0x214deca8, 0x97560cd8, 0x960b2a09, 0x2010ca79, 0x94b167ab,
0x22aa87db, 0x23f7a10a, 0x95ec417a, 0xd35e25bf, 0x6545c5cf,
0x6418e31e, 0xd203036e, 0x66a2aebc, 0xd0b94ecc, 0xd1e4681d,
0x67ff886d, 0x63d635f8, 0xd5cdd588, 0xd490f359, 0x628b1329,
0xd62abefb, 0x60315e8b, 0x616c785a, 0xd777982a, 0x693f0370,
0xdf24e300, 0xde79c5d1, 0x686225a1, 0xdcc38873, 0x6ad86803,
0x6b854ed2, 0xdd9eaea2, 0xd9b71337, 0x6facf347, 0x6ef1d596,
0xd8ea35e6, 0x6c4b9834, 0xda507844, 0xdb0d5e95, 0x6d16bee5,
0x7ced6e60, 0xcaf68e10, 0xcbaba8c1, 0x7db048b1, 0xc911e563,
0x7f0a0513, 0x7e5723c2, 0xc84cc3b2, 0xcc657e27, 0x7a7e9e57,
0x7b23b886, 0xcd3858f6, 0x7999f524, 0xcf821554, 0xcedf3385,
0x78c4d3f5, 0xc68c48af, 0x7097a8df, 0x71ca8e0e, 0xc7d16e7e,
0x7370c3ac, 0xc56b23dc, 0xc436050d, 0x722de57d, 0x760458e8,
0xc01fb898, 0xc1429e49, 0x77597e39, 0xc3f8d3eb, 0x75e3339b,
0x74be154a, 0xc2a5f53a, 0x5749b440, 0xe1525430, 0xe00f72e1,
0x56149291, 0xe2b53f43, 0x54aedf33, 0x55f3f9e2, 0xe3e81992,
0xe7c1a407, 0x51da4477, 0x508762a6, 0xe69c82d6, 0x523d2f04,
0xe426cf74, 0xe57be9a5, 0x536009d5, 0xed28928f, 0x5b3372ff,
0x5a6e542e, 0xec75b45e, 0x58d4198c, 0xeecff9fc, 0xef92df2d,
0x59893f5d, 0x5da082c8, 0xebbb62b8, 0xeae64469, 0x5cfda419,
0xe85c09cb, 0x5e47e9bb, 0x5f1acf6a, 0xe9012f1a, 0xf8faff9f,
0x4ee11fef, 0x4fbc393e, 0xf9a7d94e, 0x4d06749c, 0xfb1d94ec,
0xfa40b23d, 0x4c5b524d, 0x4872efd8, 0xfe690fa8, 0xff342979,
0x492fc909, 0xfd8e64db, 0x4b9584ab, 0x4ac8a27a, 0xfcd3420a,
0x429bd950, 0xf4803920, 0xf5dd1ff1, 0x43c6ff81, 0xf7675253,
0x417cb223, 0x402194f2, 0xf63a7482, 0xf213c917, 0x44082967,
0x45550fb6, 0xf34eefc6, 0x47ef4214, 0xf1f4a264, 0xf0a984b5,
0x46b264c5,
0x00000000, 0x7dcd4d3f, 0xfb9a9a7e, 0x8657d741, 0x2c4432bd,
0x51897f82, 0xd7dea8c3, 0xaa13e5fc, 0x5888657a, 0x25452845,
0xa312ff04, 0xdedfb23b, 0x74cc57c7, 0x09011af8, 0x8f56cdb9,
0xf29b8086, 0xb110caf4, 0xccdd87cb, 0x4a8a508a, 0x37471db5,
0x9d54f849, 0xe099b576, 0x66ce6237, 0x1b032f08, 0xe998af8e,
0x9455e2b1, 0x120235f0, 0x6fcf78cf, 0xc5dc9d33, 0xb811d00c,
0x3e46074d, 0x438b4a72, 0xb95093a9, 0xc49dde96, 0x42ca09d7,
0x3f0744e8, 0x9514a114, 0xe8d9ec2b, 0x6e8e3b6a, 0x13437655,
0xe1d8f6d3, 0x9c15bbec, 0x1a426cad, 0x678f2192, 0xcd9cc46e,
0xb0518951, 0x36065e10, 0x4bcb132f, 0x0840595d, 0x758d1462,
0xf3dac323, 0x8e178e1c, 0x24046be0, 0x59c926df, 0xdf9ef19e,
0xa253bca1, 0x50c83c27, 0x2d057118, 0xab52a659, 0xd69feb66,
0x7c8c0e9a, 0x014143a5, 0x871694e4, 0xfadbd9db, 0xa9d02113,
0xd41d6c2c, 0x524abb6d, 0x2f87f652, 0x859413ae, 0xf8595e91,
0x7e0e89d0, 0x03c3c4ef, 0xf1584469, 0x8c950956, 0x0ac2de17,
0x770f9328, 0xdd1c76d4, 0xa0d13beb, 0x2686ecaa, 0x5b4ba195,
0x18c0ebe7, 0x650da6d8, 0xe35a7199, 0x9e973ca6, 0x3484d95a,
0x49499465, 0xcf1e4324, 0xb2d30e1b, 0x40488e9d, 0x3d85c3a2,
0xbbd214e3, 0xc61f59dc, 0x6c0cbc20, 0x11c1f11f, 0x9796265e,
0xea5b6b61, 0x1080b2ba, 0x6d4dff85, 0xeb1a28c4, 0x96d765fb,
0x3cc48007, 0x4109cd38, 0xc75e1a79, 0xba935746, 0x4808d7c0,
0x35c59aff, 0xb3924dbe, 0xce5f0081, 0x644ce57d, 0x1981a842,
0x9fd67f03, 0xe21b323c, 0xa190784e, 0xdc5d3571, 0x5a0ae230,
0x27c7af0f, 0x8dd44af3, 0xf01907cc, 0x764ed08d, 0x0b839db2,
0xf9181d34, 0x84d5500b, 0x0282874a, 0x7f4fca75, 0xd55c2f89,
0xa89162b6, 0x2ec6b5f7, 0x530bf8c8, 0x88d14467, 0xf51c0958,
0x734bde19, 0x0e869326, 0xa49576da, 0xd9583be5, 0x5f0feca4,
0x22c2a19b, 0xd059211d, 0xad946c22, 0x2bc3bb63, 0x560ef65c,
0xfc1d13a0, 0x81d05e9f, 0x078789de, 0x7a4ac4e1, 0x39c18e93,
0x440cc3ac, 0xc25b14ed, 0xbf9659d2, 0x1585bc2e, 0x6848f111,
0xee1f2650, 0x93d26b6f, 0x6149ebe9, 0x1c84a6d6, 0x9ad37197,
0xe71e3ca8, 0x4d0dd954, 0x30c0946b, 0xb697432a, 0xcb5a0e15,
0x3181d7ce, 0x4c4c9af1, 0xca1b4db0, 0xb7d6008f, 0x1dc5e573,
0x6008a84c, 0xe65f7f0d, 0x9b923232, 0x6909b2b4, 0x14c4ff8b,
0x929328ca, 0xef5e65f5, 0x454d8009, 0x3880cd36, 0xbed71a77,
0xc31a5748, 0x80911d3a, 0xfd5c5005, 0x7b0b8744, 0x06c6ca7b,
0xacd52f87, 0xd11862b8, 0x574fb5f9, 0x2a82f8c6, 0xd8197840,
0xa5d4357f, 0x2383e23e, 0x5e4eaf01, 0xf45d4afd, 0x899007c2,
0x0fc7d083, 0x720a9dbc, 0x21016574, 0x5ccc284b, 0xda9bff0a,
0xa756b235, 0x0d4557c9, 0x70881af6, 0xf6dfcdb7, 0x8b128088,
0x7989000e, 0x04444d31, 0x82139a70, 0xffded74f, 0x55cd32b3,
0x28007f8c, 0xae57a8cd, 0xd39ae5f2, 0x9011af80, 0xeddce2bf,
0x6b8b35fe, 0x164678c1, 0xbc559d3d, 0xc198d002, 0x47cf0743,
0x3a024a7c, 0xc899cafa, 0xb55487c5, 0x33035084, 0x4ece1dbb,
0xe4ddf847, 0x9910b578, 0x1f476239, 0x628a2f06, 0x9851f6dd,
0xe59cbbe2, 0x63cb6ca3, 0x1e06219c, 0xb415c460, 0xc9d8895f,
0x4f8f5e1e, 0x32421321, 0xc0d993a7, 0xbd14de98, 0x3b4309d9,
0x468e44e6, 0xec9da11a, 0x9150ec25, 0x17073b64, 0x6aca765b,
0x29413c29, 0x548c7116, 0xd2dba657, 0xaf16eb68, 0x05050e94,
0x78c843ab, 0xfe9f94ea, 0x8352d9d5, 0x71c95953, 0x0c04146c,
0x8a53c32d, 0xf79e8e12, 0x5d8d6bee, 0x204026d1, 0xa617f190,
0xdbdabcaf
};

View File

@@ -0,0 +1,253 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, Red Hat, Inc. and/or its affiliates.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "nmt/memMapPrinter.hpp"
#include "os_windows.hpp"
#include "runtime/vm_version.hpp"
#include <limits.h>
#include <winnt.h>
#include <memoryapi.h>
#include <psapi.h>
/* maximum number of mapping records returned */
static const int MAX_REGIONS_RETURNED = 1000000;
class MappingInfo {
public:
stringStream _ap_buffer;
stringStream _state_buffer;
stringStream _protect_buffer;
stringStream _type_buffer;
char _file_name[MAX_PATH];
MappingInfo() {}
void process(MEMORY_BASIC_INFORMATION& mem_info) {
_ap_buffer.reset();
_state_buffer.reset();
_protect_buffer.reset();
_type_buffer.reset();
get_protect_string(_ap_buffer, mem_info.AllocationProtect);
get_state_string(_state_buffer, mem_info);
get_protect_string(_protect_buffer, mem_info.Protect);
get_type_string(_type_buffer, mem_info);
_file_name[0] = 0;
if (mem_info.Type == MEM_IMAGE) {
HMODULE hModule = 0;
if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, static_cast<LPCSTR>(mem_info.AllocationBase), &hModule)) {
GetModuleFileName(hModule, _file_name, sizeof(_file_name));
}
}
}
void get_protect_string(outputStream& out, DWORD prot) {
const char read_c = prot & (PAGE_READONLY | PAGE_READWRITE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_WRITECOPY | PAGE_EXECUTE_WRITECOPY) ? 'r' : '-';
const char write_c = prot & (PAGE_READWRITE | PAGE_WRITECOPY | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY) ? 'w' : '-';
const char execute_c = prot & (PAGE_EXECUTE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY) ? 'x' : '-';
out.print("%c%c%c", read_c, write_c, execute_c);
if (prot & (PAGE_WRITECOPY | PAGE_EXECUTE_WRITECOPY)) {
out.put('c');
}
if (prot & PAGE_GUARD) {
out.put('g');
}
if (prot & PAGE_NOCACHE) {
out.put('n');
}
if (prot & PAGE_WRITECOMBINE) {
out.put('W');
}
const DWORD bits = PAGE_NOACCESS | PAGE_READONLY | PAGE_READWRITE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE
| PAGE_WRITECOPY | PAGE_EXECUTE_WRITECOPY | PAGE_EXECUTE
| PAGE_GUARD | PAGE_NOCACHE | PAGE_WRITECOMBINE;
if ((prot & bits) != prot) {
out.print_cr("Unknown Windows memory protection value: 0x%x unknown bits: 0x%x", prot, prot & ~bits);
assert(false, "Unknown Windows memory protection value: 0x%x unknown bits: 0x%x", prot, prot & ~bits);
}
}
void get_state_string(outputStream& out, MEMORY_BASIC_INFORMATION& mem_info) {
if (mem_info.State == MEM_COMMIT) {
out.put('c');
} else if (mem_info.State == MEM_FREE) {
out.put('f');
} else if (mem_info.State == MEM_RESERVE) {
out.put('r');
} else {
out.print_cr("Unknown Windows memory state value: 0x%x", mem_info.State);
assert(false, "Unknown Windows memory state value: 0x%x", mem_info.State);
}
}
void get_type_string(outputStream& out, MEMORY_BASIC_INFORMATION& mem_info) {
if (mem_info.Type == MEM_IMAGE) {
out.print("img");
} else if (mem_info.Type == MEM_MAPPED) {
out.print("map");
} else if (mem_info.Type == MEM_PRIVATE) {
out.print("pvt");
} else if (mem_info.Type == 0 && mem_info.State == MEM_FREE) {
out.print("---");
} else {
out.print_cr("Unknown Windows memory type 0x%x", mem_info.Type);
assert(false, "Unknown Windows memory type 0x%x", mem_info.Type);
}
}
};
class MappingInfoSummary {
unsigned _num_mappings;
size_t _total_region_size; // combined resident set size
size_t _total_committed; // combined committed size
class WinOsInfo : public os::win32 {
public:
static void printOsInfo(outputStream* st) {
st->print("OS:");
os::win32::print_windows_version(st);
os::win32::print_uptime_info(st);
VM_Version::print_platform_virtualization_info(st);
os::print_memory_info(st);
}
};
public:
MappingInfoSummary() : _num_mappings(0), _total_region_size(0),
_total_committed(0) {}
void add_mapping(const MEMORY_BASIC_INFORMATION& mem_info, const MappingInfo& mapping_info) {
if (mem_info.State != MEM_FREE) {
_num_mappings++;
_total_region_size += mem_info.RegionSize;
_total_committed += mem_info.State == MEM_COMMIT ? mem_info.RegionSize : 0;
}
}
void print_on(const MappingPrintSession& session) const {
outputStream* st = session.out();
WinOsInfo::printOsInfo(st);
st->print_cr("current process reserved memory: " PROPERFMT, PROPERFMTARGS(_total_region_size));
st->print_cr("current process committed memory: " PROPERFMT, PROPERFMTARGS(_total_committed));
st->print_cr("current process region count: " PROPERFMT, PROPERFMTARGS(_num_mappings));
}
};
class MappingInfoPrinter {
const MappingPrintSession& _session;
public:
MappingInfoPrinter(const MappingPrintSession& session) :
_session(session)
{}
void print_single_mapping(const MEMORY_BASIC_INFORMATION& mem_info, const MappingInfo& mapping_info) const {
outputStream* st = _session.out();
#define INDENT_BY(n) \
if (st->fill_to(n) == 0) { \
st->print(" "); \
}
st->print(PTR_FORMAT "-" PTR_FORMAT, mem_info.BaseAddress, static_cast<const char*>(mem_info.BaseAddress) + mem_info.RegionSize);
INDENT_BY(38);
st->print("%12zu", mem_info.RegionSize);
INDENT_BY(51);
st->print("%s", mapping_info._protect_buffer.base());
INDENT_BY(57);
st->print("%s-%s", mapping_info._state_buffer.base(), mapping_info._type_buffer.base());
INDENT_BY(63);
st->print("%#11llx", reinterpret_cast<const unsigned long long>(mem_info.BaseAddress) - reinterpret_cast<const unsigned long long>(mem_info.AllocationBase));
INDENT_BY(72);
if (_session.print_nmt_info_for_region(mem_info.BaseAddress, static_cast<const char*>(mem_info.BaseAddress) + mem_info.RegionSize)) {
st->print(" ");
}
st->print_raw(mapping_info._file_name);
#undef INDENT_BY
st->cr();
}
void print_legend() const {
outputStream* st = _session.out();
st->print_cr("from, to, vsize: address range and size");
st->print_cr("prot: protection:");
st->print_cr(" rwx: read / write / execute");
st->print_cr(" c: copy on write");
st->print_cr(" g: guard");
st->print_cr(" n: no cache");
st->print_cr(" W: write combine");
st->print_cr("state: region state and type:");
st->print_cr(" state: committed / reserved");
st->print_cr(" type: image / mapped / private");
st->print_cr("file: file mapped, if mapping is not anonymous");
st->print_cr("vm info: VM information (requires NMT)");
{
streamIndentor si(st, 16);
_session.print_nmt_flag_legend();
}
}
void print_header() const {
outputStream* st = _session.out();
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3
// 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
// 0x00007ffb24565000-0x00007ffb24a7e000 5345280 r-- c-img 0x1155000 C:\work\jdk\build\fastdebug\jdk\bin\server\jvm.dll
st->print_cr("from to vsize prot state offset vminfo/file");
st->print_cr("===========================================================================================");
}
};
void MemMapPrinter::pd_print_all_mappings(const MappingPrintSession& session) {
HANDLE hProcess = GetCurrentProcess();
MappingInfoPrinter printer(session);
MappingInfoSummary summary;
outputStream* const st = session.out();
printer.print_legend();
st->cr();
printer.print_header();
MEMORY_BASIC_INFORMATION mem_info;
MappingInfo mapping_info;
int region_count = 0;
::memset(&mem_info, 0, sizeof(mem_info));
for (char* ptr = 0; VirtualQueryEx(hProcess, ptr, &mem_info, sizeof(mem_info)) == sizeof(mem_info); ) {
assert(mem_info.RegionSize > 0, "RegionSize is not greater than zero");
if (++region_count > MAX_REGIONS_RETURNED) {
st->print_cr("limit of %d regions reached (results inaccurate)", region_count);
break;
}
mapping_info.process(mem_info);
if (mem_info.State != MEM_FREE) {
printer.print_single_mapping(mem_info, mapping_info);
summary.add_mapping(mem_info, mapping_info);
}
ptr += mem_info.RegionSize;
::memset(&mem_info, 0, sizeof(mem_info));
}
st->cr();
summary.print_on(session);
st->cr();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2024, 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
@@ -208,7 +208,7 @@ static DCmdArgument<MemorySizeArgument> _dcmd_globalbuffersize(
static DCmdArgument<jlong> _dcmd_numglobalbuffers(
"numglobalbuffers",
"Number of global buffers",
"JULONG",
"INT",
false,
default_num_global_buffers);
@@ -222,7 +222,7 @@ static DCmdArgument<MemorySizeArgument> _dcmd_maxchunksize(
static DCmdArgument<jlong> _dcmd_old_object_queue_size (
"old-object-queue-size",
"Maximum number of old objects to track",
"JINT",
"INT",
false,
default_old_object_queue_size);
@@ -245,7 +245,7 @@ static DCmdArgument<bool> _dcmd_sample_protection(
static DCmdArgument<jlong> _dcmd_stackdepth(
"stackdepth",
"Stack depth for stacktraces (minimum 1, maximum 2048)",
"JULONG",
"INT",
false,
default_stack_depth);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2024, 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
@@ -117,6 +117,7 @@ static void commit(const HelperType& helper) {
JavaThread* jt = JavaThread::cast(thread);
if (jt->thread_state() == _thread_in_native) {
// For a JavaThread to take a JFR stacktrace, it must be in _thread_in_vm. Can safepoint here.
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, jt));
ThreadInVMfromNative transition(jt);
event.commit();
return;

View File

@@ -25,7 +25,7 @@
#include "precompiled.hpp"
#ifdef LINUX
#if defined(LINUX) || defined(_WIN64)
#include "gc/shared/collectedHeap.hpp"
#include "logging/logAsyncWriter.hpp"

View File

@@ -30,7 +30,7 @@
#include "nmt/memTag.hpp"
#include "utilities/globalDefinitions.hpp"
#ifdef LINUX
#if defined(LINUX) || defined(_WIN64)
class outputStream;
class CachedNMTInformation;

View File

@@ -3347,8 +3347,9 @@ void Compile::final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& f
bool is_oop = t->isa_oopptr() != nullptr;
bool is_klass = t->isa_klassptr() != nullptr;
if ((is_oop && Matcher::const_oop_prefer_decode() ) ||
(is_klass && Matcher::const_klass_prefer_decode() && t->isa_klassptr()->exact_klass()->is_in_encoding_range())) {
if ((is_oop && UseCompressedOops && Matcher::const_oop_prefer_decode() ) ||
(is_klass && UseCompressedClassPointers && Matcher::const_klass_prefer_decode() &&
t->isa_klassptr()->exact_klass()->is_in_encoding_range())) {
Node* nn = nullptr;
int op = is_oop ? Op_ConN : Op_ConNKlass;

View File

@@ -562,6 +562,103 @@ bool PhaseCFG::unrelated_load_in_store_null_block(Node* store, Node* load) {
return false;
}
class DefUseMemStatesQueue : public StackObj {
private:
class DefUsePair : public StackObj {
private:
Node* _def; // memory state
Node* _use; // use of the memory state that also modifies the memory state
public:
DefUsePair(Node* def, Node* use) :
_def(def), _use(use) {
}
DefUsePair() :
_def(nullptr), _use(nullptr) {
}
Node* def() const {
return _def;
}
Node* use() const {
return _use;
}
};
GrowableArray<DefUsePair> _queue;
GrowableArray<MergeMemNode*> _worklist_visited; // visited mergemem nodes
bool already_enqueued(Node* def_mem, PhiNode* use_phi) const {
// def_mem is one of the inputs of use_phi and at least one input of use_phi is
// not def_mem. It's however possible that use_phi has def_mem as input multiple
// times. If that happens, use_phi is recorded as a use of def_mem multiple
// times as well. When PhaseCFG::insert_anti_dependences() goes over
// uses of def_mem and enqueues them for processing, use_phi would then be
// enqueued for processing multiple times when it only needs to be
// processed once. The code below checks if use_phi as a use of def_mem was
// already enqueued to avoid redundant processing of use_phi.
int j = _queue.length()-1;
// If there are any use of def_mem already enqueued, they were enqueued
// last (all use of def_mem are processed in one go).
for (; j >= 0; j--) {
const DefUsePair& def_use_pair = _queue.at(j);
if (def_use_pair.def() != def_mem) {
// We're done with the uses of def_mem
break;
}
if (def_use_pair.use() == use_phi) {
return true;
}
}
#ifdef ASSERT
for (; j >= 0; j--) {
const DefUsePair& def_use_pair = _queue.at(j);
assert(def_use_pair.def() != def_mem, "Should be done with the uses of def_mem");
}
#endif
return false;
}
public:
DefUseMemStatesQueue(ResourceArea* area) {
}
void push(Node* def_mem_state, Node* use_mem_state) {
if (use_mem_state->is_MergeMem()) {
// Be sure we don't get into combinatorial problems.
if (!_worklist_visited.append_if_missing(use_mem_state->as_MergeMem())) {
return; // already on work list; do not repeat
}
} else if (use_mem_state->is_Phi()) {
// A Phi could have the same mem as input multiple times. If that's the case, we don't need to enqueue it
// more than once. We otherwise allow phis to be repeated; they can merge two relevant states.
if (already_enqueued(def_mem_state, use_mem_state->as_Phi())) {
return;
}
}
_queue.push(DefUsePair(def_mem_state, use_mem_state));
}
bool is_nonempty() const {
return _queue.is_nonempty();
}
Node* top_def() const {
return _queue.top().def();
}
Node* top_use() const {
return _queue.top().use();
}
void pop() {
_queue.pop();
}
};
//--------------------------insert_anti_dependences---------------------------
// A load may need to witness memory that nearby stores can overwrite.
// For each nearby store, either insert an "anti-dependence" edge
@@ -579,6 +676,7 @@ bool PhaseCFG::unrelated_load_in_store_null_block(Node* store, Node* load) {
// preserve anti-dependences. The caller may also hoist the load
// above the LCA, if it is not the early block.
Block* PhaseCFG::insert_anti_dependences(Block* LCA, Node* load, bool verify) {
ResourceMark rm;
assert(load->needs_anti_dependence_check(), "must be a load of some sort");
assert(LCA != nullptr, "");
DEBUG_ONLY(Block* LCA_orig = LCA);
@@ -625,10 +723,8 @@ Block* PhaseCFG::insert_anti_dependences(Block* LCA, Node* load, bool verify) {
early = memory_early_block(load, early, this);
}
ResourceArea *area = Thread::current()->resource_area();
Node_List worklist_mem(area); // prior memory state to store
Node_List worklist_store(area); // possible-def to explore
Node_List worklist_visited(area); // visited mergemem nodes
ResourceArea* area = Thread::current()->resource_area();
DefUseMemStatesQueue worklist_def_use_mem_states(area); // prior memory state to store and possible-def to explore
Node_List non_early_stores(area); // all relevant stores outside of early
bool must_raise_LCA = false;
@@ -644,60 +740,56 @@ Block* PhaseCFG::insert_anti_dependences(Block* LCA, Node* load, bool verify) {
// The relevant stores "nearby" the load consist of a tree rooted
// at initial_mem, with internal nodes of type MergeMem.
// Therefore, the branches visited by the worklist are of this form:
// initial_mem -> (MergeMem ->)* store
// initial_mem -> (MergeMem ->)* Memory state modifying node
// Memory state modifying nodes include Store and Phi nodes and any node for which needs_anti_dependence_check()
// returns false.
// The anti-dependence constraints apply only to the fringe of this tree.
Node* initial_mem = load->in(MemNode::Memory);
worklist_store.push(initial_mem);
worklist_visited.push(initial_mem);
worklist_mem.push(nullptr);
while (worklist_store.size() > 0) {
worklist_def_use_mem_states.push(nullptr, initial_mem);
while (worklist_def_use_mem_states.is_nonempty()) {
// Examine a nearby store to see if it might interfere with our load.
Node* mem = worklist_mem.pop();
Node* store = worklist_store.pop();
uint op = store->Opcode();
Node* def_mem_state = worklist_def_use_mem_states.top_def();
Node* use_mem_state = worklist_def_use_mem_states.top_use();
worklist_def_use_mem_states.pop();
uint op = use_mem_state->Opcode();
assert(!use_mem_state->needs_anti_dependence_check(), "no loads");
// MergeMems do not directly have anti-deps.
// Treat them as internal nodes in a forward tree of memory states,
// the leaves of which are each a 'possible-def'.
if (store == initial_mem // root (exclusive) of tree we are searching
if (use_mem_state == initial_mem // root (exclusive) of tree we are searching
|| op == Op_MergeMem // internal node of tree we are searching
) {
mem = store; // It's not a possibly interfering store.
if (store == initial_mem)
def_mem_state = use_mem_state; // It's not a possibly interfering store.
if (use_mem_state == initial_mem)
initial_mem = nullptr; // only process initial memory once
for (DUIterator_Fast imax, i = mem->fast_outs(imax); i < imax; i++) {
store = mem->fast_out(i);
if (store->is_MergeMem()) {
// Be sure we don't get into combinatorial problems.
// (Allow phis to be repeated; they can merge two relevant states.)
uint j = worklist_visited.size();
for (; j > 0; j--) {
if (worklist_visited.at(j-1) == store) break;
}
if (j > 0) continue; // already on work list; do not repeat
worklist_visited.push(store);
for (DUIterator_Fast imax, i = def_mem_state->fast_outs(imax); i < imax; i++) {
use_mem_state = def_mem_state->fast_out(i);
if (use_mem_state->needs_anti_dependence_check()) {
// use_mem_state is also a kind of load (i.e. needs_anti_dependence_check), and it is not a memory state
// modifying node (store, Phi or MergeMem). Hence, load can't be anti dependent on this node.
continue;
}
worklist_mem.push(mem);
worklist_store.push(store);
worklist_def_use_mem_states.push(def_mem_state, use_mem_state);
}
continue;
}
if (op == Op_MachProj || op == Op_Catch) continue;
if (store->needs_anti_dependence_check()) continue; // not really a store
// Compute the alias index. Loads and stores with different alias
// indices do not need anti-dependence edges. Wide MemBar's are
// anti-dependent on everything (except immutable memories).
const TypePtr* adr_type = store->adr_type();
const TypePtr* adr_type = use_mem_state->adr_type();
if (!C->can_alias(adr_type, load_alias_idx)) continue;
// Most slow-path runtime calls do NOT modify Java memory, but
// they can block and so write Raw memory.
if (store->is_Mach()) {
MachNode* mstore = store->as_Mach();
if (use_mem_state->is_Mach()) {
MachNode* mstore = use_mem_state->as_Mach();
if (load_alias_idx != Compile::AliasIdxRaw) {
// Check for call into the runtime using the Java calling
// convention (and from there into a wrapper); it has no
@@ -736,10 +828,10 @@ Block* PhaseCFG::insert_anti_dependences(Block* LCA, Node* load, bool verify) {
// or else observe that 'store' is all the way up in the
// earliest legal block for 'load'. In the latter case,
// immediately insert an anti-dependence edge.
Block* store_block = get_block_for_node(store);
Block* store_block = get_block_for_node(use_mem_state);
assert(store_block != nullptr, "unused killing projections skipped above");
if (store->is_Phi()) {
if (use_mem_state->is_Phi()) {
// Loop-phis need to raise load before input. (Other phis are treated
// as store below.)
//
@@ -754,8 +846,8 @@ Block* PhaseCFG::insert_anti_dependences(Block* LCA, Node* load, bool verify) {
// Do not assert(store_block != early, "Phi merging memory after access")
// PhiNode may be at start of block 'early' with backedge to 'early'
DEBUG_ONLY(bool found_match = false);
for (uint j = PhiNode::Input, jmax = store->req(); j < jmax; j++) {
if (store->in(j) == mem) { // Found matching input?
for (uint j = PhiNode::Input, jmax = use_mem_state->req(); j < jmax; j++) {
if (use_mem_state->in(j) == def_mem_state) { // Found matching input?
DEBUG_ONLY(found_match = true);
Block* pred_block = get_block_for_node(store_block->pred(j));
if (pred_block != early) {
@@ -781,21 +873,21 @@ Block* PhaseCFG::insert_anti_dependences(Block* LCA, Node* load, bool verify) {
// will find him on the non_early_stores list and stick him
// with a precedence edge.
// (But, don't bother if LCA is already raised all the way.)
if (LCA != early && !unrelated_load_in_store_null_block(store, load)) {
if (LCA != early && !unrelated_load_in_store_null_block(use_mem_state, load)) {
store_block->set_raise_LCA_mark(load_index);
must_raise_LCA = true;
non_early_stores.push(store);
non_early_stores.push(use_mem_state);
}
} else {
// Found a possibly-interfering store in the load's 'early' block.
// This means 'load' cannot sink at all in the dominator tree.
// Add an anti-dep edge, and squeeze 'load' into the highest block.
assert(store != load->find_exact_control(load->in(0)), "dependence cycle found");
assert(use_mem_state != load->find_exact_control(load->in(0)), "dependence cycle found");
if (verify) {
assert(store->find_edge(load) != -1 || unrelated_load_in_store_null_block(store, load),
assert(use_mem_state->find_edge(load) != -1 || unrelated_load_in_store_null_block(use_mem_state, load),
"missing precedence edge");
} else {
store->add_prec(load);
use_mem_state->add_prec(load);
}
LCA = early;
// This turns off the process of gathering non_early_stores.

View File

@@ -138,9 +138,11 @@ void DCmd::register_dcmds(){
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<PerfMapDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TrimCLibcHeapDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<MallocInfoDcmd>(full_export, true, false));
#endif // LINUX
#if defined(LINUX) || defined(_WIN64)
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemMapDCmd>(full_export, true,false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemDumpMapDCmd>(full_export, true,false));
#endif // LINUX
#endif // LINUX or WINDOWS
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeHeapAnalyticsDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompilerDirectivesPrintDCmd>(full_export, true, false));
@@ -1172,7 +1174,7 @@ void CompilationMemoryStatisticDCmd::execute(DCmdSource source, TRAPS) {
CompilationMemoryStatistic::print_all_by_size(output(), human_readable, minsize);
}
#ifdef LINUX
#if defined(LINUX) || defined(_WIN64)
SystemMapDCmd::SystemMapDCmd(outputStream* output, bool heap) : DCmd(output, heap) {}
@@ -1190,16 +1192,22 @@ SystemDumpMapDCmd::SystemDumpMapDCmd(outputStream* output, bool heap) :
void SystemDumpMapDCmd::execute(DCmdSource source, TRAPS) {
const char* name = _filename.value();
if (name == nullptr || name[0] == 0) {
output()->print_cr("filename is empty or not specified. No file written");
return;
}
fileStream fs(name);
if (fs.is_open()) {
if (!MemTracker::enabled()) {
output()->print_cr("(NMT is disabled, will not annotate mappings).");
}
MemMapPrinter::print_all_mappings(&fs);
#ifndef _WIN64
// For the readers convenience, resolve path name.
char tmp[JVM_MAXPATHLEN];
const char* absname = os::Posix::realpath(name, tmp, sizeof(tmp));
name = absname != nullptr ? absname : name;
#endif
output()->print_cr("Memory map dumped to \"%s\".", name);
} else {
output()->print_cr("Failed to open \"%s\" for writing (%s).", name, os::strerror(errno));

View File

@@ -981,14 +981,14 @@ public:
virtual void execute(DCmdSource source, TRAPS);
};
#ifdef LINUX
#if defined(LINUX) || defined(_WIN64)
class SystemMapDCmd : public DCmd {
public:
SystemMapDCmd(outputStream* output, bool heap);
static const char* name() { return "System.map"; }
static const char* description() {
return "Prints an annotated process memory map of the VM process (linux only).";
return "Prints an annotated process memory map of the VM process (linux and Windows only).";
}
static const char* impact() { return "Medium; can be high for very large java heaps."; }
static const JavaPermission permission() {
@@ -1006,7 +1006,7 @@ public:
SystemDumpMapDCmd(outputStream* output, bool heap);
static const char* name() { return "System.dump_map"; }
static const char* description() {
return "Dumps an annotated process memory map to an output file (linux only).";
return "Dumps an annotated process memory map to an output file (linux and Windows only).";
}
static const char* impact() { return "Medium; can be high for very large java heaps."; }
static const JavaPermission permission() {
@@ -1017,6 +1017,6 @@ public:
virtual void execute(DCmdSource source, TRAPS);
};
#endif // LINUX
#endif // LINUX or WINDOWS
#endif // SHARE_SERVICES_DIAGNOSTICCOMMAND_HPP

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, 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
@@ -28,9 +28,9 @@ package java.lang;
/**
* Thrown when an application tries to access a type using a string
* representing the type's name, but no definition for the type with
* the specified name can be found. This exception differs from
* {@link ClassNotFoundException} in that {@code ClassNotFoundException} is a
* checked exception, whereas this exception is unchecked.
* the specified name can be found. This exception differs from
* {@link ClassNotFoundException} in that {@code ClassNotFoundException}
* is a checked exception, whereas this exception is unchecked.
*
* <p>Note that this exception may be used when undefined type variables
* are accessed as well as when types (e.g., classes, interfaces or
@@ -48,15 +48,15 @@ public class TypeNotPresentException extends RuntimeException {
private static final long serialVersionUID = -5101214195716534496L;
/**
* The type name.
* The type name or the name of a type variable.
*/
private String typeName;
/**
* Constructs a {@code TypeNotPresentException} for the named type
* with the specified cause.
* Constructs a {@code TypeNotPresentException} for the named type or
* type variable with the specified cause.
*
* @param typeName the fully qualified name of the unavailable type
* @param typeName the fully qualified name of the unavailable type or type variable
* @param cause the exception that was thrown when the system attempted to
* load the named type, or {@code null} if unavailable or inapplicable
*/
@@ -66,9 +66,9 @@ public class TypeNotPresentException extends RuntimeException {
}
/**
* Returns the fully qualified name of the unavailable type.
* Returns the fully qualified name of the unavailable type or type variable name.
*
* @return the fully qualified name of the unavailable type
* @return the fully qualified name of the unavailable type or type variable name
*/
public String typeName() { return typeName;}
}

View File

@@ -143,7 +143,7 @@ abstract sealed class DelegatingMethodHandle extends MethodHandle
final int PRE_ACTION = hasPreAction ? nameCursor++ : -1;
final int NEXT_MH = customized ? -1 : nameCursor++;
final int REINVOKE = nameCursor++;
LambdaForm.Name[] names = LambdaForm.arguments(nameCursor - ARG_LIMIT, mtype.invokerType());
LambdaForm.Name[] names = LambdaForm.invokeArguments(nameCursor - ARG_LIMIT, mtype);
assert(names.length == nameCursor);
names[THIS_DMH] = names[THIS_DMH].withConstraint(constraint);
Object[] targetArgs;

View File

@@ -250,11 +250,17 @@ sealed class DirectMethodHandle extends MethodHandle {
default: throw new InternalError("which="+which);
}
MethodType mtypeWithArg = mtype.appendParameterTypes(MemberName.class);
if (doesAlloc)
mtypeWithArg = mtypeWithArg
.insertParameterTypes(0, Object.class) // insert newly allocated obj
.changeReturnType(void.class); // <init> returns void
MethodType mtypeWithArg;
if (doesAlloc) {
var ptypes = mtype.ptypes();
var newPtypes = new Class<?>[ptypes.length + 2];
newPtypes[0] = Object.class; // insert newly allocated obj
System.arraycopy(ptypes, 0, newPtypes, 1, ptypes.length);
newPtypes[newPtypes.length - 1] = MemberName.class;
mtypeWithArg = MethodType.methodType(void.class, newPtypes, true);
} else {
mtypeWithArg = mtype.appendParameterTypes(MemberName.class);
}
MemberName linker = new MemberName(MethodHandle.class, linkerName, mtypeWithArg, REF_invokeStatic);
try {
linker = IMPL_NAMES.resolveOrFail(REF_invokeStatic, linker, null, LM_TRUSTED,
@@ -270,7 +276,7 @@ sealed class DirectMethodHandle extends MethodHandle {
final int GET_MEMBER = nameCursor++;
final int CHECK_RECEIVER = (needsReceiverCheck ? nameCursor++ : -1);
final int LINKER_CALL = nameCursor++;
Name[] names = arguments(nameCursor - ARG_LIMIT, mtype.invokerType());
Name[] names = invokeArguments(nameCursor - ARG_LIMIT, mtype);
assert(names.length == nameCursor);
if (doesAlloc) {
// names = { argx,y,z,... new C, init method }
@@ -786,7 +792,7 @@ sealed class DirectMethodHandle extends MethodHandle {
final int LINKER_CALL = nameCursor++;
final int POST_CAST = (needsCast && isGetter ? nameCursor++ : -1);
final int RESULT = nameCursor-1; // either the call or the cast
Name[] names = arguments(nameCursor - ARG_LIMIT, mtype.invokerType());
Name[] names = invokeArguments(nameCursor - ARG_LIMIT, mtype);
if (needsInit)
names[INIT_BAR] = new Name(getFunction(NF_ensureInitialized), names[DMH_THIS]);
if (needsCast && !isGetter)

View File

@@ -314,14 +314,14 @@ class Invokers {
final int CHECK_TYPE = nameCursor++;
final int CHECK_CUSTOM = (CUSTOMIZE_THRESHOLD >= 0) ? nameCursor++ : -1;
final int LINKER_CALL = nameCursor++;
MethodType invokerFormType = mtype.invokerType();
MethodType invokerFormType = mtype;
if (isLinker) {
if (!customized)
invokerFormType = invokerFormType.appendParameterTypes(MemberName.class);
} else {
invokerFormType = invokerFormType.invokerType();
}
Name[] names = arguments(nameCursor - INARG_LIMIT, invokerFormType);
Name[] names = invokeArguments(nameCursor - INARG_LIMIT, invokerFormType);
assert(names.length == nameCursor)
: Arrays.asList(mtype, customized, which, nameCursor, names.length);
if (MTYPE_ARG >= INARG_LIMIT) {
@@ -390,11 +390,11 @@ class Invokers {
final int LINKER_CALL = nameCursor++;
Name[] names = new Name[LINKER_CALL + 1];
names[THIS_VH] = argument(THIS_VH, BasicType.basicType(Object.class));
names[THIS_VH] = argument(THIS_VH, BasicType.L_TYPE);
for (int i = 0; i < mtype.parameterCount(); i++) {
names[ARG_BASE + i] = argument(ARG_BASE + i, BasicType.basicType(mtype.parameterType(i)));
}
names[VAD_ARG] = new Name(ARG_LIMIT, BasicType.basicType(Object.class));
names[VAD_ARG] = new Name(ARG_LIMIT, BasicType.L_TYPE);
names[UNBOUND_VH] = new Name(getFunction(NF_directVarHandleTarget), names[THIS_VH]);
@@ -446,8 +446,8 @@ class Invokers {
final int LINKER_CALL = nameCursor++;
Name[] names = new Name[LINKER_CALL + 1];
names[THIS_MH] = argument(THIS_MH, BasicType.basicType(Object.class));
names[CALL_VH] = argument(CALL_VH, BasicType.basicType(Object.class));
names[THIS_MH] = argument(THIS_MH, BasicType.L_TYPE);
names[CALL_VH] = argument(CALL_VH, BasicType.L_TYPE);
for (int i = 0; i < mtype.parameterCount(); i++) {
names[ARG_BASE + i] = argument(ARG_BASE + i, BasicType.basicType(mtype.parameterType(i)));
}
@@ -589,17 +589,16 @@ class Invokers {
final int CSITE_ARG = skipCallSite ? -1 : APPENDIX_ARG;
final int CALL_MH = skipCallSite ? APPENDIX_ARG : nameCursor++; // result of getTarget
final int LINKER_CALL = nameCursor++;
MethodType invokerFormType = mtype.appendParameterTypes(skipCallSite ? MethodHandle.class : CallSite.class);
Name[] names = arguments(nameCursor - INARG_LIMIT, invokerFormType);
assert(names.length == nameCursor);
assert(names[APPENDIX_ARG] != null);
Name[] names = arguments(nameCursor - INARG_LIMIT + 1, mtype);
assert(names.length == nameCursor && names[APPENDIX_ARG] == null);
names[APPENDIX_ARG] = argument(APPENDIX_ARG, BasicType.L_TYPE);
if (!skipCallSite)
names[CALL_MH] = new Name(getFunction(NF_getCallSiteTarget), names[CSITE_ARG]);
// (site.)invokedynamic(a*):R => mh = site.getTarget(); mh.invokeBasic(a*)
final int PREPEND_MH = 0, PREPEND_COUNT = 1;
Object[] outArgs = Arrays.copyOfRange(names, ARG_BASE, OUTARG_LIMIT + PREPEND_COUNT, Object[].class);
Object[] outArgs = new Object[OUTARG_LIMIT + PREPEND_COUNT];
System.arraycopy(names, 0, outArgs, PREPEND_COUNT, outArgs.length - PREPEND_COUNT);
// prepend MH argument:
System.arraycopy(outArgs, 0, outArgs, PREPEND_COUNT, outArgs.length - PREPEND_COUNT);
outArgs[PREPEND_MH] = names[CALL_MH];
names[LINKER_CALL] = new Name(mtype, outArgs);
lform = LambdaForm.create(INARG_LIMIT, names,

View File

@@ -1636,6 +1636,16 @@ class LambdaForm {
names[i] = argument(i, basicType(types.parameterType(i)));
return names;
}
static Name[] invokeArguments(int extra, MethodType types) {
int length = types.parameterCount();
Name[] names = new Name[length + extra + 1];
names[0] = argument(0, L_TYPE);
for (int i = 0; i < length; i++)
names[i + 1] = argument(i + 1, basicType(types.parameterType(i)));
return names;
}
static final int INTERNED_ARGUMENT_LIMIT = 10;
private static final Name[][] INTERNED_ARGUMENTS
= new Name[ARG_TYPE_LIMIT][INTERNED_ARGUMENT_LIMIT];

View File

@@ -810,8 +810,7 @@ abstract class MethodHandleImpl {
final int CALL_TARGET = nameCursor++;
assert(CALL_TARGET == SELECT_ALT+1); // must be true to trigger IBG.emitSelectAlternative
MethodType lambdaType = basicType.invokerType();
Name[] names = arguments(nameCursor - ARG_LIMIT, lambdaType);
Name[] names = invokeArguments(nameCursor - ARG_LIMIT, basicType);
BoundMethodHandle.SpeciesData data =
(GET_COUNTERS != -1) ? BoundMethodHandle.speciesData_LLLL()
@@ -843,7 +842,7 @@ abstract class MethodHandleImpl {
invokeArgs[0] = names[SELECT_ALT];
names[CALL_TARGET] = new Name(basicType, invokeArgs);
lform = LambdaForm.create(lambdaType.parameterCount(), names, /*forceInline=*/true, Kind.GUARD);
lform = LambdaForm.create(basicType.parameterCount() + 1, names, /*forceInline=*/true, Kind.GUARD);
return basicType.form().setCachedLambdaForm(MethodTypeForm.LF_GWT, lform);
}
@@ -870,8 +869,6 @@ abstract class MethodHandleImpl {
* among catchException combinators with the same basic type.
*/
private static LambdaForm makeGuardWithCatchForm(MethodType basicType) {
MethodType lambdaType = basicType.invokerType();
LambdaForm lform = basicType.form().cachedLambdaForm(MethodTypeForm.LF_GWC);
if (lform != null) {
return lform;
@@ -890,7 +887,7 @@ abstract class MethodHandleImpl {
final int TRY_CATCH = nameCursor++;
final int UNBOX_RESULT = nameCursor++;
Name[] names = arguments(nameCursor - ARG_LIMIT, lambdaType);
Name[] names = invokeArguments(nameCursor - ARG_LIMIT, basicType);
BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLLLL();
names[THIS_MH] = names[THIS_MH].withConstraint(data);
@@ -919,7 +916,7 @@ abstract class MethodHandleImpl {
Object[] unboxArgs = new Object[] {names[GET_UNBOX_RESULT], names[TRY_CATCH]};
names[UNBOX_RESULT] = new Name(invokeBasicUnbox, unboxArgs);
lform = LambdaForm.create(lambdaType.parameterCount(), names, Kind.GUARD_WITH_CATCH);
lform = LambdaForm.create(basicType.parameterCount() + 1, names, Kind.GUARD_WITH_CATCH);
return basicType.form().setCachedLambdaForm(MethodTypeForm.LF_GWC, lform);
}
@@ -1738,8 +1735,6 @@ abstract class MethodHandleImpl {
* bytecode generation}.
*/
private static LambdaForm makeLoopForm(MethodType basicType, BasicType[] localVarTypes) {
MethodType lambdaType = basicType.invokerType();
final int THIS_MH = 0; // the BMH_LLL
final int ARG_BASE = 1; // start of incoming arguments
final int ARG_LIMIT = ARG_BASE + basicType.parameterCount();
@@ -1754,7 +1749,7 @@ abstract class MethodHandleImpl {
LambdaForm lform = basicType.form().cachedLambdaForm(MethodTypeForm.LF_LOOP);
if (lform == null) {
Name[] names = arguments(nameCursor - ARG_LIMIT, lambdaType);
Name[] names = invokeArguments(nameCursor - ARG_LIMIT, basicType);
BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLL();
names[THIS_MH] = names[THIS_MH].withConstraint(data);
@@ -1782,7 +1777,7 @@ abstract class MethodHandleImpl {
names[UNBOX_RESULT] = new Name(invokeBasicUnbox, unboxArgs);
lform = basicType.form().setCachedLambdaForm(MethodTypeForm.LF_LOOP,
LambdaForm.create(lambdaType.parameterCount(), names, Kind.LOOP));
LambdaForm.create(basicType.parameterCount() + 1, names, Kind.LOOP));
}
// BOXED_ARGS is the index into the names array where the loop idiom starts
@@ -1971,8 +1966,6 @@ abstract class MethodHandleImpl {
* forms among tryFinally combinators with the same basic type.
*/
private static LambdaForm makeTryFinallyForm(MethodType basicType) {
MethodType lambdaType = basicType.invokerType();
LambdaForm lform = basicType.form().cachedLambdaForm(MethodTypeForm.LF_TF);
if (lform != null) {
return lform;
@@ -1990,7 +1983,7 @@ abstract class MethodHandleImpl {
final int TRY_FINALLY = nameCursor++;
final int UNBOX_RESULT = nameCursor++;
Name[] names = arguments(nameCursor - ARG_LIMIT, lambdaType);
Name[] names = invokeArguments(nameCursor - ARG_LIMIT, basicType);
BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLLL();
names[THIS_MH] = names[THIS_MH].withConstraint(data);
@@ -2016,7 +2009,7 @@ abstract class MethodHandleImpl {
Object[] unboxArgs = new Object[] {names[GET_UNBOX_RESULT], names[TRY_FINALLY]};
names[UNBOX_RESULT] = new Name(invokeBasicUnbox, unboxArgs);
lform = LambdaForm.create(lambdaType.parameterCount(), names, Kind.TRY_FINALLY);
lform = LambdaForm.create(basicType.parameterCount() + 1, names, Kind.TRY_FINALLY);
return basicType.form().setCachedLambdaForm(MethodTypeForm.LF_TF, lform);
}
@@ -2060,7 +2053,6 @@ abstract class MethodHandleImpl {
}
private static LambdaForm makeCollectorForm(MethodType basicType, Class<?> arrayType) {
MethodType lambdaType = basicType.invokerType();
int parameterCount = basicType.parameterCount();
// Only share the lambda form for empty arrays and reference types.
@@ -2093,7 +2085,7 @@ abstract class MethodHandleImpl {
final int STORE_ELEMENT_LIMIT = STORE_ELEMENT_BASE + parameterCount;
nameCursor = STORE_ELEMENT_LIMIT;
Name[] names = arguments(nameCursor - ARG_LIMIT, lambdaType);
Name[] names = invokeArguments(nameCursor - ARG_LIMIT, basicType);
BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_L();
names[THIS_MH] = names[THIS_MH].withConstraint(data);
@@ -2111,7 +2103,7 @@ abstract class MethodHandleImpl {
names[CALL_NEW_ARRAY], storeIndex, names[argCursor]);
}
LambdaForm lform = LambdaForm.create(lambdaType.parameterCount(), names, CALL_NEW_ARRAY, Kind.COLLECTOR);
LambdaForm lform = LambdaForm.create(basicType.parameterCount() + 1, names, CALL_NEW_ARRAY, Kind.COLLECTOR);
if (isSharedLambdaForm) {
lform = basicType.form().setCachedLambdaForm(MethodTypeForm.LF_COLLECTOR, lform);
}
@@ -2174,8 +2166,6 @@ abstract class MethodHandleImpl {
private static LambdaForm makeTableSwitchForm(MethodType basicType, BoundMethodHandle.SpeciesData data,
int numCases) {
MethodType lambdaType = basicType.invokerType();
// We need to cache based on the basic type X number of cases,
// since the number of cases is used when generating bytecode.
// This also means that we can't use the cache in MethodTypeForm,
@@ -2207,7 +2197,7 @@ abstract class MethodHandleImpl {
final int FIELD_UNBOX_RESULT = fieldCursor++;
final int FIELD_CASES = fieldCursor++;
Name[] names = arguments(nameCursor - ARG_LIMIT, lambdaType);
Name[] names = invokeArguments(nameCursor - ARG_LIMIT, basicType);
names[THIS_MH] = names[THIS_MH].withConstraint(data);
names[GET_DEFAULT_CASE] = new Name(data.getterFunction(FIELD_DEFAULT_CASE), names[THIS_MH]);
@@ -2236,7 +2226,7 @@ abstract class MethodHandleImpl {
names[UNBOXED_RESULT] = new Name(invokeBasic, unboxArgs);
}
lform = LambdaForm.create(lambdaType.parameterCount(), names, Kind.TABLE_SWITCH);
lform = LambdaForm.create(basicType.parameterCount() + 1, names, Kind.TABLE_SWITCH);
LambdaForm prev = TableSwitchCacheKey.CACHE.putIfAbsent(key, lform);
return prev != null ? prev : lform;
}

View File

@@ -108,7 +108,7 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
final int GET_NEP = nameCursor++;
final int LINKER_CALL = nameCursor++;
LambdaForm.Name[] names = arguments(nameCursor - ARG_LIMIT, mtype.invokerType());
LambdaForm.Name[] names = invokeArguments(nameCursor - ARG_LIMIT, mtype);
assert (names.length == nameCursor);
names[GET_NEP] = new LambdaForm.Name(Lazy.NF_internalNativeEntryPoint, names[NMH_THIS]);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, 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
@@ -106,7 +106,11 @@ public class CoreReflectionFactory implements GenericsFactory {
}
public TypeVariable<?> findTypeVariable(String name){
return getScope().lookup(name);
TypeVariable<?> variable = getScope().lookup(name);
if (variable == null) {
throw new TypeNotPresentException(name, null);
}
return variable;
}
public Type makeNamedType(String name){

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, 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
@@ -48,7 +48,7 @@ import sun.java2d.cmm.PCMM;
* {@code ColorSpace} class. This representation of device independent and
* device dependent color spaces is based on the International Color Consortium
* Specification ICC.1:2001-12, File Format for Color Profiles (see
* <a href="http://www.color.org">http://www.color.org</a>).
* <a href="https://www.color.org">https://www.color.org</a>).
* <p>
* Typically, a {@code Color} or {@code ColorModel} would be associated with an
* ICC Profile which is either an input, display, or output profile (see the ICC

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, 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
@@ -64,7 +64,7 @@ import sun.java2d.cmm.ProfileDeferralInfo;
* A representation of color profile data for device independent and device
* dependent color spaces based on the International Color Consortium
* Specification ICC.1:2001-12, File Format for Color Profiles, (see
* <a href="http://www.color.org"> http://www.color.org</a>).
* <a href="https://www.color.org"> https://www.color.org</a>).
* <p>
* An {@code ICC_ColorSpace} object can be constructed from an appropriate
* {@code ICC_Profile}. Typically, an {@code ICC_ColorSpace} would be associated

View File

@@ -690,7 +690,7 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp {
* shall be set to zero. Thus, we are ignoring two most significant
* bytes here.
*
* See http://www.color.org/ICC1v42_2006-05.pdf, section 7.2.15.
* See https://www.color.org/ICC1v42_2006-05.pdf, section 7.2.15.
*/
return ((header[index+2] & 0xff) << 8) |
(header[index+3] & 0xff);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2024, 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
@@ -101,7 +101,7 @@
* <!-- WBMP plugin -->
* <tr>
* <th scope="row">
* <a href="http://www.wapforum.org/what/technical/SPEC-WAESpec-19990524.pdf">
* <a href="https://www.wapforum.org/what/technical/SPEC-WAESpec-19990524.pdf">
* WBMP</a>
* <td>yes
* <td>yes

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2024, 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
@@ -1008,7 +1008,7 @@ public final class BaselineTIFFTagSet extends TIFFTagSet {
/**
* Constant specifying the "ICC Profile" tag.
*
* @see <a href="http://www.color.org/ICC1V42.pdf">ICC Specification, section B.4: Embedding ICC profiles in TIFF files</a>
* @see <a href="https://www.color.org/ICC1V42.pdf">ICC Specification, section B.4: Embedding ICC profiles in TIFF files</a>
*/
public static final int TAG_ICC_PROFILE = 34675;

View File

@@ -75,9 +75,11 @@ public abstract class VKSurfaceData extends SurfaceData
private static final String DESC_VK_TEXTURE = "VK Texture";
// We want non-premultiplied alpha to prevent precision loss, so use PixelConverter.Argb
// See also VKUtil_DecodeJavaColor.
static final SurfaceType VKSurface =
SurfaceType.Any.deriveSubType(DESC_VK_SURFACE,
PixelConverter.ArgbPre.instance);
PixelConverter.Argb.instance);
static final SurfaceType VKSurfaceRTT =
VKSurface.deriveSubType(DESC_VK_SURFACE_RTT);
static final SurfaceType VKTexture =
@@ -110,6 +112,7 @@ public abstract class VKSurfaceData extends SurfaceData
}
}
// TODO Do we really want to have scale there? It is used by getDefaultScaleX/Y...
protected int scale;
protected int width;
protected int height;

View File

@@ -1,9 +1,9 @@
#version 450
layout(binding = 0) uniform sampler2D texSampler;
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
layout(binding = 0) uniform sampler2D u_TexSampler;
layout(location = 0) in vec2 in_TexCoord;
layout(location = 0) out vec4 out_Color;
void main() {
outColor = texture(texSampler, fragTexCoord);
out_Color = texture(u_TexSampler, in_TexCoord);
}

View File

@@ -1,10 +1,10 @@
#version 450
layout(location = 0) in vec2 inPosition;
layout(location = 1) in vec2 texPosition;
layout(location = 0) out vec2 fragTexCoord;
layout(location = 0) in vec2 in_Position;
layout(location = 1) in vec2 in_TexCoord;
layout(location = 0) out vec2 out_TexCoord;
void main() {
gl_Position = vec4(inPosition, 0.0, 1.0);
fragTexCoord = texPosition;
gl_Position = vec4(in_Position, 0.0, 1.0);
out_TexCoord = in_TexCoord;
}

View File

@@ -0,0 +1,11 @@
#version 450
layout(push_constant) uniform PushConstants {
vec2 viewportNormalizer; // 2.0 / viewport
} push;
layout(location = 0) in ivec2 in_Position;
void main() {
gl_Position = vec4(vec2(in_Position) * push.viewportNormalizer - vec2(1.0), 0.0, 1.0);
}

View File

@@ -1,8 +1,8 @@
#version 450
layout(location = 0) in flat vec4 fragColor;
layout(location = 0) out vec4 outColor;
layout(location = 0) in flat vec4 in_Color;
layout(location = 0) out vec4 out_Color;
void main() {
outColor = fragColor;
out_Color = in_Color;
}

View File

@@ -1,13 +1,14 @@
#version 450
layout(push_constant) uniform PushConstants {
vec4 fragColor;
} pushConstants;
vec2 viewportNormalizer; // 2.0 / viewport
} push;
layout(location = 0) in vec2 inPosition;
layout(location = 0) out flat vec4 fragColor;
layout(location = 0) in vec2 in_Position;
layout(location = 1) in vec4 in_Color;
layout(location = 0) out flat vec4 out_Color;
void main() {
gl_Position = vec4(inPosition, 0.0, 1.0);
fragColor = pushConstants.fragColor;
gl_Position = vec4(in_Position * push.viewportNormalizer - vec2(1.0), 0.0, 1.0);
out_Color = in_Color;
}

View File

@@ -0,0 +1,18 @@
#version 450
layout(set = 0, binding = 0, r8) uniform readonly restrict imageBuffer u_Mask;
layout(origin_upper_left) in vec4 gl_FragCoord;
layout(location = 0) in flat ivec4 in_OriginOffsetAndScanline;
layout(location = 1) in flat vec4 in_Color;
layout(location = 0) out vec4 out_Color;
void main() {
ivec2 maskPos = ivec2(gl_FragCoord.xy) - in_OriginOffsetAndScanline.xy;
int offset = in_OriginOffsetAndScanline.z;
int scanline = in_OriginOffsetAndScanline.w;
int maskIndex = offset + scanline * maskPos.y + min(scanline, maskPos.x);
out_Color = in_Color * imageLoad(u_Mask, maskIndex).r;
}

View File

@@ -0,0 +1,20 @@
#version 450
layout(push_constant) uniform PushConstants {
vec2 viewportNormalizer; // 2.0 / viewport
} push;
layout(location = 0) in ivec4 in_PositionOffsetAndScanline;
layout(location = 1) in vec4 in_Color;
// This starts with "Origin" and not "Position" intentionally.
// When drawing, vertices are ordered in a such way, that provoking vertex is always the top-left one.
// This gives us an easy way to calculate offset within the rectangle without additional inputs.
layout(location = 0) out flat ivec4 out_OriginOffsetAndScanline;
layout(location = 1) out flat vec4 out_Color;
void main() {
gl_Position = vec4(vec2(in_PositionOffsetAndScanline.xy) * push.viewportNormalizer - vec2(1.0), 0.0, 1.0);
out_OriginOffsetAndScanline = in_PositionOffsetAndScanline;
out_Color = in_Color;
}

View File

@@ -186,46 +186,59 @@ void* CARR_ring_buffer_realloc(CARR_ring_buffer_t* buf, size_t elem_size, size_t
*/
#define RING_BUFFER_CAPACITY(P) ((P) == NULL ? (size_t) 0 : RING_BUFFER_T(P)->capacity)
/**
* Add element to the beginning of the ring buffer. Implicitly initializes when buffer is NULL.
* On allocation failure, C_ARRAY_UTIL_ALLOCATION_FAILED is called.
* @param P pointer to the first data element of the buffer
*/
#define RING_BUFFER_PUSH_FRONT(P, ...) do { \
if ((P) == NULL) (P) = CARR_ring_buffer_realloc(NULL, sizeof((P)[0]), ARRAY_DEFAULT_CAPACITY); \
else if ((RING_BUFFER_T(P)->head + RING_BUFFER_T(P)->capacity - 1) % RING_BUFFER_T(P)->capacity == RING_BUFFER_T(P)->tail) \
(P) = CARR_ring_buffer_realloc(RING_BUFFER_T(P), sizeof((P)[0]), ARRAY_CAPACITY_GROW(RING_BUFFER_T(P)->capacity)); \
if ((P) == NULL) C_ARRAY_UTIL_ALLOCATION_FAILED(); \
RING_BUFFER_T(P)->head = (RING_BUFFER_T(P)->head + RING_BUFFER_T(P)->capacity - 1) % RING_BUFFER_T(P)->capacity; \
(P)[RING_BUFFER_T(P)->head] = (__VA_ARGS__); \
} while(0)
/**
* Add element to the end of the ring buffer. Implicitly initializes when buffer is NULL.
* On allocation failure, C_ARRAY_UTIL_ALLOCATION_FAILED is called.
* @param P pointer to the first data element of the buffer
*/
#define RING_BUFFER_PUSH(P, ...) RING_BUFFER_PUSH_CUSTOM(P, (P)[tail] = (__VA_ARGS__);)
#define RING_BUFFER_PUSH_CUSTOM(P, ...) do { \
size_t head, tail, new_tail; \
if ((P) == NULL) { \
(P) = CARR_ring_buffer_realloc(NULL, sizeof((P)[0]), ARRAY_DEFAULT_CAPACITY); \
if ((P) == NULL) C_ARRAY_UTIL_ALLOCATION_FAILED(); \
head = tail = 0; \
new_tail = 1; \
} else { \
head = RING_BUFFER_T(P)->head; \
tail = RING_BUFFER_T(P)->tail; \
new_tail = (tail + 1) % RING_BUFFER_T(P)->capacity; \
if (new_tail == head) { \
(P) = CARR_ring_buffer_realloc(RING_BUFFER_T(P), sizeof(P[0]), ARRAY_CAPACITY_GROW(RING_BUFFER_T(P)->capacity)); \
if ((P) == NULL) C_ARRAY_UTIL_ALLOCATION_FAILED(); \
head = 0; \
tail = RING_BUFFER_T(P)->tail; \
new_tail = RING_BUFFER_T(P)->tail + 1; \
} \
} \
__VA_ARGS__ \
RING_BUFFER_T(P)->tail = new_tail; \
#define RING_BUFFER_PUSH_BACK(P, ...) do { \
if ((P) == NULL) (P) = CARR_ring_buffer_realloc(NULL, sizeof((P)[0]), ARRAY_DEFAULT_CAPACITY); \
else if ((RING_BUFFER_T(P)->tail + 1) % RING_BUFFER_T(P)->capacity == RING_BUFFER_T(P)->head) \
(P) = CARR_ring_buffer_realloc(RING_BUFFER_T(P), sizeof((P)[0]), ARRAY_CAPACITY_GROW(RING_BUFFER_T(P)->capacity)); \
if ((P) == NULL) C_ARRAY_UTIL_ALLOCATION_FAILED(); \
(P)[RING_BUFFER_T(P)->tail] = (__VA_ARGS__); \
RING_BUFFER_T(P)->tail = (RING_BUFFER_T(P)->tail + 1) % RING_BUFFER_T(P)->capacity; \
} while(0)
/**
* Get pointer to the first element of the ring buffer.
* @param P pointer to the first data element of the buffer
*/
#define RING_BUFFER_PEEK(P) ((P) == NULL || RING_BUFFER_T(P)->head == RING_BUFFER_T(P)->tail ? NULL : &(P)[RING_BUFFER_T(P)->head])
#define RING_BUFFER_FRONT(P) ((P) == NULL || RING_BUFFER_T(P)->head == RING_BUFFER_T(P)->tail ? NULL : &(P)[RING_BUFFER_T(P)->head])
/**
* Get pointer to the last element of the ring buffer.
* @param P pointer to the first data element of the buffer
*/
#define RING_BUFFER_BACK(P) ((P) == NULL || RING_BUFFER_T(P)->head == RING_BUFFER_T(P)->tail ? NULL : \
&(P)[(RING_BUFFER_T(P)->tail + RING_BUFFER_T(P)->capacity - 1) % RING_BUFFER_T(P)->capacity])
/**
* Move beginning of the ring buffer forward (remove first element).
* @param P pointer to the first data element of the buffer
*/
#define RING_BUFFER_POP(P) RING_BUFFER_T(P)->head = (RING_BUFFER_T(P)->head + 1) % RING_BUFFER_T(P)->capacity
#define RING_BUFFER_POP_FRONT(P) RING_BUFFER_T(P)->head = (RING_BUFFER_T(P)->head + 1) % RING_BUFFER_T(P)->capacity
/**
* Move end of the ring buffer backward (remove last element).
* @param P pointer to the first data element of the buffer
*/
#define RING_BUFFER_POP_BACK(P) \
RING_BUFFER_T(P)->tail = (RING_BUFFER_T(P)->tail + RING_BUFFER_T(P)->capacity - 1) % RING_BUFFER_T(P)->capacity
/**
* Deallocate the ring buffer

View File

@@ -0,0 +1,609 @@
// Copyright 2024 JetBrains s.r.o.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This code is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License version 2 only, as
// published by the Free Software Foundation. Oracle designates this
// particular file as subject to the "Classpath" exception as provided
// by Oracle in the LICENSE file that accompanied this code.
//
// This code is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// version 2 for more details (a copy is included in the LICENSE file that
// accompanied this code).
//
// You should have received a copy of the GNU General Public License version
// 2 along with this work; if not, write to the Free Software Foundation,
// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
//
// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
// or visit www.oracle.com if you need additional information or have any
// questions.
#include <assert.h>
#include "VKUtil.h"
#include "VKBase.h"
#include "VKAllocator.h"
/**
* Block size is a minimum allocation size.
* Using block size of 256 bytes gives us 256*2^21 = 512MiB addressable space per shared page
* (read further for explanations). Such block size is less than typical alignment,
* so there is no point in decreasing block size further to decrease possible fragmentation.
*/
#define BLOCK_POWER 8U
#define BLOCK_SIZE (1ULL<<BLOCK_POWER)
/**
* Starting page level for small allocations.
* With block size of 256 bytes and page level of 12, smallest pages will be 1MiB in size.
*/
#define MIN_SHARED_PAGE_LEVEL 12
/**
* Pair of memory blocks - "buddies".
* We want to keep bookkeeping footprint low, so single BlockPair should fit into 64 bits.
* This implies the following limits:
* - Max number of bottom-level blocks in a page (flat) = 2^21
* - Max number of bottom-level block pairs in a page (flat) = 2^20
* - Max number of all block pair nodes in a page (binary tree) = 2^21-1
*/
typedef struct {
uint64_t offset : 20; // Memory offset in block pairs from the beginning of the page.
uint64_t parent : 21; // Parent BlockPair index starting from 1, or 0 if none.
uint64_t nextFree : 21; // Index of the next free BlockPair of the same level starting from 1, or 0 if none.
uint64_t firstFree : 1; // Whether first block is free.
uint64_t secondFree : 1; // Whether second block is free.
} BlockPair;
/**
* Memory handle passed outside of allocator, we also need it to fit into 64 bits.
* Memory offset and BlockPair indices are both fixed to 21 bits (see BlockPair).
* We use 5 bits for block level, as this gives us full range over available offsets [0, 2^21-1].
* Special block level value of 31 means that its size covers the entire page, and may not be power of two.
* Note, however, that 21 bits for offset is not enough to cover whole range of levels [0, 30],
* therefore maximum size of shared pages will be bounded by available offset range (2^21 blocks).
* This leaves us with 17 bits, which we use for page index, there is no any special reason for this,
* we just use what's left. This naturally limits total possible number of allocated pages to 2^17.
*/
typedef union MemoryHandle {
uint64_t value;
struct {
uint64_t page : 17; // Page index.
uint64_t offset : 21; // Memory offset in blocks from the beginning of the page.
uint64_t level : 5; // Block level = log2(size), or 31 if size is not power of two.
uint64_t pair : 21; // BlockPair index starting from 1, or 0 if none.
};
} MemoryHandle;
// Define limits discussed earlier.
#define MAX_PAGES (1ULL << 17)
// These are hard constants and not meant to be adjusted:
#define MAX_BLOCK_LEVEL (21U)
#define MAX_SHARED_PAGE_SIZE ((1ULL << MAX_BLOCK_LEVEL) * BLOCK_SIZE)
typedef struct {
BlockPair* blockPairs;
void* mappedData;
uint32_t freeLevelIndices[MAX_BLOCK_LEVEL+1]; // Indices start from 1
uint32_t freeBlockPairIndex; // Indices start from 1
uint32_t nextPageIndex;
uint32_t memoryType;
} SharedPageData;
typedef struct {
VkDeviceMemory memory;
union {
VkDeviceSize dedicatedSize; // If this is a dedicated page.
SharedPageData* sharedPageData; // If this is a shared page.
uint32_t nextFreePage; // If this struct is unused.
};
#ifdef DEBUG
VkDeviceSize debugPageSize;
uint32_t debugMemoryType;
#endif
} Page;
typedef struct {
uint32_t sharedPagesIndex;
uint32_t allocationLevelTracker; // Used to manage page growth. Each new page size = (allocationLevelTracker++) / 2
#ifdef DEBUG
VkDeviceSize debugTotalPagesSize;
#endif
} Pool;
struct VKAllocator {
VKDevice* device;
VkPhysicalDeviceMemoryProperties memoryProperties;
Page* pages;
uint32_t freePageIndex;
Pool pools[VK_MAX_MEMORY_TYPES];
};
#define NO_PAGE_INDEX (~0U)
VKMemoryRequirements VKAllocator_NoRequirements(VKAllocator* allocator) {
return (VKMemoryRequirements) {
.allocator = allocator,
.dedicatedRequirements.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS,
.requirements.sType = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2,
.requirements.memoryRequirements = {
.size = 0,
.alignment = 1,
.memoryTypeBits = VK_NO_MEMORY_TYPE
},
.memoryType = VK_NO_MEMORY_TYPE
};
}
VKMemoryRequirements VKAllocator_BufferRequirements(VKAllocator* allocator, VkBuffer buffer) {
assert(allocator != NULL);
VKMemoryRequirements r = VKAllocator_NoRequirements(allocator);
r.requirements.pNext = &r.dedicatedRequirements;
const VkBufferMemoryRequirementsInfo2 bufferRequirementsInfo = {
.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2,
.buffer = buffer
};
allocator->device->vkGetBufferMemoryRequirements2(allocator->device->handle, &bufferRequirementsInfo, &r.requirements);
return r;
}
VKMemoryRequirements VKAllocator_ImageRequirements(VKAllocator* allocator, VkImage image) {
assert(allocator != NULL);
VKMemoryRequirements r = VKAllocator_NoRequirements(allocator);
r.requirements.pNext = &r.dedicatedRequirements;
const VkImageMemoryRequirementsInfo2 imageRequirementsInfo = {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2,
.image = image
};
allocator->device->vkGetImageMemoryRequirements2(allocator->device->handle, &imageRequirementsInfo, &r.requirements);
return r;
}
void VKAllocator_PadToAlignment(VKMemoryRequirements* requirements) {
assert(requirements != NULL);
VkMemoryRequirements* t = &requirements->requirements.memoryRequirements;
t->size = ((t->size + t->alignment - 1) / t->alignment) * t->alignment;
requirements->dedicatedRequirements.requiresDedicatedAllocation = VK_FALSE;
requirements->dedicatedRequirements.prefersDedicatedAllocation = VK_FALSE;
}
void VKAllocator_FindMemoryType(VKMemoryRequirements* requirements,
VkMemoryPropertyFlags requiredProperties, VkMemoryPropertyFlags allowedProperties) {
if (requirements->memoryType != VK_NO_MEMORY_TYPE) return;
// TODO also skip heaps with insufficient memory?
allowedProperties |= requiredProperties;
for (uint32_t i = 0; i < requirements->allocator->memoryProperties.memoryTypeCount; i++) {
if ((requirements->requirements.memoryRequirements.memoryTypeBits & (1 << i)) == 0) continue;
VkMemoryPropertyFlags flags = requirements->allocator->memoryProperties.memoryTypes[i].propertyFlags;
if ((flags & requiredProperties) == requiredProperties && (flags & allowedProperties) == flags) {
requirements->memoryType = i;
return;
}
}
}
static uint32_t VKAllocator_AllocatePage(VKAllocator* alloc, uint32_t memoryType, VkDeviceSize size,
VkImage dedicatedImage, VkBuffer dedicatedBuffer) {
assert(alloc != NULL);
// Allocate memory.
VkBool32 dedicated = dedicatedImage != VK_NULL_HANDLE || dedicatedBuffer != VK_NULL_HANDLE;
VKDevice* device = alloc->device;
VkMemoryDedicatedAllocateInfo dedicatedAllocateInfo = {
.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO,
.image = dedicatedImage,
.buffer = dedicatedBuffer
};
VkMemoryAllocateInfo allocateInfo = {
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
.pNext = dedicated ? &dedicatedAllocateInfo : NULL,
.allocationSize = size,
.memoryTypeIndex = memoryType
};
VkDeviceMemory memory;
VK_IF_ERROR(device->vkAllocateMemory(device->handle, &allocateInfo, NULL, &memory)) {
J2dRlsTraceLn3(J2D_TRACE_ERROR, "VKAllocator_AllocatePage: FAILED memoryType=%d, size=%d, dedicated=%d", memoryType, size, dedicated);
return NO_PAGE_INDEX;
}
// Allocate page struct.
uint32_t index;
Page* page;
if (alloc->freePageIndex != NO_PAGE_INDEX) {
index = alloc->freePageIndex;
page = &alloc->pages[index];
alloc->freePageIndex = page->nextFreePage;
} else {
index = ARRAY_SIZE(alloc->pages);
VK_RUNTIME_ASSERT(index < MAX_PAGES);
ARRAY_PUSH_BACK(alloc->pages, (Page) {});
page = &ARRAY_LAST(alloc->pages);
}
assert(page->memory == VK_NULL_HANDLE);
*page = (Page) { .memory = memory };
J2dRlsTraceLn4(J2D_TRACE_INFO, "VKAllocator_AllocatePage: #%d memoryType=%d, size=%d, dedicated=%d", index, memoryType, size, dedicated);
#ifdef DEBUG
page->debugPageSize = size;
page->debugMemoryType = memoryType;
alloc->pools[memoryType].debugTotalPagesSize += size;
J2dTraceLn2(J2D_TRACE_INFO, "VKAllocator_AllocatePage: memoryType=%d, debugTotalPagesSize=%d", memoryType, alloc->pools[memoryType].debugTotalPagesSize);
#endif
return index;
}
static void VKAllocator_FreePage(VKAllocator* alloc, Page* page, uint32_t pageIndex) {
assert(alloc != NULL);
VKDevice* device = alloc->device;
device->vkFreeMemory(device->handle, page->memory, NULL);
page->memory = VK_NULL_HANDLE;
page->nextFreePage = alloc->freePageIndex;
alloc->freePageIndex = pageIndex;
J2dRlsTraceLn1(J2D_TRACE_INFO, "VKAllocator_FreePage: #%d", pageIndex);
#ifdef DEBUG
alloc->pools[page->debugMemoryType].debugTotalPagesSize -= page->debugPageSize;
J2dTraceLn2(J2D_TRACE_INFO, "VKAllocator_FreePage: memoryType=%d, debugTotalPagesSize=%d",
page->debugMemoryType, alloc->pools[page->debugMemoryType].debugTotalPagesSize);
#endif
}
/**
* Pop free block pair of the specified level from the free list.
* Subdivides upper level blocks if there are no existing matching blocks.
*/
static uint32_t VKAllocator_PopFreeBlockPair(SharedPageData* data, uint32_t level) {
assert(data != NULL && level <= MAX_BLOCK_LEVEL);
uint32_t pairIndex = data->freeLevelIndices[level];
if (pairIndex != 0) {
// Pop existing free block pair.
BlockPair pair = data->blockPairs[pairIndex-1];
assert(pair.firstFree ^ pair.secondFree); // Only one must be free.
data->freeLevelIndices[level] = pair.nextFree;
return pairIndex;
} else if (level < MAX_BLOCK_LEVEL && (pairIndex = VKAllocator_PopFreeBlockPair(data, level+1)) != 0) {
// Allocate block pair struct.
uint32_t parentIndex = pairIndex;
BlockPair* pair;
if (data->freeBlockPairIndex != 0) {
pairIndex = data->freeBlockPairIndex;
pair = &data->blockPairs[pairIndex-1];
data->freeBlockPairIndex = pair->nextFree;
} else {
ARRAY_PUSH_BACK(data->blockPairs, (BlockPair) {});
pairIndex = ARRAY_SIZE(data->blockPairs);
pair = &data->blockPairs[pairIndex-1];
}
// Subdivide parent block.
BlockPair* parent = &data->blockPairs[parentIndex-1];
assert(parent->firstFree || parent->secondFree);
*pair = (BlockPair) {
.offset = parent->offset,
.parent = parentIndex,
.nextFree = 0,
.firstFree = 1,
.secondFree = 1,
};
if (!parent->firstFree) {
pair->offset |= 1ULL << level;
parent->secondFree = 0;
} else parent->firstFree = 0;
data->freeLevelIndices[level] = pairIndex;
return pairIndex;
} else return 0;
}
/**
* Push free block pair of the specified level to the free list.
* Merges into upper level blocks if there are free buddies.
* Returns VK_TRUE, if page was completely freed.
*/
static VkBool32 VKAllocator_PushFreeBlockPair(SharedPageData* data, BlockPair* pair, uint32_t pairIndex, uint32_t level) {
assert(data != NULL && level <= MAX_BLOCK_LEVEL);
assert(pair->firstFree || pair->secondFree);
if (pair->firstFree && pair->secondFree) {
// Merge.
uint32_t parentIndex = pair->parent;
assert(parentIndex != 0);
BlockPair* parent = &data->blockPairs[parentIndex-1];
if (pair->offset == parent->offset) {
assert(!parent->firstFree);
parent->firstFree = 1;
} else {
assert(!parent->secondFree);
parent->secondFree = 1;
}
// Remove from free list.
if (data->freeLevelIndices[level] == pairIndex) {
data->freeLevelIndices[level] = pair->nextFree;
} else {
assert(data->freeLevelIndices[level] != 0);
BlockPair* b = &data->blockPairs[data->freeLevelIndices[level]-1];
for (;;) {
if (b->nextFree == pairIndex) {
b->nextFree = pair->nextFree;
break;
}
assert(b->nextFree != 0);
b = &data->blockPairs[b->nextFree-1];
}
}
// Return block pair struct to pool.
pair->nextFree = data->freeBlockPairIndex;
data->freeBlockPairIndex = pairIndex;
return VKAllocator_PushFreeBlockPair(data, parent, parentIndex, level+1);
} else {
pair->nextFree = data->freeLevelIndices[level];
data->freeLevelIndices[level] = pairIndex;
return pair->parent == 0;
}
}
typedef struct {
MemoryHandle handle;
VkDeviceMemory memory;
} AllocationResult;
/**
* Provided image or buffer may be used for dedicated allocation.
*/
static AllocationResult VKAllocator_AllocateForResource(VKMemoryRequirements* requirements, VkImage image, VkBuffer buffer) {
assert(requirements != NULL && requirements->allocator != NULL);
VKAllocator* alloc = requirements->allocator;
uint32_t memoryType = requirements->memoryType;
VkDeviceSize size = requirements->requirements.memoryRequirements.size;
VkDeviceSize alignment = requirements->requirements.memoryRequirements.alignment;
VkBool32 dedicated = requirements->dedicatedRequirements.requiresDedicatedAllocation ||
requirements->dedicatedRequirements.prefersDedicatedAllocation;
assert(memoryType != VK_NO_MEMORY_TYPE);
assert(size > 0);
assert(alignment > 0 && (alignment & (alignment - 1)) == 0); // Alignment must be power of 2.
uint32_t level = size <= BLOCK_SIZE ? 0 : VKUtil_Log2(size - 1) + 1 - BLOCK_POWER;
uint32_t blockSize = BLOCK_SIZE << level;
// Adjust level to ensure proper alignment. Not very optimal, but this is a very rare case.
while (blockSize % alignment != 0) { level++; blockSize <<= 1; }
J2dRlsTraceLn6(J2D_TRACE_VERBOSE,
"VKAllocator_Allocate: level=%d, blockSize=%d, size=%d, alignment=%d, memoryType=%d, dedicated=%d",
level, blockSize, size, alignment, memoryType, dedicated);
if (!dedicated && level <= MAX_BLOCK_LEVEL) {
// Try to sub-allocate.
AllocationResult result = { .handle.value = 0 };
result.handle.level = level;
Pool* pool = &alloc->pools[memoryType];
uint32_t pageIndex = pool->sharedPagesIndex;
// Try to find block in existing pages.
Page* page;
SharedPageData* data;
uint32_t pairIndex;
while (pageIndex != NO_PAGE_INDEX) {
page = &alloc->pages[pageIndex];
data = page->sharedPageData;
pairIndex = VKAllocator_PopFreeBlockPair(data, level);
if (pairIndex != 0) break;
pageIndex = data->nextPageIndex;
}
// Allocate new page.
if (pageIndex == NO_PAGE_INDEX) {
uint32_t pageLevel = (pool->allocationLevelTracker++) / 2;
if (pageLevel < level) pool->allocationLevelTracker = (pageLevel = level) * 2 + 1;
else if (pageLevel > MAX_BLOCK_LEVEL) pool->allocationLevelTracker = (pageLevel = MAX_BLOCK_LEVEL) * 2 + 1;
pageIndex = VKAllocator_AllocatePage(alloc, memoryType, BLOCK_SIZE << pageLevel, VK_NULL_HANDLE, VK_NULL_HANDLE);
if (pageIndex == NO_PAGE_INDEX) return (AllocationResult) {{0}, VK_NULL_HANDLE};
page = &alloc->pages[pageIndex];
data = page->sharedPageData = (SharedPageData*) calloc(1, sizeof(SharedPageData));
VK_RUNTIME_ASSERT(page->sharedPageData);
data->memoryType = memoryType;
ARRAY_PUSH_BACK(data->blockPairs, (BlockPair) {
.offset = 0,
.parent = 0,
.nextFree = 0,
.firstFree = 1,
.secondFree = 0,
});
data->freeLevelIndices[pageLevel] = 1;
data->nextPageIndex = pool->sharedPagesIndex;
pool->sharedPagesIndex = pageIndex;
pairIndex = VKAllocator_PopFreeBlockPair(data, level);
assert(pairIndex != 0);
}
// Take the block.
BlockPair* pair = &data->blockPairs[pairIndex-1];
result.handle.page = pageIndex;
result.handle.pair = pairIndex;
// No need to check alignment, all blocks are aligned on their size.
if (pair->firstFree) {
result.handle.offset = (pair->offset << 1U);
pair->firstFree = 0;
} else {
result.handle.offset = (pair->offset << 1U) + (1ULL << level);
pair->secondFree = 0;
}
result.memory = page->memory;
return result;
} else {
// Dedicated allocation.
uint32_t pageIndex = VKAllocator_AllocatePage(alloc, memoryType, size, image, buffer);
if (pageIndex == NO_PAGE_INDEX) return (AllocationResult) {{0}, VK_NULL_HANDLE};
Page* page = &alloc->pages[pageIndex];
page->dedicatedSize = size;
return (AllocationResult) {
.handle = {
.page = pageIndex,
.offset = 0,
.level = 31, // Special value, same meaning as VK_WHOLE_SIZE
.pair = 0
},
.memory = page->memory
};
}
}
VKMemory VKAllocator_Allocate(VKMemoryRequirements* requirements) {
return (VKMemory) VKAllocator_AllocateForResource(requirements, VK_NULL_HANDLE, VK_NULL_HANDLE).handle.value;
}
VKMemory VKAllocator_AllocateForImage(VKMemoryRequirements* requirements, VkImage image) {
AllocationResult result = VKAllocator_AllocateForResource(requirements, image, VK_NULL_HANDLE);
if (result.handle.value == 0) return VK_NULL_HANDLE;
assert(result.memory != VK_NULL_HANDLE);
VKDevice* device = requirements->allocator->device;
VK_IF_ERROR(device->vkBindImageMemory(device->handle, image, result.memory, result.handle.offset << BLOCK_POWER)) {
VKAllocator_Free(requirements->allocator, (VKMemory) result.handle.value);
return VK_NULL_HANDLE;
}
return (VKMemory) result.handle.value;
}
VKMemory VKAllocator_AllocateForBuffer(VKMemoryRequirements* requirements, VkBuffer buffer) {
AllocationResult result = VKAllocator_AllocateForResource(requirements, VK_NULL_HANDLE, buffer);
if (result.handle.value == 0) return VK_NULL_HANDLE;
assert(result.memory != VK_NULL_HANDLE);
VKDevice* device = requirements->allocator->device;
VK_IF_ERROR(device->vkBindBufferMemory(device->handle, buffer, result.memory, result.handle.offset << BLOCK_POWER)) {
VKAllocator_Free(requirements->allocator, (VKMemory) result.handle.value);
return VK_NULL_HANDLE;
}
return (VKMemory) result.handle.value;
}
void VKAllocator_Free(VKAllocator* allocator, VKMemory memory) {
assert(allocator != NULL);
if (memory == VK_NULL_HANDLE) return;
MemoryHandle handle = { .value = (uint64_t) memory };
Page* page = &allocator->pages[handle.page];
if (handle.pair != 0) {
// Return block into shared page.
SharedPageData* data = page->sharedPageData;
BlockPair* pair = &data->blockPairs[handle.pair-1];
if ((pair->offset << 1U) == handle.offset) pair->firstFree = 1;
else pair->secondFree = 1;
VkBool32 cleared = VKAllocator_PushFreeBlockPair(data, pair, handle.pair, handle.level);
J2dRlsTraceLn3(J2D_TRACE_VERBOSE,
"VKAllocator_Free: shared, level=%d, blockSize=%d, memoryType=%d",
handle.level, BLOCK_SIZE << handle.level, data->memoryType);
// If page is empty and not the last created, release it.
if (cleared) {
Pool* pool = &allocator->pools[data->memoryType];
if (pool->sharedPagesIndex != handle.page) {
assert(pool->sharedPagesIndex != NO_PAGE_INDEX);
Page* p = &allocator->pages[pool->sharedPagesIndex];
for (;;) {
if (p->sharedPageData->nextPageIndex == handle.page) {
p->sharedPageData->nextPageIndex = data->nextPageIndex;
break;
}
assert(p->sharedPageData->nextPageIndex != 0);
p = &allocator->pages[p->sharedPageData->nextPageIndex];
}
VKAllocator_FreePage(allocator, page, handle.page);
free(data);
}
}
} else {
// Release dedicated allocation.
J2dRlsTraceLn2(J2D_TRACE_VERBOSE, "VKAllocator_Free: dedicated, level=%d, blockSize=%d", handle.level, BLOCK_SIZE << handle.level);
VKAllocator_FreePage(allocator, page, handle.page);
}
}
VkMappedMemoryRange VKAllocator_GetMemoryRange(VKAllocator* allocator, VKMemory memory) {
assert(allocator != NULL && memory != VK_NULL_HANDLE);
MemoryHandle handle = { .value = (uint64_t) memory };
return (VkMappedMemoryRange) {
.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
.memory = allocator->pages[handle.page].memory,
.offset = handle.offset * BLOCK_SIZE,
.size = handle.level == 31 ? VK_WHOLE_SIZE : BLOCK_SIZE << handle.level
};
}
void* VKAllocator_Map(VKAllocator* allocator, VKMemory memory) {
assert(allocator != NULL && memory != VK_NULL_HANDLE);
MemoryHandle handle = { .value = (uint64_t) memory };
Page* page = &allocator->pages[handle.page];
void *p;
if (handle.pair != 0) {
if (page->sharedPageData->mappedData == NULL) {
VK_IF_ERROR(allocator->device->vkMapMemory(allocator->device->handle, page->memory,
0, VK_WHOLE_SIZE, 0, &p)) VK_UNHANDLED_ERROR();
page->sharedPageData->mappedData = p;
}
p = (void*) (((uint8_t*) page->sharedPageData->mappedData) + (handle.offset * BLOCK_SIZE));
} else {
VK_IF_ERROR(allocator->device->vkMapMemory(allocator->device->handle, page->memory,
0, VK_WHOLE_SIZE, 0, &p)) VK_UNHANDLED_ERROR();
}
return p;
}
void VKAllocator_Unmap(VKAllocator* allocator, VKMemory memory) {
assert(allocator != NULL && memory != VK_NULL_HANDLE);
MemoryHandle handle = { .value = (uint64_t) memory };
Page* page = &allocator->pages[handle.page];
if (handle.pair == 0) allocator->device->vkUnmapMemory(allocator->device->handle, page->memory);
}
void VKAllocator_Flush(VKAllocator* allocator, VKMemory memory, VkDeviceSize offset, VkDeviceSize size) {
VkMappedMemoryRange range = VKAllocator_GetMemoryRange(allocator, memory);
assert((size == VK_WHOLE_SIZE && offset <= range.size) || offset + size <= range.size);
range.offset += offset;
range.size = size == VK_WHOLE_SIZE ? range.size - offset : size;
VK_IF_ERROR(allocator->device->vkFlushMappedMemoryRanges(allocator->device->handle, 1, &range)) VK_UNHANDLED_ERROR();
}
void VKAllocator_Invalidate(VKAllocator* allocator, VKMemory memory, VkDeviceSize offset, VkDeviceSize size) {
VkMappedMemoryRange range = VKAllocator_GetMemoryRange(allocator, memory);
assert((size == VK_WHOLE_SIZE && offset <= range.size) || offset + size <= range.size);
range.offset += offset;
range.size = size == VK_WHOLE_SIZE ? range.size - offset : size;
VK_IF_ERROR(allocator->device->vkInvalidateMappedMemoryRanges(allocator->device->handle, 1, &range)) VK_UNHANDLED_ERROR();
}
VKAllocator* VKAllocator_Create(VKDevice* device) {
VKGraphicsEnvironment* ge = VKGE_graphics_environment();
VKAllocator* allocator = (VKAllocator*) calloc(1, sizeof(VKAllocator));
allocator->device = device;
allocator->freePageIndex = NO_PAGE_INDEX;
for (uint32_t i = 0; i < VK_MAX_MEMORY_TYPES; i++) {
allocator->pools[i] = (Pool) {
.sharedPagesIndex = NO_PAGE_INDEX,
.allocationLevelTracker = MIN_SHARED_PAGE_LEVEL * 2
};
}
ge->vkGetPhysicalDeviceMemoryProperties(device->physicalDevice, &allocator->memoryProperties);
J2dRlsTraceLn1(J2D_TRACE_INFO, "VKAllocator_Create: allocator=%p", allocator);
return allocator;
}
void VKAllocator_Destroy(VKAllocator* allocator) {
if (allocator == NULL) return;
for (uint32_t i = 0; i < VK_MAX_MEMORY_TYPES; i++) {
uint32_t pageIndex;
while ((pageIndex = allocator->pools[i].sharedPagesIndex) != NO_PAGE_INDEX) {
Page* page = &allocator->pages[pageIndex];
SharedPageData* data = page->sharedPageData;
#ifdef DEBUG
// Check that all shared allocations were freed.
for (uint32_t j = MAX_BLOCK_LEVEL;; j--) {
if (data->freeLevelIndices[j] != 0) {
BlockPair* pair = &data->blockPairs[data->freeLevelIndices[j]-1];
if (pair->parent == 0) break;
else VK_FATAL_ERROR("VKAllocator_Destroy: leaked memory in shared page");
}
assert(j > 0);
}
#endif
ARRAY_FREE(data->blockPairs);
allocator->pools[i].sharedPagesIndex = data->nextPageIndex;
free(data);
VKAllocator_FreePage(allocator, page, pageIndex);
}
#ifdef DEBUG
// Check that all dedicated allocations were freed.
if (allocator->pools[i].debugTotalPagesSize > 0) VK_FATAL_ERROR("VKAllocator_Destroy: leaked memory in dedicated page");
#endif
}
ARRAY_FREE(allocator->pages);
J2dRlsTraceLn1(J2D_TRACE_INFO, "VKAllocator_Destroy(%p)", allocator);
free(allocator);
}

View File

@@ -0,0 +1,138 @@
// Copyright 2024 JetBrains s.r.o.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This code is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License version 2 only, as
// published by the Free Software Foundation. Oracle designates this
// particular file as subject to the "Classpath" exception as provided
// by Oracle in the LICENSE file that accompanied this code.
//
// This code is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// version 2 for more details (a copy is included in the LICENSE file that
// accompanied this code).
//
// You should have received a copy of the GNU General Public License version
// 2 along with this work; if not, write to the Free Software Foundation,
// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
//
// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
// or visit www.oracle.com if you need additional information or have any
// questions.
#ifndef VKAllocator_h_Included
#define VKAllocator_h_Included
#include "VKTypes.h"
#define VK_NO_MEMORY_TYPE (~0U)
#define VK_ALL_MEMORY_PROPERTIES ((VkMemoryPropertyFlags) (~0U))
typedef struct {
VKAllocator* allocator;
VkMemoryRequirements2 requirements;
VkMemoryDedicatedRequirements dedicatedRequirements;
uint32_t memoryType;
} VKMemoryRequirements;
VKAllocator* VKAllocator_Create(VKDevice* device);
void VKAllocator_Destroy(VKAllocator* allocator);
/**
* Get generic, most permissive memory requirements with size=0, alignment=1.
*/
VKMemoryRequirements VKAllocator_NoRequirements(VKAllocator* allocator);
/**
* Get buffer memory requirements. Required size may not be multiple of alignment, see VKAllocator_PadToAlignment.
*/
VKMemoryRequirements VKAllocator_BufferRequirements(VKAllocator* allocator, VkBuffer buffer);
/**
* Get image memory requirements. Required size may not be multiple of alignment, see VKAllocator_PadToAlignment.
*/
VKMemoryRequirements VKAllocator_ImageRequirements(VKAllocator* allocator, VkImage image);
/**
* Buffer and image memory requirements doesn't enforce size to be multiple of alignment.
* This needs to be enforced manually if resources are going to be sub-allocated in array manner.
* This also resets dedicated requirement flags, as for dedicated allocations size must
* be strictly equal to the one returned by resource memory requirements.
*/
void VKAllocator_PadToAlignment(VKMemoryRequirements* requirements);
/**
* Find memory type with properties not less than requiredProperties and not more than allowedProperties,
* allowed by given memory requirements.
* Found memory type is set in requirements->memoryType, if it is not set already.
* If requirements->memoryType is already set, this function does nothing.
* @param requiredProperties minimal required set of properties
* @param allowedProperties maximal allowed set of properties, implicitly includes requiredProperties, can be 0
*/
void VKAllocator_FindMemoryType(VKMemoryRequirements* requirements,
VkMemoryPropertyFlags requiredProperties, VkMemoryPropertyFlags allowedProperties);
/**
* Callback used to find appropriate memory type within given requirements.
* Found memory type must be set in requirements->memoryType.
* See VKAllocator_FindMemoryType.
*/
typedef void (*VKAllocator_FindMemoryTypeCallback)(VKMemoryRequirements* requirements);
/**
* Allocate memory within given requirements.
* Requirements must have been initialized with VKAllocator_*Requirements
* and memory type found with VKAllocator_FindMemoryType.
*/
VKMemory VKAllocator_Allocate(VKMemoryRequirements* requirements);
/**
* Allocate memory within given requirements and bind it to the image.
* Requirements must have been initialized with VKAllocator_*Requirements
* and memory type found with VKAllocator_FindMemoryType.
*/
VKMemory VKAllocator_AllocateForImage(VKMemoryRequirements* requirements, VkImage image);
/**
* Allocate memory within given requirements and bind it to the buffer.
* Requirements must have been initialized with VKAllocator_*Requirements
* and memory type found with VKAllocator_FindMemoryType.
*/
VKMemory VKAllocator_AllocateForBuffer(VKMemoryRequirements* requirements, VkBuffer buffer);
/**
* Release allocated memory.
*/
void VKAllocator_Free(VKAllocator* allocator, VKMemory memory);
/**
* Get underlying memory range for the memory handle.
* - VkMappedMemoryRange.memory is a raw VkDeviceMemory given memory was allocated from.
* - VkMappedMemoryRange.offset is the starting offset of the given memory within VkMappedMemoryRange.memory.
* - VkMappedMemoryRange.size is the size of the given memory block, or VK_WHOLE_SIZE.
* VK_WHOLE_SIZE is returned in cases, when exact memory block size is not known,
* but it is guaranteed, that in such cases memory block covers the entire VkMappedMemoryRange.memory.
*/
VkMappedMemoryRange VKAllocator_GetMemoryRange(VKAllocator* allocator, VKMemory memory);
/**
* Map allocated memory. Returns pointer to the beginning of mapped memory block.
*/
void* VKAllocator_Map(VKAllocator* allocator, VKMemory memory);
/**
* Unmap allocated memory.
*/
void VKAllocator_Unmap(VKAllocator* allocator, VKMemory memory);
/**
* Flush mapped memory range. size may be VK_WHOLE_SIZE. See vkFlushMappedMemoryRanges.
*/
void VKAllocator_Flush(VKAllocator* allocator, VKMemory memory, VkDeviceSize offset, VkDeviceSize size);
/**
* Invalidate mapped memory range. size may be VK_WHOLE_SIZE. See vkInvalidateMappedMemoryRanges.
*/
void VKAllocator_Invalidate(VKAllocator* allocator, VKMemory memory, VkDeviceSize offset, VkDeviceSize size);
#endif //VKAllocator_h_Included

View File

@@ -28,6 +28,7 @@
#include <string.h>
#include "VKUtil.h"
#include "VKBase.h"
#include "VKAllocator.h"
#include "VKRenderer.h"
#include "VKTexturePool.h"
@@ -58,26 +59,22 @@ static void vulkanLibClose() {
VKDevice* device = &geInstance->devices[i];
VKRenderer_Destroy(device->renderer);
VKTexturePool_Dispose(device->texturePool);
VKAllocator_Destroy(device->allocator);
ARRAY_FREE(device->enabledExtensions);
ARRAY_FREE(device->enabledLayers);
free(device->name);
if (device->vkDestroyDevice != NULL && device->handle != NULL) {
device->vkDestroyDevice(device->handle, NULL);
}
if (device->vkDestroyDevice != NULL) device->vkDestroyDevice(device->handle, NULL);
}
ARRAY_FREE(geInstance->devices);
}
#if defined(DEBUG)
if (geInstance->vkDestroyDebugUtilsMessengerEXT != NULL &&
geInstance->debugMessenger != NULL && geInstance->vkInstance != NULL) {
if (geInstance->vkDestroyDebugUtilsMessengerEXT != NULL && geInstance->vkInstance != VK_NULL_HANDLE) {
geInstance->vkDestroyDebugUtilsMessengerEXT(geInstance->vkInstance, geInstance->debugMessenger, NULL);
}
#endif
if (geInstance->vkDestroyInstance != NULL && geInstance->vkInstance != NULL) {
geInstance->vkDestroyInstance(geInstance->vkInstance, NULL);
}
if (geInstance->vkDestroyInstance != NULL) geInstance->vkDestroyInstance(geInstance->vkInstance, NULL);
free(geInstance);
geInstance = NULL;
}
@@ -359,9 +356,19 @@ static jboolean VK_FindDevices() {
ARRAY_ENSURE_CAPACITY(geInstance->devices, physicalDevicesCount);
for (uint32_t i = 0; i < physicalDevicesCount; i++) {
VkPhysicalDeviceExtendedDynamicStateFeaturesEXT extendedDynamicStateFeatures = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT,
.pNext = NULL
};
VkPhysicalDeviceExtendedDynamicState3FeaturesEXT extendedDynamicState3Features = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT,
.pNext = &extendedDynamicStateFeatures
};
VkPhysicalDeviceVulkan12Features device12Features = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES,
.pNext = NULL
.pNext = &extendedDynamicState3Features
};
VkPhysicalDeviceFeatures2 deviceFeatures2 = {
@@ -371,7 +378,7 @@ static jboolean VK_FindDevices() {
geInstance->vkGetPhysicalDeviceFeatures2(geInstance->physicalDevices[i], &deviceFeatures2);
VkPhysicalDeviceProperties2 deviceProperties2 = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2};
VkPhysicalDeviceProperties2 deviceProperties2 = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2 };
geInstance->vkGetPhysicalDeviceProperties2(geInstance->physicalDevices[i], &deviceProperties2);
J2dRlsTrace5(J2D_TRACE_INFO, "\t- %s (%d.%d.%d, %s) ",
(const char *) deviceProperties2.properties.deviceName,
@@ -450,14 +457,24 @@ static jboolean VK_FindDevices() {
VK_IF_ERROR(geInstance->vkEnumerateDeviceExtensionProperties(geInstance->physicalDevices[i],
NULL, &extensionCount, extensions)) continue;
J2dRlsTraceLn(J2D_TRACE_VERBOSE, " Supported device extensions:")
VkBool32 hasSwapChain = VK_FALSE;
VkBool32 hasSwapChain = VK_FALSE, hasDynamicRendering = VK_FALSE,
hasExtendedDynamicState = VK_FALSE, hasExtendedDynamicState3 = VK_FALSE;
for (uint32_t j = 0; j < extensionCount; j++) {
J2dRlsTraceLn1(J2D_TRACE_VERBOSE, " %s", (char *) extensions[j].extensionName)
hasSwapChain = hasSwapChain ||
strcmp(VK_KHR_SWAPCHAIN_EXTENSION_NAME, extensions[j].extensionName) == 0;
strcmp(VK_KHR_SWAPCHAIN_EXTENSION_NAME, extensions[j].extensionName) == 0;
hasDynamicRendering = hasDynamicRendering ||
strcmp(VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME, extensions[j].extensionName) == 0;
hasExtendedDynamicState = hasExtendedDynamicState ||
strcmp(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME, extensions[j].extensionName) == 0;
hasExtendedDynamicState3 = hasExtendedDynamicState3 ||
strcmp(VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME, extensions[j].extensionName) == 0;
}
J2dRlsTraceLn(J2D_TRACE_VERBOSE, "Vulkan: Found device extensions:")
J2dRlsTraceLn1(J2D_TRACE_VERBOSE, " " VK_KHR_SWAPCHAIN_EXTENSION_NAME " = %s", hasSwapChain ? "true" : "false")
J2dRlsTraceLn1(J2D_TRACE_VERBOSE, " " VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME " = %s", hasDynamicRendering ? "true" : "false")
J2dRlsTraceLn1(J2D_TRACE_VERBOSE, " " VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME " = %s", hasExtendedDynamicState ? "true" : "false")
J2dRlsTraceLn1(J2D_TRACE_VERBOSE, " " VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME " = %s", hasExtendedDynamicState3 ? "true" : "false")
if (!hasSwapChain) {
J2dRlsTraceLn(J2D_TRACE_INFO,
@@ -465,9 +482,17 @@ static jboolean VK_FindDevices() {
continue;
}
// Randomly turn off optional features in debug mode.
if (VK_DEBUG_RANDOM(50)) hasDynamicRendering = VK_FALSE;
if (VK_DEBUG_RANDOM(50)) hasExtendedDynamicState = VK_FALSE;
if (VK_DEBUG_RANDOM(50)) hasExtendedDynamicState3 = VK_FALSE;
pchar* deviceEnabledLayers = NULL;
pchar* deviceEnabledExtensions = NULL;
ARRAY_PUSH_BACK(deviceEnabledExtensions, VK_KHR_SWAPCHAIN_EXTENSION_NAME);
if (hasDynamicRendering) ARRAY_PUSH_BACK(deviceEnabledExtensions, VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME);
if (hasExtendedDynamicState) ARRAY_PUSH_BACK(deviceEnabledExtensions, VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME);
if (hasExtendedDynamicState3) ARRAY_PUSH_BACK(deviceEnabledExtensions, VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME);
// Validation layer
#ifdef DEBUG
@@ -496,7 +521,12 @@ static jboolean VK_FindDevices() {
.physicalDevice = geInstance->physicalDevices[i],
.queueFamily = queueFamily,
.enabledLayers = deviceEnabledLayers,
.enabledExtensions = deviceEnabledExtensions
.enabledExtensions = deviceEnabledExtensions,
.dynamicRendering = hasDynamicRendering,
.dynamicBlending = hasExtendedDynamicState3 && extendedDynamicState3Features.extendedDynamicState3ColorBlendEquation,
.dynamicLogicOp = hasExtendedDynamicState3 && extendedDynamicState3Features.extendedDynamicState3LogicOpEnable &&
extendedDynamicState3Features.extendedDynamicState3ColorBlendEnable,
.dynamicStencil = hasExtendedDynamicState && extendedDynamicStateFeatures.extendedDynamicState
}));
}
if (ARRAY_SIZE(geInstance->devices) == 0) {
@@ -537,6 +567,29 @@ static jboolean VK_InitDevice(VKDevice* device) {
};
void *pNext = &features12;
VkPhysicalDeviceDynamicRenderingFeaturesKHR dynamicRenderingFeatures = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES_KHR,
.pNext = pNext,
.dynamicRendering = VK_TRUE
};
if (device->dynamicRendering) pNext = &dynamicRenderingFeatures;
VkPhysicalDeviceExtendedDynamicStateFeaturesEXT dynamicStateFeatures = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT,
.pNext = pNext,
.extendedDynamicState = VK_TRUE
};
if (device->dynamicStencil) pNext = &dynamicStateFeatures;
VkPhysicalDeviceExtendedDynamicState3FeaturesEXT dynamicState3Features = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT,
.pNext = pNext,
.extendedDynamicState3ColorBlendEquation = device->dynamicBlending,
.extendedDynamicState3ColorBlendEnable = device->dynamicLogicOp,
.extendedDynamicState3LogicOpEnable = device->dynamicLogicOp,
};
if (device->dynamicBlending || device->dynamicLogicOp) pNext = &dynamicState3Features;
VkDeviceCreateInfo createInfo = {
.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
.pNext = pNext,
@@ -554,7 +607,8 @@ static jboolean VK_InitDevice(VKDevice* device) {
J2dRlsTraceLn1(J2D_TRACE_ERROR, "Vulkan: Cannot create device: %s", device->name)
return JNI_FALSE;
}
J2dRlsTraceLn1(J2D_TRACE_INFO, "Vulkan: Device created (%s)", device->name)
J2dRlsTraceLn5(J2D_TRACE_INFO, "VK_InitDevice(%s): dynamicRendering=%d, dynamicBlending=%d, dynamicLogicOp=%d, dynamicStencil=%d",
device->name, device->dynamicRendering, device->dynamicBlending, device->dynamicLogicOp, device->dynamicStencil);
#define DEVICE_PROC(NAME) GET_VK_PROC_RET_FALSE_IF_ERR(geInstance->vkGetDeviceProcAddr, device, device->handle, NAME)
DEVICE_PROC(vkDestroyDevice);
@@ -589,11 +643,21 @@ static jboolean VK_InitDevice(VKDevice* device) {
DEVICE_PROC(vkCmdBlitImage);
DEVICE_PROC(vkCmdPipelineBarrier);
DEVICE_PROC(vkCmdBeginRenderPass);
if (device->dynamicRendering) {
DEVICE_PROC(vkCmdBeginRenderingKHR);
DEVICE_PROC(vkCmdEndRenderingKHR);
}
DEVICE_PROC(vkCmdExecuteCommands);
DEVICE_PROC(vkCmdClearAttachments);
DEVICE_PROC(vkCmdBindPipeline);
DEVICE_PROC(vkCmdSetViewport);
DEVICE_PROC(vkCmdSetScissor);
if (device->dynamicStencil) DEVICE_PROC(vkCmdSetStencilTestEnableEXT);
if (device->dynamicBlending) DEVICE_PROC(vkCmdSetColorBlendEquationEXT);
if (device->dynamicLogicOp) {
DEVICE_PROC(vkCmdSetColorBlendEnableEXT);
DEVICE_PROC(vkCmdSetLogicOpEnableEXT);
}
DEVICE_PROC(vkCmdDraw);
DEVICE_PROC(vkCmdEndRenderPass);
DEVICE_PROC(vkEndCommandBuffer);
@@ -606,25 +670,28 @@ static jboolean VK_InitDevice(VKDevice* device) {
DEVICE_PROC(vkDestroyDescriptorSetLayout);
DEVICE_PROC(vkUpdateDescriptorSets);
DEVICE_PROC(vkCreateDescriptorPool);
DEVICE_PROC(vkDestroyDescriptorPool);
DEVICE_PROC(vkAllocateDescriptorSets);
DEVICE_PROC(vkCmdBindDescriptorSets);
DEVICE_PROC(vkGetImageMemoryRequirements);
DEVICE_PROC(vkGetImageMemoryRequirements2);
DEVICE_PROC(vkCreateBuffer);
DEVICE_PROC(vkGetBufferMemoryRequirements);
DEVICE_PROC(vkDestroyBuffer);
DEVICE_PROC(vkCreateBufferView);
DEVICE_PROC(vkDestroyBufferView);
DEVICE_PROC(vkGetBufferMemoryRequirements2);
DEVICE_PROC(vkBindBufferMemory);
DEVICE_PROC(vkMapMemory);
DEVICE_PROC(vkUnmapMemory);
DEVICE_PROC(vkCmdBindVertexBuffers);
DEVICE_PROC(vkCreateRenderPass);
DEVICE_PROC(vkDestroyRenderPass);
DEVICE_PROC(vkDestroyBuffer);
DEVICE_PROC(vkFreeMemory);
DEVICE_PROC(vkDestroyImageView);
DEVICE_PROC(vkDestroyImage);
DEVICE_PROC(vkDestroyFramebuffer);
DEVICE_PROC(vkFlushMappedMemoryRanges);
DEVICE_PROC(vkInvalidateMappedMemoryRanges);
DEVICE_PROC(vkCmdPushConstants);
DEVICE_PROC(vkCmdCopyBufferToImage);
device->vkGetDeviceQueue(device->handle, device->queueFamily, 0, &device->queue);
if (device->queue == NULL) {
@@ -633,6 +700,13 @@ static jboolean VK_InitDevice(VKDevice* device) {
return JNI_FALSE;
}
device->allocator = VKAllocator_Create(device);
if (!device->allocator) {
J2dRlsTraceLn(J2D_TRACE_ERROR, "Vulkan: Cannot create allocator")
VK_UNHANDLED_ERROR();
return JNI_FALSE;
}
device->renderer = VKRenderer_Create(device);
if (!device->renderer) {
J2dRlsTraceLn(J2D_TRACE_ERROR, "Vulkan: Cannot create renderer")
@@ -663,6 +737,10 @@ VKGraphicsEnvironment* VKGE_graphics_environment() {
*/
JNIEXPORT jboolean JNICALL
Java_sun_java2d_vulkan_VKInstance_initNative(JNIEnv *env, jclass wlge, jlong nativePtr, jboolean verb, jint requestedDevice) {
#ifdef DEBUG
// Init random for debug-related validation tricks.
srand(nativePtr);
#endif
verbose = verb;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = vulkanLibOpen();
if (vkGetInstanceProcAddr == NULL) {

View File

@@ -28,7 +28,6 @@
#define VKBase_h_Included
#include "VKTypes.h"
#include "VKTexturePool.h"
#include "VKRenderState.h"
struct VKDevice {
VkDevice handle;
@@ -38,7 +37,12 @@ struct VKDevice {
pchar* enabledLayers;
pchar* enabledExtensions;
VkQueue queue;
VkBool32 dynamicRendering;
VkBool32 dynamicBlending;
VkBool32 dynamicLogicOp;
VkBool32 dynamicStencil;
VKAllocator* allocator;
VKRenderer* renderer;
VKTexturePool* texturePool;
@@ -73,12 +77,18 @@ struct VKDevice {
PFN_vkBeginCommandBuffer vkBeginCommandBuffer;
PFN_vkCmdBlitImage vkCmdBlitImage;
PFN_vkCmdPipelineBarrier vkCmdPipelineBarrier;
PFN_vkCmdBeginRenderingKHR vkCmdBeginRenderingKHR;
PFN_vkCmdEndRenderingKHR vkCmdEndRenderingKHR;
PFN_vkCmdBeginRenderPass vkCmdBeginRenderPass;
PFN_vkCmdExecuteCommands vkCmdExecuteCommands;
PFN_vkCmdClearAttachments vkCmdClearAttachments;
PFN_vkCmdBindPipeline vkCmdBindPipeline;
PFN_vkCmdSetViewport vkCmdSetViewport;
PFN_vkCmdSetScissor vkCmdSetScissor;
PFN_vkCmdSetStencilTestEnableEXT vkCmdSetStencilTestEnableEXT;
PFN_vkCmdSetColorBlendEquationEXT vkCmdSetColorBlendEquationEXT;
PFN_vkCmdSetColorBlendEnableEXT vkCmdSetColorBlendEnableEXT;
PFN_vkCmdSetLogicOpEnableEXT vkCmdSetLogicOpEnableEXT;
PFN_vkCmdDraw vkCmdDraw;
PFN_vkCmdEndRenderPass vkCmdEndRenderPass;
PFN_vkEndCommandBuffer vkEndCommandBuffer;
@@ -91,25 +101,28 @@ struct VKDevice {
PFN_vkDestroyDescriptorSetLayout vkDestroyDescriptorSetLayout;
PFN_vkUpdateDescriptorSets vkUpdateDescriptorSets;
PFN_vkCreateDescriptorPool vkCreateDescriptorPool;
PFN_vkDestroyDescriptorPool vkDestroyDescriptorPool;
PFN_vkAllocateDescriptorSets vkAllocateDescriptorSets;
PFN_vkCmdBindDescriptorSets vkCmdBindDescriptorSets;
PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements;
PFN_vkGetImageMemoryRequirements2 vkGetImageMemoryRequirements2;
PFN_vkCreateBuffer vkCreateBuffer;
PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements;
PFN_vkDestroyBuffer vkDestroyBuffer;
PFN_vkCreateBufferView vkCreateBufferView;
PFN_vkDestroyBufferView vkDestroyBufferView;
PFN_vkGetBufferMemoryRequirements2 vkGetBufferMemoryRequirements2;
PFN_vkBindBufferMemory vkBindBufferMemory;
PFN_vkMapMemory vkMapMemory;
PFN_vkUnmapMemory vkUnmapMemory;
PFN_vkCmdBindVertexBuffers vkCmdBindVertexBuffers;
PFN_vkCreateRenderPass vkCreateRenderPass;
PFN_vkDestroyRenderPass vkDestroyRenderPass;
PFN_vkDestroyBuffer vkDestroyBuffer;
PFN_vkFreeMemory vkFreeMemory;
PFN_vkDestroyImageView vkDestroyImageView;
PFN_vkDestroyImage vkDestroyImage;
PFN_vkDestroyFramebuffer vkDestroyFramebuffer;
PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges;
PFN_vkInvalidateMappedMemoryRanges vkInvalidateMappedMemoryRanges;
PFN_vkCmdPushConstants vkCmdPushConstants;
PFN_vkCmdCopyBufferToImage vkCmdCopyBufferToImage;
};
struct VKGraphicsEnvironment {

View File

@@ -1,216 +0,0 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, JetBrains s.r.o.. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <malloc.h>
#include <string.h>
#include "jlong.h"
#include "SurfaceData.h"
#include "VKUtil.h"
#include "VKBlitLoops.h"
#include "VKSurfaceData.h"
#include "VKRenderer.h"
#include "Trace.h"
#include "VKImage.h"
#include "VKRenderer.h"
#include "VKImage.h"
#include "VKBuffer.h"
#include "CArrayUtil.h"
static void VKBlitSwToTextureViaPooledTexture(VKRenderingContext* context, VKImage* dest, const SurfaceDataRasInfo *srcInfo,
int dx1, int dy1, int dx2, int dy2) {
const int sw = srcInfo->bounds.x2 - srcInfo->bounds.x1;
const int sh = srcInfo->bounds.y2 - srcInfo->bounds.y1;
const int dw = dx2 - dx1;
const int dh = dy2 - dy1;
if (dw < sw || dh < sh) {
J2dTraceLn4(J2D_TRACE_ERROR, "replaceTextureRegion: dest size: (%d, %d) less than source size: (%d, %d)", dw, dh, sw, sh);
return;
}
float width = dest->extent.width/2.0;
float height = dest->extent.height/2.0;
J2dRlsTraceLn2(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: FILL_PARALLELOGRAM(W=%f, H=%f)",
width, height);
VKTxVertex* vertices = ARRAY_ALLOC(VKTxVertex, 4);
/*
* (p1)---------(p2)
* | |
* | |
* | |
* (p4)---------(p3)
*/
float p1x = -1.0f + dx1 / width;
float p1y = -1.0f + dy1 / height;
float p2x = -1.0f + dx2 / width;
float p2y = -1.0f + dy1 / height;
float p3x = -1.0f + dx2 / width;
float p3y = -1.0f + dy2 / height;
float p4x = -1.0f + dx1 / width;
float p4y = -1.0f + dy2 / height;
ARRAY_PUSH_BACK(vertices, ((VKTxVertex) {p1x, p1y, 0.0f, 0.0f}));
ARRAY_PUSH_BACK(vertices, ((VKTxVertex) {p2x, p2y, 1.0f, 0.0f}));
ARRAY_PUSH_BACK(vertices, ((VKTxVertex) {p4x, p4y, 0.0f, 1.0f}));
ARRAY_PUSH_BACK(vertices, ((VKTxVertex) {p3x, p3y, 1.0f, 1.0f}));
VKBuffer* renderVertexBuffer = ARRAY_TO_VERTEX_BUF(context->surface->device, vertices);
ARRAY_FREE(vertices);
VKSDOps* surface = context->surface;
VKRenderer_Render(surface);
const char *raster = srcInfo->rasBase;
raster += (uint32_t)srcInfo->bounds.y1 * (uint32_t)srcInfo->scanStride + (uint32_t)srcInfo->bounds.x1 * (uint32_t)srcInfo->pixelStride;
VKImage *image = VKImage_Create(context->surface->device, sw, sh, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_TILING_LINEAR,
VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT,
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
J2dTraceLn4(J2D_TRACE_VERBOSE, "replaceTextureRegion src (dw, dh) : [%d, %d] dest (dx1, dy1) =[%d, %d]",
dw, dh, dx1, dy1);
uint32_t dataSize = sw * sh * srcInfo->pixelStride;
char* data = malloc(dataSize);
// copy src pixels inside src bounds to buff
for (int row = 0; row < sh; row++) {
memcpy(data + (row * sw * srcInfo->pixelStride), raster, sw * srcInfo->pixelStride);
raster += (uint32_t)srcInfo->scanStride;
}
VKBuffer *buffer = VKBuffer_CreateFromData(context->surface->device, data, dataSize);
//free(data);
VKImage_LoadBuffer(context, image, buffer, dx1, dy1, sw, sh);
VKRenderer_TextureRender(context, dest, image, renderVertexBuffer->buffer, 4);
//VKRenderer_EndRendering(logicalDevice, VK_FALSE, VK_FALSE);
VKRenderer_FlushRenderPass(context->surface);
}
void VKBlitLoops_IsoBlit(JNIEnv *env,
VKRenderingContext* context, jlong pSrcOps, jlong pDstOps,
jboolean xform, jint hint,
jboolean texture,
jint sx1, jint sy1,
jint sx2, jint sy2,
jdouble dx1, jdouble dy1,
jdouble dx2, jdouble dy2)
{
J2dRlsTraceLn8(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: BLIT_IsoBlit (%d %d %d %d) -> (%f %f %f %f) ",
sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2);
J2dRlsTraceLn2(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: BLIT_IsoBlit texture=%d xform=%d",
texture, xform)
}
void VKBlitLoops_Blit(JNIEnv *env,
VKRenderingContext* context, jlong pSrcOps, jlong pDstOps,
jboolean xform, jint hint,
jint srctype, jboolean texture,
jint sx1, jint sy1,
jint sx2, jint sy2,
jdouble dx1, jdouble dy1,
jdouble dx2, jdouble dy2)
{
J2dRlsTraceLn8(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: BLIT_Blit (%d %d %d %d) -> (%f %f %f %f) ",
sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2)
J2dRlsTraceLn3(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: BLIT_Blit texture=%d xform=%d srctype=%d",
texture, xform, srctype)
SurfaceDataOps *srcOps = (SurfaceDataOps *)jlong_to_ptr(pSrcOps);
VKSDOps *dstOps = (VKSDOps *)jlong_to_ptr(pDstOps);
RETURN_IF_NULL(context);
RETURN_IF_NULL(srcOps);
RETURN_IF_NULL(dstOps);
VKImage *dest = dstOps->image;
if (dest == NULL) {
J2dTraceLn(J2D_TRACE_ERROR, "MTLBlitLoops_Blit: dest is null");
return;
}
// if (srctype < 0 || srctype >= sizeof(RasterFormatInfos)/ sizeof(MTLRasterFormatInfo)) {
// J2dTraceLn1(J2D_TRACE_ERROR, "MTLBlitLoops_Blit: source pixel format %d isn't supported", srctype);
// return;
// }
const jint sw = sx2 - sx1;
const jint sh = sy2 - sy1;
const jint dw = dx2 - dx1;
const jint dh = dy2 - dy1;
if (sw <= 0 || sh <= 0 || dw <= 0 || dh <= 0) {
J2dTraceLn(J2D_TRACE_ERROR, "MTLBlitLoops_Blit: invalid dimensions");
return;
}
// if (!xform) {
// clipDestCoords(
// &dx1, &dy1, &dx2, &dy2,
// &sx1, &sy1, &sx2, &sy2,
// dest.width, dest.height, texture ? NULL : [mtlc.clip getRect]
// );
// }
SurfaceDataRasInfo srcInfo;
srcInfo.bounds.x1 = sx1;
srcInfo.bounds.y1 = sy1;
srcInfo.bounds.x2 = sx2;
srcInfo.bounds.y2 = sy2;
// NOTE: This function will modify the contents of the bounds field to represent the maximum available raster data.
if (srcOps->Lock(env, srcOps, &srcInfo, SD_LOCK_READ) != SD_SUCCESS) {
J2dTraceLn(J2D_TRACE_WARNING, "MTLBlitLoops_Blit: could not acquire lock");
return;
}
if (srcInfo.bounds.x2 > srcInfo.bounds.x1 && srcInfo.bounds.y2 > srcInfo.bounds.y1) {
srcOps->GetRasInfo(env, srcOps, &srcInfo);
if (srcInfo.rasBase) {
if (srcInfo.bounds.x1 != sx1) {
const int dx = srcInfo.bounds.x1 - sx1;
dx1 += dx * (dw / sw);
}
if (srcInfo.bounds.y1 != sy1) {
const int dy = srcInfo.bounds.y1 - sy1;
dy1 += dy * (dh / sh);
}
if (srcInfo.bounds.x2 != sx2) {
const int dx = srcInfo.bounds.x2 - sx2;
dx2 += dx * (dw / sw);
}
if (srcInfo.bounds.y2 != sy2) {
const int dy = srcInfo.bounds.y2 - sy2;
dy2 += dy * (dh / sh);
}
// MTLRasterFormatInfo rfi = RasterFormatInfos[srctype];
//
// if (texture) {
// replaceTextureRegion(mtlc, dest, &srcInfo, &rfi, (int) dx1, (int) dy1, (int) dx2, (int) dy2);
// } else {
VKBlitSwToTextureViaPooledTexture(context, dest, &srcInfo, dx1, dy1, dx2, dy2);
// }
}
SurfaceData_InvokeRelease(env, srcOps, &srcInfo);
}
SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
}

View File

@@ -1,60 +0,0 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, JetBrains s.r.o.. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifndef VKBlitLoops_h_Included
#define VKBlitLoops_h_Included
#include "jni.h"
#include "sun_java2d_vulkan_VKBlitLoops.h"
#include "VKBase.h"
#define OFFSET_SRCTYPE sun_java2d_vulkan_VKBlitLoops_OFFSET_SRCTYPE
#define OFFSET_HINT sun_java2d_vulkan_VKBlitLoops_OFFSET_HINT
#define OFFSET_TEXTURE sun_java2d_vulkan_VKBlitLoops_OFFSET_TEXTURE
#define OFFSET_RTT sun_java2d_vulkan_VKBlitLoops_OFFSET_RTT
#define OFFSET_XFORM sun_java2d_vulkan_VKBlitLoops_OFFSET_XFORM
#define OFFSET_ISOBLIT sun_java2d_vulkan_VKBlitLoops_OFFSET_ISOBLIT
void VKBlitLoops_IsoBlit(JNIEnv *env,
VKRenderingContext* context, jlong pSrcOps, jlong pDstOps,
jboolean xform, jint hint,
jboolean texture,
jint sx1, jint sy1,
jint sx2, jint sy2,
jdouble dx1, jdouble dy1,
jdouble dx2, jdouble dy2);
void VKBlitLoops_Blit(JNIEnv *env,
VKRenderingContext* context, jlong pSrcOps, jlong pDstOps,
jboolean xform, jint hint,
jint srctype, jboolean texture,
jint sx1, jint sy1,
jint sx2, jint sy2,
jdouble dx1, jdouble dy1,
jdouble dx2, jdouble dy2);
#endif /* VKBlitLoops_h_Included */

View File

@@ -24,118 +24,155 @@
* questions.
*/
#include <assert.h>
#include <string.h>
#include "VKUtil.h"
#include "VKAllocator.h"
#include "VKBase.h"
#include "VKBuffer.h"
VkResult VKBuffer_FindMemoryType(VkPhysicalDevice physicalDevice, uint32_t typeFilter,
VkMemoryPropertyFlags properties, uint32_t* pMemoryType) {
VKGraphicsEnvironment* ge = VKGE_graphics_environment();
VkPhysicalDeviceMemoryProperties memProperties;
ge->vkGetPhysicalDeviceMemoryProperties(physicalDevice, &memProperties);
for (uint32_t i = 0; i < memProperties.memoryTypeCount; i++) {
if ((typeFilter & (1 << i)) && (memProperties.memoryTypes[i].propertyFlags & properties) == properties) {
*pMemoryType = i;
return VK_SUCCESS;
}
static VKMemory VKBuffer_DestroyBuffersOnFailure(VKDevice* device, VKMemory page, uint32_t bufferCount, VKBuffer* buffers) {
assert(device != NULL && device->allocator != NULL);
for (uint32_t i = 0; i < bufferCount; i++) {
device->vkDestroyBuffer(device->handle, buffers[i].handle, NULL);
}
return VK_ERROR_UNKNOWN;
VKAllocator_Free(device->allocator, page);
return VK_NULL_HANDLE;
}
VKBuffer* VKBuffer_Create(VKDevice* device, VkDeviceSize size,
VkBufferUsageFlags usage, VkMemoryPropertyFlags properties)
{
VKBuffer* buffer = calloc(1, sizeof(VKBuffer));
VK_RUNTIME_ASSERT(buffer);
VKMemory VKBuffer_CreateBuffers(VKDevice* device, VkBufferUsageFlags usageFlags,
VKAllocator_FindMemoryTypeCallback findMemoryTypeCallback,
VkDeviceSize bufferSize, VkDeviceSize pageSize,
uint32_t* bufferCount, VKBuffer* buffers) {
assert(device != NULL && device->allocator != NULL);
assert(bufferCount != NULL && buffers != NULL);
assert(pageSize == 0 || pageSize >= bufferSize);
if (*bufferCount == 0 || bufferSize == 0) return VK_NULL_HANDLE;
VKAllocator* alloc = device->allocator;
// Create a single buffer.
VkBufferCreateInfo bufferInfo = {
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
.size = size,
.usage = usage,
.size = bufferSize,
.usage = usageFlags,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE
};
VK_IF_ERROR(device->vkCreateBuffer(device->handle, &bufferInfo, NULL, &buffers[0].handle)) return VK_NULL_HANDLE;
VK_IF_ERROR(device->vkCreateBuffer(device->handle, &bufferInfo, NULL, &buffer->buffer)) {
VKBuffer_free(device, buffer);
return NULL;
// Check memory requirements. We aim to create maxBufferCount buffers,
// but due to implementation-specific alignment requirements this number can be lower (unlikely though).
VKMemoryRequirements requirements = VKAllocator_BufferRequirements(alloc, buffers[0].handle);
VKAllocator_PadToAlignment(&requirements); // Align for array-like allocation.
VkDeviceSize realBufferSize = requirements.requirements.memoryRequirements.size;
if (pageSize == 0) pageSize = (*bufferCount) * realBufferSize;
uint32_t realBufferCount = pageSize / realBufferSize;
if (realBufferCount > *bufferCount) realBufferCount = *bufferCount;
if (realBufferCount == 0) return VKBuffer_DestroyBuffersOnFailure(device, VK_NULL_HANDLE, 1, buffers);
requirements.requirements.memoryRequirements.size = pageSize;
// Find memory type.
findMemoryTypeCallback(&requirements);
if (requirements.memoryType == VK_NO_MEMORY_TYPE) {
return VKBuffer_DestroyBuffersOnFailure(device, VK_NULL_HANDLE, 1, buffers);
}
buffer->size = size;
// Allocate new memory page.
VKMemory page = VKAllocator_Allocate(&requirements);
if (page == VK_NULL_HANDLE) return VKBuffer_DestroyBuffersOnFailure(device, VK_NULL_HANDLE, 1, buffers);
void* data = VKAllocator_Map(alloc, page);
if (data == NULL) return VKBuffer_DestroyBuffersOnFailure(device, page, 1, buffers);
VkMappedMemoryRange range = VKAllocator_GetMemoryRange(alloc, page);
VkMemoryRequirements memRequirements;
device->vkGetBufferMemoryRequirements(device->handle, buffer->buffer, &memRequirements);
uint32_t memoryType;
VK_IF_ERROR(VKBuffer_FindMemoryType(device->physicalDevice,
memRequirements.memoryTypeBits,
properties, &memoryType)) {
VKBuffer_free(device, buffer);
return NULL;
// Create remaining buffers and bind memory.
for (uint32_t i = 0;;) {
VKBuffer* b = &buffers[i];
b->range = (VkMappedMemoryRange) {
.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
.memory = range.memory,
.offset = range.offset + realBufferSize * i,
.size = realBufferSize
};
b->data = (void*) (((uint8_t*) data) + realBufferSize * i);
VK_IF_ERROR(device->vkBindBufferMemory(device->handle, b->handle, range.memory, b->range.offset)) {
return VKBuffer_DestroyBuffersOnFailure(device, page, i + 1, buffers);
}
if ((++i) >= realBufferCount) break;
VK_IF_ERROR(device->vkCreateBuffer(device->handle, &bufferInfo, NULL, &buffers[i].handle)) {
return VKBuffer_DestroyBuffersOnFailure(device, page, i, buffers);
}
}
VkMemoryAllocateInfo allocInfo = {
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
.allocationSize = memRequirements.size,
.memoryTypeIndex = memoryType
};
VK_IF_ERROR(device->vkAllocateMemory(device->handle, &allocInfo, NULL, &buffer->memory)) {
VKBuffer_free(device, buffer);
return NULL;
}
VK_IF_ERROR(device->vkBindBufferMemory(device->handle, buffer->buffer, buffer->memory, 0)) {
VKBuffer_free(device, buffer);
return NULL;
}
return buffer;
*bufferCount = realBufferCount;
return page;
}
VKBuffer* VKBuffer_CreateFromData(VKDevice* device, void* vertices, VkDeviceSize bufferSize)
{
VKBuffer* buffer = VKBuffer_Create(device, bufferSize,
VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
void* data;
VK_IF_ERROR(device->vkMapMemory(device->handle, buffer->memory, 0, VK_WHOLE_SIZE, 0, &data)) {
VKBuffer_free(device, buffer);
return NULL;
static VkDescriptorPool VKBuffer_DestroyTexelBuffersOnFailure(VKDevice* device, VkDescriptorPool pool, uint32_t bufferCount, VKTexelBuffer* texelBuffers) {
assert(device != NULL);
for (uint32_t i = 0; i < bufferCount; i++) {
device->vkDestroyBufferView(device->handle, texelBuffers[i].view, NULL);
}
memcpy(data, vertices, bufferSize);
device->vkDestroyDescriptorPool(device->handle, pool, NULL);
return VK_NULL_HANDLE;
}
VkMappedMemoryRange memoryRange = {
.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
.pNext = NULL,
.memory = buffer->memory,
VkDescriptorPool VKBuffer_CreateTexelBuffers(VKDevice* device, VkFormat format,
VkDescriptorType descriptorType, VkDescriptorSetLayout descriptorSetLayout,
uint32_t bufferCount, VKBuffer* buffers, VKTexelBuffer* texelBuffers) {
assert(device != NULL);
// Create descriptor pool.
VkDescriptorPoolSize poolSize = { .type = descriptorType, .descriptorCount = bufferCount };
VkDescriptorPoolCreateInfo descriptorPoolCreateInfo = {
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
.flags = 0,
.maxSets = bufferCount,
.poolSizeCount = 1,
.pPoolSizes = &poolSize
};
VkDescriptorPool pool;
VK_IF_ERROR(device->vkCreateDescriptorPool(device->handle, &descriptorPoolCreateInfo, NULL, &pool)) return VK_NULL_HANDLE;
// Allocate descriptor sets.
VkDescriptorSetLayout layouts[bufferCount];
for (uint32_t i = 0; i < bufferCount; i++) layouts[i] = descriptorSetLayout;
VkDescriptorSetAllocateInfo allocateInfo = {
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
.descriptorPool = pool,
.descriptorSetCount = bufferCount,
.pSetLayouts = layouts
};
VkDescriptorSet descriptorSets[bufferCount];
VK_IF_ERROR(device->vkAllocateDescriptorSets(device->handle, &allocateInfo, descriptorSets)) {
return VKBuffer_DestroyTexelBuffersOnFailure(device, pool, 0, texelBuffers);
}
// Create buffer views and record them into descriptors.
VkBufferViewCreateInfo bufferViewCreateInfo = {
.sType = VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO,
.format = format,
.offset = 0,
.size = VK_WHOLE_SIZE
.range = VK_WHOLE_SIZE
};
VK_IF_ERROR(device->vkFlushMappedMemoryRanges(device->handle, 1, &memoryRange)) {
VKBuffer_free(device, buffer);
return NULL;
VkWriteDescriptorSet writeDescriptorSets[bufferCount];
for (uint32_t i = 0; i < bufferCount; i++) {
texelBuffers[i] = (VKTexelBuffer) {
.buffer = buffers[i],
.descriptorSet = descriptorSets[i]
};
bufferViewCreateInfo.buffer = buffers[i].handle;
VK_IF_ERROR(device->vkCreateBufferView(device->handle, &bufferViewCreateInfo, NULL, &texelBuffers[i].view)) {
return VKBuffer_DestroyTexelBuffersOnFailure(device, pool, i, texelBuffers);
}
writeDescriptorSets[i] = (VkWriteDescriptorSet) {
.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
.dstSet = descriptorSets[i],
.dstBinding = 0,
.dstArrayElement = 0,
.descriptorCount = 1,
.descriptorType = descriptorType,
.pTexelBufferView = &texelBuffers[i].view
};
}
device->vkUnmapMemory(device->handle, buffer->memory);
buffer->size = bufferSize;
return buffer;
device->vkUpdateDescriptorSets(device->handle, bufferCount, writeDescriptorSets, 0, NULL);
return pool;
}
void VKBuffer_free(VKDevice* device, VKBuffer* buffer) {
if (buffer != NULL) {
if (buffer->buffer != VK_NULL_HANDLE) {
device->vkDestroyBuffer(device->handle, buffer->buffer, NULL);
}
if (buffer->memory != VK_NULL_HANDLE) {
device->vkFreeMemory(device->handle, buffer->memory, NULL);
}
free(buffer);
}
}

View File

@@ -29,23 +29,42 @@
#include "VKTypes.h"
#define ARRAY_TO_VERTEX_BUF(device, vertices) \
VKBuffer_CreateFromData(device, vertices, ARRAY_SIZE(vertices)*sizeof (vertices[0]))
struct VKBuffer {
VkBuffer buffer;
VkDeviceMemory memory;
VkDeviceSize size;
VkBuffer handle;
// Buffer has no ownership over its memory.
// Provided memory, offset and size must only be used to flush memory writes.
// Allocation and freeing is done in pages.
VkMappedMemoryRange range;
// Only sequential writes and no reads from mapped memory!
void* data;
};
VkResult VKBuffer_FindMemoryType(VkPhysicalDevice physicalDevice, uint32_t typeFilter,
VkMemoryPropertyFlags properties, uint32_t* pMemoryType);
struct VKTexelBuffer {
VKBuffer buffer;
VkBufferView view;
VkDescriptorSet descriptorSet;
};
VKBuffer* VKBuffer_Create(VKDevice* device, VkDeviceSize size,
VkBufferUsageFlags usage, VkMemoryPropertyFlags properties);
/**
* Create buffers, allocate a memory page and bind them together.
* 'pageSize' can be 0, meaning that page size is calculated based on buffer memory requirements.
* It returns allocated memory page, or VK_NULL_HANDLE on failure.
* 'bufferCount' is updated with actual number of created buffers.
* Created buffers are written in 'buffers'.
*/
VKMemory VKBuffer_CreateBuffers(VKDevice* device, VkBufferUsageFlags usageFlags,
VKAllocator_FindMemoryTypeCallback findMemoryTypeCallback,
VkDeviceSize bufferSize, VkDeviceSize pageSize,
uint32_t* bufferCount, VKBuffer* buffers);
VKBuffer* VKBuffer_CreateFromData(VKDevice* device, void* vertices, VkDeviceSize bufferSize);
void VKBuffer_free(VKDevice* device, VKBuffer* buffer);
/**
* Create texel buffers from existing array of buffers.
* It returns created descriptor pool, or VK_NULL_HANDLE on failure.
* Created texel buffers are written in 'texelBuffers',
* original buffers are taken from 'buffers'.
*/
VkDescriptorPool VKBuffer_CreateTexelBuffers(VKDevice* device, VkFormat format,
VkDescriptorType descriptorType, VkDescriptorSetLayout descriptorSetLayout,
uint32_t bufferCount, VKBuffer* buffers, VKTexelBuffer* texelBuffers);
#endif // VKBuffer_h_Included

View File

@@ -24,46 +24,57 @@
* questions.
*/
#include <assert.h>
#include "VKUtil.h"
#include "VKAllocator.h"
#include "VKBase.h"
#include "VKBuffer.h"
#include "VKImage.h"
#include "VKRenderer.h"
#include "VKSurfaceData.h"
VkBool32 VKImage_CreateView(VKDevice* device, VKImage* image) {
static VkBool32 VKImage_CreateViews(VKDevice* device, VKImage* image) {
VkImageViewCreateInfo viewInfo = {
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = image->image,
.image = image->handle,
.viewType = VK_IMAGE_VIEW_TYPE_2D,
.format = image->format,
.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.subresourceRange.aspectMask = VKImage_GetAspect(image),
.subresourceRange.baseMipLevel = 0,
.subresourceRange.levelCount = 1,
.subresourceRange.baseArrayLayer = 0,
.subresourceRange.layerCount = 1,
};
VK_IF_ERROR(device->vkCreateImageView(device->handle, &viewInfo, NULL, &image->view)) {
return VK_FALSE;
FormatGroup formatGroup = VKUtil_GetFormatGroup(image->format);
if (formatGroup.bytes == 0) formatGroup.aliases[FORMAT_ALIAS_UNORM] = image->format;
SET_FORMAT_ALIASED_HANDLE(image->view, formatGroup.aliases, alias) {
viewInfo.format = formatGroup.aliases[alias];
VK_IF_ERROR(device->vkCreateImageView(device->handle, &viewInfo, NULL, &image->view[alias])) {
return VK_FALSE;
}
}
return VK_TRUE;
}
VkImageAspectFlagBits VKImage_GetAspect(VKImage* image) {
return VKUtil_GetFormatGroup(image->format).bytes == 0 ? // Unknown format group means stencil.
VK_IMAGE_ASPECT_STENCIL_BIT : VK_IMAGE_ASPECT_COLOR_BIT;
}
VKImage* VKImage_Create(VKDevice* device, uint32_t width, uint32_t height,
VkFormat format, VkImageTiling tiling,
VkImageUsageFlags usage,
VkMemoryPropertyFlags properties)
{
VkImageCreateFlags flags, VkFormat format,
VkImageTiling tiling, VkImageUsageFlags usage, VkSampleCountFlagBits samples,
VKAllocator_FindMemoryTypeCallback findMemoryTypeCallback) {
assert(device != NULL && device->allocator != NULL);
VKImage* image = calloc(1, sizeof(VKImage));
VK_RUNTIME_ASSERT(image);
image->format = format;
image->extent = (VkExtent2D) {width, height};
image->layout = VK_IMAGE_LAYOUT_UNDEFINED;
image->lastStage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
image->lastAccess = 0;
VkImageCreateInfo imageInfo = {
VkImageCreateInfo createInfo = {
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
.flags = flags,
.imageType = VK_IMAGE_TYPE_2D,
.extent.width = width,
.extent.height = height,
@@ -74,94 +85,41 @@ VKImage* VKImage_Create(VKDevice* device, uint32_t width, uint32_t height,
.tiling = tiling,
.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED,
.usage = usage,
.samples = VK_SAMPLE_COUNT_1_BIT,
.samples = samples,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE
};
VK_IF_ERROR(device->vkCreateImage(device->handle, &imageInfo, NULL, &image->image)) {
VKImage_free(device, image);
VK_IF_ERROR(device->vkCreateImage(device->handle, &createInfo, NULL, &image->handle)) {
VKImage_Destroy(device, image);
return NULL;
}
VkMemoryRequirements memRequirements;
device->vkGetImageMemoryRequirements(device->handle, image->image, &memRequirements);
uint32_t memoryType;
VK_IF_ERROR(VKBuffer_FindMemoryType(device->physicalDevice,
memRequirements.memoryTypeBits,
properties, &memoryType))
{
VKImage_free(device, image);
VKMemoryRequirements requirements = VKAllocator_ImageRequirements(device->allocator, image->handle);
findMemoryTypeCallback(&requirements);
if (requirements.memoryType == VK_NO_MEMORY_TYPE) {
VKImage_Destroy(device, image);
return NULL;
}
VkMemoryAllocateInfo allocInfo = {
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
.allocationSize = memRequirements.size,
.memoryTypeIndex = memoryType
};
VK_IF_ERROR(device->vkAllocateMemory(device->handle, &allocInfo, NULL, &image->memory)) {
VKImage_free(device, image);
image->memory = VKAllocator_AllocateForImage(&requirements, image->handle);
if (image->memory == VK_NULL_HANDLE) {
VKImage_Destroy(device, image);
return NULL;
}
VK_IF_ERROR(device->vkBindImageMemory(device->handle, image->image, image->memory, 0)) {
VKImage_free(device, image);
return NULL;
}
if (!VKImage_CreateView(device, image)) {
VKImage_free(device, image);
if (!VKImage_CreateViews(device, image)) {
VKImage_Destroy(device, image);
return NULL;
}
return image;
}
void VKImage_LoadBuffer(VKRenderingContext* context, VKImage* image, VKBuffer* buffer,
uint32_t x0, uint32_t y0, uint32_t width, uint32_t height) {
VkCommandBuffer cb = VKRenderer_Render(context->surface);
VKDevice *device = context->surface->device;
VkBufferImageCopy region = (VkBufferImageCopy){
.bufferOffset = 0,
.bufferRowLength = 0,
.bufferImageHeight = 0,
.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.imageSubresource.mipLevel = 0,
.imageSubresource.baseArrayLayer = 0,
.imageSubresource.layerCount = 1,
.imageOffset = {x0, y0, 0},
.imageExtent = {
.width = width,
.height = height,
.depth = 1
}
};
J2dRlsTraceLn4(J2D_TRACE_VERBOSE, "VKImage_LoadBuffer(device=%p, commandBuffer=%p, buffer=%p, image=%p)",
device, cb, buffer->buffer, image->image);
device->vkCmdCopyBufferToImage(cb, buffer->buffer, image->image,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
1, &region);
}
void VKImage_free(VKDevice* device, VKImage* image) {
if (!image) return;
if (image->view != VK_NULL_HANDLE) {
device->vkDestroyImageView(device->handle, image->view, NULL);
image->view = VK_NULL_HANDLE;
}
if (image->memory != VK_NULL_HANDLE) {
device->vkFreeMemory(device->handle, image->memory, NULL);
image->memory = VK_NULL_HANDLE;
}
if (image->image != VK_NULL_HANDLE) {
device->vkDestroyImage(device->handle, image->image, NULL);
image->image = VK_NULL_HANDLE;
}
void VKImage_Destroy(VKDevice* device, VKImage* image) {
assert(device != NULL && device->allocator != NULL);
if (image == NULL) return;
SET_FORMAT_ALIASED_HANDLE(image->view, image->view, alias)
device->vkDestroyImageView(device->handle, image->view[alias], NULL);
device->vkDestroyImage(device->handle, image->handle, NULL);
VKAllocator_Free(device->allocator, image->memory);
free(image);
}

View File

@@ -28,22 +28,26 @@
#define VKImage_h_Included
#include "VKTypes.h"
#include "VKAllocator.h"
struct VKImage {
VkImage image;
VkDeviceMemory memory;
VkImageView view;
VkFormat format;
VkExtent2D extent;
VkImage handle;
VKMemory memory;
VkImageView view FORMAT_ALIASED;
VkFormat format;
VkExtent2D extent;
VkImageLayout layout;
VkPipelineStageFlagBits lastStage;
VkAccessFlagBits lastAccess;
};
VkImageAspectFlagBits VKImage_GetAspect(VKImage* image);
VKImage* VKImage_Create(VKDevice* device, uint32_t width, uint32_t height,
VkFormat format, VkImageTiling tiling,
VkImageUsageFlags usage,
VkMemoryPropertyFlags properties);
VkImageCreateFlags flags, VkFormat format,
VkImageTiling tiling, VkImageUsageFlags usage, VkSampleCountFlagBits samples,
VKAllocator_FindMemoryTypeCallback findMemoryTypeCallback);
void VKImage_LoadBuffer(VKRenderingContext* context, VKImage* image, VKBuffer* buffer,
uint32_t x0, uint32_t y0, uint32_t width, uint32_t height);
void VKImage_free(VKDevice* device, VKImage* image);
void VKImage_Destroy(VKDevice* device, VKImage* image);
#endif // VKImage_h_Included

View File

@@ -34,15 +34,17 @@
#undef SHADER_ENTRY
#undef BYTECODE_END
struct VKPipelineSet {
typedef struct VKPipelineSet {
VkPipeline pipelines[PIPELINE_COUNT];
};
VKPipelineSetDescriptor descriptor;
struct VKPipelineSet* next;
} VKPipelineSet;
struct VKShaders {
typedef struct VKShaders {
# define SHADER_ENTRY(NAME, TYPE) VkPipelineShaderStageCreateInfo NAME ## _ ## TYPE;
# include "vulkan/shader_list.h"
# undef SHADER_ENTRY
};
} VKShaders;
static void VKPipelines_DestroyShaders(VKDevice* device, VKShaders* shaders) {
assert(device != NULL);
@@ -80,27 +82,37 @@ static VKShaders* VKPipelines_CreateShaders(VKDevice* device) {
return shaders;
}
#define MAKE_INPUT_STATE(TYPE, ...) \
static const VkVertexInputAttributeDescription attributes[] = { __VA_ARGS__ }; \
static const VkVertexInputBindingDescription binding = { \
.binding = 0, \
.stride = sizeof(TYPE), \
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX \
}; \
static const VkPipelineVertexInputStateCreateInfo inputState = { \
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, \
.vertexBindingDescriptionCount = 1, \
.pVertexBindingDescriptions = &binding, \
.vertexAttributeDescriptionCount = SARRAY_COUNT_OF(attributes), \
.pVertexAttributeDescriptions = attributes \
}
#define MAKE_INPUT_STATE(NAME, TYPE, ...) \
const VkFormat INPUT_STATE_ATTRIBUTE_FORMATS_##NAME[] = { __VA_ARGS__ }; \
VkVertexInputAttributeDescription \
INPUT_STATE_ATTRIBUTES_##NAME[SARRAY_COUNT_OF(INPUT_STATE_ATTRIBUTE_FORMATS_##NAME)]; \
const VkVertexInputBindingDescription INPUT_STATE_BINDING_##NAME = { \
.binding = 0, \
.stride = sizeof(TYPE), \
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX \
}; \
const VkPipelineVertexInputStateCreateInfo INPUT_STATE_##NAME = { \
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, \
.vertexBindingDescriptionCount = 1, \
.pVertexBindingDescriptions = &INPUT_STATE_BINDING_##NAME, \
.vertexAttributeDescriptionCount = SARRAY_COUNT_OF(INPUT_STATE_ATTRIBUTES_##NAME), \
.pVertexAttributeDescriptions = INPUT_STATE_ATTRIBUTES_##NAME \
}; \
uint32_t INPUT_STATE_BINDING_SIZE_##NAME = 0; \
for (uint32_t i = 0; i < SARRAY_COUNT_OF(INPUT_STATE_ATTRIBUTES_##NAME); i++) { \
INPUT_STATE_ATTRIBUTES_##NAME[i] = (VkVertexInputAttributeDescription) { \
i, 0, INPUT_STATE_ATTRIBUTE_FORMATS_##NAME[i], INPUT_STATE_BINDING_SIZE_##NAME}; \
INPUT_STATE_BINDING_SIZE_##NAME += \
VKUtil_GetFormatGroup(INPUT_STATE_ATTRIBUTE_FORMATS_##NAME[i]).bytes; \
} if (sizeof(TYPE) != INPUT_STATE_BINDING_SIZE_##NAME) VK_FATAL_ERROR("Vertex size mismatch for input state " #NAME)
typedef struct {
VkGraphicsPipelineCreateInfo createInfo;
VkPipelineMultisampleStateCreateInfo multisampleState;
VkPipelineDepthStencilStateCreateInfo depthStencilState;;
VkPipelineColorBlendStateCreateInfo colorBlendState;
VkPipelineDynamicStateCreateInfo dynamicState;
VkDynamicState dynamicStates[2];
VkDynamicState dynamicStates[6];
} PipelineCreateState;
typedef struct {
@@ -137,6 +149,20 @@ static void VKPipelines_InitPipelineCreateState(PipelineCreateState* state) {
.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT
};
const VkStencilOpState stencilOpState = {
.failOp = VK_STENCIL_OP_KEEP,
.passOp = VK_STENCIL_OP_KEEP,
.compareOp = VK_COMPARE_OP_NOT_EQUAL,
.compareMask = 0xFFFFFFFFU,
.writeMask = 0U,
.reference = CLIP_STENCIL_EXCLUDE_VALUE
};
state->depthStencilState = (VkPipelineDepthStencilStateCreateInfo) {
.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
.stencilTestEnable = VK_FALSE,
.front = stencilOpState,
.back = stencilOpState
};
state->colorBlendState = (VkPipelineColorBlendStateCreateInfo) {
.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,
.logicOpEnable = VK_FALSE,
@@ -157,6 +183,7 @@ static void VKPipelines_InitPipelineCreateState(PipelineCreateState* state) {
.pViewportState = &viewportState,
.pRasterizationState = &rasterizationState,
.pMultisampleState = &state->multisampleState,
.pDepthStencilState = &state->depthStencilState,
.pColorBlendState = &state->colorBlendState,
.pDynamicState = &state->dynamicState,
.subpass = 0,
@@ -178,13 +205,40 @@ static const VkPipelineInputAssemblyStateCreateInfo INPUT_ASSEMBLY_STATE_LINE_LI
.topology = VK_PRIMITIVE_TOPOLOGY_LINE_LIST
};
const VkPipelineColorBlendAttachmentState BLEND_STATE = {
.blendEnable = VK_FALSE,
.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT
// Blend states are hard-coded, but can also be loaded dynamically to implement custom composites.
#define DEF_BLEND(NAME, SRC_COLOR, DST_COLOR, SRC_ALPHA, DST_ALPHA) \
{ .blendEnable = VK_TRUE, \
.srcColorBlendFactor = VK_BLEND_FACTOR_ ## SRC_COLOR, \
.dstColorBlendFactor = VK_BLEND_FACTOR_ ## DST_COLOR, \
.colorBlendOp = VK_BLEND_OP_ADD, \
.srcAlphaBlendFactor = VK_BLEND_FACTOR_ ## SRC_ALPHA, \
.dstAlphaBlendFactor = VK_BLEND_FACTOR_ ## DST_ALPHA, \
.alphaBlendOp = VK_BLEND_OP_ADD, \
.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | \
VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT }
const VkPipelineColorBlendAttachmentState COMPOSITE_BLEND_STATES[COMPOSITE_COUNT] = {
{ .blendEnable = VK_FALSE, // LOGIC_XOR
.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT },
// NAME || SRC_COLOR | DST_COLOR | SRC_ALPHA | DST_ALPHA ||
DEF_BLEND(| CLEAR |, ZERO , ZERO , ZERO , ZERO ),
DEF_BLEND(| SRC |, ONE , ZERO , ONE , ZERO ),
DEF_BLEND(| SRC_OVER |, ONE , ONE_MINUS_SRC_ALPHA , ONE , ONE_MINUS_SRC_ALPHA ),
DEF_BLEND(| DST_OVER |, ONE_MINUS_DST_ALPHA , ONE , ONE_MINUS_DST_ALPHA , ONE ),
DEF_BLEND(| SRC_IN |, DST_ALPHA , ZERO , DST_ALPHA , ZERO ),
DEF_BLEND(| DST_IN |, ZERO , SRC_ALPHA , ZERO , SRC_ALPHA ),
DEF_BLEND(| SRC_OUT |, ONE_MINUS_DST_ALPHA , ZERO , ONE_MINUS_DST_ALPHA , ZERO ),
DEF_BLEND(| DST_OUT |, ZERO , ONE_MINUS_SRC_ALPHA , ZERO , ONE_MINUS_SRC_ALPHA ),
DEF_BLEND(| DST |, ZERO , ONE , ZERO , ONE ),
DEF_BLEND(| SRC_ATOP |, DST_ALPHA , ONE_MINUS_SRC_ALPHA , ZERO , ONE ),
DEF_BLEND(| DST_ATOP |, ONE_MINUS_DST_ALPHA , SRC_ALPHA , ONE , ZERO ),
DEF_BLEND(| XOR |, ONE_MINUS_DST_ALPHA , ONE_MINUS_SRC_ALPHA , ONE_MINUS_DST_ALPHA , ONE_MINUS_SRC_ALPHA ),
};
static void VKPipelines_DestroyPipelineSet(VKDevice* device, VKPipelineSet* set) {
assert(device != NULL);
if (set == NULL) return;
for (uint32_t i = 0; i < PIPELINE_COUNT; i++) {
device->vkDestroyPipeline(device->handle, set->pipelines[i], NULL);
@@ -192,21 +246,48 @@ static void VKPipelines_DestroyPipelineSet(VKDevice* device, VKPipelineSet* set)
free(set);
}
static VKPipelineSet* VKPipelines_CreatePipelineSet(VKRenderPassContext* renderPassContext) {
static VKPipelineSet* VKPipelines_CreatePipelineSet(VKRenderPassContext* renderPassContext, VKPipelineSetDescriptor descriptor) {
assert(renderPassContext != NULL && renderPassContext->pipelineContext != NULL);
assert(descriptor.composite < COMPOSITE_COUNT);
VKPipelineContext* pipelineContext = renderPassContext->pipelineContext;
VKPipelineSet* set = calloc(1, sizeof(VKPipelineSet));
VK_RUNTIME_ASSERT(set);
set->descriptor = descriptor;
VKDevice* device = pipelineContext->device;
VKShaders* shaders = pipelineContext->shaders;
// Setup default pipeline parameters.
PipelineCreateState base;
VKPipelines_InitPipelineCreateState(&base);
FormatAlias formatAlias = FORMAT_ALIAS_ORIGINAL;
FormatGroup formatGroup = VKUtil_GetFormatGroup(renderPassContext->format);
if (COMPOSITE_GROUP(descriptor.composite) == LOGIC_COMPOSITE_GROUP) {
// Tweak parameters for logic composite. Make sure to draw into UNORM attachment.
formatAlias = FORMAT_ALIAS_UNORM;
base.colorBlendState.logicOpEnable = VK_TRUE;
}
base.createInfo.layout = pipelineContext->pipelineLayout;
base.createInfo.renderPass = renderPassContext->renderPass;
base.colorBlendState.pAttachments = &BLEND_STATE;
base.createInfo.renderPass = renderPassContext->renderPass[descriptor.stencilMode != STENCIL_MODE_NONE][formatAlias];
base.colorBlendState.pAttachments = &COMPOSITE_BLEND_STATES[descriptor.composite];
if (device->dynamicBlending)
base.dynamicStates[base.dynamicState.dynamicStateCount++] = VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT;
if (device->dynamicLogicOp) {
base.dynamicStates[base.dynamicState.dynamicStateCount++] = VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT;
base.dynamicStates[base.dynamicState.dynamicStateCount++] = VK_DYNAMIC_STATE_LOGIC_OP_ENABLE_EXT;
}
if (descriptor.stencilMode != STENCIL_MODE_NONE && device->dynamicStencil)
base.dynamicStates[base.dynamicState.dynamicStateCount++] = VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT;
if (descriptor.stencilMode == STENCIL_MODE_ON) base.depthStencilState.stencilTestEnable = VK_TRUE;
VkPipelineRenderingCreateInfoKHR renderingCreateInfo = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR,
.viewMask = 0,
.colorAttachmentCount = 1,
.pColorAttachmentFormats = &formatGroup.aliases[formatAlias],
.stencilAttachmentFormat = descriptor.stencilMode == STENCIL_MODE_NONE ?
VK_FORMAT_UNDEFINED : VK_FORMAT_S8_UINT
};
if (device->dynamicRendering) base.createInfo.pNext = &renderingCreateInfo;
assert(base.dynamicState.dynamicStateCount <= SARRAY_COUNT_OF(base.dynamicStates));
ShaderStages stages[PIPELINE_COUNT];
@@ -216,46 +297,40 @@ static VKPipelineSet* VKPipelines_CreatePipelineSet(VKRenderPassContext* renderP
createInfos[i].pStages = stages[i].createInfos;
}
static const VkVertexInputAttributeDescription positionAttribute = {
.location = 0,
.binding = 0,
.format = VK_FORMAT_R32G32_SFLOAT,
.offset = 0
};
static const VkVertexInputAttributeDescription texcoordAttribute = {
.location = 1,
.binding = 0,
.format = VK_FORMAT_R32G32_SFLOAT,
.offset = sizeof(float) * 2
};
// Setup plain color pipelines.
MAKE_INPUT_STATE(COLOR, VKColorVertex, VK_FORMAT_R32G32_SFLOAT, VK_FORMAT_R32G32B32A32_SFLOAT);
createInfos[PIPELINE_DRAW_COLOR].pVertexInputState = createInfos[PIPELINE_FILL_COLOR].pVertexInputState = &INPUT_STATE_COLOR;
createInfos[PIPELINE_FILL_COLOR].pInputAssemblyState = &INPUT_ASSEMBLY_STATE_TRIANGLE_LIST;
createInfos[PIPELINE_DRAW_COLOR].pInputAssemblyState = &INPUT_ASSEMBLY_STATE_LINE_LIST;
stages[PIPELINE_DRAW_COLOR] = stages[PIPELINE_FILL_COLOR] = (ShaderStages) {{ shaders->color_vert, shaders->color_frag }};
{ // Setup plain color pipelines.
MAKE_INPUT_STATE(VKVertex, positionAttribute);
createInfos[PIPELINE_DRAW_COLOR].pVertexInputState = createInfos[PIPELINE_FILL_COLOR].pVertexInputState = &inputState;
createInfos[PIPELINE_FILL_COLOR].pInputAssemblyState = &INPUT_ASSEMBLY_STATE_TRIANGLE_LIST;
createInfos[PIPELINE_DRAW_COLOR].pInputAssemblyState = &INPUT_ASSEMBLY_STATE_LINE_LIST;
stages[PIPELINE_DRAW_COLOR] = stages[PIPELINE_FILL_COLOR] = (ShaderStages) {{ shaders->color_vert, shaders->color_frag }};
}
// Setup blit pipeline.
MAKE_INPUT_STATE(BLIT, VKTxVertex, VK_FORMAT_R32G32_SFLOAT, VK_FORMAT_R32G32_SFLOAT);
createInfos[PIPELINE_BLIT].pVertexInputState = &INPUT_STATE_BLIT;
createInfos[PIPELINE_BLIT].pInputAssemblyState = &INPUT_ASSEMBLY_STATE_TRIANGLE_STRIP;
createInfos[PIPELINE_BLIT].layout = pipelineContext->texturePipelineLayout;
stages[PIPELINE_BLIT] = (ShaderStages) {{ shaders->blit_vert, shaders->blit_frag }};
{ // Setup texture pipeline.
MAKE_INPUT_STATE(VKTxVertex, positionAttribute, texcoordAttribute);
createInfos[PIPELINE_BLIT].pVertexInputState = &inputState;
createInfos[PIPELINE_BLIT].pInputAssemblyState = &INPUT_ASSEMBLY_STATE_TRIANGLE_STRIP;
createInfos[PIPELINE_BLIT].layout = pipelineContext->texturePipelineLayout;
stages[PIPELINE_BLIT] = (ShaderStages) {{ shaders->blit_vert, shaders->blit_frag }};
}
// Setup plain color mask fill pipeline.
MAKE_INPUT_STATE(MASK_FILL_COLOR, VKMaskFillColorVertex, VK_FORMAT_R32G32B32A32_SINT, VK_FORMAT_R32G32B32A32_SFLOAT);
createInfos[PIPELINE_MASK_FILL_COLOR].pVertexInputState = &INPUT_STATE_MASK_FILL_COLOR;
createInfos[PIPELINE_MASK_FILL_COLOR].pInputAssemblyState = &INPUT_ASSEMBLY_STATE_TRIANGLE_LIST;
createInfos[PIPELINE_MASK_FILL_COLOR].layout = pipelineContext->maskFillPipelineLayout;
stages[PIPELINE_MASK_FILL_COLOR] = (ShaderStages) {{ shaders->mask_fill_color_vert, shaders->mask_fill_color_frag }};
// Create pipelines.
// TODO pipeline cache
VK_IF_ERROR(device->vkCreateGraphicsPipelines(device->handle, VK_NULL_HANDLE, PIPELINE_COUNT,
createInfos, NULL, set->pipelines)) VK_UNHANDLED_ERROR();
J2dRlsTraceLn(J2D_TRACE_INFO, "VKPipelines_CreatePipelineSet");
J2dRlsTraceLn2(J2D_TRACE_INFO, "VKPipelines_CreatePipelineSet: composite=%d, stencilMode=%d",
descriptor.composite, descriptor.stencilMode);
return set;
}
static VkResult VKPipelines_InitRenderPass(VKDevice* device, VKRenderPassContext* renderPassContext) {
VkAttachmentDescription colorAttachment = {
.format = renderPassContext->format,
static VkResult VKPipelines_InitRenderPasses(VKDevice* device, VKRenderPassContext* renderPassContext) {
assert(device != NULL && renderPassContext != NULL);
if (device->dynamicRendering) return VK_SUCCESS;
VkAttachmentDescription attachments[] = {{
.samples = VK_SAMPLE_COUNT_1_BIT,
.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
@@ -263,44 +338,74 @@ static VkResult VKPipelines_InitRenderPass(VKDevice* device, VKRenderPassContext
.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE,
.initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
.finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL
};
}, {
.format = VK_FORMAT_S8_UINT,
.samples = VK_SAMPLE_COUNT_1_BIT,
.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE,
.storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE,
.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
.stencilStoreOp = VK_ATTACHMENT_STORE_OP_STORE,
.initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL
}};
VkAttachmentReference colorReference = {
.attachment = 0,
.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL
};
VkAttachmentReference stencilReference = {
.attachment = 1,
.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL
};
VkSubpassDescription subpassDescription = {
.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS,
.colorAttachmentCount = 1,
.pColorAttachments = &colorReference
};
// TODO this is probably not needed?
// // Subpass dependencies for layout transitions
// VkSubpassDependency dependency = {
// .srcSubpass = VK_SUBPASS_EXTERNAL,
// .dstSubpass = 0,
// .srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
// .dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
// .srcAccessMask = 0,
// .dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT
// };
VkRenderPassCreateInfo createInfo = {
.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
.attachmentCount = 1,
.pAttachments = &colorAttachment,
.pAttachments = attachments,
.subpassCount = 1,
.pSubpasses = &subpassDescription,
.dependencyCount = 0,
.pDependencies = NULL
};
return device->vkCreateRenderPass(device->handle, &createInfo, NULL, &renderPassContext->renderPass);
FormatGroup formatGroup = VKUtil_GetFormatGroup(renderPassContext->format);
for (uint32_t i = 0; i < 2; i++) {
if (i == 1) {
createInfo.attachmentCount = 2;
subpassDescription.pDepthStencilAttachment = &stencilReference;
}
SET_FORMAT_ALIASED_HANDLE(renderPassContext->renderPass[i], formatGroup.aliases, alias) {
attachments[0].format = formatGroup.aliases[alias];
VkResult result = device->vkCreateRenderPass(device->handle, &createInfo, NULL, &renderPassContext->renderPass[i][alias]);
VK_IF_ERROR(result) return result;
}
}
return VK_SUCCESS;
}
static void VKPipelines_DestroyRenderPassContext(VKRenderPassContext* renderPassContext) {
if (renderPassContext == NULL) return;
VKDevice* device = renderPassContext->pipelineContext->device;
assert(device != NULL);
VKPipelines_DestroyPipelineSet(device, renderPassContext->pipelineSet);
device->vkDestroyRenderPass(device->handle, renderPassContext->renderPass, NULL);
for (uint32_t i = 0; i < ARRAY_SIZE(renderPassContext->pipelineSets); i++) {
VKPipelineSet* set = renderPassContext->pipelineSets[i];
while (set != NULL) {
VKPipelineSet* s = set;
set = set->next;
VKPipelines_DestroyPipelineSet(device, s);
}
}
ARRAY_FREE(renderPassContext->pipelineSets);
SET_FORMAT_ALIASED_HANDLE(renderPassContext->clipPipeline, renderPassContext->clipPipeline, alias)
device->vkDestroyPipeline(device->handle, renderPassContext->clipPipeline[alias], NULL);
for (uint32_t i = 0; i < 2; i++) {
SET_FORMAT_ALIASED_HANDLE(renderPassContext->renderPass[i], renderPassContext->renderPass[i], alias)
device->vkDestroyRenderPass(device->handle, renderPassContext->renderPass[i][alias], NULL);
}
J2dRlsTraceLn2(J2D_TRACE_INFO, "VKPipelines_DestroyRenderPassContext(%p): format=%d",
renderPassContext, renderPassContext->format);
free(renderPassContext);
}
@@ -311,11 +416,67 @@ static VKRenderPassContext* VKPipelines_CreateRenderPassContext(VKPipelineContex
renderPassContext->pipelineContext = pipelineContext;
renderPassContext->format = format;
VK_IF_ERROR(VKPipelines_InitRenderPass(pipelineContext->device, renderPassContext)) {
VK_IF_ERROR(VKPipelines_InitRenderPasses(pipelineContext->device, renderPassContext)) {
VKPipelines_DestroyRenderPassContext(renderPassContext);
return NULL;
}
// Setup default pipeline parameters.
const VkPipelineColorBlendAttachmentState NO_COLOR_ATTACHMENT = {
.blendEnable = VK_FALSE,
.colorWriteMask = 0
};
PipelineCreateState base;
VKPipelines_InitPipelineCreateState(&base);
base.createInfo.layout = pipelineContext->pipelineLayout;
base.colorBlendState.pAttachments = &NO_COLOR_ATTACHMENT;
base.depthStencilState.stencilTestEnable = VK_TRUE;
VkPipelineRenderingCreateInfoKHR renderingCreateInfo = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR,
.viewMask = 0,
.colorAttachmentCount = 1,
.pColorAttachmentFormats = &renderPassContext->format,
.stencilAttachmentFormat = VK_FORMAT_S8_UINT
};
if (pipelineContext->device->dynamicRendering) base.createInfo.pNext = &renderingCreateInfo;
assert(base.dynamicState.dynamicStateCount <= SARRAY_COUNT_OF(base.dynamicStates));
// Setup clip pipeline.
MAKE_INPUT_STATE(CLIP, VKIntVertex, VK_FORMAT_R32G32_SINT);
base.createInfo.pVertexInputState = &INPUT_STATE_CLIP;
base.createInfo.pInputAssemblyState = &INPUT_ASSEMBLY_STATE_TRIANGLE_LIST;
const VkStencilOpState CLIP_STENCIL_OP = {
.failOp = VK_STENCIL_OP_REPLACE,
.passOp = VK_STENCIL_OP_REPLACE,
.compareOp = VK_COMPARE_OP_NEVER,
.compareMask = 0U,
.writeMask = 0xFFFFFFFFU,
.reference = CLIP_STENCIL_INCLUDE_VALUE
};
const VkPipelineDepthStencilStateCreateInfo CLIP_STENCIL_STATE = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
.stencilTestEnable = VK_TRUE,
.front = CLIP_STENCIL_OP,
.back = CLIP_STENCIL_OP
};
base.createInfo.pDepthStencilState = &CLIP_STENCIL_STATE;
base.createInfo.stageCount = 1;
base.createInfo.pStages = &pipelineContext->shaders->clip_vert;
VkGraphicsPipelineCreateInfo createInfos FORMAT_ALIASED;
for (FormatAlias alias = FORMAT_ALIAS_ORIGINAL; alias <= FORMAT_ALIAS_UNORM; alias++) {
createInfos[alias] = base.createInfo;
createInfos[alias].renderPass = renderPassContext->renderPass[1][alias];
}
VkBool32 hasFormatAliasing = renderPassContext->renderPass[1][FORMAT_ALIAS_ORIGINAL] != renderPassContext->renderPass[1][FORMAT_ALIAS_UNORM];
// Create pipelines.
// TODO pipeline cache
VK_IF_ERROR(pipelineContext->device->vkCreateGraphicsPipelines(
pipelineContext->device->handle, VK_NULL_HANDLE, hasFormatAliasing ? 2 : 1,
createInfos, NULL, renderPassContext->clipPipeline)) VK_UNHANDLED_ERROR();
if (!hasFormatAliasing) renderPassContext->clipPipeline[FORMAT_ALIAS_UNORM] = renderPassContext->clipPipeline[FORMAT_ALIAS_ORIGINAL];
J2dRlsTraceLn2(J2D_TRACE_INFO, "VKPipelines_CreateRenderPassContext(%p): format=%d", renderPassContext, format);
return renderPassContext;
}
@@ -327,7 +488,7 @@ static VkResult VKPipelines_InitPipelineLayouts(VKDevice* device, VKPipelineCont
VkPushConstantRange pushConstantRange = {
.stageFlags = VK_SHADER_STAGE_VERTEX_BIT,
.offset = 0,
.size = sizeof(float) * 4
.size = sizeof(float) * 2
};
VkPipelineLayoutCreateInfo createInfo = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
@@ -358,6 +519,26 @@ static VkResult VKPipelines_InitPipelineLayouts(VKDevice* device, VKPipelineCont
result = device->vkCreatePipelineLayout(device->handle, &createInfo, NULL, &pipelines->texturePipelineLayout);
VK_IF_ERROR(result) return result;
VkDescriptorSetLayoutBinding maskBufferLayoutBinding = {
.binding = 0,
.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER,
.descriptorCount = 1,
.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT,
.pImmutableSamplers = NULL
};
VkDescriptorSetLayoutCreateInfo descriptorSetLayoutCreateInfo = {
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,
.bindingCount = 1,
.pBindings = &maskBufferLayoutBinding
};
result = device->vkCreateDescriptorSetLayout(device->handle, &descriptorSetLayoutCreateInfo, NULL, &pipelines->maskFillDescriptorSetLayout);
VK_IF_ERROR(result) return result;
createInfo.setLayoutCount = 1;
createInfo.pSetLayouts = &pipelines->maskFillDescriptorSetLayout;
result = device->vkCreatePipelineLayout(device->handle, &createInfo, NULL, &pipelines->maskFillPipelineLayout);
VK_IF_ERROR(result) return result;
return VK_SUCCESS;
}
@@ -392,6 +573,7 @@ VKPipelineContext* VKPipelines_CreateContext(VKDevice* device) {
return NULL;
}
J2dRlsTraceLn1(J2D_TRACE_INFO, "VKPipelines_CreateContext(%p)", pipelineContext);
return pipelineContext;
}
@@ -412,13 +594,16 @@ void VKPipelines_DestroyContext(VKPipelineContext* pipelineContext) {
device->vkDestroyPipelineLayout(device->handle, pipelineContext->texturePipelineLayout, NULL);
device->vkDestroyDescriptorSetLayout(device->handle, pipelineContext->textureDescriptorSetLayout, NULL);
J2dRlsTraceLn1(J2D_TRACE_INFO, "VKPipelines_DestroyContext(%p)", pipelineContext);
free(pipelineContext);
}
VKRenderPassContext* VKPipelines_GetRenderPassContext(VKPipelineContext* pipelineContext, VkFormat format) {
assert(pipelineContext != NULL && pipelineContext->device != NULL);
for (uint32_t i = 0; i < ARRAY_SIZE(pipelineContext->renderPassContexts); i++) {
if (pipelineContext->renderPassContexts[i]->format == format) return pipelineContext->renderPassContexts[i];
if (pipelineContext->renderPassContexts[i]->format == format) {
return pipelineContext->renderPassContexts[i];
}
}
// Not found, create.
VKRenderPassContext* renderPassContext = VKPipelines_CreateRenderPassContext(pipelineContext, format);
@@ -426,9 +611,118 @@ VKRenderPassContext* VKPipelines_GetRenderPassContext(VKPipelineContext* pipelin
return renderPassContext;
}
VkPipeline VKPipelines_GetPipeline(VKRenderPassContext* renderPassContext, VKPipeline pipeline) {
if (renderPassContext->pipelineSet == NULL) {
renderPassContext->pipelineSet = VKPipelines_CreatePipelineSet(renderPassContext);
}
return renderPassContext->pipelineSet->pipelines[pipeline];
inline void hash(uint32_t* result, int i) { // Good for hashing enums.
uint32_t x = (uint32_t) i;
x = ((x >> 16U) ^ x) * 0x45d9f3bU;
x = ((x >> 16U) ^ x) * 0x45d9f3bU;
x = (x >> 16U) ^ x;
*result ^= x + 0x9e3779b9U + (*result << 6U) + (*result >> 2U);
}
inline uint32_t pipelineSetDescriptorHash(VKPipelineSetDescriptor* d) {
uint32_t h = 0U;
hash(&h, d->stencilMode);
hash(&h, d->composite);
return h;
}
inline VkBool32 pipelineSetDescriptorEquals(VKPipelineSetDescriptor* a, VKPipelineSetDescriptor* b) {
return a->stencilMode == b->stencilMode &&
a->composite == b->composite;
}
VkPipeline VKPipelines_GetPipeline(VKRenderPassContext* renderPassContext, VKPipelineSetDescriptor descriptor, VKPipeline pipeline) {
assert(renderPassContext != NULL && renderPassContext->pipelineContext != NULL);
assert(pipeline < PIPELINE_COUNT); // We could append custom pipelines after that index.
// Depending on availability of certain dynamic states, we can reduce number of pipeline permutations.
// We do this by amending the pipeline set descriptor here.
VKDevice* device = renderPassContext->pipelineContext->device;
assert(device != NULL);
VKCompositeMode compositeGroup = COMPOSITE_GROUP(descriptor.composite);
if (device->dynamicBlending && compositeGroup == ALPHA_COMPOSITE_GROUP)
descriptor.composite = ALPHA_COMPOSITE_SRC_OVER; // Dynamic blending: all alpha composites are combined.
if (device->dynamicLogicOp && compositeGroup == LOGIC_COMPOSITE_GROUP &&
renderPassContext->renderPass[0][FORMAT_ALIAS_ORIGINAL] == renderPassContext->renderPass[0][FORMAT_ALIAS_UNORM])
descriptor.composite = ALPHA_COMPOSITE_SRC_OVER; // Dynamic logicOp: all composites are combined.
if (device->dynamicStencil && descriptor.stencilMode != STENCIL_MODE_NONE)
descriptor.stencilMode = STENCIL_MODE_ON; // Dynamic stencil: stencil test on/off combined.
// Find pipeline set in hash table.
VKPipelineSet* set = NULL;
uint32_t lookupDepth = 0xFFFFFFFFU;
uint32_t hash = pipelineSetDescriptorHash(&descriptor);
if (renderPassContext->pipelineSets != NULL) {
VKPipelineSet* bucket = renderPassContext->pipelineSets[hash % ARRAY_SIZE(renderPassContext->pipelineSets)];
lookupDepth = 0;
while (bucket != NULL) {
if (pipelineSetDescriptorEquals(&descriptor, &bucket->descriptor)) {
set = bucket;
break;
} else {
bucket = bucket->next;
lookupDepth++;
}
}
}
// If lookup was too deep, rehash.
const uint32_t REHASH_THRESHOLD = 5;
if (lookupDepth >= REHASH_THRESHOLD) {
static const uint32_t TABLE_SIZE_PRIMES[] = { 53U, 97U, 193U, 389U, 769U, 1543U, 3079U, 6151U, 12289U, 24593U,
49157U, 98317U, 196613U, 393241U, 786433U, 1572869U, 3145739U,
6291469U, 12582917U, 25165843U, 50331653U, 100663319U,
201326611U, 402653189U, 805306457U, 1610612741U };
size_t size = ARRAY_SIZE(renderPassContext->pipelineSets);
for (uint32_t i = 0;; i++) {
assert(i < SARRAY_COUNT_OF(TABLE_SIZE_PRIMES));
if (TABLE_SIZE_PRIMES[i] > size) {
size = TABLE_SIZE_PRIMES[i];
break;
}
}
VKPipelineSet** t = NULL;
ARRAY_RESIZE(t, size);
for (uint32_t i = 0; i < size; i++) t[i] = NULL;
for (uint32_t i = 0; i < ARRAY_SIZE(renderPassContext->pipelineSets); i++) {
VKPipelineSet* s = renderPassContext->pipelineSets[i];
while (s != NULL) {
VKPipelineSet* next = s->next;
VKPipelineSet** bucket = &t[pipelineSetDescriptorHash(&s->descriptor) % size];
s->next = *bucket;
*bucket = s;
s = next;
}
}
ARRAY_FREE(renderPassContext->pipelineSets);
renderPassContext->pipelineSets = t;
}
// If pipeline set was not found, create and insert.
if (set == NULL) {
set = VKPipelines_CreatePipelineSet(renderPassContext, descriptor);
VKPipelineSet** bucket = &renderPassContext->pipelineSets[hash % ARRAY_SIZE(renderPassContext->pipelineSets)];
set->next = *bucket;
*bucket = set;
#ifdef DEBUG
lookupDepth = REHASH_THRESHOLD;
#endif
}
#ifdef DEBUG
if (lookupDepth >= REHASH_THRESHOLD) {
J2dTraceLn1(J2D_TRACE_VERBOSE, "VKPipelines_GetPipeline: hash table updated, buckets=%d",
ARRAY_SIZE(renderPassContext->pipelineSets));
uint32_t minDepth = 0xFFFFFFFFU, maxDepth = 0, totalSets = 0;
J2dTrace(J2D_TRACE_VERBOSE, " ");
for (uint32_t i = 0; i < ARRAY_SIZE(renderPassContext->pipelineSets); i++) {
uint32_t depth = 0;
for (VKPipelineSet* s = renderPassContext->pipelineSets[i]; s != NULL; s = s ->next) depth++;
J2dTrace1(J2D_TRACE_VERBOSE2, " %d", depth);
if (minDepth > depth) minDepth = depth;
if (maxDepth < depth) maxDepth = depth;
totalSets += depth;
}
J2dTrace3(J2D_TRACE_VERBOSE, " | minDepth=%d, maxDepth=%d, totalSets=%d\n", minDepth, maxDepth, totalSets);
}
#endif
return set->pipelines[pipeline];
}

View File

@@ -24,33 +24,75 @@
#ifndef VKPipelines_h_Included
#define VKPipelines_h_Included
#include "java_awt_AlphaComposite.h"
#include "VKTypes.h"
typedef struct VKShaders VKShaders;
typedef struct VKPipelineSet VKPipelineSet;
#define CLIP_STENCIL_INCLUDE_VALUE 0x80U
#define CLIP_STENCIL_EXCLUDE_VALUE 0U
/**
* All pipeline types, use these to index into VKPipelineSet.pipelines.
* All pipeline types.
*/
typedef enum {
PIPELINE_FILL_COLOR = 0,
PIPELINE_DRAW_COLOR = 1,
PIPELINE_BLIT = 2,
PIPELINE_COUNT = 3
PIPELINE_FILL_COLOR = 0,
PIPELINE_DRAW_COLOR = 1,
PIPELINE_BLIT = 2,
PIPELINE_MASK_FILL_COLOR = 3,
PIPELINE_COUNT = 4,
NO_PIPELINE = 0x7FFFFFFF
} VKPipeline;
typedef enum {
STENCIL_MODE_NONE = 0, // No stencil attachment.
STENCIL_MODE_OFF = 1, // Has stencil attachment, stencil test disabled.
STENCIL_MODE_ON = 2 // Has stencil attachment, stencil test enabled.
} VKStencilMode;
/**
* There are two groups of composite modes:
* - Logic composite - using logicOp.
* - Alpha compisite - using blending.
*/
typedef enum {
LOGIC_COMPOSITE_XOR = 0,
LOGIC_COMPOSITE_GROUP = LOGIC_COMPOSITE_XOR,
ALPHA_COMPOSITE_CLEAR = java_awt_AlphaComposite_CLEAR,
ALPHA_COMPOSITE_SRC = java_awt_AlphaComposite_SRC,
ALPHA_COMPOSITE_DST = java_awt_AlphaComposite_DST,
ALPHA_COMPOSITE_SRC_OVER = java_awt_AlphaComposite_SRC_OVER,
ALPHA_COMPOSITE_DST_OVER = java_awt_AlphaComposite_DST_OVER,
ALPHA_COMPOSITE_SRC_IN = java_awt_AlphaComposite_SRC_IN,
ALPHA_COMPOSITE_DST_IN = java_awt_AlphaComposite_DST_IN,
ALPHA_COMPOSITE_SRC_OUT = java_awt_AlphaComposite_SRC_OUT,
ALPHA_COMPOSITE_DST_OUT = java_awt_AlphaComposite_DST_OUT,
ALPHA_COMPOSITE_SRC_ATOP = java_awt_AlphaComposite_SRC_ATOP,
ALPHA_COMPOSITE_DST_ATOP = java_awt_AlphaComposite_DST_ATOP,
ALPHA_COMPOSITE_XOR = java_awt_AlphaComposite_XOR,
ALPHA_COMPOSITE_GROUP = ALPHA_COMPOSITE_XOR,
COMPOSITE_COUNT = ALPHA_COMPOSITE_GROUP + 1,
NO_COMPOSITE = 0x7FFFFFFF
} VKCompositeMode;
#define COMPOSITE_GROUP(COMPOSITE) ( \
(COMPOSITE) <= LOGIC_COMPOSITE_GROUP ? LOGIC_COMPOSITE_GROUP : \
(COMPOSITE) <= ALPHA_COMPOSITE_GROUP ? ALPHA_COMPOSITE_GROUP : \
NO_COMPOSITE )
extern const VkPipelineColorBlendAttachmentState COMPOSITE_BLEND_STATES[COMPOSITE_COUNT];
/**
* Global pipeline context.
*/
struct VKPipelineContext {
VKDevice* device;
VkPipelineLayout pipelineLayout;
VkPipelineLayout texturePipelineLayout;
VkDescriptorSetLayout textureDescriptorSetLayout;
VkPipelineLayout texturePipelineLayout;
VkDescriptorSetLayout maskFillDescriptorSetLayout;
VkPipelineLayout maskFillPipelineLayout;
VkSampler linearRepeatSampler;
VKShaders* shaders;
struct VKShaders* shaders;
VKRenderPassContext** renderPassContexts;
};
@@ -58,25 +100,45 @@ struct VKPipelineContext {
* Per-format context.
*/
struct VKRenderPassContext {
VKPipelineContext* pipelineContext;
VkFormat format;
VkRenderPass renderPass;
VKPipelineSet* pipelineSet; // TODO we will need a real hash map for this in the future.
VKPipelineContext* pipelineContext;
VkFormat format;
VkRenderPass renderPass[2] FORMAT_ALIASED; // Color-only and color+stencil. Only when dynamicRendering=OFF.
VkPipeline clipPipeline FORMAT_ALIASED;
struct VKPipelineSet** pipelineSets;
};
/**
* All features describing a pipeline set.
* When adding new fields, update hash and comparison in VKPipelines_GetPipeline.
*/
typedef struct {
VKStencilMode stencilMode;
VKCompositeMode composite;
} VKPipelineSetDescriptor;
typedef struct {
int x, y;
} VKIntVertex;
typedef struct {
float x, y;
} VKVertex;
Color color;
} VKColorVertex;
typedef struct {
float px, py;
float u, v;
} VKTxVertex;
typedef struct {
int x, y, maskOffset, maskScanline;
Color color;
} VKMaskFillColorVertex;
VKPipelineContext* VKPipelines_CreateContext(VKDevice* device);
void VKPipelines_DestroyContext(VKPipelineContext* pipelines);
VKRenderPassContext* VKPipelines_GetRenderPassContext(VKPipelineContext* pipelineContext, VkFormat format);
VkPipeline VKPipelines_GetPipeline(VKRenderPassContext* renderPassContext, VKPipeline pipeline);
VkPipeline VKPipelines_GetPipeline(VKRenderPassContext* renderPassContext, VKPipelineSetDescriptor descriptor, VKPipeline pipeline);
#endif //VKPipelines_h_Included

View File

@@ -26,13 +26,15 @@
#ifndef HEADLESS
#include "sun_font_StrikeCache.h"
#include "sun_java2d_pipe_BufferedOpCodes.h"
#include "sun_java2d_pipe_BufferedRenderPipe.h"
#include "sun_java2d_pipe_BufferedTextPipe.h"
#include "sun_java2d_vulkan_VKBlitLoops.h"
#include "fontscalerdefs.h"
#include "Trace.h"
#include "jlong.h"
#include "VKBase.h"
#include "VKBlitLoops.h"
#include "VKSurfaceData.h"
#include "VKRenderer.h"
#include "VKUtil.h"
@@ -91,9 +93,24 @@
#define OFFSET_XFORM sun_java2d_vulkan_VKBlitLoops_OFFSET_XFORM
#define OFFSET_ISOBLIT sun_java2d_vulkan_VKBlitLoops_OFFSET_ISOBLIT
#define NO_CLIP ((VkRect2D) {{0, 0}, {0x7FFFFFFFU, 0x7FFFFFFFU}})
// Rendering context is only accessed from VKRenderQueue_flushBuffer,
// which is only called from queue flusher thread, no need for synchronization.
static VKRenderingContext context = {};
static VKRenderingContext context = {
.surface = NULL,
.color = {},
.composite = ALPHA_COMPOSITE_SRC_OVER,
.extraAlpha = 1.0f,
.clipModCount = 1,
.clipRect = NO_CLIP,
.clipSpanVertices = NULL
};
// We keep this color separately from context.color,
// because we need consistent state when switching between XOR and alpha composite modes.
// This variable holds last value set by SET_COLOR, while context.color holds color,
// currently used for drawing, which may have also been provided by SET_XOR_COMPOSITE.
CorrectedColor color;
JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
(JNIEnv *env, jobject oglrq, jlong buf, jint limit)
@@ -144,6 +161,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
J2dRlsTraceLn4(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: DRAW_RECT(%d, %d, %d, %d)",
x, y, w, h);
VKRenderer_RenderRect(&context, PIPELINE_DRAW_COLOR, x, y, w, h);
}
break;
case sun_java2d_pipe_BufferedOpCodes_DRAW_POLY:
@@ -213,7 +231,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
jint h = NEXT_INT(b);
J2dRlsTraceLn4(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: FILL_RECT(%d, %d, %d, %d)", x, y, w, h);
VKRenderer_FillRect(&context, x, y, w, h);
VKRenderer_RenderRect(&context, PIPELINE_FILL_COLOR, x, y, w, h);
}
break;
case sun_java2d_pipe_BufferedOpCodes_FILL_SPANS:
@@ -250,6 +268,8 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
J2dRlsTraceLn6(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: FILL_AAPARALLELOGRAM(%f, %f, %f, %f, %f, %f)",
x11, y11, dx21, dy21, dx12, dy12);
// TODO this is not AA!
VKRenderer_RenderParallelogram(&context, PIPELINE_FILL_COLOR, x11, y11, dx21, dy21, dx12, dy12);
}
break;
@@ -279,6 +299,25 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
bytesPerGlyph = BYTES_PER_GLYPH_IMAGE;
}
J2dRlsTraceLn(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: DRAW_GLYPH_LIST");
// TODO this is a quick and dirty implementation of greyscale-AA text rendering over MASK_FILL. Need to do better.
jfloat glyphx, glyphy;
for (int i = 0; i < numGlyphs; i++) {
GlyphInfo *ginfo = (GlyphInfo *)jlong_to_ptr(NEXT_LONG(images));
if (usePositions) {
jfloat posx = NEXT_FLOAT(positions);
jfloat posy = NEXT_FLOAT(positions);
glyphx = glyphListOrigX + posx + ginfo->topLeftX;
glyphy = glyphListOrigY + posy + ginfo->topLeftY;
} else {
glyphx = glyphListOrigX + ginfo->topLeftX;
glyphy = glyphListOrigY + ginfo->topLeftY;
glyphListOrigX += ginfo->advanceX;
glyphListOrigY += ginfo->advanceY;
}
if (ginfo->format != sun_font_StrikeCache_PIXEL_FORMAT_GREYSCALE) continue;
if (ginfo->height*ginfo->rowBytes == 0) continue;
VKRenderer_MaskFill(&context, (int) glyphx, (int) glyphy, ginfo->width, ginfo->height, 0, ginfo->rowBytes, ginfo->height*ginfo->rowBytes, ginfo->image);
}
SKIP_BYTES(b, numGlyphs * bytesPerGlyph);
}
break;
@@ -319,25 +358,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
OFFSET_XFORM);
jboolean isoblit = EXTRACT_BOOLEAN(packedParams,
OFFSET_ISOBLIT);
if (isoblit) {
VKBlitLoops_IsoBlit(env, &context, pSrc, pDst,
xform, hint, texture,
sx1, sy1, sx2, sy2,
dx1, dy1, dx2, dy2);
} else {
jint srctype = EXTRACT_BYTE(packedParams, OFFSET_SRCTYPE);
VKBlitLoops_Blit(env, &context, pSrc, pDst,
xform, hint, srctype, texture,
sx1, sy1, sx2, sy2,
dx1, dy1, dx2, dy2);
}
break;
J2dRlsTraceLn8(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: BLIT (%d %d %d %d) -> (%f %f %f %f) ",
sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2)
J2dRlsTraceLn4(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: BLIT texture=%d rtt=%d xform=%d isoblit=%d",
texture, rtt, xform, isoblit)
J2dRlsTraceLn(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: BLIT");
}
break;
case sun_java2d_pipe_BufferedOpCodes_SURFACE_TO_SW_BLIT:
@@ -364,7 +385,10 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
jint maskscan = NEXT_INT(b);
jint masklen = NEXT_INT(b);
unsigned char *pMask = (masklen > 0) ? b : NULL;
J2dRlsTraceLn(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: MASK_FILL");
J2dRlsTraceLn7(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: MASK_FILL(%d, %d, %dx%d, maskoff=%d, maskscan=%d, masklen=%d)",
x, y, w, h, maskoff, maskscan, masklen);
VKRenderer_MaskFill(&context, x, y, w, h, maskoff, maskscan, masklen, pMask);
SKIP_BYTES(b, masklen);
}
break;
@@ -390,12 +414,17 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
J2dRlsTraceLn4(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: SET_RECT_CLIP(%d, %d, %d, %d)",
x1, y1, x2, y2);
ARRAY_RESIZE(context.clipSpanVertices, 0);
context.clipRect = (VkRect2D) {{x1, y1}, {x2 - x1, y2 - y1}};
context.clipModCount++;
}
break;
case sun_java2d_pipe_BufferedOpCodes_BEGIN_SHAPE_CLIP:
{
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: BEGIN_SHAPE_CLIP");
ARRAY_RESIZE(context.clipSpanVertices, 0);
context.clipModCount++;
}
break;
case sun_java2d_pipe_BufferedOpCodes_SET_SHAPE_CLIP_SPANS:
@@ -403,28 +432,50 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
jint count = NEXT_INT(b);
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: SET_SHAPE_CLIP_SPANS");
SKIP_BYTES(b, count * BYTES_PER_SPAN);
size_t offset = ARRAY_SIZE(context.clipSpanVertices);
ARRAY_RESIZE(context.clipSpanVertices, offset + count * 6);
for (jint i = 0; i < count; i++) {
jint x1 = NEXT_INT(b);
jint y1 = NEXT_INT(b);
jint x2 = NEXT_INT(b);
jint y2 = NEXT_INT(b);
context.clipSpanVertices[offset + i * 6 + 0] = (VKIntVertex) {x1, y1};
context.clipSpanVertices[offset + i * 6 + 1] = (VKIntVertex) {x2, y1};
context.clipSpanVertices[offset + i * 6 + 2] = (VKIntVertex) {x2, y2};
context.clipSpanVertices[offset + i * 6 + 3] = (VKIntVertex) {x2, y2};
context.clipSpanVertices[offset + i * 6 + 4] = (VKIntVertex) {x1, y2};
context.clipSpanVertices[offset + i * 6 + 5] = (VKIntVertex) {x1, y1};
}
context.clipModCount++;
}
break;
case sun_java2d_pipe_BufferedOpCodes_END_SHAPE_CLIP:
{
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: END_SHAPE_CLIP");
context.clipRect = NO_CLIP;
context.clipModCount++;
}
break;
case sun_java2d_pipe_BufferedOpCodes_RESET_CLIP:
{
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: RESET_CLIP");
ARRAY_RESIZE(context.clipSpanVertices, 0);
context.clipRect = NO_CLIP;
context.clipModCount++;
}
break;
case sun_java2d_pipe_BufferedOpCodes_SET_ALPHA_COMPOSITE:
{
jint rule = NEXT_INT(b);
jint rule = NEXT_INT(b);
jfloat extraAlpha = NEXT_FLOAT(b);
jint flags = NEXT_INT(b);
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: SET_ALPHA_COMPOSITE");
jint flags = NEXT_INT(b);
J2dRlsTraceLn3(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: SET_ALPHA_COMPOSITE(%d, %f, %d)", rule, extraAlpha, flags);
context.color = color;
context.composite = (VKCompositeMode) rule;
context.extraAlpha = extraAlpha;
}
break;
case sun_java2d_pipe_BufferedOpCodes_SET_XOR_COMPOSITE:
@@ -432,12 +483,21 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
jint xorPixel = NEXT_INT(b);
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: SET_XOR_COMPOSITE");
context.color = VKUtil_DecodeJavaColor(xorPixel);
context.composite = LOGIC_COMPOSITE_XOR;
context.extraAlpha = 1.0f;
// Alpha is left unchanged in XOR mode.
context.color.linear.a = 0.0f;
context.color.nonlinearSrgb.a = 0.0f;
}
break;
case sun_java2d_pipe_BufferedOpCodes_RESET_COMPOSITE:
{
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: RESET_COMPOSITE");
context.color = color;
context.composite = ALPHA_COMPOSITE_SRC;
context.extraAlpha = 1.0f;
}
break;
case sun_java2d_pipe_BufferedOpCodes_SET_TRANSFORM:
@@ -448,18 +508,8 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
jdouble m11 = NEXT_DOUBLE(b);
jdouble m02 = NEXT_DOUBLE(b);
jdouble m12 = NEXT_DOUBLE(b);
J2dRlsTraceLn3(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: SET_TRANSFORM | %.2f %.2f %.2f |", m00, m01, m02);
J2dRlsTraceLn3(J2D_TRACE_VERBOSE,
" | %.2f %.2f %.2f |", m10, m11, m12);
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
" | 0.00 0.00 1.00 |");
//currentDevice->renderState.m00 = m00;
//currentDevice->renderState.m01 = m01;
//currentDevice->renderState.m10 = m10;
//currentDevice->renderState.m11 = m11;
//currentDevice->renderState.m02 = m02;
//currentDevice->renderState.m12 = m12;
"VKRenderQueue_flushBuffer: SET_TRANSFORM");
}
break;
case sun_java2d_pipe_BufferedOpCodes_RESET_TRANSFORM:
@@ -572,10 +622,13 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
case sun_java2d_pipe_BufferedOpCodes_SET_COLOR:
{
jint javaColor = NEXT_INT(b);
context.color = VKUtil_DecodeJavaColor(javaColor);
J2dRlsTraceLn5(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: SET_COLOR 0x%08x, linear_rgba={%.3f, %.3f, %.3f, %.3f}",
javaColor, context.color.r, context.color.g, context.color.b, context.color.a);
color = VKUtil_DecodeJavaColor(javaColor);
if (COMPOSITE_GROUP(context.composite) == ALPHA_COMPOSITE_GROUP) context.color = color;
J2dRlsTraceLn1(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: SET_COLOR(0x%08x)", javaColor);
J2dTraceLn8(J2D_TRACE_VERBOSE, // Print color values with straight alpha for convenience.
" srgb={%.3f, %.3f, %.3f, %.3f}, linear={%.3f, %.3f, %.3f, %.3f}",
color.nonlinearSrgb.r/color.linear.a, color.nonlinearSrgb.g/color.linear.a, color.nonlinearSrgb.b/color.linear.a, color.linear.a,
color.linear.r/color.linear.a, color.linear.g/color.linear.a, color.linear.b/color.linear.a, color.linear.a);
}
break;
case sun_java2d_pipe_BufferedOpCodes_SET_GRADIENT_PAINT:

View File

@@ -1,43 +0,0 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, JetBrains s.r.o.. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifndef VKRenderState_h_Included
#define VKRenderState_h_Included
#include <stdint.h>
struct VKRenderState {
uint32_t color;
double m00;
double m10;
double m01;
double m11;
double m02;
double m12;
};
#endif /* VKRenderState_h_Included */

File diff suppressed because it is too large Load Diff

View File

@@ -31,75 +31,19 @@
#include "VKPipelines.h"
struct VKRenderingContext {
VKSDOps* surface;
Color color;
};
#define TRACKED_RESOURCE(NAME) \
typedef struct { \
uint64_t timestamp; \
NAME value; \
} Tracked ## NAME
TRACKED_RESOURCE(VkCommandBuffer);
TRACKED_RESOURCE(VkSemaphore);
/**
* Renderer attached to device.
*/
struct VKRenderer {
VKDevice* device;
VKPipelineContext* pipelineContext;
TrackedVkCommandBuffer* pendingCommandBuffers;
TrackedVkCommandBuffer* pendingSecondaryCommandBuffers;
TrackedVkSemaphore* pendingSemaphores;
/**
* Last known timestamp hit by GPU execution. Resources with equal or less timestamp may be safely reused.
*/
uint64_t readTimestamp;
/**
* Next timestamp to be recorded. This is the last checkpoint to be hit by GPU execution.
*/
uint64_t writeTimestamp;
VkSemaphore timelineSemaphore;
VkCommandPool commandPool;
VkCommandBuffer commandBuffer;
struct Wait {
VkSemaphore* semaphores;
VkPipelineStageFlags* stages;
} wait;
struct PendingPresentation {
VkSwapchainKHR* swapchains;
uint32_t* indices;
VkResult* results;
} pendingPresentation;
};
/**
* Rendering-related info attached to surface.
*/
struct VKRenderPass {
VKRenderPassContext* context;
VkFramebuffer framebuffer;
VkCommandBuffer commandBuffer;
VkBool32 pendingFlush;
VkBool32 pendingCommands;
VkBool32 pendingClear;
VkImageLayout layout;
VkPipelineStageFlagBits lastStage;
VkAccessFlagBits lastAccess;
uint64_t lastTimestamp; // When was this surface last used?
VKSDOps* surface;
CorrectedColor color;
VKCompositeMode composite;
// Extra alpha is not used when painting with plain color,
// in this case color.a already includes it.
float extraAlpha;
uint64_t clipModCount; // Used to track changes to the clip.
VkRect2D clipRect;
VKIntVertex* clipSpanVertices;
};
VKRenderer* VKRenderer_Create(VKDevice* device);
VkCommandBuffer VKRenderer_Render(VKSDOps* surface);
void VKRenderer_Destroy(VKRenderer* renderer);
/**
@@ -115,7 +59,7 @@ void VKRenderer_Flush(VKRenderer* renderer);
/**
* Cancel render pass of the surface, release all associated resources and deallocate render pass.
*/
void VKRenderer_ReleaseRenderPass(VKSDOps* surface);
void VKRenderer_DestroyRenderPass(VKSDOps* surface);
/**
* Flush pending render pass and queue surface for presentation (if applicable).
@@ -127,15 +71,16 @@ void VKRenderer_FlushSurface(VKSDOps* surface);
* Actual resize will be performed later, before starting a new frame.
*/
void VKRenderer_ConfigureSurface(VKSDOps* surface, VkExtent2D extent);
void VKRenderer_FlushRenderPass(VKSDOps* surface);
// Blit ops.
// Blit operations.
void VKRenderer_TextureRender(VKRenderingContext* context,
VKImage *destImage, VKImage *srcImage,
VkBuffer vertexBuffer, uint32_t vertexNum);
// fill ops
void VKRenderer_FillRect(VKRenderingContext* context, jint x, jint y, jint w, jint h);
// Drawing operations.
void VKRenderer_RenderRect(VKRenderingContext* context, VKPipeline pipeline, jint x, jint y, jint w, jint h);
void VKRenderer_RenderParallelogram(VKRenderingContext* context, VKPipeline pipeline,
jfloat x11, jfloat y11,
@@ -144,4 +89,6 @@ void VKRenderer_RenderParallelogram(VKRenderingContext* context, VKPipeline pipe
void VKRenderer_FillSpans(VKRenderingContext* context, jint spanCount, jint *spans);
void VKRenderer_MaskFill(VKRenderingContext* context, jint x, jint y, jint w, jint h, jint maskoff, jint maskscan, jint masklen, uint8_t* mask);
#endif //VKRenderer_h_Included

View File

@@ -38,11 +38,12 @@ static void VKSD_ResetImageSurface(VKSDOps* vksdo) {
if (vksdo == NULL) return;
// ReleaseRenderPass also waits while the surface resources are being used by device.
VKRenderer_ReleaseRenderPass(vksdo);
VKRenderer_DestroyRenderPass(vksdo);
if (vksdo->device != NULL && vksdo->image != NULL) {
VKImage_free(vksdo->device, vksdo->image);
vksdo->image = NULL;
if (vksdo->device != NULL) {
VKImage_Destroy(vksdo->device, vksdo->stencil);
VKImage_Destroy(vksdo->device, vksdo->image);
vksdo->image = vksdo->stencil = NULL;
}
}
@@ -67,6 +68,10 @@ void VKSD_ResetSurface(VKSDOps* vksdo) {
}
}
static void VKSD_FindImageSurfaceMemoryType(VKMemoryRequirements* requirements) {
VKAllocator_FindMemoryType(requirements, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, VK_ALL_MEMORY_PROPERTIES);
}
VkBool32 VKSD_ConfigureImageSurface(VKSDOps* vksdo) {
// Initialize the device. currentDevice can be changed on the fly, and we must reconfigure surfaces accordingly.
VKDevice* device = VKGE_graphics_environment()->currentDevice;
@@ -79,15 +84,26 @@ VkBool32 VKSD_ConfigureImageSurface(VKSDOps* vksdo) {
if (vksdo->requestedExtent.width > 0 && vksdo->requestedExtent.height > 0 && (vksdo->image == NULL ||
vksdo->requestedExtent.width != vksdo->image->extent.width ||
vksdo->requestedExtent.height != vksdo->image->extent.height)) {
// VK_FORMAT_B8G8R8A8_UNORM is the most widely-supported format for our use.
// Use proper blending by default. See VKRenderer_GetFormatAliasForRenderPass for details.
vksdo->gammaCorrect = VK_TRUE;
// VK_FORMAT_B8G8R8A8_SRGB is the most widely-supported format for our use.
// We can also use normalized high-bit-count formats, like R10G10B10A2_UNORM, or R16G16B16A16_UNORM.
// The only thing to keep in mind is that we must not use 8-bits per component normalized formats, like
// B8G8R8A8_UNORM, because they would result in precision loss when blitting to the swapchain (explained further).
// Currently, we only support *_SRGB and *_UNORM formats,
// as other types may not be trivial to alias for logicOp rendering.
VkFormat format = VK_FORMAT_B8G8R8A8_SRGB;
if (VK_DEBUG_RANDOM(50)) format = VK_FORMAT_R16G16B16A16_UNORM;
VkFormat unormAlias = VKUtil_GetFormatGroup(format).aliases[FORMAT_ALIAS_UNORM];
// If we are using legacy blending, force UNORM format for surface image and swapchain.
if (!vksdo->gammaCorrect) format = unormAlias;
VKImage* image = VKImage_Create(device, vksdo->requestedExtent.width, vksdo->requestedExtent.height,
VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_TILING_OPTIMAL,
format != unormAlias ? VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT : 0,
format, VK_IMAGE_TILING_OPTIMAL,
VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
if (image == NULL) {
J2dRlsTraceLn1(J2D_TRACE_ERROR, "VKSD_ConfigureImageSurface(%p): cannot create image", vksdo);
VK_UNHANDLED_ERROR();
}
VK_SAMPLE_COUNT_1_BIT, VKSD_FindImageSurfaceMemoryType);
VK_RUNTIME_ASSERT(image);
VKSD_ResetImageSurface(vksdo);
vksdo->image = image;
J2dRlsTraceLn3(J2D_TRACE_INFO, "VKSD_ConfigureImageSurface(%p): image updated %dx%d", vksdo, image->extent.width, image->extent.height);
@@ -95,6 +111,25 @@ VkBool32 VKSD_ConfigureImageSurface(VKSDOps* vksdo) {
return vksdo->image != NULL;
}
VkBool32 VKSD_ConfigureImageSurfaceStencil(VKSDOps* vksdo) {
// Check that image is ready.
if (vksdo->image == NULL) {
J2dRlsTraceLn1(J2D_TRACE_WARNING, "VKSD_ConfigureImageSurfaceStencil(%p): image is not ready", vksdo);
return VK_FALSE;
}
// Initialize stencil image.
if (vksdo->stencil == NULL) {
vksdo->stencil = VKImage_Create(vksdo->device, vksdo->image->extent.width, vksdo->image->extent.height,
0, VK_FORMAT_S8_UINT, VK_IMAGE_TILING_OPTIMAL,
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
VK_SAMPLE_COUNT_1_BIT, VKSD_FindImageSurfaceMemoryType);
VK_RUNTIME_ASSERT(vksdo->stencil);
J2dRlsTraceLn3(J2D_TRACE_INFO, "VKSD_ConfigureImageSurfaceStencil(%p): stencil image updated %dx%d",
vksdo, vksdo->stencil->extent.width, vksdo->stencil->extent.height);
}
return vksdo->stencil != NULL;
}
VkBool32 VKSD_ConfigureWindowSurface(VKWinSDOps* vkwinsdo) {
// Check that image is ready.
if (vkwinsdo->vksdOps.image == NULL) {
@@ -120,6 +155,47 @@ VkBool32 VKSD_ConfigureWindowSurface(VKWinSDOps* vkwinsdo) {
return VK_FALSE;
}
// currentExtent is the current width and height of the surface, or the special value (0xFFFFFFFF, 0xFFFFFFFF)
// indicating that the surface size will be determined by the extent of a swapchain targeting the surface.
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSurfaceCapabilitiesKHR.html
// The behavior is platform-dependent if the image extent does not match the surfaces currentExtent
// as returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR.
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSwapchainCreateInfoKHR.html
if ((vkwinsdo->vksdOps.image->extent.width != capabilities.currentExtent.width ||
vkwinsdo->vksdOps.image->extent.height != capabilities.currentExtent.height) &&
(capabilities.currentExtent.width != 0xFFFFFFFF || capabilities.currentExtent.height != 0xFFFFFFFF)) {
J2dRlsTraceLn5(J2D_TRACE_WARNING,
"VKSD_ConfigureWindowSurface(%p): surface size doesn't match, expected=%dx%d, capabilities.currentExtent=%dx%d",
vkwinsdo, vkwinsdo->vksdOps.image->extent.width, vkwinsdo->vksdOps.image->extent.height,
capabilities.currentExtent.width, capabilities.currentExtent.height);
return VK_FALSE;
}
if (vkwinsdo->vksdOps.image->extent.width < capabilities.minImageExtent.width ||
vkwinsdo->vksdOps.image->extent.height < capabilities.minImageExtent.height ||
vkwinsdo->vksdOps.image->extent.width > capabilities.maxImageExtent.width ||
vkwinsdo->vksdOps.image->extent.height > capabilities.maxImageExtent.height) {
J2dRlsTraceLn7(J2D_TRACE_WARNING,
"VKSD_ConfigureWindowSurface(%p): surface size doesn't fit, expected=%dx%d, "
"capabilities.minImageExtent=%dx%d, capabilities.minImageExtent=%dx%d",
vkwinsdo, vkwinsdo->vksdOps.image->extent.width, vkwinsdo->vksdOps.image->extent.height,
capabilities.minImageExtent.width, capabilities.minImageExtent.height,
capabilities.maxImageExtent.width, capabilities.maxImageExtent.height);
return VK_FALSE;
}
// Our surfaces use pre-multiplied alpha, try to match.
// This allows us to have semi-transparent windows.
VkCompositeAlphaFlagBitsKHR compositeAlpha;
if (capabilities.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR) {
compositeAlpha = VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR;
} else if (capabilities.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR) {
// This is wrong, but at least some transparency is better than none, right?
compositeAlpha = VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR;
} else if (capabilities.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR) {
compositeAlpha = VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR;
} else compositeAlpha = (VkCompositeAlphaFlagBitsKHR) capabilities.supportedCompositeAlpha;
uint32_t formatCount;
VK_IF_ERROR(ge->vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, vkwinsdo->surface, &formatCount, NULL)) {
return VK_FALSE;
@@ -133,17 +209,29 @@ VkBool32 VKSD_ConfigureWindowSurface(VKWinSDOps* vkwinsdo) {
J2dRlsTraceLn1(J2D_TRACE_INFO, "VKSD_ConfigureWindowSurface(%p): available swapchain formats:", vkwinsdo);
for (uint32_t i = 0; i < formatCount; i++) {
J2dRlsTraceLn2(J2D_TRACE_INFO, " format=%d, colorSpace=%d", formats[i].format, formats[i].colorSpace);
// We draw with sRGB colors (see VKUtil_DecodeJavaColor()), so we don't want Vulkan to do color space
// conversions when drawing to surface. We use *_UNORM formats, so that colors are written "as is".
// With VK_COLOR_SPACE_SRGB_NONLINEAR_KHR these colors will be interpreted by presentation engine as sRGB.
if (formats[i].colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR && (
formats[i].format == VK_FORMAT_A8B8G8R8_UNORM_PACK32 ||
formats[i].format == VK_FORMAT_B8G8R8A8_UNORM ||
formats[i].format == VK_FORMAT_R8G8B8A8_UNORM ||
formats[i].format == VK_FORMAT_B8G8R8_UNORM ||
formats[i].format == VK_FORMAT_R8G8B8_UNORM
)) {
format = &formats[i];
// Currently, we only support default VK_COLOR_SPACE_SRGB_NONLINEAR_KHR color space, which means
// that we must use SRGB image formats, if we want proper gamma-correct colors.
// This only applies to the swapchain image, and we can use any format for the intermediate rendering
// target (VKSDOps.image). But in practice this means that for VKSDOps.image we would want to either
// use *_SRGB, or high-bit-count images, as even R8G8B8A8_UNORM will result in precision loss.
// We must strictly use SRGB formats for gamma-correct colors and UNORM for legacy mode.
if (vkwinsdo->vksdOps.gammaCorrect) {
if (formats[i].colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR && (
formats[i].format == VK_FORMAT_A8B8G8R8_SRGB_PACK32 ||
formats[i].format == VK_FORMAT_B8G8R8A8_SRGB ||
formats[i].format == VK_FORMAT_R8G8B8A8_SRGB ||
formats[i].format == VK_FORMAT_B8G8R8_SRGB ||
formats[i].format == VK_FORMAT_R8G8B8_SRGB
)) format = &formats[i];
} else {
if (formats[i].colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR && (
formats[i].format == VK_FORMAT_A8B8G8R8_UNORM_PACK32 ||
formats[i].format == VK_FORMAT_B8G8R8A8_UNORM ||
formats[i].format == VK_FORMAT_R8G8B8A8_UNORM ||
formats[i].format == VK_FORMAT_B8G8R8_UNORM ||
formats[i].format == VK_FORMAT_R8G8B8_UNORM
)) format = &formats[i];
}
}
if (format == NULL) {
@@ -151,20 +239,32 @@ VkBool32 VKSD_ConfigureWindowSurface(VKWinSDOps* vkwinsdo) {
return VK_FALSE;
}
// TODO inspect and choose present mode
uint32_t presentModeCount;
VK_IF_ERROR(ge->vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, vkwinsdo->surface, &presentModeCount, NULL)) {
return VK_FALSE;
}
VkPresentModeKHR presentModes[presentModeCount];
VK_IF_ERROR(ge->vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, vkwinsdo->surface, &presentModeCount, presentModes)) {
VK_UNHANDLED_ERROR();
return VK_FALSE;
}
uint32_t imageCount = capabilities.minImageCount + 1;
if (capabilities.maxImageCount > 0 && imageCount > capabilities.maxImageCount) {
imageCount = capabilities.maxImageCount;
// FIFO mode is guaranteed to be supported.
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkPresentModeKHR.html
uint32_t imageCount = 2;
VkPresentModeKHR presentMode = VK_PRESENT_MODE_FIFO_KHR;
// MAILBOX makes no sense without at least 3 images and using less memory
// for swapchain images may be more beneficial than having unlimited FPS.
// However, if minImageCount is too big anyway, why not use MAILBOX.
if (capabilities.minImageCount >= 3) {
for (uint32_t i = 0; i < presentModeCount; i++) {
if (presentModes[i] == VK_PRESENT_MODE_MAILBOX_KHR) {
presentMode = VK_PRESENT_MODE_MAILBOX_KHR;
imageCount = 3;
break;
}
}
}
if (imageCount > capabilities.maxImageCount && capabilities.maxImageCount != 0) imageCount = capabilities.maxImageCount;
else if (imageCount < capabilities.minImageCount) imageCount = capabilities.minImageCount;
VkSwapchainKHR swapchain;
VkSwapchainCreateInfoKHR createInfoKhr = {
@@ -173,15 +273,15 @@ VkBool32 VKSD_ConfigureWindowSurface(VKWinSDOps* vkwinsdo) {
.minImageCount = imageCount,
.imageFormat = format->format,
.imageColorSpace = format->colorSpace,
.imageExtent = vkwinsdo->vksdOps.image->extent, // TODO consider capabilities.currentExtent, capabilities.minImageExtent and capabilities.maxImageExtent
.imageExtent = vkwinsdo->vksdOps.image->extent,
.imageArrayLayers = 1,
.imageUsage = VK_IMAGE_USAGE_TRANSFER_DST_BIT,
.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE,
.queueFamilyIndexCount = 0,
.pQueueFamilyIndices = NULL,
.preTransform = capabilities.currentTransform,
.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
.presentMode = VK_PRESENT_MODE_FIFO_KHR, // TODO need more flexibility
.compositeAlpha = compositeAlpha,
.presentMode = presentMode,
.clipped = VK_TRUE,
.oldSwapchain = vkwinsdo->swapchain
};
@@ -189,7 +289,9 @@ VkBool32 VKSD_ConfigureWindowSurface(VKWinSDOps* vkwinsdo) {
VK_IF_ERROR(device->vkCreateSwapchainKHR(device->handle, &createInfoKhr, NULL, &swapchain)) {
return VK_FALSE;
}
J2dRlsTraceLn1(J2D_TRACE_INFO, "VKSD_ConfigureWindowSurface(%p): swapchain created", vkwinsdo);
J2dRlsTraceLn5(J2D_TRACE_INFO, "VKSD_ConfigureWindowSurface(%p): swapchain created, format=%d, presentMode=%d, imageCount=%d, compositeAlpha=%d",
vkwinsdo, format->format, presentMode, imageCount, compositeAlpha);
vkwinsdo->resizeCallback(vkwinsdo, vkwinsdo->vksdOps.image->extent);
if (vkwinsdo->swapchain != VK_NULL_HANDLE) {
// Destroy old swapchain.

View File

@@ -40,6 +40,7 @@
#define VKSD_UNDEFINED sun_java2d_pipe_hw_AccelSurface_UNDEFINED
#define VKSD_WINDOW sun_java2d_pipe_hw_AccelSurface_WINDOW
#define VKSD_RT_TEXTURE sun_java2d_pipe_hw_AccelSurface_RT_TEXTURE
/**
* The VKSDOps structure describes a native Vulkan surface and contains all
* information pertaining to the native surface.
@@ -47,15 +48,25 @@
struct VKSDOps {
SurfaceDataOps sdOps;
jint drawableType;
/**
* Whether we use proper gamma-corrected colors, or not.
* When TRUE, linear colors are used for drawing, which results in correct blending.
* When FALSE, sRGB colors are used for drawing, which results in legacy blending.
* See VKRenderer_GetFormatAliasForRenderPass for details.
*/
VkBool32 gammaCorrect;
VKDevice* device;
VKImage* image;
VKImage* stencil;
Color background;
CorrectedColor background;
VkExtent2D requestedExtent;
VKRenderPass* renderPass;
};
typedef void (*VKWinSD_SurfaceResizeCallback)(VKWinSDOps* surface, VkExtent2D extent);
/**
* The VKWinSDOps structure describes a native Vulkan surface connected with a window.
*/
@@ -66,6 +77,7 @@ struct VKWinSDOps {
VkImage* swapchainImages;
VKDevice* swapchainDevice;
VkExtent2D swapchainExtent;
VKWinSD_SurfaceResizeCallback resizeCallback;
};
/**
@@ -80,6 +92,12 @@ void VKSD_ResetSurface(VKSDOps* vksdo);
*/
VkBool32 VKSD_ConfigureImageSurface(VKSDOps* vksdo);
/**
* [Re]configure stencil attachment of the image surface.
* VKSD_ConfigureImageSurface must have been called before.
*/
VkBool32 VKSD_ConfigureImageSurfaceStencil(VKSDOps* vksdo);
/**
* Configure window surface. This [re]initializes the swapchain.
* VKSD_ConfigureImageSurface must have been called before.

View File

@@ -24,13 +24,12 @@
* questions.
*/
#include <stdlib.h>
#include <pthread.h>
#include "VKImage.h"
#include "VKUtil.h"
#include "VKTexturePool.h"
#include "jni.h"
#include "jni_util.h"
#include "Trace.h"
@@ -72,6 +71,10 @@ void VKTexturePoolLock_unlockImpl(ATexturePoolLockPrivPtr *lock) {
if (TRACE_LOCK) J2dRlsTraceLn1(J2D_TRACE_VERBOSE, "VKTexturePoolLock_unlockImpl: lock=%p - unlocked", l);
}
static void VKTexturePool_FindImageMemoryType(VKMemoryRequirements* requirements) {
// TODO both DEVICE_LOCAL and HOST_VISIBLE memory is very precious, we may need to use just DEVICE_LOCAL instead.
VKAllocator_FindMemoryType(requirements, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, VK_ALL_MEMORY_PROPERTIES);
}
/* Texture allocate/free API */
static ATexturePrivPtr* VKTexturePool_createTexture(ADevicePrivPtr *device,
@@ -81,10 +84,10 @@ static ATexturePrivPtr* VKTexturePool_createTexture(ADevicePrivPtr *device,
{
CHECK_NULL_RETURN(device, NULL);
VKImage* texture = VKImage_Create((VKDevice*)device, width, height,
(VkFormat)format,
VK_IMAGE_TILING_LINEAR,
0, (VkFormat)format,
VK_IMAGE_TILING_OPTIMAL,
VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT,
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
VK_SAMPLE_COUNT_1_BIT, VKTexturePool_FindImageMemoryType);
if IS_NULL(texture) {
J2dRlsTrace(J2D_TRACE_ERROR, "VKTexturePool_createTexture: Cannot create VKImage");
return NULL;
@@ -98,15 +101,11 @@ static ATexturePrivPtr* VKTexturePool_createTexture(ADevicePrivPtr *device,
}
static int VKTexturePool_bytesPerPixel(long format) {
switch ((VkFormat)format) {
case VK_FORMAT_R8G8B8A8_UNORM:
return 4;
case VK_FORMAT_R8_UNORM:
return 1;
default:
J2dRlsTraceLn1(J2D_TRACE_ERROR, "VKTexturePool_bytesPerPixel: format=%d not supported (4 bytes by default)", format);
return 4;
}
FormatGroup group = VKUtil_GetFormatGroup((VkFormat)format);
if (group.bytes == 0) {
J2dRlsTraceLn1(J2D_TRACE_ERROR, "VKTexturePool_bytesPerPixel: format=%d not supported (4 bytes by default)", format);
return 4;
} else return (int) group.bytes;
}
static void VKTexturePool_freeTexture(ADevicePrivPtr *device, ATexturePrivPtr *texture) {
@@ -116,7 +115,7 @@ static void VKTexturePool_freeTexture(ADevicePrivPtr *device, ATexturePrivPtr *t
if (TRACE_TEX) J2dRlsTraceLn4(J2D_TRACE_VERBOSE, "VKTexturePool_freeTexture: free texture: tex=%p, w=%d h=%d, pf=%d",
tex, tex->extent.width, tex->extent.height, tex->format);
VKImage_free((VKDevice*)device, tex);
VKImage_Destroy((VKDevice*)device, tex);
}
/* VKTexturePoolHandle API */

View File

@@ -26,7 +26,23 @@
#include <vulkan/vulkan.h>
/**
* Floating-point RGBA color with sRGB encoding.
* Sometimes we need to reinterpret an image as UNORM instead of its original format.
* Therefore for any resource related to image/attachment format we need two copies:
* - FORMAT_ALIAS_ORIGINAL
* - FORMAT_ALIAS_UNORM
* Such resources are:
* - Image view.
* - Surface framebuffer (Only when dynamicRendering=OFF).
* - Render pass instance (Only when dynamicRendering=OFF).
*
* See SET_FORMAT_ALIASED_HANDLE and VKRenderer_GetFormatAliasForRenderPass for more details.
*/
#define FORMAT_ALIASED [2]
/**
* Floating-point RGBA color components with pre-multiplied alpha.
* May be encoded as either linear, or sRGB depending on the context.
* See CorrectedColor.linear, CorrectedColor.nonlinearSrgb.
*/
typedef union {
struct {
@@ -35,14 +51,29 @@ typedef union {
VkClearValue vkClearValue;
} Color;
/**
* Floating-point RGBA color with pre-multiplied alpha in both linear and sRGB encoding.
* You never need to use linear or sRGB variants directly, use VKRenderer_GetColorForRenderPass instead.
*
* Read more about presenting sRGB content in VKSD_ConfigureWindowSurface.
* Read more about conversion from Java colors in VKUtil_DecodeJavaColor.
*/
typedef struct {
Color linear;
Color nonlinearSrgb;
} CorrectedColor;
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VKMemory);
typedef struct VKGraphicsEnvironment VKGraphicsEnvironment;
typedef struct VKDevice VKDevice;
typedef struct VKAllocator VKAllocator;
typedef struct VKRenderer VKRenderer;
typedef struct VKRenderPass VKRenderPass;
typedef struct VKRenderingContext VKRenderingContext;
typedef struct VKPipelineContext VKPipelineContext;
typedef struct VKRenderPassContext VKRenderPassContext;
typedef struct VKShaders VKShaders;
typedef struct VKTexelBuffer VKTexelBuffer;
typedef struct VKBuffer VKBuffer;
typedef struct VKImage VKImage;
typedef struct VKSDOps VKSDOps;

View File

@@ -21,9 +21,12 @@
// or visit www.oracle.com if you need additional information or have any
// questions.
#include <assert.h>
#include <math.h>
#include "VKUtil.h"
Color VKUtil_DecodeJavaColor(uint32_t srgb) {
CorrectedColor VKUtil_DecodeJavaColor(uint32_t color) {
assert(sizeof(Color) == sizeof(float) * 4);
// Just map [0, 255] integer colors onto [0, 1] floating-point range, it remains in sRGB color space.
// sRGB gamma correction remains unsupported.
static const float NormTable256[256] = {
@@ -32,13 +35,253 @@ Color VKUtil_DecodeJavaColor(uint32_t srgb) {
#define NORM64(N) NORM8(N),NORM8(N+8),NORM8(N+16),NORM8(N+24),NORM8(N+32),NORM8(N+40),NORM8(N+48),NORM8(N+56)
NORM64(0),NORM64(64),NORM64(128),NORM64(192)
};
Color c = {
.r = NormTable256[(srgb >> 16) & 0xFF],
.g = NormTable256[(srgb >> 8) & 0xFF],
.b = NormTable256[ srgb & 0xFF],
.a = NormTable256[(srgb >> 24) & 0xFF]
Color srgb = {
.r = NormTable256[(color >> 16) & 0xFF],
.g = NormTable256[(color >> 8) & 0xFF],
.b = NormTable256[ color & 0xFF],
.a = NormTable256[(color >> 24) & 0xFF]
};
return c;
// This SRGB -> LINEAR conversion implementation is taken from Khronos Data Format Specification:
// https://registry.khronos.org/DataFormat/specs/1.3/dataformat.1.3.html#TRANSFER_SRGB_EOTF
Color linear = {
.r = (float) (srgb.r <= 0.04045 ? srgb.r / 12.92 : pow((srgb.r + 0.055) / 1.055, 2.4)),
.g = (float) (srgb.g <= 0.04045 ? srgb.g / 12.92 : pow((srgb.g + 0.055) / 1.055, 2.4)),
.b = (float) (srgb.b <= 0.04045 ? srgb.b / 12.92 : pow((srgb.b + 0.055) / 1.055, 2.4)),
.a = srgb.a
};
// Convert to pre-multiplied alpha.
srgb.r *= srgb.a;
srgb.g *= srgb.a;
srgb.b *= srgb.a;
linear.r *= linear.a;
linear.g *= linear.a;
linear.b *= linear.a;
return (CorrectedColor) { .linear = linear, .nonlinearSrgb = srgb };
}
uint32_t VKUtil_Log2(uint64_t i) {
// https://graphics.stanford.edu/~seander/bithacks.html#IntegerLogLookup
static const char LogTable256[256] = {
#define LT(n) n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n
-1, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
LT(4), LT(5), LT(5), LT(6), LT(6), LT(6), LT(6),
LT(7), LT(7), LT(7), LT(7), LT(7), LT(7), LT(7), LT(7) };
register uint32_t t;
if (t = i >> 56) return 56 + LogTable256[t];
else if (t = i >> 48) return 48 + LogTable256[t];
else if (t = i >> 40) return 40 + LogTable256[t];
else if (t = i >> 32) return 32 + LogTable256[t];
else if (t = i >> 24) return 24 + LogTable256[t];
else if (t = i >> 16) return 16 + LogTable256[t];
else if (t = i >> 8) return 8 + LogTable256[t];
else return LogTable256[i & 0xFF];
}
FormatGroup VKUtil_GetFormatGroup(VkFormat format) {
#define GROUP(SIZE, ...) return ((FormatGroup) { .bytes = SIZE, .aliases[FORMAT_ALIAS_ORIGINAL] = format, __VA_ARGS__ })
switch (format) {
case VK_FORMAT_R4G4_UNORM_PACK8: GROUP(1, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R4G4_UNORM_PACK8);
case VK_FORMAT_R4G4B4A4_UNORM_PACK16: GROUP(2, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R4G4B4A4_UNORM_PACK16);
case VK_FORMAT_B4G4R4A4_UNORM_PACK16: GROUP(2, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_B4G4R4A4_UNORM_PACK16);
case VK_FORMAT_R5G6B5_UNORM_PACK16: GROUP(2, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R5G6B5_UNORM_PACK16);
case VK_FORMAT_B5G6R5_UNORM_PACK16: GROUP(2, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_B5G6R5_UNORM_PACK16);
case VK_FORMAT_R5G5B5A1_UNORM_PACK16: GROUP(2, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R5G5B5A1_UNORM_PACK16);
case VK_FORMAT_B5G5R5A1_UNORM_PACK16: GROUP(2, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_B5G5R5A1_UNORM_PACK16);
case VK_FORMAT_A1R5G5B5_UNORM_PACK16: GROUP(2, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_A1R5G5B5_UNORM_PACK16);
case VK_FORMAT_R8_UNORM:
case VK_FORMAT_R8_SNORM:
case VK_FORMAT_R8_USCALED:
case VK_FORMAT_R8_SSCALED:
case VK_FORMAT_R8_UINT:
case VK_FORMAT_R8_SINT:
case VK_FORMAT_R8_SRGB:
GROUP(1, .aliases[FORMAT_ALIAS_SRGB] = VK_FORMAT_R8_SRGB,
.aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R8_UNORM, .aliases[FORMAT_ALIAS_SNORM] = VK_FORMAT_R8_SNORM,
.aliases[FORMAT_ALIAS_USCALED] = VK_FORMAT_R8_USCALED, .aliases[FORMAT_ALIAS_SSCALED] = VK_FORMAT_R8_SSCALED,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_R8_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_R8_SINT);
case VK_FORMAT_R8G8_UNORM:
case VK_FORMAT_R8G8_SNORM:
case VK_FORMAT_R8G8_USCALED:
case VK_FORMAT_R8G8_SSCALED:
case VK_FORMAT_R8G8_UINT:
case VK_FORMAT_R8G8_SINT:
case VK_FORMAT_R8G8_SRGB:
GROUP(2, .aliases[FORMAT_ALIAS_SRGB] = VK_FORMAT_R8G8_SRGB,
.aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R8G8_UNORM, .aliases[FORMAT_ALIAS_SNORM] = VK_FORMAT_R8G8_SNORM,
.aliases[FORMAT_ALIAS_USCALED] = VK_FORMAT_R8G8_USCALED, .aliases[FORMAT_ALIAS_SSCALED] = VK_FORMAT_R8G8_SSCALED,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_R8G8_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_R8G8_SINT);
case VK_FORMAT_R8G8B8_UNORM:
case VK_FORMAT_R8G8B8_SNORM:
case VK_FORMAT_R8G8B8_USCALED:
case VK_FORMAT_R8G8B8_SSCALED:
case VK_FORMAT_R8G8B8_UINT:
case VK_FORMAT_R8G8B8_SINT:
case VK_FORMAT_R8G8B8_SRGB:
GROUP(3, .aliases[FORMAT_ALIAS_SRGB] = VK_FORMAT_R8G8B8_SRGB,
.aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R8G8B8_UNORM, .aliases[FORMAT_ALIAS_SNORM] = VK_FORMAT_R8G8B8_SNORM,
.aliases[FORMAT_ALIAS_USCALED] = VK_FORMAT_R8G8B8_USCALED, .aliases[FORMAT_ALIAS_SSCALED] = VK_FORMAT_R8G8B8_SSCALED,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_R8G8B8_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_R8G8B8_SINT);
case VK_FORMAT_B8G8R8_UNORM:
case VK_FORMAT_B8G8R8_SNORM:
case VK_FORMAT_B8G8R8_USCALED:
case VK_FORMAT_B8G8R8_SSCALED:
case VK_FORMAT_B8G8R8_UINT:
case VK_FORMAT_B8G8R8_SINT:
case VK_FORMAT_B8G8R8_SRGB:
GROUP(3, .aliases[FORMAT_ALIAS_SRGB] = VK_FORMAT_B8G8R8_SRGB,
.aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_B8G8R8_UNORM, .aliases[FORMAT_ALIAS_SNORM] = VK_FORMAT_B8G8R8_SNORM,
.aliases[FORMAT_ALIAS_USCALED] = VK_FORMAT_B8G8R8_USCALED, .aliases[FORMAT_ALIAS_SSCALED] = VK_FORMAT_B8G8R8_SSCALED,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_B8G8R8_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_B8G8R8_SINT);
case VK_FORMAT_R8G8B8A8_UNORM:
case VK_FORMAT_R8G8B8A8_SNORM:
case VK_FORMAT_R8G8B8A8_USCALED:
case VK_FORMAT_R8G8B8A8_SSCALED:
case VK_FORMAT_R8G8B8A8_UINT:
case VK_FORMAT_R8G8B8A8_SINT:
case VK_FORMAT_R8G8B8A8_SRGB:
GROUP(4, .aliases[FORMAT_ALIAS_SRGB] = VK_FORMAT_R8G8B8A8_SRGB,
.aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R8G8B8A8_UNORM, .aliases[FORMAT_ALIAS_SNORM] = VK_FORMAT_R8G8B8A8_SNORM,
.aliases[FORMAT_ALIAS_USCALED] = VK_FORMAT_R8G8B8A8_USCALED, .aliases[FORMAT_ALIAS_SSCALED] = VK_FORMAT_R8G8B8A8_SSCALED,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_R8G8B8A8_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_R8G8B8A8_SINT);
case VK_FORMAT_B8G8R8A8_UNORM:
case VK_FORMAT_B8G8R8A8_SNORM:
case VK_FORMAT_B8G8R8A8_USCALED:
case VK_FORMAT_B8G8R8A8_SSCALED:
case VK_FORMAT_B8G8R8A8_UINT:
case VK_FORMAT_B8G8R8A8_SINT:
case VK_FORMAT_B8G8R8A8_SRGB:
GROUP(4, .aliases[FORMAT_ALIAS_SRGB] = VK_FORMAT_B8G8R8A8_SRGB,
.aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_B8G8R8A8_UNORM, .aliases[FORMAT_ALIAS_SNORM] = VK_FORMAT_B8G8R8A8_SNORM,
.aliases[FORMAT_ALIAS_USCALED] = VK_FORMAT_B8G8R8A8_USCALED, .aliases[FORMAT_ALIAS_SSCALED] = VK_FORMAT_B8G8R8A8_SSCALED,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_B8G8R8A8_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_B8G8R8A8_SINT);
case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
case VK_FORMAT_A8B8G8R8_SNORM_PACK32:
case VK_FORMAT_A8B8G8R8_USCALED_PACK32:
case VK_FORMAT_A8B8G8R8_SSCALED_PACK32:
case VK_FORMAT_A8B8G8R8_UINT_PACK32:
case VK_FORMAT_A8B8G8R8_SINT_PACK32:
case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
GROUP(4, .aliases[FORMAT_ALIAS_SRGB] = VK_FORMAT_A8B8G8R8_SRGB_PACK32,
.aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_A8B8G8R8_UNORM_PACK32, .aliases[FORMAT_ALIAS_SNORM] = VK_FORMAT_A8B8G8R8_SNORM_PACK32,
.aliases[FORMAT_ALIAS_USCALED] = VK_FORMAT_A8B8G8R8_USCALED_PACK32, .aliases[FORMAT_ALIAS_SSCALED] = VK_FORMAT_A8B8G8R8_SSCALED_PACK32,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_A8B8G8R8_UINT_PACK32, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_A8B8G8R8_SINT_PACK32);
case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
case VK_FORMAT_A2R10G10B10_SNORM_PACK32:
case VK_FORMAT_A2R10G10B10_USCALED_PACK32:
case VK_FORMAT_A2R10G10B10_SSCALED_PACK32:
case VK_FORMAT_A2R10G10B10_UINT_PACK32:
case VK_FORMAT_A2R10G10B10_SINT_PACK32:
GROUP(4,
.aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_A2R10G10B10_UNORM_PACK32, .aliases[FORMAT_ALIAS_SNORM] = VK_FORMAT_A2R10G10B10_SNORM_PACK32,
.aliases[FORMAT_ALIAS_USCALED] = VK_FORMAT_A2R10G10B10_USCALED_PACK32, .aliases[FORMAT_ALIAS_SSCALED] = VK_FORMAT_A2R10G10B10_SSCALED_PACK32,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_A2R10G10B10_UINT_PACK32, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_A2R10G10B10_SINT_PACK32);
case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
case VK_FORMAT_A2B10G10R10_SNORM_PACK32:
case VK_FORMAT_A2B10G10R10_USCALED_PACK32:
case VK_FORMAT_A2B10G10R10_SSCALED_PACK32:
case VK_FORMAT_A2B10G10R10_UINT_PACK32:
case VK_FORMAT_A2B10G10R10_SINT_PACK32:
GROUP(4,
.aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_A2B10G10R10_UNORM_PACK32, .aliases[FORMAT_ALIAS_SNORM] = VK_FORMAT_A2B10G10R10_SNORM_PACK32,
.aliases[FORMAT_ALIAS_USCALED] = VK_FORMAT_A2B10G10R10_USCALED_PACK32, .aliases[FORMAT_ALIAS_SSCALED] = VK_FORMAT_A2B10G10R10_SSCALED_PACK32,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_A2B10G10R10_UINT_PACK32, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_A2B10G10R10_SINT_PACK32);
case VK_FORMAT_R16_UNORM:
case VK_FORMAT_R16_SNORM:
case VK_FORMAT_R16_USCALED:
case VK_FORMAT_R16_SSCALED:
case VK_FORMAT_R16_UINT:
case VK_FORMAT_R16_SINT:
case VK_FORMAT_R16_SFLOAT:
GROUP(2, .aliases[FORMAT_ALIAS_SFLOAT] = VK_FORMAT_R16_SFLOAT,
.aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R16_UNORM, .aliases[FORMAT_ALIAS_SNORM] = VK_FORMAT_R16_SNORM,
.aliases[FORMAT_ALIAS_USCALED] = VK_FORMAT_R16_USCALED, .aliases[FORMAT_ALIAS_SSCALED] = VK_FORMAT_R16_SSCALED,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_R16_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_R16_SINT);
case VK_FORMAT_R16G16_UNORM:
case VK_FORMAT_R16G16_SNORM:
case VK_FORMAT_R16G16_USCALED:
case VK_FORMAT_R16G16_SSCALED:
case VK_FORMAT_R16G16_UINT:
case VK_FORMAT_R16G16_SINT:
case VK_FORMAT_R16G16_SFLOAT:
GROUP(4, .aliases[FORMAT_ALIAS_SFLOAT] = VK_FORMAT_R16G16_SFLOAT,
.aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R16G16_UNORM, .aliases[FORMAT_ALIAS_SNORM] = VK_FORMAT_R16G16_SNORM,
.aliases[FORMAT_ALIAS_USCALED] = VK_FORMAT_R16G16_USCALED, .aliases[FORMAT_ALIAS_SSCALED] = VK_FORMAT_R16G16_SSCALED,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_R16G16_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_R16G16_SINT);
case VK_FORMAT_R16G16B16_UNORM:
case VK_FORMAT_R16G16B16_SNORM:
case VK_FORMAT_R16G16B16_USCALED:
case VK_FORMAT_R16G16B16_SSCALED:
case VK_FORMAT_R16G16B16_UINT:
case VK_FORMAT_R16G16B16_SINT:
case VK_FORMAT_R16G16B16_SFLOAT:
GROUP(6, .aliases[FORMAT_ALIAS_SFLOAT] = VK_FORMAT_R16G16B16_SFLOAT,
.aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R16G16B16_UNORM, .aliases[FORMAT_ALIAS_SNORM] = VK_FORMAT_R16G16B16_SNORM,
.aliases[FORMAT_ALIAS_USCALED] = VK_FORMAT_R16G16B16_USCALED, .aliases[FORMAT_ALIAS_SSCALED] = VK_FORMAT_R16G16B16_SSCALED,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_R16G16B16_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_R16G16B16_SINT);
case VK_FORMAT_R16G16B16A16_UNORM:
case VK_FORMAT_R16G16B16A16_SNORM:
case VK_FORMAT_R16G16B16A16_USCALED:
case VK_FORMAT_R16G16B16A16_SSCALED:
case VK_FORMAT_R16G16B16A16_UINT:
case VK_FORMAT_R16G16B16A16_SINT:
case VK_FORMAT_R16G16B16A16_SFLOAT:
GROUP(8, .aliases[FORMAT_ALIAS_SFLOAT] = VK_FORMAT_R16G16B16A16_SFLOAT,
.aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R16G16B16A16_UNORM, .aliases[FORMAT_ALIAS_SNORM] = VK_FORMAT_R16G16B16A16_SNORM,
.aliases[FORMAT_ALIAS_USCALED] = VK_FORMAT_R16G16B16A16_USCALED, .aliases[FORMAT_ALIAS_SSCALED] = VK_FORMAT_R16G16B16A16_SSCALED,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_R16G16B16A16_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_R16G16B16A16_SINT);
case VK_FORMAT_R32_UINT:
case VK_FORMAT_R32_SINT:
case VK_FORMAT_R32_SFLOAT:
GROUP(4, .aliases[FORMAT_ALIAS_SFLOAT] = VK_FORMAT_R32_SFLOAT,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_R32_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_R32_SINT);
case VK_FORMAT_R32G32_UINT:
case VK_FORMAT_R32G32_SINT:
case VK_FORMAT_R32G32_SFLOAT:
GROUP(8, .aliases[FORMAT_ALIAS_SFLOAT] = VK_FORMAT_R32G32_SFLOAT,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_R32G32_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_R32G32_SINT);
case VK_FORMAT_R32G32B32_UINT:
case VK_FORMAT_R32G32B32_SINT:
case VK_FORMAT_R32G32B32_SFLOAT:
GROUP(12, .aliases[FORMAT_ALIAS_SFLOAT] = VK_FORMAT_R32G32B32_SFLOAT,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_R32G32B32_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_R32G32B32_SINT);
case VK_FORMAT_R32G32B32A32_UINT:
case VK_FORMAT_R32G32B32A32_SINT:
case VK_FORMAT_R32G32B32A32_SFLOAT:
GROUP(16, .aliases[FORMAT_ALIAS_SFLOAT] = VK_FORMAT_R32G32B32A32_SFLOAT,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_R32G32B32A32_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_R32G32B32A32_SINT);
case VK_FORMAT_R64_UINT:
case VK_FORMAT_R64_SINT:
case VK_FORMAT_R64_SFLOAT:
GROUP(8, .aliases[FORMAT_ALIAS_SFLOAT] = VK_FORMAT_R64_SFLOAT,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_R64_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_R64_SINT);
case VK_FORMAT_R64G64_UINT:
case VK_FORMAT_R64G64_SINT:
case VK_FORMAT_R64G64_SFLOAT:
GROUP(16, .aliases[FORMAT_ALIAS_SFLOAT] = VK_FORMAT_R64G64_SFLOAT,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_R64G64_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_R64G64_SINT);
case VK_FORMAT_R64G64B64_UINT:
case VK_FORMAT_R64G64B64_SINT:
case VK_FORMAT_R64G64B64_SFLOAT:
GROUP(24, .aliases[FORMAT_ALIAS_SFLOAT] = VK_FORMAT_R64G64B64_SFLOAT,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_R64G64B64_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_R64G64B64_SINT);
case VK_FORMAT_R64G64B64A64_UINT:
case VK_FORMAT_R64G64B64A64_SINT:
case VK_FORMAT_R64G64B64A64_SFLOAT:
GROUP(32, .aliases[FORMAT_ALIAS_SFLOAT] = VK_FORMAT_R64G64B64A64_SFLOAT,
.aliases[FORMAT_ALIAS_UINT] = VK_FORMAT_R64G64B64A64_UINT, .aliases[FORMAT_ALIAS_SINT] = VK_FORMAT_R64G64B64A64_SINT);
case VK_FORMAT_R10X6_UNORM_PACK16: GROUP(2, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R10X6_UNORM_PACK16);
case VK_FORMAT_R10X6G10X6_UNORM_2PACK16: GROUP(4, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R10X6G10X6_UNORM_2PACK16);
case VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16: GROUP(8, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16);
case VK_FORMAT_R12X4_UNORM_PACK16: GROUP(2, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R12X4_UNORM_PACK16);
case VK_FORMAT_R12X4G12X4_UNORM_2PACK16: GROUP(4, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R12X4G12X4_UNORM_2PACK16);
case VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16: GROUP(8, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16);
case VK_FORMAT_A4R4G4B4_UNORM_PACK16: GROUP(2, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_A4R4G4B4_UNORM_PACK16);
case VK_FORMAT_A4B4G4R4_UNORM_PACK16: GROUP(2, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_A4B4G4R4_UNORM_PACK16);
case VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR: GROUP(2, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR);
case VK_FORMAT_A8_UNORM_KHR: GROUP(1, .aliases[FORMAT_ALIAS_UNORM] = VK_FORMAT_A8_UNORM_KHR);
default: GROUP(0);
}
#undef GROUP
}
void VKUtil_LogResultError(const char* string, VkResult result) {

View File

@@ -33,6 +33,16 @@
#define C_ARRAY_UTIL_ALLOCATION_FAILED() VK_FATAL_ERROR("CArrayUtil allocation failed")
#include "CArrayUtil.h"
// VK_DEBUG_RANDOM may be used to randomly tune some parameters and turn off some features,
// which would allow to cover wider range of scenarios and catch configuration-specific errors early.
// In debug builds it returns 1 with approximately CHANCE_PERCENT chance, on release builds it is always 0.
// When using this macro, make sure to leave sufficient info in the log to track failing configurations.
#ifdef DEBUG
#define VK_DEBUG_RANDOM(CHANCE_PERCENT) ((rand() % 100) < CHANCE_PERCENT)
#else
#define VK_DEBUG_RANDOM(CHANCE_PERCENT) 0
#endif
// Useful logging & result checking macros
void VKUtil_LogResultError(const char* string, VkResult result);
inline VkBool32 VKUtil_CheckError(VkResult result, const char* errorMessage) {
@@ -58,27 +68,62 @@ inline VkBool32 VKUtil_CheckError(VkResult result, const char* errorMessage) {
#define VK_RUNTIME_ASSERT(...) if (!(__VA_ARGS__)) VK_FATAL_ERROR("Vulkan assertion failed: " #__VA_ARGS__)
/**
* Vulkan expects linear colors.
* However Java2D expects legacy behavior, as if colors were blended in sRGB color space.
* Therefore this function just remaps color components from [0, 255] to [0, 1] range,
* they still represent sRGB color.
* This is also accounted for in VKSD_ConfigureWindowSurface, so that Vulkan doesn't do any
* color space conversions on its own, as the colors we are drawing are already in sRGB.
* Set format-aliased handle.
* CHECK is anything which can be used for matching handle check, usually format aliases.
* It executes a loop for each of two unique format aliases (FORMAT_ALIAS_ORIGINAL and FORMAT_ALIAS_UNORM).
* If CHECK is the same for both format aliases, only one iteration for FORMAT_ALIAS_ORIGINAL is executed,
* and FORMAT_ALIAS_UNORM handle alias is copied from FORMAT_ALIAS_ORIGINAL.
*
* See FORMAT_ALIASED and VKRenderer_GetFormatAliasForRenderPass for more details.
*/
Color VKUtil_DecodeJavaColor(uint32_t color);
#define SET_FORMAT_ALIASED_HANDLE(HANDLE, CHECK, ALIAS) for (FormatAlias (ALIAS) = FORMAT_ALIAS_ORIGINAL; \
(ALIAS) == FORMAT_ALIAS_ORIGINAL || ((ALIAS) == FORMAT_ALIAS_UNORM && \
((CHECK)[FORMAT_ALIAS_UNORM] != (CHECK)[FORMAT_ALIAS_ORIGINAL] || \
(((HANDLE)[FORMAT_ALIAS_UNORM] = (HANDLE)[FORMAT_ALIAS_ORIGINAL]) && 0))); (ALIAS)++)
/*
* The following macros allow the caller to return (or continue) if the
* provided value is NULL. (The strange else clause is included below to
* allow for a trailing ';' after RETURN/CONTINUE_IF_NULL() invocations.)
typedef enum {
FORMAT_ALIAS_ORIGINAL = 0,
FORMAT_ALIAS_UNORM = 1,
FORMAT_ALIAS_SNORM = 2,
FORMAT_ALIAS_USCALED = 3,
FORMAT_ALIAS_SSCALED = 4,
FORMAT_ALIAS_UINT = 5,
FORMAT_ALIAS_SINT = 6,
FORMAT_ALIAS_SFLOAT = 7,
FORMAT_ALIAS_SRGB = 8,
FORMAT_ALIAS_COUNT = 9
} FormatAlias;
/**
* Group of format aliases. Use FormatAlias enum values to index into FormatGroup.aliases.
*/
#define ACT_IF_NULL(ACTION, value) \
if ((value) == NULL) { \
J2dTraceLn1(J2D_TRACE_ERROR, \
"%s is null", #value); \
ACTION; \
} else do { } while (0)
#define RETURN_IF_NULL(value) ACT_IF_NULL(return, value)
#define CONTINUE_IF_NULL(value) ACT_IF_NULL(continue, value)
typedef struct {
VkFormat aliases[FORMAT_ALIAS_COUNT];
uint bytes;
} FormatGroup;
/**
* Convert 32-bit sRGB encoded straight-alpha Java color to [0, 1] normalized
* floating-point representation with pre-multiplied alpha in both linear and sRGB color space.
* You never need to use linear or sRGB variants directly, use VKRenderer_GetColorForRenderPass instead.
*
* Read more about presenting sRGB content in VKSD_ConfigureWindowSurface.
*
* Note: we receive colors from Java with straight (non-premultiplied) alpha, which is unusual.
* This is controlled by PixelConverter parameter of SurfaceType, see VKSurfaceData.java.
* This is done to prevent precision loss and redundant conversions,
* as we need straight alpha to convert from sRGB to linear color space anyway.
*/
CorrectedColor VKUtil_DecodeJavaColor(uint32_t color);
/**
* Integer log2, the same as index of highest set bit.
*/
uint32_t VKUtil_Log2(uint64_t i);
/**
* Get group of formats with the same component layout.
*/
FormatGroup VKUtil_GetFormatGroup(VkFormat format);
#endif //VKUtil_h_Included

View File

@@ -46,7 +46,6 @@ public abstract class WLVKSurfaceData extends VKSurfaceData implements WLSurface
private static final PlatformLogger log = PlatformLogger.getLogger("sun.java2d.vulkan.WLVKSurfaceData");
protected WLComponentPeer peer;
protected WLVKGraphicsConfig graphicsConfig;
private native void initOps(int backgroundRGB);
@@ -57,13 +56,18 @@ public abstract class WLVKSurfaceData extends VKSurfaceData implements WLSurface
{
super(gc, cm, type, 0, 0);
this.peer = peer;
this.graphicsConfig = gc;
final int backgroundRGB = peer.getBackground() != null
? peer.getBackground().getRGB()
: 0;
initOps(backgroundRGB);
}
private void bufferAttached() {
// Called from the native code when a buffer has just been attached to this surface
// but the surface has not been committed yet.
peer.updateSurfaceSize();
}
@Override
public void assignSurface(long surfacePtr) {
assignWlSurface(surfacePtr);
@@ -85,8 +89,8 @@ public abstract class WLVKSurfaceData extends VKSurfaceData implements WLSurface
rq.ensureCapacityAndAlignment(20, 4);
buf.putInt(CONFIGURE_SURFACE);
buf.putLong(getNativeOps());
buf.putInt(width / scale); // TODO This is incorrect, but we'll deal with this later, we probably need to do something on Wayland side for app-controlled scaling
buf.putInt(height / scale); // TODO This is incorrect, but we'll deal with this later, we probably need to do something on Wayland side for app-controlled scaling
buf.putInt(width);
buf.putInt(height);
rq.flushNow();
} finally {
@@ -115,8 +119,9 @@ public abstract class WLVKSurfaceData extends VKSurfaceData implements WLSurface
return false;
}
@Override
public GraphicsConfiguration getDeviceConfiguration() {
return graphicsConfig;
return peer.getGraphicsConfiguration();
}
/**
@@ -180,7 +185,7 @@ public abstract class WLVKSurfaceData extends VKSurfaceData implements WLSurface
@Override
public BufferedContext getContext() {
return graphicsConfig.getContext();
return ((WLVKGraphicsConfig) getDeviceConfiguration()).getContext();
}
@Override

View File

@@ -30,6 +30,11 @@
#include "VKUtil.h"
#include "VKSurfaceData.h"
static void WLVKSurfaceData_OnResize(VKWinSDOps* surface, VkExtent2D extent) {
JNIEnv* env = (JNIEnv*)JNU_GetEnv(jvm, JNI_VERSION_1_2);
JNU_CallMethodByName(env, NULL, surface->vksdOps.sdOps.sdObject, "bufferAttached", "()V");
}
JNIEXPORT void JNICALL Java_sun_java2d_vulkan_WLVKSurfaceData_initOps(JNIEnv *env, jobject vksd, jint backgroundRGB) {
J2dTraceLn1(J2D_TRACE_VERBOSE, "WLVKSurfaceData_initOps(%p)", vksd);
VKWinSDOps* sd = (VKWinSDOps*)SurfaceData_InitOps(env, vksd, sizeof(VKWinSDOps));
@@ -39,6 +44,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_WLVKSurfaceData_initOps(JNIEnv *en
}
sd->vksdOps.drawableType = VKSD_WINDOW;
sd->vksdOps.background = VKUtil_DecodeJavaColor(backgroundRGB);
sd->resizeCallback = WLVKSurfaceData_OnResize;
VKSD_ResetSurface(&sd->vksdOps);
}

View File

@@ -221,7 +221,7 @@ final class ArgumentParser {
private Object value(String name, String type, String text) {
return switch (type) {
case "JULONG" -> parseLong(name, text);
case "INT" -> parseLong(name, text);
case "STRING", "STRING SET" -> text == null ? "" : text;
case "BOOLEAN" -> parseBoolean(name, text);
case "NANOTIME" -> parseNanotime(name, text);
@@ -361,4 +361,4 @@ final class ArgumentParser {
}
}
}
}
}

View File

@@ -237,7 +237,7 @@ final class DCmdDump extends AbstractDCmd {
'yyyy_MM_dd_HH_mm_ss' format.
maxage (Optional) Length of time for dumping the flight recording data to a
file. (INTEGER followed by 's' for seconds 'm' for minutes or 'h' for
file. (INT followed by 's' for seconds 'm' for minutes or 'h' for
hours, no default value)
maxsize (Optional) Maximum size for the amount of data to dump from a flight

View File

@@ -141,7 +141,7 @@ public final class DCmdQuery extends AbstractDCmd {
Options:
maxage (Optional) Length of time for the query to span. (INTEGER followed by
maxage (Optional) Length of time for the query to span. (INT followed by
's' for seconds 'm' for minutes or 'h' for hours, no default value)
maxsize (Optional) Maximum size for the query to span in bytes if one of
@@ -154,7 +154,7 @@ public final class DCmdQuery extends AbstractDCmd {
verbose (Optional) Display additional information about the query execution.
(BOOLEAN, false)
width (Optional) Maximum number of horizontal characters. (BOOLEAN, false)""";
width (Optional) Maximum number of horizontal characters. (INT, default value is 100)""";
}
@Override
@@ -170,7 +170,7 @@ public final class DCmdQuery extends AbstractDCmd {
null, false),
new Argument("verbose", "Display additional information about the query execution", "BOOLEAN", false,
true, "false", false),
new Argument("width", "Maximum number of horizontal characters", "JULONG", false, true, "100",
new Argument("width", "Maximum number of horizontal characters", "INT", false, true, "100",
false), };
}
}

View File

@@ -353,7 +353,7 @@ final class DCmdStart extends AbstractDCmd {
Options:
delay (Optional) Length of time to wait before starting to record
(INTEGER followed by 's' for seconds 'm' for minutes or h' for
(INT followed by 's' for seconds 'm' for minutes or h' for
hours, 0s)
disk (Optional) Flag for also writing the data to disk while recording
@@ -368,7 +368,7 @@ final class DCmdStart extends AbstractDCmd {
id-1-2021_09_14_09_00.jfr) (BOOLEAN, false)
duration (Optional) Length of time to record. Note that 0s means forever
(INTEGER followed by 's' for seconds 'm' for minutes or 'h' for
(INT followed by 's' for seconds 'm' for minutes or 'h' for
hours, 0s)
filename (Optional) Name of the file to which the flight recording data is
@@ -385,7 +385,7 @@ final class DCmdStart extends AbstractDCmd {
maxage (Optional) Maximum time to keep the recorded data on disk. This
parameter is valid only when the disk parameter is set to true.
Note 0s means forever. (INTEGER followed by 's' for seconds 'm'
Note 0s means forever. (INT followed by 's' for seconds 'm'
for minutes or 'h' for hours, 0s)
maxsize (Optional) Maximum size of the data to keep on disk in bytes if

View File

@@ -108,9 +108,9 @@ public class DCmdView extends AbstractDCmd {
return """
Options:
cell-height (Optional) Maximum number of rows in a table cell. (INTEGER, no default value)
cell-height (Optional) Maximum number of rows in a table cell. (INT, no default value)
maxage (Optional) Length of time for the view to span. (INTEGER followed by
maxage (Optional) Length of time for the view to span. (INT followed by
's' for seconds 'm' for minutes or 'h' for hours, default value is 10m)
maxsize (Optional) Maximum size for the view to span in bytes if one of
@@ -127,7 +127,7 @@ public class DCmdView extends AbstractDCmd {
See list below for available views. (STRING, no default value)
width (Optional) The width of the view in characters
(INTEGER, no default value)""";
(INT, default value is 100)""";
}
public String getExamples() {
@@ -136,7 +136,7 @@ public class DCmdView extends AbstractDCmd {
$ jcmd <pid> JFR.view gc
$ jcmd <pid< JFR.view width=160 hot-methods
$ jcmd <pid> JFR.view width=160 hot-methods
$ jcmd <pid> JFR.view verbose=true allocation-by-class
@@ -154,7 +154,7 @@ public class DCmdView extends AbstractDCmd {
return new Argument[] {
new Argument("cell-height",
"Maximum heigth of a table cell",
"JULONG", false, true, "1", false),
"INT", false, true, "1", false),
new Argument("maxage",
"Maximum duration of data to view, in (s)econds, (m)inutes, (h)ours, or (d)ays, e.g. 60m, or 0 for no limit",
"NANOTIME", false, true, "10m", false),
@@ -172,7 +172,7 @@ public class DCmdView extends AbstractDCmd {
"STRING", true, false, null, false),
new Argument("width",
"Maximum number of horizontal characters",
"JULONG", false, true, "100", false)
"INT", false, true, "100", false)
};
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -35,7 +35,7 @@ import java.util.regex.Pattern;
* @test
* @summary Test of diagnostic command System.map
* @library /test/lib
* @requires (os.family=="linux")
* @requires (os.family == "linux" | os.family == "windows")
* @modules java.base/jdk.internal.misc
* java.compiler
* java.management
@@ -63,11 +63,11 @@ public class SystemDumpMapTest extends SystemMapTestBase {
boolean NMTOff = output.contains("NMT is disabled");
String regexBase = ".*0x\\p{XDigit}+ - 0x\\p{XDigit}+ +\\d+";
HashSet<Pattern> patterns = new HashSet<>();
for (String s: shouldMatchUnconditionally) {
for (String s: shouldMatchUnconditionally()) {
patterns.add(Pattern.compile(s));
}
if (!NMTOff) { // expect VM annotations if NMT is on
for (String s: shouldMatchIfNMTIsEnabled) {
for (String s: shouldMatchIfNMTIsEnabled()) {
patterns.add(Pattern.compile(s));
}
}

View File

@@ -31,7 +31,7 @@ import jdk.test.lib.process.OutputAnalyzer;
* @test
* @summary Test of diagnostic command System.map
* @library /test/lib
* @requires (os.family=="linux")
* @requires (os.family == "linux" | os.family == "windows")
* @modules java.base/jdk.internal.misc
* java.compiler
* java.management
@@ -42,11 +42,11 @@ public class SystemMapTest extends SystemMapTestBase {
public void run(CommandExecutor executor) {
OutputAnalyzer output = executor.execute("System.map");
boolean NMTOff = output.contains("NMT is disabled");
for (String s: shouldMatchUnconditionally) {
for (String s: shouldMatchUnconditionally()) {
output.shouldMatch(s);
}
if (!NMTOff) { // expect VM annotations if NMT is on
for (String s: shouldMatchIfNMTIsEnabled) {
for (String s: shouldMatchIfNMTIsEnabled()) {
output.shouldMatch(s);
}
}

View File

@@ -22,6 +22,8 @@
* questions.
*/
import jdk.test.lib.Platform;
public class SystemMapTestBase {
// e.g.
@@ -29,6 +31,7 @@ public class SystemMapTestBase {
private static final String range = "0x\\p{XDigit}+-0x\\p{XDigit}+";
private static final String space = " +";
private static final String someSize = "\\d+";
private static final String someNumber = "(0x\\p{XDigit}+|\\d+)";
private static final String pagesize = "(4K|8K|16K|64K|2M|16M|64M)";
private static final String prot = "[rwsxp-]+";
@@ -44,7 +47,8 @@ public class SystemMapTestBase {
// java heap is either committed, non-shared, or - in case of ZGC - committed and shared.
private static final String regexBase_java_heap = regexBase + "(shrd,)?com.*";
protected static final String shouldMatchUnconditionally[] = {
private static final String shouldMatchUnconditionally_linux[] = {
// java launcher
regexBase_committed + "/bin/java",
// libjvm
@@ -55,7 +59,7 @@ public class SystemMapTestBase {
regexBase_shared_and_committed + "hsperfdata_.*"
};
protected static final String shouldMatchIfNMTIsEnabled[] = {
private static final String shouldMatchIfNMTIsEnabled_linux[] = {
regexBase_java_heap + "JAVAHEAP.*",
// metaspace
regexBase_committed + "META.*",
@@ -66,4 +70,43 @@ public class SystemMapTestBase {
// Main thread stack
regexBase_committed + "STACK.*main.*"
};
// windows:
private static final String winprot = "[\\-rwxcin]*";
private static final String wintype = "[rc]-(img|map|pvt)";
private static final String winbase = range + space + someSize + space + winprot + space;
private static final String winimage = winbase + "c-img" + space + someNumber + space;
private static final String wincommitted = winbase + "(c-pvt|c-map)" + space + someNumber + space;
private static final String winreserved = winbase + "r-pvt" + space + someNumber + space;
private static final String shouldMatchUnconditionally_windows[] = {
// java launcher
winimage + ".*[\\/\\\\]bin[\\/\\\\]java[.]exe",
// libjvm
winimage + ".*[\\/\\\\]bin[\\/\\\\].*[\\/\\\\]jvm.dll"
};
private static final String shouldMatchIfNMTIsEnabled_windows[] = {
wincommitted + "JAVAHEAP.*",
// metaspace
wincommitted + "META.*",
// parts of metaspace should be uncommitted
winreserved + "META.*",
// code cache
wincommitted + "CODE.*",
// Main thread stack
wincommitted + "STACK-\\d+-main.*"
};
private static final boolean isWindows = Platform.isWindows();
protected static String[] shouldMatchUnconditionally() {
return isWindows ? shouldMatchUnconditionally_windows : shouldMatchUnconditionally_linux;
}
protected static String[] shouldMatchIfNMTIsEnabled() {
return isWindows ? shouldMatchIfNMTIsEnabled_windows : shouldMatchIfNMTIsEnabled_linux;
}
}

View File

@@ -788,3 +788,4 @@ java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java 8258103 linux-all
java/awt/Focus/FrameMinimizeTest/FrameMinimizeTest.java 8016266 linux-x64
java/awt/Frame/SizeMinimizedTest.java 8305915 linux-x64
java/awt/PopupMenu/PopupHangTest.java 8340022 windows-all
java/awt/Focus/MinimizeNonfocusableWindowTest.java 8024487 windows-all

View File

@@ -0,0 +1,76 @@
/*
* Copyright (c) 2011, 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6399659
* @summary When minimizing non-focusable window focus shouldn't jump out of the focused window.
* @library /java/awt/regtesthelpers
* @build PassFailJFrame
* @run main/manual MinimizeNonfocusableWindowTest
*/
import java.awt.Frame;
import java.awt.Window;
import java.util.List;
public class MinimizeNonfocusableWindowTest {
private static final String INSTRUCTIONS = """
You should see three frames: Frame-1, Frame-2 and Unfocusable.
1. Click Frame-1 to make it focused window, then click Frame-2.
Minimize Unfocusable frame with the mouse. If Frame-2 is still
the focused window continue testing, otherwise press FAIL.
2. Restore Unfocusable frame to normal state. Try to resize by dragging
its edge with left mouse button. It should be resizable. If not press
FAIL. Try the same with right mouse button. It shouldn't resize.
If it does, press FAIL, otherwise press PASS.""";
public static void main(String[] args) throws Exception {
PassFailJFrame.builder()
.title("MinimizeNonfocusableWindowTest Instructions")
.instructions(INSTRUCTIONS)
.rows((int) INSTRUCTIONS.lines().count() + 1)
.columns(40)
.testUI(MinimizeNonfocusableWindowTest::createTestUI)
.build()
.awaitAndCheck();
}
private static List<Window> createTestUI() {
Frame frame1 = new Frame("Frame-1");
Frame frame2 = new Frame("Frame-2");
Frame frame3 = new Frame("Unfocusable");
frame1.setBounds(100, 0, 200, 100);
frame2.setBounds(100, 150, 200, 100);
frame3.setBounds(100, 300, 200, 100);
frame3.setFocusableWindowState(false);
return List.of(frame1, frame2, frame3);
}
}

View File

@@ -0,0 +1,98 @@
/*
* Copyright (c) 1999, 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4257071 4228379
* @summary Ensures that focus lost is delivered to a lightweight component
in a disposed window
* @library /java/awt/regtesthelpers
* @build PassFailJFrame
* @run main/manual WindowDisposeFocusTest
*/
import java.awt.Window;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class WindowDisposeFocusTest {
private static final String INSTRUCTIONS = """
Click on "Second"
Click on close box
When dialog pops up, "Second" should no longer have focus.""";
public static void main(String[] args) throws Exception {
PassFailJFrame.builder()
.title("WindowDisposeFocusTest Instructions")
.instructions(INSTRUCTIONS)
.rows((int) INSTRUCTIONS.lines().count() + 2)
.columns(35)
.testUI(WindowDisposeFocusTest::createTestUI)
.build()
.awaitAndCheck();
}
private static Window createTestUI() {
return JFCFocusBug2.test(new String[]{});
}
}
class JFCFocusBug2 extends JPanel {
static public Window test(String[] args) {
final JFrame frame = new JFrame("WindowDisposeFrame");
frame.setSize(100, 100);
frame.setVisible(true);
final JFCFocusBug2 bug = new JFCFocusBug2();
final JDialog dialog = new JDialog(frame, false);
dialog.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dialog.dispose();
JDialog dialog2 = new JDialog(frame, false);
dialog2.setContentPane(bug);
dialog2.pack();
dialog2.setVisible(true);
}
});
dialog.setContentPane(bug);
dialog.pack();
dialog.setVisible(true);
return frame;
}
public JFCFocusBug2() {
_first = new JButton("First");
_second = new JButton("Second");
add(_first);
add(_second);
}
private JButton _first;
private JButton _second;
}

View File

@@ -0,0 +1,91 @@
/*
* Copyright (c) 2006, 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6435715
* @summary JButton stops receiving the focusGained event and eventually focus is lost altogether
* @modules java.desktop/sun.awt
* @library /java/awt/regtesthelpers
* @build PassFailJFrame
* @run main/manual bug6435715
*/
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class bug6435715 {
private static final String INSTRUCTIONS = """
1. after test started you will see frame with three buttons. Notice that focus is on Button2.
2. Click on Button 3. Focus goes to Button3.
3. Click on Button1 and quickly switch to another window. Via either alt/tab or
clicking another window with the mouse.
4. After a few seconds, come back to the frame. Notice that focus is around Button2
5. Click at Button3. If focus remains at Button2 test failed, if focus is on Button3 - test passed.""";
public static void main(String[] args) throws Exception {
PassFailJFrame.builder()
.title("bug6435715 Instructions")
.instructions(INSTRUCTIONS)
.rows((int) INSTRUCTIONS.lines().count() + 5)
.columns(35)
.testUI(bug6435715::createTestUI)
.build()
.awaitAndCheck();
}
private static JFrame createTestUI() {
JFrame fr = new JFrame("FocusIssue");
sun.awt.SunToolkit.setLWRequestStatus(fr, true);
JPanel panel = new JPanel();
final JButton b1 = new JButton("Button 1");
final JButton b2 = new JButton("Button 2");
final JButton b3 = new JButton("Button 3");
panel.add(b1);
panel.add(b2);
panel.add(b3);
b1.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent event) {
synchronized (this) {
try {
wait(1000);
} catch (Exception ex) {
ex.printStackTrace();
}
b2.requestFocus();
}
}
});
fr.getContentPane().add(panel);
fr.pack();
return fr;
}
}

View File

@@ -0,0 +1,169 @@
/*
* Copyright (c) 1999, 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.Label;
import java.awt.Panel;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.TextField;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
/*
* @test
* @key headful
* @bug 4247913
* @summary Tests that Label repaints after call Container.validate()
* @run main ContainerValidateTest
*/
public class ContainerValidateTest extends Frame implements MouseListener {
private static Robot robot;
private static Panel currentPanel;
private static Button currentBtn;
private static Panel updatedPanel;
private static Label updatedLabel;
private static TextField updatedTxtField;
private static Button updatedBtn;
private static volatile Rectangle btnBounds;
Panel pnl1 = new Panel();
Panel pnl2 = new Panel();
Label lbl1 = new Label("Label 1");
Label lbl2 = new Label("Label 2");
TextField txt1 = new TextField("field1", 20);
TextField txt2 = new TextField("field2", 20);
Button btn1 = new Button("Swap 1");
Button btn2 = new Button("Swap 2");
public static void main(String[] args) throws Exception {
robot = new Robot();
ContainerValidateTest containerValidate = new ContainerValidateTest();
EventQueue.invokeAndWait(containerValidate::createAndShowUI);
robot.waitForIdle();
robot.delay(1000);
containerValidate.testUI();
}
private void createAndShowUI() {
this.setTitle("ContainerValidateTest Test");
pnl1.add(lbl1);
pnl1.add(txt1);
pnl1.add(btn1);
pnl2.add(lbl2);
pnl2.add(txt2);
pnl2.add(btn2);
btn1.addMouseListener(this);
btn2.addMouseListener(this);
this.add(pnl1, BorderLayout.CENTER);
pack();
setLocationRelativeTo(null);
setVisible(true);
}
private void testUI() throws Exception {
EventQueue.invokeAndWait(() -> btnBounds
= new Rectangle(btn1.getLocationOnScreen().x,
btn1.getLocationOnScreen().y,
btn1.getWidth(),
btn1.getHeight()));
for (int i= 1; i < 4 ; i++) {
EventQueue.invokeAndWait(() -> {
currentPanel = (Panel) this.getComponent(0);
currentBtn = (Button) currentPanel.getComponent(2);
});
robot.mouseMove(btnBounds.x + (int) btnBounds.getWidth() / 2,
btnBounds.y + (int) btnBounds.getHeight() / 2);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.waitForIdle();
//large delay set for completion of UI validate()
robot.delay(500);
EventQueue.invokeAndWait(() -> {
updatedPanel = (Panel) this.getComponent(0);
updatedLabel = (Label) updatedPanel.getComponent(0);
updatedTxtField = (TextField) updatedPanel.getComponent(1);
updatedBtn = (Button) updatedPanel.getComponent(2);
});
testPanelComponents(currentBtn.getLabel());
}
}
private void testPanelComponents(String btnLabel) {
if (btnLabel.equals("Swap 1")) {
if (!(updatedLabel.getText().equals(lbl2.getText())
&& updatedTxtField.getText().equals(txt2.getText())
&& updatedBtn.getLabel().equals(btn2.getLabel()))) {
throw new RuntimeException("Test Failed!! Labels not repainted"
+ " after Container.validate()");
}
} else {
if (!(updatedLabel.getText().equals(lbl1.getText())
&& updatedTxtField.getText().equals(txt1.getText())
&& updatedBtn.getLabel().equals(btn1.getLabel()))) {
throw new RuntimeException("Test Failed!! Labels not repainted"
+ " after Container.validate()");
}
}
}
@Override
public void mousePressed(MouseEvent evt) {
if (evt.getComponent() instanceof Button btn) {
if (btn.equals(btn1)) {
remove(pnl1);
add(pnl2, BorderLayout.CENTER);
} else {
remove(pnl2);
add(pnl1, BorderLayout.CENTER);
}
invalidate();
validate();
}
}
@Override
public void mouseReleased(MouseEvent e) {}
@Override
public void mouseEntered(MouseEvent e) {}
@Override
public void mouseExited(MouseEvent e) {}
@Override
public void mouseClicked(MouseEvent e) {}
}

View File

@@ -0,0 +1,178 @@
/*
* Copyright (c) 1999, 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.awt.Button;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Label;
import java.awt.Point;
import java.awt.Robot;
import java.awt.TextField;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import jdk.test.lib.Platform;
/*
* @test
* @bug 4124697
* @key headful
* @summary Make sure that after setting and then changing the echo
* character again, the TextField continues to function as expected.
* @library /test/lib
* @build jdk.test.lib.Platform
* @run main SetEchoCharTest
*/
public class SetEchoCharTest {
private static Frame frame;
private static Robot robot;
private static TextField tfPassword;
private static Button btn1;
private static Button btn2;
private static volatile Point btn1Loc;
private static volatile Point btn2Loc;
private static final String CHANGE = "Change echo char";
private static final String PRINT = "Print text";
private static final String INITIAL_TEXT = "DefaultPwd";
private static final String CHANGED_TEXT = "NewPwd";
private static final char NEW_ECHO_CHAR = '*';
public static void main(String[] args) throws Exception {
try {
robot = new Robot();
robot.setAutoWaitForIdle(true);
robot.setAutoDelay(50);
EventQueue.invokeAndWait(() -> createAndShowUI());
robot.waitForIdle();
robot.delay(1000);
testEchoChar();
robot.waitForIdle();
robot.delay(200);
testNewEchoChar();
robot.waitForIdle();
robot.delay(200);
} finally {
EventQueue.invokeAndWait(() -> {
if (frame != null) {
frame.dispose();
}
});
}
}
private static void createAndShowUI() {
frame = new Frame("SetEchoCharTest");
frame.setLayout(new FlowLayout());
Label label = new Label("Pwd:");
tfPassword = new TextField(INITIAL_TEXT, 10);
tfPassword.setEchoChar('X');
tfPassword.addActionListener((ActionListener) e -> {
if (e.getActionCommand().equals(CHANGED_TEXT)) {
//check the 2nd condition only if ActionEvent
//is triggered by changed text
if (!(tfPassword.getText().equals(CHANGED_TEXT)
&& tfPassword.getEchoChar() == NEW_ECHO_CHAR)) {
throw new RuntimeException("Test Failed!!! TextField not working"
+ " as expected after echo char change");
}
}
});
frame.add(label);
frame.add(tfPassword);
btn1 = new Button(PRINT);
btn1.addActionListener(new BtnActionListener());
frame.add(btn1);
btn2 = new Button(CHANGE);
btn2.addActionListener(new BtnActionListener());
frame.add(btn2);
frame.setSize(200,200);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
private static void testEchoChar() throws Exception {
EventQueue.invokeAndWait(() -> {
btn1Loc = btn1.getLocationOnScreen();
btn2Loc = btn2.getLocationOnScreen();
});
robot.mouseMove(btn1Loc.x + btn1.getWidth() / 2,
btn1Loc.y + btn1.getHeight() / 2);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.delay(1000);
robot.mouseMove(btn2Loc.x + btn2.getWidth() / 2,
btn2Loc.y + btn2.getHeight() / 2);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.delay(1000);
}
private static void testNewEchoChar() {
StringSelection stringSelection = new StringSelection(CHANGED_TEXT);
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(stringSelection, stringSelection);
int ctrlKey = Platform.isOSX() ? KeyEvent.VK_META : KeyEvent.VK_CONTROL;
robot.keyPress(ctrlKey);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_V);
robot.keyRelease(ctrlKey);
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
}
private static class BtnActionListener implements ActionListener {
public void actionPerformed(ActionEvent evt) {
String ac = evt.getActionCommand();
if (CHANGE.equals(ac)) {
tfPassword.setText("");
tfPassword.setEchoChar(NEW_ECHO_CHAR);
tfPassword.requestFocus();
}
if (PRINT.equals(ac)) {
if (!tfPassword.getText().equals(INITIAL_TEXT)) {
throw new RuntimeException("Test Failed!!!"
+ " Initial text not as expected");
}
}
}
}
}

View File

@@ -0,0 +1,90 @@
/*
* Copyright (c) 2005, 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.awt.FlowLayout;
import java.awt.Label;
import java.awt.TextField;
import javax.swing.JPanel;
import jdk.test.lib.Platform;
/*
* @test
* @bug 6191897
* @summary Verifies that ctrl+left/right does not move word-by-word in a TextField
* with echo character set
* @library /java/awt/regtesthelpers /test/lib
* @build PassFailJFrame jdk.test.lib.Platform
* @run main/manual SetEchoCharWordOpsTest
*/
public class SetEchoCharWordOpsTest {
public static void main(String[] args) throws Exception {
String selectAllKey;
String moveKeys;
String selectKeys;
if (Platform.isOSX()) {
selectAllKey = "Cmd + A";
moveKeys = "Alt + Right/Left";
selectKeys = "Shift + Alt + Right/Left";
} else {
selectAllKey = "Ctrl + A";
moveKeys = "Ctrl + Right/Left";
selectKeys = "Shift + Ctrl + Right/Left";
}
String instructions =
"The password field (in the bottom panel) in this test contains"
+ " a few words (3 words).\n"
+ "Move the focus to the text field and press " + selectAllKey + ".\n"
+ "Try moving the caret word-by-word with " + moveKeys + " or"
+ " extending selection with " + selectKeys + "."
+ " You should NOT be able to do that.\n\n"
+ "If you are able to move the caret word-by-word press FAIL,"
+ " else press PASS.";
PassFailJFrame.builder()
.title("SetEchoCharClipboard Instructions")
.instructions(instructions)
.rows((int) instructions.lines().count() + 3)
.columns(45)
.splitUIBottom(SetEchoCharWordOpsTest::createAndShowUI)
.build()
.awaitAndCheck();
}
private static JPanel createAndShowUI() {
JPanel jPanel = new JPanel();
TextField tf = new TextField("one two three", 15);
Label tfLabel = new Label("Password Field:");
jPanel.setLayout(new FlowLayout());
tf.setEchoChar('*');
jPanel.add(tfLabel);
jPanel.add(tf);
return jPanel;
}
}

View File

@@ -0,0 +1,70 @@
/*
* Copyright (c) 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @library /test/lib
* @bug 8337302
* @enablePreview
* @summary Tests that an exception is thrown if a type variable is not declared
*/
import jdk.test.lib.ByteCodeLoader;
import java.lang.classfile.ClassFile;
import java.lang.classfile.Signature;
import java.lang.classfile.attribute.SignatureAttribute;
import java.lang.constant.ClassDesc;
import java.lang.reflect.AccessFlag;
import java.lang.reflect.Type;
public class TestMissingTypeVariable {
public static void main(String[] args) throws Exception {
ClassFile cf = ClassFile.of();
byte[] bytes = cf.build(
ClassDesc.of("sample.MissingVariable"),
classBuilder -> {
classBuilder.withSuperclass(ClassDesc.of("java.lang.Object"));
classBuilder.withFlags(AccessFlag.PUBLIC);
classBuilder.withField("f",
ClassDesc.of("java.lang.Object"),
fieldBuilder -> fieldBuilder.withFlags(AccessFlag.PUBLIC).with(SignatureAttribute.of(Signature.parseFrom("TA;"))));
});
/*
package sample;
public class MissingVariable {
public A f; // undeclared type variable
}
*/
Class<?> missing = ByteCodeLoader.load("sample.MissingVariable", bytes);
try {
Type type = missing.getField("f").getGenericType();
throw new IllegalStateException("Expected TypeNotPresentException but got: " + type);
} catch (TypeNotPresentException e) {
if (!"A".equals(e.typeName())) {
throw new IllegalStateException("Unexpected name: " + e.typeName());
}
}
}
}

View File

@@ -0,0 +1,121 @@
/*
* Copyright (c) 2002, 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4725045
* @key headful
* @summary verifies that there are no artifacts due to using
* GDI for copies to the back buffer (GDI should only be used
* for copies to the screen)
* @run main GdiBlitOffscreenTest
*/
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Point;
import java.awt.Robot;
import java.awt.image.BufferedImage;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
public class GdiBlitOffscreenTest {
static volatile JFrame f;
static final int imageW = 100, imageH = 100, FW = 500, FH = 500;
static volatile BufferedImage greenImage;
public static void main(String[] args) throws Exception {
// First, create an image.
greenImage = new BufferedImage(imageW, imageH,
BufferedImage.TYPE_INT_RGB);
Graphics redG = greenImage.getGraphics();
redG.setColor(Color.green);
redG.fillRect(0, 0, imageW, imageH);
redG.setColor(Color.white);
redG.drawString("Passed!", 30, 80);
Robot robot = new Robot();
try {
SwingUtilities.invokeAndWait(GdiBlitOffscreenTest::createUI);
robot.delay(1000);
robot.waitForIdle();
Point p = f.getLocationOnScreen();
Color c = robot.getPixelColor(p.x+FW/2, p.y+FH/2);
if (!c.equals(Color.green)) {
throw new RuntimeException("Color is " + c);
}
} finally {
if (f != null) {
SwingUtilities.invokeAndWait(f::dispose);
}
}
}
private static void createUI() {
f = new JFrame("GdiBlitOffscreenTest");
f.setSize(FW, FH);
f.setVisible(true);
// copy the image to the window.
Graphics g = f.getGraphics();
g.drawImage(greenImage, 0, 0, null);
// Now, get on with the rest of the test
JComponent app = new GdiBlitOffscreenTestComponent(imageW, imageH, greenImage);
app.setSize(500, 500);
f.getContentPane().add(app);
f.validate();
f.repaint();
}
}
class GdiBlitOffscreenTestComponent extends JComponent {
int imageW, imageH;
Image theImage;
public GdiBlitOffscreenTestComponent(int imageW, int imageH,
Image theImage)
{
this.theImage = theImage;
this.imageW = imageW;
this.imageH = imageH;
}
public void paintComponent(Graphics g) {
int imageX = (getWidth() - imageW) / 2;
int imageY = (getHeight() - imageH) / 2;
g.setColor(Color.blue);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Color.red);
g.fillRect(imageX, imageY, imageW, imageH);
g.setColor(Color.white);
g.drawString("Failed!", imageX + 30, imageY + 80);
g.drawImage(theImage, imageX, imageY, null);
}
}

View File

@@ -0,0 +1,95 @@
/*
* Copyright (c) 2002, 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4693644
* @summary verifies that there are no artifacts due to copying with GDI
* @library /java/awt/regtesthelpers
* @build PassFailJFrame
* @run main/manual GdiLockTest
*/
import java.awt.Color;
import java.awt.Component;
import java.awt.Frame;
import java.awt.Graphics;
public class GdiLockTest {
static final String INSTRUCTIONS = """
A window will open up next to these instructions.
The text you see in that window should blink on and off.
If it never disappears, then the test has failed.
""";
public static void main(String[] argv) throws Exception {
PassFailJFrame.builder()
.title("GdiLockTest")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(5)
.columns(45)
.testUI(GdiLockTest::createUI)
.build()
.awaitAndCheck();
}
private static Frame createUI() {
Frame f = new Frame("GdiLockTest");
f.setSize(300, 300);
GdiLockTestComponent test = new GdiLockTestComponent();
Thread t = new Thread(test);
f.add(test);
t.start();
return f;
}
}
class GdiLockTestComponent extends Component implements Runnable {
boolean textVisible = true;
public void paint(Graphics g) {
g.setColor(Color.white);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Color.black);
if (!textVisible) {
g.setClip(200, 200, 300, 300);
}
g.drawString("This text should be blinking", 10, 30);
if (!textVisible) {
g.setClip(0, 0, getWidth(), getHeight());
}
}
public void run() {
while (true) {
repaint();
textVisible = !textVisible;
try {
Thread.sleep(500);
} catch (Exception e) {}
}
}
}

View File

@@ -0,0 +1,69 @@
/*
* Copyright (c) 2001, 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4515761
* @summary verify that drawRoundRect produces correct output for 0 w/h
*/
import java.awt.Color;
import static java.awt.Color.*;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
public class DrawRoundRect0Bug {
public static void main(String argv[]) {
BufferedImage img = new BufferedImage(250, 250, BufferedImage.TYPE_INT_RGB);
Graphics2D g = img.createGraphics();
g.setColor(white);
g.fillRect(0, 0, img.getWidth(), img.getHeight());
g.setColor(green);
g.drawLine(150, 90, 150, 110);
if (img.getRGB(150, 100) != green.getRGB()) {
throw new RuntimeException("Vertical line not green");
}
g.setColor(blue);
g.drawRoundRect(160, 90, 0, 20, 4, 4);
if (img.getRGB(160, 100) != blue.getRGB()) {
throw new RuntimeException("Vertical (ie zero width) round rect not blue");
}
g.setColor(green);
g.drawLine(150, 140, 170, 140);
if (img.getRGB(160, 140) != green.getRGB()) {
throw new RuntimeException("Horizontal line not green");
}
g.setColor(blue);
g.drawRoundRect(150, 150, 20, 0, 4, 4);
if (img.getRGB(160, 150) != blue.getRGB()) {
throw new RuntimeException("Horizontal (ie zero height) round rect not blue");
}
}
}

View File

@@ -0,0 +1,104 @@
/*
* Copyright (c) 2002, 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4652373
* @summary verify that SunGraphics2D survives surface revalidation
* @library /java/awt/regtesthelpers
* @build PassFailJFrame
* @run main/manual RevalidateBug
* @requires (os.family == "windows")
*/
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Rectangle;
import javax.swing.JComponent;
import javax.swing.JFrame;
public class RevalidateBug {
private static final String INSTRUCTIONS = """
This bug only reproduces on Windows systems with a task manager that can lock the computer.
This test draws a grayscale gradient in a window.
After the gradient becomes visible above, use ctrl-alt-del to bring up
the task manager and lock the computer.
Then unlock the computer and the gradient should be repainted to pass.
If the gradient does not appear after unlocking (or if the test gets
an error on its own after unlocking the computer) then it fails.
""";
public static void main(String[] argv) throws Exception {
PassFailJFrame.builder()
.title("RevalidateBug")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(12)
.columns(50)
.testUI(RevalidateBug::createUI)
.build()
.awaitAndCheck();
}
private static JFrame createUI() {
JComponent comp = new JComponent() {
protected void paintComponent(Graphics g) {
super.paintComponent(g);
System.out.println("paintComponent");
Graphics2D g2d = (Graphics2D) g;
Insets insets = getInsets();
Rectangle rect =
new Rectangle(insets.left, insets.top,
getWidth() - insets.right - insets.left,
getHeight() - insets.top - insets.bottom);
g2d.setPaint(new GradientPaint(rect.x, rect.y, Color.white,
rect.x + rect.width, rect.y, Color.black));
System.out.println(rect + " w:" + getWidth() + " h:"+getHeight());
g2d.fillRect(0, 0, getWidth(), getHeight());
}
public Dimension getPreferredSize() {
return new Dimension(500, 500);
}
};
JFrame f = new JFrame("RevalidateTest");
f.add(comp);
f.pack();
return f;
}
}

View File

@@ -0,0 +1,95 @@
/*
* Copyright (c) 2001, 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4516037
* @summary verify that scaled Polygons honor the transform
*/
import java.awt.Color;
import static java.awt.Color.*;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.image.BufferedImage;
public class ScaledPolyTest {
public static void main(String[] args) {
Polygon poly = new Polygon();
poly.addPoint(20, 10);
poly.addPoint(30, 30);
poly.addPoint(10, 30);
poly.addPoint(20, 10);
int height = 300;
int width = 300;
BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = bi.createGraphics();
g2d.setColor(Color.white);
g2d.fillRect(0, 0, bi.getWidth(), bi.getHeight());
g2d.translate(10, 10);
g2d.scale(2, 2);
g2d.setColor(Color.yellow);
g2d.fill(poly);
g2d.setColor(Color.blue);
g2d.draw(poly);
/*
* Examine each row of the image.
* If the stroked polygon is correctly aligned on the filled polygon,
* if there is anything except white on the line,
* the transition will always be white+->blue+->yellow*->blue*->white+
*/
int bluePix = blue.getRGB();
int yellowPix = yellow.getRGB();
int whitePix = white.getRGB();
for (int y = 0; y < height; y++ ) {
int x = 0;
int pix = whitePix;
while (pix == whitePix && x < width) pix = bi.getRGB(x++, y);
if (pix == whitePix && x == width) continue; // all white row.
if (pix != bluePix) throw new RuntimeException("Expected blue");
while (pix == bluePix) pix = bi.getRGB(x++, y);
if (pix == yellowPix) {
while (pix == yellowPix) pix = bi.getRGB(x++, y);
if (pix != bluePix) throw new RuntimeException("Expected blue");
while (pix == bluePix) pix = bi.getRGB(x++, y);
if (pix != whitePix) throw new RuntimeException("Expected white");
}
while (pix == whitePix && x < width) pix = bi.getRGB(x++, y);
if (pix == whitePix && x == width) {
continue;
} else {
throw new RuntimeException("Expected white to finish the row");
}
}
}
}

View File

@@ -51,6 +51,8 @@ public class TestJcmdPIDSubstitution {
verifyOutputFilenames("GC.heap_dump", FILENAME);
if (Platform.isLinux()) {
verifyOutputFilenames("Compiler.perfmap", FILENAME);
}
if (Platform.isLinux() || Platform.isWindows()) {
verifyOutputFilenames("System.dump_map", "-F=%s".formatted(FILENAME));
}
}

File diff suppressed because it is too large Load Diff