SwapBuffers() dequeue native buffer fail: No such device

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Post Reply
shawndong21
Gnoblar
Posts: 9
Joined: Sun Jan 18, 2015 6:39 pm

SwapBuffers() dequeue native buffer fail: No such device

Post by shawndong21 »

Dear Sir,

I am trying to port our game to android platform. We are using Ogre 1.9.0 final. Since there is no interface to launch IME for softkeypad so I have to use JNI to launch InputMethodManager for the user to input username. It can popup the android UI but the ogre native activity will crash due SwapBuffers error: SwapBuffers() dequeue native buffer fail: No such device.

The android platform target is 10.

Can anyone tell me how to fix it? Any workaround?

Many thanks in advance.

-Shawn

The followings are the log:

Code: Select all

 I/OGRE(25928): click on editbox, popup IME
 I/OGRE(25928): GetInput
 I/OGRE(25928): g_JavaVM->AttachCurrentThread
 I/OGRE(25928): g_JavaVM->AttachCurrentThread return 0
 I/OGRE(25928): g_JavaVM->GetEnv
 I/OGRE(25928): g_JavaVM->GetEnv return 0
 E/NativeActivity(25928): channel '414c20e8 net.gooody.www/android.app.NativeActivity (client)' ~ Failed to receive dispatch signal.  status=-11
 E/NativeActivity(25928): channel '414c20e8 net.gooody.www/android.app.NativeActivity (client)' ~ Failed to receive dispatch signal.  status=-11
 E/NativeActivity(25928): channel '414c20e8 net.gooody.www/android.app.NativeActivity (client)' ~ Failed to receive dispatch signal.  status=-11
 E/NativeActivity(25928): channel '414c20e8 net.gooody.www/android.app.NativeActivity (client)' ~ Failed to receive dispatch signal.  status=-11
 I/Ogre(25928): APP_CMD_LOST_FOCUS
 I/OGRE(25928): mouseReleased:152
 E/NativeActivity(25928): channel '414c20e8 net.gooody.www/android.app.NativeActivity (client)' ~ Failed to receive dispatch signal.  status=-11
 D/memalloc(25928): /dev/pmem: Mapped buffer base:0x5eac6000 size:6819840 offset:4730880 fd:100
 D/OpenGLRenderer(25928): Enabling debug mode 0
 D/memalloc(25928): /dev/pmem: Mapped buffer base:0x5f147000 size:8908800 offset:6819840 fd:103
 E/SurfaceTextureClient(25928): queueBuffer: error queuing buffer to SurfaceTexture, -19
 E/Adreno200-EGLSUB(25928): SwapBuffers() dequeue native buffer fail: No such device
 E/Adreno200-EGLSUB(25928): GetSurfaceSize() dequeue native buffer failed: No such device.
 E/Adreno200-EGLSUB(25928): GetSurfaceSize() dequeue native buffer failed: No such device.
 E/Adreno200-EGL(25928): <eglSurfaceResize:4020>: EGL_BAD_ALLOC
 E/OGRE(25928): OGRE EXCEPTION(3:RenderingAPIException): Fail to SwapBuffers in swapBuffers at ..\..\..\RenderSystems\GLES2\src\EGL\OgreEGLWindow.cpp (line 161)
 A/libc(25928): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: SwapBuffers() dequeue native buffer fail: No such device

Post by c6burns »

1.9.0 from some download or something? You should build from mercurial source v1-9

Also, it seems like you are trying to call renderOneFrame right after your app loses focus (APP_CMD_LOST_FOCUS)
shawndong21
Gnoblar
Posts: 9
Joined: Sun Jan 18, 2015 6:39 pm

Re: SwapBuffers() dequeue native buffer fail: No such device

Post by shawndong21 »

c6burns wrote:1.9.0 from some download or something? You should build from mercurial source v1-9

Also, it seems like you are trying to call renderOneFrame right after your app loses focus (APP_CMD_LOST_FOCUS)
Thanks so much for your reply!

I download it from the 1.9.0 final branch because I need to use CEGUI for android build as well.

Actually I have turned off renderOneFrame before starting the android java activity:

Code: Select all

		case APP_CMD_LOST_FOCUS:
			LOGI("APP_CMD_LOST_FOCUS");
			mBrowser->applicationWillResignActive();
			break;

        void applicationWillResignActive()
        {
            if(_app)
            {
            	LOGI("SampleBrowser: applicationDidResignActive");
                _app->on_app_will_resign_active();
                _app->set_pause_render(true);
            }
        }
        void render()
        {
            if(_app)
            {
                if(!_app->is_pause_render())
                {
                	LOGI("SampleBrowser: render() render_one_frame");
                    _app->render_one_frame();
                }
            } 
        }
      
