Sponsored Links

Sponsored Links

Rumor: PS3 RSX Driver in Development, May Arrive Soon


Sponsored Links
233w ago - Update: Disane has also now [Register or Login to view links] a guide (below) on coding on the PS3 (GNU Tool-chain and CodeLite 2).

As recently hinted, a PS3 RSX driver is rumored to be in development and may arrive soon.

For those who are unfamiliar with it, you can check out PlayStation 3's RAM and RSX Explained as a start.

To recap briefly: In 2007, Glaurung and IronPeter hunted for 3D graphics access from homebrew/Linux (Other OS) on the PS3.

CNLohr shared a video of PS3 GPU Use in Linux, followed by a second video courtesy of fartist demonstrating PS3 RSX access.

In PS3 Firmware update 2.10 Sony blocked a potential RSX exploit that allowed full GPU access on the PS3.

This brings us to today, where Disane has posted a compilation of excerpts from [Register or Login to view links] on the PS3 RSX along with news of a rumored PlayStation 3 RSX driver in development.

To quote, in part: "As GeoHot said so "I couldn't find a single thing that gives Linux less privilege than GameOS". So it wasn't clear until now what exactly was blocked by the Hypervisor.

I met a member of team nouveau on IRC named Lb1 and we began to talk about the Hypervisor of the PS3 and what does it do (mostly what it blocks and what it allows and what benefits does the GeoHot hack has that could be used to port nouveau to PS3 Linux).

Well, since my knowledge wasn't enough on GPU terms, I asked him to speak with GeoHot.

Lb1 began to talk about how the nVidia video cards work. He mentioned that they were unable to make the system create a NV40 3D GPU object. In user space we are unable to use the NV40 3D GPU object which has the object class 0x00004097 (nVidia Chip version and 3D engine) also known as NV40TCL or NV40_CURIVE_PRIMITIVE.

Here's what Lb1 said about the 3D context loading: "Basically there is a table called RAMHT. Which is a Hash Table with handles and channel numbers as keys and instance offsets as values to create the 3d object, and entry must be inserted here with an arbitrary handle, and pointing to a small region of memory on the card that must have the correct value".

Today Sony has released an update that took out OtherOS support from the FAT systems. This prevents people from developing and running homebrew software on their units.

The update is optional but if someone decides not to update then he won't be able to access PSN. Which means some games won't even work! Well, thanks a lot Sony an RSX driver couldn't come at a better time."

Coding on the PS3 - Setting up the GNU tool-chain in CodeLite 2:

As you may know I've been away for a while trying to find a working IDE (Integrated Development Environment) for the PS3-Linux. That performs as good as any other lightweight IDE on Windows-PC. Since the PS3 has such fewer memory only a handful of IDEs are capable of running on the PS3 with good performance.

Under performance I mean the time it takes to open up a window, browse the options menu, loading time, response time, etc. Apart from speed I also wanted to find an IDE which can be fully modified to work with GNU Tool-chain Sony designed and made available on the PS3-Linux and other Cell Platforms.

So far I tried 3 IDEs which were Code::Blocks (is a bit slower than CodeLite and less configurable, also very unresponsive) Eclipse (which takes a lot of time to load up, unresponsive and it requires a lot of extra configuration, its a horrible choice to install on the PS3) and finally CodeLite 2 (this is not an advertisement of course, CodeLite 2 is very easy to use and easy to configure to work with the GNU compilers).

I used Ubuntu 9.10 but I think CodeLite 2 would work on any Linux that supports PowerPC64 architecture (which the PS3 supports).

Let's start with a FAQ, shall we:

"Why did you write this tutorial? Why should I bother reading it?"

Sony took out OtherOS a month ago and forced people to upgrade their systems. People had to upgrade to be able to use their PS3s for games and to access PSN. Now, I know some of you are stuck on ver. 3.15 and waiting for the glorious days of homebrew to come. If you're the person I'm talking about then this tutorial is for you.

This tutorial gives you a bit of insight on how homebrew can be made on the PS3 (PS3 homebrew mad with the PS3, now which other console allowed that in the past?). The experience and knowledge you gain here can also benefit you when we can finally run unsigned code on GameOS.

"What kind of applications can we write on the PS3?"

