Re: [OpenJDK 2D-Dev] RFR: 8252133: The java/awt/GraphicsDevice/DisplayModes/CycleDMImage.java fails if metal pipeline is active [v4]

2020-10-20 Thread Sergey Bylokhov
On Tue, 20 Oct 2020 23:43:46 GMT, Alexander Zuev  wrote:

>> Sergey Bylokhov has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Update CGraphicsEnvironment.java
>
> src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java line 182:
> 
>> 180: }
>> 181: // fetch the main display again, the old value might be outdated
>> 182: mainDisplayID = getMainDisplayID();
> 
> What action since line 162 can trigger changing the getMainDisplayID() 
> outcome?

If the main screen is not in the list of screens means that the system monitors 
were changed in some way after this
method was called and we will get one more notification later.

-

PR: https://git.openjdk.java.net/jdk/pull/554


Re: [OpenJDK 2D-Dev] RFR: 8252133: The java/awt/GraphicsDevice/DisplayModes/CycleDMImage.java fails if metal pipeline is active [v4]

2020-10-20 Thread Alexander Zuev
On Fri, 9 Oct 2020 05:42:31 GMT, Sergey Bylokhov  wrote:

>> This bug easily reproduced by the test in question on the dual video card 
>> systems
>> when the metal pipeline is active. But it is possible to reproduce it in the 
>> OGL
>> pipeline as well, but it is required some additional steps.
>> 
>> Problem description:
>>Our CGraphicsEnvironment maintains the list of active graphics devices. 
>> The one
>> important feature of this CGraphicsEnvironment is to invalidate the old 
>> devices and
>> map them to the new devices. For example, if the user got a reference to the 
>> device,
>> and this device was removed then this reference will refer to the main 
>> screen.
>> 
>> The problem in the current implementation arise when the system has two 
>> video cards:
>>   1 The user get some GraphicsDevice
>>   2 The user sets the full-screen window for this device
>>   3 The user change screen resolution for this device
>>   4 The resolution of the screen is not changed ->> BUG.
>> 
>> The problem is that somewhere after step 1 or 2 and before step 3 the macOS 
>> decided
>> to switch to the discrete video card, but it does not report the old 
>> device(integrated VC)
>> as removed, because actually no screens were removed.
>> 
>> Since it was not reported as removed we did not invalidate it and did not 
>> map it to the
>> new device ->> request to change the screen resolution at step 3 send to 
>> some non existed
>> deviceID.
>> 
>> As a fix I suggest to change this current logic:
>>   - Invalidate devices reported by macOS as removed
>>   - Initialize the main screen
>>   - Initialize all NEW screens
>> 
>> To this logic:
>>   - Ignore devices reported by the macOS as removed
>>   - Initialize the main screen
>>   - Initialize all NEW screens
>>   - Check that the main device is in the list of all NEW devices
>>   - Invalidate all OLD devices which are not in the list of NEW devices
>> 
>> The old review request:
>> https://mail.openjdk.java.net/pipermail/2d-dev/2020-August/011011.html
>
> Sergey Bylokhov has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Update CGraphicsEnvironment.java

src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java line 182:

> 180: }
> 181: // fetch the main display again, the old value might be outdated
> 182: mainDisplayID = getMainDisplayID();

What action since line 162 can trigger changing the getMainDisplayID() outcome?

-

PR: https://git.openjdk.java.net/jdk/pull/554


Re: [OpenJDK 2D-Dev] RFR: 8252133: The java/awt/GraphicsDevice/DisplayModes/CycleDMImage.java fails if metal pipeline is active [v4]

2020-10-19 Thread Phil Race
On Fri, 9 Oct 2020 05:42:31 GMT, Sergey Bylokhov  wrote:

