You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.9 KiB

/*
* Copyright (c) Hisilicon Technologies Co., Ltd.. 2022-2022. All rights reserved.
* Description: Support private hwgraphics hidl interface
* Author: Hisilicon
* Created: 2022.11.10
*/
#include "HWCDft.h"
#include <utils/Log.h>
#include "dft_event.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
volatile int g_sidebandInject = 0;
__attribute__((optnone)) void SidebandPlayInjectFault()
{
g_sidebandInject = 1;
}
__attribute__((optnone)) void SidebandPlayUnInjectFault()
{
g_sidebandInject = 0;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
using namespace dft;
HWCDft* HWCDft::instance = new HWCDft();
HWCDft::~HWCDft()
{
if (instance != nullptr) {
delete instance;
instance = nullptr;
}
}
HWCDft* HWCDft::GetInstance()
{
return instance;
}
void HWCDft::ReportFaultIfNecessary(bool execReport, int eventId, FaultInfo& info) const
{
bool ignoreReport = !execReport && (g_sidebandInject != 1);
if (ignoreReport) {
return;
}
unsigned int handle;
ALOGI("reportFault partion: hwc, function: %s", info.funName.c_str());
int retValue = dft_event_create(eventId, &handle);
if (retValue == SUCCESS) {
dft_event_put_string(handle, "PNAME", "hwc");
dft_event_put_string(handle, "F1NAME", info.funName.c_str());
dft_event_put_string(handle, "P1NAME", info.fParamName.c_str());
dft_event_put_integral(handle, "P1VALUE", info.fParamValue);
dft_event_put_string(handle, "P2NAME", info.sParamName.c_str());
dft_event_put_integral(handle, "P2VALUE", info.sParamValue);
dft_event_report(handle);
dft_event_destroy(handle);
ALOGI("reportFault success, partion: hwc, function: %s", info.funName.c_str());
} else {
ALOGE("reportFault create fail, function:%s retValue:%d", info.funName.c_str(), retValue);
}
return;
}