Hi all,

I'm new to DirectFB and have just implemented TextureTriangles in our 
gfxdriver.  I have everything working fairly well in the case where the texture 
surface is created out of the fbdev memory area.  However, our graphics 
hardware can perform operations on arbitrary system RAM areas (that are not in 
the fbdev memory range).  Further, I'd like to avoid a texture copy from an 
arbitrary RAM buffer into an fbdev memory area surface.  Therefore, I'm now 
testing with a texture surface that is created with a pre-allocated RAM buffer, 
as follows:

    surface_desc.flags = DSDESC_CAPS | DSDESC_PIXELFORMAT | DSDESC_WIDTH | 
DSDESC_HEIGHT | DSDESC_PREALLOCATED;
    surface_desc.caps = DSCAPS_PREMULTIPLIED;
    surface_desc.pixelformat = pixel_format;
    surface_desc.width = screen_width;
    surface_desc.height = screen_height;
    surface_desc.preallocated[0].data = texture_buffer;
    surface_desc.preallocated[0].pitch = texture_pitch;
    surface_desc.preallocated[1].data = 0;
    surface_desc.preallocated[1].pitch = 0;
    DFBCHECK(dfb->CreateSurface(dfb,&surface_desc,&textureSurface));
    DFBCHECK(textureSurface->GetCapabilities(textureSurface,&surface_caps));
    printf("textureSurface->GetCapabilities: %#x\n",surface_caps);
    DFBCHECK(textureSurface->Clear(textureSurface,1,2,3,255));

The texture surface seems to be created OK, but the first attempt to use a 
gfxdriver on this surface (Clear) fails and kicks back to CPU access which 
succeeds.  The debug log for the Create and Clear follows.  The failure seems 
to be in the find_allocation and dfb_surface_pools_negotiate functions and I 
have added a little more debug output there:

(-) [Main Thread       2.247] (  487) IDirectFB:          
IDirectFB_CreateSurface( 0x18768 )
(-) [Main Thread       2.248] (  487) Core/LayerContext:      
dfb_layer_context_get_configuration( 0x1c738, 0xbee9da18 )
(-) [Main Thread       2.248] (  487) IDirectFB:            -> flags  0x0000001f
(-) [Main Thread       2.248] (  487) IDirectFB:            -> width  800
(-) [Main Thread       2.248] (  487) IDirectFB:            -> height 600
(-) [Main Thread       2.248] (  487) IDirectFB:            -> caps   0x00001000
(-) [Main Thread       2.249] (  487) IDirectFB:            -> format RGB32
(-) [Main Thread       2.249] (  487) Core/Surface:           
dfb_surface_create( 0x14468, 0xbee9d998, 0xbee9da44 )
(-) [Main Thread       2.249] (  487) Direct/Mem:                   +    60 
bytes [reactor.c:1593 in fusion_reactor_new()]
(-) [Main Thread       2.249] (  487) Fusion/Object:              == Surface 
Pool ==
(-) [Main Thread       2.250] (  487) Fusion/Object:                -> added 
0x1d8e0
(-) [Main Thread       2.250] (  487) Core/Surface:             -> 800x600
(-) [Main Thread       2.250] (  487) Core/Surface:             -> RGB32
(-) [Main Thread       2.250] (  487) Core/Surface:             -> caps 
0x00001000
(-) [Main Thread       2.250] (  487) Core/Surface:             -> prealloc 
0x40a48010 [3200]
(-) [Main Thread       2.251] (  487) Core/SurfBuffer:            
dfb_surface_buffer_new( RGB32 )
(-) [Main Thread       2.251] (  487) Direct/Mem:               +   252 bytes 
[idirectfb.c:830 in IDirectFB_CreateSurface()]
(-) [Main Thread       2.251] (  487) Direct/Mem:               +   672 bytes 
[idirectfbsurface.c:2607 in IDirectFBSurface_Construct()]
(-) [Main Thread       2.251] (  487) IDirectFBSurface:       
IDirectFBSurface_Construct( 0x1dad0 )
(-) [Main Thread       2.252] (  487) IDirectFBSurface:   
IDirectFBSurface_GetCapabilities( 0x1dad0 )
(-) [Main Thread       2.252] (  487) IDirectFBSurface:   
IDirectFBSurface_Clear( 0x1dad0, 0xff010203 )
(-) [Main Thread       2.252] (  487) Core/GraphicsOps:       
dfb_gfxcard_fillrectangles( 0x1dc4c [1], 0x1dcb4 )
(-) [Main Thread       2.252] (  487) Core/GraphicsOps:           
dfb_gfxcard_state_check( 0x1dcb4, 0x00000001 ) [0,0 - 799,599]
(-) [Main Thread       2.253] (  487) Core/GfxState:              
dfb_gfxcard_state_check( 0x1dcb4, 0x00000001 )  drawing -> 0x1d8e0
(-) [Main Thread       2.253] (  487) Core/GfxState:                <- checked 
0x00000000, accel 0x00000000, modified 0x00033fff, mod_hw 0x00000000
(-) [Main Thread       2.253] (  487) Core/GfxState:                -> checked 
0x00000000, accel 0x00000000, modified 0x00033fff, mod_hw 0x00000000

-------------------------------------------------------------
------------------ NashobaCheckState() ------------------
Dest format DSPF_RGB32
DFXL_FILLRECTANGLE
Drawing flags:
OK to accelerate drawing op
(-) [Main Thread       2.254] (  487) Core/GfxState:                -> checked 
0x0000000f, accel 0x0000000f, modified 0x00033fff, mod_hw 0x00000000
(-) [Main Thread       2.254] (  487) Core/GfxState:                => checked 
0x0000000f, accel 0x0000000f, modified 0x00000000, mod_hw 0x00033fff
(-) [Main Thread       2.254] (  487) Core/GfxState:              
dfb_gfxcard_state_acquire( 0x1dcb4, 0x00000001 )  drawing -> 0x1d8e0
(-) [Main Thread       2.254] (  487) Core/SurfBuffer:                
dfb_surface_buffer_lock( 0x1da88, 0x02, 0x1dd60 ) <- 800x600 RGB32 [0]
(-) [Main Thread       2.255] (  487) Core/SurfBuffer:                  -> GPU 
WRITE
(-) [Main Thread       2.255] (  487) Core/SurfBuffer:                    
find_allocation( 0x1da88 0x2 0x2 0x1)
(-) [Main Thread       2.255] (  487) Core/SurfBuffer:                    
uptodate: 0, outdated: 0
(-) [Main Thread       2.255] (  487) Core/SurfacePool:                   
dfb_surface_pools_allocate( 0x1da88, 0x2 )
(-) [Main Thread       2.255] (  487) Core/SurfacePool:                    -> 
800x600 RGB32 - PRIVATE PREALLOCATED
(-) [Main Thread       2.256] (  487) Core/SurfacePool:                       
dfb_surface_pools_negotiate( 0x1da88 [RGB32], 0x02, 0x02, max 4 )
(-) [Main Thread       2.256] (  487) Core/SurfacePool:                         
->     0x02 0x400 required
(-) [Main Thread       2.256] (  487) Core/SurfacePool:                         
->     pool[0]: access: 0, type: 0x108
(-) [Main Thread       2.256] (  487) Core/SurfacePool:                         
->     pool[1]: access: 0, type: 0x11f
(-) [Main Thread       2.256] (  487) Core/SurfacePool:                         
->     pool[2]: access: 0, type: 0x500
(-) [Main Thread       2.257] (  487) Core/SurfacePool:                         
->     pool[3]: access: 0x13, type: 0x21f
(-) [Main Thread       2.257] (  487) Core/SurfacePool:                         
=> 0 pools available
(-) [Main Thread       2.257] (  487) Core/SurfacePool:                         
=> 0 pools out of memory
(-) [Main Thread       2.257] (  487) Core/SurfacePool:                     -> 
NEGOTIATION FAILED! (Not supported!)
(-) [Main Thread       2.257] (  487) Core/Graphics:              Could not 
lock destination for GPU access!
(-) [Main Thread       2.298] (  487) Direct/Mem:                   +   372 
bytes [generic.c:6927 in gAcquire()]
(-) [Main Thread       2.298] (  487) Core/SurfBuffer:            
dfb_surface_buffer_lock( 0x1da88, 0x02, 0x1dd60 ) <- 800x600 RGB32 [0]
(-) [Main Thread       2.298] (  487) Core/SurfBuffer:              -> CPU WRITE
(-) [Main Thread       2.299] (  487) Core/SurfBuffer:                
find_allocation( 0x1da88 0x1 0x2 0x1)
(-) [Main Thread       2.299] (  487) Core/SurfBuffer:                uptodate: 
0, outdated: 0
(-) [Main Thread       2.299] (  487) Core/SurfacePool:               
dfb_surface_pools_allocate( 0x1da88, 0x2 )
(-) [Main Thread       2.300] (  487) Core/SurfacePool:                -> 
800x600 RGB32 - PRIVATE PREALLOCATED
(-) [Main Thread       2.300] (  487) Core/SurfacePool:                   
dfb_surface_pools_negotiate( 0x1da88 [RGB32], 0x01, 0x02, max 4 )
(-) [Main Thread       2.300] (  487) Core/SurfacePool:                     ->  
   0x02 0x400 required
