forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Yellow Dog Linux 5.01 Kernel patch to add 3D support

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS3 Linux Development
View previous topic :: View next topic  
Author Message
hermes



Joined: 30 Mar 2004
Posts: 25
Location: Spain

PostPosted: Tue Dec 11, 2007 5:48 am    Post subject: Yellow Dog Linux 5.01 Kernel patch to add 3D support Reply with quote

Hi

I have done a script to install, patch and compile a custom kernel for the YDL 5.01 to add the devices to use libps3rsx , UDF 2.50, to resolve a problem with the Bluray unit when Linux start without one disc, etc.

It is very easy to use:

Code:

- Enter in Linux as root user

- Extract all files in a directory

- Copy the file kernel-source-2.6.16-20070425.ydl.3.ppc64.rpm in the same directory from
Yellow Dog Linux 5.01 DVD (from /YellowDog/RPMS directory)

- Run the install script from the console using: ./install_kernel

- Wait a time to finish

- When it finish, you have a new 2.6.16-20070425.ydl.3custom kernel

- Edit kboot.conf file from /etc/ directory

- Add this lines to the end of file:

ydlcustom='/dev/sda1:/vmlinux-2.6.16-20070425.ydl.3custom initrd=/dev/sda1:/initrd-2.6.16-20070425.ydl.3custom.img root=/dev/sda2 init=/sbin/init video=ps3fb:mode:3 rhgb'

- Remember to change ps3fb:mode:3 to your custom video mode (3 is for 1280x720P 60 Hz non fullscreen)

- If you want, change the string 'default=ydl' to 'default=ydlcustom' to autorun this kernel from kboot:

- You can run too this kernel writing 'ydlcustom' from kboot console

- You can run the old kernel writing 'ydl' (you can use this method to safe if the new kernel fail)

- When restart Linux, on root mode,  you can see in the /dev/ directory 3 news devices: ps3gpu_vram, ps3gpu_fifo and ps3gpu_ctrl. This devices requires root perms, so you need to change it to use in user mode.

For example, edit /etc/rc.local and put this lines:

chmod 766 /dev/ps3gpu_vram
chmod 766 /dev/ps3gpu_fifo
chmod 766 /dev/ps3gpu_ctrl

Also is possible to use an alternative method using /dev/fb0 to map the memory (see demo3d_alternative code, files util.c, line 112 and util.l line 62). It is valid for user mode too.



It is based in part of the work of Glaurung and IronPeter to do a ps3fb driver for the 2.6.16 kernel using some partially patch information and the libps3rsx method.

i have included a little 3D example with libps3rsx too, slightly modified to include some info and one alternative form to get the memory areas form /dev/fb0

Also i include two ioctl functions, one to call lv1_gpu_context_attribute function (same method i see in a patch of Glaurung), and other to flip the screen (to use double buffer)

For example, to 'reset' the FIFO position i use this method:

Code:

uint32_t *ctrl = gpu->ctrl.virt;
uint32_t fifo_base;
struct ps3fb_ioctl_gpu_attr a;
fifo_base =ctrl[0x10] & ~(gpu->fifo.len - 1);

a.attr=1;
a.p0=fifo_base;
a.p1=fifo_base;
a.p2=0;
a.p3=0;
ioctl(fb_fd, PS3FB_IOCTL_GPU_ATTR, &a);


So, i put always the FIFO datas from offset 0


To flip the screen, you send a param with the VRAM offset :

Code:

#define PS3FB_IOCTL_GPU_FLIP      _IOW('r', 10, int)   /* flip the buffers */ <- defined in util.h

if(!val) offset=width*height*4; else offset=0;
ioctl(fb_fd, PS3FB_IOCTL_GPU_FLIP, &offset); // flip the screen



It can use ps3gpu_vram, ps3gpu_fifo and ps3gpu_ctrl devices to asign the memory areas on libps3rsx, but i have an alternative method to use only a device too:

Code:

from /dev/fb0

 mem=mmap(0, res->len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset);

offset =          0 -> mem= XRAM
offset = 0x10000000 -> mem= VRAM
offset = 0x20000000 -> mem= FIFO
offset = 0x30000000 -> mem= CTRL


I think it is an easy method to map the memory, without problems with the user perms under Linux.

To compile the kernel maybe you need to disable the PS3 screen saver to avoid the hang of the system, but i don't remember any problem compiling it from a virtual console under Gnome.

In any way, if you are using YDL 5.01 and you use the same .rpm file, it compile without problems (except if you need free space in your hdd)

i hope you understand my post (i am spanish and the English language is a little problem for me :) )

The download link:

http://mods.elotrolado.net/~hermes/ps3/kernel_update-YellowDog5.01-with-3D-support.tar.gz
Back to top
View user's profile Send private message
billb



Joined: 12 Dec 2007
Posts: 32

PostPosted: Wed Dec 12, 2007 6:03 am    Post subject: Reply with quote

Works great! Thanks.
Back to top
View user's profile Send private message
MeeM



Joined: 13 Dec 2007
Posts: 1

PostPosted: Thu Dec 13, 2007 4:21 am    Post subject: Isn't working Reply with quote

Hey guys can you help me, this isn't working on my PS3
Here is that what happens, when i Run it:
Code:

