Exemplo n.º 1
0
void
dfb_init(int argc, char *argv[])
{
     DFBCHECK(DirectFBInit( &argc, &argv ));

     /* quiet option is no longer supported in DFB 1.2 */
     /* DFBCHECK(DirectFBSetOption ("quiet", "")); */

     /* create the super interface */
     DFBCHECK(DirectFBCreate( &dfb ));

     dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN);

     DFBCHECK(dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer ));
     layer->GetConfiguration (layer, &layer_config);

     /* get the primary surface, i.e. the surface of the primary layer we have
	exclusive access to */
     memset( &dsc, 0, sizeof(DFBSurfaceDescription) );     
     dsc.flags = 
	DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
     dsc.width = layer_config.width;
     dsc.height = layer_config.height;

     dsc.caps = DSCAPS_PRIMARY | DSCAPS_SYSTEMONLY /*| DSCAPS_FLIPPING */;
     /* FIXME */
     dsc.pixelformat = DSPF_RGB16;
     DFBCHECK(dfb->CreateSurface(dfb, &dsc, &primary ));
     primary->GetSize (primary, &opt.client.width, &opt.client.height);

     DFBCHECK(dfb->GetInputDevice( dfb, DIDID_KEYBOARD, &keyboard ));
     DFBCHECK(dfb->GetInputDevice( dfb, DIDID_MOUSE, &mouse ));
     DFBCHECK (dfb->CreateInputEventBuffer (dfb, DICAPS_ALL, DFB_TRUE, &input_buffer));
}
Exemplo n.º 2
0
int
dfb_post_connect(rdpInst * inst)
{
	GDI *gdi;
	dfbInfo *dfbi = GET_DFBI(inst);

	gdi_init(inst);
	gdi = GET_GDI(inst);
	
	dfbi->err = DirectFBCreate(&(dfbi->dfb));

	dfbi->dsc.flags = DSDESC_CAPS;
	dfbi->dsc.caps = DSCAPS_PRIMARY;
	dfbi->err = dfbi->dfb->CreateSurface(dfbi->dfb, &(dfbi->dsc), &(dfbi->primary));
	dfbi->err = dfbi->primary->GetSize(dfbi->primary, &(gdi->width), &(gdi->height));
	dfbi->dfb->SetVideoMode(dfbi->dfb, gdi->width, gdi->height, gdi->dstBpp);
	dfbi->dfb->CreateInputEventBuffer(dfbi->dfb, DICAPS_ALL, DFB_TRUE, &(dfbi->event_buffer));
	dfbi->event_buffer->CreateFileDescriptor(dfbi->event_buffer, &(dfbi->read_fds));
	
	dfbi->dfb->GetDisplayLayer(dfbi->dfb, 0, &(dfbi->layer));
	dfbi->layer->EnableCursor(dfbi->layer, 1);
	
	dfbi->dsc.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PREALLOCATED | DSDESC_PIXELFORMAT;
	dfbi->dsc.caps = DSCAPS_SYSTEMONLY;
	dfbi->dsc.width = gdi->width;
	dfbi->dsc.height = gdi->height;
	dfbi->dsc.pixelformat = DSPF_AiRGB;
	dfbi->dsc.preallocated[0].data = gdi->primary_buffer;
	dfbi->dsc.preallocated[0].pitch = gdi->width * 4;
	dfbi->dfb->CreateSurface(dfbi->dfb, &(dfbi->dsc), &(dfbi->surface));

	return 0;
}
Exemplo n.º 3
0
int dfb_init(int argc, char** argv, unsigned short width, unsigned short height) {

	DFBCHECK(DirectFBInit (&argc, &argv));
	DFBCHECK(DirectFBCreate (&DFBC_INTERFACE_));
	DFBCHECK(DFBC_INTERFACE_->SetCooperativeLevel (DFBC_INTERFACE_, DFSCL_FULLSCREEN));

	DFBC_ESCAPECTRL_ = DIKS_UP;
	DFBC_SURFACE_DESC_.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT;
	DFBC_SURFACE_DESC_.height = height;
	DFBC_SURFACE_DESC_.width = width;
	DFBC_SURFACE_DESC_.caps  = DSCAPS_PRIMARY | DSCAPS_FLIPPING;

	DFBCHECK(DFBC_INTERFACE_->CreateSurface(DFBC_INTERFACE_, &DFBC_SURFACE_DESC_, &DFBC_SURFACE_));
	DFBCHECK(DFBC_SURFACE_->GetSize (DFBC_SURFACE_, &DFB_SCREENW, &DFB_SCREENH));

	//Hide the cursor
	DFBC_INTERFACE_->GetDisplayLayer(DFBC_INTERFACE_, 0x00, &DFBC_LAYER_);
	DFBC_LAYER_->SetCooperativeLevel(DFBC_LAYER_, DLSCL_ADMINISTRATIVE);
	DFBC_LAYER_->SetCursorOpacity(DFBC_LAYER_, 0);

	/*
	 * TO-DO
	 * Return code
	 */
	return 0;
}
Exemplo n.º 4
0
g_error directfb_init(void) {
   DFBResult err;
   DFBSurfaceDescription dsc;
   err = DirectFBInit(NULL, NULL); /* no argc/argv */
   dfb_errcheck_die;
   err = DirectFBCreate (&directfb);
   dfb_errcheck_die;
   //directfb->SetCooperativeLevel (directfb, DFSCL_FULLSCREEN);
   dsc.flags = DSDESC_CAPS;
   dsc.caps  = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
   err = directfb->CreateSurface(directfb, &dsc, &primary);
   dfb_errcheck_die;
   err = primary->GetSize (primary, &vid->xres, &vid->yres);
   dfb_errcheck_die;
   vid->display = NULL;
   // FIXME
   if (!vid->bpp) vid->bpp = 32;

#ifdef DRIVER_DIRECTFBINPUT
   /* Load a main input driver */
   return load_inlib(&directfbinput_regfunc,&inlib_main);
#else
   return success;
#endif
}
Exemplo n.º 5
0
int
main( int argc, char** argv )
{
     IDirectFB      *dfb     = NULL; 
     ISaWMan        *saw     = NULL; 
     ISaWManManager *manager = NULL; 

     D_INFO( "SaWMan/Sample1: Initializing...\n" );

     CHECK( DirectFBInit( &argc, &argv ) );

     CHECK( DirectFBCreate( &dfb ) );

     CHECK( SaWManCreate( &saw ) );

     CHECK( saw->CreateManager( saw, &callbacks, NULL, &manager ) );

     pause();


out:
     D_INFO( "SaWMan/Sample1: Shutting down...\n" );

     if (manager)
          manager->Release( manager );

     if (saw)
          saw->Release( saw );

     if (dfb)
          dfb->Release( dfb );

     return 0;
}
Exemplo n.º 6
0
int
main( int argc, char *argv[] )
{
     DFBResult  ret;
     IDirectFB *dfb;

     /* Initialize DirectFB. */
     ret = DirectFBInit( &argc, &argv );
     if (ret) {
          D_DERROR( ret, "DFBTest/Resize: DirectFBInit() failed!\n" );
          return ret;
     }


     /* Create super interface. */
     ret = DirectFBCreate( &dfb );
     if (ret) {
          D_DERROR( ret, "DFBTest/Resize: DirectFBCreate() failed!\n" );
          return ret;
     }

     /* Required for keyboard access */
     dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );

     TestResize( dfb );



     /* Shutdown DirectFB. */
     dfb->Release( dfb );


     return ret;
}
Exemplo n.º 7
0
Arquivo: v4pi.c Projeto: miellaby/v4p
// Prepare things before the very first graphic rendering
Boolean v4pDisplayInit(int quality, Boolean fullscreen) {
   int rc = success;
   

   /* Get screen size from display structure macro */
   int wantedWidth = defaultScreenWidth * 2 / (3 - quality);
   int wantedHeight = defaultScreenHeight * 2 / (3 - quality);
   int argc = 0;
   char *argv[] = {"directFB"};
   DirectFBInit(&argc, &argv);
   DirectFBCreate(&dfb);
   if (fullscreen) {
	   dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN);
	}

   DFBSurfaceDescription dsc;
   /* dsc.flags = DSDESC_CAPS|DSDESC_WIDTH|DSDESC_HEIGHT; */
   dsc.flags = DSDESC_CAPS;
   dsc.caps  = DSCAPS_PRIMARY /* | DSCAPS_FLIPPING */;
   dsc.width = wantedWidth;
   dsc.height = wantedHeight;
   
   dfb->CreateSurface( dfb, &dsc, &v4pDisplayDefaultContextS.surface);

   v4pDisplayDefaultContextS.surface->GetSize (
                     v4pDisplayDefaultContextS.surface,
                     &v4pDisplayDefaultContextS.width,
                     &v4pDisplayDefaultContextS.height); 

   v4pDisplaySetContext(v4pDisplayDefaultContext);
   
   return rc;
}
Exemplo n.º 8
0
DirectFBFrame *createWindowFrame(const char *inTitle, int inWidth, int inHeight, unsigned int inFlags)
{
   putenv ((char*)"DFBARGS=system=x11");
   
   DirectFBInit(0, NULL);
   DirectFBCreate(&dfb);
   
   bool fullscreen = (inFlags & wfFullScreen) != 0;
   if (fullscreen)
   {
      dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN);
   }
   else
   {
      //dfb->SetCooperativeLevel(dfb, DFSCL_NORMAL);
      dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN);
   }
   
   dfb->SetVideoMode(dfb, inWidth, inHeight, 32);
   dfb->CreateInputEventBuffer(dfb, (DFBInputDeviceCapabilities)(DICAPS_KEYS | DICAPS_BUTTONS), DFB_FALSE, &sgEventBuffer);
   
   DFBSurfaceDescription dsc;
   dsc.flags = DSDESC_CAPS;
   dsc.caps = (DFBSurfaceCapabilities)(DSCAPS_PRIMARY | DSCAPS_FLIPPING);
   dsc.width = inWidth;
   dsc.height = inHeight;
   
   IDirectFBSurface *surface = NULL;
   dfb->CreateSurface(dfb, &dsc, &surface);
   
   return new DirectFBFrame(surface, inWidth, inHeight);
}
Exemplo n.º 9
0
int testing_multicore() {
    IDirectFB *dfb = NULL;
    IDirectFBSurface *surface = NULL;
    DFBSurfaceDescription dsc;

    pid_t n_pid = fork();

    if (n_pid) {
        sleep(1);
    }

    DFBCHECK(DirectFBInit(NULL, NULL));
    DFBCHECK(DirectFBCreate(&dfb));
    push_release(dfb, dfb->Release);

    DFBCHECK(dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
    dsc.flags = DSDESC_CAPS;
    dsc.caps  = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
    DFBCHECK (dfb->CreateSurface( dfb, &dsc, &surface ));
    push_release(surface, surface->Release);

    if (!n_pid) {
        sleep(1);
    }
    sleep(2);

    //DFBCHECK(surface->Release(surface));
    //DFBCHECK(dfb->Release(dfb));
    release_all();

    if (n_pid) {
        wait(NULL);
    }
    return 0;
}
Exemplo n.º 10
0
int
main( int argc, char *argv[] )
{
     DFBResult  ret;
     IDirectFB *dfb;

     /* Initialize DirectFB. */
     ret = DirectFBInit( &argc, &argv );
     if (ret) {
          D_DERROR( ret, "DFBTest/Init: DirectFBInit() failed!\n" );
          return ret;
     }

     /* Create super interface. */
     ret = DirectFBCreate( &dfb );
     if (ret) {
          D_DERROR( ret, "DFBTest/Init: DirectFBCreate() failed!\n" );
          return ret;
     }

     /* Shutdown DirectFB. */
     ret = dfb->Release( dfb );
     if (ret) {
          D_DERROR( ret, "DFBTest/Init: IDirectFB::Release() failed!\n" );
          return ret;
     }

     return 0;
}
Exemplo n.º 11
0
static int OpenDisplay(vout_display_t *vd)
{
    vout_display_sys_t *sys = vd->sys;

    DFBSurfaceDescription dsc;
    /*dsc.flags = DSDESC_CAPS | DSDESC_HEIGHT | DSDESC_WIDTH;*/
    dsc.flags = DSDESC_CAPS;
    dsc.caps  = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
    /*dsc.width = 352;*/
    /*dsc.height = 240;*/

    IDirectFB *directfb = NULL;
    if (DirectFBCreate(&directfb) != DFB_OK || !directfb)
        return VLC_EGENERIC;
    sys->directfb = directfb;

    IDirectFBSurface *primary = NULL;
    if (directfb->CreateSurface(directfb, &dsc, &primary) || !primary)
        return VLC_EGENERIC;
    sys->primary = primary;

    primary->GetSize(primary, &sys->width, &sys->height);
    primary->GetPixelFormat(primary, &sys->pixel_format);
    primary->FillRectangle(primary, 0, 0, sys->width, sys->height);
    primary->Flip(primary, NULL, 0);

    return VLC_SUCCESS;
}
Exemplo n.º 12
0
int get_display_layer_window() {
    IDirectFB *dfb = NULL;
    IDirectFBDisplayLayer   *layer   = NULL;
    IDirectFBWindow         *window  = NULL;

    DFBWindowDescription desc;


    DFBCHECK(DirectFBInit(NULL, NULL));

    DFBCHECK(DirectFBCreate(&dfb));
    push_release(dfb,dfb->Release);
    DFBCHECK(dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer));
    push_release(layer, layer->Release);

    desc.flags = DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY;

    desc.posx = desc.posy = desc.width = desc.height = 20;
    
    DFBCHECK(layer->CreateWindow(layer, &desc, &window));
    push_release(window, window->Release);

    /* check window */

    release_all();
    return 0;

}
Exemplo n.º 13
0
int directfb_init(int argc, char *argv[])
{
    DFBSurfaceDescription dsc;
    DFBFontDescription font_dsc;

    DFBCHECK (DirectFBInit (&argc, &argv));
    DFBCHECK (DirectFBCreate (&dfb));
    DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_NORMAL));
    dsc.flags = DSDESC_CAPS | DSDESC_PIXELFORMAT;
    dsc.caps  = DSCAPS_PRIMARY | DSCAPS_INTERLACED | DSCAPS_FLIPPING; 
    dsc.pixelformat = DSPF_YUY2;
    DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
    DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));

    font_dsc.flags = DFDESC_HEIGHT;
    font_dsc.height = 48;
    DFBCHECK (dfb->CreateFont (dfb, "Vera.ttf", &font_dsc, &font));
    DFBCHECK (primary->SetFont(primary, font));

    /* Blank screen */
    DFBCHECK (primary->SetColor (primary, 0x0, 0x0, 0x0, 0xFF));
    DFBCHECK (primary->FillRectangle (primary, 0, 0, screen_width, screen_height));
    /* Print text */
    DFBCHECK (primary->SetColor (primary, 0x80, 0x0, 0x20, 0xFF));
    DFBCHECK (primary->DrawString (primary, title, -1, 10, screen_height-100, DSTF_LEFT));
    /* Flip the front and back buffer, but wait for the vertical retrace to avoid tearing. */
    DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC));

    font->Release (font);
    return 23;
}
Exemplo n.º 14
0
/** Opens application window and return pointer to offscreen buffer for  */
char *directfbapp_open_window() {

    DFBWindowDescription wdesc;
    DFBDisplayLayerConfig lconfig;
    static char *argv_array[] = {
        "CVM",
        "--dfb:system=FBDev"
            ",force-windowed"   /* use windows instead of surfaces */
            ",no-vt-switch"     /* do not switch between Linux' VT */
            ",no-cursor"        /* do not use pointer */
            // ",no-deinit-check" /* do not check for deinit */
        ,NULL
    };
    int argc = sizeof argv_array / sizeof argv_array[0] - 1;
    char **argv = argv_array;
    IDirectFBDisplayLayer *dlayer;
    char *dst;
    int pitch;
    unsigned int win_id;
    int win_x, win_y;

    DFBCHECK(DirectFBInit(&argc, &argv));
    DFBCHECK(DirectFBCreate(&dfb));
    DFBCHECK(dfb->SetCooperativeLevel(dfb, DFSCL_NORMAL));

    DFBCHECK(dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &dlayer));
    DFBCHECK(dlayer->GetConfiguration(dlayer, &lconfig));
    wdesc.caps = DWCAPS_DOUBLEBUFFER;
    wdesc.surface_caps = DSCAPS_DOUBLE;
    wdesc.pixelformat = DSPF_RGB16;
    wdesc.width = CHAM_WIDTH;
    wdesc.height = CHAM_HEIGHT;
    wdesc.flags = DWDESC_CAPS | DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_PIXELFORMAT |
        DWDESC_SURFACE_CAPS;
    DFBCHECK(dlayer->CreateWindow(dlayer, &wdesc, &window));
    releaseInterface(dlayer);
    if ((lconfig.flags & (DLCONF_WIDTH | DLCONF_HEIGHT)) == (DLCONF_WIDTH | DLCONF_HEIGHT)) {
        DFBCHECK(window->GetID(window, &win_id));
        set_win_position(win_id, lconfig.width, lconfig.height, win_x, win_y);
        DFBCHECK(window->MoveTo(window, win_x, win_y));
    }
    DFBCHECK(window->RaiseToTop(window));
    DFBCHECK(window->SetOpacity(window, 0xff));
    DFBCHECK(window->RequestFocus(window));
    DFBCHECK(window->GetSurface(window, &screen));
    DFBCHECK(screen->GetSize(screen, &screen_width, &screen_height));
    DFBCHECK(screen->Lock(screen, DSLF_WRITE, (void**)(void*)&dst, &pitch));
    if (pitch != (int)sizeof(gxj_pixel_type) * screen_width) {
        REPORT_ERROR(LC_LOWUI,
            "Invalid pixel format: Supports only 16-bit, 5:6:5 display");
        goto dfb_err;
    }
    return dst;

dfb_err:;
    directfbapp_finalize();
    exit(1); /* TODO: exit from Java */
    /* return NULL; */
}
Exemplo n.º 15
0
void Renderer::init()
{
  if (m_initialized) return;

  // Set Video mode, if requested.
  // Must be done before DirectFBCreate()!
  if (m_videoMode != -1)
  {
    setVideoMode(m_videoMode);
  }

  DFBSurfaceDescription dsc;

  if (DirectFBCreate(&m_dfb) != DFB_OK) {
    fprintf(stderr, "Error in DirectFBCreate!\n"); return;
  }

  if (m_dfb->SetCooperativeLevel(m_dfb, DFSCL_EXCLUSIVE) != DFB_OK) {
    fprintf(stderr, "Error in SetCooperativeLevel!\n"); return;
  }
  
  dsc.flags = (DFBSurfaceDescriptionFlags)(DSDESC_CAPS | DSDESC_PIXELFORMAT);
  dsc.caps  = (DFBSurfaceCapabilities)(DSCAPS_PRIMARY | DSCAPS_DOUBLE);
  dsc.pixelformat = (DFBSurfacePixelFormat)DSPF_ARGB;
  
  if (m_dfb->CreateSurface( m_dfb, &dsc, &m_surface ) != DFB_OK) {
    fprintf(stderr, "Error in CreateSurface!\n"); return;
  }
  
  if (m_surface->GetSize (m_surface, &m_width, &m_height) != DFB_OK) {
    fprintf(stderr, "Error in GetSize!\n"); return;
  }

  m_scale = ((float)m_width) / VIRTUAL_WIDTH;
  m_width = VIRTUAL_WIDTH;
  m_height = VIRTUAL_HEIGHT;
  
  m_curr_buffer = 0;

  color(0,0,0,0xff);
  rect(0,0,m_width, m_height); flip();
  rect(0,0,m_width, m_height); flip();

  if (m_dfb->GetInputDevice (m_dfb, INPUT_DEVICE, &m_input) != DFB_OK) {
    fprintf(stderr, "Error in GetInputDevice!\n"); return;    
  }
  
  if (m_input->CreateEventBuffer (m_input, &m_eventBuffer) != DFB_OK) {
    fprintf(stderr, "Error in CreateEventBuffer!\n"); return;    
  }

  // m_image_loader = new ImageLoader();
  // m_image_loader->start();

  m_exit = false;
  m_initialized = true;
}
Exemplo n.º 16
0
int init_n_close() {
    IDirectFB *dfb = NULL;
    DFBCHECK(DirectFBInit(NULL, NULL));
    DFBCHECK(DirectFBCreate(&dfb));
    push_release(dfb, dfb->Release);

    release_all();
    return 0;
}
Exemplo n.º 17
0
int
main( int argc, char *argv[] )
{
     DFBResult         ret;
     int               i;
     IDirectFB        *dfb;
     DFBInputDeviceID  device_id = 0;

     /* Initialize DirectFB. */
     ret = DirectFBInit( &argc, &argv );
     if (ret) {
          D_DERROR( ret, "DFBTest/Input: DirectFBInit() failed!\n" );
          return ret;
     }

     /* Parse arguments. */
     for (i=1; i<argc; i++) {
          const char *arg = argv[i];

          if (strcmp( arg, "-h" ) == 0 || strcmp (arg, "--help") == 0)
               return print_usage( argv[0] );
          else if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) {
               fprintf (stderr, "dfbtest_input version %s\n", DIRECTFB_VERSION);
               return false;
          }
          else if (strcmp (arg, "-d") == 0 || strcmp (arg, "--device") == 0) {
               if (++i == argc) {
                    print_usage (argv[0]);
                    return false;
               }

               if (!parse_id( argv[i], &device_id ))
                    return false;
          }
          else
               return print_usage( argv[0] );
     }

     /* Create super interface. */
     ret = DirectFBCreate( &dfb );
     if (ret) {
          D_DERROR( ret, "DFBTest/Input: DirectFBCreate() failed!\n" );
          return ret;
     }

     Test_Sensitivity( dfb, device_id );

     /* Shutdown DirectFB. */
     ret = dfb->Release( dfb );
     if (ret) {
          D_DERROR( ret, "DFBTest/Input: IDirectFB::Release() failed!\n" );
          return ret;
     }

     return 0;
}
Exemplo n.º 18
0
BOOL df_post_connect(freerdp* instance)
{
    rdpGdi* gdi;
    dfInfo* dfi;
    dfContext* context;

    context = ((dfContext*) instance->context);
    dfi = context->dfi;

    gdi_init(instance, CLRCONV_ALPHA | CLRCONV_INVERT | CLRBUF_16BPP | CLRBUF_32BPP, NULL);
    gdi = instance->context->gdi;

    dfi->err = DirectFBCreate(&(dfi->dfb));

    dfi->dsc.flags = DSDESC_CAPS;
    dfi->dsc.caps = DSCAPS_PRIMARY;
    dfi->err = dfi->dfb->CreateSurface(dfi->dfb, &(dfi->dsc), &(dfi->primary));
    dfi->err = dfi->primary->GetSize(dfi->primary, &(gdi->width), &(gdi->height));
    dfi->dfb->SetVideoMode(dfi->dfb, gdi->width, gdi->height, gdi->dstBpp);
    dfi->dfb->CreateInputEventBuffer(dfi->dfb, DICAPS_ALL, DFB_TRUE, &(dfi->event_buffer));
    dfi->event_buffer->CreateFileDescriptor(dfi->event_buffer, &(dfi->read_fds));

    dfi->dfb->GetDisplayLayer(dfi->dfb, 0, &(dfi->layer));
    dfi->layer->EnableCursor(dfi->layer, 1);

    dfi->dsc.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PREALLOCATED | DSDESC_PIXELFORMAT;
    dfi->dsc.caps = DSCAPS_SYSTEMONLY;
    dfi->dsc.width = gdi->width;
    dfi->dsc.height = gdi->height;

    if (gdi->dstBpp == 32 || gdi->dstBpp == 24)
        dfi->dsc.pixelformat = DSPF_AiRGB;
    else if (gdi->dstBpp == 16 || gdi->dstBpp == 15)
        dfi->dsc.pixelformat = DSPF_RGB16;
    else if (gdi->dstBpp == 8)
        dfi->dsc.pixelformat = DSPF_RGB332;
    else
        dfi->dsc.pixelformat = DSPF_AiRGB;

    dfi->dsc.preallocated[0].data = gdi->primary_buffer;
    dfi->dsc.preallocated[0].pitch = gdi->width * gdi->bytesPerPixel;
    dfi->dfb->CreateSurface(dfi->dfb, &(dfi->dsc), &(dfi->surface));

    instance->update->BeginPaint = df_begin_paint;
    instance->update->EndPaint = df_end_paint;

    df_keyboard_init();

    pointer_cache_register_callbacks(instance->update);
    df_register_graphics(instance->context->graphics);

    freerdp_channels_post_connect(instance->context->channels, instance);

    return TRUE;
}
Exemplo n.º 19
0
int
main( int argc, char *argv[] )
{
     int                    i;
     DFBResult              ret;
     IDirectFB             *dfb;
     IDirectFBDisplayLayer *layer  = NULL;
     App                    apps[1];
     DFBDisplayLayerConfig  config;

     /* Parse arguments. */
     for (i=1; i<argc; i++) {
          if (!strcmp( argv[i], "-h" ))
               return show_usage( argv[0] );
     }

     /* Initialize DirectFB. */
     ret = DirectFBInit( &argc, &argv );
     if (ret) {
          D_DERROR( ret, "DFBTest/WindowFlip: DirectFBInit() failed!\n" );
          return ret;
     }

     /* Create super interface. */
     ret = DirectFBCreate( &dfb );
     if (ret) {
          D_DERROR( ret, "DFBTest/WindowFlip: DirectFBCreate() failed!\n" );
          return ret;
     }

     /* Get primary layer. */
     ret = dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer );
     if (ret) {
          D_DERROR( ret, "DFBTest/WindowFlip: IDirectFB::GetDisplayLayer( PRIMARY ) failed!\n" );
          goto out;
     }

     
     layer->GetConfiguration( layer, &config );

     app_init( &apps[0], layer, 100, 50, config.width-300, config.height-150, 0 );

     while (true) {
          direct_thread_sleep( 1000000 );

          app_update( &apps[0] );
     }


