/* * ======== call ======== */ static VISA_Status call(VISA_Handle visaHandle, VISA_Msg visaMsg) { _VIDDEC2FRONT_Msg *msg = (_VIDDEC2FRONT_Msg *)visaMsg; VIDDEC2FRONT_Handle handle = (VIDDEC2FRONT_Handle)visaHandle; // Int i, j; // XDM1_BufDesc inBufs; // XDM_BufDesc outBufs; IVIDDEC2FRONT_OutArgs *pOutArgs; IVIDDEC2FRONT_Status *pStatus; // IVIDDEC2_CodecClassConfig *codecClassConfig; // Int numBufs; #if 0 /* get stub/skeleton config data; can be NULL (for old codecs) */ codecClassConfig = (IVIDDEC2_CodecClassConfig *) VISA_getCodecClassConfig( visaHandle ); #endif /* perform the requested VIDDEC2 operation by parsing message. */ switch (msg->visa.cmd) { case _VIDDEC2FRONT_CPROCESS: { #if 0 /* unmarshall inBufs and outBufs */ inBufs = msg->cmd.process.inBufs; outBufs.bufs = msg->cmd.process.outBufs; outBufs.numBufs = msg->cmd.process.numOutBufs; outBufs.bufSizes = msg->cmd.process.outBufSizes; /* invalidate cache for all input buffers */ for (i = 0, numBufs = 0; i < XDM_MAX_IO_BUFFERS; i++) { if (inBufs.descs[i].buf != NULL) { /* valid member of sparse array, * invalidate it unless user configured it not to */ if (codecClassConfig != NULL && codecClassConfig->manageInBufsCache[i] == FALSE) { /* do nothing, i.e. don't invalidate */ } else { Memory_cacheInv(inBufs.descs[i].buf, inBufs.descs[i].bufSize); } if (++numBufs == inBufs.numBufs) { break; } } } /* invalidate cache for all output buffers */ for (i = 0, numBufs = 0; i < XDM_MAX_IO_BUFFERS; i++) { if (outBufs.bufs[i] != NULL) { /* valid member of sparse array, * invalidate it unless user configured it not to */ if (codecClassConfig != NULL && codecClassConfig->manageOutBufsCache[i] == FALSE) { /* do nothing, i.e. don't invalidate */ } else { Memory_cacheInv(outBufs.bufs[i], outBufs.bufSizes[i]); } if (++numBufs == outBufs.numBufs) { break; } } } #endif /* unmarshall outArgs based on the "size" of inArgs */ pOutArgs = (IVIDDEC2FRONT_OutArgs *)((UInt)(&(msg->cmd.process.inArgs)) + msg->cmd.process.inArgs.size); /* * Note, there's no need to invalidate cache for * pOutArgs->decodedBuf bufs nor pOutArgs->displayBufs * bufs as the app doesn't provide OUT buffers to the * algorithm via these fields. */ /* make the process call */ msg->visa.status = VIDDEC2FRONT_process(handle, &(msg->cmd.process.inArgs), &(msg->cmd.process.context), pOutArgs); #if 0 /* * Writeback cache for all output buffers: * - .decodedBufs * - .displayBufs * - .mbDataBuf */ for (i = 0; (i < pOutArgs->decodedBufs.numBufs) && (i < IVIDEO_MAX_YUV_BUFFERS); i++) { if ((pOutArgs->decodedBufs.bufDesc[i].buf != NULL) && (XDM_ISACCESSMODE_WRITE( pOutArgs->decodedBufs.bufDesc[i].accessMask))) { Memory_cacheWb(pOutArgs->decodedBufs.bufDesc[i].buf, pOutArgs->decodedBufs.bufDesc[i].bufSize); } /* * Since we've cacheWb this buffer, we arguably should * reflect this cache state and clear the WRITE bit in * the .accessMask field. However, we know the stub * doesn't propogate this field to the calling app, so * this extra buffer management detail isn't necessary: * * XDM_CLEARACCESSMODE_WRITE( * outArgs->decodedBufs.bufDesc[i].accessMask); */ } for (i = 0; (pOutArgs->outputID[i] != 0) && (i < IVIDDEC2_MAX_IO_BUFFERS); i++) { for (j = 0; j < pOutArgs->displayBufs[i].numBufs; j++) { if ((pOutArgs->displayBufs[i].bufDesc[j].buf != NULL) && (XDM_ISACCESSMODE_WRITE( pOutArgs->displayBufs[i].bufDesc[j].accessMask))) { Memory_cacheWb(pOutArgs->displayBufs[i].bufDesc[j].buf, pOutArgs->displayBufs[i].bufDesc[j].bufSize); /* * Since we've cacheWb this buffer, we arguably should * reflect this cache state and clear the WRITE bit in * the .accessMask field. However, we know the stub * doesn't propogate this field to the calling app, so * this extra buffer management detail isn't necessary: * * XDM_CLEARACCESSMODE_WRITE( * outArgs->displayBufs.bufDesc[i].accessMask); */ } } } if ((pOutArgs->outputMbDataID != 0) && (pOutArgs->mbDataBuf.buf != NULL) && (XDM_ISACCESSMODE_WRITE(pOutArgs->mbDataBuf.accessMask))) { Memory_cacheWb(pOutArgs->mbDataBuf.buf, pOutArgs->mbDataBuf.bufSize); /* * Since we've cacheWb this buffer, we arguably should * reflect this cache state and clear the WRITE bit in * the .accessMask field. However, we know the stub * doesn't propogate this field to the calling app, so * this extra buffer management detail isn't necessary: * * XDM_CLEARACCESSMODE_WRITE(outArgs->mbDataBuf.accessMask); */ } #endif /* * Note that any changes to individual outBufs[i] values made by * the codec will automatically update msg->cmd.process.outBufs * as we pass the outBufs array by reference. */ break; } case _VIDDEC2FRONT_CCONTROL: { /* unmarshall status based on the "size" of params */ pStatus = (IVIDDEC2FRONT_Status *)((UInt)(&(msg->cmd.control.params)) + msg->cmd.control.params.size); #if 0 /* invalidate data buffer */ if (pStatus->data.buf != NULL) { Memory_cacheInv(pStatus->data.buf, pStatus->data.bufSize); } #endif msg->visa.status = VIDDEC2FRONT_control(handle, msg->cmd.control.id, &(msg->cmd.control.params), &(msg->cmd.control.context), pStatus); #if 0 /* writeback data buffer */ if ((pStatus->data.buf != NULL) && XDM_ISACCESSMODE_WRITE(pStatus->data.accessMask)) { Memory_cacheWb(pStatus->data.buf, pStatus->data.bufSize); /* * Since we've cacheWb this buffer, we arguably should * reflect this cache state and clear the WRITE bit in * the .accessMask field. However, we know the stub * doesn't propogate this field to the calling app, so * this extra buffer management detail isn't necessary: * * XDM_CLEARACCESSMODE_WRITE(pStatus->data.accessMask); */ } #endif break; } default: { msg->visa.status = VISA_EFAIL; break; } } return (VISA_EOK); }
/* * ======== call ======== */ static VISA_Status call(VISA_Handle visaHandle, VISA_Msg visaMsg) { _VIDDEC3_Msg *msg = (_VIDDEC3_Msg *)visaMsg; VIDDEC3_Handle handle = (VIDDEC3_Handle)visaHandle; Int i; XDM2_BufDesc inBufs; XDM2_BufDesc outBufs; IVIDDEC3_OutArgs *pOutArgs; IVIDDEC3_Status *pStatus; IVIDDEC3_CodecClassConfig *codecClassConfig; Int numBufs; Bool success; /* get stub/skeleton config data; can be NULL (for old codecs) */ codecClassConfig = (IVIDDEC3_CodecClassConfig *)VISA_getCodecClassConfig(visaHandle); /* perform the requested VIDDEC2 operation by parsing message. */ switch (msg->visa.cmd) { case _VIDDEC3_CPROCESS: { /* unmarshall inBufs and outBufs */ inBufs = msg->cmd.process.inBufs; outBufs = msg->cmd.process.outBufs; /* invalidate cache for all input buffers */ for (i = 0, numBufs = 0; i < XDM_MAX_IO_BUFFERS; i++) { if (inBufs.descs[i].buf != NULL) { /* valid member of sparse array, * invalidate it unless user configured it not to */ if (codecClassConfig != NULL && codecClassConfig->manageInBufsCache[i] == FALSE) { /* do nothing, i.e. don't invalidate */ } else { if (inBufs.descs[i].memType == XDM_MEMTYPE_RAW) { Memory_cacheInv(inBufs.descs[i].buf, inBufs.descs[i].bufSize.bytes); } else { /* TODO:H are tiled buffers cacheable? */ } } if (++numBufs == inBufs.numBufs) { break; } } } /* invalidate cache for all output buffers */ for (i = 0, numBufs = 0; i < XDM_MAX_IO_BUFFERS; i++) { if (outBufs.descs[i].buf != NULL) { /* valid member of sparse array, * invalidate it unless user configured it not to */ if (codecClassConfig != NULL && codecClassConfig->manageOutBufsCache[i] == FALSE) { /* do nothing, i.e. don't invalidate */ } else { if (outBufs.descs[i].memType == XDM_MEMTYPE_RAW) { Memory_cacheInv(outBufs.descs[i].buf, outBufs.descs[i].bufSize.bytes); } else { /* TODO:H are tiled buffers cacheable? */ } } if (++numBufs == outBufs.numBufs) { break; } } } /* unmarshall outArgs based on the "size" of inArgs */ pOutArgs = (IVIDDEC3_OutArgs *)((UInt)(&(msg->cmd.process.inArgs)) + msg->cmd.process.inArgs.size); /* * Note, there's no need to invalidate cache for * pOutArgs->decodedBuf bufs nor pOutArgs->displayBufs * bufs as the app doesn't provide OUT buffers to the * algorithm via these fields. */ /* make the process call */ msg->visa.status = VIDDEC3_process(handle, &inBufs, &outBufs, &(msg->cmd.process.inArgs), pOutArgs); /* * We probably should only be doing this if msg->visa.status * is IVIDDEC3_EOK or _EFAIL and .extendedError is non-fatal. */ /* * Writeback cache for all output buffers: * - .decodedBufs * - .displayBufs */ /* * ======== .decodedBufs ======== */ success = writebackVideo2BufDesc(&pOutArgs->decodedBufs); if (!success) { return (VISA_EFAIL); } /* * ======== .displayBufs ======== */ /* identify which mode the displayBufs are returned as */ if (pOutArgs->displayBufsMode == IVIDDEC3_DISPLAYBUFS_EMBEDDED) { /* the display buffers are embedded in the outArgs struct */ for (i = 0; (pOutArgs->outputID[i] != 0) && (i < IVIDEO2_MAX_IO_BUFFERS); i++) { success = writebackVideo2BufDesc( &(pOutArgs->displayBufs.bufDesc[i])); if (!success) { return (VISA_EFAIL); } } } else { /* the display buffers are pointed to in the outArgs struct */ for (i = 0; (pOutArgs->outputID[i] != 0) && (i < IVIDEO2_MAX_IO_BUFFERS); i++) { success = writebackVideo2BufDesc( pOutArgs->displayBufs.pBufDesc[i]); if (!success) { return (VISA_EFAIL); } } } /* * Note that any changes to individual outBufs[i] values made by * the codec will automatically update msg->cmd.process.outBufs * as we pass the outBufs array by reference. */ break; } case _VIDDEC3_CCONTROL: { /* unmarshall status based on the "size" of params */ pStatus = (IVIDDEC3_Status *)((UInt)(&(msg->cmd.control.params)) + msg->cmd.control.params.size); /* invalidate data buffer */ if (pStatus->data.buf != NULL) { Memory_cacheInv(pStatus->data.buf, pStatus->data.bufSize); } msg->visa.status = VIDDEC3_control(handle, msg->cmd.control.id, &(msg->cmd.control.params), pStatus); /* writeback data buffer */ if ((pStatus->data.buf != NULL) && XDM_ISACCESSMODE_WRITE(pStatus->data.accessMask)) { Memory_cacheWb(pStatus->data.buf, pStatus->data.bufSize); /* * Since we've cacheWb this buffer, we arguably should * reflect this cache state and clear the WRITE bit in * the .accessMask field. However, we know the stub * doesn't propogate this field to the calling app, so * this extra buffer management detail isn't necessary: * * XDM_CLEARACCESSMODE_WRITE(pStatus->data.accessMask); */ } break; } default: { msg->visa.status = VISA_EFAIL; break; } } return (VISA_EOK); }
/* * ======== call ======== */ static VISA_Status call(VISA_Handle visaHandle, VISA_Msg visaMsg) { _VIDDEC_Msg *msg = (_VIDDEC_Msg *)visaMsg; VIDDEC_Handle handle = (VIDDEC_Handle)visaHandle; Int i; XDM_BufDesc inBufs, outBufs; IVIDDEC_OutArgs *pOutArgs; IVIDDEC_Status *pStatus; IVIDDEC_CodecClassConfig *codecClassConfig; /* get stub/skeleton config data; can be NULL (for old codecs) */ codecClassConfig = (IVIDDEC_CodecClassConfig *) VISA_getCodecClassConfig( visaHandle ); /* perform the requested VIDDEC operation by parsing message. */ switch (msg->visa.cmd) { case _VIDDEC_CPROCESS: { /* unmarshall inBufs and outBufs since they differ in shape * from what their flattened versions passed in the message */ inBufs.bufs = msg->cmd.process.inBufs; inBufs.numBufs = msg->cmd.process.numInBufs; inBufs.bufSizes = msg->cmd.process.inBufSizes; outBufs.bufs = msg->cmd.process.outBufs; outBufs.numBufs = msg->cmd.process.numOutBufs; outBufs.bufSizes = msg->cmd.process.outBufSizes; if (SKEL_cachingPolicy == SKEL_LOCALBUFFERINVWB) { /* invalidate cache for all input buffers */ for (i = 0; i < inBufs.numBufs; i++) { if (codecClassConfig != NULL && codecClassConfig->manageInBufsCache[i] == FALSE) { continue; } Memory_cacheInv(inBufs.bufs[i], inBufs.bufSizes[i]); } /* invalidate cache for all output buffers */ for (i = 0; i < outBufs.numBufs; i++) { if (codecClassConfig != NULL && codecClassConfig->manageOutBufsCache[i] == FALSE) { continue; } Memory_cacheInv(outBufs.bufs[i], outBufs.bufSizes[i]); } } /* SKEL_cachingPolicy == SKEL_LOCALBUFFERINVWB */ /* unmarshall outArgs based on the "size" of inArgs */ pOutArgs = (IVIDDEC_OutArgs *)((UInt)(&(msg->cmd.process.inArgs)) + msg->cmd.process.inArgs.size); /* make the process call */ msg->visa.status = VIDDEC_process(handle, &inBufs, &outBufs, &(msg->cmd.process.inArgs), pOutArgs); if (SKEL_cachingPolicy == SKEL_WBINVALL) { Memory_cacheWbInvAll(); } else if (SKEL_cachingPolicy == SKEL_LOCALBUFFERINVWB) { /* flush cache for all output buffers and outArgs buffers * (unless...) */ for (i = 0; i < outBufs.numBufs; i++) { if (codecClassConfig != NULL && codecClassConfig->manageOutBufsCache[i] == FALSE) { continue; } Memory_cacheWb(outBufs.bufs[i], outBufs.bufSizes[i]); } for (i = 0; i < pOutArgs->displayBufs.numBufs; i++) { if (codecClassConfig != NULL && codecClassConfig->manageDisplayBufsCache[i] == FALSE) { continue; } Memory_cacheWbInv(pOutArgs->displayBufs.bufs[i], pOutArgs->displayBufs.bufSizes[i]); } } /* * Note that any changes to individual outBufs[i] values made by * the codec will automatically update msg->cmd.process.outBufs * as we pass the outBufs array by reference. */ break; } case _VIDDEC_CCONTROL: { /* unmarshall status based on the "size" of params */ pStatus = (IVIDDEC_Status *)((UInt)(&(msg->cmd.control.params)) + msg->cmd.control.params.size); msg->visa.status = VIDDEC_control(handle, msg->cmd.control.id, &(msg->cmd.control.params), pStatus); break; } default: { msg->visa.status = VISA_EFAIL; break; } } return (VISA_EOK); }
/* * ======== call ======== */ static VISA_Status call(VISA_Handle visaHandle, VISA_Msg visaMsg) { _VIDENC2_Msg *msg = (_VIDENC2_Msg *)visaMsg; VIDENC2_Handle handle = (VIDENC2_Handle)visaHandle; Int i; IVIDEO2_BufDesc inBufs; XDM2_BufDesc outBufs; IVIDENC2_OutArgs *pOutArgs; IVIDENC2_Status *pStatus; IVIDENC2_CodecClassConfig *codecClassConfig; Int numBufs; /* get stub/skeleton config data; can be NULL (for old codecs) */ codecClassConfig = (IVIDENC2_CodecClassConfig *) VISA_getCodecClassConfig(visaHandle); /* perform the requested VIDENC2 operation by parsing message. */ switch (msg->visa.cmd) { case _VIDENC2_CPROCESS: { /* unmarshall inBufs and outBufs */ inBufs = msg->cmd.process.inBufs; outBufs = msg->cmd.process.outBufs; /* Should assert inBufs.numPlanes and inBufs.numMetaPlanes * are < 3. */ /* invalidate cache for all input plane buffers */ for (i = 0; i < inBufs.numPlanes; i++) { if (inBufs.planeDesc[i].buf != NULL) { if ((codecClassConfig != NULL) && (codecClassConfig->manageInBufsPlaneDescCache[i] == FALSE)) { /* do nothing, i.e. don't invalidate */ } else { if (inBufs.planeDesc[i].memType == XDM_MEMTYPE_ROW) { Memory_cacheInv(inBufs.planeDesc[i].buf, inBufs.planeDesc[i].bufSize.bytes); } else { /* TODO:H are tiled buffers cacheable? */ } } } } /* invalidate cache for all input meta plane buffers */ for (i = 0; i < inBufs.numMetaPlanes; i++) { if (inBufs.metadataPlaneDesc[i].buf != NULL) { if ((codecClassConfig != NULL) && (codecClassConfig->manageInBufsMetaPlaneDescCache[i] == FALSE)) { /* do nothing, i.e. don't invalidate */ } else { if (inBufs.metadataPlaneDesc[i].memType == XDM_MEMTYPE_ROW) { Memory_cacheInv(inBufs.metadataPlaneDesc[i].buf, inBufs.metadataPlaneDesc[i].bufSize.bytes); } else { /* TODO:H are tiled buffers cacheable? */ } } } } /* invalidate cache for all output buffers */ for (i = 0, numBufs = 0; i < XDM_MAX_IO_BUFFERS; i++) { if (outBufs.descs[i].buf != NULL) { /* valid member of sparse array, * invalidate it unless user configured it not to */ if (codecClassConfig != NULL && codecClassConfig->manageOutBufsCache[i] == FALSE) { /* do nothing, i.e. don't invalidate */ } else { if (outBufs.descs[i].memType == XDM_MEMTYPE_ROW) { Memory_cacheInv(outBufs.descs[i].buf, outBufs.descs[i].bufSize.bytes); } else { /* TODO:H are tiled buffers cacheable? */ } } if (++numBufs == outBufs.numBufs) { break; } } } /* unmarshall outArgs based on the "size" of inArgs */ pOutArgs = (IVIDENC2_OutArgs *)((UInt)(&(msg->cmd.process.inArgs)) + msg->cmd.process.inArgs.size); /* * Note, there's no need to invalidate cache for * pOutArgs->encodedBuf bufs nor pOutArgs->reconBufs bufs as they're * not _really_ OUT buffers. Rather they're references to * the _real_ OUT buffers that are provided in outBufs - which * were already invalidated above. */ /* make the process call */ msg->visa.status = VIDENC2_process(handle, &inBufs, &outBufs, &(msg->cmd.process.inArgs), pOutArgs); #if 0 /* TODO! */ /* writeback cache for recon buffers */ for (i = 0; ((i < pOutArgs->reconBufs.numBufs) && (i < IVIDEO_MAX_YUV_BUFFERS)); i++) { if ((pOutArgs->reconBufs.bufDesc[i].buf != NULL) && (XDM_ISACCESSMODE_WRITE( pOutArgs->reconBufs.bufDesc[i].accessMask))) { Memory_cacheWb(pOutArgs->reconBufs.bufDesc[i].buf, pOutArgs->reconBufs.bufDesc[i].bufSize); /* * Since we've cacheWb this buffer, we arguably should * reflect this cache state and clear the WRITE bit in * the .accessMask field. However, we know the stub * doesn't propogate this field to the calling app, so * this extra buffer management detail isn't necessary: * * XDM_CLEARACCESSMODE_WRITE( * pOutArgs->reconBufs.bufDesc[i].accessMask); */ } } #endif /* TODO! */ /* * Note that any changes to individual outBufs[i] values made by * the codec will automatically update msg->cmd.process.outBufs * as we pass the outBufs array by reference. */ break; } case _VIDENC2_CCONTROL: { /* unmarshall status based on the "size" of params */ pStatus = (IVIDENC2_Status *)((UInt)(&(msg->cmd.control.params)) + msg->cmd.control.params.size); /* invalidate data buffer */ if (pStatus->data.buf != NULL) { Memory_cacheInv(pStatus->data.buf, pStatus->data.bufSize); } msg->visa.status = VIDENC2_control(handle, msg->cmd.control.id, &(msg->cmd.control.params), pStatus); /* writeback data buffer */ if ((pStatus->data.buf != NULL) && XDM_ISACCESSMODE_WRITE(pStatus->data.accessMask)) { Memory_cacheWb(pStatus->data.buf, pStatus->data.bufSize); /* * Since we've cacheWb this buffer, we arguably should * reflect this cache state and clear the WRITE bit in * the .accessMask field. However, we know the stub * doesn't propogate this field to the calling app, so * this extra buffer management detail isn't necessary: * * XDM_CLEARACCESSMODE_WRITE(pStatus->data.accessMask); */ } break; } default: { msg->visa.status = VISA_EFAIL; break; } } return (VISA_EOK); }