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.
1275 lines
40 KiB
1275 lines
40 KiB
/*
|
|
* Copyright (c) Hisilicon Technologies Co., Ltd.. 2019-2022. All rights reserved.
|
|
* Description: Support hwdisplay hal adaptation interface
|
|
* Author: Hisilicon
|
|
* Created: 2022-12-28
|
|
*/
|
|
|
|
#include "display.h"
|
|
#include <cstdio>
|
|
#include <cstdlib>
|
|
#include <fcntl.h>
|
|
#include <sys/ioctl.h>
|
|
#include <pthread.h>
|
|
#include <securec.h>
|
|
#include <map>
|
|
|
|
#include <cutils/log.h>
|
|
#include <cutils/properties.h>
|
|
#include <hardware/hardware.h>
|
|
|
|
#include "DisplayImpl.h"
|
|
#include "DisplayLog.h"
|
|
#include "EnumCommad.h"
|
|
#include "td_type.h"
|
|
#include "uapi_pmoc.h"
|
|
|
|
static bool g_debuglog = true;
|
|
|
|
#undef LOG_TAG
|
|
#define LOG_TAG "display"
|
|
|
|
#define BUFLEN PROP_VALUE_MAX
|
|
#define PROPERTY_LEN PROP_VALUE_MAX
|
|
|
|
struct DisplayContextT *g_dispCtx = nullptr;
|
|
|
|
using namespace android;
|
|
|
|
static Mutex g_lock;
|
|
|
|
static td_s32 GetDispmngCount(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)in;
|
|
td_s32 count = 0;
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetDispmngCount(count);
|
|
|
|
out.writeInt32(count);
|
|
ALOGI("count:%d, ret:%d", count, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetDispmngDispid(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = 0;
|
|
td_s32 index = in.readInt32();
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetDispmngDispid(index, dispid);
|
|
|
|
out.writeInt32(dispid);
|
|
|
|
ALOGI("get display id:%d for index:%d, ret:%d", dispid, index, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 DispmngAttachDispid(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dstid = in.readInt32();
|
|
td_s32 srcid = in.readInt32();
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->DispmngAttachDispid(dstid, srcid);
|
|
|
|
ALOGI("dstid:%d, srcid:%d, ret:%d", dstid, srcid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 DispmngDetachDispid(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dstid = in.readInt32();
|
|
td_s32 srcid = in.readInt32();
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->DispmngDetachDispid(dstid, srcid);
|
|
|
|
ALOGI("dstid:%d, srcid:%d, ret:%d", dstid, srcid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetBrightness(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
td_u32 brightness = in.readUint32();
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetBrightness(dispid, brightness);
|
|
|
|
ALOGI("dispid:%d, brightness:%d, ret:%d", dispid, brightness, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetBrightness(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
td_u32 brightness = 0;
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetBrightness(dispid, brightness);
|
|
|
|
out.writeInt32(brightness);
|
|
ALOGI("dispid:%d, brightness:%d, ret:%d", dispid, brightness, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetContrast(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
td_u32 contrast = 0;
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetContrast(dispid, contrast);
|
|
|
|
out.writeInt32(contrast);
|
|
ALOGI("dispid:%d, contrast:%d, ret:%d", dispid, contrast, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetContrast(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
td_u32 contrast = in.readUint32();
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetContrast(dispid, contrast);
|
|
|
|
ALOGI("dispid:%d, contrast:%d, ret:%d", dispid, contrast, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetHue(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
td_u32 hue = 0;
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetHue(dispid, hue);
|
|
|
|
out.writeInt32(hue);
|
|
ALOGI("dispid:%d, hue:%d, ret:%d", dispid, hue, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetHue(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
td_u32 hue = in.readUint32();
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetHue(dispid, hue);
|
|
|
|
ALOGI("dispid:%d, hue:%d, ret:%d", dispid, hue, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetSaturation(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
td_u32 saturation = 0;
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetSaturation(dispid, saturation);
|
|
|
|
out.writeInt32(saturation);
|
|
ALOGI("dispid:%d, saturation:%d, ret:%d", dispid, saturation, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
static td_s32 SetSaturation(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
td_u32 saturation = in.readUint32();
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetSaturation(dispid, saturation);
|
|
|
|
ALOGI("dispid:%d, saturation:%d, ret:%d", dispid, saturation, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetBacklight(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
td_u32 backlight = 0;
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetBacklight(dispid, backlight);
|
|
|
|
out.writeInt32(backlight);
|
|
ALOGI("dispid:%d, backlight:%d, ret:%d", dispid, backlight, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetBacklight(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
td_u32 backlight = in.readUint32();
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetBacklight(dispid, backlight);
|
|
|
|
ALOGI("dispid:%d, backlight:%d, ret:%d", dispid, backlight, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetScreenOffset(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
CROP_RECT_S offset = {};
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetScreenOffset(dispid, offset);
|
|
|
|
out.writeInt32(offset.u32LeftOffset);
|
|
out.writeInt32(offset.u32TopOffset);
|
|
out.writeInt32(offset.u32RightOffset);
|
|
out.writeInt32(offset.u32BottomOffset);
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetScreenOffset(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
CROP_RECT_S offset = {};
|
|
offset.u32LeftOffset = in.readUint32();
|
|
offset.u32TopOffset = in.readUint32();
|
|
offset.u32RightOffset = in.readUint32();
|
|
offset.u32BottomOffset = in.readUint32();
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetScreenOffset(dispid, offset);
|
|
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetEnableHdcp(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
DispHdcpMode mode = static_cast<DispHdcpMode>(in.readInt32());
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetEnableHdcp(dispid, mode);
|
|
|
|
ALOGI("dispid:%d, hdcp mode:%d, ret:%d", dispid, mode, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetDisableHdcp(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetDisableHdcp(dispid);
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetHdcpCapability(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
DispHdcpCapability cap = {};
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetHdcpCapability(dispid, cap);
|
|
|
|
out.writeInt32(cap.support14);
|
|
out.writeInt32(cap.support2x);
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetHdcpStatus(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
DispHdcpStatus status = {};
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetHdcpStatus(dispid, status);
|
|
|
|
out.writeInt32(status.authStart);
|
|
out.writeInt32(status.authSuccess);
|
|
out.writeInt32(status.reauthTimes);
|
|
out.writeInt32(status.mode);
|
|
out.writeInt32(status.errCode);
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetHdrType(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
td_s32 hdrType = 0;
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetHdrType(dispid, hdrType);
|
|
|
|
out.writeInt32(hdrType);
|
|
ALOGI("dispid:%d, hdrType:%d, ret:%d", dispid, hdrType, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetHdrType(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
td_s32 hdrType = in.readInt32();
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetHdrType(dispid, hdrType);
|
|
|
|
ALOGI("dispid:%d, hdrType:%d, ret:%d", dispid, hdrType, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetVirtualScreenhw(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
td_u32 width = 0;
|
|
td_u32 height = 0;
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetVirtualScreenhw(dispid, width, height);
|
|
|
|
out.writeInt32(width);
|
|
out.writeInt32(height);
|
|
ALOGI("dispid:%d, width:%d, height:%d", dispid, width, height);
|
|
return s32Ret;
|
|
}
|
|
static td_s32 SetVirtualScreenhw(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
td_u32 width = in.readUint32();
|
|
td_u32 height = in.readUint32();
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetVirtualScreenhw(dispid, width, height);
|
|
|
|
ALOGI("dispid:%d, width:%d, height:%d", dispid, width, height);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetQmsEnable(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
td_bool enable = TD_FALSE;
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetQmsEnable(dispid, enable);
|
|
out.writeInt32(enable);
|
|
|
|
ALOGI("dispid:%d, enable:%d", dispid, enable);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetQmsEnable(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
td_bool enable = static_cast<td_bool>(in.readInt32());
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetQmsEnable(dispid, enable);
|
|
|
|
ALOGI("dispid:%d, enable:%d", dispid, enable);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetQmsAttr(const Parcel &in, Parcel &out)
|
|
{
|
|
td_u32 qmsRate = 0;
|
|
td_s32 dispid = in.readInt32();
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetQmsAttr(dispid, qmsRate);
|
|
out.writeInt32(qmsRate);
|
|
|
|
ALOGI("dispid:%d, dst_rate:%d", dispid, qmsRate);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetQmsAttr(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_u32 qmsRate = 0;
|
|
|
|
td_s32 dispid = in.readInt32();
|
|
qmsRate = static_cast<td_u32>(in.readInt32());
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetQmsAttr(dispid, qmsRate);
|
|
|
|
ALOGI("dispid:%d, dst_rate:%d", dispid, qmsRate);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetVrrEnable(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
td_bool enable = TD_FALSE;
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetVrrEnable(dispid, enable);
|
|
out.writeInt32(enable);
|
|
|
|
ALOGI("dispid:%d, enable:%d", dispid, enable);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetVrrEnable(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
td_bool enable = static_cast<td_bool>(in.readInt32());
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetVrrEnable(dispid, enable);
|
|
|
|
ALOGI("dispid:%d, enable:%d", dispid, enable);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetAllmAttr(const Parcel &in, Parcel &out)
|
|
{
|
|
td_u32 allmMode = 0;
|
|
td_s32 dispid = in.readInt32();
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetAllmAttr(dispid, allmMode);
|
|
out.writeInt32(allmMode);
|
|
|
|
ALOGI("dispid:%d, allmMode:%d", dispid, allmMode);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetAllmAttr(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_u32 allmMode = 0;
|
|
|
|
td_s32 dispid = in.readInt32();
|
|
allmMode = static_cast<td_u32>(in.readInt32());
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetAllmAttr(dispid, allmMode);
|
|
|
|
ALOGI("dispid:%d, allmMode:%d", dispid, allmMode);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetOutputStatus(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
DispOutputStatus status = {};
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetOutputStatus(dispid, status);
|
|
out.writeInt32(status.actualOutHdrType);
|
|
out.writeInt32(status.actualOutColorpace);
|
|
out.writeInt32(status.refreshRate);
|
|
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetDisplayStatus(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
DisplayStatus status = {};
|
|
/* waiting */
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetDisplayStatus(dispid, status);
|
|
for (td_u32 i = 0; i < status.number; i++) {
|
|
int type = static_cast<int>(status.intf[i].intfType);
|
|
if (status.intf[i].intfType == DispIntfType::DISPMNG_INTERFACE_HDMITX) {
|
|
out.writeInt32(5); /* date length is 5 */
|
|
out.writeInt32(type);
|
|
out.writeInt32(status.intf[i].intf.cvbs.dac);
|
|
out.writeInt32(status.intf[i].intf.cvbs.connected);
|
|
out.writeInt32(status.intf[i].intf.cvbs.cgms);
|
|
out.writeInt32(status.intf[i].intf.cvbs.macrovision);
|
|
} else if (status.intf[i].intfType == DispIntfType::DISPMNG_INTERFACE_CVBS) {
|
|
out.writeInt32(5); /* date length is 5 */
|
|
out.writeInt32(type);
|
|
out.writeInt32(status.intf[i].intf.hdmi.hdmitxId);
|
|
out.writeInt32(status.intf[i].intf.hdmi.connStatus);
|
|
out.writeInt32(status.intf[i].intf.hdmi.rsenStatus);
|
|
out.writeInt32(status.intf[i].intf.hdmi.enabled);
|
|
} else if (status.intf[i].intfType == DispIntfType::DISPMNG_INTERFACE_PANEL) {
|
|
out.writeInt32(6); /* date length is 6 */
|
|
out.writeInt32(type);
|
|
out.writeInt32(status.intf[i].intf.panel.panelId);
|
|
out.writeInt32(status.intf[i].intf.panel.powerOn);
|
|
out.writeInt32(status.intf[i].intf.panel.dynamicBacklightEnabled);
|
|
out.writeInt32(status.intf[i].intf.panel.backlightLevel);
|
|
out.writeInt32(status.intf[i].intf.panel.abnormal);
|
|
}
|
|
}
|
|
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetDisplayInfo(const Parcel &in, Parcel &out)
|
|
{
|
|
DispSinkInfo info = {};
|
|
|
|
td_s32 dispid = in.readInt32();
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetDisplayInfo(dispid, info);
|
|
|
|
std::string tempStr = (char *)info.mfrsName;
|
|
out.writeInt32(5); /* date length is 5 */
|
|
out.writeString16(String16(tempStr.c_str()));
|
|
out.writeInt32(info.productCode);
|
|
out.writeInt32(info.serialNumber);
|
|
out.writeInt32(info.week);
|
|
out.writeInt32(info.year);
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_void WriteDispCapDolbyVision(const DisplayCapability &cap, Parcel &out)
|
|
{
|
|
out.writeInt32(cap.dolbyVision.supportV0);
|
|
out.writeInt32(cap.dolbyVision.supportV1);
|
|
out.writeInt32(cap.dolbyVision.supportV2);
|
|
out.writeInt32(cap.dolbyVision.v0.yuv42212bit);
|
|
out.writeInt32(cap.dolbyVision.v0.support2160p60);
|
|
out.writeInt32(cap.dolbyVision.v0.globalDimming);
|
|
out.writeInt32(cap.dolbyVision.v0.whiteX);
|
|
out.writeInt32(cap.dolbyVision.v0.whiteY);
|
|
out.writeInt32(cap.dolbyVision.v0.dmMajorVersion);
|
|
out.writeInt32(cap.dolbyVision.v0.dmMinorVersion);
|
|
out.writeInt32(cap.dolbyVision.v0.minPq);
|
|
out.writeInt32(cap.dolbyVision.v0.maxPq);
|
|
out.writeInt32(cap.dolbyVision.v0.redX);
|
|
out.writeInt32(cap.dolbyVision.v0.redY);
|
|
out.writeInt32(cap.dolbyVision.v0.greenX);
|
|
out.writeInt32(cap.dolbyVision.v0.greenY);
|
|
out.writeInt32(cap.dolbyVision.v0.blueX);
|
|
out.writeInt32(cap.dolbyVision.v0.blueY);
|
|
out.writeInt32(cap.dolbyVision.v1.yuv42212bit);
|
|
out.writeInt32(cap.dolbyVision.v1.support2160p60);
|
|
out.writeInt32(cap.dolbyVision.v1.globalDimming);
|
|
out.writeInt32(cap.dolbyVision.v1.colorimetry);
|
|
out.writeInt32(cap.dolbyVision.v1.dmVersion);
|
|
out.writeInt32(cap.dolbyVision.v1.lowLatency);
|
|
out.writeInt32(cap.dolbyVision.v1.minLuminance);
|
|
out.writeInt32(cap.dolbyVision.v1.maxLuminance);
|
|
out.writeInt32(cap.dolbyVision.v1.redX);
|
|
out.writeInt32(cap.dolbyVision.v1.redY);
|
|
out.writeInt32(cap.dolbyVision.v1.greenX);
|
|
out.writeInt32(cap.dolbyVision.v1.greenY);
|
|
out.writeInt32(cap.dolbyVision.v1.blueX);
|
|
out.writeInt32(cap.dolbyVision.v1.blueY);
|
|
out.writeInt32(cap.dolbyVision.v2.yuv42212bit);
|
|
out.writeInt32(cap.dolbyVision.v2.backLightContol);
|
|
out.writeInt32(cap.dolbyVision.v2.globalDimming);
|
|
out.writeInt32(cap.dolbyVision.v2.dmVersion);
|
|
out.writeInt32(cap.dolbyVision.v2.backltMinLuma);
|
|
out.writeInt32(cap.dolbyVision.v2.interface);
|
|
out.writeInt32(cap.dolbyVision.v2.yuv444Rgb44410b12b);
|
|
out.writeInt32(cap.dolbyVision.v2.minPqV2);
|
|
out.writeInt32(cap.dolbyVision.v2.maxPqV2);
|
|
out.writeInt32(cap.dolbyVision.v2.redX);
|
|
out.writeInt32(cap.dolbyVision.v2.redY);
|
|
out.writeInt32(cap.dolbyVision.v2.greenX);
|
|
out.writeInt32(cap.dolbyVision.v2.greenY);
|
|
out.writeInt32(cap.dolbyVision.v2.blueX);
|
|
out.writeInt32(cap.dolbyVision.v2.blueY);
|
|
|
|
return;
|
|
}
|
|
|
|
static td_s32 GetDisplayCapabilities(const Parcel &in, Parcel &out)
|
|
{
|
|
DisplayCapability cap = {};
|
|
|
|
td_s32 dispid = in.readInt32();
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetDisplayCapabilities(dispid, cap);
|
|
|
|
out.writeInt32(DISP_COLORIMETRY_MAX);
|
|
for (td_u32 i = 0; i < DISP_COLORIMETRY_MAX; i++) {
|
|
out.writeInt32(cap.colorimetry.colorimetry[i]);
|
|
}
|
|
|
|
out.writeInt32(47); /* date length is 47 */
|
|
WriteDispCapDolbyVision(cap, out);
|
|
|
|
out.writeInt32(15); /* date length is 15 */
|
|
out.writeInt32(cap.hdr.eotf.eotfSdr);
|
|
out.writeInt32(cap.hdr.eotf.eotfHdr);
|
|
out.writeInt32(cap.hdr.eotf.eotfSmpteSt2084);
|
|
out.writeInt32(cap.hdr.eotf.eotfHlg);
|
|
out.writeInt32(cap.hdr.staticMetadata.staticType1);
|
|
out.writeInt32(cap.hdr.staticMetadata.maxLumCv);
|
|
out.writeInt32(cap.hdr.staticMetadata.averLumCv);
|
|
out.writeInt32(cap.hdr.staticMetadata.minLumCv);
|
|
out.writeInt32(cap.hdr.dynamicMetadata.dynamicType1Support);
|
|
out.writeInt32(cap.hdr.dynamicMetadata.dynamicType1Version);
|
|
out.writeInt32(cap.hdr.dynamicMetadata.dynamicType2Support);
|
|
out.writeInt32(cap.hdr.dynamicMetadata.dynamicType2Version);
|
|
out.writeInt32(cap.hdr.dynamicMetadata.dynamicType3Support);
|
|
out.writeInt32(cap.hdr.dynamicMetadata.dynamicType4Support);
|
|
out.writeInt32(cap.hdr.dynamicMetadata.dynamicType4Version);
|
|
|
|
out.writeInt32(5); /* date length is 5 */
|
|
out.writeInt32(cap.latency.latencyPresent);
|
|
out.writeInt32(cap.latency.pvideoLatency);
|
|
out.writeInt32(cap.latency.paudioLatency);
|
|
out.writeInt32(cap.latency.ivideoLatency);
|
|
out.writeInt32(cap.latency.iaudioLatency);
|
|
|
|
out.writeInt32(9); /* date length is 9 */
|
|
out.writeInt32(cap.vrr.support);
|
|
out.writeInt32(cap.vrr.fva);
|
|
out.writeInt32(cap.vrr.cnmVrr);
|
|
out.writeInt32(cap.vrr.cinemaVrr);
|
|
out.writeInt32(cap.vrr.mDelta);
|
|
out.writeInt32(cap.vrr.fapaStartLocat);
|
|
out.writeInt32(cap.vrr.allm);
|
|
out.writeInt32(cap.vrr.vrrMin);
|
|
out.writeInt32(cap.vrr.vrrMax);
|
|
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static void ConfigDisplayMode(Parcel &out, DisplayMode mode)
|
|
{
|
|
std::string tempStr = (td_char *)mode.name;
|
|
out.writeInt32(mode.vic);
|
|
out.writeInt32(mode.format);
|
|
out.writeInt32(mode.pixelFormat);
|
|
out.writeInt32(mode.bitDepth);
|
|
out.writeString16(String16(tempStr.c_str()));
|
|
out.writeInt32(mode.width);
|
|
out.writeInt32(mode.height);
|
|
out.writeInt32(mode.progressive);
|
|
out.writeInt32(mode.fieldRate);
|
|
|
|
return;
|
|
}
|
|
|
|
static void SetSupportedModeList(Parcel &out, DisplayAvailableMode* mode)
|
|
{
|
|
td_s32 length = static_cast<td_s32>((mode->number + 2) * 9);
|
|
out.writeInt32(length);
|
|
ConfigDisplayMode(out, mode->nativeMode);
|
|
ConfigDisplayMode(out, mode->maxMode);
|
|
for (td_u32 i = 0; i < mode->number; i++) {
|
|
ConfigDisplayMode(out, mode->mode[i]);
|
|
}
|
|
}
|
|
|
|
static td_s32 GetDisplaySupportedModeList(const Parcel &in, Parcel &out)
|
|
{
|
|
DisplayAvailableMode mode = {};
|
|
|
|
td_s32 dispid = in.readInt32();
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetDisplaySupportedModeList(dispid, mode);
|
|
|
|
SetSupportedModeList(out, &mode);
|
|
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetDisplayAllModeList(const Parcel &in, Parcel &out)
|
|
{
|
|
DisplayAvailableMode mode = {};
|
|
|
|
td_s32 dispid = in.readInt32();
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetDisplayAllModeList(dispid, mode);
|
|
|
|
SetSupportedModeList(out, &mode);
|
|
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetDisplayMode(const Parcel &in, Parcel &out)
|
|
{
|
|
DisplayMode mode = {};
|
|
|
|
td_s32 dispid = in.readInt32();
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetDisplayMode(dispid, mode);
|
|
|
|
out.writeInt32(9); /* date length is 9 */
|
|
ConfigDisplayMode(out, mode);
|
|
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetDisplayMode(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
DisplayMode mode = {};
|
|
|
|
td_s32 dispid = in.readInt32();
|
|
|
|
mode.vic = in.readUint32();
|
|
mode.format = in.readUint32();
|
|
mode.pixelFormat = in.readUint32();
|
|
mode.bitDepth = in.readUint32();
|
|
String8 name = String8(in.readString16());
|
|
errno_t rc = strcpy_s((char *)mode.name, MAX_DISPLAY_MODE_NAME_LENGTH, name.c_str());
|
|
if (rc != EOK) {
|
|
ALOGE("strcpy_s failed, rc = %d", rc);
|
|
return TD_FAILURE;
|
|
}
|
|
mode.width = in.readUint32();
|
|
mode.height = in.readUint32();
|
|
mode.progressive = static_cast<td_bool>(in.readBool());
|
|
mode.fieldRate = in.readUint32();
|
|
|
|
bool invalidPara = (td_s32)mode.vic < 0 || (td_s32)mode.format < 0 || (td_s32)mode.pixelFormat < 0 ||
|
|
(td_s32)mode.bitDepth < 0 || (td_s32)mode.width < 0 || (td_s32)mode.height < 0;
|
|
if (invalidPara) {
|
|
ALOGE("Invalid parameter");
|
|
return TD_FAILURE;
|
|
}
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetDisplayMode(dispid, mode);
|
|
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetSceneMode(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
td_s32 mode = 0;
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetSceneMode(dispid, mode);
|
|
|
|
out.writeInt32(mode);
|
|
ALOGI("dispid:%d, mode:%d", dispid, mode);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetSceneMode(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
td_s32 mode = in.readInt32();
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetSceneMode(dispid, mode);
|
|
|
|
ALOGI("dispid:%d, mode:%d", dispid, mode);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetAspectRatio(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
VideoAspectInfo ratio = {};
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetAspectRatio(dispid, ratio);
|
|
|
|
out.writeInt32(ratio.ratio);
|
|
out.writeInt32(ratio.width);
|
|
out.writeInt32(ratio.height);
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetAspectRatio(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
VideoAspectInfo ratio = {};
|
|
ratio.ratio = in.readUint32();
|
|
ratio.width = in.readUint32();
|
|
ratio.height = in.readUint32();
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetAspectRatio(dispid, ratio);
|
|
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetHdrMatchContent(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
td_bool match = TD_FALSE;
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetHdrMatchContent(dispid, match);
|
|
|
|
out.writeInt32(match);
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
static td_s32 SetHdrMatchContent(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
td_bool match = static_cast<td_bool>(in.readInt32());
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetHdrMatchContent(dispid, match);
|
|
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 LoadHDCPKey(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
DispHdcpKey key = {};
|
|
key.keyVersion = in.readUint32();
|
|
key.length = in.readInt32();
|
|
td_u8 tempArry[key.length];
|
|
for (td_s32 i = 0; i < key.length; i++) {
|
|
tempArry[i] = in.readInt32();
|
|
}
|
|
|
|
key.data = tempArry;
|
|
td_s32 s32Ret = DisplayImpl::Instance()->LoadHDCPKey(dispid, key);
|
|
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 LoadHDCPSrm(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
DispHdcpSrm srm = {};
|
|
srm.length = in.readInt32();
|
|
td_u8 tempArry[srm.length];
|
|
|
|
for (td_s32 i = 0; i < srm.length; i++) {
|
|
tempArry[i] = in.readInt32();
|
|
}
|
|
srm.data = tempArry;
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->LoadHDCPSrm(dispid, srm);
|
|
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetHdmiConfigInfo(const Parcel &in, Parcel &out)
|
|
{
|
|
td_u32 hdmitx = static_cast<td_u32>(in.readInt32());
|
|
HdmiConfigInfo cfgInfo = {};
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetHdmiConfigInfo(hdmitx, cfgInfo);
|
|
|
|
out.writeInt32(4); /* date length is 4 */
|
|
out.writeInt32(cfgInfo.hdcpEnable);
|
|
out.writeInt32(cfgInfo.hdcpMode);
|
|
out.writeInt32(cfgInfo.cecEnable);
|
|
out.writeInt32(cfgInfo.cecMode);
|
|
|
|
ALOGI("hdmitx:%d, ret:%d", hdmitx, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetHdmiConfigInfo(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
HdmiConfigInfo cfgInfo = {};
|
|
td_u32 hdmitx = static_cast<td_u32>(in.readInt32());
|
|
cfgInfo.hdcpEnable = static_cast<td_u32>(in.readInt32());
|
|
cfgInfo.hdcpMode = static_cast<td_u32>(in.readInt32());
|
|
cfgInfo.cecEnable = static_cast<td_u32>(in.readInt32());
|
|
cfgInfo.cecMode = static_cast<td_u32>(in.readInt32());
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetHdmiConfigInfo(hdmitx, cfgInfo);
|
|
|
|
ALOGI("hdmitx:%d, ret:%d", hdmitx, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetHdmitxidByDispid(const Parcel &in, Parcel &out)
|
|
{
|
|
td_u32 dispid = static_cast<td_u32>(in.readInt32());
|
|
td_u32 hdmitx = 0;
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetHdmitxidByDispid(dispid, hdmitx);
|
|
|
|
out.writeInt32(hdmitx);
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetDisplayConfig(const Parcel &in, Parcel &out)
|
|
{
|
|
td_u32 dispid = static_cast<td_u32>(in.readInt32());
|
|
DisplayConfig cfgInfo = {};
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetDisplayConfig(dispid, cfgInfo);
|
|
|
|
out.writeInt32(10); /* date length is 10 */
|
|
out.writeInt32(cfgInfo.index);
|
|
out.writeInt32(cfgInfo.enable);
|
|
out.writeInt32(cfgInfo.attach);
|
|
out.writeInt32(cfgInfo.srcDisp);
|
|
out.writeInt32(cfgInfo.rType);
|
|
out.writeInt32(cfgInfo.rAngle);
|
|
out.writeInt32(cfgInfo.hFlip);
|
|
out.writeInt32(cfgInfo.vFlip);
|
|
out.writeInt32(cfgInfo.touchId);
|
|
out.writeInt32(cfgInfo.panelIndex);
|
|
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetDisplayConfig(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
DisplayConfig cfgInfo = {};
|
|
td_u32 dispid = static_cast<td_u32>(in.readInt32());
|
|
cfgInfo.index = static_cast<td_u32>(in.readInt32());
|
|
cfgInfo.enable = static_cast<td_bool>(in.readInt32());
|
|
cfgInfo.attach = static_cast<td_bool>(in.readInt32());
|
|
cfgInfo.srcDisp = static_cast<td_u32>(in.readInt32());
|
|
cfgInfo.rType = static_cast<td_u32>(in.readInt32());
|
|
cfgInfo.rAngle = static_cast<td_u32>(in.readInt32());
|
|
cfgInfo.hFlip = static_cast<td_bool>(in.readInt32());
|
|
cfgInfo.vFlip = static_cast<td_bool>(in.readInt32());
|
|
cfgInfo.touchId = static_cast<td_u32>(in.readInt32());
|
|
cfgInfo.panelIndex = static_cast<td_u32>(in.readInt32());
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetDisplayConfig(dispid, cfgInfo);
|
|
|
|
ALOGI("dispid:%d, ret:%d", dispid, s32Ret);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetVrrAttr(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispid = in.readInt32();
|
|
DISPLAY_RANGE_S range = {};
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetVrrAttr(dispid, range);
|
|
out.writeInt32(range.min);
|
|
out.writeInt32(range.max);
|
|
|
|
ALOGI("dispid:%d, min:%d, max:%d", dispid, range.min, range.max);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetVrrAttr(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispid = in.readInt32();
|
|
DISPLAY_RANGE_S range = {};
|
|
range.min = in.readUint32();
|
|
range.max = in.readUint32();
|
|
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetVrrAttr(dispid, range);
|
|
|
|
ALOGI("dispid:%d, min:%d, max:%d", dispid, range.min, range.max);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetPQBypass(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)in;
|
|
td_u32 enable = 0;
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetPQBypass(enable);
|
|
out.writeInt32(enable);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetPQBypass(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 enable = in.readInt32();
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetPQBypass(enable);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetAspectCvrs(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)in;
|
|
td_s32 cvrs = DisplayImpl::Instance()->GetAspectCvrs();
|
|
out.writeInt32(cvrs);
|
|
return TD_SUCCESS;
|
|
}
|
|
|
|
static td_s32 SetAspectCvrs(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 cvrs = in.readInt32();
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetAspectCvrs(cvrs);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetHdmiStart(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispId = in.readInt32();
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetHdmiStart(dispId);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetHdmiStop(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispId = in.readInt32();
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetHdmiStop(dispId);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetEnable3D(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispId = in.readInt32();
|
|
td_bool enable = TD_FALSE;
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetEnable3D(dispId, enable);
|
|
out.writeInt32(enable);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetEnable3D(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispId = in.readInt32();
|
|
td_bool enable = static_cast<td_bool>(in.readInt32());
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetEnable3D(dispId, enable);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 AttachIntf(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispId = in.readInt32();
|
|
td_s32 s32Ret = DisplayImpl::Instance()->AttachIntf(dispId);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 DetachIntf(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispId = in.readInt32();
|
|
td_s32 s32Ret = DisplayImpl::Instance()->AttachIntf(dispId);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetDisplayWindowNumber(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispId = in.readInt32();
|
|
uapi_win_handle_info handleInfo = {};
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetDisplayWindowNumber(dispId, &handleInfo);
|
|
if (s32Ret == 0) {
|
|
out.writeInt32(handleInfo.win_num);
|
|
}
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 GetFmtFromVic(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 vic = in.readInt32();
|
|
td_s32 fmt = DisplayImpl::Instance()->GetFmtFromVic(vic);
|
|
out.writeInt32(fmt);
|
|
return TD_SUCCESS;
|
|
}
|
|
|
|
static td_s32 GetVicFromFmt(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 fmt = in.readInt32();
|
|
td_s32 vic = DisplayImpl::Instance()->GetVicFromFmt(fmt);
|
|
out.writeInt32(vic);
|
|
return TD_SUCCESS;
|
|
}
|
|
|
|
static td_s32 GetDisplayLuminance(const Parcel &in, Parcel &out)
|
|
{
|
|
td_s32 dispId = in.readInt32();
|
|
uapi_svr_dispmng_display_luminance luminance = {};
|
|
td_s32 s32Ret = DisplayImpl::Instance()->GetDisplayLuminance(dispId, luminance);
|
|
out.writeInt32(luminance.min_luminance);
|
|
out.writeInt32(luminance.max_luminance);
|
|
return s32Ret;
|
|
}
|
|
|
|
static td_s32 SetDisplayLuminance(const Parcel &in, Parcel &out)
|
|
{
|
|
(void)out;
|
|
td_s32 dispId = in.readInt32();
|
|
uapi_svr_dispmng_display_luminance luminance = {};
|
|
luminance.min_luminance = in.readUint32();
|
|
luminance.max_luminance = in.readUint32();
|
|
td_s32 s32Ret = DisplayImpl::Instance()->SetDisplayLuminance(dispId, luminance);
|
|
return s32Ret;
|
|
}
|
|
|
|
static std::map<DISP_COMMAND_E, LocalAtomicPfn> g_pfnMap = {
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETDISPCOUNT, GetDispmngCount },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETDISPID, GetDispmngDispid },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_ATTACHDISPID, DispmngAttachDispid },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_DETTACHDISPID, DispmngDetachDispid },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETBRIGHTNESS, GetBrightness },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETBRIGHTNESS, SetBrightness },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETSATURATION, GetSaturation },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETSATURATION, SetSaturation },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETCONTRAST, GetContrast },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETCONTRAST, SetContrast },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETHUE, GetHue },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETHUE, SetHue },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETBACKLIGHT, GetBacklight },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETBACKLIGHT, SetBacklight },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETSCREENRANGE, GetScreenOffset },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETSCREENRANGE, SetScreenOffset },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETHDCPENABLE, SetEnableHdcp },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETHDCPDISABLE, SetDisableHdcp },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETHDCPCAPABILITY, GetHdcpCapability },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETHDCPSTATUS, GetHdcpStatus },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETHDRTYPE, GetHdrType },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETHDRTYPE, SetHdrType },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETVIRSCREEN, GetVirtualScreenhw },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETVIRSCREEN, SetVirtualScreenhw },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETQMSENABLE, GetQmsEnable },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETQMSENABLE, SetQmsEnable },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETQMSATTR, GetQmsAttr },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETQMSATTR, SetQmsAttr },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETVRRENABLE, GetVrrEnable },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETVRRENABLE, SetVrrEnable },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETALLMATTR, GetAllmAttr },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETALLMATTR, SetAllmAttr },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETOUTPUTSTATUS, GetOutputStatus },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETDISPSTATUS, GetDisplayStatus },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETDISPSINKINFO, GetDisplayInfo },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETDISPCAPABILITY, GetDisplayCapabilities },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETSUPMODELIST, GetDisplaySupportedModeList },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETALLMODELIST, GetDisplayAllModeList },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETDISPLAYMODE, GetDisplayMode },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETDISPLAYMODE, SetDisplayMode },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETSCENEMODE, GetSceneMode },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETSCENEMODE, SetSceneMode },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETASPECTRATIO, GetAspectRatio },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETASPECTRATIO, SetAspectRatio },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETHDRCONTENT, GetHdrMatchContent },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETHDRCONTENT, SetHdrMatchContent },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_LOADHDCPKEY, LoadHDCPKey },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_LOADHDCPSRM, LoadHDCPSrm },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETHDMICFGINFO, GetHdmiConfigInfo },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETHDMICFGINFO, SetHdmiConfigInfo },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETDISPCONFIG, GetDisplayConfig },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETDISPCONFIG, SetDisplayConfig },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETHDMITXID, GetHdmitxidByDispid },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETVRRATTR, GetVrrAttr },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETVRRATTR, SetVrrAttr },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETPQBYPASS, SetPQBypass },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETPQBYPASS, GetPQBypass },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETASPECTCVRS, GetAspectCvrs },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETASPECTCVRS, SetAspectCvrs },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_STARTHDMI, SetHdmiStart },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_STOPHDMI, SetHdmiStop },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETENABLE3D, GetEnable3D },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETENABLE3D, SetEnable3D },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_ATTACHINTF, AttachIntf },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_DETACHINTF, DetachIntf },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETDISPLAYWINDOWNUMBER, GetDisplayWindowNumber },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETFORMATBYVIC, GetFmtFromVic },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETVICBYFORMAT, GetVicFromFmt },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_GETDISPLAYLUMINANCE, GetDisplayLuminance },
|
|
{ DISP_COMMAND_E::CMD_DISPLAY_SETDISPLAYLUMINANCE, SetDisplayLuminance },
|
|
};
|
|
|
|
static int Invoke(const android::Parcel &request, android::Parcel& reply)
|
|
{
|
|
ALOGI("===========Invoke begin=========");
|
|
request.setDataPosition(0);
|
|
td_u32 id = static_cast<td_u32>(request.readInt32());
|
|
ALOGV("display Invoke, ID: 0x%x", id);
|
|
Parcel output;
|
|
Mutex::Autolock lock(g_lock);
|
|
auto pfn = g_pfnMap.find(DISP_COMMAND_E(id));
|
|
if (pfn != g_pfnMap.end()) {
|
|
ALOGV("before reply write");
|
|
reply.writeInt32(pfn->second(request, output));
|
|
reply.write(output.data(), output.dataSize());
|
|
reply.setDataPosition(0);
|
|
ALOGV("after reply write");
|
|
ALOGI("===========Invoke success=========");
|
|
return TD_SUCCESS;
|
|
}
|
|
ALOGE("display Invoke failed!, ID: 0x%x", id);
|
|
ALOGE("===========Invoke failed=========");
|
|
return TD_FAILURE;
|
|
}
|
|
|
|
static int RegisterDispmngCallback(unsigned int event, DispmngEventCallback callback, td_void *privData)
|
|
{
|
|
td_s32 ret = uapi_svr_dispmng_register_callback((uapi_svr_dispmng_event)event, callback, privData);
|
|
if (ret != TD_SUCCESS) {
|
|
ALOGE("%s (%d) event=%d return ret=0x%x\n", __func__, __LINE__, event, ret);
|
|
ret = TD_FAILURE;
|
|
}
|
|
|
|
ALOGI_IF(g_debuglog, "%s (%d) event=%d \n", __func__, __LINE__, event);
|
|
return ret;
|
|
}
|
|
|
|
static int UnRegisterDispmngCallback(unsigned int event, DispmngEventCallback callback)
|
|
{
|
|
td_s32 ret = uapi_svr_dispmng_unregister_callback((uapi_svr_dispmng_event)event, callback);
|
|
if (ret != TD_SUCCESS) {
|
|
ALOGE("%s (%d) event=%d return ret=0x%x\n", __func__, __LINE__, event, ret);
|
|
ret = TD_FAILURE;
|
|
}
|
|
|
|
ALOGI_IF(g_debuglog, "%s (%d) event=%d \n", __func__, __LINE__, event);
|
|
return ret;
|
|
}
|
|
|
|
/* * State information for each device Instance */
|
|
static int OpenDisplay(const struct hw_module_t *module, const char *name, struct hw_device_t **device);
|
|
|
|
/* * Common hardware methods */
|
|
static struct hw_module_methods_t g_displayModuleMethods = {
|
|
.open = OpenDisplay
|
|
};
|
|
|
|
/* * The DISPLAY Module */
|
|
struct DisplayModuleT HAL_MODULE_INFO_SYM = {
|
|
.common = {
|
|
.tag = HARDWARE_MODULE_TAG,
|
|
.version_major = 1,
|
|
.version_minor = 0,
|
|
.id = DISPLAY_HARDWARE_MODULE_ID,
|
|
.name = "DISPLAY Module",
|
|
.author = "Hisilicon",
|
|
.methods = &g_displayModuleMethods
|
|
}
|
|
};
|
|
|
|
static hw_device_t *g_moduleDisplay = nullptr;
|
|
|
|
/* * Close the copybit device */
|
|
static int CloseDisplay(hw_device_t *dev)
|
|
{
|
|
ALOGI_IF(g_debuglog, "%s (%d)", __func__, __LINE__);
|
|
uapi_svr_dispmng_deinit();
|
|
|
|
if (dev != nullptr && dev == g_moduleDisplay) {
|
|
free(dev);
|
|
g_moduleDisplay = nullptr;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
/* * Open a new Instance of a copybit device using name */
|
|
static int OpenDisplay(const struct hw_module_t *module, const char *name, hw_device_t **device)
|
|
{
|
|
(void)name;
|
|
if (g_moduleDisplay != nullptr) {
|
|
*device = g_moduleDisplay;
|
|
return TD_SUCCESS;
|
|
}
|
|
|
|
g_dispCtx = (DisplayContextT *)malloc(sizeof(DisplayContextT));
|
|
if (g_dispCtx == nullptr) {
|
|
ALOGE("%s %dmalloc g_dispCtx failed", __func__, __LINE__);
|
|
return TD_FAILURE;
|
|
}
|
|
|
|
int ret = memset_s(g_dispCtx, sizeof(*g_dispCtx), 0, sizeof(*g_dispCtx));
|
|
if (ret != TD_SUCCESS) {
|
|
free(g_dispCtx);
|
|
ALOGE("memset_s Err--- %d", ret);
|
|
return TD_FAILURE;
|
|
}
|
|
|
|
g_dispCtx->device.common.tag = HARDWARE_MODULE_TAG;
|
|
g_dispCtx->device.common.version = 1;
|
|
g_dispCtx->device.common.module = (hw_module_t *)(module);
|
|
g_dispCtx->device.common.close = CloseDisplay;
|
|
g_dispCtx->device.invoke = Invoke;
|
|
g_dispCtx->device.registerDispmngCallback = RegisterDispmngCallback;
|
|
g_dispCtx->device.unregisterDispmngCallback = UnRegisterDispmngCallback;
|
|
|
|
*device = &g_dispCtx->device.common;
|
|
g_moduleDisplay = &g_dispCtx->device.common;
|
|
ret = uapi_svr_dispmng_init();
|
|
if (ret != TD_SUCCESS) {
|
|
ALOGE("uapi_svr_dispmng_init error %d ", ret);
|
|
if (g_dispCtx != nullptr) {
|
|
free(g_dispCtx);
|
|
g_dispCtx = nullptr;
|
|
}
|
|
}
|
|
DisplayImpl::Instance()->SetDisplayCount();
|
|
DisplayImpl::Instance()->SetHdmiConfig();
|
|
DisplayImpl::Instance()->SetCuvaConfig();
|
|
return ret;
|
|
}
|