Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - SEGV in gf_draw_blit2: (8 Items)
   
SEGV in gf_draw_blit2  
I am creating a lot of offscreen surfaces and bit blitting some graphics from memory to that surface. After a defined 
number of surfaces the application crashes with with SIGSEGV in memcpy inside gf_draw_blit2.

Here is the code snippet:
...
	gf_surface_t dstSurface;
	gf_draw_end(hal->context);
	if (gf_surface_create(&dstSurface, hal->device, dst.w, dst.h, GF_FORMAT_PACK_ARGB1555, 0, GF_SURFACE_CREATE_2D_ACCESSIBLE) == GF_ERR_OK)

	{
		gf_surface_t imgSurface;
		if (gf_surface_attach(&imgSurface, hal->device, dst.w, dst.h, dst.access.direct.stride, GF_FORMAT_PKLE_ARGB1555, 0, dst.access.direct.
data, 0) == GF_ERR_OK)
		{
			gf_draw_begin(hal->context);
			std::cout << "Blit begin " << hal->context << std::endl;
			gf_surface_info_t info;
			gf_surface_get_info(dstSurface, &info);
			std::cout << "sid = " << info.sid << ", w = " << info.w << ", h = " << info.h << ", format = " << info.format << ", 
stride = " << info.stride;
			std::cout << ", paddr = " << (unsigned int*)info.paddr << ", vaddr = " << (unsigned int*)info.vaddr << ", flags = " <
< info.flags << std::endl;

			gf_draw_blit2(hal->context, imgSurface, dstSurface, 0, 0, dst.w - 1, dst.h - 1, 0, 0);
			std::cout << "Blit end " << hal->context << std::endl;
			gf_draw_end(hal->context);
			gf_surface_free(imgSurface);
		}
		else
		{
	        std::cerr << "Failed to create memory surface" << std::endl;
		}
	}
	else
	{
        std::cerr << "Failed to create offscreen surface" << std::endl;
	}

	std::free(dst.access.direct.data);
...

And the application output:
...
Image data = 36a018
Blit begin 12a778
sid = 146, w = 28, h = 1301, format = 5392, stride = 64, paddr = 43ea5ec0, vaddr = 85fa5ec0, flags = 164095
Blit end 12a778
Image data = 36a018
Blit begin 12a778
sid = 145, w = 31, h = 1451, format = 5392, stride = 64, paddr = 43e8f3c0, vaddr = 85f8f3c0, flags = 164095
Blit end 12a778
Image data = 3b0018
Blit begin 12a778
sid = 144, w = 33, h = 1523, format = 5392, stride = 128, paddr = 43e5fa00, vaddr = 85f5fa00, flags = 164095

Process 266260 (FontAppwt124395008950214) terminated SIGSEGV code=1 fltno=11 ip=0105a1cc(libc.so.3@memcpy+0x64) mapaddr=
0005a1cc. ref=003c9000

Is the source code available, so I can debug libffb?

Thanks,
Thomas
RE: SEGV in gf_draw_blit2  
Just a few questions:

What version of QNX are your using?
What graphics (devg-xxxxx) driver are you using?  What target CPU?
Can this be reproduced in a small recompileable test case?  If so,
please attach it.

-----Original Message-----
From: Thomas Wihl [mailto:community-noreply@qnx.com] 
Sent: Tuesday, June 02, 2009 10:26 AM
To: advanced-graphics
Subject: SEGV in gf_draw_blit2

I am creating a lot of offscreen surfaces and bit blitting some graphics
from memory to that surface. After a defined number of surfaces the
application crashes with with SIGSEGV in memcpy inside gf_draw_blit2.

Here is the code snippet:
...
	gf_surface_t dstSurface;
	gf_draw_end(hal->context);
	if (gf_surface_create(&dstSurface, hal->device, dst.w, dst.h,
GF_FORMAT_PACK_ARGB1555, 0, GF_SURFACE_CREATE_2D_ACCESSIBLE) ==
GF_ERR_OK)
	{
		gf_surface_t imgSurface;
		if (gf_surface_attach(&imgSurface, hal->device, dst.w,
dst.h, dst.access.direct.stride, GF_FORMAT_PKLE_ARGB1555, 0,
dst.access.direct.data, 0) == GF_ERR_OK)
		{
			gf_draw_begin(hal->context);
			std::cout << "Blit begin " << hal->context <<
std::endl;
			gf_surface_info_t info;
			gf_surface_get_info(dstSurface, &info);
			std::cout << "sid = " << info.sid << ", w = " <<
info.w << ", h = " << info.h << ", format = " << info.format << ",
stride = " << info.stride;
			std::cout << ", paddr = " << (unsigned
int*)info.paddr << ", vaddr = " << (unsigned int*)info.vaddr << ", flags
= " << info.flags << std::endl;

			gf_draw_blit2(hal->context, imgSurface,
dstSurface, 0, 0, dst.w - 1, dst.h - 1, 0, 0);
			std::cout << "Blit end " << hal->context <<
std::endl;
			gf_draw_end(hal->context);
			gf_surface_free(imgSurface);
		}
		else
		{
	        std::cerr << "Failed to create memory surface" <<
std::endl;
		}
	}
	else
	{
        std::cerr << "Failed to create offscreen surface" << std::endl;
	}

	std::free(dst.access.direct.data);
