Console Yourself Sarah Ewen Lionel Lemari SCEE Technology

  • Slides: 40
Download presentation
Console Yourself Sarah Ewen & Lionel Lemarié SCEE Technology Group Sarah Ewen – Console

Console Yourself Sarah Ewen & Lionel Lemarié SCEE Technology Group Sarah Ewen – Console Yourself 1

This talk… • Brief overview of Play. Station 2 architecture – Basic knowledge for

This talk… • Brief overview of Play. Station 2 architecture – Basic knowledge for development • Linux for Play. Station 2 – What is it, how does it work • • Development using the Linux kit Comparison with the professional devkit Performance The direct access “SPS 2” module Sarah Ewen – Console Yourself 2

But first… • Who are we? – Sarah Ewen – Lionel Lemarié SCEE Technology

But first… • Who are we? – Sarah Ewen – Lionel Lemarié SCEE Technology Group Sarah Ewen – Console Yourself R&D Other Developer Support 3

Play. Station 2 What were the design goals of the Play. Station 2? Sarah

Play. Station 2 What were the design goals of the Play. Station 2? Sarah Ewen – Console Yourself 4

Play. Station 2: Goals of hardware • Floating point performance – Essential for realistic

Play. Station 2: Goals of hardware • Floating point performance – Essential for realistic 3 D graphics • High bandwidth – Maximise throughput • Low level – More flexibility for developers – Feedback from Play. Station Sarah Ewen – Console Yourself 5

Design goals So how does the Play. Station 2 meet these goals? Sarah Ewen

Design goals So how does the Play. Station 2 meet these goals? Sarah Ewen – Console Yourself 6

Main components RAM Emotion Engine (EE) Graphic Synthesiser (GS) Video Out RAM I/O Processor

Main components RAM Emotion Engine (EE) Graphic Synthesiser (GS) Video Out RAM I/O Processor (IOP) Sound Processor (SPU 2) Audio Out External Devices ROM Sarah Ewen – Console Yourself CD/DVD 7

The Emotion Engine (EE) SPU 2 IOP: Input Output Processor SPU 2: Sound Processor

The Emotion Engine (EE) SPU 2 IOP: Input Output Processor SPU 2: Sound Processor Emotion Engine Memory 32 mb 128 bit bus cache FPU EE CORE EE: 128 -bit Emotion Engine VU 0/VU 1: Vector Units FPU: Floating Point Unit Sarah Ewen – Console Yourself IPU DMA VU 0 VU 1 GIF GS 4 mb GS: Graphic Synthesiser DMA: Direct memory access IPU: Image processing Unit 8

Introducing the Linux Kit Why release Linux for Play. Station 2? What’s in the

Introducing the Linux Kit Why release Linux for Play. Station 2? What’s in the kit? How does it work? Sarah Ewen – Console Yourself 9

Introducing the Linux kit • Why? Sarah Ewen – Console Yourself 10

Introducing the Linux kit • Why? Sarah Ewen – Console Yourself 10

What it is • • • Keyboard & Mouse 40 GB HDD 10/100 Mbit

What it is • • • Keyboard & Mouse 40 GB HDD 10/100 Mbit NIC Monitor cable 2 x. DVD set – Linux – Manuals – EULA Sarah Ewen – Console Yourself 11

What it is not • Professional development environment – EULA agreement – Runtime Environment

What it is not • Professional development environment – EULA agreement – Runtime Environment • Desktop computer – Close, but not out of the box – Takes familiarity with Linux Sarah Ewen – Console Yourself 12

Linux • Distro based on Kondara Linux – Based on Red Hat 6. 2

Linux • Distro based on Kondara Linux – Based on Red Hat 6. 2 • Usual software packages – Disc 2 • Supports VESA, PAL, NTSC • Useful PS 2 Linux tools – setcrtmode – mcformat Sarah Ewen – Console Yourself 13

Linux kit - Software • How does it work? Load RTE from Disc 1

Linux kit - Software • How does it work? Load RTE from Disc 1 install Swap discs, follow instructions Install, Boot, Rescue? boot rescue Boot rescue kernel off disc 2 Choose kernel (on memcard) Load kernel; mount HDD Sarah Ewen – Console Yourself 14

Runtime Environment • Provides access to: – DVD drive – Memory cards –. .

Runtime Environment • Provides access to: – DVD drive – Memory cards –. . any IO device via IOP • Consequences – Can only read PS 2 discs in drive – Cannot open game saves on memory card… Sarah Ewen – Console Yourself 15

Development What are my options using the Linux kit? Sarah Ewen – Console Yourself

Development What are my options using the Linux kit? Sarah Ewen – Console Yourself 16

Linux kit - development Higher level: – PS 2 GL – Mesa – SDL

Linux kit - development Higher level: – PS 2 GL – Mesa – SDL port PS 2 Approach: – Libps 2 dev • Bundled with examples and some documentation • /usr/doc/Play. Station 2 – Additionally • ps 2 stuff & SPS 2 projects available on playstation 2 -linux. com Sarah Ewen – Console Yourself 17

Linux kit - development • Access to the Vector Units – Unaffected by Linux

Linux kit - development • Access to the Vector Units – Unaffected by Linux – Write applications in C/C++ and assembly • Development environment – – – Libraries to access devices under Linux A vu 0 math library Your favourite text editor A cross compiler Principals are the same as native PS 2 Limited debugging capability Sarah Ewen – Console Yourself 18

A comparison Linux kit vs professional development hardware: What’s the difference? • • •

A comparison Linux kit vs professional development hardware: What’s the difference? • • • Hardware Software Development Tools Libraries Docs & support Sarah Ewen – Console Yourself 19

Hardware T 10000: PS 2 Linux: • Expanded PS 2 • Standard PS 2

Hardware T 10000: PS 2 Linux: • Expanded PS 2 • Standard PS 2 – 128 M main memory – 8 M IOP memory – 32 M main memory – 2 M IOP memory • Host-PC • Controlled via network only • HDD • Network adapter • Can be used directly using a keyboard and mouse – No direct access to either the PS 2 or the host-PC Sarah Ewen – Console Yourself 20

Software T 10000: PS 2 Linux: • Host-PC controls PS 2 hardware • PS

Software T 10000: PS 2 Linux: • Host-PC controls PS 2 hardware • PS 2 runs Linux – PS 2 hardware resources unrestricted – Thin kernel • manages I/O • debugging features – IOP exposed to developers Sarah Ewen – Console Yourself – PS 2 hardware exposed through devices – Nodirect IOP access or SPU 2 access to protect “Magic. Gate” – Linux eats memory and CPU time 21

Development T 10000: PS 2 Linux: • Cross development • Direct development – compilation

Development T 10000: PS 2 Linux: • Cross development • Direct development – compilation of code done on users PC • downloaded to PS 2 via host-PC interface – debugger runs on users PC, talks to host-PC over network, which then talks to PS 2 hardware Sarah Ewen – Console Yourself – compilation of code done on Linux kit itself – debugger runs on PS 2 Linux, taking up extra resources 22

Tools T 10000: PS 2 Linux: • Supplied with custom toolchain • Supplied with

Tools T 10000: PS 2 Linux: • Supplied with custom toolchain • Supplied with GCC – GCC based compiler – EE and IOP debuggers • All tools know about PS 2 hardware – Not fully “PS 2” – Ports to other platforms possible for cross compilation • Several commercial development packages – Fully visual IDE’s etc. Sarah Ewen – Console Yourself 23

Libraries T 10000: PS 2 Linux: • Has several low-level libraries • Has device

Libraries T 10000: PS 2 Linux: • Has several low-level libraries • Has device interfaces to some features – GS – DMAC – VU 0 • And some higher level ones – Mpeg – Network Sarah Ewen – Console Yourself – VU/VIF – GS – expand • Has some “helper” libraries to get you going – Lib. PS 2 Dev 24

Docs and Support T 10000: PS 2 Linux: • Full hardware manuals – Except

Docs and Support T 10000: PS 2 Linux: • Full hardware manuals – Except IOP – But including SPU – Printed and PDF • Many additional documents on professional website • Private newsgroups and email support Sarah Ewen – Console Yourself – Except IO Processor, sound chip – PDF only • Public website – Public projects – Discussion forums • Limited direct support – Sarah, Adam – Tech group staff in their own time 25

Sarah Ewen – Console Yourself 26

Sarah Ewen – Console Yourself 26

Performance What level of performance can be achieved on the Linux kit? What affects

