40.4.1.2 Ring Buffer Allocation
The instruction Ring Buffer (RB) is a contiguous memory area shared between the processor and the graphics engine. The size of the ring buffer is 24 x (GFX2D_LEN.LEN+1) bytes.
It is an efficient and effective means of passing instructions to the graphics. It is non-blocking and it facilitates batch processing of surfaces. The total RB length is software-programmable, and is a multiple of the RB memory allocation unit. A large RB is recommended to reduce CPU intervention.
Use the following software procedure to allocate a new ring buffer:
- Wait for command completion by polling the GFX2D_GS.BUSY bit.
- Disable the ring buffer by writing to GFX2D_GD.DISABLE.
- Initialize the tail and head pointers by setting GFX2D_HEAD.HEAD and GFX2D_TAIL.TAIL to ‘0’.
- Program the ring buffer base address by setting GFX2D_BASE.BASE to the base address. The address must be 24 bytes aligned.
- Program the ring buffer length by setting GFX2D_LEN.LEN to the length.
- Enable the ring buffer by writing to GFX2D_GE.ENABLE.