Compile PS3 RSX X11 and 3D Drivers on Yellow Dog Linux 5.02

Investigation into how Linux on the PS3 might lead to homebrew development.

Moderators: cheriff, emoon

Post Reply
kingchurch
Posts: 3
Joined: Tue Jul 26, 2005 11:47 am

Compile PS3 RSX X11 and 3D Drivers on Yellow Dog Linux 5.02

Post by kingchurch »

Trying to compile the ps3 X11 driver from glaurung on Yellow Dog Linux 5.02. The kernel RSX framebuffer driver compiles and loads ok. But the user space x11 video driver checked out from the following URL doesn't compile correctly.

git clone http://mandos.homelinux.org/~glaurung/git/ps3rsx.git ./ps3rsx.01-19-2008

Basically it requires xorg-x11-server version >=1.0.99.901 while the YDL has only version 1.0.1.9. Thus the configure script failed up front. After brutal-force the configure script to take the older x11-server version, there were quite some compilation errors popped up related to header files, changed X11 SDK data structures, ..., etc. After some dirty fix of all of these, the user space driver compiles ok and the system boots into Xwindows all right with the new "ps3" RSX X11 driver configured in the X11 config file.

I haven't noticed obvious difference in the X11's behavior, not sure if the new RSX X11 driver works properly. The following is the X11 log:

---
(II) Module kbd: vendor="X.Org Foundation"
compiled for 7.0.0, module version = 1.0.1
Module class: X.Org XInput Driver
ABI class: X.Org XInput driver, version 0.5
(II) PS3: driver for framebuffer: ps3
(II) Loading sub module "fbdevhw"
(II) LoadModule: "fbdevhw"
(II) Reloading /usr/lib/xorg/modules/linux/libfbdevhw.so
(II) PS3(0): using default device
(II) Running in FRAMEBUFFER Mode
(**) PS3(0): Depth 24, (**) framebuffer bpp 32
(==) PS3(0): RGB weight 888
(==) PS3(0): Default visual is TrueColor
(==) PS3(0): Using gamma correction (1.0, 1.0, 1.0)
(II) PS3(0): hardware: ps3fb (video memory: 18240kB)
(II) PS3(0): checking modes against framebuffer device...
(II) PS3(0): mode "1124x644" not found
(II) PS3(0): checking modes against monitor...
(II) PS3(0): use current mode
(--) PS3(0): Virtual size is 1124x644 (pitch 1124)
(**) PS3(0): Built-in mode "current": 74.2 MHz, 45.0 kHz, 59.9 Hz
(II) PS3(0): Modeline "current" 74.18 1124 1272 1352 1650 644 688 693 750 bcast -hsync -vsync -csync
(==) PS3(0): DPI set to (75, 75)
(II) Loading sub module "fb"
(II) LoadModule: "fb"
(II) Loading /usr/lib/xorg/modules/libfb.so
(II) Module fb: vendor="X.Org Foundation"
compiled for 7.0.0, module version = 1.0.0
ABI class: X.Org ANSI C Emulation, version 0.2
(II) Loading sub module "exa"
(II) LoadModule: "exa"
(II) Loading /usr/lib/xorg/modules/libexa.so
(II) Module exa: vendor="X.Org Foundation"
compiled for 7.0.0, module version = 1.2.0
ABI class: X.Org Video Driver, version 0.8
(--) Depth 24 pixmap format is 32 bpp
(II) PS3(0): Control registers : 0xe5e9a000
(II) PS3(0): DMA command buffer: 0xe5e9b000
(II) PS3(0): DMA cmdbuf length : 63 KiB
(II) PS3(0): DMA base PUT : 0x0e1d0000
(==) PS3(0): Backing store disabled
(**) Option "dpms"
(**) PS3(0): DPMS enabled
(==) RandR enabled
(II) Initializing built-in extension MIT-SHM
(II) Initializing built-in extension XInputExtension
(II) Initializing built-in extension XTEST
(II) Initializing built-in extension XKEYBOARD
(II) Initializing built-in extension LBX
(II) Initializing built-in extension XC-APPGROUP
(II) Initializing built-in extension SECURITY
(II) Initializing built-in extension XINERAMA
(II) Initializing built-in extension XFIXES
(II) Initializing built-in extension XFree86-Bigfont
(II) Initializing built-in extension RENDER
(II) Initializing built-in extension RANDR
(II) Initializing built-in extension COMPOSITE
(II) Initializing built-in extension DAMAGE
(II) Initializing built-in extension XEVIE
(**) Option "Protocol" "IMPS/2"
------------

Does this look correct ? Is there any graphics benchmark we can try to see the difference in performance ?

The following is my quick and dirty patch to make the RSX user space X11 driver compile on YDL5.02 (xorg-x11-server 1.0.1-9). Sorry for the ugliness of the code, still, any comments are welcomed.

diff --git a/configure b/configure
index 95df930..28de8f0 100755
--- a/configure
+++ b/configure
@@ -20298,12 +20298,12 @@ if test -n "$PKG_CONFIG"; then
pkg_cv_XORG_CFLAGS="$XORG_CFLAGS"
else
if test -n "$PKG_CONFIG" && \
- { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"xorg-server >= 1.0.99.901 xproto fontsproto \$REQUIRED_MODULES\"") >&5
- ($PKG_CONFIG --exists --print-errors "xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES") 2>&5
+ { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"xorg-server >= 1.0.0.901 xproto fontsproto \$REQUIRED_MODULES\"") >&5
+ ($PKG_CONFIG --exists --print-errors "xorg-server >= 1.0.0.901 xproto fontsproto $REQUIRED_MODULES") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- pkg_cv_XORG_CFLAGS=`$PKG_CONFIG --cflags "xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES" 2>/dev/null`
+ pkg_cv_XORG_CFLAGS=`$PKG_CONFIG --cflags "xorg-server >= 1.0.0.901 xproto fontsproto $REQUIRED_MODULES" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -20316,12 +20316,12 @@ if test -n "$PKG_CONFIG"; then
pkg_cv_XORG_LIBS="$XORG_LIBS"
else
if test -n "$PKG_CONFIG" && \
- { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"xorg-server >= 1.0.99.901 xproto fontsproto \$REQUIRED_MODULES\"") >&5
- ($PKG_CONFIG --exists --print-errors "xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES") 2>&5
+ { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"xorg-server >= 1.0.0.901 xproto fontsproto \$REQUIRED_MODULES\"") >&5
+ ($PKG_CONFIG --exists --print-errors "xorg-server >= 1.0.0.901 xproto fontsproto $REQUIRED_MODULES") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- pkg_cv_XORG_LIBS=`$PKG_CONFIG --libs "xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES" 2>/dev/null`
+ pkg_cv_XORG_LIBS=`$PKG_CONFIG --libs "xorg-server >= 1.0.0.901 xproto fontsproto $REQUIRED_MODULES" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -20340,14 +20340,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- XORG_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES"`
+ XORG_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "xorg-server >= 1.0.0.901 xproto fontsproto $REQUIRED_MODULES"`
else
- XORG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES"`
+ XORG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xorg-server >= 1.0.0.901 xproto fontsproto $REQUIRED_MODULES"`
fi
# Put the nasty error message in config.log where it belongs
echo "$XORG_PKG_ERRORS" >&5

- { { echo "$as_me:$LINENO: error: Package requirements (xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES) were not met:
+ { { echo "$as_me:$LINENO: error: Package requirements (xorg-server >= 1.0.0.901 xproto fontsproto $REQUIRED_MODULES) were not met:

$XORG_PKG_ERRORS

@@ -20358,7 +20358,7 @@ Alternatively, you may set the environme
and XORG_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
" >&5
-echo "$as_me: error: Package requirements (xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES) were not met:
+echo "$as_me: error: Package requirements (xorg-server >= 1.0.0.901 xproto fontsproto $REQUIRED_MODULES) were not met:

$XORG_PKG_ERRORS
diff --git a/src/ps3_exa.c b/src/ps3_exa.c
index 4be51a9..bb2c75a 100644
--- a/src/ps3_exa.c
+++ b/src/ps3_exa.c
@@ -54,7 +54,7 @@ #include "nouveau_class.h"
#include "nv_shaders.h"

#include <sys/time.h>
-#include <string.h>
+//#include <string.h>

//#define TRACE() ErrorF("%s\n", __FUNCTION__);
#define TRACE()
@@ -1509,46 +1509,46 @@ Bool PS3ExaInit(ScreenPtr pScreen)
return FALSE;
}

- pPS3->EXADriverPtr->exa_major = EXA_VERSION_MAJOR;
- pPS3->EXADriverPtr->exa_minor = EXA_VERSION_MINOR;
+// pPS3->EXADriverPtr->exa_major = EXA_VERSION_MAJOR;
+// pPS3->EXADriverPtr->exa_minor = EXA_VERSION_MINOR;

- pPS3->EXADriverPtr->memoryBase = (void *) pPS3->vram_base;
- pPS3->EXADriverPtr->offScreenBase =
+ pPS3->EXADriverPtr->card.memoryBase = (void *) pPS3->vram_base;
+ pPS3->EXADriverPtr->card.offScreenBase =
((2 * pPS3->fboff +
pScrn->displayWidth * pScrn->virtualY *
(pScrn->bitsPerPixel/8) + 63) & ~63);
- pPS3->EXADriverPtr->memorySize = pPS3->vram_size;
- pPS3->EXADriverPtr->pixmapOffsetAlign = 256;
- pPS3->EXADriverPtr->pixmapPitchAlign = 64;
- pPS3->EXADriverPtr->flags = EXA_OFFSCREEN_PIXMAPS;
- pPS3->EXADriverPtr->maxX = 32768;
- pPS3->EXADriverPtr->maxY = 32768;
+ pPS3->EXADriverPtr->card.memorySize = pPS3->vram_size;
+ pPS3->EXADriverPtr->card.pixmapOffsetAlign = 256;
+ pPS3->EXADriverPtr->card.pixmapPitchAlign = 64;
+ pPS3->EXADriverPtr->card.flags = EXA_OFFSCREEN_PIXMAPS;
+ pPS3->EXADriverPtr->card.maxX = 32768;
+ pPS3->EXADriverPtr->card.maxY = 32768;

- pPS3->EXADriverPtr->WaitMarker = PS3ExaWaitMarker;
+ pPS3->EXADriverPtr->accel.WaitMarker = PS3ExaWaitMarker;

/* Install default hooks */
- pPS3->EXADriverPtr->DownloadFromScreen = PS3DownloadFromScreen;
- pPS3->EXADriverPtr->UploadToScreen = PS3UploadToScreen;
+ pPS3->EXADriverPtr->accel.DownloadFromScreen = PS3DownloadFromScreen;
+ pPS3->EXADriverPtr->accel.UploadToScreen = PS3UploadToScreen;

- pPS3->EXADriverPtr->PrepareCopy = PS3ExaPrepareCopy_2;
- pPS3->EXADriverPtr->Copy = PS3ExaCopy_2;
- pPS3->EXADriverPtr->DoneCopy = PS3ExaDoneCopy_2;
+ pPS3->EXADriverPtr->accel.PrepareCopy = PS3ExaPrepareCopy_2;
+ pPS3->EXADriverPtr->accel.Copy = PS3ExaCopy_2;
+ pPS3->EXADriverPtr->accel.DoneCopy = PS3ExaDoneCopy_2;

- pPS3->EXADriverPtr->PrepareSolid = PS3ExaPrepareSolid;
- pPS3->EXADriverPtr->Solid = PS3ExaSolid;
- pPS3->EXADriverPtr->DoneSolid = PS3ExaDoneSolid;
+ pPS3->EXADriverPtr->accel.PrepareSolid = PS3ExaPrepareSolid;
+ pPS3->EXADriverPtr->accel.Solid = PS3ExaSolid;
+ pPS3->EXADriverPtr->accel.DoneSolid = PS3ExaDoneSolid;

- pPS3->EXADriverPtr->CheckComposite = NV40EXACheckComposite;
- pPS3->EXADriverPtr->PrepareComposite = NV40EXAPrepareComposite;
- pPS3->EXADriverPtr->Composite = NV40EXAComposite;
- pPS3->EXADriverPtr->DoneComposite = NV40EXADoneComposite;
+ pPS3->EXADriverPtr->accel.CheckComposite = NV40EXACheckComposite;
+ pPS3->EXADriverPtr->accel.PrepareComposite = NV40EXAPrepareComposite;
+ pPS3->EXADriverPtr->accel.Composite = NV40EXAComposite;
+ pPS3->EXADriverPtr->accel.DoneComposite = NV40EXADoneComposite;

/* Reserve FB memory for DMA notifier and fragment programs */
pPS3->dmaNotifier = (CARD32 *) ((unsigned long ) pPS3->vram_base +
- pPS3->EXADriverPtr->offScreenBase);
+ pPS3->EXADriverPtr->card.offScreenBase); pPS3->fpMem = (CARD32 *) ((unsigned long) pPS3->dmaNotifier + 64);
- pPS3->EXADriverPtr->offScreenBase += 0x1000;
- pPS3->EXADriverPtr->memorySize -= 0x1000;
+ pPS3->EXADriverPtr->card.offScreenBase += 0x1000;
+ pPS3->EXADriverPtr->card.memorySize -= 0x1000;

/* Initialize 3D context */
setup_TCL(pScrn);
diff --git a/src/ps3_exa_TCL.c b/src/ps3_exa_TCL.c
index 629fe8b..0c22db6 100644
--- a/src/ps3_exa_TCL.c
+++ b/src/ps3_exa_TCL.c
@@ -35,7 +35,7 @@ #include "nouveau_class.h"
#include "nv_shaders.h"

#include <sys/time.h>
-#include <string.h>
+//#include <string.h>

typedef struct nv_pict_surface_format {
int pict_fmt;
diff --git a/src/ps3_gpu.c b/src/ps3_gpu.c
index efc2917..9422c17 100644
--- a/src/ps3_gpu.c
+++ b/src/ps3_gpu.c
@@ -10,13 +10,13 @@ #endif
#include "xf86.h"
#include "xf86_OSproc.h"

-#include <stdio.h>
+//#include <stdio.h>
#include <stdint.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
+//#include <unistd.h>
+//#include <string.h>
+//#include <sys/mman.h>
+//#include <sys/ioctl.h>
+//#include <fcntl.h>
#include <errno.h>

#include <linux/types.h>
@@ -32,6 +32,8 @@ #include "nouveau_class.h"
#include "nv_shaders.h"
#include "ps3_ioctl.h"

+typedef unsigned long off_t;
+
#define DEV_VFB "/dev/fb0"
#define DEV_RSXFB "/dev/fb1"
#define OFFSET_VRAM 0x00000000
diff --git a/src/ps3_video.c b/src/ps3_video.c
index 87128c0..c8e1d83 100644
--- a/src/ps3_video.c
+++ b/src/ps3_video.c
@@ -16,7 +16,7 @@ #include "regionstr.h"
#include "xf86xv.h"
#include <X11/extensions/Xv.h>
#include "exa.h"
-#include "damage.h"
+//#include "damage.h"
#include "dixstruct.h"
#include "fourcc.h"
#include "nouveau_class.h"
Last edited by kingchurch on Mon Jan 21, 2008 6:30 pm, edited 2 times in total.
billb
Posts: 32
Joined: Wed Dec 12, 2007 5:52 am

Re: Port PS3 RSX X11 User Space Driver to Yelow Dog Linux 5.

Post by billb »

kingchurch wrote:Trying to compile the ps3 X11 driver from glaurung on Yellow Dog Linux 5.02. The kernel RSX framebuffer driver compiles and loads ok. But the user space x11 video driver checked out from the following URL doesn't compile correctly.
I made an attempt at installing the driver on YDL 5.0.1 before I upgraded my firmware to 2.10 -- see this thread. But I updated xorg-x11-server with 1.1.1-47.8 from FC6, then ran into the module requirement mismatch. I quit trying it on YDL after that.

I switched to using it on Fedora 7 but didn't note any performance improvements. I thought there was an improvement because of installing xcompmgr (smoother window movement, drop shadows, etc) but it turns out you can install that WITHOUT ps3rsx.
kingchurch
Posts: 3
Joined: Tue Jul 26, 2005 11:47 am

Re: Port PS3 RSX X11 User Space Driver to Yelow Dog Linux 5.

Post by kingchurch »

billb wrote: I made an attempt at installing the driver on YDL 5.0.1 before I upgraded my firmware to 2.10 -- see this thread. But I updated xorg-x11-server with 1.1.1-47.8 from FC6, then ran into the module requirement mismatch. I quit trying it on YDL after that.

I switched to using it on Fedora 7 but didn't note any performance improvements. I thought there was an improvement because of installing xcompmgr (smoother window movement, drop shadows, etc) but it turns out you can install that WITHOUT ps3rsx.
I thought about switching to FC8 too, but gave up the idea cause my download session of the 4GB FC8 DVD broken at about 800MB. Figured it might be easy to hack YDL to do it to avoid re-installation hassle. After the patch I attached in the earlier email, the RSX FB kernel module and x11 driver seem work ok with the stock Gusty 2.6.23 kernel. BTW, I feel that after upgrading kernel from the YDL 2.6.23-wifi kernel to the stock Gusty's kernel and patch in Gaurung/IronPeter's kernel RSX/FB patch, the X11 speed seems to be faster than earlier's RSX x11 driver on top of YDL 2.6.23-wifi kernel. I plan to try some "transulent mplayer" test later to see if there is any performance difference between the RSX FB driver and standard FB driver.

Also I went on and compiled in IronPeter/Gaurung's 3D/FB kernel patch with the 2.6.23 kernel. After the patch and reboot into Text mode, I was able to launch two of IronPeter's RSX samples. They are very simple, just would like to list what I saw here to confirm if they worked correctly:

1) Simple_dct Sample
A Monstar's 2D image was shown with a blue background

2) simple_trananble Sample
A few triangle shapes overlapped with each other with different degrees of rotations. The background is orange.

I tried 480i/480p/720p/1080i, no big difference in the result. Can someone confirm if this is the expected results ?

Also tried "theOtherOS Demo" with the nice smily worm running from "kboot" as a standalone ELF. Very nice! Marcus! Anyone has done a port of the Demo to Linux environment using IronPeter's RSX API already ?

Thanks
Kc


and tried IronPeter's 3D demos
Post Reply