Skip to content

Commit 5aae516

Browse files
walter-baiintel-mediadev
authored andcommitted
[Media Common] Revert/re-implement 0c545e1 to use VE copy as default fast dump copy method and enable changing copy method through CodecDbgSetting.cfg
To set VE copy as default copy method, prefer to change the input params instead of making internal code change.
1 parent 581fd49 commit 5aae516

File tree

7 files changed

+40
-37
lines changed

7 files changed

+40
-37
lines changed

media_softlet/agnostic/common/codec/hal/codechal_debug.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3543,22 +3543,19 @@ MOS_STATUS CodechalDebugInterface::SetFastDumpConfig(MediaCopyWrapper *mediaCopy
35433543
}
35443544
else
35453545
{
3546-
cfg.allowDataLoss = false;
3546+
cfg.allowDataLoss = m_configMgr->AttrIsEnabled(MediaDbgAttr::attrFastDumpAllowDataLoss);
35473547
cfg.informOnError = false;
35483548

3549-
MediaUserSetting::Value outValue{};
3550-
ReadUserSettingForDebug(
3551-
m_userSettingPtr,
3552-
outValue,
3553-
"Enable VECopy For Surface Dump",
3554-
MediaUserSetting::Group::Sequence);
3555-
3556-
if (outValue.Get<bool>())
3549+
// E.g., when FastDumpRenderCpyEn:1, FastDumpVeCpyEn:0, FastDumpBltCpyEn:0, only use render copy
3550+
// when FastDumpRenderCpyEn:1, FastDumpVeCpyEn:1, FastDumpBltCpyEn:0, randomly use render and VE copy
3551+
// when FastDumpRenderCpyEn:1, FastDumpVeCpyEn:1, FastDumpBltCpyEn:1, randomly use render, VE and BLT copy
3552+
// when FastDumpRenderCpyEn:0, FastDumpVeCpyEn:0, FastDumpBltCpyEn:0, use FastDump default copy method, which is VE copy
3553+
if (m_configMgr->AttrIsEnabled(MediaDbgAttr::attrFastDumpRenderCpyEn) || m_configMgr->AttrIsEnabled(MediaDbgAttr::attrFastDumpVeCpyEn)
3554+
|| m_configMgr->AttrIsEnabled(MediaDbgAttr::attrFastDumpBltCpyEn))
35573555
{
3558-
// use VE copy
3559-
cfg.weightRenderCopy = 0;
3560-
cfg.weightVECopy = 100;
3561-
cfg.weightBLTCopy = 0;
3556+
cfg.weightRenderCopy = m_configMgr->AttrIsEnabled(MediaDbgAttr::attrFastDumpRenderCpyEn) ? 100 : 0;
3557+
cfg.weightVECopy = m_configMgr->AttrIsEnabled(MediaDbgAttr::attrFastDumpVeCpyEn) ? 100 : 0;
3558+
cfg.weightBLTCopy = m_configMgr->AttrIsEnabled(MediaDbgAttr::attrFastDumpBltCpyEn) ? 100 : 0;
35623559
}
35633560
}
35643561

media_softlet/agnostic/common/shared/media_debug_config_manager.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,10 @@ void MediaDebugConfigMgr::GenerateDefaultConfig(std::string configFileName)
413413
ofs << "#" << MediaDbgAttr::attrDumpToThreadFolder << ":0" << std::endl;
414414
ofs << "#" << MediaDbgAttr::attrDumpCmdBufInBinary << ":0" << std::endl;
415415
ofs << "#" << MediaDbgAttr::attrEnableFastDump << ":1" << std::endl;
416+
ofs << "#" << MediaDbgAttr::attrFastDumpAllowDataLoss << ":0" << std::endl;
417+
ofs << "#" << MediaDbgAttr::attrFastDumpRenderCpyEn << ":0" << std::endl;
418+
ofs << "#" << MediaDbgAttr::attrFastDumpVeCpyEn << ":0" << std::endl;
419+
ofs << "#" << MediaDbgAttr::attrFastDumpBltCpyEn << ":0" << std::endl;
416420
ofs << "#" << MediaDbgAttr::attrStatusReport << ":0" << std::endl;
417421
ofs << std::endl;
418422

media_softlet/agnostic/common/shared/media_debug_fast_dump.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ class MediaDebugFastDump
8383
RangedUint8<> maxDeprioritizedMem = 75; // max percentage of deprioritized memory can be used for fast dump, 0% - 100%
8484