(-) [Main Thread       2.300] (  487) Core/SurfacePool:                     ->  
   pool[0]: access: 0x3, type: 0x108
(-) [Main Thread       2.301] (  487) Core/SurfacePool:                     ->  
   pool[1]: access: 0x13, type: 0x11f
(-) [Main Thread       2.301] (  487) Core/SurfacePool:                     ->  
   pool[2]: access: 0x3, type: 0x500
(-) [Main Thread       2.302] (  487) Core/SurfacePool:                     -> 
[2] 0x00 0x500 (0) [Preallocated Memory]
(-) [Main Thread       2.302] (  487) Core/SurfacePool:                       
=> OK
(-) [Main Thread       2.302] (  487) Core/SurfacePool:                     ->  
   pool[3]: access: 0x13, type: 0x21f
(-) [Main Thread       2.302] (  487) Core/SurfacePool:                     => 
1 pools available
(-) [Main Thread       2.302] (  487) Core/SurfacePool:                     => 
0 pools out of memory
(-) [Main Thread       2.303] (  487) Core/SurfacePool:                   
dfb_surface_pool_allocate( 0x158c0 [2], 0x1da88 )
(-) [Main Thread       2.303] (  487) Core/SurfacePool:                     -> 
0x1e038
(-) [Main Thread       2.303] (  487) Core/SurfacePool:                 -> 
0x1e038
(-) [Main Thread       2.304] (  487) Core/SurfBuffer:                
dfb_surface_allocation_update()
(-) [Main Thread       2.304] (  487) Core/SurfBuffer:                  -> 
increasing serial...
(-) [Main Thread       2.304] (  487) Core/SurfPoolLock:              
dfb_surface_pool_lock( 0x158c0 [2], 0x1e038 )
(-) [Main Thread       2.304] (  487) Core/SurfBuffer:              -> locked 
1x now
(-) [Main Thread       2.325] (  487) Core/SurfBuffer:            
dfb_surface_buffer_unlock( 0x1dd60 )
(-) [Main Thread       2.326] (  487) Core/SurfPoolLock:              
dfb_surface_pool_unlock( 0x158c0 [2], 0x1e038 )

Comparing this debug stream to the equivalent section for a non-pre-allocated 
buffer surface, I see that the find_allocation function will find an allocation 
and cause dfb_surface_allocation_update to be called, rather than 
dfb_surface_pools_allocate/dfb_surface_pools_negotiate.

Does anyone have an idea regarding the creation of a pre-allocated buffer (from 
system RAM) surface that would allow that buffer to be passed into my 
gfxdriver?  I guess an equivalent question would be:  how do I get read/write 
access flags set in the surface buffer pools for this pre-allocated buffer 
surface?  (That seems to be the point of failure in 
dfb_surface_pools_negotiate).

Thanks in advance for any guidance,

Tom


Conexant E-mail Firewall (Conexant.Com) made the following annotations
---------------------------------------------------------------------
********************** Legal Disclaimer **************************** 

"This email may contain confidential and privileged material for the sole use 
of the intended recipient. Any unauthorized review, use or distribution by 
others is strictly prohibited. If you have received the message in error, 
please advise the sender by reply email and delete the message. Thank you." 

********************************************************************** 

---------------------------------------------------------------------

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

Reply via email to