JDK-8096755 : Regression: Mac (prism-sw) rendering is corrupted
Type:Bug
Component:javafx
Sub-Component:graphics
Affected Version:8u60
Priority:P3
Status:Resolved
Resolution:Fixed
Submitted:2015-03-11
Updated:2017-10-13
Resolved:2015-03-18
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
This corruption appeared on simple program such as HelloRectangle, please see attached image. I have verified prism-sw were working fine on 8u40.
Comments
It may be related to sw pipeline, but this is all MacOS interface code and that's not part of the SW pipeline that I am familiar with. I did take a quick glance and didn't see anything glaring, but I wasn't always sure what I was looking at at times...
I agree about the subclassing not being worth the effort. Also, after looking more closely and talking with Chien I am fine with the changes to bind / unbind -- it seems cleaner than what I was proposing.
I have tested it on my mac with both SW pipeline and ES2 pipeline and all looks good to me. You should also do more testing before you push, but it looks good to me, and will be good to get this bug fixed.
+1
18-03-2015
I doubt it is worth the risk and effort to do the sub-classing. This is a relatively easy fix and the restored code has been stable for years.
18-03-2015
Reviewed the changes, but have not yet looked at the offending regression change set.
They look ok, but perhaps creating a sub-class might be a cleaner approach?
18-03-2015
Yes, Morris should review this as well. I was thinking it is a prism-sw bug so I tagged Jim instead.
Regarding the suggested change, I believe what I did is correct. We need to go back to the original code:
http://cr.openjdk.java.net/~ckyang/RT-39008/webrev.00/modules/graphics/src/main/native-glass/mac/GlassOffscreen.m.udiff.html
[self unsetContext] was moved into bindForWidth() when we deleted unbind().
Now that we store unbind() it is correct to move it back, and also [self->_offscreen unbind] is a no-op for es2 pipe.
18-03-2015
I'll test it tomorrow, but I think there might be a problem with the changes around GlassOffscreen bindForWidth and unbind. For the HW pipeline the code used to call [self unsetContext] right away, but now waits until unbind is called. I think this reverts too much, and may be better written something like the following (although I need to look at it more closely) :
- (void)bindForWidth:(GLuint)width andHeight:(GLuint)height
{
[self setContext];
[self->_offscreen bindForWidth:width andHeight:height];
+ if (!isSwPipe) {
[self unsetContext];
+ }
+}
+
+- (void)unbind
+{
+ if (isSwPipe) {
+ assert(CGLGetCurrentContext() == self->_ctx);
+ [self->_offscreen unbind];
[self unsetContext];
+ }
}
18-03-2015
Since this is Mac glass code, Morris needs to review it as well.
18-03-2015
Hi Kevin and Jim,
Please review the proposed fix. This fix is essentially to restore the native glass code that was deleted in the cleanup of RT-39008, and guard it for sw pipe only:
http://cr.openjdk.java.net/~ckyang/RT-40245/webrev.00/
18-03-2015
This bug was introduced by the following fix:
The first bad revision is:
changeset: 8599:a69f48b048e5
user: Chien Yang <chien.yang@oracle.com>
date: Fri Jan 23 16:24:36 2015 -0800
summary: RT-39008: [Mac] Glass shouldn't use Prism's context for creating or destroying native rendering resources