Wednesday, January 14, 2015

AmigaOS4.1 boot process UBOOT.

I was thinking it be nice to write a useful Blog about the boot process of AmigaOS4.1.
Many people have problem understanding the Boot Process, coming from Classic Amiga (500/1200/4000), or if they are used to a PC. That has Windows preinstalled.

AmigaOS4.1 can boot from tree different Firmware types (On PC there is BIOS or UEFI, on PowerPC there different Firmware).

On Pegasus II, there is OpenFirmware.
On AmigaONE-X1000 there is CFE.
On AmigaONE-XE/SE/Mini there is UBOOT.
On Sam440/460 (AmigaONE-500), there is UBOOT.

The most common BIOS Firmware is UBOOT this the one most people are having problems with. CFE and OpenFirmware is easier to use.

The uboot boot process.

UBOOT checks hardware and scans SATA and IDE and USB buses for devices.
Once it knows what is connected, it goes to the next step, this where things can go wrong.

For Linux the boot process is simple, as UBOOT diskboot command loads in kernel from PPCBoot image device all you do is define the controller number and the partition number and it finds it.

For AmigaOS this bit more complicated, BOOTA is not feed the controller, nor the partition number instead, the boot process depends on BOOT1 and BOOT2 variables, If device defined in BOOT1 is not found it goes to the next one BOOT2.

This sound simple, but here is the problem, BOOTA does not know what is a CDROM or HD, unless you have defined it, there for you will need to have UBOOT variable for etch controller that defines what is wired to a CDROM what connector what is not in use, and what connector that is wired to Hard drive.

This is defined by the UBOOT variable a1ide_conf for AmigaONE-XE/SE ide controller, for other controller the name of variable is different, but the suffix is always _conf.

The variable defines what is connected to A1 ide controller.
0 is not connected
1 is HD
2 is CDROM

When BOOTA command knows what is CDROM and what is HD, the chance of success has increased.

The SLB2 is loaded from the RDB (Amiga partition table), the SLB will look for kickstart files on first bootable partition on hard drive it finds.

So if the kickstart modules are not found, you have done something bad when partition the harddrive, and setting up boot priorities.

If everything works out then kickstart modules are loaded, and AmigaOS4 kickstart takes over.

For AmigaOS4 kickstart to continue booting kickstart drivers must be loaded that support the controllers you have connected, and also it need to know that things are connected, once it has found the CDROM’s and HDDRIVES, it scan partition tables to boot partition or CDROM with the highest boot priority.

Here again you might have done something wrong, if you changed the boot priority of partition too high, then the kickstart will never boot from the CDROM. It can get really tricky to reset the boot priorities, luckily the AmigaOS kickstart was designed as the firmware for Classic Amiga, and it has not lost the possibility for user to select boot device.

By pressing the “Scroll Lock” key on the keyboard, you can get into boot menu of the kickstart, or you can hold the two mouse buttons.

Monday, January 12, 2015

Mplayer 6.4 userguide for AmigaOS4.1

LiveForIt-Mplayer 6.x requires: AmigaOS4.1 Final and Radeon™ HD v2.4 drivers from Hans/A-EON, to take full advantage of COMP, COMP_YUV and COMP_YUV2.


If you do not plan to upgrade just yet, stick with the older LiveForIt-Mplayer version 5.5. or be forced to use cgx_wpa, SDL or p96_pip.

Some useful information that only relates to LiveForIt-Mplayer 6.4 for AmigaOS4.1

Video outputs mplayer for AmigaOS4.1 supports:

This video output is written by Kjetil Hvalstrand and is based on cgx_wpa output, but was changed to use composition instead of WritePixelArray(), and enabled the video output to have scalable windows, and full-screen mode that allowed the video to stretched to fit screen mode. the video output convert yuv420/yv12 bitmaps into 32bit ARGB bitmaps using the CPU, just like CGX_WPA.

This is based on Comp, but was rewritten to use new color spaces yuv420p that is now supported by 
Radeon HD 2.4 drivers for AmigaOS4.1, this basically enables this video output to not need to convert into ARGB format,
in addition DRI support was added for codecs that supports this, and we have accelerated video to graphic card using DMA from new Graphic library 54.153. this video output supports window scaling and full screen mode.