Starting ...
find: /usr/src/linux-2.6.16-20070425.ydl.3: Datei oder Verzeichnis nicht gefunden
Kernel Source Install ...
Warnung: kernel-source-2.6.16-20070425.ydl.3.ppc64.rpm: Header V3 DSA-Signatur: NOKEY, key ID aeb6b9c4
Vorbereiten...              ########################################### [100%]
   1:kernel-source          ########################################### [100%]
Copying ps3fb.c ...
cp: reguläre Datei „/usr/src/linux-2.6.16-20070425.ydl.3/drivers/video/ps3fb.c“ kann nicht angelegt werden: Datei oder Verzeichnis nicht gefunden
Error copying ps3fb.c
[root@localhost kernel_custom]#


Any idea?
Back to top
View user's profile Send private message MSN Messenger
myke666



Joined: 13 Dec 2007
Posts: 1

PostPosted: Thu Dec 13, 2007 10:02 am    Post subject: yo Reply with quote

i ve got the same bug because i canfnd the good rpm source : 2.6.22 instead of 2.6.16 ...
Partial solution :
go to /usr/src/
you'll find this folder : linux-2.6.22-0.ydl.rc4
make a copy and rename it : linux-2.6.16-20070425.ydl.3
launch again and it will work...
But it will ask you 46406466416.97+5 questions to compile the kernel, and for the moment, i haven't found the good combinaison to compile correctly the kernel with the last sources....

The rpm sources of 2.6.16 is only available on old ydl dvd isos...
So .... WE'RE DOOMED !!!!!
WE'LL NEVER SEE SOMETHING WORKING IN 3D ON OUR PS3 ... !!!?!
Or it's because i'm a french noob on linux for ps3?! ...

hum well ... hermes .... please ...
can you put the rpm somewhere ?
thanks by advance...

MyKe
Back to top
View user's profile Send private message
hermes



Joined: 30 Mar 2004
Posts: 25
Location: Spain

PostPosted: Thu Dec 13, 2007 10:49 am    Post subject: Reply with quote

Hi.

You can download the old ISO and extract it... but I include the ps3fb.c file (instead of a patch) to do easy the portability to others kernels (2.6.16 kernel is very different and because it , i have done this patch).

I think if you compile the old kernel it don't work well
Back to top
View user's profile Send private message
billb



Joined: 12 Dec 2007
Posts: 32

PostPosted: Thu Dec 13, 2007 1:29 pm    Post subject: Reply with quote

I'm running on the custom kernel:
Code:
#  uname -a
#  Linux localhost.localdomain 2.6.16-20070425.ydl.3custom #1 SMP Tue Dec 11 19:34:45 MST 2007 ppc64 ppc64 ppc64 GNU/Linux


And I'm able to run the demo as root:
Code:
[root@localhost demo3d]# ./demo3d.elf
video mode 3
vram 264241152 fifo 65536 ctrl 4096
mmap: /dev/fb0 len 16777216
mmap: /dev/ps3gpu_vram len 264241152
mmap: /dev/ps3gpu_fifo len 65536
mmap: /dev/ps3gpu_ctrl len 4096


But should I be installing the ps3rsx and x driver as described here?

I can make and load the ps3rsx module:

Code:
#  dmesg
...
ps3rsx: PS3 RSX access module, 1.0.0
ps3rsx: reserved XDR memory is @c000000000500000, len 18874368
ps3rsx: 254MB of DDR video ram at 0x7001e0000000 mapped at d0000800900af000 handle 5a5a5a5b
ps3rsx: context 0x55555554 dma=440000421000 driver=4000001f4000 reports=480000810000 reports_size=10000
ps3rsx: ctrl=d00008009feaf000 drv=d00008009feb0000 reports=d00008009fed0000
ps3rsx: version 2.11 RSX rev12 0MB RAM channel 1 core 500MHz mem 650MHz
ps3rsx: remapped XDR apperture at c000000000500000 size 18432kB to RSX


And I can build xf86-video-ps3 after updating xorg-x11-server-sdk using a package from FC6: xorg-x11-server-sdk-1.1.1-47.8.fc6.ppc.rpm.

But when I tried to use the driver in /etc/X11/xorg.conf, my Xorg.0.log said:

Code:
(II) LoadModule: "ps3"
(II) Loading /usr/lib/xorg/modules/drivers/ps3_drv.so
(II) Module ps3: vendor="X.Org Foundation"
        compiled for 7.1.1, module version = 0.3.1
        ABI class: X.Org Video Driver, version 1.0
(EE) module ABI major version (1) doesn't match the server's version (0)
(II) UnloadModule: "ps3"
(II) Unloading /usr/lib/xorg/modules/drivers/ps3_drv.so
(EE) Failed to load module "ps3" (module requirement mismatch, 0)


Err... help?
Back to top
View user's profile Send private message
hermes



Joined: 30 Mar 2004
Posts: 25
Location: Spain

PostPosted: Sun Dec 16, 2007 5:06 am    Post subject: Reply with quote

It is easy: you are using a Xorg-server with version different to the ps3 driver and it fail.

you need to compile and older xf86 code merged with the ps3 code to work or you need to compile a new xorg-server code with the correct version for the xf86 code (but i don´t have any idea about the steps to do it)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS3 Linux Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group