On Sat, 5 Aug 2023 13:36:23 GMT, Kevin Rushforth <k...@openjdk.org> wrote:

>> Hi,
>> 
>> I did open the bug report. Some notes to this PR:
>> 
>> My colleagues and I are able to reproduce this bug regularly, even though it 
>> takes sometimes up to 3 or 4 weeks until the D3DERR_DEVICEHUNG error shows 
>> up. We are currently evaluating two versions of fixes, but until now we do 
>> not have any results. I will post them as soon as I got them.
>> 
>> Version 1 (this version): Based on the observation, that the 
>> TestCooperativeLevel/CheckDeviceState method returns D3D_OK again after 
>> about 20 - 60 seconds, the reinitialize is called after the first time the 
>> state is returning D3D_OK. The 'isHung' flag stores the information until 
>> then.
>> 
>> Version 2: calls reinitialize directly after D3DERR_DEVICEHUNG has been 
>> returned. Basically
>> if (hr == D3DERR_DEVICEREMOVED || hr == D3DERR_DEVICEHUNG  ) { .. }
>> 
>> I did not modify the validatePresent method, as for our workaround (see 
>> ticket) it was not necessary. At least the native call swapchain->present 
>> dows not return that error code 
>> (https://learn.microsoft.com/en-us/windows/win32/api/d3d9/nf-d3d9-idirect3dswapchain9-present).
>>  I did not look decisively into all the native calls behind 
>> D3DRTTexture#readPixels.
>> 
>> As I said I will post the results (prism.verbose output) for the 2 versions 
>> later as a base for discussions.
>
> This version seems like a straight-forward fix, so if it resolves the 
> problem, it may well be the best option. It uses the existing well-tested 
> logic to reinitialize once the graphics device reports that it is OK again.
> 
> We can discuss your findings regarding your "version 2" when you are ready, 
> but we would need a pretty compelling reason to want to make any intrusive 
> changes.

Last week the error happend again, and calling reinitialize immediately (-> aka 
Version 2) was again a reliable way to handle it (screenshot is attached). 
Everything runs normal and we did not see multiple reinitializations for the 
same error. The 2 errors are about an hour appart, which indicates two distict 
failures. The former fix did sadly not work, so I updated this PR. We see it as 
a solution and would be glad to integrate it in the code base. @kevinrushforth 
if you have any further questions, please let me know.
<img width="446" alt="screenshot" 
src="https://github.com/openjdk/jfx/assets/39555455/46481930-a6ac-4dac-9214-2682ebfb9ed9";>

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1199#issuecomment-1742111762

Reply via email to