Same as comp_yuv but mplayer do not wait for vsync to complete, window refresh has been moved into its own thread, so mplayer can continue doing some thing else, while it waits for vsync.

This video output was originally written by DET Nicolas, and Fabian Coeurjoly, to use CyberGraphicsX on MorphOS and AmigaOS, AmigaOS4.x uses Picasso96 so this heavy modified version of the original, most of the code is the same. the video output support window mode, but you can't re-size the window, the video also support full-screen, but no scaling to fit the screen. 

This is the good old Picasso96 overlay video output from Jorge Strohmayer, originally it did not support double buffering, I added double buffering to video output, this video output support window mode and full screen.
the video output does not support DRI nor DMA transfer.

PIP is experimental video output from Jorge Strohmayer, full screen mode is not working atm, and PIP is there for not included in mplayer build by default. some optional color spaces is supported.

(Simple DirectMedia Layer), is a none native GUI system that sits on top of graphic.library,
SDL should support overlay, but this is not implemented on AmigaOS4.1, SDL is there for slow to render graphics, SDL video output support CPU scaled video output in window mode, but not in full screen.

Using video outputs:

Options for comp/comp_yuv/comp_yuv2.

Mplayer mymovie.avi –vo comp_yuv2:help

Shows a list of video output options.

Mplayer mymovie.avi –vo comp_yuv2:monitor=0

This opens up mplayer on monitor 0 or first monitor, when going full screen, no need for screen promotion in Workbench.

Mplayer mymovie.avi –vo comp_yuv2:monitor=1

This opens mplayer on monitor 1 or second monitor.

Mplayer mymovie.avi –vo comp_yuv2:nodma

Disables DMA, this can be used for debugging.
Image is now writes directly to VRAM,
(If codec support DRI, then video output will be black, when DMA is disabled.)

Mplayer mymovie.avi –vo comp_yuv2:nodri

Disables DRI rendering, forces mplayer to draw images using slices.
(Many codecs do not support DRI)

Mplayer mymovie.avi –vo comp_yuv2:pubscreen=dopus.1

This should open mplayer window on public screen dopus.1

Options for P96_PIP 

This one does not have any options.

Most common options for PIP
 (not compiled into mplayer by default).

Mplayer mymovie.avi –vo pip:mode=0

display video in YUV410 format (default)

Mplayer mymovie.avi –vo pip:mode=1

display video in YUV420 format

Mplayer mymovie.avi –vo pip:mode=2

display video in YUV422 format

Using AREXX with mplayer:

Start mplayer from shell.

Now you can send ARexx commands like this.

Rx Arexx/Volume100.rx

this script sets mplayers volume to 100% volume.

Rx Arexx/GetTimeLength.rx

Get length current film played.

Rx Arexx/GetPercentPos.Rx

Get percentage position in the film.

Rx Arexx/Help.rx

Get a list of ARexx commands from mplayer.


What is DRI?
DRI is short for Direct Rendering Interface, when a codec support DRI, the codec asks the video output for image buffer, instead of allocating a buffer of its own in Codec, as result mplayer don't need to copy image slices from the codec buffer to video output.

What is DMA?

DMA is short for Direct Memory Access, DMA allows hardware to copy or access memory with out using the CPU. you can find more about it on Wikipedia:

What is VSync?

VSync enables the program to sync to refresh rate, so you don't get a half drawn image, before it displayed.

LCD monitors use 60Hz refresh rate, older CTR monitors some time up 100hz refresh rate.
60Hz equals 60 frames per second; most videos are record at 25 FPS (frames per second).

LCD monitors have static picture, the image is changed at 60Hz, while the older CTR has to paint the pixels repeatedly this can make the screen flicker (as you can see the pixel turn on and off), if the refresh is 60Hz or lower, with higher refresh rate you trick the eye to not see it.

For general questions about mplayer you can find the Linux man pages on MplayerHQ useful