2013-02-07 58 views
1

同樣的例子在我的大的Ubuntu 10.10與DirectFB的1.4.11沒有問題的運行,並顯示在黑屏中央的黃線:如何使用DirectFB 1.6.3在Ubuntu 12.04 64位上運行此DFB圖像示例?

#include <iostream> 
#include <stdio.h> 
#include <unistd.h> 
#include <directfb.h> 

using namespace std; 

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);       \ 
     }              \ 
    } 
int main(int argc, char **argv) { 

    DFBSurfaceDescription dsc; 
    DFBCHECK(DirectFBInit (&argc, &argv)); 
    DFBCHECK(DirectFBCreate (&dfb)); 
    DFBCHECK(dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)); 
    dsc.flags = DSDESC_CAPS; 
    dsc.caps = DFBSurfaceCapabilities(DSCAPS_PRIMARY | DSCAPS_FLIPPING); 
    DFBCHECK(dfb->CreateSurface(dfb, &dsc, &primary)); 
    DFBCHECK(primary->GetSize (primary, &screen_width, &screen_height)); 
    DFBCHECK(primary->FillRectangle (primary, 0, 0, screen_width, screen_height)); 
    DFBCHECK(primary->SetColor (primary, 0xFF, 0xFF, 0x00, 0xff)); 
    DFBCHECK(primary->SetSrcColorKey(primary, 0xFF, 0xFF, 0x00)); 
    DFBCHECK(primary->SetBlittingFlags(primary, (DFBSurfaceBlittingFlags) (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_SRC_COLORKEY))); 
    DFBCHECK(primary->DrawLine (primary, 0, screen_height/2, screen_width - 1, screen_height/2)); 
    primary->Flip(primary, NULL, DFBSurfaceFlipFlags(0)); 
    sleep(3); 
    primary->Release(primary); 
    dfb->Release(dfb); 
    cout << "DONE!\n"; 
    return 23; 
} 

但同樣的例子,將只顯示黑屏,沒有線,在Ubuntu 12.04中,使用DirectFB 6.3。

控制檯輸出爲:

# ./a.out 

    ~~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB 1.6.3 |~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     (c) 2012-2013 DirectFB integrated media GmbH 
     (c) 2001-2013 The world wide DirectFB Open Source Community 
     (c) 2000-2004 Convergence (integrated media) GmbH 
     ---------------------------------------------------------------- 

(*) DirectFB/Core: Single Application Core. (2013-02-07 11:05) 
(*) Direct/Memcpy: Using libc memcpy() 
(*) Direct/Thread: Started 'Fusion Dispatch' (-1) [MESSAGING OTHER/OTHER 0/0] <8388608>... 
(*) Direct/Thread: Started 'VT Switcher' (-1) [CRITICAL OTHER/OTHER 0/0] <8388608>... 
(*) Direct/Thread: Started 'VT Flusher' (-1) [DEFAULT OTHER/OTHER 0/0] <8388608>... 
(*) DirectFB/FBDev: Found 'svgadrmfb' (ID 0) with frame buffer at 0x00000000, 15360k (MMIO 0x00000000, 0k) 
(*) Direct/Thread: Started 'PS/2 Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>... 
(*) DirectFB/Input: IMPS/2 Mouse (1) 1.0 (directfb.org) 
(*) Direct/Thread: Started 'PS/2 Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>... 
(*) DirectFB/Input: IMPS/2 Mouse (2) 1.0 (directfb.org) 
(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>... 
(*) DirectFB/Input: Power Button (1) 0.1 (directfb.org) 
(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>... 
(*) DirectFB/Input: AT Translated Set 2 keyboard (2) 0.1 (directfb.org) 
(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>... 
(*) DirectFB/Input: VMware VMware Virtual USB Mouse (3) 0.1 (directfb.org) 
(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>... 
(*) DirectFB/Input: VMware VMware Virtual USB Mouse (4) 0.1 (directfb.org) 
(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>... 
(*) DirectFB/Input: ImPS/2 Generic Wheel Mouse (5) 0.1 (directfb.org) 
(*) Direct/Thread: Started 'Hotplug with Linux Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>... 
(*) DirectFB/Input: Hot-plug detection enabled with Linux Input Driver 
(*) Direct/Thread: Started 'Joystick Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>... 
(*) DirectFB/Input: Joystick 0.9 (directfb.org) 
(*) DirectFB/Input: Hot-plug detection enabled with Input Hub Driver 
(*) Direct/Thread: Started 'Keyboard Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>... 
(!!!) *** ONCE [Joystick sends JS_EVENT_INIT events, make sure it has been calibrated using 'jscal -c' 
] *** [joystick.c:99 in joystick_handle_event()] 
(*) DirectFB/Input: Keyboard 0.9 (directfb.org) 
(*) DirectFB/Genefx: MMX detected and enabled 
(*) DirectFB/Graphics: MMX Software Rasterizer 0.7 (directfb.org) 
(*) DirectFB/Core/WM: Default 0.3 (directfb.org) 
(*) FBDev/Mode: Setting 800x600 RGB32 
(*) FBDev/Mode: Switched to 800x600 (virtual 800x600) at 32 bit (RGB32), pitch 8192 
(*) FBDev/Mode: Setting 800x600 RGB32 
(*) FBDev/Mode: Switched to 800x600 (virtual 800x600) at 32 bit (RGB32), pitch 8192 
(*) FBDev/Mode: Setting 800x600 RGB32 
(*) FBDev/Mode: Switched to 800x600 (virtual 800x1200) at 32 bit (RGB32), pitch 8192 
(*) FBDev/Mode: Setting 800x600 RGB32 
(*) FBDev/Mode: Switched to 800x600 (virtual 800x600) at 32 bit (RGB32), pitch 8192 
DONE! 

任何想法,爲什麼則不繪製線條?我想知道這是64位系統的問題嗎?

回答

0

您的意思是1.6.3版本。我不知道你的配置選項。例如MMX Support。 您可以使用--enable-debug和/或--enable-trace重新配置並重新安裝,然後使用--dfb:debug運行程序以獲取更多信息。 另外DirectFB在運行時會做很多system call,所以您可以通過strace查看它們。 這是一個古老的問題,但最近這些是我的建議方法來查找相關問題來運行directfb應用程序。 Goog運氣。

相關問題