where

Code: Select all

void set_pause_render( bool flag )
{
    _pause_render = flag;
}

bool is_pause_render()
{
    return _pause_render;
}
and in the _app:

Code: Select all

void c_game_app::render_one_frame()
{
	if(!is_pause_render())
		Ogre::Root::getSingleton().renderOneFrame();
}
and the complete log can be seen:

Code: Select all

01-20 02:14:15.971: I/Ogre(8973): SampleBrowser: render() render_one_frame
01-20 02:14:16.001: I/Ogre(8973): SampleBrowser: render() render_one_frame
01-20 02:14:16.041: I/Ogre(8973): SampleBrowser: render() render_one_frame
01-20 02:14:16.071: I/Ogre(8973): SampleBrowser: render() render_one_frame
01-20 02:14:16.101: I/Ogre(8973): SampleBrowser: render() render_one_frame
01-20 02:14:16.131: I/OGRE(8973): ------->on_input_keydown_cb(input_user,True)
01-20 02:14:16.131: I/OGRE(8973): mousePressed:488
01-20 02:14:16.131: I/OGRE(8973): click on editbox, popup IME
01-20 02:14:16.141: I/OGRE(8973): GetInput
01-20 02:14:16.141: I/OGRE(8973): g_JavaVM->AttachCurrentThread
01-20 02:14:16.141: I/OGRE(8973): g_JavaVM->AttachCurrentThread return 0
01-20 02:14:16.141: I/OGRE(8973): g_JavaVM->GetEnv
01-20 02:14:16.141: I/OGRE(8973): g_JavaVM->GetEnv return 0
01-20 02:14:16.162: E/NativeActivity(8973): channel '413730d8 net.gooody.www/android.app.NativeActivity (client)' ~ Failed to receive dispatch signal.  status=-11
01-20 02:14:16.172: E/NativeActivity(8973): channel '413730d8 net.gooody.www/android.app.NativeActivity (client)' ~ Failed to receive dispatch signal.  status=-11
01-20 02:14:16.202: E/NativeActivity(8973): channel '413730d8 net.gooody.www/android.app.NativeActivity (client)' ~ Failed to receive dispatch signal.  status=-11
01-20 02:14:16.242: E/NativeActivity(8973): channel '413730d8 net.gooody.www/android.app.NativeActivity (client)' ~ Failed to receive dispatch signal.  status=-11
01-20 02:14:16.262: E/NativeActivity(8973): channel '413730d8 net.gooody.www/android.app.NativeActivity (client)' ~ Failed to receive dispatch signal.  status=-11
01-20 02:14:16.272: I/Ogre(8973): APP_CMD_LOST_FOCUS
01-20 02:14:16.272: I/Ogre(8973): SampleBrowser: applicationDidResignActive
01-20 02:14:16.282: E/NativeActivity(8973): channel '413730d8 net.gooody.www/android.app.NativeActivity (client)' ~ Failed to receive dispatch signal.  status=-11
01-20 02:14:16.302: I/OGRE(8973): mouseReleased:152
01-20 02:14:16.302: E/NativeActivity(8973): channel '413730d8 net.gooody.www/android.app.NativeActivity (client)' ~ Failed to receive dispatch signal.  status=-11
01-20 02:14:16.422: D/memalloc(8973): /dev/pmem: Mapped buffer base:0x5e52b000 size:6819840 offset:4730880 fd:98
01-20 02:14:16.442: D/OpenGLRenderer(8973): Enabling debug mode 0
01-20 02:14:16.602: D/memalloc(8973): /dev/pmem: Mapped buffer base:0x5ed1e000 size:8908800 offset:6819840 fd:101
01-20 02:14:16.632: E/Adreno200-EGLSUB(8973): SwapBuffers() dequeue native buffer fail: No such device
01-20 02:14:16.642: E/Adreno200-EGLSUB(8973): GetSurfaceSize() dequeue native buffer failed: No such device.
01-20 02:14:16.642: E/SurfaceTextureClient(8973): queueBuffer: error queuing buffer to SurfaceTexture, -19
01-20 02:14:16.642: E/Adreno200-EGLSUB(8973): GetSurfaceSize() dequeue native buffer failed: No such device.
01-20 02:14:16.642: E/Adreno200-EGL(8973): <eglSurfaceResize:4020>: EGL_BAD_ALLOC
01-20 02:14:16.642: E/OGRE(8973): OGRE EXCEPTION(3:RenderingAPIException): Fail to SwapBuffers in swapBuffers at ..\..\..\RenderSystems\GLES2\src\EGL\OgreEGLWindow.cpp (line 161)
01-20 02:14:16.662: A/libc(8973): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)
From the log you can find that no more renderOneframe after popup IME so I cannot understand why SwapBuffers would crash.


Thanks.
-Shawn
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: SwapBuffers() dequeue native buffer fail: No such device

Post by c6burns »

Hmmm yeah I'm not sure exactly what's happening there. I've never really worked with the samplebrowser or nativeactivities. I use JNI based on the OgreJNI project.

v1-9-0 was tagged in Dec 2013. Now it's Jan 2015. A lot has happened. I'm not sure why you feel CEGUI requires you use v1-9-0 tag as opposed to v1-9 branch head
shawndong21
Gnoblar
Posts: 9
Joined: Sun Jan 18, 2015 6:39 pm

Re: SwapBuffers() dequeue native buffer fail: No such device

Post by shawndong21 »

c6burns wrote:Hmmm yeah I'm not sure exactly what's happening there. I've never really worked with the samplebrowser or nativeactivities. I use JNI based on the OgreJNI project.

v1-9-0 was tagged in Dec 2013. Now it's Jan 2015. A lot has happened. I'm not sure why you feel CEGUI requires you use v1-9-0 tag as opposed to v1-9 branch head
Ok, now I remember that it's the particle universe issue which cannot be compiled against Ogre 1.9.x and Ogre 1.10:
https://github.com/scrawl/particleuniverse/issues/14

If you can help to fix the particle universe issue then I will be very happy to try newer version of Ogre.

By the way, do you have any method to launch IME in Ogre for android?

ANativeActivity_showSoftInput doesn't popup the IME for me:

Code: Select all

/*ANativeActivity_showSoftInput doesn't work for ogre*/
ANativeActivity_showSoftInput(nativeActivity, ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED);
Many thanks.
-Shawn
shawndong21
Gnoblar
Posts: 9
Joined: Sun Jan 18, 2015 6:39 pm

Re: SwapBuffers() dequeue native buffer fail: No such device

Post by shawndong21 »

The crash turned out to be my own fault: there is another renderOneframe() somewhere else.
Now I can switch to a java android UI to input text and use JNI to pass the text back to Ogre.

But if anyone can point out how to popup softkeypad directly in Ogre, that will be even better.
Thanks.

Also the particle universe compatibility issue with ogre 1.9.x and newer version. I am still waiting for a solution for it.

Many thanks,
-Shawn
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: SwapBuffers() dequeue native buffer fail: No such device

Post by c6burns »

shawndong21 wrote:The crash turned out to be my own fault: there is another renderOneframe() somewhere else.
Aha, I thought so.
shawndong21 wrote:Also the particle universe compatibility issue with ogre 1.9.x and newer version. I am still waiting for a solution for it.
Not sure why this isn't a problem for me, but just take 5 good minutes and look at the issue. You can probably change the EXCEPT macro in ParticleUniverse to just use the OGRE_EXCEPT macro (which in turn will use Ogre::ExceptionFactory::throwException - see OgreException.h) ... it's not rocket science, it's just wrapping around throw
shawndong21
Gnoblar
Posts: 9
Joined: Sun Jan 18, 2015 6:39 pm

Re: SwapBuffers() dequeue native buffer fail: No such device

Post by shawndong21 »

Thanks a lot.

According to your hint, I have already found a solution for the particle universe 1.6 to be compatible to Ogre 1.9.x and 1.10, just change the definition of EXCEPT in the following file:
ParticleUniverse\include\ParticleUniverseException.h

from

Code: Select all

#define EXCEPT(num, desc, src) throw Ogre::ExceptionFactory::create( \
Ogre::ExceptionCodeType(), desc, src, FILE, LINE );
to:

Code: Select all

#ifndef EXCEPT
#define EXCEPT(code, desc, src) Ogre::ExceptionFactory::throwException(code, code, desc, src, FILE, LINE)
#define EXCEPT_EX(code, num, desc, src) Ogre::ExceptionFactory::throwException(code, num, desc, src, FILE, LINE)
#else
#define EXCEPT_EX(code, num, desc, src) OGRE_EXCEPT(code, desc, src)
#endif
Post Reply