Hello,

When I try and run the following program on my Matrox G450 using CVS version
(before major restructuring) and the 2.6 fbdev I get a non deterministic
behaviour : each time I get a different output (but never what I want :-( ).

I have the impression that the fbdev could be causing this, or am I just
writing wrong code ? Could someone with a Matrox card try this out ?

Thanks a lot !!!

Kristof

_______________________
#include <stdio.h>
#include <unistd.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 );                         \
      }                                                        \
  }

int main (int argc, char **argv)
{
        IDirectFB *dfb = NULL;
        IDirectFBDisplayLayer *secondaryLayer = NULL;
        IDirectFBSurface *primarySurface = NULL;
        IDirectFBSurface *secondarySurface = NULL;
        int screen_width  = 500;
        int screen_height = 500;
        DFBSurfaceDescription dsc;
        DFBDisplayLayerConfig conf;
        DFBCHECK (DirectFBInit (&argc, &argv));
        DirectFBSetOption ("bg-none", NULL);
        DirectFBSetOption("no-cursor",NULL);
        DFBCHECK (DirectFBCreate (&dfb));
        dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN);
        dsc.flags = DSDESC_CAPS;
        dsc.caps  = DSCAPS_PRIMARY;
        DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primarySurface ));
        DFBCHECK (primarySurface->Clear( primarySurface, 0, 0, 0, 0xff ));
        DFBCHECK (primarySurface->SetDrawingFlags(primarySurface,
DSDRAW_BLEND));
        DFBCHECK (primarySurface->GetSize (primarySurface, &screen_width,
&screen_height));
        DFBCHECK (primarySurface->SetColor (primarySurface, 0xff, 0x00, 0x00,
0x3f));
        DFBCHECK (primarySurface->FillRectangle (primarySurface,
                                                         0, 0,
screen_width / 2, screen_height / 2));
        DFBCHECK (primarySurface->Flip (primarySurface, NULL, 0));
        sleep (3);
        primarySurface->Release( primarySurface );
        DFBCHECK (dfb->GetDisplayLayer(dfb, 1, &secondaryLayer));
        DFBCHECK (secondaryLayer->SetCooperativeLevel(secondaryLayer,
DLSCL_EXCLUSIVE));
        //DFBCHECK (secondaryLayer->SetScreenLocation(secondaryLayer, 0.0 ,
0.0, 1.0, 1.0));
        conf.flags = (DFBDisplayLayerConfigFlags)(DLCONF_BUFFERMODE  |
DLCONF_PIXELFORMAT);
        conf.buffermode = DLBM_BACKVIDEO;
        conf.pixelformat = DSPF_I420;
        DFBCHECK (secondaryLayer->SetConfiguration(secondaryLayer, &conf));
        DFBCHECK (secondaryLayer->GetSurface(secondaryLayer,
&secondarySurface));
        DFBCHECK (secondarySurface->GetSize (secondarySurface, &screen_width,
&screen_height));
        DFBCHECK (secondarySurface->SetDrawingFlags(secondarySurface,
DSDRAW_BLEND));
        DFBCHECK (secondarySurface->SetColor (secondarySurface, 0x00, 0xff,
0x00, 0x7f));
        DFBCHECK (secondarySurface->FillRectangle (secondarySurface,
                                                         screen_width /
4, screen_height / 4, screen_width / 2, screen_height / 2));
        DFBCHECK (secondarySurface->Flip (secondarySurface, NULL, 0));
        sleep (3);
        DFBCHECK (secondarySurface->SetColor (secondarySurface, 0x00, 0xff,
0x00, 0x7f));
        DFBCHECK (secondarySurface->FillRectangle (secondarySurface,
                                                         screen_width /
4, screen_height / 4, screen_width / 2, screen_height / 2));
        DFBCHECK (secondarySurface->SetColor (secondarySurface, 0x00, 0x00,
0xff, 0x7f));
        DFBCHECK (secondarySurface->FillRectangle (secondarySurface,
                                                         screen_width /
2, screen_height / 2, screen_width / 2, screen_height / 2));
        DFBCHECK (secondarySurface->Flip (secondarySurface, NULL, 0));
        sleep (3);
        secondarySurface->Release( secondarySurface );
        secondaryLayer->Release( secondaryLayer );
        dfb->Release( dfb );
        return 23;
}



-- 
Info:  To unsubscribe send a mail to [EMAIL PROTECTED] with 
"unsubscribe directfb-dev" as subject.

Reply via email to