Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - gf_surface_create and incorrect stride: (4 Items)
   
gf_surface_create and incorrect stride  
Hello,
I want to use gf_surface_create in order to create a scratchpad for offline drawing, then blit it to the main surface 
layer.
I can pass some parameter, but no stride. When I look to the surface info structure I see that the stride is populated 
with the same stride of the main layer. But I think it is incorrect:
Display 1024x768 32bpp
- Main surface layer -> surface_info.stride 4096 (means 1024 pixel x 4 bytes/pixel)

Scratchpad surface: 500x500 32bpp
- surface_info.stride: 4096 <---??? I expect 2000 (i.e. 500 pixel x 4 bytes/pixel)

So if I want to "raw write" to surface_info.vaddr a number of raw pixel: what is the real scanline?

Thanks, 
Mario.
RE: gf_surface_create and incorrect stride  
It all depends on how the devg driver allocates the memory.  If you want a want a "tight" surface, you can use 
gf_surface_attach(), but it is unlikely such a surface can be accelerated.
 
-Derek

________________________________

From: Mario Mastrodicasa [mailto:community-noreply@qnx.com]
Sent: Tue 24/03/2009 10:10 AM
To: advanced-graphics
Subject: gf_surface_create and incorrect stride



Hello,
I want to use gf_surface_create in order to create a scratchpad for offline drawing, then blit it to the main surface 
layer.
I can pass some parameter, but no stride. When I look to the surface info structure I see that the stride is populated 
with the same stride of the main layer. But I think it is incorrect:
Display 1024x768 32bpp
- Main surface layer -> surface_info.stride 4096 (means 1024 pixel x 4 bytes/pixel)

Scratchpad surface: 500x500 32bpp
- surface_info.stride: 4096 <---??? I expect 2000 (i.e. 500 pixel x 4 bytes/pixel)

So if I want to "raw write" to surface_info.vaddr a number of raw pixel: what is the real scanline?

Thanks,
Mario.

_______________________________________________
Advanced Graphics
http://community.qnx.com/sf/go/post25104



Attachment: Text winmail.dat 3.91 KB
Re: RE: gf_surface_create and incorrect stride  
It can be a solution. But gf_surface_attach needs a preallocated memory area. If I have an image the memory area is 
available (like the image example), but in other cases I need to allocate an area of memory that is in conformance with 
the passed format. Is it right?
Re: RE: gf_surface_create and incorrect stride  
> It can be a solution. But gf_surface_attach needs a preallocated memory area. 
> If I have an image the memory area is available (like the image example), but 
> in other cases I need to allocate an area of memory that is in conformance 
> with the passed format. Is it right?


With gf_surface_attach(), it does not matter where the memory comes from, malloc, shmem, or vram ... but yes, you have 
to make surface the format corresponds to the bpl (stride), width, and height.

But going back to your original question, do not be worried if you have a stride for the created surface, which is much 
larger than the width you specified.

-Derek