sepolicy添加
1/2請修改 在android S branch下
1.device/mediatek/sepolicy/basic/non_plat/hal_graphics_composer_default.te:
添加
get_prop(hal_graphics_composer_default, vendor_single_buf_waitnopf_prop)
2.device/mediatek/sepolicy/basic/public/property.te:
添加
system_public_prop(vendor_single_buf_waitnopf_prop)
3/4/5/6/7請修改 在android T branch下
3.device/mediatek/sepolicy/base/private/surfaceflinger.te:
添加
get_prop(surfaceflinger, vendor_single_buf_waitnopf_prop)
set_prop(surfaceflinger, vendor_single_buf_waitnopf_prop)
4. device/mediatek/sepolicy/base/public/property.te:
添加
system_public_prop(vendor_single_buf_waitnopf_prop)
5. device/mediatek/sepolicy/base/private/property_contexts:
vendor.stylus.hwc.no_wait_pf u:object_r:vendor_single_buf_waitnopf_prop:s0 exact bool
6. device/mediatek/sepolicy/base/private/genfs_contexts:
genfscon bpf /tethering u:object_r:fs_bpf_net_shared:s0
----自動(dòng)生成的漓柑,不用修改
7.device/mediatek/sepolicy/base/private/compat/31.0/31.0.cil
添加
(expandtypeattribute (vendor_single_buf_waitnopf_prop_31_0) true)
(typeattribute vendor_single_buf_waitnopf_prop_31_0)
(typeattributeset vendor_single_buf_waitnopf_prop_31_0 (vendor_single_buf_waitnopf_prop))
overlay 屬性使用
#include <cutils/properties.h>
void OverlayEngine::waitAllFence(sp<FrameInfo>& info)
{
char tag[128];
DbgLogger logger(DbgLogger::TYPE_HWC_LOG, 'D', nullptr);
//BEGIN Lenovo, huyong6, 2023/02/03, INCEPTION-3065, single buffer
char value[PROPERTY_VALUE_MAX];
property_get("vendor.stylus.hwc.no_wait_pf", value, "0");
//END INCEPTION-3065
logger.printf("(%" PRIu64 ") Wait present fence for idx: %d", m_disp_id, info->present_fence_idx);
waitOverlayFence(info);
if (info->prev_present_fence != -1)
{
if (HWCMediator::getInstance().getLowLatencyWFD() == true)
{
// status: active(0) signaled(1) error(<0)
if (m_sync_fence->queryFenceStatus(info->prev_present_fence) == 0)
{
HWCMediator::getInstance().setRepaintAfterNextVsync();
}
else
{
HWCMediator::getInstance().setRepaintInNextVsync();
}
}
#ifdef FENCE_DEBUG
HWC_LOGD("+ OverlayEngine::waitPresentFence prev_present_fence:%d", info->prev_present_fence);
#endif
//BEGIN Lenovo, huyong6, 2023/02/03, INCEPTION-3065, single buffer
HWC_ATRACE_NAME("PF");
if(atoi(value)==0)
{
//HWC_LOGE("isStylusTargetLayer OverlayEngine::stylus Close");
if (!isUserLoad() && snprintf(tag, sizeof(tag), "%s-PF", DEBUG_LOG_TAG) > 0)
{
m_sync_fence->wait(info->prev_present_fence, 1000, tag);
}
else
{
m_sync_fence->wait(info->prev_present_fence, 1000, nullptr, SYNC_FENCE_PF, m_disp_id);
}
}
else
{
//HWC_LOGE("isStylusTargetLayer OverlayEngine::stylus open");
protectedClose(info->prev_present_fence);
}
//END INCEPTION-3065
#ifdef FENCE_DEBUG
HWC_LOGD("- OverlayEngine::waitPresentFence");
#endif
info->prev_present_fence = -1;
}
if (info->pq_fence_fd != -1)
{
HWC_ATRACE_NAME("PQF");
if (!isUserLoad() && snprintf(tag, sizeof(tag), "%s-PQF", DEBUG_LOG_TAG) > 0)
{
m_sync_fence->wait(info->pq_fence_fd, 1000, tag);
}
else
{
m_sync_fence->wait(info->pq_fence_fd, 1000, nullptr, SYNC_FENCE_PQ, m_disp_id);
}
}
}
SF側(cè)使用
property_set("vendor.stylus.hwc.no_wait_pf", "0");
sepolicy編譯結(jié)果檢查
請?jiān)?S branch out_hal/target/product/xxx/vendor/etc/selinux 下 grep vendor.stylus.hwc.no_wait_pf
請?jiān)?T branch out_sys/target/product/xxx/system/system_ext/etc/selinux 下 grep vendor.stylus.hwc.no_wait_pf