DirectFB教程参数无效
我似乎无法启动DirectFB,以便它可以毫无问题地启动。 在DFBCHECK DirectFBCreate&dfb;之后尝试访问函数时,我得到的参数无效; 我尝试运行教程中的简单示例。代码如下:DirectFB教程参数无效,c,linux,framebuffer,directfb,C,Linux,Framebuffer,Directfb,我似乎无法启动DirectFB,以便它可以毫无问题地启动。 在DFBCHECK DirectFBCreate&dfb;之后尝试访问函数时,我得到的参数无效; 我尝试运行教程中的简单示例。代码如下: #include <stdio.h> #include <unistd.h> #include <directfb.h> static IDirectFB *dfb = NULL; static IDirectFBSurface *primary = NULL;
#include <stdio.h>
#include <unistd.h>
#include <directfb.h>
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)
{
int argx = 2;
char *argData[] = {"self","--dfb:system=fbdev,disable-module=keyboard,disable-module=joystick,no-hardware",0};
char **argPointer = argData;
DFBSurfaceDescription dsc;
DFBCHECK (DirectFBInit (&argx,&argPointer));
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));
DFBCHECK (primary->FillRectangle (primary, 0, 0, screen_width, screen_height));
DFBCHECK (primary->SetColor (primary, 0x80, 0x80, 0xff, 0xff));
DFBCHECK (primary->DrawLine (primary,
0, screen_height / 2,
screen_width - 1, screen_height / 2));
DFBCHECK (primary->Flip (primary, NULL, 0));
sleep (5);
primary->Release( primary );
dfb->Release( dfb );
return 23;
}
*DirectFB/Core:单应用程序核心。2012-05-21 06:43
*直接/线程:已启动“VT切换器”3285[关键其他/其他0/0]
*直接/模块:抑制模块“操纵杆”
*直接/模块:抑制模块“键盘”
*直接/线程:已启动“Linux输入”-1[输入其他/其他0/0]
*DirectFB/输入:盖子开关1 0.1 DirectFB.org
*直接/线程:已启动“Linux输入”-1[输入其他/其他0/0]
*DirectFB/输入:电源按钮2 0.1 DirectFB.org
*直接/线程:已启动“Linux输入”-1[输入其他/其他0/0]
*DirectFB/输入:睡眠按钮3 0.1 DirectFB.org
*直接/线程:已启动“Linux输入”-1[输入其他/其他0/0]
*DirectFB/输入:电源按钮4 0.1 DirectFB.org
*直接/线程:已启动“Linux输入”-1[输入其他/其他0/0]
*DirectFB/Input:Apple Computer Apple Internal K 5 0.1 DirectFB.org
*直接/线程:已启动“Linux输入”-1[输入其他/其他0/0]
*DirectFB/Input:Apple Computer Apple Internal K 6 0.1 DirectFB.org
*直接/线程:已启动“Linux输入”-1[输入其他/其他0/0]
*DirectFB/Input:Logitech USB-PS/2光学鼠标7 0.1 DirectFB.org
*直接/线程:已启动“Linux输入”-1[输入其他/其他0/0]
*DirectFB/Input:appletouch 8 0.1 DirectFB.org
*直接/线程:已启动“Linux输入”-1[输入其他/其他0/0]
*DirectFB/Input:applesmc 9 0.1 DirectFB.org
*直接/线程:已启动“Linux输入”-1[输入其他/其他0/0]
*DirectFB/Input:10 0.1 DirectFB.org中的HDA Intel SPDIF
*直接/线程:已启动“Linux输入”-1[输入其他/其他0/0]
*DirectFB/Input:HDA Intel Line 11 0.1 DirectFB.org
*直接/线程:已启动“Linux输入”-1[输入其他/其他0/0]
*DirectFB/Input:HDA英特尔耳机12 0.1 DirectFB.org
*直接/线程:已启动“PS/2输入”-1[输入其他/其他0/0]
*DirectFB/Input:IMPS/2鼠标1 1.0 DirectFB.org
*直接/线程:已启动“PS/2输入”-1[输入其他/其他0/0]
*DirectFB/Input:IMPS/2鼠标2 1.0 DirectFB.org
*DirectFB/Genefx:检测到并启用了MMX
*DirectFB/Graphics:MMX软件光栅化器0.6 DirectFB.org
*DirectFB/Core/WM:默认为0.3 DirectFB.org
*FBDev/Surface:在偏移量0和间距5888处分配640x480 32位LUT8缓冲索引0
*FBDev/模式:设置640x480 LUT8
*FBDev/模式:切换到640x480虚拟640x480,8位LUT8,间距5888
dfbtest.c:
!!!*警告[应用程序在未取消DirectFB初始化的情况下退出!]*[../../../src/core/core.c:dfb\u core\u deinit\u check中的859]
任何关于如何进一步调试的想法都将不胜感激。我在Ubuntu12上运行这个。带有Radeon芯片的旧MacBook Pro。如果在控制台或X11下运行此操作,结果是相同的。屏幕闪烁,使帧缓冲区启动,但在此SetCollaborativeLevel调用中崩溃 这就是版本兼容性问题。标题包含在比链接的库更高版本的DirectFB中。通过链接DirectFB库的正确版本,解决了该问题 这是用户愚蠢的错误。显然,我或Ubuntu在某些系统库路径中有一个旧的DirectFB,它被链接,而不是更新的版本。当我使用-L选项为编译器添加正确的库路径时,它工作得很好。。。
~~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB 1.2.10 |~~~~~~~~~~~~~~~~~~~~~~~~~~
(c) 2001-2008 The world wide DirectFB Open Source Community
(c) 2000-2004 Convergence (integrated media) GmbH
----------------------------------------------------------------
(#) DirectFBError [dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)]: Invalid argument!