RSXFIFOCommands: Difference between revisions

From PS3 Developer wiki
Jump to navigation Jump to search
m (Created page with "Category:Software Crossreference: [http://portal.gitbrew.org/wikibrew/PS3:HvReverseEngineering:RSXFIFOCommands gitbrew.org::RSXFIFOCommands] <br /> =Commands= ==NOP (0x0000...")
 
mNo edit summary
Line 84: Line 84:
0x00040050
0x00040050
<value>
<value>
</pre>
==SEMAPHORE DMA CONTEXT (0x00040060)==
* Sets semaphore DMA context
<pre>
0x00040060
<value>
</pre>
==SEMAPHORE OFFSET (0x00040064)==
* Sets semaphore offset
<pre>
0x00040064
<value>
</pre>
==SEMAPHORE ACQUIRE (0x00040068)==
* Acquires semaphore
<pre>
0x00040068
<value>
</pre>
==SEMAPHORE RELEASE (0x0004006C)==
* Releases semaphore
<pre>
0x0004006C
<value>
</pre>
=libgcm Functions=
==cellGcmGetControlRegister==
* Returns EA of FIFO registers: PUT, GET and REF
==cellGcmFlush==
* Kicks FIFO command processing by moving PUT register
==cellGcmFinish==
* 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==
* 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==
* 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:
<pre>
lv1_gpu_context_attribute(context handle, 0x10a, 0x1 /* id */, 0x7fffffff /* mask */, 0x0 /* value */, 0x0)
</pre>
</pre>


Line 283: Line 352:


==SetWriteCommandLabel==
==SetWriteCommandLabel==
* Releases semaphore.


<pre>
<pre>
Line 292: Line 363:


==SetWaitLabel==
==SetWaitLabel==
* Acquires semaphore.


<pre>
<pre>
Line 298: Line 371:
0x00040068
0x00040068
<param>
<param>
</pre>
==SetWriteBackEndLabel==
<pre>
0x00041D6C
<param>
0x00041D70
<param>
</pre>
==SetWriteBackEndLabelForConditional==
<pre>
0x00041D6C
<param>
0x00041D70
<param>
0x00040110
0x00000000
</pre>
</pre>


Line 304: Line 397:
<pre>
<pre>
0x00040110
0x00040110
0x00000000
</pre>
==SetWaitFlip==
* SetWaitFlip is nothing more than acquiring semaphore.
* This command is equal to SetWaitLabel with '''index=0x00000001''' and '''value=0x00000000'''.
<pre>
0x00040064
0x00000010      # semaphore offset = index * 16
0x00040068
0x00000000
0x00000000
</pre>
</pre>
Line 438: Line 543:
0x00040100
0x00040100
0x00000000
0x00000000
</pre>
==SetTransferDataMode==
<pre>
0x00082184
<source>            # 0xFEED0000 - local memory, 0xFEED0001 - system memory
<destination>      # 0xFEED0000 - local memory, 0xFEED0001 - system memory
</pre>
==SetTransferDataOffset==
<pre>
0x0004230C
<source address>
0x00042310
<destination address>
0x00042328
0x00000000
</pre>
==SetTransferDataFormat==
<pre>
0x00142314
<source pitch>
<destination pitch>
<line length>
<line count>
<destination increment> << 8 | <source increment>
</pre>
==SetTransferLocation==
<pre>
0x00046188
<destination>            # 0xFEED0000 - local memory, 0xFEED0001 - system memory
</pre>
</pre>


Line 447: Line 591:
<destination>            # 0xFEED0000 - local memory, 0xFEED0001 - system memory
<destination>            # 0xFEED0000 - local memory, 0xFEED0001 - system memory


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


Line 467: Line 620:
TODO
TODO
</pre>
</pre>
==SetVertexTextureAddress==
<pre>
0x00040908 + (index * 0x20)
(wrapt << 8) | wraps
</pre>
==SetVertexDataArray==
<pre>
0x00041740 + (index * 0x4)
param
0x00041680 + (index * 0x4)
param
</pre>
=libgcm System Semaphores=
{| class="wikitable"
|-
! Offset !! Value !! Description
|-
| 0x00000010 || 0x00000000 || Flip done semaphore (used by cellGcmWaitFlip)
|}
=Semaphores=
==Small Test==
Here is a FIFO program i executed on Linux:
<pre>
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
</pre>
And here is dump of reports area:
<pre>
000003f8: 0x1337beef
000003fc: 0x1337f001
00000400: 0xf00dbeef  # semaphore value
00000404: 0x1337babe
00000408: 0x1337beef
0000040c: 0x1337f001
</pre>
* As you see releasing semaphore writes 0xf00dbeef to reports area at offset 0x400.
=Reports Area=
* [[PS3:HvReverseEngineering:RSXFIFOCommands:ReportsAreaDump]]