>> This bug easily reproduced by the test in question on the dual video card 
>> systems
>> when the metal pipeline is active. But it is possible to reproduce it in the 
>> OGL
>> pipeline as well, but it is required some additional steps.
>> 
>> Problem description:
>>Our CGraphicsEnvironment maintains the list of active graphics devices. 
>> The one
>> important feature of this CGraphicsEnvironment is to invalidate the old 
>> devices and
>> map them to the new devices. For example, if the user got a reference to the 
>> device,
>> and this device was removed then this reference will refer to the main 
>> screen.
>> 
>> The problem in the current implementation arise when the system has two 
>> video cards:
>>   1 The user get some GraphicsDevice
>>   2 The user sets the full-screen window for this device
>>   3 The user change screen resolution for this device
>>   4 The resolution of the screen is not changed ->> BUG.
>> 
>> The problem is that somewhere after step 1 or 2 and before step 3 the macOS 
>> decided
>> to switch to the discrete video card, but it does not report the old 
>> device(integrated VC)
>> as removed, because actually no screens were removed.
>> 
>> Since it was not reported as removed we did not invalidate it and did not 
>> map it to the
>> new device ->> request to change the screen resolution at step 3 send to 
>> some non existed
>> deviceID.
>> 
>> As a fix I suggest to change this current logic:
>>   - Invalidate devices reported by macOS as removed
>>   - Initialize the main screen
>>   - Initialize all NEW screens
>> 
>> To this logic:
>>   - Ignore devices reported by the macOS as removed
>>   - Initialize the main screen
>>   - Initialize all NEW screens
>>   - Check that the main device is in the list of all NEW devices
>>   - Invalidate all OLD devices which are not in the list of NEW devices
>> 
>> The old review request:
>> https://mail.openjdk.java.net/pipermail/2d-dev/2020-August/011011.html
>
> Sergey Bylokhov has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Update CGraphicsEnvironment.java

Marked as reviewed by prr (Reviewer).

-

PR: https://git.openjdk.java.net/jdk/pull/554


Re: [OpenJDK 2D-Dev] RFR: 8252133: The java/awt/GraphicsDevice/DisplayModes/CycleDMImage.java fails if metal pipeline is active [v4]

2020-10-08 Thread Sergey Bylokhov
> This bug easily reproduced by the test in question on the dual video card 
> systems
> when the metal pipeline is active. But it is possible to reproduce it in the 
> OGL
> pipeline as well, but it is required some additional steps.
> 
> Problem description:
>Our CGraphicsEnvironment maintains the list of active graphics devices. 
> The one
> important feature of this CGraphicsEnvironment is to invalidate the old 
> devices and
> map them to the new devices. For example, if the user got a reference to the 
> device,
> and this device was removed then this reference will refer to the main screen.
> 
> The problem in the current implementation arise when the system has two video 
> cards:
>   1 The user get some GraphicsDevice
>   2 The user sets the full-screen window for this device
>   3 The user change screen resolution for this device
>   4 The resolution of the screen is not changed ->> BUG.
> 
> The problem is that somewhere after step 1 or 2 and before step 3 the macOS 
> decided
> to switch to the discrete video card, but it does not report the old 
> device(integrated VC)
> as removed, because actually no screens were removed.
> 
> Since it was not reported as removed we did not invalidate it and did not map 
> it to the
> new device ->> request to change the screen resolution at step 3 send to some 
> non existed
> deviceID.
> 
> As a fix I suggest to change this current logic:
>   - Invalidate devices reported by macOS as removed
>   - Initialize the main screen
>   - Initialize all NEW screens
> 
> To this logic:
>   - Ignore devices reported by the macOS as removed
>   - Initialize the main screen
>   - Initialize all NEW screens
>   - Check that the main device is in the list of all NEW devices
>   - Invalidate all OLD devices which are not in the list of NEW devices
> 
> The old review request:
> https://mail.openjdk.java.net/pipermail/2d-dev/2020-August/011011.html

Sergey Bylokhov has updated the pull request incrementally with one additional 
commit since the last revision:

  Update CGraphicsEnvironment.java

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/554/files
  - new: https://git.openjdk.java.net/jdk/pull/554/files/a38ef0ef..0b81a0fe

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=554=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=554=02-03

  Stats: 5 lines in 1 file changed: 0 ins; 1 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/554.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/554/head:pull/554

PR: https://git.openjdk.java.net/jdk/pull/554