Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 02-11-10, 05:16 AM   #1
cg-dev
Registered User
 
Join Date: Feb 2010
Posts: 5
Default Advice for segfault in libGLcore for drivers 190.53 x64

Hi,

I'm stuck on a bug, I think I made something wrong but I would like to be sure that it's not a driver bug.

The following code crash in glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, C_facePoints);
Each provided array are valid pointer and valid data.(see Ouput)
I also try to disable texturing => same result.
Moreover, glGetError() does not detect any error.

-> The "same application" works fine on Android (native application not JAVA).
-> In a simple application, glDrawElements works fine.

My application use severals threads that can call OpenGL (/ES) function.
Each time a chunk of code access to OpenGL(/ES), it acquires the
context with glXMakeCurrent() or eglMakeCurrent().
In my case, the context is correctly acquires. No error raised.

Thank you for your help.

My config:

Card : GeForce 7600 GT
Drivers : NVIDIA-Linux-x86_64-190.53-pkg2.run
Kernel : Linux 2.6.31.6-morrowind #2 SMP PREEMPT Mon Jan 4 15:38:53 GMT 2010 x86_64 GNU/Linux
GCC : gcc (Debian 4.4.2-9) 4.4.3 20100108 (prerelease)

********* Code *********
Code:
void GLUtil_drawQuad2D(GLImageBuffer * glImageBuffer)
{
	static uint8_t C_facePoints[]  = {0, 1, 2, 3}; // face
	static float   C_texCoords[] =
	{
		0.0f, 0.0f, // Left Top
		1.0f, 0.0f, // Rigth Top
		0.0f, 1.0f, // Left Bottom
		1.0f, 1.0f  // Rigth Bottom
	} ;

	static float vertexArray[12];

	uint32_t idx = 0;

	// Left up Corner
	vertexArray[idx++]  =  0.0f;
	vertexArray[idx++]  =  0.0f;
	vertexArray[idx++]  =  0.0f;

	// Right up Corner
	vertexArray[idx++]  =  1.0f;
	vertexArray[idx++]  =  0.0f;
	vertexArray[idx++]  =  0.0f;

	// Left down Corner
	vertexArray[idx++]  =  0.0f;
	vertexArray[idx++]  =  -1.0f;
	vertexArray[idx++]  =  0.0f;

	// Rigth down Corner
	vertexArray[idx++]  =  1.0f;
	vertexArray[idx++]  =  -1.0f;
	vertexArray[idx++]  =  0.0f;

	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_TEXTURE_COORD_ARRAY);

	glEnable(GL_TEXTURE_2D);

	glBindTexture(GL_TEXTURE_2D, glImageBuffer->getIdForGL());
	glVertexPointer(3, GL_FLOAT, 0, vertexArray);
	glTexCoordPointer(2, GL_FLOAT, 0, C_texCoords);
	
	LOG("glImageBuffer->getIdForGL() : %i\n",glImageBuffer->getIdForGL());
	for (int i = 0; i < 12;i++)
	{
		LOG("vertexArray[%i] : %.2f\n",i,vertexArray[i]);
	}
	for (int i = 0; i < 8;i++)
	{
		LOG("C_texCoords[%i] : %.2f\n",i,C_texCoords[i]);
	}
	
	LOG("glGetError = %X",glGetError());
	glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, C_facePoints);
	LOG("glGetError = %X",glGetError());

	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
	glDisableClientState(GL_VERTEX_ARRAY);

	glDisable(GL_TEXTURE_2D);

}
********* Output *********
Code:
[15:54:37]>[GLUtil] : glImageBuffer->getIdForGL() : 9
[15:54:37]>[GLUtil] : vertexArray[0] : 0.00
[15:54:37]>[GLUtil] : vertexArray[1] : 0.00
[15:54:37]>[GLUtil] : vertexArray[2] : 0.00
[15:54:37]>[GLUtil] : vertexArray[3] : 1.00
[15:54:37]>[GLUtil] : vertexArray[4] : 0.00
[15:54:37]>[GLUtil] : vertexArray[5] : 0.00
[15:54:37]>[GLUtil] : vertexArray[6] : 0.00
[15:54:37]>[GLUtil] : vertexArray[7] : -1.00
[15:54:37]>[GLUtil] : vertexArray[8] : 0.00
[15:54:37]>[GLUtil] : vertexArray[9] : 1.00
[15:54:37]>[GLUtil] : vertexArray[10] : -1.00
[15:54:37]>[GLUtil] : vertexArray[11] : 0.00
[15:54:37]>[GLUtil] : C_texCoords[0] : 0.00
[15:54:37]>[GLUtil] : C_texCoords[1] : 0.00
[15:54:37]>[GLUtil] : C_texCoords[2] : 1.00
[15:54:37]>[GLUtil] : C_texCoords[3] : 0.00
[15:54:37]>[GLUtil] : C_texCoords[4] : 0.00
[15:54:37]>[GLUtil] : C_texCoords[5] : 1.00
[15:54:37]>[GLUtil] : C_texCoords[6] : 1.00
[15:54:37]>[GLUtil] : C_texCoords[7] : 1.00
[15:54:37]>[GLUtil] : glGetError = 0
Segmentation fault
********* GDB *********
Code:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff1803910 (LWP 5041)]
0x00007ffff5a30620 in ?? () from /usr/lib/libGLcore.so.1
(gdb) backtrace
#0  0x00007ffff5a30620 in ?? () from /usr/lib/libGLcore.so.1
#1  0x00007ffff5a39848 in ?? () from /usr/lib/libGLcore.so.1
#2  0x00007ffff56aa5d4 in ?? () from /usr/lib/libGLcore.so.1
#3  0x00007ffff7bc2631 in Poseidon::GLUtil_drawQuad2D (glImageBuffer=0x79f260) at ../src/poseidon/GL/GLUtil.cpp:150
#4  0x0000000000407acd in ContactMenu::preRender (this=0x79ef50) at ../src/Menu/ContactMenu.cpp:57
#5  0x00007ffff7bb6185 in Poseidon::GLObject::internal_preRender (this=0x79ef50) at ../src/poseidon/GL/GLObject.cpp:151
#6  0x00007ffff7bb9117 in Poseidon::GLServer::renderGUI (this=0x6153d0) at ../src/poseidon/GL/GLServer.cpp:714
#7  0x00007ffff7bb9504 in Poseidon::GLServer::renderAll (this=0x6153d0) at ../src/poseidon/GL/GLServer.cpp:810
#8  0x00007ffff7bb7a2e in Poseidon::GLServer::main (this=0x6153d0) at ../src/poseidon/GL/GLServer.cpp:204
#9  0x00007ffff7ba1de4 in Poseidon::thread_object_func (obj=0x6153d0) at ../src/poseidon/core/ThreadedObject.cpp:51
#10 0x00007ffff470873a in start_thread (arg=<value optimized out>) at pthread_create.c:300
#11 0x00007ffff71486dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#12 0x0000000000000000 in ?? ()
(gdb)
Attached Files
File Type: gz nvidia-bug-report.log.gz (41.6 KB, 102 views)
cg-dev is offline   Reply With Quote
Old 02-11-10, 12:06 PM   #2
AaronP
NVIDIA Corporation
 