8585
// media copy configurations
86-
RangedUint8<> weightRenderCopy = 100; // weight for render copy, 0 - 100
87-
RangedUint8<> weightVECopy = 80; // weight for VE copy, 0 - 100
88-
RangedUint8<> weightBLTCopy = 20; // weight for BLT copy, 0 - 100
86+
RangedUint8<> weightRenderCopy = 0; // weight for render copy, 0 - 100
87+
RangedUint8<> weightVECopy = 100; // weight for VE copy, 0 - 100
88+
RangedUint8<> weightBLTCopy = 0; // weight for BLT copy, 0 - 100
8989
// when weightRenderCopy, weightVECopy and weightBLTCopy are all 0, use default copy method,
9090
// otherwise randomly select 1 of the 3 methods based on their weights, e.g., the chance of
9191
// selecting render copy is weightRenderCopy/(weightRenderCopy+weightVECopy+weightBLTCopy)

media_softlet/agnostic/common/shared/media_debug_fast_dump_imp.hpp

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -622,18 +622,25 @@ class MediaDebugFastDumpImp : public MediaDebugFastDump
622622
}
623623
else
624624
{
625-
if (cfg.weightVECopy == 100) //Force VE-Copy
626-
{
627-
m_copyMethod = [=] {
628-
return MCPY_METHOD_BALANCE;
629-
};
630-
}
631-
else
632-
{
633-
m_copyMethod = [] {
634-
return MCPY_METHOD_DEFAULT;
625+
const auto weightRenderCopy = static_cast<double>(cfg.weightRenderCopy);
626+
const auto weightVECopy = static_cast<double>(cfg.weightVECopy);
627+
const auto weightBLTCopy = static_cast<double>(cfg.weightBLTCopy);
628+
629+
m_copyMethod = [=] {
630+
const MCPY_METHOD methods[] = {
631+
MCPY_METHOD_PERFORMANCE,
632+
MCPY_METHOD_BALANCE,
633+
MCPY_METHOD_POWERSAVING,
635634
};
636-
}
635+
std::random_device rd;
636+
std::mt19937 gen(rd());
637+
std::discrete_distribution<> distribution({
638+
weightRenderCopy,
639+
weightVECopy,
640+
weightBLTCopy,
641+
});
642+
return methods[distribution(gen)];
643+
};
637644
}
638645
}
639646

media_softlet/agnostic/common/shared/media_debug_serializer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727

2828
#if USE_MEDIA_DEBUG_TOOL
2929

30+
#include <cstdint>
3031
#include <cstring>
3132
#include <iomanip>
3233
#include <ostream>
3334
#include <sstream>
3435
#include <string>
3536
#include <typeinfo>
3637
#include <type_traits>
37-
#include <stdint.h>
3838
#include "media_class_trace.h"
3939

4040
template <typename T, typename = void>

media_softlet/agnostic/common/shared/media_debug_utils.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ static const char *attrDumpBufferInBinary = "DumpBufferInBinary";
4141
static const char *attrDumpToThreadFolder = "DumpToThreadFolder";
4242
static const char *attrDumpCmdBufInBinary = "DumpCmdBufInBinary";
4343
static const char *attrEnableFastDump = "EnableFastDump";
44+
static const char *attrFastDumpAllowDataLoss = "FastDumpAllowDataLoss";
45+
static const char *attrFastDumpRenderCpyEn = "FastDumpRenderCpyEn";
46+
static const char *attrFastDumpVeCpyEn = "FastDumpVeCpyEn";
47+
static const char *attrFastDumpBltCpyEn = "FastDumpBltCpyEn";
4448

4549
//Codec Attr
4650
static const char *attrPicParams = "PicParams";

media_softlet/agnostic/common/shared/pipeline/media_user_setting.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,5 @@ MOS_STATUS MediaPipeline::InitUserSetting(MediaUserSettingSharedPtr userSettingP
3939
int32_t(1),
4040
false);
4141

42-
#if (_DEBUG || _RELEASE_INTERNAL)
43-
DeclareUserSettingKeyForDebug(
44-
userSettingPtr,
45-
"Enable VECopy For Surface Dump",
46-
MediaUserSetting::Group::Sequence,
47-
false,
48-
false);
49-
#endif // _DEBUG || _RELEASE_INTERNAL
50-
5142
return MOS_STATUS_SUCCESS;
5243
}

0 commit comments

Comments
 (0)