From: 刘小双 <liuxs226@gmail.com>
To: linuxppc-embedded@ozlabs.org
Subject: segment fault problem
Date: Sun, 30 Mar 2008 17:34:30 +0800 [thread overview]
Message-ID: <e81b2fb40803300234v759dbd6cv914421d2934be9f5@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 516 bytes --]
hi, all
My platform is mpc8540 with graphics chip Fujitsu MB86296, my kernel version
is 2.6.12.6. I compiled DirectFB with gfxdriver mb86296, I wrote this
gfxdriver myself. Then I run a program named "simple" in
DFBTutorials-0.5.0which I downloaded from
directfb.org website. I want to see if the gfxdriver worked well. When I run
./simple there is a segment fault problem, and I don't how to fix it.
The attachment mb86296 is the gfxdriver.
The attachment simple.c is part of DFBTutorials-0.5.0.
Thanks
liuxs
[-- Attachment #1.2: Type: text/html, Size: 897 bytes --]
[-- Attachment #2: simple.c --]
[-- Type: text/plain, Size: 5305 bytes --]
/*
DirectFB Tutorials
(c) Copyright 2000-2002 convergence integrated media GmbH.
(c) Copyright 2002 convergence GmbH.
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Hundt <andi@fischlustig.de> and
Sven Neumann <neo@directfb.org>.
This file is subject to the terms and conditions of the MIT License:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* simple.c
*
* Simple fullscreen application that draws a horizontal line
*/
#include <stdio.h>
#include <unistd.h>
#include <directfb.h>
/*
* This is the super interface, it's the entry point to all functionality.
*/
static IDirectFB *dfb = NULL;
/*
* The primary surface, i.e. the "screen".
* In cooperative level DFSCL_FULLSCREEN it's the surface of the primary layer.
*/
static IDirectFBSurface *primary = NULL;
/*
* Store the width and height of the primary surface here to support all resolutions.
*/
static int screen_width = 0;
static int screen_height = 0;
/*
* An error checking macro for a call to DirectFB.
* It is suitable for very simple apllications or tutorials.
* In more sophisticated applications this general error checking should not be used.
*/
#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)
{
/*
* A surface description is needed to create a surface.
*/
DFBSurfaceDescription dsc;
/*
* Initialize DirectFB passing argc and argv
* to support the standard DirectFB command line options.
*
* DirectFB command line options will be stripped out automatically.
*/
DFBCHECK (DirectFBInit (&argc, &argv));
printf("simple.c DirectFBInit() is called\n");
/*
* Create the super interface.
*/
DFBCHECK (DirectFBCreate (&dfb));
printf("simple.c DirectFBCreate() is called\n");
/*
* We want to go fullscreen,
* the primary surface will be exclusive access to the surface of the primary layer.
*
* If you disable this call a window will be created implicitly,
* no further changes needed, flipping the surface updates the window.
*/
DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
/*
* 1. Specify which fields of the struct are set.
* 2. Fill out fields,
* in this example we want to have a flippable primary surface.
*/
dsc.flags = DSDESC_CAPS;
dsc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
/*
* Create the primary surface by passing our surface description.
*/
DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
printf("simple.c CreateSurface() is called \n");
/*
* We have exclusive access to the primary layer's surface now,
* get the width and height of the surface, i.e. the screen resolution.
*/
DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));
/*
* Clear the screen by filling a rectangle with the size of the surface.
* Default color is black, default drawing flags are DSDRAW_NOFX.
*/
DFBCHECK (primary->FillRectangle (primary, 0, 0, screen_width, screen_height));
/*
* Draw a horizontal line in the middle of the screen.
* Current color is black, so we have to set another one before.
*/
DFBCHECK (primary->SetColor (primary, 0x80, 0x80, 0xff, 0xff));
DFBCHECK (primary->DrawLine (primary,
0, screen_height / 2,
screen_width - 1, screen_height / 2));
/*
* Now flip the whole surface to make things visible.
*/
DFBCHECK (primary->Flip (primary, NULL, 0));
/*
* Wait a bit to see the result before exiting the example application.
*/
sleep (5);
/*
* Cleanup in a stack like style.
*/
primary->Release( primary );
dfb->Release( dfb );
return 23;
}
[-- Attachment #3: mb86296.rar --]
[-- Type: application/octet-stream, Size: 61566 bytes --]
reply other threads:[~2008-03-30 9:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e81b2fb40803300234v759dbd6cv914421d2934be9f5@mail.gmail.com \
--to=liuxs226@gmail.com \
--cc=linuxppc-embedded@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).