RFR: 8087980: Add property to disable Monocle cursor

Dell Green github.com+12861109+dellgreen at openjdk.org
Mon Nov 18 14:07:23 UTC 2019


On Sun, 17 Nov 2019 10:04:36 GMT, Dell Green <github.com+12861109+dellgreen at openjdk.org> wrote:

> On Sat, 16 Nov 2019 17:51:56 GMT, John Neffenger <github.com+1413266+jgneff at openjdk.org> wrote:
> 
>> On Sat, 16 Nov 2019 06:09:35 GMT, Dell Green <github.com+12861109+dellgreen at openjdk.org> wrote:
>> 
>>> On Sat, 16 Nov 2019 00:32:31 GMT, John Neffenger <github.com+1413266+jgneff at openjdk.org> wrote:
>>> 
>>>> On Wed, 13 Nov 2019 22:04:36 GMT, Dell Green <github.com+12861109+dellgreen at openjdk.org> wrote:
>>>> 
>>>>> On Wed, 13 Nov 2019 21:34:06 GMT, John Neffenger <github.com+1413266+jgneff at openjdk.org> wrote:
>>>>> 
>>>>>> On Tue, 8 Oct 2019 12:03:42 GMT, Dell Green <12861109+dellgreen at users.noreply.github.com> wrote:
>>>>>> 
>>>>>>> Often on embedded systems a cursor is not a valid input modality. On some of these systems, when the javafx toolkit initialises the native hardware cursor, it produces artefacts which can be seen on screen (in the framebuffer for example). This change adds a system property "monocle.cursor.enabled" that can disable the creation of a native cursor in each of the Monocle NativePlatform implementations in favour of a NullCursor which is a no-op implementation of the NativeCursor abstract class that all native cursors have to implement.
>>>>>>> 
>>>>>>> NullCursor class already existed and was being returned for some implementations like AndroidPlatform and HeadlessPlatform. This change builds upon that and conditionally returns NullCursor for all platforms.
>>>>>>> 
>>>>>>> A system property "monocle.debugcursor" has also been added to turn on logging of which NativeCursor has been selected when the toolkit initialises.
>>>>>>> 
>>>>>>> ----------------
>>>>>>> 
>>>>>>> Commits:
>>>>>>>  - cfbbc7dd: JDK-8087980: Add property to disable Monocle cursor
>>>>>>> 
>>>>>>> Changes: https://git.openjdk.java.net/jfx/pull/5/files
>>>>>>>  Webrev: https://webrevs.openjdk.java.net/jfx/5/webrev.00
>>>>>>>   Issue: https://bugs.openjdk.java.net/browse/JDK-8087980
>>>>>>>   Stats: 49 lines in 8 files changed: 40 ins; 0 del; 9 mod
>>>>>>>   Patch: https://git.openjdk.java.net/jfx/pull/5.diff
>>>>>>>   Fetch: git fetch https://git.openjdk.java.net/jfx pull/5/head:pull/5
>>>>>> 
>>>>>> modules/javafx.graphics/src/main/java/com/sun/glass/ui/monocle/NativePlatform.java line 50:
>>>>>> 
>>>>>>> 49:         AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> {
>>>>>>> 50:             final String str =
>>>>>>> 51:                 System.getProperty("monocle.debugcursor", "");
>>>>>> 
>>>>>> Just a nit, but why `monocle.debugcursor` rather than `monocle.cursor.debug` (my preference), or at least `monocle.debugCursor`? Below is the full list, for comparison, including the two added by this pull request.
>>>>>> 
>>>>>> monocle.cursor.enabled
>>>>>> monocle.debugcursor
>>>>>> monocle.epd.bitsPerPixel
>>>>>> monocle.epd.enableInversion
>>>>>> monocle.epd.forceMonochrome
>>>>>> monocle.epd.noWait
>>>>>> monocle.epd.rotate
>>>>>> monocle.epd.useDitheringY1
>>>>>> monocle.epd.useDitheringY4
>>>>>> monocle.epd.waveformMode
>>>>>> monocle.epd.y8inverted
>>>>>> monocle.input.<product>.flipXY
>>>>>> monocle.input.<product>.maxX
>>>>>> monocle.input.<product>.maxY
>>>>>> monocle.input.<product>.minX
>>>>>> monocle.input.<product>.minY
>>>>>> monocle.input.<product>.touchFilters
>>>>>> monocle.input.touchFilters
>>>>>> monocle.input.touchRadius
>>>>>> monocle.input.traceEvents
>>>>>> monocle.input.traceEvents.verbose
>>>>>> monocle.maliSignedStruct
>>>>>> monocle.platform
>>>>>> monocle.platform.traceConfig
>>>>>> monocle.screen.fb
>>>>>> monocle.stackSize
>>>>>> 
>>>>>> I'm nervous about our hidden API of system properties, and I'm as guilty as anyone with the nine properties I added for Monocle EPD. I think it might be okay as long as the code gets the property values only during class initialization. That should restrict their use to startup scripts and keep them out of application code trying to modify them *on-the-fly* at run time.
>>>>> 
>>>>> if i recall i originally started with the format you recommend as it made more sense, and when looking for other debug logging across the javafx stack I picked up on somewhat of a loose existing convention so changed to match it. I guess it can be whatever everyone agrees upon. :)
>>>> 
>>>> On second thought, let's remove `monocle.debugcursor` and use a [PlatformLogger](https://github.com/openjdk/jfx/blob/master/modules/javafx.base/src/main/java/com/sun/javafx/logging/PlatformLogger.java). The JavaFX loggers are available from [Logging](https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/java/com/sun/javafx/util/Logging.java). In retrospect, that's how I managed to avoid any new *debug* properties for Monocle EPD even though it's packed with debugging and trace messages. For examples, see the variable `logger` in [EPDFrameBuffer](https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/java/com/sun/glass/ui/monocle/EPDFrameBuffer.java), where `logger.fine` is called for messages printed once per run, while `logger.finer` is called for messages printed once per rendered frame.
>>> 
>>> OK, that looks a better way to go. I'll sort out out an additional pull request when back in work Monday. Off the top of your head can you remember the syntax to change the logger level from command line when starting the JVM?
>> 
>>> Off the top of your head can you remember the syntax to change the logger level from command line when starting the JVM?
>> 
>> Here's how I use it. My Bash run script is **bin/run.sh**:
>> 
>> #!/bin/bash
>> # Runs the EPD JavaFX Animator program
>> JAVA_HOME=$HOME/opt/jdk-13.0.1+9
>> JAVAFX_LIB=$HOME/lib/armv6hf-sdk/lib
>> 
>> app_dir=$HOME/src/epd-javafx
>> app_jar=$app_dir/dist/epd-javafx.jar
>> logging=$app_dir/conf/logging.properties
>> 
>> $JAVA_HOME/bin/java -Djava.util.logging.config.file=$logging \
>>     --add-modules=javafx.graphics --module-path=$JAVAFX_LIB \
>>     -Dglass.platform=Monocle -Dmonocle.platform=EPD -Dprism.order=sw \
>>     -Dmonocle.input.18/0/0/0.maxX=800 -Dmonocle.input.18/0/0/0.maxY=600 \
>>     -Dmonocle.epd.waveformMode=4 -jar $app_jar $@
>> 
>> The logging properties are defined in **conf/logging.properties**:
>> 
>>  Properties
>> # Global properties
>> handlers = java.util.logging.ConsoleHandler
>> .level = INFO
>> 
>> # Handler specific properties
>> java.util.logging.ConsoleHandler.level = ALL
>> java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
>> java.util.logging.SimpleFormatter.format=%4$s: %5$s%n
>> 
>> # Facility specific properties
>> javafx.level = FINE
>> 
>> The output looks like the following:
>> 
>> $ sudo bin/run.sh --pattern=3 --loops=0
>> FINE: EPD system properties: {monocle.epd.waveformMode=4}
>> FINE: Frame buffer geometry: 800 600 800 640 32
>> FINE: Frame buffer rgba: 8/16,8/8,8/0,8/24
>> FINE: Frame buffer grayscale: 0
>> FINE: Mapping frame buffer: 1,920,000 bytes
>> Frame rate: 80 frames in 11.93 s =  6.70 fps (149 ms/frame)
>> Frame rate: 80 frames in  9.97 s =  8.03 fps (125 ms/frame)
>> Frame rate: 80 frames in  9.96 s =  8.03 fps (125 ms/frame)
>> 
>> You can just add a new commit to this pull request branch. (I think that's what you meant, but just in case.) The commits get *squashed* into a single commit when they are integrated into the target branch.
> 
> cool thanks, apologies i meant commit. :)

system property has now been changed to use platform logger as advised. has been tested successfully on my imx6 board.

PR: https://git.openjdk.java.net/jfx/pull/5


More information about the openjfx-dev mailing list