[vpp] Enable copy pass thru for VAAPI #1268
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2018 Intel Corporation | ||
// Copyright (c) 2018-2019 Intel Corporation | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -2962,6 +2962,28 @@ mfxStatus VideoVPPHW::Close() | |
} // mfxStatus VideoVPPHW::Close() | ||
|
||
|
||
bool VideoVPPHW::UseCopyPassThrough(const DdiTask *pTask) const | ||
{ | ||
if (!m_config.m_bCopyPassThroughEnable | ||
|| IsRoiDifferent(pTask->input.pSurf, pTask->output.pSurf)) | ||
{ | ||
return false; | ||
} | ||
|
||
if (m_pCore->GetVAType() != MFX_HW_VAAPI || m_ioMode != D3D_TO_D3D) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't this check mean that vaapi core is used? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mgonchar Yes, the cast must not fail. I don't like dropping the check, however. What can I do here, as there is no asserts in release and you think returning mfxStatus is ugly? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well, currently I see two different ways:
So both of these ways are definitely not much better than current approach. I will try to figure out better solution... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Asserts are enabled in release builds of master branch. They are switched off in builds of release branches. So, use assert if you feel it right. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here I want to be protected from some fearless code refactoring. So checking on master' release is just fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having virtual There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe adding new virtual functions to |
||
{ | ||
return true; | ||
} | ||
|
||
// Under VAAPI for D3D_TO_D3D either CM copy or VPP pipeline are preferred by | ||
// performance reasons. So, before enabling CopyPassThrough for a task we check | ||
// for CM availability to do fallback to VPP if there is no CM. | ||
// This can't be done in ConfigureExecuteParams() because CmCopy status is set later. | ||
const VAAPIVideoCORE *vaapiCore = dynamic_cast<VAAPIVideoCORE*>(m_pCore); | ||
MFX_CHECK_WITH_ASSERT(vaapiCore, false); | ||
return vaapiCore->CmCopy(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you know, I am not sure I like this code. I would probably go with just:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a huge "Can't happen!" and we are ignoring it silently, aren't we? Why not add |
||
} | ||
|
||
mfxStatus VideoVPPHW::VppFrameCheck( | ||
mfxFrameSurface1 *input, | ||
mfxFrameSurface1 *output, | ||
|
@@ -3115,9 +3137,11 @@ mfxStatus VideoVPPHW::VppFrameCheck( | |
#endif | ||
MFX_CHECK_STS(sts); | ||
|
||
bool useCopyPassThrough = UseCopyPassThrough(pTask); | ||
|
||
if (VPP_SYNC_WORKLOAD == m_workloadMode) | ||
{ | ||
pTask->bRunTimeCopyPassThrough = (true == m_config.m_bCopyPassThroughEnable && false == IsRoiDifferent(pTask->input.pSurf, pTask->output.pSurf)); | ||
pTask->bRunTimeCopyPassThrough = useCopyPassThrough; | ||
|
||
// submit task | ||
SyncTaskSubmission(pTask); | ||
|
@@ -3136,8 +3160,7 @@ mfxStatus VideoVPPHW::VppFrameCheck( | |
} | ||
else | ||
{ | ||
if (false == m_config.m_bCopyPassThroughEnable || | ||
(true == m_config.m_bCopyPassThroughEnable && true == IsRoiDifferent(pTask->input.pSurf, pTask->output.pSurf))) | ||
if (!useCopyPassThrough) | ||
{ | ||
pTask->bRunTimeCopyPassThrough = false; | ||
|
||
|
@@ -6104,7 +6127,6 @@ mfxStatus ConfigureExecuteParams( | |
executeParams.bSceneDetectionEnable = false; | ||
} | ||
|
||
#if defined(WIN64) || defined (WIN32) | ||
if ( (0 == memcmp(&videoParam.vpp.In, &videoParam.vpp.Out, sizeof(mfxFrameInfo))) && | ||
executeParams.IsDoNothing() ) | ||
{ | ||
|
@@ -6115,7 +6137,6 @@ mfxStatus ConfigureExecuteParams( | |
config.m_bCopyPassThroughEnable = false;// after Reset() parameters may be changed, | ||
// flag should be disabled | ||
} | ||
#endif//m_bCopyPassThroughEnable == false for another OS | ||
|
||
if (inDNRatio == outDNRatio && !executeParams.bVarianceEnable && !executeParams.bComposite && | ||
!(config.m_extConfig.mode == IS_REFERENCES) ) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2017-2018 Intel Corporation | ||
// Copyright (c) 2017-2019 Intel Corporation | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -812,8 +812,8 @@ VAAPIVideoCORE::GetVAService( | |
|
||
} // mfxStatus VAAPIVideoCORE::GetVAService(...) | ||
|
||
mfxStatus | ||
VAAPIVideoCORE::SetCmCopyStatus(bool enable) | ||
void | ||
VAAPIVideoCORE::SetCmCopy(bool enable) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe no sense for this function to return status There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mgonchar Is it possible to change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @onabiull : please, comment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we wan't old plugins to remain functional, we need change interfaces by adding new ones. This would affect windows version in the first hand. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @onabiull : Does this apply to VAAPIVideoCORE or VideoCORE or both? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I understand Oleg correctly, So, rename |
||
{ | ||
m_bCmCopyAllowed = enable; | ||
if (!enable) | ||
|
@@ -824,7 +824,6 @@ VAAPIVideoCORE::SetCmCopyStatus(bool enable) | |
} | ||
m_bCmCopy = false; | ||
} | ||
return MFX_ERR_NONE; | ||
} // mfxStatus VAAPIVideoCORE::SetCmCopyStatus(...) | ||
|
||
mfxStatus | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name of the function should probably be: UseCmCopyPassThrough(), right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plan was to hide mere presence of Cm. Why may a user of CopyPassThrought be interested in what is used inside? One just want fastest version, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it seems that this function implies that CM is going to be used. At least that's what I think looking into last line in its code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I got it after offline discussion. Under copy pass through we understand any mem copy operation without VP algorithms. This can be map+memcpy or cmcopy. In different modes we prefer different copy type.