Commit e91f18db authored by Dafna Hirschfeld's avatar Dafna Hirschfeld
Browse files

get rid of coda9 type in SecAxiInfo.



1. the struct SecAxiInfo has a union that can
be either 'coda9' or 'wave'. Remove coda9 and make
it not a union.
2. remove the function ConfigSecAXICoda9
Signed-off-by: Dafna Hirschfeld's avatarDafna Hirschfeld <dafna.hirschfeld@collabora.com>
parent 70c87c02
......@@ -1890,17 +1890,12 @@ RetCode VPU_DecGiveCommand(DecHandle handle, CodecCommand cmd, void* param)
}
}
}
pDecInfo->secAxiInfo.u.wave.useIpEnable = secAxiUse.u.wave.useIpEnable;
pDecInfo->secAxiInfo.u.wave.useLfRowEnable = secAxiUse.u.wave.useLfRowEnable;
pDecInfo->secAxiInfo.u.wave.useBitEnable = secAxiUse.u.wave.useBitEnable;
pDecInfo->secAxiInfo.wave.useIpEnable = secAxiUse.u.wave.useIpEnable;
pDecInfo->secAxiInfo.wave.useLfRowEnable = secAxiUse.u.wave.useLfRowEnable;
pDecInfo->secAxiInfo.wave.useBitEnable = secAxiUse.u.wave.useBitEnable;
}
else {
pDecInfo->secAxiInfo.u.coda9.useBitEnable = secAxiUse.u.coda9.useBitEnable;
pDecInfo->secAxiInfo.u.coda9.useIpEnable = secAxiUse.u.coda9.useIpEnable;
pDecInfo->secAxiInfo.u.coda9.useDbkYEnable = secAxiUse.u.coda9.useDbkYEnable;
pDecInfo->secAxiInfo.u.coda9.useDbkCEnable = secAxiUse.u.coda9.useDbkCEnable;
pDecInfo->secAxiInfo.u.coda9.useOvlEnable = secAxiUse.u.coda9.useOvlEnable;
pDecInfo->secAxiInfo.u.coda9.useBtpEnable = secAxiUse.u.coda9.useBtpEnable;
WARN_ONCE(1, "%s: bad product id\n", __func__);
}
break;
......@@ -3140,16 +3135,11 @@ RetCode VPU_EncGiveCommand(
}
secAxiUse = *(SecAxiUse *)param;
if (handle->productId == PRODUCT_ID_521) {
pEncInfo->secAxiInfo.u.wave.useEncRdoEnable = secAxiUse.u.wave.useEncRdoEnable;
pEncInfo->secAxiInfo.u.wave.useEncLfEnable = secAxiUse.u.wave.useEncLfEnable;
pEncInfo->secAxiInfo.wave.useEncRdoEnable = secAxiUse.u.wave.useEncRdoEnable;
pEncInfo->secAxiInfo.wave.useEncLfEnable = secAxiUse.u.wave.useEncLfEnable;
}
else { // coda9 or coda7q or ...
pEncInfo->secAxiInfo.u.coda9.useBitEnable = secAxiUse.u.coda9.useBitEnable;
pEncInfo->secAxiInfo.u.coda9.useIpEnable = secAxiUse.u.coda9.useIpEnable;
pEncInfo->secAxiInfo.u.coda9.useDbkYEnable = secAxiUse.u.coda9.useDbkYEnable;
pEncInfo->secAxiInfo.u.coda9.useDbkCEnable = secAxiUse.u.coda9.useDbkCEnable;
pEncInfo->secAxiInfo.u.coda9.useOvlEnable = secAxiUse.u.coda9.useOvlEnable;
pEncInfo->secAxiInfo.u.coda9.useBtpEnable = secAxiUse.u.coda9.useBtpEnable;
WARN_ONCE(1, "%s: bad product id\n", __func__);
}
}
break;
......
......@@ -823,281 +823,6 @@ RetCode AllocateTiledFrameBufferGdiV2(
return RETCODE_SUCCESS;
}
Int32 ConfigSecAXICoda9(Uint32 coreIdx, Int32 codecMode, SecAxiInfo *sa, Uint32 width, Uint32 height, Uint32 profile)
{
vpu_buffer_t vb;
Uint32 offset;
Uint32 MbNumX = ((width & 0xFFFF) + 15) / 16;
Uint32 MbNumY = ((height & 0xFFFF) + 15) / 16;
Uint32 productId;
if (vdi_get_sram_memory(coreIdx, &vb) < 0) {
return 0;
}
productId = ProductVpuGetId(coreIdx);
if (!vb.size) {
sa->bufSize = 0;
sa->u.coda9.useBitEnable = 0;
sa->u.coda9.useIpEnable = 0;
sa->u.coda9.useDbkYEnable = 0;
sa->u.coda9.useDbkCEnable = 0;
sa->u.coda9.useOvlEnable = 0;
sa->u.coda9.useBtpEnable = 0;
return 0;
}
sa->bufBase = vb.phys_addr;
offset = 0;
//BIT
if (sa->u.coda9.useBitEnable) {
sa->u.coda9.useBitEnable = 1;
sa->u.coda9.bufBitUse = vb.phys_addr + offset;
switch (codecMode)
{
case AVC_DEC:
offset = offset + MbNumX * 144;
break; // AVC
case RV_DEC:
offset = offset + MbNumX * 128;
break;
case VC1_DEC:
offset = offset + MbNumX * 64;
break;
case AVS_DEC:
offset = offset + ((MbNumX + 3)&~3) * 32;
break;
case MP2_DEC:
offset = offset + MbNumX * 0;
break;
case VPX_DEC:
offset = offset + MbNumX * 0;
break;
case AVC_ENC:
{
if (productId == PRODUCT_ID_960) {
offset = offset + MbNumX * 128;
}
else {
if (MbNumX > 128) offset = offset + MbNumX * 16;
}
}
break;
case MP4_ENC:
offset = offset + MbNumX * 16;
break;
default:
offset = offset + MbNumX * 16;
break; // MPEG-4, Divx3
}
if (offset > vb.size)
{
sa->bufSize = 0;
return 0;
}
}
//Intra Prediction, ACDC
if (sa->u.coda9.useIpEnable)
{
sa->u.coda9.bufIpAcDcUse = vb.phys_addr + offset;
sa->u.coda9.useIpEnable = 1;
switch (codecMode)
{
case AVC_DEC:
offset = offset + MbNumX * 64;
break; // AVC
case RV_DEC:
offset = offset + MbNumX * 64;
break;
case VC1_DEC:
offset = offset + MbNumX * 128;
break;
case AVS_DEC:
offset = offset + MbNumX * 64;
break;
case MP2_DEC:
offset = offset + MbNumX * 0;
break;
case VPX_DEC:
offset = offset + MbNumX * 64;
break;
case AVC_ENC:
offset = offset + MbNumX * 64;
break;
case MP4_ENC:
offset = offset + MbNumX * 128;
break;
default:
offset = offset + MbNumX * 128;
break; // MPEG-4, Divx3
}
if (offset > vb.size)
{
sa->bufSize = 0;
return 0;
}
}
//Deblock Chroma
if (sa->u.coda9.useDbkCEnable)
{
sa->u.coda9.bufDbkCUse = vb.phys_addr + offset;
sa->u.coda9.useDbkCEnable = 1;
switch (codecMode)
{
case AVC_DEC:
offset = (profile==66/*AVC BP decoder*/) ? offset + (MbNumX * 64) : offset + (MbNumX * 128);
break; // AVC
case RV_DEC:
offset = offset + MbNumX * 128;
break;
case VC1_DEC:
offset = profile==2 ? offset + MbNumX * 256 : offset + MbNumX * 128;
break;
case AVS_DEC:
offset = offset + MbNumX * 64;
break;
case MP2_DEC:
offset = offset + MbNumX * 64;
break;
case VPX_DEC:
offset = offset + MbNumX * 128;
break;
case MP4_DEC:
offset = offset + MbNumX * 64;
break;
case AVC_ENC:
offset = offset + MbNumX * 64;
break;
case MP4_ENC:
offset = offset + MbNumX * 64;
break;
default:
offset = offset + MbNumX * 64;
break;
}
if (offset > vb.size)
{
sa->bufSize = 0;
return 0;
}
}
//Deblock Luma
if (sa->u.coda9.useDbkYEnable)
{
sa->u.coda9.bufDbkYUse = vb.phys_addr + offset;
sa->u.coda9.useDbkYEnable = 1;
switch (codecMode)
{
case AVC_DEC:
offset = (profile==66/*AVC BP decoder*/)? offset + (MbNumX * 64) : offset + (MbNumX * 128);
break; // AVC
case RV_DEC:
offset = offset + MbNumX * 128;
break;
case VC1_DEC:
offset = profile==2 ? offset + MbNumX * 256 : offset + MbNumX * 128;
break;
case AVS_DEC:
offset = offset + MbNumX * 64;
break;
case MP2_DEC:
offset = offset + MbNumX * 128;
break;
case VPX_DEC:
offset = offset + MbNumX * 128;
break;
case MP4_DEC:
offset = offset + MbNumX * 64;
break;
case AVC_ENC:
offset = offset + MbNumX * 64;
break;
case MP4_ENC:
offset = offset + MbNumX * 64;
break;
default:
offset = offset + MbNumX * 128;
break;
}
if (offset > vb.size)
{
sa->bufSize = 0;
return 0;
}
}
// check the buffer address which is 256 byte is available.
if (((offset + 255) & (~255)) > vb.size) {
VLOG(ERR, "%s:%d NOT ENOUGH SRAM: required(%d), sram(%d)\n", __FUNCTION__, __LINE__, offset, vb.size);
sa->bufSize = 0;
return 0;
}
//VC1 Bit-plane
if (sa->u.coda9.useBtpEnable)
{
if (codecMode != VC1_DEC)
{
sa->u.coda9.useBtpEnable = 0;
}
else
{
int oneBTP;
offset = ((offset+255)&~255);
sa->u.coda9.bufBtpUse = vb.phys_addr + offset;
sa->u.coda9.useBtpEnable = 1;
oneBTP = (((MbNumX+15)/16) * MbNumY + 1) * 2;
oneBTP = (oneBTP%256) ? ((oneBTP/256)+1)*256 : oneBTP;
offset = offset + oneBTP * 3;
if (offset > vb.size)
{
sa->bufSize = 0;
return 0;
}
}
}
//VC1 Overlap
if (sa->u.coda9.useOvlEnable)
{
if (codecMode != VC1_DEC)
{
sa->u.coda9.useOvlEnable = 0;
}
else
{
sa->u.coda9.bufOvlUse = vb.phys_addr + offset;
sa->u.coda9.useOvlEnable = 1;
offset = offset + MbNumX * 80;
if (offset > vb.size)
{
sa->bufSize = 0;
return 0;
}
}
}
sa->bufSize = offset;
return 1;
}
static int GetXY2AXILogic(int map_val , int xpos, int ypos, int tb)
{
int invert;
......
......@@ -124,21 +124,6 @@ extern VpuAttr g_VpuCoreAttributes[MAX_NUM_VPU_CORE];
* PRODUCT: CODA9/WAVE5
*/
typedef struct {
union {
struct {
int useBitEnable;
int useIpEnable;
int useDbkYEnable;
int useDbkCEnable;
int useOvlEnable;
int useBtpEnable;
PhysicalAddress bufBitUse;
PhysicalAddress bufIpAcDcUse;
PhysicalAddress bufDbkYUse;
PhysicalAddress bufDbkCUse;
PhysicalAddress bufOvlUse;
PhysicalAddress bufBtpUse;
} coda9;
struct {
int useIpEnable;
int useLfRowEnable;
......@@ -146,7 +131,6 @@ typedef struct {
int useEncRdoEnable;
int useEncLfEnable;
} wave;
} u;
int bufSize;
PhysicalAddress bufBase;
} SecAxiInfo;
......@@ -903,7 +887,6 @@ RetCode SetParaSet(DecHandle handle, int paraSetType, DecParamSet * para);
void DecSetHostParaAddr(Uint32 coreIdx, PhysicalAddress baseAddr, PhysicalAddress paraAddr);
RetCode CheckInstanceValidity(CodecInst* pCodecInst);
Int32 ConfigSecAXICoda9(Uint32 coreIdx, Int32 codecMode, SecAxiInfo* sa, Uint32 width, Uint32 height, Uint32 profile);
RetCode UpdateFrameBufferAddr(TiledMapType mapType, FrameBuffer* fbArr, Uint32 numOfFrameBuffers, Uint32 sizeLuma, Uint32 sizeChroma);
RetCode AllocateTiledFrameBufferGdiV1(TiledMapType mapType, PhysicalAddress tiledBaseAddr, FrameBuffer* fbArr, Uint32 numOfFrameBuffers, Uint32 sizeLuma, Uint32 sizeChroma, DRAMConfig* pDramCfg);
RetCode AllocateTiledFrameBufferGdiV2(TiledMapType mapType, FrameBuffer* fbArr, Uint32 numOfFrameBuffers, Uint32 sizeLuma, Uint32 sizeChroma);
......
......@@ -1144,9 +1144,9 @@ RetCode Wave5VpuDecode(CodecInst* instance, DecParam* option)
VpuWriteReg(instance->coreIdx, W5_BS_OPTION, bsOption);
/* Secondary AXI */
regVal = (pDecInfo->secAxiInfo.u.wave.useBitEnable<<0) |
(pDecInfo->secAxiInfo.u.wave.useIpEnable<<9) |
(pDecInfo->secAxiInfo.u.wave.useLfRowEnable<<15);
regVal = (pDecInfo->secAxiInfo.wave.useBitEnable<<0) |
(pDecInfo->secAxiInfo.wave.useIpEnable<<9) |
(pDecInfo->secAxiInfo.wave.useLfRowEnable<<15);
VpuWriteReg(instance->coreIdx, W5_USE_SEC_AXI, regVal);
/* Set attributes of User buffer */
......@@ -2944,7 +2944,7 @@ RetCode Wave5VpuEncode(CodecInst* instance, EncParam* option)
VpuWriteReg(coreIdx, W5_CMD_ENC_PIC_SRC_AXI_SEL, DEFAULT_SRC_AXI);
/* Secondary AXI */
regVal = (pEncInfo->secAxiInfo.u.wave.useEncRdoEnable << 11) | (pEncInfo->secAxiInfo.u.wave.useEncLfEnable << 15);
regVal = (pEncInfo->secAxiInfo.wave.useEncRdoEnable << 11) | (pEncInfo->secAxiInfo.wave.useEncLfEnable << 15);
VpuWriteReg(coreIdx, W5_CMD_ENC_PIC_USE_SEC_AXI, regVal);
regVal = 0;
......@@ -3265,7 +3265,7 @@ RetCode Wave5VpuEncGetHeader(EncHandle instance, EncHeaderParam * encHeaderParam
pEncInfo->streamBufEndAddr = encHeaderParam->buf + encHeaderParam->size;
/* Secondary AXI */
regVal = (pEncInfo->secAxiInfo.u.wave.useEncRdoEnable << 11) | (pEncInfo->secAxiInfo.u.wave.useEncLfEnable << 15);
regVal = (pEncInfo->secAxiInfo.wave.useEncRdoEnable << 11) | (pEncInfo->secAxiInfo.wave.useEncLfEnable << 15);
VpuWriteReg(coreIdx, W5_CMD_ENC_PIC_USE_SEC_AXI, regVal);
VpuWriteReg(coreIdx, W5_CMD_ENC_PIC_CODE_OPTION, (encHeaderParam->headerType) | (encHeaderParam->encodeAUD<<5));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment