mirror of
https://github.com/openharmony/device_rockchip.git
synced 2026-06-30 21:27:58 -04:00
fix display source
Signed-off-by: yanghongliang <yang_hongliang@hoperun.com>
This commit is contained in:
@@ -33,7 +33,7 @@ std::shared_ptr<HdiDeviceInterface> DrmDevice::Create()
|
||||
DISPLAY_LOGD();
|
||||
if (mDrmFd == nullptr) {
|
||||
const std::string name("rockchip");
|
||||
int drmFd = drmOpen(name.c_str(), nullptr);
|
||||
int drmFd = open("/dev/dri/card0", O_RDWR | O_CLOEXEC);//drmOpen(name.c_str(), nullptr);
|
||||
if (drmFd < 0) {
|
||||
DISPLAY_LOGE("drm file:%{public}s open failed %{public}s", name.c_str(), strerror(errno));
|
||||
return nullptr;
|
||||
|
||||
@@ -28,11 +28,75 @@ DrmPlane::~DrmPlane()
|
||||
DISPLAY_LOGD();
|
||||
}
|
||||
|
||||
int DrmPlane::GetCrtcProp(DrmDevice &drmDevice)
|
||||
{
|
||||
int32_t ret;
|
||||
int32_t crtc_x, crtc_y, crtc_w, crtc_h;
|
||||
DrmProperty prop;
|
||||
|
||||
ret = drmDevice.GetPlaneProperty(*this, PROP_CRTC_X_ID, prop);
|
||||
DISPLAY_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_LOGE("cat not get pane crtc_x prop id"));
|
||||
mPropCrtc_xId = prop.propId;
|
||||
crtc_x = prop.value;
|
||||
|
||||
ret = drmDevice.GetPlaneProperty(*this, PROP_CRTC_Y_ID, prop);
|
||||
DISPLAY_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_LOGE("cat not get pane crtc_y prop id"));
|
||||
mPropCrtc_yId = prop.propId;
|
||||
crtc_y = prop.value;
|
||||
|
||||
ret = drmDevice.GetPlaneProperty(*this, PROP_CRTC_W_ID, prop);
|
||||
DISPLAY_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_LOGE("cat not get pane crtc_w prop id"));
|
||||
mPropCrtc_wId = prop.propId;
|
||||
crtc_w = prop.value;
|
||||
|
||||
ret = drmDevice.GetPlaneProperty(*this, PROP_CRTC_H_ID, prop);
|
||||
DISPLAY_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_LOGE("cat not get pane crtc_h prop id"));
|
||||
mPropCrtc_hId = prop.propId;
|
||||
crtc_h = prop.value;
|
||||
|
||||
DISPLAY_LOGE("plane %{public}d crtc_x %{public}d crtc_y %{public}d crtc_w %{public}d crtc_h %{public}d",GetId(), crtc_x, crtc_y, crtc_w, crtc_h);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DrmPlane::GetSrcProp(DrmDevice &drmDevice)
|
||||
{
|
||||
int32_t ret;
|
||||
int32_t src_x, src_y, src_w, src_h;
|
||||
DrmProperty prop;
|
||||
|
||||
ret = drmDevice.GetPlaneProperty(*this, PROP_SRC_X_ID, prop);
|
||||
DISPLAY_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_LOGE("cat not get pane src_x prop id"));
|
||||
mPropSrc_xId = prop.propId;
|
||||
src_x = prop.value;
|
||||
|
||||
ret = drmDevice.GetPlaneProperty(*this, PROP_SRC_Y_ID, prop);
|
||||
DISPLAY_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_LOGE("cat not get pane src_y prop id"));
|
||||
mPropSrc_yId = prop.propId;
|
||||
src_y = prop.value;
|
||||
|
||||
ret = drmDevice.GetPlaneProperty(*this, PROP_SRC_W_ID, prop);
|
||||
DISPLAY_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_LOGE("cat not get pane src_w prop id"));
|
||||
mPropSrc_wId = prop.propId;
|
||||
src_w = prop.value;
|
||||
|
||||
ret = drmDevice.GetPlaneProperty(*this, PROP_SRC_H_ID, prop);
|
||||
DISPLAY_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_LOGE("cat not get pane src_h prop id"));
|
||||
mPropSrc_hId = prop.propId;
|
||||
src_h = prop.value;
|
||||
|
||||
DISPLAY_LOGE("plane %{public}d src_x %{public}d src_y %{public}d src_w %{public}d src_h %{public}d",GetId(), src_x, src_y, src_w, src_h);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t DrmPlane::Init(DrmDevice &drmDevice)
|
||||
{
|
||||
DISPLAY_LOGD();
|
||||
int32_t ret;
|
||||
DrmProperty prop;
|
||||
GetCrtcProp(drmDevice);
|
||||
GetSrcProp(drmDevice);
|
||||
ret = drmDevice.GetPlaneProperty(*this, PROP_FBID, prop);
|
||||
mPropFbId = prop.propId;
|
||||
DISPLAY_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_LOGE("can not get plane fb id"));
|
||||
@@ -42,6 +106,7 @@ int32_t DrmPlane::Init(DrmDevice &drmDevice)
|
||||
ret = drmDevice.GetPlaneProperty(*this, PROP_CRTC_ID, prop);
|
||||
DISPLAY_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_LOGE("cat not get pane crtc prop id"));
|
||||
mPropCrtcId = prop.propId;
|
||||
|
||||
ret = drmDevice.GetPlaneProperty(*this, PROP_TYPE, prop);
|
||||
DISPLAY_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_LOGE("cat not get pane crtc prop id"));
|
||||
switch (prop.value) {
|
||||
|
||||
@@ -28,6 +28,17 @@ const std::string PROP_FBID = "FB_ID";
|
||||
const std::string PROP_IN_FENCE_FD = "IN_FENCE_FD";
|
||||
const std::string PROP_CRTC_ID = "CRTC_ID";
|
||||
const std::string PROP_TYPE = "type";
|
||||
|
||||
const std::string PROP_CRTC_X_ID = "CRTC_X";
|
||||
const std::string PROP_CRTC_Y_ID = "CRTC_Y";
|
||||
const std::string PROP_CRTC_W_ID = "CRTC_W";
|
||||
const std::string PROP_CRTC_H_ID = "CRTC_H";
|
||||
|
||||
const std::string PROP_SRC_X_ID = "SRC_X";
|
||||
const std::string PROP_SRC_Y_ID = "SRC_Y";
|
||||
const std::string PROP_SRC_W_ID = "SRC_W";
|
||||
const std::string PROP_SRC_H_ID = "SRC_H";
|
||||
|
||||
class DrmDevice;
|
||||
|
||||
class DrmPlane {
|
||||
@@ -35,6 +46,8 @@ public:
|
||||
explicit DrmPlane(drmModePlane &p);
|
||||
virtual ~DrmPlane();
|
||||
int32_t Init(DrmDevice &drmDevice);
|
||||
int GetCrtcProp(DrmDevice &drmDevice);
|
||||
int GetSrcProp(DrmDevice &drmDevice);
|
||||
uint32_t GetId() const
|
||||
{
|
||||
return mId;
|
||||
@@ -43,6 +56,38 @@ public:
|
||||
{
|
||||
return mPropFbId;
|
||||
}
|
||||
uint32_t GetPropCrtc_xId() const
|
||||
{
|
||||
return mPropCrtc_xId;
|
||||
}
|
||||
uint32_t GetPropCrtc_yId() const
|
||||
{
|
||||
return mPropCrtc_yId;
|
||||
}
|
||||
uint32_t GetPropCrtc_wId() const
|
||||
{
|
||||
return mPropCrtc_wId;
|
||||
}
|
||||
uint32_t GetPropCrtc_hId() const
|
||||
{
|
||||
return mPropCrtc_hId;
|
||||
}
|
||||
uint32_t GetPropSrc_xId() const
|
||||
{
|
||||
return mPropSrc_xId;
|
||||
}
|
||||
uint32_t GetPropSrc_yId() const
|
||||
{
|
||||
return mPropSrc_yId;
|
||||
}
|
||||
uint32_t GetPropSrc_wId() const
|
||||
{
|
||||
return mPropSrc_wId;
|
||||
}
|
||||
uint32_t GetPropSrc_hId() const
|
||||
{
|
||||
return mPropSrc_hId;
|
||||
}
|
||||
uint32_t GetPropFenceInId() const
|
||||
{
|
||||
return mPropFenceInId;
|
||||
@@ -78,6 +123,17 @@ private:
|
||||
uint32_t mPropFbId = 0;
|
||||
uint32_t mPropFenceInId = 0;
|
||||
uint32_t mPropCrtcId = 0;
|
||||
|
||||
uint32_t mPropCrtc_xId = 0;
|
||||
uint32_t mPropCrtc_yId = 0;
|
||||
uint32_t mPropCrtc_wId = 0;
|
||||
uint32_t mPropCrtc_hId = 0;
|
||||
|
||||
uint32_t mPropSrc_xId = 0;
|
||||
uint32_t mPropSrc_yId = 0;
|
||||
uint32_t mPropSrc_wId = 0;
|
||||
uint32_t mPropSrc_hId = 0;
|
||||
|
||||
uint32_t mPipe = 0;
|
||||
uint32_t mType = 0;
|
||||
std::vector<uint32_t> mFormats;
|
||||
@@ -86,4 +142,4 @@ private:
|
||||
} // namespace HDI
|
||||
} // namespace DISPLAY
|
||||
|
||||
#endif // DRM_PLANE_H
|
||||
#endif // DRM_PLANE_H
|
||||
|
||||
@@ -53,12 +53,16 @@ int32_t HdiDrmComposition::SetLayers(std::vector<HdiLayer *> &layers, HdiLayer &
|
||||
return DISPLAY_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t HdiDrmComposition::ApplyPlane(HdiDrmLayer &layer, DrmPlane &drmPlane, drmModeAtomicReqPtr pset)
|
||||
int32_t HdiDrmComposition::ApplyPlane(HdiDrmLayer &layer, HdiLayer &hlayer, DrmPlane &drmPlane, drmModeAtomicReqPtr pset)
|
||||
{
|
||||
// set fence in
|
||||
int ret;
|
||||
int fenceFd = layer.GetAcquireFenceFd();
|
||||
int propId = drmPlane.GetPropFenceInId();
|
||||
HdiLayerBuffer *layerBuffer = hlayer.GetCurrentBuffer();
|
||||
int32_t bufferW = layerBuffer->GetWight();
|
||||
int32_t bufferH = layerBuffer->GetHeight();
|
||||
|
||||
DISPLAY_LOGD();
|
||||
if (propId != 0) {
|
||||
DISPLAY_LOGD("set the fence in prop");
|
||||
@@ -70,6 +74,46 @@ int32_t HdiDrmComposition::ApplyPlane(HdiDrmLayer &layer, DrmPlane &drmPlane, dr
|
||||
}
|
||||
}
|
||||
|
||||
ret = drmModeAtomicAddProperty(pset, drmPlane.GetId(), drmPlane.GetPropCrtc_xId(), 0);
|
||||
DISPLAY_LOGD("set the fb planeid %{public}d, GetPropCrtc_xId %{public}d, crop.x %{public}d", drmPlane.GetId(),
|
||||
drmPlane.GetPropCrtc_xId(), 0);
|
||||
DISPLAY_CHK_RETURN((ret < 0), DISPLAY_FAILURE, DISPLAY_LOGE("set the fb planeid fialed errno : %{public}d", errno));
|
||||
|
||||
ret = drmModeAtomicAddProperty(pset, drmPlane.GetId(), drmPlane.GetPropCrtc_yId(), 0);
|
||||
DISPLAY_LOGD("set the fb planeid %{public}d, GetPropCrtc_yId %{public}d, crop.y %{public}d", drmPlane.GetId(),
|
||||
drmPlane.GetPropCrtc_yId(), 0);
|
||||
DISPLAY_CHK_RETURN((ret < 0), DISPLAY_FAILURE, DISPLAY_LOGE("set the fb planeid fialed errno : %{public}d", errno));
|
||||
|
||||
ret = drmModeAtomicAddProperty(pset, drmPlane.GetId(), drmPlane.GetPropCrtc_wId(), bufferW);
|
||||
DISPLAY_LOGD("set the fb planeid %{public}d, GetPropCrtc_wId %{public}d, crop.w %{public}d", drmPlane.GetId(),
|
||||
drmPlane.GetPropCrtc_wId(), bufferW);
|
||||
DISPLAY_CHK_RETURN((ret < 0), DISPLAY_FAILURE, DISPLAY_LOGE("set the fb planeid fialed errno : %{public}d", errno));
|
||||
|
||||
ret = drmModeAtomicAddProperty(pset, drmPlane.GetId(), drmPlane.GetPropCrtc_hId(), bufferH);
|
||||
DISPLAY_LOGD("set the fb planeid %{public}d, GetPropCrtc_hId %{public}d, crop.h %{public}d", drmPlane.GetId(),
|
||||
drmPlane.GetPropCrtc_xId(), bufferH);
|
||||
DISPLAY_CHK_RETURN((ret < 0), DISPLAY_FAILURE, DISPLAY_LOGE("set the fb planeid fialed errno : %{public}d", errno));
|
||||
|
||||
ret = drmModeAtomicAddProperty(pset, drmPlane.GetId(), drmPlane.GetPropSrc_xId(), 0<<16);
|
||||
DISPLAY_LOGD("set the fb planeid %{public}d, GetPropSrc_xId %{public}d, displayRect.x %{public}d", drmPlane.GetId(),
|
||||
drmPlane.GetPropSrc_xId(), 0);
|
||||
DISPLAY_CHK_RETURN((ret < 0), DISPLAY_FAILURE, DISPLAY_LOGE("set the fb planeid fialed errno : %{public}d", errno));
|
||||
|
||||
ret = drmModeAtomicAddProperty(pset, drmPlane.GetId(), drmPlane.GetPropSrc_yId(), 0<<16);
|
||||
DISPLAY_LOGD("set the fb planeid %{public}d, GetPropSrc_yId %{public}d, displayRect.y %{public}d", drmPlane.GetId(),
|
||||
drmPlane.GetPropSrc_yId(), 0);
|
||||
DISPLAY_CHK_RETURN((ret < 0), DISPLAY_FAILURE, DISPLAY_LOGE("set the fb planeid fialed errno : %{public}d", errno));
|
||||
|
||||
ret = drmModeAtomicAddProperty(pset, drmPlane.GetId(), drmPlane.GetPropSrc_wId(), bufferW<<16);
|
||||
DISPLAY_LOGD("set the fb planeid %{public}d, GetPropCrtc_wId %{public}d, displayRect.w %{public}d", drmPlane.GetId(),
|
||||
drmPlane.GetPropSrc_wId(), bufferW);
|
||||
DISPLAY_CHK_RETURN((ret < 0), DISPLAY_FAILURE, DISPLAY_LOGE("set the fb planeid fialed errno : %{public}d", errno));
|
||||
|
||||
ret = drmModeAtomicAddProperty(pset, drmPlane.GetId(), drmPlane.GetPropSrc_hId(), bufferH<<16);
|
||||
DISPLAY_LOGD("set the fb planeid %{public}d, GetPropSrc_hId %{public}d, displayRect.h %{public}d", drmPlane.GetId(),
|
||||
drmPlane.GetPropSrc_hId(), bufferH);
|
||||
DISPLAY_CHK_RETURN((ret < 0), DISPLAY_FAILURE, DISPLAY_LOGE("set the fb planeid fialed errno : %{public}d", errno));
|
||||
|
||||
// set fb id
|
||||
DrmGemBuffer *gemBuffer = layer.GetGemBuffer();
|
||||
DISPLAY_CHK_RETURN((gemBuffer == nullptr), DISPLAY_FAILURE, DISPLAY_LOGE("current gemBuffer is nullptr"));
|
||||
@@ -142,8 +186,9 @@ int32_t HdiDrmComposition::Apply(bool modeSet)
|
||||
DISPLAY_LOGD("mCompLayers size %{public}zd", mCompLayers.size());
|
||||
for (uint32_t i = 0; i < mCompLayers.size(); i++) {
|
||||
HdiDrmLayer *layer = static_cast<HdiDrmLayer *>(mCompLayers[i]);
|
||||
HdiLayer *hlayer = mCompLayers[i];
|
||||
auto &drmPlane = mPlanes[i];
|
||||
ret = ApplyPlane(*layer, *drmPlane, atomicReqPtr.Get());
|
||||
ret = ApplyPlane(*layer, *hlayer, *drmPlane, atomicReqPtr.Get());
|
||||
if (ret != DISPLAY_SUCCESS) {
|
||||
DISPLAY_LOGE("apply plane failed");
|
||||
break;
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
int32_t UpdateMode(std::unique_ptr<DrmModeBlock> &modeBlock, drmModeAtomicReq &pset);
|
||||
|
||||
private:
|
||||
int32_t ApplyPlane(HdiDrmLayer &layer, DrmPlane &drmPlane, drmModeAtomicReqPtr pset);
|
||||
int32_t ApplyPlane(HdiDrmLayer &layer, HdiLayer &hlayer, DrmPlane &drmPlane, drmModeAtomicReqPtr pset);
|
||||
std::shared_ptr<DrmDevice> mDrmDevice;
|
||||
std::shared_ptr<DrmConnector> mConnector;
|
||||
std::shared_ptr<DrmCrtc> mCrtc;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
"mkdir /data",
|
||||
"mount ext4 /dev/block/platform/fe310000.sdhci/by-name/vendor /vendor wait rdonly barrier=1",
|
||||
"mount ext4 /dev/block/platform/fe310000.sdhci/by-name/userdata /data wait nosuid nodev noatime barrier=1,data=ordered,noauto_da_alloc",
|
||||
"load_persist_params "
|
||||
"load_persist_params"
|
||||
]
|
||||
}, {
|
||||
"name" : "init",
|
||||
@@ -31,6 +31,7 @@
|
||||
"symlink /proc/self/fd/1 /dev/stdout",
|
||||
"symlink /proc/self/fd/2 /dev/stderr",
|
||||
"symlink /sys/kernel/debug /d",
|
||||
"symlink /system/lib/ld-musl-arm.so.1 /system/bin/ld-musl-arm.so.1",
|
||||
"mkdir /dev/stune/foreground",
|
||||
"mkdir /dev/stune/background",
|
||||
"mkdir /dev/stune/top-app",
|
||||
@@ -358,7 +359,8 @@
|
||||
"chown system system /sys/kernel/ipv4/tcp_rmem_def",
|
||||
"chown system system /sys/kernel/ipv4/tcp_rmem_max",
|
||||
"chown root radio /proc/cmdline",
|
||||
"setparam net.tcp.default_init_rwnd 60"
|
||||
"setparam net.tcp.default_init_rwnd 60",
|
||||
"start ispserver"
|
||||
]
|
||||
}, {
|
||||
"name" : "param:sys.sysctl.extra_free_kbytes=*",
|
||||
@@ -418,6 +420,10 @@
|
||||
"name" : "misc",
|
||||
"path" : ["/system/bin/misc_daemon", "--write_logo", "/vendor/logo.rgb"],
|
||||
"once" : 1
|
||||
}, {
|
||||
"name" : "ispserver",
|
||||
"path" : ["/system/bin/ispserver"],
|
||||
"once" : 1
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user