--- old/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.cpp 2016-09-12 17:08:25.908864700 +0300 +++ new/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.cpp 2016-09-12 17:08:25.326363900 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -36,6 +36,7 @@ #include "D3DTextRenderer.h" #include "D3DPipelineManager.h" #include "D3DGlyphCache.h" +#include "Devices.h" typedef struct { D3DBLEND src; @@ -212,11 +213,18 @@ D3DContext::D3DContext(IDirect3D9 *pd3d, UINT adapter) { + HMONITOR hMon; J2dTraceLn(J2D_TRACE_INFO, "D3DContext::D3DContext"); J2dTraceLn1(J2D_TRACE_VERBOSE, " pd3d=0x%x", pd3d); pd3dObject = pd3d; pd3dDevice = NULL; adapterOrdinal = adapter; + hMon = pd3d->GetAdapterMonitor(adapter); + if (hMon && Devices::GetInstance()) { + screen = AwtWin32GraphicsDevice::GetScreenFromHMONITOR(hMon); + } else { + screen = -1; + } pResourceMgr = NULL; pMaskCache = NULL; @@ -254,7 +262,7 @@ EndScene(); D3DPipelineManager::NotifyAdapterEventListeners(devCaps.AdapterOrdinal, - DEVICE_RESET); + DEVICE_RESET, screen); contextCaps = CAPS_EMPTY; @@ -293,7 +301,7 @@ ReleaseDefPoolResources(); D3DPipelineManager::NotifyAdapterEventListeners(devCaps.AdapterOrdinal, - DEVICE_DISPOSED); + DEVICE_DISPOSED, screen); // dispose shader lists ShaderList_Dispose(&convolvePrograms); --- old/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.h 2016-09-12 17:08:29.069869200 +0300 +++ new/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.h 2016-09-12 17:08:28.519868400 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -340,6 +340,7 @@ DWORD lastTextureColorState[MAX_USED_TEXTURE_SAMPLER+1]; UINT adapterOrdinal; + int screen; D3DPRESENT_PARAMETERS curParams; D3DCAPS9 devCaps; int contextCaps; --- old/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.cpp 2016-09-12 17:08:32.089873400 +0300 +++ new/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.cpp 2016-09-12 17:08:31.519872600 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -175,12 +175,8 @@ // static void D3DPipelineManager::NotifyAdapterEventListeners(UINT adapter, - jint eventType) + jint eventType, int screen) { - HMONITOR hMon; - int gdiScreen; - D3DPipelineManager *pMgr; - // fix for 6946559: if d3d preloading fails jmv may be NULL if (jvm == NULL) { return; @@ -189,23 +185,18 @@ JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); RETURN_IF_NULL(env); - pMgr = D3DPipelineManager::GetInstance(); - RETURN_IF_NULL(pMgr); - hMon = pMgr->pd3d9->GetAdapterMonitor(adapter); - /* * If we don't have devices initialized yet, no sense to clear them. */ - if (!Devices::GetInstance()){ + if (!Devices::GetInstance() || screen < 0) { return; } - gdiScreen = AwtWin32GraphicsDevice::GetScreenFromHMONITOR(hMon); - JNU_CallStaticMethodByName(env, NULL, "sun/java2d/pipe/hw/AccelDeviceEventNotifier", "eventOccured", "(II)V", gdiScreen, eventType); + JNU_CHECK_EXCEPTION(env); } UINT D3DPipelineManager::GetAdapterOrdinalForScreen(jint gdiScreen) --- old/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.h 2016-09-12 17:08:35.069877600 +0300 +++ new/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.h 2016-09-12 17:08:34.509876800 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -81,7 +81,7 @@ // notifies adapter event listeners by calling // AccelDeviceEventNotifier.eventOccured() static - void NotifyAdapterEventListeners(UINT adapter, jint eventType); + void NotifyAdapterEventListeners(UINT adapter, jint eventType, int screen); private: D3DPipelineManager(void);