Hi, I got following error while executing my sample application:
(!) [Main Thread 0.000] (27229) *** Assertion [surface->num_buffers > 0] failed *** [../../src/core/surface.h:324 in dfb_surface_get_buffer()] The problem occurs when I attempt to create window. But it happens only after cooperative level is switched to DFSCL_EXCLUSIVE or DFSCL_FULLSCREEN. I have found that when DFSCL_NORMAL cooperative level is switched to DFSCL_EXCLUSIVE or DFSCL_FULLSCREEN then following actions are performed: - new layer context is created and activated, - which causes previous context to be deactivated - that destroys all buffers attached to previous context. When a new window is about to be created DirectFB refers to previous layer context as a primary context, which assumes that its number of buffers is more than zero and performs division by number of buffers in function dfb_surface_get_buffer, unless assertion is enabled I reproduced such behaviour also using DirectFB 1.4.15. Could you give me a hint how to prevent such problems? Is there some bug in DirectFB or do I do something wrong? Regards, Sebastian Tron Here is a sample code: #include <stdio.h> #include <unistd.h> #include <unistd.h> #include <stdlib.h> #include <math.h> #include <time.h> #include <string.h> #include <direct/clock.h> #include <direct/debug.h> #include <directfb.h> #define DFBCHECK(x...) \ { \ DFBResult err = x; \ \ if (err != DFB_OK) \ { \ fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \ DirectFBErrorFatal( #x, err ); \ } \ } #define TTXT_WIDTH 720 #define TTXT_HEIGHT 288 #define TTXT_DFB_PALETTE_SIZE 64 static IDirectFB *dfb = NULL; static IDirectFBSurface *dfb_surface_handle = NULL; static IDirectFBPalette *fb_palette_handle = NULL; static IDirectFBDisplayLayer *dfb_primary_layer_handle = NULL; static IDirectFBWindow *dfb_window_handle = NULL; //-----------------------------------------------------------------------------------------------------------// int main (int argc, char **argv) { DFBDisplayLayerConfig layerConfig; DFBWindowDescription description; DFBResult dfb_result = DFB_FAILURE; DFBCHECK (DirectFBInit (&argc, &argv)) ; DFBCHECK (DirectFBCreate (&dfb)); /* Switch to EXCLUSIVE level to hide some unwanted distortions on the screen in further steps */ DFBCHECK (dfb->SetCooperativeLevel(dfb, DFSCL_EXCLUSIVE)); DFBCHECK (dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &dfb_primary_layer_handle)); memset(&description, 0, sizeof(DFBWindowDescription)); description.flags = DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY | DWDESC_OPTIONS | DWDESC_CAPS | DWDESC_SURFACE_CAPS | DWDESC_PIXELFORMAT; description.width = 720; description.height = 576; description.posx = 0; description.posy = 0; description.pixelformat = DSPF_LUT8; description.options = DWOP_ALPHACHANNEL | DWOP_SCALE; description.caps = DWCAPS_DOUBLEBUFFER | DWCAPS_ALPHACHANNEL | DWCAPS_NODECORATION; description.surface_caps = DSCAPS_DOUBLE | DSCAPS_PREMULTIPLIED; /* This call causes division by zero */ DFBCHECK (dfb_primary_layer_handle->CreateWindow(dfb_primary_layer_handle, &description, &dfb_window_handle)); dfb->SetCooperativeLevel(dfb, DFSCL_NORMAL); sleep (5); if (dfb_surface_handle != NULL) { if (fb_palette_handle != NULL) { dfb_result = fb_palette_handle->Release(fb_palette_handle); fb_palette_handle = NULL; } dfb_result = dfb_surface_handle->Release(dfb_surface_handle); dfb_surface_handle = NULL; dfb_window_handle->Release(dfb_window_handle); dfb_window_handle = NULL; } dfb->Release (dfb); return 0; } _______________________________________________ directfb-dev mailing list directfb-dev@directfb.org http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev