> The OGL pipeline on Linux passes raw X11 window id to GLX. This is allowed by 
> the spec but is a deprecated compatibility path. Mesa has a 
> [bug](https://gitlab.freedesktop.org/mesa/mesa/-/issues/1001) where 
> glXMakeContextCurrent() drops the buffers of the previously bound drawable 
> when switching to a different window, corrupting its content.
> 
> The fix creates GLXWindow objects via glXCreateWindow() and uses them instead 
> of raw window id for all GLX calls. The question is where to store the 
> GLXWindow. It could be stored in the java in XWindow and passed around, but 
> that would pollute "shared xawt code" with OGL specific state even when OGL 
> is not enabled. Instead, the GLXWindow is managed entirely on the native OGL 
> side using a map keyed by the X window id. This keeps one GLXWindow per X 
> window, creates it only when GLX surfaces are actually used, and uses 
> reference counting so it is destroyed when the last surface releases it.
> 
> Also fixes [JDK-8369561](https://bugs.openjdk.org/browse/JDK-8369561) — wrong 
> pixel colors in DrawBitmaskImage on Linux, same root cause.
> 
> Two tests added:
> - MultiWindowFillTest — reproduces the bug: paints two windows different 
> colors, switches context between them, verifies the first window's content 
> survives
> - FlipCoexistTest — verifies that direct rendering and flip BufferStrategy 
> coexist on the same window. This test will fail if the implementation creates 
> a separate GLXWindow per Java OGL surface instead of sharing one per X window

Sergey Bylokhov has updated the pull request with a new target base due to a 
merge or a rebase. The incremental webrev excludes the unrelated changes 
brought in by the merge/rebase. The pull request contains four additional 
commits since the last revision:

 - Merge branch 'openjdk:master' into JDK-8378201
 - Review feedback
 - Update tests
 - 8378201: [OGL] glXMakeContextCurrent() drops the buffers of the unbound 
drawable

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/29886/files
  - new: https://git.openjdk.org/jdk/pull/29886/files/812f62fa..039d7373

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=29886&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29886&range=01-02

  Stats: 53515 lines in 1527 files changed: 28061 ins; 10571 del; 14883 mod
  Patch: https://git.openjdk.org/jdk/pull/29886.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29886/head:pull/29886

PR: https://git.openjdk.org/jdk/pull/29886

Reply via email to