out:
     /* Shutdown DirectFB. */
     dfb->Release( dfb );

     return ret;
}
Exemplo n.º 20
0
int main (int argc, char **argv)
{
    DFBResult dfberr;

    if( (dfberr = DirectFBInit( &argc, &argv )) != DFB_OK )
    { DirectFBErrorFatal("DirectFBInit( &argc, &argv )", dfberr); }

    IDirectFB * main_interface = NULL;
    IDirectFB * main_interface_2 = NULL;                                  
    /* 1) */

    if( (dfberr = DirectFBCreate( &main_interface )) != DFB_OK )
    { DirectFBErrorFatal( "DirectFBCreate( &main_interface )", dfberr); }
#if 0
        /* 2) */
    if( (dfberr = DirectFBCreate( &main_interface )) != DFB_OK )          
    { DirectFBErrorFatal( "DirectFBCreate( &main_interface )", dfberr); }
#endif

/*if( (dfberr 
= main_dfb_interface->SetVideoMode( main_interface, 100, 100, 0 )) != 
DFB_OK ) { fprintf(stderr, "File: %s, Line: %d:\n", __FILE__, __LINE__); 
DirectFBErrorFatal( "SetVideoMode( main_interface, 100, 100, 100 )", 
dfberr); }*/
            
    if( (dfberr = DirectFBCreate( &main_interface_2 )) != DFB_OK )
    { DirectFBErrorFatal( "DirectFBCreate( &main_interface_2 )", dfberr); }

if (main_interface == main_interface_2)
{
printf("Returns same\n");
printf("Returns same\n");
printf("Returns same\n");
sleep(10);
}

    if( (dfberr = main_interface->SetCooperativeLevel( main_interface, DFSCL_FULLSCREEN )) != DFB_OK )
    { DirectFBErrorFatal( "SetCooperativeLevel( main_interface, DFSCL_FULLSCREEN )", dfberr); }
        if( (dfberr = main_interface_2->SetCooperativeLevel( main_interface_2, DFSCL_FULLSCREEN )) != DFB_OK )         /* 3) */
        { DirectFBErrorFatal( "SetCooperativeLevel( main_interface_2, DFSCL_FULLSCREEN )", dfberr); }
}
Exemplo n.º 21
0
gfxDirectFBSurface::gfxDirectFBSurface(const gfxIntSize& size, gfxImageFormat format) :
    mDFB(nsnull), mDFBSurface(nsnull)
{
    DFBResult             ret;
    DFBSurfaceDescription desc;

    if (!CheckSurfaceSize(size) || size.width <= 0 || size.height <= 0)
        return;

    /* Lightweight, getting singleton */
    ret = DirectFBCreate( &mDFB );
    if (ret) {
        D_DERROR( (DirectResult) ret, "gfxDirectFBSurface: DirectFBCreate() failed!\n" );
        return;
    }

    desc.flags  = (DFBSurfaceDescriptionFlags)( DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT );
    desc.width  = size.width;
    desc.height = size.height;

    switch (format) {
    case gfxASurface::ImageFormatARGB32:
        desc.pixelformat = DSPF_ARGB;
        break;

    case gfxASurface::ImageFormatRGB24:
        desc.pixelformat = DSPF_RGB32;
        break;

    case gfxASurface::ImageFormatA8:
        desc.pixelformat = DSPF_A8;
        break;

    case gfxASurface::ImageFormatA1:
        desc.pixelformat = DSPF_A1;
        break;

    default:
        D_BUG( "unknown format" );
        return;
    }

    ret = mDFB->CreateSurface( mDFB, &desc, &mDFBSurface );
    if (ret) {
        D_DERROR( (DirectResult) ret, "gfxDirectFBSurface: "
                  "IDirectFB::CreateSurface( %dx%d ) failed!\n", desc.width, desc.height );
        return;
    }

    cairo_surface_t *surface = cairo_directfb_surface_create(mDFB, mDFBSurface);

    Init(surface);
}
Exemplo n.º 22
0
IDirectFB *QDirectFbConvenience::dfbInterface()
{
    static IDirectFB *dfb = 0;
    if (!dfb) {
        DFBResult result = DirectFBCreate(&dfb);
        if (result != DFB_OK) {
            DirectFBError("QDirectFBConvenience: error creating DirectFB interface",result);
            return 0;
        }
    }
    return dfb;
}
Exemplo n.º 23
0
int
main( int argc, char *argv[] )
{
     DFBResult ret;
     Reaction  reaction;

     /* Initialize DirectFB including command line parsing. */
     ret = DirectFBInit( &argc, &argv );
     if (ret) {
          DirectFBError( "DirectFBInit() failed", ret );
          return -1;
     }

     /* Parse the command line. */
     if (!parse_command_line( argc, argv ))
          return -2;

     /* Create the super interface. */
     ret = DirectFBCreate( &dfb );
     if (ret) {
          DirectFBError( "DirectFBCreate() failed", ret );
          return -3;
     }

     if (!unique_wm_running()) {
          D_ERROR( "UniQuE/Test: This session doesn't run UniQuE!\n" );
          dfb->Release( dfb );
          return EXIT_FAILURE;
     }

     unique_wm_enum_contexts( context_callback, NULL );

     if (!context) {
          D_ERROR( "UniQuE/Test: No context available!\n" );
          dfb->Release( dfb );
          return EXIT_FAILURE;
     }


     unique_input_channel_attach( context->foo_channel, foo_channel_listener, context, &reaction );

     pause();

     unique_input_channel_detach( context->foo_channel, &reaction );

     unique_context_unref( context );

     /* Release the super interface. */
     dfb->Release( dfb );

     return EXIT_SUCCESS;
}
Exemplo n.º 24
0
int
main( int argc, char *argv[] )
{
     DFBResult ret;

     /* Initialize DirectFB including command line parsing. */
     ret = DirectFBInit( &argc, &argv );
     if (ret) {
          DirectFBError( "DirectFBInit() failed", ret );
          return -1;
     }

     /* Parse the command line. */
     if (!parse_command_line( argc, argv ))
          return -2;

     /* Create the super interface. */
     ret = DirectFBCreate( &dfb );
     if (ret) {
          DirectFBError( "DirectFBCreate() failed", ret );
          return -3;
     }

     if (!prophecy_wm_running()) {
          D_ERROR( "Prophecy/Test: This session doesn't run Prophecy!\n" );
          dfb->Release( dfb );
          return EXIT_FAILURE;
     }

     prophecy_wm_enum_contexts( context_callback, NULL );

     if (!context) {
          D_ERROR( "Prophecy/Test: No context available!\n" );
          dfb->Release( dfb );
          return EXIT_FAILURE;
     }

     /* Set the background according to the users wishes. */
     if (color)
          set_color();

     prophecy_context_unref( context );

     /* Release the super interface. */
     dfb->Release( dfb );

     return EXIT_SUCCESS;
}
Exemplo n.º 25
0
static void
init_application( int *argc, char **argv[] )
{
     DFBResult             ret;
     DFBSurfaceDescription desc;

     /* Initialize DirectFB including command line parsing. */
     ret = DirectFBInit( argc, argv );
     if (ret) {
          DirectFBError( "DirectFBInit() failed", ret );
          exit_application( 1 );
     }

     /* Create the super interface. */
     ret = DirectFBCreate( &dfb );
     if (ret) {
          DirectFBError( "DirectFBCreate() failed", ret );
          exit_application( 2 );
     }

     /* Request fullscreen mode. */
     dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );

     /* Fill the surface description. */
     desc.flags       = DSDESC_CAPS | DSDESC_PIXELFORMAT;
     desc.caps        = DSCAPS_PRIMARY | DSCAPS_DOUBLE;
     desc.pixelformat = DSPF_ARGB;
     
     /* Create an 8 bit palette surface. */
     ret = dfb->CreateSurface( dfb, &desc, &primary );
     if (ret) {
          DirectFBError( "IDirectFB::CreateSurface() failed", ret );
          exit_application( 3 );
     }
     
     /* Create an event buffer with key capable devices attached. */
     ret = dfb->CreateInputEventBuffer( dfb, DICAPS_KEYS, DFB_FALSE, &events );
     if (ret) {
          DirectFBError( "IDirectFB::CreateEventBuffer() failed", ret );
          exit_application( 4 );
     }
     
     /* Clear with black. */
     primary->Clear( primary, 0x00, 0x00, 0x00, 0xff );
     primary->Flip( primary, NULL, 0 );
}
Exemplo n.º 26
0
int get_display_layer() {
    IDirectFB *dfb = NULL;
    IDirectFBDisplayLayer   *layer   = NULL;

    DFBCHECK(DirectFBInit(NULL, NULL));

    DFBCHECK(DirectFBCreate(&dfb));
    push_release(dfb, dfb->Release);

    DFBCHECK(dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer));
    push_release(layer, layer->Release);

    release_all();

    return 0;

}
Exemplo n.º 27
0
int open_display(int w, int h)
{
	DirectFBInit(NULL, NULL);

	DirectFBCreate( &dfb );

	width = w;
	height = h;

	dfb->SetCooperativeLevel(dfb, DFSCL_EXCLUSIVE);

	dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer);

	layer->GetSurface(layer, &surface);

	return 0;
}
Exemplo n.º 28
0
Eina_Bool
engine_directfb_args(const char *engine, int width, int height)
{
   Evas_Engine_Info_DirectFB *einfo;
   DFBWindowDescription desc;
   int i;

   evas_output_method_set(evas, evas_render_method_lookup("directfb"));
   einfo = (Evas_Engine_Info_DirectFB *)evas_engine_info_get(evas);
   if (!einfo)
     {
	printf("Evas does not support the DirectFB Engine\n");
	return EINA_FALSE;
     }

   DFBCHECK(DirectFBInit(NULL, NULL));
   DFBCHECK(DirectFBCreate(&_dfb));
   DFBCHECK(_dfb->GetDisplayLayer(_dfb, DLID_PRIMARY, &_layer));
   DFBCHECK(_dfb->CreateEventBuffer(_dfb, &_window_event));
   DFBCHECK(_dfb->CreateInputEventBuffer(_dfb, DICAPS_ALL, DFB_FALSE, &_input_event));

   memset(&desc, 0, sizeof(DFBWindowDescription));
   desc.flags = (DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_PIXELFORMAT);
   desc.posx = 0;
   desc.posy = 0;
   desc.width = width;
   desc.height = height;
   desc.pixelformat = DSPF_ARGB;

   DFBCHECK(_layer->CreateWindow(_layer, &desc, &_dfb_window));
   DFBCHECK(_dfb_window->AttachEventBuffer(_dfb_window, _window_event));
   DFBCHECK(_dfb_window->SetOptions(_dfb_window, DWOP_NONE));
   DFBCHECK(_dfb_window->SetOpacity(_dfb_window, 0xFF));
   DFBCHECK(_dfb_window->GetSurface(_dfb_window, &_dfb_surface));
   DFBCHECK(_dfb_surface->SetPorterDuff(_dfb_surface, DSPD_SRC_OVER));

   einfo->info.dfb = _dfb;
   einfo->info.surface = _dfb_surface;
   if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo))
     {
	printf("Evas can not setup the informations of the DirectFB Engine\n");
	return EINA_FALSE;
     }

   return EINA_TRUE;
}
Exemplo n.º 29
0
int list_layers() {

    IDirectFB *dfb = NULL;
    //IDirectFBSurface *surface = NULL;
    //IDirectFBLayer   *layer   = NULL;


    DFBCHECK(DirectFBInit(NULL, NULL));

    DFBCHECK(DirectFBCreate(&dfb)); 
    push_release(dfb, dfb->Release);
    
    DFBCHECK(dfb->EnumDisplayLayers(dfb, layer_cb, dfb));

    sleep(1);
    release_all();
    return 0;
}
Exemplo n.º 30
0
static void init_dfb(IDirectFBSurface     **SurfaceHandle, int clut)
{
  if (!DirectFBHandle) {
    DFBCHECK (DirectFBInit (0, NULL));
    DFBCHECK (DirectFBCreate (&DirectFBHandle));
  }

  SurfaceDescription.width  = 1280;
  SurfaceDescription.height = 720;
  SurfaceDescription.pixelformat = clut ? DSPF_LUT8 : DSPF_ARGB;
  SurfaceDescription.caps   = DSCAPS_VIDEOONLY;
  SurfaceDescription.flags  = (DSDESC_CAPS
			       | DSDESC_PIXELFORMAT
			       | DSDESC_WIDTH
			       | DSDESC_HEIGHT);
  
  DFBCHECK(DirectFBHandle->CreateSurface( DirectFBHandle, &SurfaceDescription, SurfaceHandle ));  
}