问题
This same example runs with no problem in my older Ubuntu 10.10 with DirectFB 1.4.11 and shows a yellow line in the center of the black screen:
#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;
}
But this same example will only show a black screen, with no line, in Ubuntu 12.04, using DirectFB 6.3.
The console output is:
# ./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!
Any idea why the line is not drawn? I wonder if it's a problem with the 64-bit system?
回答1:
You meant 1.6.3
version. I dont know about your configure options. For example MMX Support
.
You can reconfigure and reinstall it with --enable-debug
and/or --enable-trace
then run the programs with --dfb:debug
for more info.
Also DirectFB
does a lot of system call
while running so you can see them by strace
.
This is an old question but lately these are my suggested methods to find related problems to run directfb apps.
Goog luck.
来源:https://stackoverflow.com/questions/14752993/how-to-run-this-dfb-image-example-on-ubuntu-12-04-64-bit-with-directfb-1-6-3