RSXFIFOCommands

From PS3 Developer wiki
Jump to: navigation, search

Crossreference: gitbrew.org::RSXFIFOCommands

Contents

Commands[edit]

NOP (0x00000100)[edit]

  • Nop
0x00000100

CALL (0x00000002)[edit]

  • Calls a function at the specified offset.
  • Command size is 0.
  • The parameter is offset in FIFO buffer.
<offset> | 0x00000002

RET (0x00020000)[edit]

  • Returns from a function.
  • Command size is 0.
0x00020000

JMP (0x20000000)[edit]

  • Jumps to the specified offset.
  • Command size is 0.
  • The parameter is offset in FIFO buffer.
0x20000000 | <offset>

COLOR MASK (0x00040324)[edit]

  • Sets color mask.
  • Command size is 1.
  • The parameter is color mask.
0x00040324
<color mask>

COLOR MASK MRT (0x00040370)[edit]

0x00040370
<color mask>

CLEAR COLOR (0x00041D90)[edit]

0x00041D90
<value>

FRONT POLYGON MODE (0x00041828)[edit]

  • Sets front polygon mode.
  • Command size is 1.
  • The parameter is front polygon mode.
0x00041828
<front polygon mode>

SET REF (0x00040050)[edit]

  • Sets value of REF control register
0x00040050
<value>

SEMAPHORE DMA CONTEXT (0x00040060)[edit]

  • Sets semaphore DMA context
0x00040060
<value>

SEMAPHORE OFFSET (0x00040064)[edit]

  • Sets semaphore offset
0x00040064
<value>

SEMAPHORE ACQUIRE (0x00040068)[edit]

  • Acquires semaphore
0x00040068
<value>

SEMAPHORE RELEASE (0x0004006C)[edit]

  • Releases semaphore
0x0004006C
<value>

libgcm Functions[edit]

cellGcmGetControlRegister[edit]

  • Returns EA of FIFO registers: PUT, GET and REF

cellGcmFlush[edit]

  • Kicks FIFO command processing by moving PUT register

cellGcmFinish[edit]

  • This function adds FIFO command for setting REF register to value 0xFFFFFFFF, kicks FIFO and then loops and checks REF register until it is set to value 0xFFFFFFFF.
  • It just waits until all FIFO commands are processed by GPU.

cellGcmGetFlipStatus[edit]

  • Returns flip status.
  • Checks bit 31 in word at offset 0x10C0 + 0x1 * 0x40 of reports area returned by lv1_gpu_context_allocate.
  • Flip status = ((word at 0x10C0 + 0x1 * 0x40) >> 31) ^ 0x1.
  • Flip status: 0 - flip done, 1 - flip waiting

cellGcmResetFlipStatus[edit]

  • Resets flip status.
  • Sets flip status to flip waiting.
  • Sets bit 31 to 0 in word at offset 0x10C0 + 0x1 * 0x40 of reports area returned by lv1_gpu_context_allocate.

Equivalent to:

lv1_gpu_context_attribute(context handle, 0x10a, 0x1 /* id */, 0x7fffffff /* mask */, 0x0 /* value */, 0x0)

libgcm Commands[edit]

SetNopCommand[edit]

0x00000000

SetReferenceCommand[edit]

0x00040050
<param>

SetJumpCommand[edit]

0x20000000 | <param>

SetCallCommand[edit]

0x00000002 | <param>

SetReturnCommand[edit]

0x00002000

SetLogicOp[edit]

  • Sets pixel logical operation
0x00040378
<param>

SetLogicOpEnable[edit]

  • Enables/Disables pixel logical operation
0x00040374
<param>

SetColorMask[edit]

0x00040324
<param>

SetColorMaskMrt[edit]

0x00040370
<param>

SetClearColor[edit]

0x00041D90
<param>

SetClearDepthStencil[edit]

0x00041D8C
<param>

SetClearSurface[edit]

0x00041D94
<param>
0x00040100
<param>

SetFrontPolygonMode[edit]

0x00041828
<param>

SetFrontFace[edit]

0x00041834
<param>

SetAlphaTestEnable[edit]

0x00040304
<param>

SetAlphaFunc[edit]

0x00080308
<param1>
<param2>

SetDepthTestEnable[edit]

0x00040A74
<param>

SetDepthFunc[edit]

0x00040A6C
<param>

SetDepthBounds[edit]

0x00080384
<param1>
<param2>

SetBlendEnable[edit]

0x00040310
<param>

SetBlendFunc[edit]

0x00080314
<param1>
<param2>

SetBlendColor[edit]

0x0004031C
<param>
0x0004037C
<param>

SetBlendEquation[edit]

0x00040320
<param>

SetClipMinMax[edit]

  • Sets Z clipping values
0x00080394
<param1>
<param2>

SetZcullEnable[edit]

  • Enables/Disables Zcull/Scull
0x00041D84
<param>

SetPointSize[edit]

0x00041EE0
<param>

SetWriteCommandLabel[edit]

  • Releases semaphore.
0x00040064
<param>
0x0004006C
<param>

SetWaitLabel[edit]

  • Acquires semaphore.
0x00040064
<param>
0x00040068
<param>

SetWriteBackEndLabel[edit]

0x00041D6C
<param>
0x00041D70
<param>

SetWriteBackEndLabelForConditional[edit]

0x00041D6C
<param>
0x00041D70
<param>
0x00040110
0x00000000

SetWaitForIdle[edit]

0x00040110
0x00000000

SetWaitFlip[edit]

  • SetWaitFlip is nothing more than acquiring semaphore.
  • This command is equal to SetWaitLabel with index=0x00000001 and value=0x00000000.
0x00040064
0x00000010       # semaphore offset = index * 16
0x00040068
0x00000000

SetReportLocation[edit]

0x000401A8
<param>

SetReport[edit]

0x00041800
<param>

SetTimeStamp[edit]

0x00041800
<param>

SetClearReport[edit]

0x000417c8
<param>

SetCullFace[edit]

  • Specifies culling face (front or back)
0x00041830
<param>

SetCullFaceEnable[edit]

  • Enables/Disables face culling
0x0004183C
<param>

SetViewport[edit]

0x00080A00
<param1>
<param2>
0x00080394
<param1>
<param2>
0x200A20
<param1>
<param2>
<param3>
<param4>
<param5>
<param6>
<param7>
<param8>
0x200A20
<param1>
<param2>
<param3>
<param4>
<param5>
<param6>
<param7>
<param8>

SetLineWidth[edit]

0x000403B8
<param>

SetLineSmoothEnable[edit]

0x000403BC
<param>

SetTextureAddress[edit]

0x00041A08 + (param1 << 5)
<param2>

SetTextureControl[edit]

0x00041A0C + (param1 << 5)
<param2>

SetTextureFilter[edit]

0x00041A14 + (param1 << 5)
<param2>

SetFogMode[edit]

0x000408CC
<param>

SetNotifyIndex[edit]

0x00040180
0x6660420F - <param>

SetNotify[edit]

0x00040104
0x00000000
0x00040100
0x00000000

SetTransferDataMode[edit]

0x00082184
<source>            # 0xFEED0000 - local memory, 0xFEED0001 - system memory
<destination>       # 0xFEED0000 - local memory, 0xFEED0001 - system memory

SetTransferDataOffset[edit]

0x0004230C
<source address>

0x00042310
<destination address>

0x00042328
0x00000000

SetTransferDataFormat[edit]

0x00142314
<source pitch>
<destination pitch>
<line length>
<line count>
<destination increment> << 8 | <source increment>

SetTransferLocation[edit]

0x00046188
<destination>            # 0xFEED0000 - local memory, 0xFEED0001 - system memory

SetTransferData[edit]

0x00082184
<source>                 # 0xFEED0000 - local memory, 0xFEED0001 - system memory
<destination>            # 0xFEED0000 - local memory, 0xFEED0001 - system memory

for (each row)
{
    0x0020230C
    <source address>
    <destination address>
    0x00000000
    0x00000000
    <number of bytes to transfer>    # max 0x3FFFFF bytes
    0x00000001
    0x00000101
    0x00000000
}

SetSurfaceWindow[edit]

0x00040194
<param>
0x0004018C
<param>
0x000801B4
<param1>
<param2>
0x00040198
<param>

TODO

SetVertexTextureAddress[edit]

0x00040908 + (index * 0x20)
(wrapt << 8) | wraps

SetVertexDataArray[edit]

0x00041740 + (index * 0x4)
param
0x00041680 + (index * 0x4)
param

libgcm System Semaphores[edit]

Offset Value Description
0x00000010 0x00000000 Flip done semaphore (used by cellGcmWaitFlip)

Semaphores[edit]

Small Test[edit]

Here is a FIFO program i executed on Linux:

0x00040060     # set semaphore DMA context method
0x66616661     # DMA object handle
0x00040064     # set semaphore offset method
0x00000400     # semaphore offset
0x0004006C     # semaphore release method
0xf00dbeef     # semaphore value

And here is dump of reports area:

000003f8: 0x1337beef
000003fc: 0x1337f001
00000400: 0xf00dbeef   # semaphore value
00000404: 0x1337babe
00000408: 0x1337beef
0000040c: 0x1337f001
  • As you see releasing semaphore writes 0xf00dbeef to reports area at offset 0x400.

Reports Area[edit]