directfb를 이용하여 선그리기

refinestyle의 이미지

DirectFB를 이용하여 임베디드 시스템에 GUI를 구현하려고 합니다.
임베디드 시스템에 쓰기전에 PC에서 써보려고 DirectFB를 설치하고
DirectFB.org에 있는 tutorial코드를 끌어와 실행했습니다.
소스는 풀스크린으로 전환후 붉은색 대각선을 그리는 프로그램입니다.
컴파일 후 실행을 하니, 풀스크린으로는 전환이 되는데 선이 안그려 지네요..
휴.. 소스코드에 컴파일에러는 없군요. 프로그램 설치를 잘못했는건지, 아니면 다른것이 잘 못되었는건지.. 난감하군요..ㅡㅡ;;;
소스코드와 프로그램 실행중 나타나는 메제시를 밑에 남깁니다.

메세지:

[root@jo workspace]# gcc `pkg-config --cflags directfb` -o test Directfb.c `pkg-config --libs directfb` -g
[root@jo workspace]# ./test

---------------------- DirectFB v0.9.22 ---------------------
(c) 2000-2002 convergence integrated media GmbH
(c) 2002-2004 convergence GmbH
-----------------------------------------------------------

(*) DirectFB/Core: Single Application Core. (2005-04-04 12:32)
(*) Direct/Memcpy: Using MMXEXT optimized memcpy()
(*) Direct/Thread: Running 'VT Switcher' (CRITICAL, 6428)...
(*) Direct/Thread: Running 'PS/2 Input' (INPUT, 6451)...
(!!!) *** UNIMPLEMENTED [fusion_reactor_set_lock] *** [reactor.c:802]
(*) DirectFB/Input: IMPS/2 Mouse 1.0 (Convergence GmbH)
(*) Direct/Thread: Running 'Keyboard Input' (INPUT, 6452)...
(*) DirectFB/Input: Keyboard 0.9 (convergence integrated media GmbH)
(*) Direct/Thread: Running 'Linux Input' (INPUT, 6453)...
(*) DirectFB/Input: AT Translated Set 2 keyboard (1) 0.1 (convergence integrated media GmbH)
(*) Direct/Thread: Running 'Linux Input' (INPUT, 6454)...
(*) DirectFB/Input: PS/2 Generic Mouse (2) 0.1 (convergence integrated media GmbH)
(*) Direct/Thread: Running 'Linux Input' (INPUT, 6455)...
(*) DirectFB/Input: 055d:1030 (3) 0.1 (convergence integrated media GmbH)
(*) DirectFB/Genefx: MMX detected and enabled
(*) DirectFB/Graphics: MMX Software Rasterizer 0.6 (convergence integrated media GmbH)
(*) DirectFB/Core/WM: Default 0.2 (Convergence GmbH)
(!!!) *** WARNING [fbdev driver possibly buggy] *** [fbdev.c:1609 in dfb_fbdev_set_mode()]
(!!!) *** ONCE [unsupported destination format] *** [generic.c:5077 in gAcquire()]

소스코드

#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)
{
        DFBSurfaceDescription dsc;

        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));
        DFBCHECK(primary->FillRectangle(primary,0,0,screen_width,screen_height));
        DFBCHECK (primary->SetColor (primary, 0xff, 0x00, 0x00, 0xff));
        DFBCHECK (primary->DrawLine (primary,0,0, screen_width,screen_height ));

        DFBCHECK (primary->Flip (primary, NULL, 0));
        sleep (5);
        primary->Release( primary );
        dfb->Release( dfb );

        return 23;
}
웃는 남자의 이미지

(!!!) *** WARNING [fbdev driver possibly buggy] *** [fbdev.c:1609 in dfb_fbdev_set_mode()] 
(!!!) *** ONCE [unsupported destination format] *** [generic.c:5077 in gAcquire()]

DirectFB 가 VGA 하드웨어 특성을 많이 탑니다.
Matrox 이외에 카드에 대한 지원이 상당히 미약합니다.
DirectFB 를 만지면서 잘 안되길래 매트록스로 바꾸고 나니 잘 되더군요.
매트록스카드가 아니라면 교체해서 테스트해보세요.

커널설정에서 matrox framebuffer driver 를 집어넣어주고 해보세요.

----------------------------------------
Nothing left after Nirvana.

refinestyle의 이미지

휴,.... DirectFB를 쓰기위해서 그래피카드까지 바꿔야 된단 말인가.. ㅠ.ㅠ
어차피 2D만 쓰기때문에 메트록스써도 상관은 없지만, 돈나가잖아요.. ㅠ.ㅠ
역시.. 실력이 없으니 여러모로 고생이네요.... ㅠ.ㅠ ㅠ.ㅠ ㅠ.ㅠ

sozu의 이미지

http://www.directfb.org/docs/DirectFB_overview_V0.2.pdf

여기에 2.1 Access to the graphics hardware by DirectFB 에 가보시면

지원이 잘 않되는 칩셋은 VESA framebuffer 를 사용하면 된다고 합니다.

저도 예전에 vesa 로 해놓고 했던 기억이 나네요^^;

Quote:
You have to pass an initial video mode if you use vesafb. Add vga=788 to your /etc/lilo.conf (for 800x600 with 16bit)

-----------
청하가 제안하는 소프트웨어 엔지니어로써 재미있게 사는 법
http://sozu.tistory.com

refinestyle의 이미지

Quote:
[root@jo proc]# cat fb
0 VESA VGA

fb가 VESA로 잡혀있는데도 안되네요.. ㅠㅠ.ㅠ;;; 먼가 문제인지 모르겠네요.. ㅠ.ㅠ 참고로 그래픽카드는 지포스 입니다.

익명 사용자의 이미지

저도 비슷한 문제를 겪어봤습니다.
제생각에는 아래 두가지중 하나일것 같습니다. 특히 2번.
1. 선색이 배경색이랑 같다.
2. 선시작 위치가 surface끝부분이다. -> 선 시작 위치와 크기 한번 확인해보세요.

익명 사용자의 이미지

소스 확인해보니 선시작 위치는 제대로 하셨고 색상도 잇네요. 근데 투명도가 Max입니다. setcolor에서 마지막 매개변수 0x00으로 두시고 한번 해보세요.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.