...

And the application output:
...
Image data = 36a018
Blit begin 12a778
sid = 146, w = 28, h = 1301, format = 5392, stride = 64, paddr =
43ea5ec0, vaddr = 85fa5ec0, flags = 164095
Blit end 12a778
Image data = 36a018
Blit begin 12a778
sid = 145, w = 31, h = 1451, format = 5392, stride = 64, paddr =
43e8f3c0, vaddr = 85f8f3c0, flags = 164095
Blit end 12a778
Image data = 3b0018
Blit begin 12a778
sid = 144, w = 33, h = 1523, format = 5392, stride = 128, paddr =
43e5fa00, vaddr = 85f5fa00, flags = 164095

Process 266260 (FontAppwt124395008950214) terminated SIGSEGV code=1
fltno=11 ip=0105a1cc(libc.so.3@memcpy+0x64) mapaddr=0005a1cc.
ref=003c9000

Is the source code available, so I can debug libffb?

Thanks,
Thomas


_______________________________________________
Advanced Graphics
http://community.qnx.com/sf/go/post30536
Re: RE: SEGV in gf_draw_blit2  
I am using 6.4.0 with devg-jade on a (you never guess) Fujitsu Jade.
I looked at the source for devg but it just calls ffb_core_blit2 which most likeley does the memcpy.
Funny thing is that I can't reproduce it with the simplest possible application.
So it's still possible it somewhere in my code, but pointers to blit2 seem okay.
I'm currently running through the ffb debugging the disassembly, but it's no fun, so getting the source code would help 
a lot.

Thanks,
Thomas
RE: RE: SEGV in gf_draw_blit2  
Yes, we can give you the source, but I think you need more than libffb
to compile it, give us some time ...

-----Original Message-----
From: Thomas Wihl [mailto:community-noreply@qnx.com] 
Sent: Tuesday, June 02, 2009 11:05 AM
To: advanced-graphics
Subject: Re: RE: SEGV in gf_draw_blit2

I am using 6.4.0 with devg-jade on a (you never guess) Fujitsu Jade.
I looked at the source for devg but it just calls ffb_core_blit2 which
most likeley does the memcpy.
Funny thing is that I can't reproduce it with the simplest possible
application.
So it's still possible it somewhere in my code, but pointers to blit2
seem okay.
I'm currently running through the ffb debugging the disassembly, but
it's no fun, so getting the source code would help a lot.

Thanks,
Thomas

_______________________________________________
Advanced Graphics
http://community.qnx.com/sf/go/post30551
Re: RE: RE: SEGV in gf_draw_blit2  
I found the problem with disassembling. My images have been too small. I use img.w * 2 instead of img.access.direct.
stride. So memcopy hase gone a bit too far and SEGV.

If it's easy for you it still would be great to have the source, but for the moment we are happy.

Thanks again,
Thomas
RE: RE: RE: SEGV in gf_draw_blit2  
Yes, I will post sometime this week, we are just so busy, but I promise
I will post it.

-Derek

-----Original Message-----
From: Thomas Wihl [mailto:community-noreply@qnx.com] 
Sent: Wednesday, June 03, 2009 2:25 AM
To: advanced-graphics
Subject: Re: RE: RE: SEGV in gf_draw_blit2

I found the problem with disassembling. My images have been too small. I
use img.w * 2 instead of img.access.direct.stride. So memcopy hase gone
a bit too far and SEGV.

If it's easy for you it still would be great to have the source, but for
the moment we are happy.

Thanks again,
Thomas

_______________________________________________
Advanced Graphics
http://community.qnx.com/sf/go/post30654
Re: RE: RE: RE: SEGV in gf_draw_blit2  
Here you go, libffb from the 640 release branch, and the dependencies required to build it.

Regards,
-Derek
Attachment: Text ffb_640.tgz 74.49 KB
Re: RE: RE: RE: SEGV in gf_draw_blit2  
Thanks a lot!
Thomas