Revision as of 17:18, 2 October 2011

Crossreference: gitbrew.org::RSXFIFOCommands

Commands

NOP (0x00000100)

  • Nop
0x00000100

CALL (0x00000002)

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

RET (0x00020000)

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

JMP (0x20000000)

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

COLOR MASK (0x00040324)

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

COLOR MASK MRT (0x00040370)

0x00040370
<color mask>

CLEAR COLOR (0x00041D90)

0x00041D90
<value>

FRONT POLYGON MODE (0x00041828)

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

SET REF (0x00040050)

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

SEMAPHORE DMA CONTEXT (0x00040060)

  • Sets semaphore DMA context
0x00040060
<value>

SEMAPHORE OFFSET (0x00040064)

  • Sets semaphore offset
0x00040064
<value>

SEMAPHORE ACQUIRE (0x00040068)

  • Acquires semaphore
0x00040068
<value>

SEMAPHORE RELEASE (0x0004006C)

  • Releases semaphore
0x0004006C
<value>

libgcm Functions

cellGcmGetControlRegister

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

cellGcmFlush

  • Kicks FIFO command processing by moving PUT register

cellGcmFinish

  • 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

  • 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

  • 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

SetNopCommand

0x00000000

SetReferenceCommand

0x00040050
<param>

SetJumpCommand

0x20000000 | <param>

SetCallCommand

0x00000002 | <param>

SetReturnCommand

0x00002000

SetLogicOp

  • Sets pixel logical operation
0x00040378
<param>

SetLogicOpEnable

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

SetColorMask

0x00040324
<param>

SetColorMaskMrt

0x00040370
<param>

SetClearColor

0x00041D90
<param>

SetClearDepthStencil

0x00041D8C
<param>

SetClearSurface

0x00041D94
<param>
0x00040100
<param>

SetFrontPolygonMode

0x00041828
<param>

SetFrontFace

0x00041834
<param>

SetAlphaTestEnable

0x00040304
<param>

SetAlphaFunc

0x00080308
<param1>
<param2>

SetDepthTestEnable

0x00040A74
<param>

SetDepthFunc

0x00040A6C
<param>

SetDepthBounds

0x00080384
<param1>
<param2>

SetBlendEnable

0x00040310
<param>

SetBlendFunc

0x00080314
<param1>
<param2>

SetBlendColor

0x0004031C
<param>
0x0004037C
<param>

SetBlendEquation

0x00040320
<param>

SetClipMinMax

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

SetZcullEnable

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

SetPointSize

0x00041EE0
<param>

SetWriteCommandLabel

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

SetWaitLabel

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

SetWriteBackEndLabel

0x00041D6C
<param>
0x00041D70
<param>

SetWriteBackEndLabelForConditional

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

SetWaitForIdle

0x00040110
0x00000000

SetWaitFlip

  • 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

0x000401A8
<param>

SetReport

0x00041800
<param>

SetTimeStamp

0x00041800
<param>

SetClearReport

0x000417c8
<param>

SetCullFace

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

SetCullFaceEnable

  • Enables/Disables face culling
0x0004183C
<param>

SetViewport

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

0x000403B8
<param>

SetLineSmoothEnable

0x000403BC
<param>

SetTextureAddress

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

SetTextureControl

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

SetTextureFilter

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

SetFogMode

0x000408CC
<param>

SetNotifyIndex

0x00040180
0x6660420F - <param>

SetNotify

0x00040104
0x00000000
0x00040100
0x00000000

SetTransferDataMode

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

SetTransferDataOffset

0x0004230C
<source address>

0x00042310
<destination address>

0x00042328
0x00000000

SetTransferDataFormat

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

SetTransferLocation

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

SetTransferData

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

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

TODO

SetVertexTextureAddress

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

SetVertexDataArray

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

libgcm System Semaphores

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

Semaphores

Small Test

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