We can write any kind of application on the PS3-Linux even games (Which Sony really doesn't like to hear, no wonder they've taken out Linux before anyone could make a graphics accelerator for the PS3-Linux.) or user applications. Many tools and libraries were ported on PowerPC64 in the recent time (the 64 bit architectures are taking over, we can't really do anything about this ).

There's also a chance that we can run our code on the XMB (VSH) side of the PS3 some day. You can't really start homebrew development too early . A tutorial came out a few days ago on how to run XBMC on the PS3. But it runs damn slow. Well you could be the one who could utilize the SPUs to gain some speed and make it run faster. You never know unless you try

"But you can install the cell simulator on the PC why would you bother with coding on the PS3?"

Well, this is all true, you can install the Cell System Simulator and work on that. But it requires Linux installed on your PC. Also in some cases the user doesn't have the luxury to have another computer at home or when he's/she's traveling a lot and can only carry one computer (or a console in our case).

There are some other benefits you can gain by coding directly on your PS3. You don't have to configure a system simulator, you can directly run and debug your code on the target platform and see how the hardware reacts.

Alright, let's see what do we need in order to get started:

• a PS3 with Linux installed (as I mentioned I used Ubuntu ver. 9.10 codename Karmic)
• able to access the Internet on your PS3-Linux
• mouse and keyboard (the PS3 supports all kinds of keyboards and mice)
• Cell SDK (I'll show you how to install it and configure your development environment so don't panic),WxWidgets 2.8+,libcurl (which you can get by installing "gnome-core-devel build-essential", again don't panic I'll reveal the process to you).
• the source code of Codelite 2.5.2 (build 4031), which you can find here: http://sourceforge.net/projects/codelite/files/Releases/codelite-2.5/codelite-2.5.2.4031.tar.gz/download
• and my tutorial of course

Let's jump with both feet:

I assume you have completed the first 3 requirements I mentioned above. The steps we are going to take below are going to take a while (not because we are going to do so many things, it's because the System is very slow ) you could read some C/C++ tutorials or the Cell-Programming-Primer while your waiting for some of the tasks to complete or do anything else if your already familiar with C/C++ and the Cell/BE.

1. Opening the Terminal: Applications -> Accessories -> Terminal. If you want to, you can customize your Terminal to make it more appealing to you, cause we are going to spend most of our time using this. For example: I managed to make a matrix theme which reminded me on the 90's DOS using full screen can also help you feel more comfortable.

2. So let's start by installing the Cell SDK:

sudo apt-get install cell-sdk

In here, we need to type in our user password to allow the installation. Let's accept the installation with 'y' and then wait for the system to download and install the packages for us.

3. in order to install SPU-Binutils type in the following:

sudo apt-get install spu-binutils

Again, allow everything so we can proceed with the installation.

4. We also need to install the GTK+, WxWidgets libraries and the rest of the libraries we need in order to compile CodeLite 2. So here's how we proceed:

sudo apt-get install gnome-core-devel build-essential

5. Let's check the compilers we have installed and the ones we already had. Start with GCC (GNU C compiler):

gcc -v

This way we can check the version number of our compiler and some other information (where it accesses our Include and Library files.)
For example it gave me the following after I exexuted the CLI code above:

Using built-in specs.
Target: powerpc-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.1-4ubuntu9' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-softfloat --enable-secureplt --enable-targets=powerpc-linux,powerpc64-linux --with-cpu=default32 --disable-werror --with-long-double-128 --enable-checking=release --build=powerpc-linux-gnu --host=powerpc-linux-gnu --target=powerpc-linux-gnu
Thread model: posix gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9)

We also might want to check the following compilers:

g++ -v
ppu-gcc -v
ppu-g++ -v
spu-gcc -v
spu-g++ -v

gcc and g++ are used for compiling PowerPC 32 bit C/C++ code, while ppu-gcc and ppu-g++ are used for compiling PowerPC 64 bit C/C++ code. We also have our SPU (Synergistic Processor Unit) compilers spu-gcc and spu-g++.

6. Now, that we have the SDK installed and we checked if every thing's fine with the compilers let's move on to setting up our development environment. I ran into some problems which gave me this error:

libstdc++.so.6: cannot open file: no such file

When I was trying to compile PPC64 code. We can easily fix this by typing in the following CLI code:

export LD_LIBRARY_PATH=/usr/lib/gcc/ppu/4.1.1

The problem is that this will only solve our problem for one occasion and we need to retype it again when we reboot the system. We can fix this by modifying our bash profile:

sudo nano ~/.bash_profile

We find ourselves in the NANO text editor (if you don't like it then you can use gedit or any other text editor you like).

The document we opened will probably be empty and we only need to add the following line (if not then just add the text to the bottom of the existing lines):

export LD_LIBRARY_PATH=/usr/lib/gcc/ppu/4.1.1

Our text should look something like this in NANO (remember not to delete any text that was already in the file, this picture shows only an example):

After we've entered the text, let's check if every thing's fine and then press CTRL+O key combination to save the file and then press Enter to accept the changes. After that press CTRL+X to exit from NANO. There's another file we need to modify in order to get what we want. Type in:

sudo nano ~/.bashrc

To open up .bashrc. This file wont be empty for sure. So just press the Down button until you reach the bottom of the entries and add the following line:

export LD_LIBRARY_PATH=/usr/lib/gcc/ppu/4.1.1

Save and exit NANO the same way as you did above. Now we can compile PPC64 code in our Terminal anytime we want.

Mounting SPUFS:

This is a problem I ran into when I was trying to compile SPU code. The error it produces when compiling code with spu-gcc or spu-g++ looks something like this:

spu_create(): Function not implemented
spe_context_create: Bad address

Fixing this problem is easy though. Let's check what's mounted so far with the following CLI code:

mount

If we don't get something similar:

none on /spu type spufs (rw,gid=1000)

Then that means that the SPUFS is not mounted and we need to fix this. Start by editing the fstab:

sudo gedit /etc/fstab

or

sudo nano /etc/fstab

Then we add the following lines below the already existing ones:

# Cell specific for the PS3:
none /spu spufs gid=spu 0 0

Save the modified file and exit from your chosen text editor.
Let's mount the SPUFS:

mount /spu

and check if its mounted:

mount

or

mount -a

7. Our Seventh step will be downloading, compiling and installing CodeLite 2. There's also an older version of CodeLite 1 somewhere on the Ubuntu Software Base. I couldn't find the never version which was already compiled so I decided to compile it on my PS3 (it took a while, and it will take a while for you as well). If anyone can make a proper package and upload it on Ubuntu's software base then please do so and pm me so I can update this tutorial:

Let's use some kind of Web Browser (I recommend FireFox although it eats up too much memory but that's my opinion.) and navigate to http://sourceforge.net/projects/codelite/files/Releases/codelite-2.5/codelite-2.5.2.4031.tar.gz/download

Let's download our file to /home/user_name/Downloads (where user_name is your user name). In order to extract the source files let's type in the following lines into the Terminal:

cd ~/Downloads/
tar xzvf codelite-2.5.2.4031.tar.gz
cd codelite-2.5.2.4031/

8. Configuring and compiling then registering our application is the next step:

./configure

This will run the shell scrip which produces the make files we need to execute in order to install the application. Once this is done type in:

make

This is a screenshot I made with VNC while compiling CodeLite 2:

This is going to take a while but once It's been done we can type in:

sudo checkinstall

or if it fails then just type in:

sudo make install

CodeLite 2 is finally installed.

Starting up CodeLite 2 and configuring it.

Let's start by starting up CodeLite 2. If everything gone well then you should have it's icon on your desktop. You can also find the shortcut in Applications-> Programming -> CodeLite.

After the welcome screen appears we find our selves in the Workspace Setup screen. Here we need to type in the name of the workspace and it's location and also show the IDE where are the Include and Library files are located. These are located in:

/usr/include//usr/lib/

After we have input the important information let's just accept everything and wait for CodeLite to finish configuring it self (this can also take a while).

After the configuration is finished we find our selves at the CodeLite 2 home page:

This is not the manual for CodeLite so I won't go trough all the menus, options and settings here. I'm only going to show you how to set it up in order to compile and run PPC64 and SPU code.

Setting up the GNU tool-chain for the Cell/BE in CodeLite:

Navigate to Settings -> Build Settings. Click on the New button to create a new compiler and type in ppu-g++ (without the quotes). Then again click on New and then type in the following name: spu-g++. Here's some visual help on how to setup our newly created compilers:

Here we setup the compilers we want CodeLite to call when we are compiling our source codes.

Here we setup the output files and their extension and also show the Global Paths to our Include and Library files. We need to do the same to our spu-g++ only this time instead of ppu-g++ we need to type in spu-g++

Other settings like Compiler Options and Linker Options we can leave empty for now we won't be using them in this tutorial. But if you want to set them up then use the gnu-g++ compiler's settings as a reference. spu-g++ and ppu-g++ compilers are both part of the GNU tool-chain so their options are mostly the same.

Creating a PPU Hello World application.

Now that we have configured the IDE to support our compilers let's check if they're working properly. First thing we want to do is create a folder for our hello_ppu project. We can do this by using the following CLI code in the Terminal:

cd ~/.codelite/
mkdir hello_ppu

or we can skip this step and create it when we are creating our new project. Let's see how it's done:

Workspace -> Create New Project. We should get something like this below:

Let's see step by step what needs to be done:

Categories -> Console
Templates -> Simple Executable (g++)
Compiler type -> ppu-g++
(dont forget to create a folder for your project in ~/.codelite/ if you haven't done that already)
Project Name -> hello_ppu (our executable will have the same name).
Click OK.

You might want to close the window below the code field use the CTRL+ALT+O key combinations. If you look at the Workspace View window on the left side of your CodeLite window you will see a blue hello_ppu folder inside that folder you can find the src folder and inside that src folder you can find main.cpp. Double click on this file to open it up. You should see the following C source code:

#include

int main(int argc, char **argv)
{
printf("hello worldn");
return 0;
}

Click on Build -> Build and Run Project (or use the shortcut keys CTRL+F9) in order to compile the source code for our simple hello world program. If you get the following text (error):

libstdc++.so.6: cannot open file: no such file

then go to Settings -> Enviroment Variables and insert the following line below or above the already existing one(s):

LD_LIBRARY_PATH=/usr/lib/gcc/ppu/4.1.1

then try running your code again (CTRL+F5).

Creating a SPU Hello World application.

Let's close our current workspace by clicking on Workspace -> Close Workspace. Let's create a new project

Workspace -> Create New Project.
Our settings are as follows:
Categories -> Console
Templates -> Simple Executable (g++)
compiler type -> spu-g++
(we should also create a new folder for our hello_spu project in ~/.codelite/ also don't forget to give a name for our project, name it hello_spu.Click OK.

Open up main.cpp and modify the code to the following:

#include

int main(unsigned long long spe, unsigned long long argp, unsigned long long envp)
{
printf("hello worldn");
return 0;
}

Now, we can compile and run our code (CTRL+F9) and we get the same window we had when we executed our code on the PPU. If we had left the code as it was then the compiler would've not produce any executable, which isn't good.

We need to understand that SPU code is a little bit different then PPU code, you can't just execute it like any code. The PPU needs to find a suitable SPU to load the code into. But how do we know which SPU was selected by the PPU? Let's print it out the number of our SPU using the spe variable. Modify the code to look more like this:

#include

int main(unsigned long long spe, unsigned long long argp, unsigned long long envp)
{
printf("SPU number: %d says Hello!n",spe);

return 0;
}

If we compile our code then we run into an error again... :

main.cpp:5: undefined reference to `__nldbl_printf'

(no wonder why this tutorial was wrote, imagine your self fighting with these bugs alone ) We can get rid of this problem for the time being by asking the IDE to compile this code differently and by not using the make file (you can also make a different make command for it but I just couldn't figure it out how, if someone finds out how to do it, then pm me so i can update this tutorial).

So click on Workspace -> Open Active Project Settings or use the shortcut key combination: ALT+F7. Click on the Custom Build tab and then check the Enable Custom Build box. Then double click on the white space next to Build. The following line goes here:

spu-g++ -v main.cpp -o ./$(IntermediateDirectory)/$(ProjectName)

To check if you did everything OK, here's a screenshot:

Then click OK and compile and run your code:

Again, if anyone finds a suitable method to compile this code with make then pm me. This code compiles fine if you use CLI.

Loading SPU code using PPU code.

Close your previous project and create a new one. Let's use the settings we did in the first project (hello_ppu). Create a new folder for our project in ~/.codelite and name it load_hello_spu. Don't forget to name your project as well.Click OK.

The following code comes from the Cell-Programming-Primer document which is a very nice source to start programming for the Cell/BE. I recommend it to anyone who would like to develop applications for the Cell/BE. So, our main.cpp will look like this:

#include
#include
#include

int main(int argc, char **argv)
{
int ret;
spe_context_ptr_t spe;
spe_program_handle_t *prog;
unsigned int entry;
spe_stop_info_t stop_info;
prog = spe_image_open("hello_spu");

if (!prog){
perror("spe_image_open");
exit(1);
}

spe = spe_context_create(0, NULL);
if (!spe) {
perror("spe_context_create");
exit(1);
}

ret = spe_program_load(spe, prog);
if (ret) {
perror("spe_program_load");
exit(1);
}

entry = SPE_DEFAULT_ENTRY;
ret = spe_context_run(spe, &entry, 0, NULL, NULL, &stop_info);

if (ret < 0) {
perror("spe_context_run");
exit(1);
}

ret = spe_context_destroy(spe);
if (ret) {
perror("spe_context_destroy");
exit(1);
}

ret = spe_image_close(prog);
  if (ret) {
perror("spe_image_close");
   exit(1);
}

return 0;
}

The code above is a simple SPU code loader which doesn't use isolation to load your unsigned code . Click on the Workspace -> Open Active Project Settings then click on the Linker tab. Our Library Path should point to /usr/lib/ and the Library we need to add is libspe2.a. Click OK.

If we happen to compile and run our code then we are going to bump into the following error:

spe_image_open: No such file or directory

To get rid of this problem we need to copy the SPU code into the same directory where the loader's binary is. We can open up the file browser and quickly drag hello_spu from ~/.codelite/hello_spu/Debug into ~/.codelite/load_hello_spu/Debug. If we don't want to wait for the file browser to open up and navigate to these folders then let's use CLI code instead in our Terminal:

cd ~/.codelite/hello_spu/Debug
cp hello_spu ~/.codelite/load_hello_spu/Debug/

Compile and run the load_hello_spu code in CodeLite to get the following results:

If you look at the result, you should see that SPU 0 was chosen to load the SPU code. Interesting, isn't it? In isolation mode you can't tell which SPU goes into isolation mode which isn't good. But we will get back to that in another tutorial perhaps...







Stay tuned for more PS3 Hacks and PS3 CFW news, follow us on Twitter and be sure to drop by the PS3 Hacks and PS3 Custom Firmware Forums for the latest PlayStation 3 scene updates and homebrew releases!

Comments 10 Comments - Go to Forum Thread »

• Please Register at PS3News.com or Login to make comments on Site News articles. Thanks!

Link14's Avatar
#10 - Link14 - 232w ago
It's moving quite nice in the PS3 underground world. I love to see that!

TUHTA's Avatar
#9 - TUHTA - 233w ago
PS3 is really need EXCELLENT WORKING RSX chips! There are so many many FAT/SLIMS PS3s was fixed by ME!

IT HAS really high temperature when its working! And it has to be rebolled or fixed by Heatgun!

Really BAD... $ony did RSX really bad, it has to be modified by using new technology OF COURSE!!

cfwprophet's Avatar
#8 - cfwprophet - 233w ago
But the OtherOS don't need any signing. So if they are able to reverse lv0,lv1,lv2,RSX driver and so on then we can run it over the OtherOS with no need for any signing

cyberfix's Avatar
#7 - cyberfix - 233w ago
Quote Originally Posted by PimpinPlayah View Post
Still holding off on the firmware update. Hope some custom firmware that continues to support the OtherOS feature is released soon... Until then, I'll be keeping my fingers crossed for better support


That would be awesome to have CFW like the PSP does. The problem I see is that they have no way to sign a custom firmware. I don't think the dumps are going to provide any keys unless the big guy actually left them unencrypted at one point in memory. Maybe they can get some point of attach that will let them load a CFW without validation by bypassing security all together. It will be interesting to see more.

PimpinPlayah's Avatar
#6 - PimpinPlayah - 233w ago
Still holding off on the firmware update. Hope some custom firmware that continues to support the OtherOS feature is released soon... Until then, I'll be keeping my fingers crossed for better support

Sponsored Links

Sponsored Links
Sponsored Links

Sponsored Links







Advertising - Affiliates - Contact Us - PS3 Downloads - Privacy Statement - Site Rules - Top - © 2014 PlayStation 3 News