Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8268120: Allow hardware cursor to be used on Monocle-EGL platforms #527

Closed
wants to merge 4 commits into from

Conversation

johanvos
Copy link
Collaborator

@johanvos johanvos commented Jun 3, 2021

Add EGL cursor implementation (Java + native) and the link to low-level drivers.
Fix for JDK-8268120


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8268120: Allow hardware cursor to be used on Monocle-EGL platforms

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/527/head:pull/527
$ git checkout pull/527

Update a local copy of the PR:
$ git checkout pull/527
$ git pull https://git.openjdk.java.net/jfx pull/527/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 527

View PR using the GUI difftool:
$ git pr show -t 527

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/527.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 3, 2021

👋 Welcome back jvos! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Ready for review label Jun 3, 2021
@mlbridge
Copy link

mlbridge bot commented Jun 3, 2021

Webrevs

Copy link
Collaborator

@jperedadnr jperedadnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this PR on embedded, and with it there is a visible mouse cursor, so the issue gets fixed.

I have some comments.

// Fallback to software cursor will be used in case monocle.egl.swcursor is set to true
boolean swcursor = Boolean.getBoolean("monocle.egl.swcursor");
final NativeCursor c = useCursor ? (swcursor ? new SoftwareCursor() : new EGLCursor()) : new NullCursor();
return c;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other platforms add a logging here, with NativePlatform::logSelectedCursor.

int length = (*env)->GetArrayLength(env, jarr);
jbyte *attrArray = (*env)->GetByteArrayElements(env, jarr, JNI_FALSE);
if (attrArray == 0) {
fprintf(stderr, "Fatal error getting char* from jbyteArray\n");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean getting jbyte*?

extern jlong getEglDisplayHandle();

// initialize the EGL system with the specified handle
extern jboolean doEglInitialize(void* handle);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to declare arguments as jlong eglDisplay here instead of void* handle as it is done in other methods?
As I see nEglInitialize() passes eglDisplay on the java side:


but it needs to convert it to a ptr in the native code:
jboolean answer = doEglInitialize(asPtr(eglDisplay));

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the advantage of changing it? In any case, it seems unrelated to this fix.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All other methods doEglChooseConfig, doEglCreateWindowSurface, doEglCreateContext, doEglMakeCurrent, doEglSwapBuffers use jlong eglDisplay. It would be good if all functions have the same style in function argument declaration.

I am wondering, was it made by purpose and void* handle really make sense in doEglInitialize function?
If no, I can change it in a separate fix.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it would be nice to have the same style in all functions, but in that case I think a void* is more appropriate, as that is what EGLDisplay is (https://www.khronos.org/registry/EGL/api/1.1/EGL/egl.h)
One of the goals of egl_ext.h file is to stay as close as possible to the EGL specifications, avoiding the need for cast operations in the low-level implementation. Hence, it would make sense to completely get rid of the jlong declarations at all.
It is the task of the eglBridge.c file to convert from Java style into EGL-style and vice versa.

I am willing to change this, but then a separate issue would be more appropriate I believe.

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have any comments aside from those Jose pointed out.

@openjdk
Copy link

openjdk bot commented Jun 4, 2021

@johanvos This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8268120: Allow hardware cursor to be used on Monocle-EGL platforms

Reviewed-by: jpereda, kcr

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 14 new commits pushed to the master branch:

  • 47700d8: 8267819: CoInitialize/CoUninitialize should be called on same thread
  • 526f990: 8239138: StyleManager should use a BufferedInputStream
  • 5e6d442: 8267892: Add .gitattributes to repo
  • 7b7050c: 8267314: Loading some animated GIFs fails with ArrayIndexOutOfBoundsException: Index 4096 out of bounds for length 4096
  • a645b5a: 8252783: Remove the css Selector and ShapeConverter constructors
  • 329013b: 8267621: Mark HonorDeveloperSettingsTest as unstable on Linux
  • 24ffe35: 8265210: TreeCell: cell editing state not updated on cell re-use
  • 9507ea4: 8264140: Add -Djava.security.manager=allow to JavaFX tests calling setSecurityManager
  • 2fd5092: 8263761: Update boot JDK to 16.0.1
  • aebac07: 8210199: [linux / macOS] fileChooser can't handle emojis
  • ... and 4 more: https://git.openjdk.java.net/jfx/compare/e76b7b1d65cef917630d1c8528d6be56c16c015f...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Ready to be integrated label Jun 4, 2021
@openjdk openjdk bot removed the ready Ready to be integrated label Jun 4, 2021
@openjdk openjdk bot added the ready Ready to be integrated label Jun 4, 2021
@johanvos
Copy link
Collaborator Author

johanvos commented Jun 5, 2021

/integrate

@openjdk openjdk bot closed this Jun 5, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Ready to be integrated rfr Ready for review labels Jun 5, 2021
@openjdk
Copy link

openjdk bot commented Jun 5, 2021

@johanvos Since your change was applied there have been 15 commits pushed to the master branch:

  • ee03238: 8268152: gstmpegaudioparse does not provides timestamps for HLS MP3 streams
  • 47700d8: 8267819: CoInitialize/CoUninitialize should be called on same thread
  • 526f990: 8239138: StyleManager should use a BufferedInputStream
  • 5e6d442: 8267892: Add .gitattributes to repo
  • 7b7050c: 8267314: Loading some animated GIFs fails with ArrayIndexOutOfBoundsException: Index 4096 out of bounds for length 4096
  • a645b5a: 8252783: Remove the css Selector and ShapeConverter constructors
  • 329013b: 8267621: Mark HonorDeveloperSettingsTest as unstable on Linux
  • 24ffe35: 8265210: TreeCell: cell editing state not updated on cell re-use
  • 9507ea4: 8264140: Add -Djava.security.manager=allow to JavaFX tests calling setSecurityManager
  • 2fd5092: 8263761: Update boot JDK to 16.0.1
  • ... and 5 more: https://git.openjdk.java.net/jfx/compare/e76b7b1d65cef917630d1c8528d6be56c16c015f...master

Your commit was automatically rebased without conflicts.

Pushed as commit fe81b9c.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
4 participants