Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
radeon_ring.c File Reference
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <drm/drmP.h>
#include <drm/radeon_drm.h>
#include "radeon_reg.h"
#include "radeon.h"
#include "atom.h"

Go to the source code of this file.

Functions

int radeon_ib_get (struct radeon_device *rdev, int ring, struct radeon_ib *ib, struct radeon_vm *vm, unsigned size)
 
void radeon_ib_free (struct radeon_device *rdev, struct radeon_ib *ib)
 
int radeon_ib_schedule (struct radeon_device *rdev, struct radeon_ib *ib, struct radeon_ib *const_ib)
 
int radeon_ib_pool_init (struct radeon_device *rdev)
 
void radeon_ib_pool_fini (struct radeon_device *rdev)
 
int radeon_ib_ring_tests (struct radeon_device *rdev)
 
void radeon_ring_write (struct radeon_ring *ring, uint32_t v)
 
bool radeon_ring_supports_scratch_reg (struct radeon_device *rdev, struct radeon_ring *ring)
 
void radeon_ring_free_size (struct radeon_device *rdev, struct radeon_ring *ring)
 
int radeon_ring_alloc (struct radeon_device *rdev, struct radeon_ring *ring, unsigned ndw)
 
int radeon_ring_lock (struct radeon_device *rdev, struct radeon_ring *ring, unsigned ndw)
 
void radeon_ring_commit (struct radeon_device *rdev, struct radeon_ring *ring)
 
void radeon_ring_unlock_commit (struct radeon_device *rdev, struct radeon_ring *ring)
 
void radeon_ring_undo (struct radeon_ring *ring)
 
void radeon_ring_unlock_undo (struct radeon_device *rdev, struct radeon_ring *ring)
 
void radeon_ring_force_activity (struct radeon_device *rdev, struct radeon_ring *ring)
 
void radeon_ring_lockup_update (struct radeon_ring *ring)
 
bool radeon_ring_test_lockup (struct radeon_device *rdev, struct radeon_ring *ring)
 
unsigned radeon_ring_backup (struct radeon_device *rdev, struct radeon_ring *ring, uint32_t **data)
 
int radeon_ring_restore (struct radeon_device *rdev, struct radeon_ring *ring, unsigned size, uint32_t *data)
 
int radeon_ring_init (struct radeon_device *rdev, struct radeon_ring *ring, unsigned ring_size, unsigned rptr_offs, unsigned rptr_reg, unsigned wptr_reg, u32 ptr_reg_shift, u32 ptr_reg_mask, u32 nop)
 
void radeon_ring_fini (struct radeon_device *rdev, struct radeon_ring *ring)
 

Function Documentation

void radeon_ib_free ( struct radeon_device rdev,
struct radeon_ib ib 
)

radeon_ib_free - free an IB (Indirect Buffer)

: radeon_device pointer : IB object to free

Free an IB (all asics).

Definition at line 104 of file radeon_ring.c.

int radeon_ib_get ( struct radeon_device rdev,
int  ring,
struct radeon_ib ib,
struct radeon_vm vm,
unsigned  size 
)

radeon_ib_get - request an IB (Indirect Buffer)

: radeon_device pointer : ring index the IB is associated with : IB object returned : requested IB size

Request an IB (all asics). IBs are allocated using the suballocator. Returns 0 on success, error on failure.

Definition at line 60 of file radeon_ring.c.

void radeon_ib_pool_fini ( struct radeon_device rdev)

radeon_ib_pool_fini - Free the IB (Indirect Buffer) pool

: radeon_device pointer

Tear down the suballocator managing the pool of memory for use as IBs (all asics).

Definition at line 232 of file radeon_ring.c.

int radeon_ib_pool_init ( struct radeon_device rdev)

radeon_ib_pool_init - Init the IB (Indirect Buffer) pool

: radeon_device pointer

Initialize the suballocator to manage a pool of memory for use as IBs (all asics). Returns 0 on success, error on failure.

Definition at line 198 of file radeon_ring.c.

int radeon_ib_ring_tests ( struct radeon_device rdev)

radeon_ib_ring_tests - test IBs on the rings

: radeon_device pointer

Test an IB (Indirect Buffer) on each ring. If the test fails, disable the ring. Returns 0 on success, error if the primary GFX ring IB test fails.

Definition at line 251 of file radeon_ring.c.

int radeon_ib_schedule ( struct radeon_device rdev,
struct radeon_ib ib,
struct radeon_ib const_ib 
)

radeon_ib_schedule - schedule an IB (Indirect Buffer) on the ring

: radeon_device pointer : IB object to schedule : Const IB to schedule (SI only)

Schedule an IB on the associated ring (all asics). Returns 0 on success, error on failure.

On SI, there are two parallel engines fed from the primary ring, the CE (Constant Engine) and the DE (Drawing Engine). Since resource descriptors have moved to memory, the CE allows you to prime the caches while the DE is updating register state so that the resource descriptors will be already in cache when the draw is processed. To accomplish this, the userspace driver submits two IBs, one for the CE and one for the DE. If there is a CE IB (called a CONST_IB), it will be put on the ring prior to the DE IB. Prior to SI there was just a DE IB.

Definition at line 131 of file radeon_ring.c.

int radeon_ring_alloc ( struct radeon_device rdev,
struct radeon_ring ring,
unsigned  ndw 
)

radeon_ring_alloc - allocate space on the ring buffer

: radeon_device pointer : radeon_ring structure holding ring information : number of dwords to allocate in the ring buffer

Allocate dwords in the ring buffer (all asics). Returns 0 on success, error on failure.

Definition at line 376 of file radeon_ring.c.

unsigned radeon_ring_backup ( struct radeon_device rdev,
struct radeon_ring ring,
uint32_t **  data 
)

radeon_ring_backup - Back up the content of a ring

: radeon_device pointer : the ring we want to back up

Saves all unprocessed commits from a ring, returns the number of dwords saved.

Definition at line 573 of file radeon_ring.c.

void radeon_ring_commit ( struct radeon_device rdev,
struct radeon_ring ring 
)

radeon_ring_commit - tell the GPU to execute the new commands on the ring buffer

: radeon_device pointer : radeon_ring structure holding ring information

Update the wptr (write pointer) to tell the GPU to execute new commands on the ring buffer (all asics).

Definition at line 431 of file radeon_ring.c.

void radeon_ring_fini ( struct radeon_device rdev,
struct radeon_ring ring 
)

radeon_ring_fini - tear down the driver ring struct.

: radeon_device pointer : radeon_ring structure holding ring information

Tear down the driver information for the selected ring (all asics).

Definition at line 737 of file radeon_ring.c.

void radeon_ring_force_activity ( struct radeon_device rdev,
struct radeon_ring ring 
)

radeon_ring_force_activity - add some nop packets to the ring

: radeon_device pointer : radeon_ring structure holding ring information

Add some nop packets to the ring to force activity (all asics). Used for lockup detection to see if the rptr is advancing.

Definition at line 491 of file radeon_ring.c.

void radeon_ring_free_size ( struct radeon_device rdev,
struct radeon_ring ring 
)

radeon_ring_free_size - update the free size

: radeon_device pointer : radeon_ring structure holding ring information

Update the free dw slots in the ring buffer (all asics).

Definition at line 348 of file radeon_ring.c.

int radeon_ring_init ( struct radeon_device rdev,
struct radeon_ring ring,
unsigned  ring_size,
unsigned  rptr_offs,
unsigned  rptr_reg,
unsigned  wptr_reg,
u32  ptr_reg_shift,
u32  ptr_reg_mask,
u32  nop 
)

radeon_ring_init - init driver ring struct.

