:肥雀寒: 果然,相對于xo,ps3的diy可行性貌似大很多....
关于qyqgpower的质疑,找了一点PS3 LINUX上的Programming with Frame Buffer的文档
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.
Virtual Frame Buffer and VSYNC
Fig. 2 shows a whole picture of double buffering and VSYNC support with the frame buffer device.
http://bbs.hlgnet.com/upload/bbsupfile/2006-11-29/20061129150625_9.gif
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
Single Buffer Model
Fig. 3 shows timing chart of hypervisor call, dma and irq with a single buffer scenario, inside Kernel.
http://bbs.hlgnet.com/upload/bbsupfile/2006-11-29/20061129150634_18.gif
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.
1. In the GPU side flip is done at vsync timing and after finishing it, the interrupt is issued to the kernel. Handling the interrupt, the kernel daemon requests dma via hyper visor and the data in the frame buffer on main memory is transferred to the GPU. This hvc is blocking call.
2. The daemon calls non-blocking FLIP request via hyper visor. At the next vsync timing, flip will be done in the GPU side.
3. Return to 1.
Double Buffer Model
Fig. 4 shows timing of IOCTL, hypervisor call, dma and irq with double buffer scenario.
http://bbs.hlgnet.com/upload/bbsupfile/2006-11-29/20061129150641_97.gif
Fig. 4 IOCTL usgae from the user Application
From the user applications, the frame buffer can be used with double buffering as following.
1. Get a screen size and number of frame buffers by ioctl PS3FB_IOCTL_SCREENINFO.
2. Stop the “ps3fbd” which performs flip in the kernel by ioctl PS3FB_IOCTL_ON. Then flip will be controllable from the user space.
3. Wait the next vsync by blocking ioctl FBIO_WAITFORVSYNC.
4. After the vsync, call blocking ioctl PS3FB_IOCTL_FSEL with frame buffer number in user space. This number indicates which frame buffer will be used at the next flip. After calling the ioctl, the data in the frame buffer is transferred with dma and flip request is issued in the kernel.
5. Return to 3.
6. Call the ioctl PS3FB_IOCTL_OFF at the end of the applications.
Sample Code
You can find the sample code as "vsync-sample" pacakge.
This sample code is a simple drawing program with frame buffer using double buffering.
How to compile
To build binaries, simple use make as follwos.
% make clean; make
How to run
Before running the sample code, get root privilage which /dev/fb0 operations require.
Sample 1 - shows "moving line" with double buffering.
# vsync 1
Sample 2 - shows "moving line" with single buffering.
# vsync 2
Sample 3 - red and blue screen by turns with double buffering
# vsync 3
What it shows
The code shows how to use ioctl for frame buffer with double buffering. Brief description is as follows. Please check the source code "vsync.c" for more details.
After opening /dev/fb0 and get handle, you can use ioctl for frame buffer in the kernel via /dev/fb0. Check the size of the frame buffer by ioctl and map it to the user space. After writing data to the buffer in the user space, issue ioctl PS3FB_IOCTL_FSEL and then the data will be displayed at the next vsync timing. You can get this timing by blocking ioctl FBIO_WAITFORVSYNC, after returning the ioctl you can reuse the buffer. Fig. 4 shows ioctl and flip timing, please see it for more details. Don't forget to call PS3FB_IOCTL_OFF at the end of your application, or frame buffer in the kernel remains blank.
Note
You can also use console ioctl to switch text/graphics mode. Please check man pages for console_ioctl.
[
本帖最后由 藕是张力 于 2006-11-29 15:09 编辑 ]
你找这只能证明我的说法是正确的,我早就说过是从主内存划出一部分作为虚拟FB(YDL不知道划了多少,FC5默认是32MB),根本没有任何效率可言,就算SD的wmv播放起来都很难维持vsync,GDDR3的显存是一点都没得用的:企鹅捶地:
而且这样的做法更让PS3的主内存捉襟见肘
不开放RSX的理由我猜测了一个:
开放对显存的direct access的话,BD源里decode后的frame在到达HDMI的HDCP之前就可以被截取下来,那么版权保护上就要出很大的问题,任何对BD影片的保护岂不都化为泡影了
XP里怎么防止这个发生我不清楚,Vista在这方面的DRM可是做了很大的功夫的
[ 本帖最后由 qyqgpower 于 2006-11-29 16:24 编辑 ]