AaronP's Avatar
 
Join Date: Mar 2005
Posts: 2,487
Default Re: Advice for segfault in libGLcore for drivers 190.53 x64

You don't have the same context current in multiple threads at once, do you? Could you please attach the complete test case so I can try to reproduce the problem?
AaronP is offline   Reply With Quote
Old 02-11-10, 01:12 PM   #3
cg-dev
Registered User
 
Join Date: Feb 2010
Posts: 5
Default Re: Advice for segfault in libGLcore for drivers 190.53 x64

Quote:
Originally Posted by AaronP View Post
You don't have the same context current in multiple threads at once, do you? Could you please attach the complete test case so I can try to reproduce the problem?
I don't have the same context current in multiple threads at once.
Before calling glXMakeCurrent(), I have checked if there is not a current context with glXGetCurrentContext(). It's always return 0. There is also recursives mutexes to protect
glXMakeCurrent() of concurent access.
When I release the context, I use glXMakeCurrent(m_display,None,NULL); and release the mutex.

But on Android, when I made something wrong with context, Error messages are generated by driver like this one :
E/libEGL ( 5257): call to OpenGL ES API with no current context

Does nvidia driver log any kind of messages ?


I will try to provide a more simple test case.

I would like to know if the following error is due to bad context ?
#0 0x00007ffff5a30620 in ?? () from /usr/lib/libGLcore.so.1
#1 0x00007ffff5a39848 in ?? () from /usr/lib/libGLcore.so.1
#2 0x00007ffff56aa5d4 in ?? () from /usr/lib/libGLcore.so.1
Is there any log somewhere ?

Thank you.
cg-dev is offline   Reply With Quote
Old 02-11-10, 01:14 PM   #4
AaronP
NVIDIA Corporation
 
AaronP's Avatar
 
Join Date: Mar 2005
Posts: 2,487
Default Re: Advice for segfault in libGLcore for drivers 190.53 x64

You could try the so-called "GLExpert" driver, which is part of the NVPerfKit build.
AaronP is offline   Reply With Quote
Old 02-12-10, 05:54 AM   #5
cg-dev
Registered User
 
Join Date: Feb 2010
Posts: 5
Default Re: Advice for segfault in libGLcore for drivers 190.53 x64

Quote:
Originally Posted by AaronP View Post
You could try the so-called "GLExpert" driver, which is part of the NVPerfKit build.
Thank you for your answer.

I cannot install NFPerfkit package for linux, I get an error it cannot find kernel source.
I try to use --kernel-source-path to specify sources and still get the same error :
Code:
ERROR: If you are using a Linux 2.4 kernel, please make sure 
you either have configured kernel sources matching your 
kernel or the correct set of kernel headers installed 
on your system. 

If you are using a Linux 2.6 kernel, please make sure 
you have configured kernel sources matching your kernel 
installed on your system. If you specified a separate 
output directory using either the "KBUILD_OUTPUT" or 
the "O" KBUILD parameter, make sure to specify this 
directory with the SYSOUT environment variable or with 
the appropriate nvidia-installer command line option.
I have checked in nvidia-installer.log, the paths are the same as my current
driver installation (190.53) :
Code:
-> Kernel source path: '/lib/modules/2.6.31.6-morrowind/source'
-> Kernel output path: '/lib/modules/2.6.31.6-morrowind/build'
Moreover the drivers used in this package are old (173.13 isn't it ?)

I have download and try with older nvidia driver (01/2009 and 02/2009) I get same crash in my application.


I will check again my code to be sure I'm not doing something wrong.
cg-dev is offline   Reply With Quote
Old 02-15-10, 05:29 AM   #6
cg-dev
Registered User
 
Join Date: Feb 2010
Posts: 5
Default Re: Advice for segfault in libGLcore for drivers 190.53 x64

Quote:
Originally Posted by cg-dev View Post
I will check again my code to be sure I'm not doing something wrong.

Got it ! But very strange, if in the previous code I change :

Code:
static uint8_t C_facePoints[]  = {0, 1, 2, 3}; // face
to
Code:
static uint16_t C_facePoints[]  = {0, 1, 2, 3}; // face
and
Code:
glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, C_facePoints);
to

Code:
glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_SHORT, C_facePoints);
It does not crash.

So it's a bug in the driver ? Memory alignment issue ?
cg-dev is offline   Reply With Quote
Old 02-24-10, 07:33 AM   #7
cg-dev
Registered User
 
Join Date: Feb 2010
Posts: 5
Default Re: Advice for segfault in libGLcore for drivers 190.53 x64

Quote:
Originally Posted by cg-dev View Post
So it's a bug in the driver ? Memory alignment issue ?
I've got it :

It's my fault

Before this code was called, I use glBindBuffer for VBO. But I forgot to release it using glBindBuffer(...,0);

Now I don't have any crash now ....
cg-dev is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
x64 and Firewall Advice Peoples-Agent Microsoft Windows XP And Vista 7 12-16-05 12:51 AM

All times are GMT -5. The time now is 03:18 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.