Skip to main content

GPU out of memory exception on Raspberry PI b100

4 replies [Last post]
tlemmons
Offline
Joined: 2013-07-20
Points: 0

I am trying to create a slide show type of application where I display images via an ImabeView/StackPanel. Every once in a while The screen shows blank and I get an exception in the main application.

java.lang.NullPointerException
at com.sun.prism.impl.BaseGraphics.drawTexture(BaseGraphics.java:389)
at com.sun.prism.impl.ps.BaseShaderGraphics.drawTexture(BaseShaderGraphics.java:138)
at com.sun.javafx.sg.prism.NGImageView.renderContent(NGImageView.java:122)
at com.sun.javafx.sg.prism.NGNode$CacheFilter.impl_renderNodeToCache(NGNode.java:1996)
at com.sun.javafx.sg.prism.BaseCacheFilter.render(BaseCacheFilter.java:238)
at com.sun.javafx.sg.prism.NGNode$CacheFilter.render(NGNode.java:1939)
at com.sun.javafx.sg.prism.NGNode.renderCached(NGNode.java:1880)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:1592)
at com.sun.javafx.sg.prism.NGImageView.doRender(NGImageView.java:102)
at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1520)
at com.sun.javafx.sg.prism.NGGroup.renderChildren(NGGroup.java:233)
at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:199)
at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:1249)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:1598)
at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1520)
at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:99)
at com.sun.javafx.tk.quantum.AbstractPainter.paintImpl(AbstractPainter.java:210)
at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:95)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:129)
at java.lang.Thread.run(Thread.java:724)
ES2 Vram Pool: 26,723,730 used (10.0%), 26,723,730 managed (10.0%), 268,435,456 total
6 total resources being managed
1 permanent resources (16.7%)
3 resources locked (50.0%)
3 resources contain interesting data (50.0%)
0 resources disappeared (0.0%)

I have traced this problem through to the nTexImage2D0 call in com.sun.prism.es2.GLContext.java (549) but that is as far as I can go. The call is returning false and printing out a glerror 0x505 which is out of memory and I believe it is talking about memory in the gpu. Can anyone help me troubleshoot the farther or tell me how to work around this problem.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
davehill
Offline
Joined: 2008-07-08
Points: 0

There are several things that could be at play here.

The texture mentioned here would be allocated from "video" memory. On the PI, there is an explicit setting of this in raspi_config.

If you use lots of textures, then you may need to bump the video memory allocation (which takes away from main memory).

The size of the images you are using can come into play too. If you are loading a lot of 12MP images, and displaying to ~2MP, then "pre-scaling" the image will both speed up your app but also use less memory.

The JFX team has been looking at resource management, and dropping unused textures is part of that. Of course before we can do that - you need to free them :-)

For a slideshow app, I would expect that you would only really want a couple of images "in hand". Usually this would be 3 - the previous to handle a back action, the current on display, and the next one.

If you are still seeing a problem, and are using a current drop from java.net, you can file a Jira on the issue. It would be particularly useful if you can share your app by attaching it to the Jira.

tlemmons
Offline
Joined: 2013-07-20
Points: 0

Thanks Dave, I am changing out 1920x1080 jpegs every 20 seconds. It seems like somewhere around the 4th or 5th change I get the exception. I have tried to analyze image file sizes, etc.. but have not gotten a good idea of why. I think I am releasing things correctly but I could have missed something. I will try to put together a small part of my app and put it in Jira.

lisa_selle
Offline
Joined: 2006-11-02
Points: 0

Can you verify the memory configuration you are running with - see if running "sudo raspi-config" and allocating more memory to the GPU resolves the problem? We usually run with a 50/50 memory split (see https://wiki.openjdk.java.net/display/OpenJFX/OpenJFX+on+the+Raspberry+Pi).

tlemmons
Offline
Joined: 2013-07-20
Points: 0

I am running with 128 gpu memory but have tried it a couple of different ways. Does not seem to make a big difference. When I set to 256 it seemed to take longer but it could have been coincidence.