: radeon_device pointer : radeon_ring structure holding ring information : size of the ring : offset of the rptr writeback location in the WB buffer : MMIO offset of the rptr register : MMIO offset of the wptr register : bit offset of the rptr/wptr values : bit mask of the rptr/wptr values : nop packet for this ring

Initialize the driver information for the selected ring (all asics). Returns 0 on success, error on failure.

Definition at line 675 of file radeon_ring.c.

int radeon_ring_lock ( struct radeon_device rdev,
struct radeon_ring ring,
unsigned  ndw 
)

radeon_ring_lock - lock the ring and allocate space on it

: radeon_device pointer : radeon_ring structure holding ring information : number of dwords to allocate in the ring buffer

Lock the ring and allocate dwords in the ring buffer (all asics). Returns 0 on success, error on failure.

Definition at line 408 of file radeon_ring.c.

void radeon_ring_lockup_update ( struct radeon_ring ring)

radeon_ring_force_activity - update lockup variables

: radeon_ring structure holding ring information

Update the last rptr value and timestamp (all asics).

Definition at line 512 of file radeon_ring.c.

int radeon_ring_restore ( struct radeon_device rdev,
struct radeon_ring ring,
unsigned  size,
uint32_t data 
)

radeon_ring_restore - append saved commands to the ring again

: radeon_device pointer : ring to append commands to : number of dwords we want to write : saved commands

Allocates space on the ring and restore the previously saved commands.

Definition at line 637 of file radeon_ring.c.

bool radeon_ring_supports_scratch_reg ( struct radeon_device rdev,
struct radeon_ring ring 
)

radeon_ring_supports_scratch_reg - check if the ring supports writing to scratch registers

: radeon_device pointer : radeon_ring structure holding ring information

Check if a specific ring supports writing to scratch registers (all asics). Returns true if the ring supports writing to scratch regs, false if not.

Definition at line 327 of file radeon_ring.c.

bool radeon_ring_test_lockup ( struct radeon_device rdev,
struct radeon_ring ring 
)

radeon_ring_test_lockup() - check if ring is lockedup by recording information : radeon device structure : radeon_ring structure holding ring information

We don't need to initialize the lockup tracking information as we will either have CP rptr to a different value of jiffies wrap around which will force initialization of the lockup tracking informations.

A possible false positivie is if we get call after while and last_cp_rptr == the current CP rptr, even if it's unlikely it might happen. To avoid this if the elapsed time since last call is bigger than 2 second than we return false and update the tracking information. Due to this the caller must call radeon_ring_test_lockup several time in less than 2sec for lockup to be reported the fencing code should be cautious about that.

Caller should write to the ring to force CP to do something so we don't get false positive when CP is just gived nothing to do.

Definition at line 538 of file radeon_ring.c.

void radeon_ring_undo ( struct radeon_ring ring)

radeon_ring_undo - reset the wptr

: radeon_ring structure holding ring information

Reset the driver's copy of the wtpr (all asics).

Definition at line 464 of file radeon_ring.c.

void radeon_ring_unlock_commit ( struct radeon_device rdev,
struct radeon_ring ring 
)

radeon_ring_unlock_commit - tell the GPU to execute the new commands on the ring buffer and unlock it

: radeon_device pointer : radeon_ring structure holding ring information

Call radeon_ring_commit() then unlock the ring (all asics).

Definition at line 451 of file radeon_ring.c.

void radeon_ring_unlock_undo ( struct radeon_device rdev,
struct radeon_ring ring 
)

radeon_ring_unlock_undo - reset the wptr and unlock the ring

: radeon_ring structure holding ring information

Call radeon_ring_undo() then unlock the ring (all asics).

Definition at line 476 of file radeon_ring.c.

void radeon_ring_write ( struct radeon_ring ring,
uint32_t  v 
)

radeon_ring_write - write a value to the ring

: radeon_ring structure holding ring information : dword (dw) value to write

Write a value to the requested ring buffer (all asics).

Definition at line 304 of file radeon_ring.c.