Copyright
©
2006 Sony Computer Entertainment Inc.
Copyright ©
2006 Sony Corp.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".
DISCLAIMER
THIS
DOCUMENT IS
PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO
REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE
DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF
SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
TRADEMARKS OR OTHER RIGHTS.
COPYRIGHT HOLDERS
WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL
DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR
IMPLEMENTATION OF THE CONTENTS THEREOF.
This note explains howto setup programing environment, programing environment itself includng SPE programming and PS3 platform specific programming.
PPE programs can be developed and run in the same way as conventional programs on Linux. Readers of the document are supposed to have knowledge of application programming on conventional Linux, and are provided no descriptions about details of application programming, here. In general, packages such as GCC, G++ and GDB, are required to develop PPE programs in C and/or C++. Please refer manuals of Linux distribution which you use, for detail.
The following add-on packages are needed to be installed, to develop SPE programs in addition to the PPE programming environment.
After installing Linux distribution, install the add-on packages above by executing the following command:
# rpm -ivh *.rpm
The conventional development and runtime environment on Linux is used to develop and to run PPE programs. Readers of the document are supposed to have generic knowledge of application programming on such conventional Linux, and descriptions about details of application programming will not provided here.Please refer to manuals of the Linux distribution which you use, and/or published books, for details of application programming environment on Linux.
Fig. 1 shows overview of SPE runtime environment, including diagram consists of SPUFS from kernel, libspe2 and SPU newlib.
Fig.
1 Diagram of
SPE runtime environment
Linux kernel has equipped SPUFS for abstraction of SPEs, and application programs can handle SPEs by using libspe, which utilize the SPUFS internally. For SPE side, GCC and G++ are available as compilers, and newlib is provided as a standard C library.
The frame buffer on PS3 platform has been implemented as virtual frame buffer allocated on main memory. We’ll explain how it works and how user program could be control it, here.
Fig. 2 shows a whole picture of double buffering and VSYNC support with the frame buffer device.
Fig. 2 Virtual frame buffer and VSYNC timimg
Virtual frame buffer is allocated two sides, on main memory in Kernel space. User space application can use this frame buffer with mapping it to user space by mmap(). With mmap() against /dev/fb, User can map up to 2 buffers and choose two model. One is “single buffer”. With this model, user can map and draw to frame buffer just same as conventional frame buffer. The kernel daemon would take place flip hvc. The other is “double buffer” model, with it application need to take care to issue flip through ioctl by program itself, although it could achieve flicker-less drawing
Fig. 3 shows timing chart of hypervisor call, dma and irq with a single buffer scenario, inside Kernel.
Fig. 3 VFB behavior in the Linux kernel
The kernelkernel daemon “ps3fbd” implements single frame buffer model and controls its dma and flip using hvc.
Fig. 4 shows timing of IOCTL, hypervisor call, dma and irq with double buffer scenario.
Fig. 4 IOCTL usgae from the user Application
From the user applications, the frame buffer can be used with double buffering as following.
You can find the sample code as "vsync-sample" pacakge.
This sample code is a simple drawing program with frame buffer using double buffering.
---