It seems to manifest itself on all the tutorial examples, but it's just hard
to see sometimes. The below application slides a big white box
across the screen making it very obvious (I took the 'text' example and
hacked it up).

////////////////////////////////////////////////////////////////////////////
//////////////

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include <directfb.h>

/*
 * (Globals)
 */
static IDirectFB *dfb = NULL;
static IDirectFBSurface *primary = NULL;
static int screen_width  = 0;
static int screen_height = 0;
#define DFBCHECK(x...)                                         \
  {                                                            \
    DFBResult err = x;                                         \
                                                               \
    if (err != DFB_OK)                                         \
      {                                                        \
        fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
        DirectFBErrorFatal( #x, err );                         \
        exit(-1);                                              \
      }                                                        \
  }

int main (int argc, char **argv)
{
  int i;

  /*
   * (Locals)
   */
  DFBSurfaceDescription dsc;

  /*
   * (Initialize)
   */
  DFBCHECK (DirectFBInit (&argc, &argv));
  DFBCHECK (DirectFBCreate (&dfb));
  DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
  dsc.flags = DSDESC_CAPS;
  dsc.caps  = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
  DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
  DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));

 // clear the front and back surfaces
      DFBCHECK (primary->SetColor (primary, 0x0, 0x0, 0x0, 0xFF));
      DFBCHECK (primary->FillRectangle (primary, 0, 0, screen_width,
screen_height));
      DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC));
      DFBCHECK (primary->SetColor (primary, 0x0, 0x0, 0x0, 0xFF));
      DFBCHECK (primary->FillRectangle (primary, 0, 0, screen_width,
screen_height));
      DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC));

  for (i = screen_width; i > 0; i--)
    {
 int x,y,width,height;

  height = 400;
  x = i - 1;
  y = (screen_height / 2) - (height / 2);
  width = screen_width - i + 1;

      DFBCHECK (primary->SetColor (primary, 0x0, 0x0, 0x0, 0xFF));
      DFBCHECK (primary->FillRectangle (primary, x,y,width,height));
      DFBCHECK (primary->SetColor (primary, 0xff, 0xff, 0xff, 0xFF));
      DFBCHECK (primary->FillRectangle (primary, x,y,width,height));


     DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC));
/* comment this in to make it work
 usleep(1);
*/

    }

  /*
   * (Release)
   */
  primary->Release (primary);
  dfb->Release (dfb);

  return 23;
}

////////////////////////////////////////////////////
----- Original Message -----
From: "Sven Neumann" <[EMAIL PROTECTED]>
To: "Neil Radisch" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, February 19, 2003 12:06 PM
Subject: [directfb-dev] Re: Matrox video tearing


> Hi,
>
> Neil Radisch <[EMAIL PROTECTED]> writes:
>
> > There seems to be a problem with flipping and waiting for
> > sync (Matrox Millennium card). I took the "text" program
> > from the DFBTutorials and modified it so it only erases the
> > rectangle with the text instead of the whole screen. The
> > program no longer waits for sync and text flies across
> > the screen, tearing the whole way.
>
> we won't be able to debug your problem unless you send us a diff
> (preferably unified) of the changes you did to the code.
>
>
> Salut, Sven
>
>
>
> --
> Info:  To unsubscribe send a mail to [EMAIL PROTECTED] with
> "unsubscribe directfb-dev" as subject.
>



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

Reply via email to