Codec Engine skelCachingPolicy

From Texas Instruments Embedded Processors Wiki

Jump to: navigation, search
Translate this page to   

Software: Codec Engine skelCachingPolicy
Hardware supported OMAP3, DM644x, DM646x, OMAPL13x, TI81xx, C647x
Software environment(s) BIOS
Status Stable

The Server.skelCachingPolicy feature was introduced in Codec Engine 2.25.02.

Introduction

For remote execution of codecs, the DSP server manages cache for I/O buffers exchanged between the codec (running on the DSP) and the ARM side app. The cache management is performed in the "skeleton" for the codec. The default cache management policy is for the skeleton to invalidate the input and output buffers from the DSP cache, before calling the codec's process() function. After returning from the process() function, the skeleton then performs a cache writeback of output buffers to ensure that CPU writes to the cache are flushed to external memory. Below is a section of code from the sphenc_skel.c illustrating the default caching policy:

/* invalidate cache for all input buffers */
for (i = 0; i < inBufs.numBufs; i++) {
    Memory_cacheInv(inBufs.bufs[i], inBufs.bufSizes[i]);
}
 
/* invalidate cache for all output buffers */
for (i = 0; i < outBufs.numBufs; i++) {
    Memory_cacheInv(outBufs.bufs[i], outBufs.bufSizes[i]);
}
 
/* unmarshall outArgs based on the "size" of inArgs */
pOutArgs = (ISPHENC_OutArgs *)((UInt)(&(msg->cmd.process.inArgs)) +
        msg->cmd.process.inArgs.size);
 
/* make the process call */
msg->visa.status = SPHENC_process(handle,
        &inBufs, &outBufs, &(msg->cmd.process.inArgs), pOutArgs);
 
/* writeback the cache for all output buffers  */
for (i = 0; i < outBufs.numBufs; i++) {
    Memory_cacheWb(outBufs.bufs[i], outBufs.bufSizes[i]);
}

The default cache management policy is conservative in that it guarantees correctness, but it does not necessarily give optimal performance. For example, if the buffer sizes are very large, the cost of performing the Memory_cacheInv() before processing and Memory_cacheWb() after processing, may be greater than performing a single Memory_cacheWbInvAll() after processing. However, to ensure correctness if the Memory_cacheInv() and Memory_cacheWb() calls are replaced with a single Memory_cacheWbInvAll(), the system must ensure that the following conditions are met:

The Server.skelCachingPolicy feature allows the system designer to choose one of the three cache management policies used by the skeletons:

Configuration

The Server module has an new configuration parameter, skelCachingPolicy, which can be set to one of the following values:

Here is an example configuration in a server's configuration file:

var Server = xdc.useModule('ti.sdo.ce.Server');
Server.skelCachingPolicy = Server.WBINVALL;

See Also

Leave a Comment
Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox