diff --git a/media_driver/Android.mk b/media_driver/Android.mk index 23da14625..0ad833133 100644 --- a/media_driver/Android.mk +++ b/media_driver/Android.mk @@ -579,6 +579,7 @@ LOCAL_SRC_FILES := \ ../media_softlet/linux/common/os/i915/xf86drmRandom.c \ ../media_softlet/linux/common/os/i915_production/mos_bufmgr.c \ ../media_softlet/linux/common/os/i915_production/mos_bufmgr_prelim.cpp \ + ../media_softlet/linux/common/os/xe/mos_synchronization_xe.c \ ../media_softlet/linux/common/os/mos_auxtable_mgr.cpp \ ../media_softlet/linux/common/os/mos_commandbuffer_specific_next.cpp \ ../media_softlet/linux/common/os/mos_context_specific_next.cpp \ @@ -1949,6 +1950,7 @@ LOCAL_C_INCLUDES = \ $(LOCAL_PATH)/../media_softlet/linux/common/os/i915/include \ $(LOCAL_PATH)/../media_softlet/linux/common/os/i915_production/include \ $(LOCAL_PATH)/../media_softlet/linux/common/os/i915_production \ + $(LOCAL_PATH)/../media_softlet/linux/common/os/xe/include \ $(LOCAL_PATH)/../media_softlet/linux/common/os \ $(LOCAL_PATH)/../media_softlet/linux/common/cp/ddi \ $(LOCAL_PATH)/../media_softlet/linux/common/cp \ diff --git a/media_driver/agnostic/common/vp/hal/vphal.cpp b/media_driver/agnostic/common/vp/hal/vphal.cpp index 1fbc847bd..b3e814c6a 100755 --- a/media_driver/agnostic/common/vp/hal/vphal.cpp +++ b/media_driver/agnostic/common/vp/hal/vphal.cpp @@ -648,13 +648,14 @@ MOS_STATUS VphalState::Render( if (VpHal_IsAvsSampleForMultiStreamsEnabled(pcRenderParams)) { eStatus = VpHal_RenderWithAvsForMultiStreams(m_renderer, pcRenderParams); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); goto finish; } // default render of video RenderParams.bIsDefaultStream = true; eStatus = m_renderer->Render((PCVPHAL_RENDER_PARAMS)(&RenderParams)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); finish: return eStatus; } diff --git a/media_driver/agnostic/common/vp/hal/vphal_render_common.c b/media_driver/agnostic/common/vp/hal/vphal_render_common.c index 1e64432a1..606d32e49 100644 --- a/media_driver/agnostic/common/vp/hal/vphal_render_common.c +++ b/media_driver/agnostic/common/vp/hal/vphal_render_common.c @@ -726,24 +726,25 @@ MOS_STATUS VpHal_RndrSubmitCommands( // Allocate all available space, unused buffer will be returned later VPHAL_RENDER_CHK_STATUS(pOsInterface->pfnGetCommandBuffer(pOsInterface, &CmdBuffer, 0)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Set initial state iRemaining = CmdBuffer.iRemaining; VPHAL_RENDER_CHK_STATUS(VpHal_RndrCommonSetPowerMode( pRenderHalLegacy, KernelID)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); #ifndef EMUL if (bLastSubmission && pOsInterface->bEnableKmdMediaFrameTracking) { + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Get GPU Status buffer VPHAL_RENDER_CHK_STATUS(pOsInterface->pfnGetGpuStatusBufferResource(pOsInterface, gpuStatusBuffer)); VPHAL_RENDER_CHK_NULL(gpuStatusBuffer); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Register the buffer VPHAL_RENDER_CHK_STATUS(pOsInterface->pfnRegisterResource(pOsInterface, gpuStatusBuffer, true, true)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); GenericPrologParams.bEnableMediaFrameTracking = true; GenericPrologParams.presMediaFrameTrackingSurface = gpuStatusBuffer; GenericPrologParams.dwMediaFrameTrackingTag = pOsInterface->pfnGetGpuStatusTag(pOsInterface, pOsInterface->CurrentGpuContextOrdinal); @@ -761,68 +762,73 @@ MOS_STATUS VpHal_RndrSubmitCommands( HalOcaInterface::DumpVpKernelInfo(CmdBuffer, (MOS_CONTEXT_HANDLE)pOsContext, KernelID, FcKernelCount, FcKernelList); // Add vphal param to log. HalOcaInterface::DumpVphalParam(CmdBuffer, (MOS_CONTEXT_HANDLE)pOsContext, pRenderHalLegacy->pVphalOcaDumper); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Initialize command buffer and insert prolog VPHAL_RENDER_CHK_STATUS(pRenderHalLegacy->pfnInitCommandBuffer(pRenderHalLegacy, &CmdBuffer, &GenericPrologParams)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(pPerfProfiler->AddPerfCollectStartCmd((void*)pRenderHalLegacy, pOsInterface, pMhwMiInterface, &CmdBuffer)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(NullHW::StartPredicate(pOsInterface, pRenderHalLegacy->pMhwMiInterface, &CmdBuffer)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Write timing data for 3P budget VPHAL_RENDER_CHK_STATUS(pRenderHalLegacy->pfnSendTimingData(pRenderHalLegacy, &CmdBuffer, true)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); bEnableSLM = (pGpGpuWalkerParams && pGpGpuWalkerParams->SLMSize > 0)? true : false; VPHAL_RENDER_CHK_STATUS(pRenderHalLegacy->pfnSetCacheOverrideParams( pRenderHalLegacy, &pRenderHalLegacy->L3CacheSettings, bEnableSLM)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); if (pRenderHalLegacy->bCmfcCoeffUpdate) { + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(pRenderHalLegacy->pfnSendCscCoeffSurface(pRenderHalLegacy, &CmdBuffer, pRenderHalLegacy->pCmfcCoeffSurface, pRenderHalLegacy->pStateHeap->pKernelAllocation[pRenderHalLegacy->iKernelAllocationID].pKernelEntry)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Flush media states VPHAL_RENDER_CHK_STATUS(pRenderHalLegacy->pfnSendMediaStates( pRenderHalLegacy, &CmdBuffer, pWalkerParams, pGpGpuWalkerParams)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); if (pBatchBuffer) - { + {ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Register batch buffer for rendering VPHAL_RENDER_CHK_STATUS(pOsInterface->pfnRegisterResource( pOsInterface, &pBatchBuffer->OsResource, false, true)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); HalOcaInterface::OnSubLevelBBStart(CmdBuffer, (MOS_CONTEXT_HANDLE)pOsContext, &pBatchBuffer->OsResource, 0, true, 0); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Send Start 2nd level batch buffer command (HW/OS dependent) VPHAL_RENDER_CHK_STATUS(pMhwMiInterface->AddMiBatchBufferStartCmd( &CmdBuffer, pBatchBuffer)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } // Write back GPU Status tag if (!pOsInterface->bEnableKmdMediaFrameTracking) { + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(pRenderHalLegacy->pfnSendRcsStatusTag(pRenderHalLegacy, &CmdBuffer)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(NullHW::StopPredicate(pOsInterface, pRenderHalLegacy->pMhwMiInterface, &CmdBuffer)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(pPerfProfiler->AddPerfCollectEndCmd((void*)pRenderHalLegacy, pOsInterface, pMhwMiInterface, &CmdBuffer)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Write timing data for 3P budget VPHAL_RENDER_CHK_STATUS(pRenderHalLegacy->pfnSendTimingData(pRenderHalLegacy, &CmdBuffer, false)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); if (GFX_IS_GEN_9_OR_LATER(pRenderHalLegacy->Platform)) { MHW_PIPE_CONTROL_PARAMS PipeControlParams; @@ -832,13 +838,16 @@ MOS_STATUS VpHal_RndrSubmitCommands( PipeControlParams.bGenericMediaStateClear = true; PipeControlParams.bIndirectStatePointersDisable = true; PipeControlParams.bDisableCSStall = false; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(pMhwMiInterface->AddPipeControl(&CmdBuffer, nullptr, &PipeControlParams)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); if (MEDIA_IS_WA(pRenderHalLegacy->pWaTable, WaSendDummyVFEafterPipelineSelect)) { MHW_VFE_PARAMS VfeStateParams = {}; VfeStateParams.dwNumberofURBEntries = 1; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(pMhwRender->AddMediaVfeCmd(&CmdBuffer, &VfeStateParams)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } } @@ -856,11 +865,15 @@ MOS_STATUS VpHal_RndrSubmitCommands( { VPHAL_RENDER_ASSERTMESSAGE("ERROR, pWalkerParams is nullptr and cannot get InterfaceDescriptorOffset."); } + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(pMhwMiInterface->AddMediaStateFlush(&CmdBuffer, nullptr, &FlushParam)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } else if (MEDIA_IS_WA(pRenderHalLegacy->pWaTable, WaAddMediaStateFlushCmd)) { + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(pMhwMiInterface->AddMediaStateFlush(&CmdBuffer, nullptr, &FlushParam)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } } @@ -868,19 +881,25 @@ MOS_STATUS VpHal_RndrSubmitCommands( if (pBatchBuffer) { + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Send Batch Buffer end command (HW/OS dependent) VPHAL_RENDER_CHK_STATUS(pMhwMiInterface->AddMiBatchBufferEnd(&CmdBuffer, nullptr)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } else if (VpHal_RndrCommonIsMiBBEndNeeded(pOsInterface)) { // Send Batch Buffer end command for 1st level Batch Buffer + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(pMhwMiInterface->AddMiBatchBufferEnd(&CmdBuffer, nullptr)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } else if (GFX_IS_GEN_8_OR_LATER(pRenderHalLegacy->Platform) && Mos_Solo_IsInUse(pOsInterface) && pRenderHalLegacy->pOsInterface->bNoParsingAssistanceInKmd) { + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(pMhwMiInterface->AddMiBatchBufferEnd(&CmdBuffer, nullptr)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } // Return unused command buffer space to OS @@ -896,10 +915,10 @@ MOS_STATUS VpHal_RndrSubmitCommands( pStatusTableUpdateParams->bTriggerGPUHang = false; } #endif - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Submit command buffer VPHAL_RENDER_CHK_STATUS(pOsInterface->pfnSubmitCommandBuffer(pOsInterface, &CmdBuffer, bNullRendering)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); if (bNullRendering == false) { dwSyncTag = pRenderHalLegacy->pStateHeap->dwNextTag++; @@ -914,9 +933,9 @@ MOS_STATUS VpHal_RndrSubmitCommands( } eStatus = MOS_STATUS_SUCCESS; - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); finish: - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); if (pStatusTableUpdateParams && pOsInterface) { VpHal_RndrUpdateStatusTableAfterSubmit(pOsInterface, pStatusTableUpdateParams, pOsInterface->CurrentGpuContextOrdinal, eStatus); diff --git a/media_driver/agnostic/common/vp/hal/vphal_render_composite.cpp b/media_driver/agnostic/common/vp/hal/vphal_render_composite.cpp index f625f39bf..ae6d955dd 100644 --- a/media_driver/agnostic/common/vp/hal/vphal_render_composite.cpp +++ b/media_driver/agnostic/common/vp/hal/vphal_render_composite.cpp @@ -2134,8 +2134,9 @@ MOS_STATUS CompositeState::RenderMultiPhase( // Reset states before rendering (clear allocations, get GSH allocation index // + any additional housekeeping) pOsInterface->pfnResetOsStates(pOsInterface); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(pRenderHal->pfnReset(pRenderHal)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Set Slice Shutdown Mode if (m_bSingleSlice) { @@ -2167,7 +2168,9 @@ MOS_STATUS CompositeState::RenderMultiPhase( if (!m_bApplyTwoLayersCompOptimize || bLastPhase || (iSources != 2) || (ppSources[1]->Rotation == VPHAL_ROTATION_IDENTITY)) { m_bLastPhase = bLastPhase && (pcRenderParams->pConstriction == nullptr); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(RenderPhase(&CompositeParams)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } // do an extra rotation if needed @@ -2248,19 +2251,24 @@ MOS_STATUS CompositeState::RenderMultiPhase( // Reset states before rendering (clear allocations, get GSH allocation index // + any additional housekeeping) pOsInterface->pfnResetOsStates(pOsInterface); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(pRenderHal->pfnReset(pRenderHal)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Set performance tag for current rotation phase PerfTag = (VPHAL_PERFTAG)((int)VPHAL_ROT); pOsInterface->pfnSetPerfTag(pOsInterface, PerfTag); // Perform compositing operation + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(RenderPhase(&CompositeParams)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } } } eStatus = MOS_STATUS_SUCCESS; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); finish: + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); return eStatus; } @@ -2385,15 +2393,15 @@ MOS_STATUS CompositeState::Render( // Get resource information MOS_ZeroMemory(&Info, sizeof(VPHAL_GET_SURFACE_INFO)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(VpHal_GetSurfaceInfo( pOsInterface, &Info, pSrc)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); //Need to decompress input surface, only if input surface is interlaced and in the RC compression Mode VPHAL_RENDER_CHK_STATUS(DecompressInterlacedSurf(pSrc)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Ensure the input is ready to be read pOsInterface->pfnSyncOnResource( pOsInterface, @@ -2408,12 +2416,12 @@ MOS_STATUS CompositeState::Render( pOsInterface->pfnUpdateResourceUsageType(&pSrc->OsResource, MOS_HW_RESOURCE_USAGE_VP_INPUT_REFERENCE_RENDER); MOS_ZeroMemory(&Info, sizeof(VPHAL_GET_SURFACE_INFO)); - + // ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(VpHal_GetSurfaceInfo( pOsInterface, &Info, pSrc->pBwdRef)); - + // ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Ensure the input is ready to be read pOsInterface->pfnSyncOnResource( pOsInterface, @@ -2515,9 +2523,9 @@ MOS_STATUS CompositeState::Render( m_Intermediate2.Format = Format_AYUV; } } - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(RenderMultiPhase(pcRenderParams, pSources, iSources, pOutput)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Last constriction phase if (pcRenderParams->pConstriction) { @@ -2547,15 +2555,18 @@ MOS_STATUS CompositeState::Render( // Reset states before rendering (clear allocations, get GSH allocation index // + any additional housekeeping) pOsInterface->pfnResetOsStates(pOsInterface); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(pRenderHal->pfnReset(pRenderHal)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Raise the flag to indicate the last comp render phase m_bLastPhase = true; // Perform compositing operation + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(RenderPhase(&CompositeParams)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); finish: if (pCacheSettings) { @@ -2568,7 +2579,7 @@ MOS_STATUS CompositeState::Render( } VPHAL_RENDER_EXITMESSAGE("eStatus %d", eStatus); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); return eStatus; } @@ -6234,10 +6245,10 @@ MOS_STATUS CompositeState::RenderPhase( pKernelDllState = m_pKernelDllState; //VPHAL_DBG_STATE_DUMPPER_SET_CURRENT_STAGE(VPHAL_DBG_STAGE_COMP); - + // ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Check whether composition parameters are valid. VPHAL_RENDER_CHK_STATUS(IsCompositeParamsValid(*pCompParams)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); //============================ // Allocate states for rendering //============================ @@ -6245,20 +6256,21 @@ MOS_STATUS CompositeState::RenderPhase( VPHAL_RENDER_CHK_STATUS(RenderInit( pCompParams, &RenderingData)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Allocate and reset media state RenderingData.pMediaState = pMediaState = pRenderHal->pfnAssignMediaState(pRenderHal, RENDERHAL_COMPONENT_COMP); + ALOGE("lhh %s:%d, pMediaState %p", __FUNCTION__,__LINE__, pMediaState); VPHAL_RENDER_CHK_NULL(pMediaState); - + ALOGE("lhh %s:%d, pRenderHal %p", __FUNCTION__,__LINE__, pRenderHal); // Allocate and reset SSH instance VPHAL_RENDER_CHK_STATUS(pRenderHal->pfnAssignSshInstance(pRenderHal)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Allocate and reset BT VPHAL_RENDER_CHK_STATUS(pRenderHal->pfnAssignBindingTable( pRenderHal, &iBindingTableID)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); RenderingData.iBindingTable = iBindingTableID; //=============================== @@ -6323,6 +6335,7 @@ MOS_STATUS CompositeState::RenderPhase( true) != MOS_STATUS_SUCCESS) { eStatus = MOS_STATUS_UNKNOWN; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); goto finish; } @@ -6357,6 +6370,7 @@ MOS_STATUS CompositeState::RenderPhase( false, true) != MOS_STATUS_SUCCESS) { + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); eStatus = MOS_STATUS_UNKNOWN; goto finish; } @@ -6374,6 +6388,7 @@ MOS_STATUS CompositeState::RenderPhase( { VPHAL_RENDER_ASSERTMESSAGE("Failed to set layer parameters."); eStatus = MOS_STATUS_UNKNOWN; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); goto finish; } @@ -6394,6 +6409,7 @@ MOS_STATUS CompositeState::RenderPhase( true) != MOS_STATUS_SUCCESS) { eStatus = MOS_STATUS_UNKNOWN; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); goto finish; } } @@ -6406,6 +6422,7 @@ MOS_STATUS CompositeState::RenderPhase( { VPHAL_RENDER_ASSERTMESSAGE("Failed to set Render Target."); eStatus = MOS_STATUS_UNKNOWN; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); goto finish; } @@ -6486,6 +6503,7 @@ MOS_STATUS CompositeState::RenderPhase( { VPHAL_RENDER_ASSERTMESSAGE("Failed to find a kernel."); eStatus = MOS_STATUS_UNKNOWN; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); goto finish; } @@ -6494,6 +6512,7 @@ MOS_STATUS CompositeState::RenderPhase( { VPHAL_RENDER_ASSERTMESSAGE("Failed to build kernel."); eStatus = MOS_STATUS_UNKNOWN; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); goto finish; } @@ -6509,6 +6528,7 @@ MOS_STATUS CompositeState::RenderPhase( { VPHAL_RENDER_ASSERTMESSAGE("Failed to store kernel in local cache."); eStatus = MOS_STATUS_UNKNOWN; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); goto finish; } } @@ -6601,6 +6621,7 @@ MOS_STATUS CompositeState::RenderPhase( { VPHAL_RENDER_ASSERTMESSAGE("Failed to render media walker batch."); eStatus = MOS_STATUS_UNKNOWN; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); goto finish; } @@ -6609,6 +6630,7 @@ MOS_STATUS CompositeState::RenderPhase( { VPHAL_RENDER_ASSERTMESSAGE("Failed to submit compositing states."); eStatus = MOS_STATUS_UNKNOWN; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); goto finish; } @@ -6632,6 +6654,7 @@ MOS_STATUS CompositeState::RenderPhase( { VPHAL_RENDER_ASSERTMESSAGE("Failed to render media walker batch."); eStatus = MOS_STATUS_UNKNOWN; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); goto finish; } @@ -6640,6 +6663,7 @@ MOS_STATUS CompositeState::RenderPhase( { VPHAL_RENDER_ASSERTMESSAGE("Failed to submit compositing states."); eStatus = MOS_STATUS_UNKNOWN; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); goto finish; } } @@ -6650,12 +6674,14 @@ MOS_STATUS CompositeState::RenderPhase( { VPHAL_RENDER_ASSERTMESSAGE("Failed to submit compositing states."); eStatus = MOS_STATUS_UNKNOWN; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); goto finish; } // Get a valid batch buffer (find a match if possible) + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(AllocateBuffer(&RenderingData, &pBatchBuffer)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // No match was found - render a new batch buffer if (!((PVPHAL_BATCH_BUFFER_PARAMS)pBatchBuffer->pPrivateData)->bMatch) { @@ -6664,6 +6690,7 @@ MOS_STATUS CompositeState::RenderPhase( &RenderingData)) { VPHAL_RENDER_ASSERTMESSAGE("Failed to render batch buffers."); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); eStatus = MOS_STATUS_UNKNOWN; goto finish; } @@ -6688,7 +6715,7 @@ MOS_STATUS CompositeState::RenderPhase( VPHAL_DBG_STATE_DUMPPER_DUMP_GSH(pRenderHal); VPHAL_DBG_STATE_DUMPPER_DUMP_SSH(pRenderHal); VPHAL_DBG_STATE_DUMPPER_DUMP_BATCH_BUFFER(pRenderHal, pBatchBuffer); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(VpHal_RndrSubmitCommands( pRenderHal, pBatchBuffer, @@ -6700,7 +6727,7 @@ MOS_STATUS CompositeState::RenderPhase( m_KernelSearch.KernelCount, m_KernelSearch.KernelID, m_bLastPhase)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); finish: // clean rendering data if (bEUFusedDispatchFlag) @@ -6711,6 +6738,7 @@ MOS_STATUS CompositeState::RenderPhase( CleanRenderingData(&RenderingData); pRenderHal->bCmfcCoeffUpdate = false; pRenderHal->pCmfcCoeffSurface = nullptr; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); return eStatus; } diff --git a/media_driver/agnostic/common/vp/hal/vphal_renderer.cpp b/media_driver/agnostic/common/vp/hal/vphal_renderer.cpp index 44bae827d..105b38177 100644 --- a/media_driver/agnostic/common/vp/hal/vphal_renderer.cpp +++ b/media_driver/agnostic/common/vp/hal/vphal_renderer.cpp @@ -701,13 +701,13 @@ MOS_STATUS VphalRenderer::RenderPass( RenderPassData.AllocateTempOutputSurfaces(); RenderPassData.bCompNeeded = true; - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Get surface info for all input source VPHAL_RENDER_CHK_STATUS(GetSurfaceInfoForSrc(pRenderParams)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Process render parameters VPHAL_RENDER_CHK_STATUS(ProcessRenderParameter(pRenderParams, &RenderPassData)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Loop through the sources for (uiIndex_in = 0; uiIndex_in < pRenderParams->uSrcCount; uiIndex_in++) { @@ -729,7 +729,9 @@ MOS_STATUS VphalRenderer::RenderPass( { // new 1toN path for multi ouput with scaling only case. VPHAL_RENDER_NORMALMESSAGE("Enter fast 1to N render."); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(RenderFast1toNComposite(pRenderParams, &RenderPassData)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } else { @@ -778,13 +780,17 @@ MOS_STATUS VphalRenderer::RenderPass( (uiIndex_in == pRenderParams->uSrcCount-1 || // compatible with N:1 case, only render at the last input. pRenderParams->uSrcCount == 0)) // fast color fill { + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(RenderComposite(pRenderParams, &RenderPassData)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } else if (VpHal_RndrIsHdrPathNeeded(this, pRenderParams, &RenderPassData) && (pHdrState && !pHdrState->bBypassHdrKernelPath)) { + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(VpHal_RndrRenderHDR(this, pRenderParams, &RenderPassData)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } } // restore render pointer and count. @@ -810,8 +816,9 @@ MOS_STATUS VphalRenderer::RenderPass( pRenderParams->pSrc[RenderPassData.uiPrimaryIndex] = RenderPassData.pPrimarySurface, false /*restore*/); } - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); finish: + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); return eStatus; } @@ -951,13 +958,17 @@ MOS_STATUS VphalRenderer::RenderComposite( pRenderParams->pTarget[0]->b16UsrPtr) && (VpHal_RndrIs16Align(&Align16State, pRenderParams))) { + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // process 16aligned usrptr mode. VPHAL_RENDER_CHK_STATUS(Align16State.pfnRender(&Align16State, pRenderParams)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } else { + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // fallback to legacy path VPHAL_RENDER_CHK_STATUS(pRender[VPHAL_RENDER_ID_COMPOSITE]->Render(pRenderParams, nullptr)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } //------------------------------------------ @@ -969,8 +980,9 @@ MOS_STATUS VphalRenderer::RenderComposite( this, pRenderParams->pTarget, VPHAL_MAX_TARGETS, pRenderParams->uDstCount, VPHAL_DBG_DUMP_TYPE_POST_COMP); //------------------------------------------ - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); finish: + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); return eStatus; } @@ -1079,6 +1091,8 @@ bool VphalRenderer::IsFormatSupported( MOS_STATUS VphalRenderer::Render( PCVPHAL_RENDER_PARAMS pcRenderParams) { + return MOS_STATUS_USER_FEATURE_READ_FAILED; + ALOGE("lhh %s:%d in", __FUNCTION__,__LINE__); MOS_STATUS eStatus; PMOS_INTERFACE pOsInterface; PRENDERHAL_INTERFACE pRenderHal; @@ -1108,6 +1122,7 @@ MOS_STATUS VphalRenderer::Render( { VPHAL_RENDER_ASSERTMESSAGE("Invalid Render Target."); eStatus = MOS_STATUS_UNKNOWN; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); goto finish; } @@ -1116,6 +1131,7 @@ MOS_STATUS VphalRenderer::Render( { VPHAL_RENDER_ASSERTMESSAGE("Invalid Render Target Output Format."); eStatus = MOS_STATUS_UNKNOWN; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); goto finish; } @@ -1126,6 +1142,7 @@ MOS_STATUS VphalRenderer::Render( { VPHAL_RENDER_ASSERTMESSAGE("Invalid number of samples."); eStatus = MOS_STATUS_UNKNOWN; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); goto finish; } @@ -1134,6 +1151,7 @@ MOS_STATUS VphalRenderer::Render( { VPHAL_RENDER_ASSERTMESSAGE("Invalid number of targets."); eStatus = MOS_STATUS_UNKNOWN; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); goto finish; } @@ -1222,8 +1240,9 @@ MOS_STATUS VphalRenderer::Render( VPHAL_RENDER_CHK_STATUS(RenderPass(&RenderParams)); } - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); finish: + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); uiFrameCounter++; return eStatus; } diff --git a/media_driver/agnostic/gen12_tgllp/vp/hal/vphal_renderer_g12_tgllp.cpp b/media_driver/agnostic/gen12_tgllp/vp/hal/vphal_renderer_g12_tgllp.cpp index 56aa2c1a5..261d0ffd7 100644 --- a/media_driver/agnostic/gen12_tgllp/vp/hal/vphal_renderer_g12_tgllp.cpp +++ b/media_driver/agnostic/gen12_tgllp/vp/hal/vphal_renderer_g12_tgllp.cpp @@ -106,17 +106,23 @@ MOS_STATUS VphalRendererG12Tgllp::Render( if (pcRenderParams->pTarget[0] == nullptr || Mos_ResourceIsNull(&(pcRenderParams->pTarget[0]->OsResource))) { - VPHAL_RENDER_ASSERTMESSAGE("Invalid Render Target."); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); + // VPHAL_RENDER_ASSERTMESSAGE("Invalid Render Target."); eStatus = MOS_STATUS_UNKNOWN; - goto finish; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); + // goto finish; + return eStatus; } // Protection mechanism, Only SKL+ support P010 output. if (IsFormatSupported(pcRenderParams) == false) { - VPHAL_RENDER_ASSERTMESSAGE("Invalid Render Target Output Format."); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); + // VPHAL_RENDER_ASSERTMESSAGE("Invalid Render Target Output Format."); eStatus = MOS_STATUS_UNKNOWN; - goto finish; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); + // goto finish; + return eStatus; } VPHAL_DBG_STATE_DUMP_SET_CURRENT_FRAME_COUNT(uiFrameCounter); @@ -124,17 +130,23 @@ MOS_STATUS VphalRendererG12Tgllp::Render( // Validate max number sources if (pcRenderParams->uSrcCount > VPHAL_MAX_SOURCES) { - VPHAL_RENDER_ASSERTMESSAGE("Invalid number of samples."); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); + // VPHAL_RENDER_ASSERTMESSAGE("Invalid number of samples."); eStatus = MOS_STATUS_UNKNOWN; - goto finish; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); + // goto finish; + return eStatus; } // Validate max number targets if (pcRenderParams->uDstCount > VPHAL_MAX_TARGETS) { - VPHAL_RENDER_ASSERTMESSAGE("Invalid number of targets."); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); + // VPHAL_RENDER_ASSERTMESSAGE("Invalid number of targets."); eStatus = MOS_STATUS_UNKNOWN; - goto finish; + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); + // goto finish; + return eStatus; } // Copy the Render Params structure (so we can update it) @@ -148,6 +160,7 @@ MOS_STATUS VphalRendererG12Tgllp::Render( for (uiDst = 0; uiDst < RenderParams.uDstCount; uiDst++) { + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(VpHal_GetSurfaceInfo( m_pOsInterface, &Info, @@ -174,22 +187,22 @@ MOS_STATUS VphalRendererG12Tgllp::Render( MOS_ZeroMemory(pSrcLeft, sizeof(PVPHAL_SURFACE) * VPHAL_MAX_SOURCES); MOS_ZeroMemory(pSrcRight, sizeof(PVPHAL_SURFACE) * VPHAL_MAX_SOURCES); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(PrepareSources( &RenderParams, pSrcLeft, pSrcRight, &uiRenderPasses)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); //set GpuContext VPHAL_RENDER_CHK_STATUS(SetRenderGpuContext(RenderParams)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // align rectangle and source surface for (uiDst = 0; uiDst < RenderParams.uDstCount; uiDst++) { VPHAL_RENDER_CHK_STATUS(VpHal_RndrRectSurfaceAlignment(RenderParams.pTarget[uiDst], RenderParams.pTarget[uiDst]->Format)); } - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); for (uiCurrentRenderPass = 0; uiCurrentRenderPass < uiRenderPasses; uiCurrentRenderPass++) @@ -202,7 +215,7 @@ MOS_STATUS VphalRendererG12Tgllp::Render( sizeof(PVPHAL_SURFACE) * VPHAL_MAX_SOURCES); MOS_ZeroMemory(&Info, sizeof(VPHAL_GET_SURFACE_INFO)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); for (uiDst = 0; uiDst < RenderParams.uDstCount; uiDst++) { Info.S3dChannel = RenderParams.pTarget[uiDst]->Channel; @@ -213,16 +226,18 @@ MOS_STATUS VphalRendererG12Tgllp::Render( &Info, RenderParams.pTarget[uiDst])); } - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); // Update channel. 0 = mono or stereo left, 1 = stereo right uiCurrentChannel = uiCurrentRenderPass; VPHAL_RENDER_CHK_STATUS(RenderScaling(&RenderParams)); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); VPHAL_RENDER_CHK_STATUS(RenderPass(&RenderParams)); + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); } - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); finish: + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); uiFrameCounter++; return eStatus; } diff --git a/media_driver/linux/common/ddi/ddi_media_context.h b/media_driver/linux/common/ddi/ddi_media_context.h index 53c1bccef..8ddef68c5 100644 --- a/media_driver/linux/common/ddi/ddi_media_context.h +++ b/media_driver/linux/common/ddi/ddi_media_context.h @@ -100,6 +100,9 @@ struct DDI_MEDIA_CONTEXT MEDIA_MUTEX_T ProtMutex = {}; MEDIA_MUTEX_T CmMutex = {}; MEDIA_MUTEX_T MfeMutex = {}; +//todo: #if VA_CHECK_VERSION(1, 9, 0) + MEDIA_MUTEX_T SyncFenceMutex = {}; +//#endif // GT system Info MEDIA_SYSTEM_INFO *pGtSystemInfo = nullptr; diff --git a/media_driver/linux/common/ddi/media_libva.cpp b/media_driver/linux/common/ddi/media_libva.cpp index d349965a2..c5d9dba4a 100755 --- a/media_driver/linux/common/ddi/media_libva.cpp +++ b/media_driver/linux/common/ddi/media_libva.cpp @@ -1428,6 +1428,9 @@ static VAStatus DdiMedia_HeapInitialize( DdiMediaUtil_InitMutex(&mediaCtx->ProtMutex); DdiMediaUtil_InitMutex(&mediaCtx->CmMutex); DdiMediaUtil_InitMutex(&mediaCtx->MfeMutex); +//todo: #if VA_CHECK_VERSION(1, 9, 0) + DdiMediaUtil_InitMutex(&mediaCtx->SyncFenceMutex); +//#endif return VA_STATUS_SUCCESS; } @@ -1482,6 +1485,9 @@ static VAStatus DdiMedia_HeapDestroy( DdiMediaUtil_DestroyMutex(&mediaCtx->ProtMutex); DdiMediaUtil_DestroyMutex(&mediaCtx->CmMutex); DdiMediaUtil_DestroyMutex(&mediaCtx->MfeMutex); +//todo: #if VA_CHECK_VERSION(1, 9, 0) + DdiMediaUtil_DestroyMutex(&mediaCtx->SyncFenceMutex); +//#endif //resource checking if (mediaCtx->uiNumSurfaces != 0) @@ -1559,6 +1565,9 @@ void DestroyMediaContextMutex(PDDI_MEDIA_CONTEXT mediaCtx) DdiMediaUtil_DestroyMutex(&mediaCtx->VpMutex); DdiMediaUtil_DestroyMutex(&mediaCtx->CmMutex); DdiMediaUtil_DestroyMutex(&mediaCtx->MfeMutex); +//todo: #if VA_CHECK_VERSION(1, 9, 0) + DdiMediaUtil_DestroyMutex(&mediaCtx->SyncFenceMutex); +//#endif #if !defined(ANDROID) && defined(X11_FOUND) DdiMediaUtil_DestroyMutex(&mediaCtx->PutSurfaceRenderMutex); DdiMediaUtil_DestroyMutex(&mediaCtx->PutSurfaceSwapBufferMutex); @@ -2169,6 +2178,9 @@ VAStatus DdiMedia_LoadFuncion (VADriverContextP ctx) pVTable->vaBeginPicture = DdiMedia_BeginPicture; pVTable->vaRenderPicture = DdiMedia_RenderPicture; pVTable->vaEndPicture = DdiMedia_EndPicture; +//todo: #if VA_CHECK_VERSION(1, 9, 0) + pVTable->vaEndPicture2 = DdiMedia_EndPicture2; +//#endif pVTable->vaSyncSurface = DdiMedia_SyncSurface; #if VA_CHECK_VERSION(1, 9, 0) pVTable->vaSyncSurface2 = DdiMedia_SyncSurface2; @@ -4088,6 +4100,57 @@ VAStatus DdiMedia_EndPicture ( return vaStatus; } +//#if VA_CHECK_VERSION(1, 9, 0) //todo: check correct version +VAStatus DdiMedia_EndPicture2 ( + VADriverContextP ctx, + VAContextID context, + int32_t *fences, + int32_t count +) +{ + DDI_FUNCTION_ENTER(); + + DDI_CHK_NULL(ctx, "nullptr ctx", VA_STATUS_ERROR_INVALID_CONTEXT); + DDI_CHK_NULL(fences, "nullptr fences", VA_STATUS_ERROR_INVALID_PARAMETER); + + uint32_t ctxType = DDI_MEDIA_CONTEXT_TYPE_NONE; + void *ctxPtr = DdiMedia_GetContextFromContextID(ctx, context, &ctxType); + PDDI_MEDIA_CONTEXT mediaCtx = DdiMedia_GetMediaContext(ctx); + VAStatus vaStatus = VA_STATUS_SUCCESS; + + DdiMediaUtil_LockMutex(&mediaCtx->SyncFenceMutex); + vaStatus = DdiMedia_SetSyncFences(ctx, context, fences, count); + //todo: add fences[1...count] into bufmgr->fences[...] + + switch (ctxType) + { + case DDI_MEDIA_CONTEXT_TYPE_DECODER: + vaStatus = DdiDecode_EndPicture(ctx, context); + break; + case DDI_MEDIA_CONTEXT_TYPE_ENCODER: + vaStatus = DdiEncode_EndPicture(ctx, context); + break; + case DDI_MEDIA_CONTEXT_TYPE_VP: + vaStatus = DdiVp_EndPicture(ctx, context); + // ALOGE("lhh %s%d, vaStatus %d", __FUNCTION__,__LINE__, (int)vaStatus); + break; + default: + DDI_ASSERTMESSAGE("DDI: unsupported context in DdiCodec_EndPicture."); + vaStatus = VA_STATUS_ERROR_INVALID_CONTEXT; + } + // ALOGE("lhh %s%d, vaStatus %d", __FUNCTION__,__LINE__, (int)vaStatus); + vaStatus = DdiMedia_GetSyncFenceOut(ctx, context, &fences[0]); + ALOGE("lhh %s%d, vaStatus %d, fence %d", __FUNCTION__,__LINE__, (int)vaStatus, fences[0]); + //todo: get fence out from bufmgr->fence[0] + DdiMediaUtil_UnLockMutex(&mediaCtx->SyncFenceMutex); + + MOS_TraceEventExt(EVENT_VA_PICTURE, EVENT_TYPE_END, &context, sizeof(context), &vaStatus, sizeof(vaStatus)); + PERF_UTILITY_STOP_ONCE("First Frame Time", PERF_MOS, PERF_LEVEL_DDI); + + return vaStatus; +} +//#endif + static VAStatus DdiMedia_StatusCheck ( PDDI_MEDIA_CONTEXT mediaCtx, DDI_MEDIA_SURFACE *surface, diff --git a/media_driver/linux/common/ddi/media_libva.h b/media_driver/linux/common/ddi/media_libva.h index 3066611c6..1cdb71cce 100755 --- a/media_driver/linux/common/ddi/media_libva.h +++ b/media_driver/linux/common/ddi/media_libva.h @@ -640,6 +640,15 @@ VAStatus DdiMedia_EndPicture ( VAContextID context ); +//#if VA_CHECK_VERSION(1, 9, 0) //todo: check correct version +VAStatus DdiMedia_EndPicture2 ( + VADriverContextP ctx, + VAContextID context, + int32_t *fences, + int32_t count +); +//#endif + //! //! \brief Sync surface //! \details This function blocks until all pending operations on the render target diff --git a/media_driver/linux/common/ddi/media_libva_common.cpp b/media_driver/linux/common/ddi/media_libva_common.cpp index bea8b673e..8af539533 100644 --- a/media_driver/linux/common/ddi/media_libva_common.cpp +++ b/media_driver/linux/common/ddi/media_libva_common.cpp @@ -475,3 +475,34 @@ void MovePriorityBufferIdToEnd (VABufferID *buffers, int32_t priorityIndexInBuf, } } +VAStatus DdiMedia_SetSyncFences(VADriverContextP ctx, VAContextID context, int32_t *fences, int32_t count) +{ + VAStatus vaStatus = VA_STATUS_SUCCESS; + PDDI_MEDIA_CONTEXT mediaCtx = DdiMedia_GetMediaContext(ctx); + struct mos_exec_fences exec_fences; + exec_fences.fences = fences; + exec_fences.count = count; + int ret = mos_set_fences(mediaCtx->pDrmBufMgr, &exec_fences); + + if (ret) + { + vaStatus = VA_STATUS_ERROR_OPERATION_FAILED; + } + + return vaStatus; +} + +VAStatus DdiMedia_GetSyncFenceOut(VADriverContextP ctx, VAContextID context, int32_t *fence_out) +{ + VAStatus vaStatus = VA_STATUS_SUCCESS; + PDDI_MEDIA_CONTEXT mediaCtx = DdiMedia_GetMediaContext(ctx); + int ret = mos_get_fence(mediaCtx->pDrmBufMgr, fence_out); + ALOGE("lhh %s:%d ret %d", __FUNCTION__,__LINE__,ret); + if (ret) + { + vaStatus = VA_STATUS_ERROR_OPERATION_FAILED; + *fence_out = 0; + } + + return vaStatus; +} diff --git a/media_driver/linux/common/ddi/media_libva_common.h b/media_driver/linux/common/ddi/media_libva_common.h index 4a9b653b1..b24033e6f 100644 --- a/media_driver/linux/common/ddi/media_libva_common.h +++ b/media_driver/linux/common/ddi/media_libva_common.h @@ -273,4 +273,14 @@ int32_t DdiMedia_GetGpuPriority (VADriverContextP ctx, VABufferID *buffers, int3 //! void MovePriorityBufferIdToEnd (VABufferID *buffers, int32_t priorityIndexInBuf, int32_t numBuffers); +//! +//! \brief Add fence fds into bufmgr for execution sync +//! +VAStatus DdiMedia_SetSyncFences(VADriverContextP ctx, VAContextID context, int32_t *fences, int32_t count); + +//! +//! \brief Get fence out from current execution submission +//! +VAStatus DdiMedia_GetSyncFenceOut(VADriverContextP ctx, VAContextID context, int32_t *fence_out); + #endif diff --git a/media_driver/linux/common/os/mos_os_specific.c b/media_driver/linux/common/os/mos_os_specific.c index 488449aa0..72b705d19 100644 --- a/media_driver/linux/common/os/mos_os_specific.c +++ b/media_driver/linux/common/os/mos_os_specific.c @@ -4271,6 +4271,7 @@ MOS_STATUS Mos_Specific_SubmitCommandBuffer( if (pOsInterface->apoMosEnabled) { + ALOGE("lhh %s:%d", __FUNCTION__,__LINE__); return MosInterface::SubmitCommandBuffer(pOsInterface->osStreamState, pCmdBuffer, bNullRendering); } @@ -4283,10 +4284,11 @@ MOS_STATUS Mos_Specific_SubmitCommandBuffer( GpuCmdResInfoDump::GetInstance(pOsInterface->pOsContext)->Dump(pOsInterface); GpuCmdResInfoDump::GetInstance(pOsInterface->pOsContext)->ClearCmdResPtrs(pOsInterface); #endif // MOS_COMMAND_RESINFO_DUMP_SUPPORTED - + ALOGE("lhh %s:%d", __FUNCTION__,__LINE__); return (gpuContext->SubmitCommandBuffer(pOsInterface, pCmdBuffer, bNullRendering)); } MOS_OS_ASSERTMESSAGE("Not support this path"); + ALOGE("lhh %s:%d", __FUNCTION__,__LINE__); return MOS_STATUS_UNIMPLEMENTED; } diff --git a/media_driver/linux/common/vp/ddi/media_libva_vp.c b/media_driver/linux/common/vp/ddi/media_libva_vp.c index dcff2555a..a4838f0e4 100644 --- a/media_driver/linux/common/vp/ddi/media_libva_vp.c +++ b/media_driver/linux/common/vp/ddi/media_libva_vp.c @@ -3628,7 +3628,7 @@ VAStatus DdiVp_EndPicture ( pVpHal = pVpCtx->pVpHal; DDI_CHK_NULL(pVpHal, "Null pVpHal.", VA_STATUS_ERROR_INVALID_PARAMETER); eStatus = pVpHal->Render(pVpCtx->pVpHalRenderParams); - + ALOGE("lhh %s:%d, eStatus %d", __FUNCTION__,__LINE__, (int)eStatus); #if (_DEBUG || _RELEASE_INTERNAL) VpDumpProcPipelineParams(pVaDrvCtx, pVpCtx); #endif //(_DEBUG || _RELEASE_INTERNAL) diff --git a/media_softlet/agnostic/common/renderhal/renderhal.cpp b/media_softlet/agnostic/common/renderhal/renderhal.cpp index 7d200de5c..e9fb10b3b 100644 --- a/media_softlet/agnostic/common/renderhal/renderhal.cpp +++ b/media_softlet/agnostic/common/renderhal/renderhal.cpp @@ -4480,6 +4480,7 @@ PRENDERHAL_MEDIA_STATE RenderHal_AssignMediaState( { MHW_RENDERHAL_ASSERTMESSAGE("Timeout for waiting free media state."); pStateHeap->pCurMediaState = pCurMediaState = nullptr; + ALOGE("lhh %s:%d Timeout for waiting free media state", __FUNCTION__,__LINE__); return pCurMediaState; } } diff --git a/media_softlet/linux/common/os/i915/include/mos_bufmgr_api.h b/media_softlet/linux/common/os/i915/include/mos_bufmgr_api.h index 558c49650..a9cb28a35 100644 --- a/media_softlet/linux/common/os/i915/include/mos_bufmgr_api.h +++ b/media_softlet/linux/common/os/i915/include/mos_bufmgr_api.h @@ -253,6 +253,13 @@ struct mos_drm_uc_version { uint32_t minor_version; }; +struct mos_exec_fences +{ +#define FENCES_MAX 10 + int32_t *fences; + int32_t count; +}; + struct mos_linux_bo *mos_bo_alloc(struct mos_bufmgr *bufmgr, struct mos_drm_bo_alloc *alloc); struct mos_linux_bo *mos_bo_alloc_userptr(struct mos_bufmgr *bufmgr, @@ -313,6 +320,9 @@ int mos_bufmgr_get_memory_info(struct mos_bufmgr *bufmgr, char *info, uint32_t l int mos_bufmgr_get_devid(struct mos_bufmgr *bufmgr); void mos_bufmgr_realloc_cache(struct mos_bufmgr *bufmgr, uint8_t alloc_mode); +int mos_set_fences(struct mos_bufmgr *bufmgr, struct mos_exec_fences *exec_fences); +int mos_get_fence(struct mos_bufmgr *bufmgr, int32_t *fence_out); + int mos_bo_map_unsynchronized(struct mos_linux_bo *bo); int mos_bo_map_gtt(struct mos_linux_bo *bo); int mos_bo_unmap_gtt(struct mos_linux_bo *bo); diff --git a/media_softlet/linux/common/os/i915/include/mos_bufmgr_priv.h b/media_softlet/linux/common/os/i915/include/mos_bufmgr_priv.h index 04f543946..25f4788c0 100644 --- a/media_softlet/linux/common/os/i915/include/mos_bufmgr_priv.h +++ b/media_softlet/linux/common/os/i915/include/mos_bufmgr_priv.h @@ -418,6 +418,9 @@ struct mos_bufmgr { uint8_t (*switch_off_n_bits)(struct mos_linux_context *ctx, uint8_t in_mask, int n) = nullptr; unsigned int (*hweight8)(struct mos_linux_context *ctx, uint8_t w) = nullptr; + int (*set_fences)(struct mos_bufmgr *bufmgr, struct mos_exec_fences *exec_fences) = nullptr; + int (*get_fence)(struct mos_bufmgr *bufmgr, int32_t *fence_out) = nullptr; + /**< Enables verbose debugging printouts */ int debug = 0; uint32_t *get_reserved = nullptr; diff --git a/media_softlet/linux/common/os/i915/mos_bufmgr_api.c b/media_softlet/linux/common/os/i915/mos_bufmgr_api.c index 6a9f5f664..bc086729c 100644 --- a/media_softlet/linux/common/os/i915/mos_bufmgr_api.c +++ b/media_softlet/linux/common/os/i915/mos_bufmgr_api.c @@ -1223,6 +1223,48 @@ mos_bufmgr_realloc_cache(struct mos_bufmgr *bufmgr, uint8_t alloc_mode) } } +int +mos_set_fences(struct mos_bufmgr *bufmgr, struct mos_exec_fences *exec_fences) +{ + if(!bufmgr) + { + MOS_OS_CRITICALMESSAGE("Input null ptr\n"); + return -EINVAL; + } + + if (bufmgr->set_fences) + { + return bufmgr->set_fences(bufmgr, exec_fences); + } + else + { + MOS_OS_CRITICALMESSAGE("Unsupported\n"); + return -EPERM; + } + +} + +int +mos_get_fence(struct mos_bufmgr *bufmgr, int32_t *fence_out) +{ + if(!bufmgr) + { + MOS_OS_CRITICALMESSAGE("Input null ptr\n"); + return -EINVAL; + } + + if (bufmgr->get_fence) + { + return bufmgr->get_fence(bufmgr, fence_out); + } + else + { + MOS_OS_CRITICALMESSAGE("Unsupported\n"); + return -EPERM; + } + +} + int mos_query_engines_count(struct mos_bufmgr *bufmgr, unsigned int *nengine) diff --git a/media_softlet/linux/common/os/i915_production/mos_bufmgr.c b/media_softlet/linux/common/os/i915_production/mos_bufmgr.c index 754c379f6..aea533008 100644 --- a/media_softlet/linux/common/os/i915_production/mos_bufmgr.c +++ b/media_softlet/linux/common/os/i915_production/mos_bufmgr.c @@ -140,6 +140,8 @@ typedef struct mos_bufmgr_gem { int exec_size; int exec_count; + struct mos_exec_fences exec_fences; + /** Array of lists of cached gem objects of power-of-two sizes */ struct mos_gem_bo_bucket cache_bucket[14 * 4]; int num_buckets; @@ -2414,9 +2416,10 @@ mos_bufmgr_gem_destroy(struct mos_bufmgr *bufmgr) struct drm_gem_close close_bo; int i, ret; - free(bufmgr_gem->exec2_objects); - free(bufmgr_gem->exec_objects); - free(bufmgr_gem->exec_bos); + mos_safe_free(bufmgr_gem->exec2_objects); + mos_safe_free(bufmgr_gem->exec_objects); + mos_safe_free(bufmgr_gem->exec_bos); + mos_safe_free(bufmgr_gem->exec_fences.fences); pthread_mutex_destroy(&bufmgr_gem->lock); /* Free any cached buffer objects we were going to reuse */ @@ -2940,6 +2943,79 @@ mos_update_buffer_offsets2 (struct mos_bufmgr_gem *bufmgr_gem, mos_linux_context } } +//todo: to move synchronization_xe.h to os common instead of xe specific +#include "mos_synchronization_xe.h" + +int +__add_eb_fence_array(struct mos_bufmgr_gem *bufmgr_gem, + struct drm_i915_gem_execbuffer2 *eb, + unsigned int flags) +{ +#define SCALABILITY_ON (I915_EXEC_FENCE_OUT | I915_EXEC_FENCE_IN | I915_EXEC_FENCE_SUBMIT) + + //Ignore multi batch submission for scalability to simplify logic + //todo: check has_fence_array from params + if (!(flags & SCALABILITY_ON) + && bufmgr_gem->exec_fences.fences) + { + int32_t fence_count = bufmgr_gem->exec_fences.count; + int32_t *exec_fences = bufmgr_gem->exec_fences.fences; + + if (fence_count > 0) + { + struct drm_i915_gem_exec_fence *fences + = (struct drm_i915_gem_exec_fence *)malloc(fence_count * sizeof(struct drm_i915_gem_exec_fence)); + if (fences == nullptr) + { + return -ENOMEM; + } + for (int32_t i = 0; i < fence_count; i++) + { + fences[i].handle = mos_sync_syncfile_fd_to_syncobj_handle(bufmgr_gem->fd, exec_fences[i + 1]); + fences[i].flags = I915_EXEC_FENCE_WAIT; + } + + eb->num_cliprects = fence_count; + eb->cliprects_ptr = (uintptr_t)fences; + eb->flags |= I915_EXEC_FENCE_ARRAY; + } + + eb->rsvd2 = -1; + eb->flags |= I915_EXEC_FENCE_OUT; //todo: to verify rsvd2 >> 32 still has fence out + return 0; + } + else + { + return 0; + } +} + +void +__clear_eb_fence_array(struct mos_bufmgr_gem *bufmgr_gem, + struct drm_i915_gem_execbuffer2 *eb) +{ + if (eb->cliprects_ptr + && eb->flags & I915_EXEC_FENCE_ARRAY) + { + struct drm_i915_gem_exec_fence *fences = (drm_i915_gem_exec_fence *)eb->cliprects_ptr; + + for (int32_t i = 0; i < eb->num_cliprects; i++) + { + mos_sync_syncobj_destroy(bufmgr_gem->fd, fences[i].handle); + } + + mos_safe_free(fences); + eb->cliprects_ptr = (uintptr_t)nullptr; + } + + if (bufmgr_gem->exec_fences.fences + && eb->flags & I915_EXEC_FENCE_OUT) + { + bufmgr_gem->exec_fences.fences[0] = eb->rsvd2 >> 32; + } + +} + drm_export int do_exec2(struct mos_linux_bo *bo, int used, struct mos_linux_context *ctx, drm_clip_rect_t *cliprects, int num_cliprects, int DR4, @@ -3011,6 +3087,8 @@ do_exec2(struct mos_linux_bo *bo, int used, struct mos_linux_context *ctx, if (bufmgr_gem->no_exec) goto skip_execution; + __add_eb_fence_array(bufmgr_gem, &execbuf, flags); + ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_EXECBUFFER2_WR, &execbuf); @@ -3037,6 +3115,8 @@ do_exec2(struct mos_linux_bo *bo, int used, struct mos_linux_context *ctx, *fence = execbuf.rsvd2 >> 32; } + __clear_eb_fence_array(bufmgr_gem, &execbuf); + skip_execution: if (bufmgr_gem->bufmgr.debug) mos_gem_dump_validation_list(bufmgr_gem); @@ -5173,6 +5253,61 @@ mos_bufmgr_enable_turbo_boost(struct mos_bufmgr *bufmgr) DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, &ctxParam ); } +int +mos_bufmgr_set_fences(struct mos_bufmgr *bufmgr, struct mos_exec_fences *exec_fences) +{ + if (!bufmgr || !exec_fences || exec_fences->count > FENCES_MAX) + { + return -EINVAL; + } + + struct mos_bufmgr_gem *bufmgr_gem = (struct mos_bufmgr_gem *)bufmgr; + + if (bufmgr_gem->exec_fences.fences == nullptr) + { + //fences[0] reserved for fence out + bufmgr_gem->exec_fences.fences = (int32_t *)malloc((FENCES_MAX + 1) * sizeof(int32_t)); + + if (bufmgr_gem->exec_fences.fences == nullptr) + { + return -ENOMEM; + } + + bufmgr_gem->exec_fences.count = 0; + } + + if (exec_fences->count > 0) + { + memcpy(bufmgr_gem->exec_fences.fences, exec_fences->fences, (exec_fences->count + 1) * sizeof(int32_t)); + bufmgr_gem->exec_fences.fences[0] = 0; + bufmgr_gem->exec_fences.count = exec_fences->count; + } + + return 0; +} + +int +mos_bufmgr_get_fence(struct mos_bufmgr *bufmgr, int32_t *fence_out) +{ + if (!bufmgr || !fence_out) + { + return -EINVAL; + } + + struct mos_bufmgr_gem *bufmgr_gem = (struct mos_bufmgr_gem *)bufmgr; + + if (bufmgr_gem->exec_fences.fences) + { + *fence_out = bufmgr_gem->exec_fences.fences[0]; + } + else + { + *fence_out = 0; + } + + return 0; +} + /** * Initializes the GEM buffer manager, which uses the kernel to allocate, map, * and manage map buffer objections. @@ -5283,6 +5418,8 @@ mos_bufmgr_gem_init_i915(int fd, int batch_size) bufmgr_gem->bufmgr.get_ts_frequency = mos_bufmgr_get_ts_frequency; bufmgr_gem->bufmgr.has_bsd2 = mos_bufmgr_has_bsd2; bufmgr_gem->bufmgr.enable_turbo_boost = mos_bufmgr_enable_turbo_boost; + bufmgr_gem->bufmgr.set_fences = mos_bufmgr_set_fences; + bufmgr_gem->bufmgr.get_fence = mos_bufmgr_get_fence; bufmgr_gem->mem_profiler_path = getenv("MEDIA_MEMORY_PROFILER_LOG"); if (bufmgr_gem->mem_profiler_path != nullptr) diff --git a/media_softlet/linux/common/os/i915_production/mos_bufmgr_priv.h b/media_softlet/linux/common/os/i915_production/mos_bufmgr_priv.h index 951a640ef..9cc5c8a31 100644 --- a/media_softlet/linux/common/os/i915_production/mos_bufmgr_priv.h +++ b/media_softlet/linux/common/os/i915_production/mos_bufmgr_priv.h @@ -419,6 +419,9 @@ struct mos_bufmgr { uint8_t (*switch_off_n_bits)(struct mos_linux_context *ctx, uint8_t in_mask, int n) = nullptr; unsigned int (*hweight8)(struct mos_linux_context *ctx, uint8_t w) = nullptr; + int (*set_fences)(struct mos_bufmgr *bufmgr, struct mos_exec_fences *exec_fences) = nullptr; + int (*get_fence)(struct mos_bufmgr *bufmgr, int32_t *fence_out) = nullptr; + /**< Enables verbose debugging printouts */ int debug = 0; /** used for reserved info*/ diff --git a/media_softlet/linux/common/os/xe/include/mos_synchronization_xe.h b/media_softlet/linux/common/os/xe/include/mos_synchronization_xe.h index 115fc2729..60ad1cdc5 100644 --- a/media_softlet/linux/common/os/xe/include/mos_synchronization_xe.h +++ b/media_softlet/linux/common/os/xe/include/mos_synchronization_xe.h @@ -34,7 +34,7 @@ #include #include #include "xe_drm.h" - +#include #if defined(__cplusplus) extern "C" { #endif @@ -101,6 +101,7 @@ int mos_sync_syncobj_timeline_wait(int fd, uint32_t *handles, uint64_t *points, uint32_t *first_signaled); int mos_sync_syncobj_handle_to_syncfile_fd(int fd, int syncobj_handle); +int mos_sync_syncfile_fd_to_syncobj_handle(int fd, int syncfile_fd); int mos_sync_import_syncfile_to_external_bo(int fd, int prime_fd, int syncfile_fd); int mos_sync_syncobj_timeline_to_binary(int fd, uint32_t binary_handle, uint32_t timeline_handle,