Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8313648

JavaFX application continues to show a black screen after graphic card driver crash

XMLWordPrintable

    • b20
    • generic
    • generic

        ADDITIONAL SYSTEM INFORMATION :
        JavaFX: tested with 17.0.8, but presumably also an issue in the newest version
        OS: Windows 10
        HW: Notebook with integrated Intel HD Graphics 520

        A DESCRIPTION OF THE PROBLEM :
        After a graphic card driver crash, in the Windows 10 event log is protocolled "Display driver igfx stopped responding and has successfully recovered.", yet the JavaFX application only continues to show a black screen. Input events are still registered, which indicates a Prism issue.

        With prism.verbose debug output, the console shows "D3DContext::testLostStateAndReset : Unknown D3D error 0x88760874"
        0x88760874 is the error code for D3DERR_DEVICEHUNG (D3D9_Ex_ (!)) which corresponds to the error in the Windows event log. In D3DContext.java#testLostStateAndReset this error is not specifically handled.


        CUSTOMER SUBMITTED WORKAROUND :
        A try-and-error approach with the following changes in D3DContext.java#testLostStateAndReset:

        public static final int D3DERR_DEVICEHUNG = 0X88760874;

        if (hr == D3DERR_DEVICEHUNG) {
        setLost();

        long retryMillis = TimeUnit.MINUTES.toMillis(5);
        long sleepMillis = TimeUnit.SECONDS.toMillis(1);

        for (int i = 0; i < retryMillis; i += sleepMillis) {
        int cooperativeLevel = D3DResourceFactory.nTestCooperativeLevel(pContext);
        System.err.println("Checking Cooperative Level: " + cooperativeLevel);

        if (cooperativeLevel == D3D_OK) {
        break;
        } else {
        try {
        Thread.sleep(sleepMillis);
        } catch (InterruptedException e) {
        e.printStackTrace();
        }
        }
        }

        // Reinitialize after 5 mins anyway, even if result is not OK.

        // Reinitialize the D3DPipeline. This will dispose and recreate
        // the resource factory and context for each adapter.
        D3DPipeline.getInstance().reinitialize();
        }

        has been sucessful and rendering is working again. The System.err output generated inside the loop only showed again 21 times the D3DERR_DEVICEHUNG error code (equals to 20 seconds in the retry loop), and after that it showed the D3D initialization output. This indicates, that the pd3dDeviceEx->CheckDeviceState returns D3D_OK at some point, but this maybe only apply to the HAL-adapter state, but imho the D3D9(Ex) state has actually been corrupted. As documented here https://learn.microsoft.com/en-us/windows/win32/direct3d9/dx9lh#device-behavior-changes ("If hardware hangs, texture memory is lost. After a driver is stopped, the IDirect9Ex object must be recreated to resume rendering."), it seems that D3DPipeline.getInstance().reinitialize() does the trick.

              kcr Kevin Rushforth
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: