Le jeudi 20 août 2009 à 16:42 +0300, Tasos Parisinos a écrit :
> Hello devels
> 
> I have managed to create my gfx driver and i am now at the stage where i 
> experiment with the blit function. I want to implement the blit with 
> alpha channel blend algorithm. My test code so far is:
> 
> bool sciensis_blit(
>     void *drv_data,
>     void *dev_data,
>     DFBRectangle *rect,
>     i32 dx,
>     i32 dy
> )
> {
>    u32 *dst, *src;
>    u32 i, j;
>    sciensis_drv_data *scdrv = (sciensis_drv_data *) drv_data;
>    sciensis_dev_data *scdev = (sciensis_dev_data *) dev_data;
> 
>    /* Software blit/blend implementation */
>    dst = scdev->dst_addr + dy * scdev->dst_pitch;
>    dst += DFB_BYTES_PER_LINE(scdev->dst_fmt, dx);
> 
>    src = scdev->src_addr + rect->y * scdev->src_pitch;
>    src += DFB_BYTES_PER_LINE(scdev->src_fmt, rect->x);
> 
>    while (rect->h--) {
>       direct_memcpy(dst, src, rect->w * scdev->dst_bpp);
> 
>       dst += scdev->dst_pitch;
>       src += scdev->src_pitch;
>    }
> 
>    return true;
> }
> 
> 
> This works fine. But when i replace direct_memcpy with memcpy or any 
> other way of manipulating surface data i get segfaults. That makes me 
> understand that the surface data buffers are not linear but have some 
> other format or data structure. I have seen some of the surface struct 
> declaration code but i can't resolve this. This must be easy for you. 
> Can you help?
> 

If allocated through the frame buffer system, buffers are linear
(physically and virtually). And I don't think DirectFB is using non
virtually linear buffers, because none of the mainly used graphical
library (cairo, imlib, etc...) handle them.

Plus, according to the code
(http://git.directfb.org/?p=core/DirectFB.git;a=blob;f=lib/direct/memcpy.c)
if you're not running one of the following; 64bits processor, powerpc or
arm, direct_memcpy uses the libc memcpy function.
Implementation for the 64bits processors assume you're passing linear
buffers.

You should enable traces to compare locked buffer's addresses and
pointers you're manipulating in your blit/blend function. Something
might be wrong.

Regards,

-- 
Lionel Landwerlin <lionel.landwer...@openwide.fr>

_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to