Performance What level of performance can be achieved on the Linux kit? What affects it? Sarah Ewen – Console Yourself 27

Performance • Linux architecture not designed for PS 2 • Large CPU overhead •

Performance • Linux architecture not designed for PS 2 • Large CPU overhead • Kernel is not cache friendly – Does not use Scratch. Pad memory – Does not use Vector Units • Software rendering is far from optimal • But you have access to all unused resources Sarah Ewen – Console Yourself 28

Performance • Pretty good performance is achievable • One of the samples displays 560

Performance • Pretty good performance is achievable • One of the samples displays 560 k polys at 60 fps – That’s 33. 6 M polys/sec – Theoretical max is 35 • Aided by SPS 2 module: – “Direct Access Environment” Sarah Ewen – Console Yourself 29

SPS 2: Direct Access Environment Developed by PS 2 Linux developer community 1. 2.

SPS 2: Direct Access Environment Developed by PS 2 Linux developer community 1. 2. 3. 4. What is it? Why use it? How do I use it? Are there disadvantages? Sarah Ewen – Console Yourself 30

What is SPS 2? • Kernel module loaded at runtime • Gives direct access

What is SPS 2? • Kernel module loaded at runtime • Gives direct access to the hardware • Has been used to create samples requiring lots of processing power • Linux friendly Sarah Ewen – Console Yourself 31

Advantages • Required for DMA transfers – Guarantee to have unswappable/unmovable memory • Only

Advantages • Required for DMA transfers – Guarantee to have unswappable/unmovable memory • Only 4 kb continuous memory is guarantied – Physical address of memory • You fill the buffers using Linux virtual addresses and sends the data using physical addresses – Direct access to the hardware registers • EE • GS Sarah Ewen – Console Yourself 32

More advantages • DMA packet checker – Set of functions for debugging purposes –

More advantages • DMA packet checker – Set of functions for debugging purposes – Helps prevent crashes • Easy to crash the system • • Very good documentation Samples to illustrate usage Currently being developed and improved The module can be installed/uninstalled at runtime – No need to recompile the kernel – No memory is reserved – No need to even reboot Sarah Ewen – Console Yourself 33

How to use SPS 2 • Load the kernel at runtime – Scripts are

How to use SPS 2 • Load the kernel at runtime – Scripts are provided to make it easy • Use the library provided – Just a set of headers to include – System calls are taken care of • Build DMA packets the same way you’d do on a Dev. Kit – Use memory allocated by the module – Build small 4 kb chunks linked in a chain • Use macros to set the DMA registers – Macros are assembly code writing directly to the registers Sarah Ewen – Console Yourself 34

Disadvantages • Potential security issue – No safeguards • Trade off between security and

Disadvantages • Potential security issue – No safeguards • Trade off between security and speed – You can have one or the other – But not both Sarah Ewen – Console Yourself 35

SPS 2 project framework • Written by members of the community – Professional developers

SPS 2 project framework • Written by members of the community – Professional developers • • Takes cares of display initialisation Deals with DMA packet building Provides a solid base for your code Samples of advanced techniques used in a game – Mskpath 3 – Bump mapping – Interlock Sarah Ewen – Console Yourself 36

Nearly there. . . • AGDC talks are nearly over! Sarah Ewen – Console

Nearly there. . . • AGDC talks are nearly over! Sarah Ewen – Console Yourself 37

Conclusion • Linux kit provides – Hardware Manuals – Access to PS 2 at

Conclusion • Linux kit provides – Hardware Manuals – Access to PS 2 at a low level – VCL • Everything you learn through the Linux kit is of value on professional development tool – SPS 2 even makes your code more portable • Amateur developer community is growing – playstation 2 -linux. com • Sourceforge approach to helping developers Sarah Ewen – Console Yourself 38

Contact • Exhibition on level 3: Booth #9 • On the web: http: //playstation

Contact • Exhibition on level 3: Booth #9 • On the web: http: //playstation 2 -linux. com http: //au. playstation. com or nz. playstation. com http: //www. technology. scee. net • Sarah_Ewen@scee. net • Lionel_Lemarie@scee. net Sarah Ewen – Console Yourself 39

Questions? Sarah Ewen – Console Yourself 40

Questions? Sarah Ewen – Console Yourself 40