From 2c88dfb69c43d993ac51bb5c7404e56f94a3d73a Mon Sep 17 00:00:00 2001 From: xiayan Date: Wed, 9 Oct 2024 17:36:03 +0800 Subject: [PATCH] update phytium device code 4.1_release_v1.1.0 update some code about vpu and display version tag 4.1_release_v1.1.0 --- README.md | 2 +- ...ervice=auto_mount_usb_storage_device.patch | 0 ...schedule-memmgr=add-hyperhold-switch.patch | 196 ++++++++++++++++++ ...ework=disable-decoding-in-avmetadata.patch | 38 ++++ ...v_codec=modify-hcodec-for-histreamer.patch | 95 +++++++++ ...=modify-bootanimation-for-histreamer.patch | 30 +++ ...c-related-compilation-for-histreamer.patch | 95 +++++++++ .../composer/display_composer_vdi_impl.cpp | 2 +- .../composer/display_composer_vdi_impl.h | 2 +- .../display_device/drm/drm_vsync_worker.cpp | 19 +- .../d2000/hardware/gpu/BUILD.gn | 2 +- phytium_env.sh | 3 +- .../codec_component_capabilities.hcs | 14 +- .../media_codec/media_codec_capabilities.hcs | 14 +- 14 files changed, 485 insertions(+), 27 deletions(-) mode change 100755 => 100644 device_board_phytium/d2000/patch/0014=foundation-filemanagement-storage_service=auto_mount_usb_storage_device.patch create mode 100644 device_board_phytium/d2000/patch/0015=foundation-resourceschedule-memmgr=add-hyperhold-switch.patch create mode 100644 device_board_phytium/d2000/patch/0016=foundation-multimedia-player_framework=disable-decoding-in-avmetadata.patch create mode 100644 device_board_phytium/d2000/patch/0017=foundation-multimedia-av_codec=modify-hcodec-for-histreamer.patch create mode 100644 device_board_phytium/d2000/patch/0018=foundation-graphic-graphic_2d=modify-bootanimation-for-histreamer.patch create mode 100644 device_board_phytium/d2000/patch/0019=third_party-ffmpeg=enable-hevc-related-compilation-for-histreamer.patch diff --git a/README.md b/README.md index 2d46358..5a46add 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ repo forall -c 'git lfs pull' 使用安装包方式获取编译工具链。 ``` -sudo apt-get update && sudo apt-get install binutils git git-lfs gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4 bc gnutls-bin python3.8 python3-pip ruby openjdk-11-jdk libtinfo5 npm +sudo apt-get update && sudo apt-get install binutils git git-lfs gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4 bc gnutls-bin python3.8 python3-pip ruby openjdk-11-jdk libtinfo5 npm dosfstools parted kpartx genext2fs libxt-dev libx11-dev xorg-dev ``` ## 1.5 执行prebuilts diff --git a/device_board_phytium/d2000/patch/0014=foundation-filemanagement-storage_service=auto_mount_usb_storage_device.patch b/device_board_phytium/d2000/patch/0014=foundation-filemanagement-storage_service=auto_mount_usb_storage_device.patch old mode 100755 new mode 100644 diff --git a/device_board_phytium/d2000/patch/0015=foundation-resourceschedule-memmgr=add-hyperhold-switch.patch b/device_board_phytium/d2000/patch/0015=foundation-resourceschedule-memmgr=add-hyperhold-switch.patch new file mode 100644 index 0000000..ecf6093 --- /dev/null +++ b/device_board_phytium/d2000/patch/0015=foundation-resourceschedule-memmgr=add-hyperhold-switch.patch @@ -0,0 +1,196 @@ +diff --git a/bundle.json b/bundle.json +index b198c9d..ed092f3 100644 +--- a/bundle.json ++++ b/bundle.json +@@ -68,7 +68,8 @@ + ] + }, + "features": [ +- "memmgr_purgeable_memory" ++ "memmgr_purgeable_memory", ++ "memmgr_hyperhold_memory" + ] + } + } +diff --git a/common/src/kernel_interface.cpp b/common/src/kernel_interface.cpp +index d50ba13..5aa48c5 100644 +--- a/common/src/kernel_interface.cpp ++++ b/common/src/kernel_interface.cpp +@@ -41,8 +41,13 @@ const std::string KernelInterface::ROOT_PROC_PATH = "/proc"; + const std::string KernelInterface::MEMCG_BASE_PATH = "/dev/memcg"; + const std::string KernelInterface::FILE_MEMCG_PROCS = "cgroup.procs"; + ++#ifdef USE_HYPERHOLD_MEMORY + const std::string KernelInterface::ZWAPD_PRESSURE_SHOW_PATH = "/dev/memcg/memory.zswapd_pressure_show"; + const std::string KernelInterface::ZWAPD_PRESSURE_SHOW_BUFFER_SIZE = "buffer_size"; ++#else ++const std::string KernelInterface::ZWAPD_PRESSURE_SHOW_PATH = "/proc/meminfo"; ++const std::string KernelInterface::ZWAPD_PRESSURE_SHOW_BUFFER_SIZE = "MemAvailable"; ++#endif + const std::string KernelInterface::MEMINFO_PATH = "/proc/meminfo"; + const std::string KernelInterface::FILE_PROC_STATUS = "status"; + const std::string KernelInterface::TOTAL_MEMORY = "MemTotal"; +@@ -350,8 +355,13 @@ int KernelInterface::GetCurrentBuffer() + ReadZswapdPressureShow(result); + auto value = result.find(ZWAPD_PRESSURE_SHOW_BUFFER_SIZE); + if (value != result.end()) { ++#ifdef USE_HYPERHOLD_MEMORY + HILOGD("buffer_size=%{public}s MB", result[ZWAPD_PRESSURE_SHOW_BUFFER_SIZE].c_str()); + return atoi(result[ZWAPD_PRESSURE_SHOW_BUFFER_SIZE].c_str()) * KB_PER_MB; ++#else ++ HILOGD("buffer_size=%{public}s KB", result[ZWAPD_PRESSURE_SHOW_BUFFER_SIZE].c_str()); ++ return atoi(result[ZWAPD_PRESSURE_SHOW_BUFFER_SIZE].c_str()); ++#endif + } + return MAX_BUFFER_KB; + } +diff --git a/memmgr.gni b/memmgr.gni +index c478c9a..35b9a4f 100644 +--- a/memmgr.gni ++++ b/memmgr.gni +@@ -32,4 +32,5 @@ declare_args() { + } + + memmgr_purgeable_memory = false ++ memmgr_hyperhold_memory = false + } +diff --git a/services/memmgrservice/BUILD.gn b/services/memmgrservice/BUILD.gn +index 8c66727..710b745 100644 +--- a/services/memmgrservice/BUILD.gn ++++ b/services/memmgrservice/BUILD.gn +@@ -54,6 +54,9 @@ config("memory_memmgr_config") { + defines += [ "USE_PURGEABLE_MEMORY" ] + include_dirs += [ "include/purgeable_mem_manager/" ] + } ++ if (memmgr_hyperhold_memory) { ++ defines += [ "USE_HYPERHOLD_MEMORY" ] ++ } + } + + ohos_shared_library("memmgrservice") { +diff --git a/services/memmgrservice/src/mem_mgr_service.cpp b/services/memmgrservice/src/mem_mgr_service.cpp +index c3fb130..647500b 100644 +--- a/services/memmgrservice/src/mem_mgr_service.cpp ++++ b/services/memmgrservice/src/mem_mgr_service.cpp +@@ -60,11 +60,13 @@ bool MemMgrService::Init() + // init multiple account manager + MultiAccountManager::GetInstance().Init(); + ++#ifdef USE_HYPERHOLD_MEMORY + // init reclaim strategy manager + if (!ReclaimStrategyManager::GetInstance().Init()) { + HILOGE("ReclaimStrategyManager init failed"); + return false; + } ++#endif + + // init event center, then managers above can work by event trigger + if (!MemMgrEventCenter::GetInstance().Init()) { +@@ -72,8 +74,11 @@ bool MemMgrService::Init() + return false; + } + ++#ifdef USE_HYPERHOLD_MEMORY + // init nandlife controller + NandLifeController::GetInstance().Init(); ++#endif ++ + HILOGI("init successed"); + return true; + } +diff --git a/services/memmgrservice/src/purgeable_mem_manager/purgeable_mem_manager.cpp b/services/memmgrservice/src/purgeable_mem_manager/purgeable_mem_manager.cpp +index 35a3928..6b2c752 100644 +--- a/services/memmgrservice/src/purgeable_mem_manager/purgeable_mem_manager.cpp ++++ b/services/memmgrservice/src/purgeable_mem_manager/purgeable_mem_manager.cpp +@@ -50,6 +50,11 @@ PurgeableMemManager::PurgeableMemManager() + + bool PurgeableMemManager::GetEventHandler() + { ++#ifdef USE_HYPERHOLD_MEMORY ++ if (!handler_) { ++ handler_ = ReclaimStrategyManager::GetInstance().GetEventHandler(); ++ } ++#endif + if (!handler_) { + MAKE_POINTER(handler_, shared, AppExecFwk::EventHandler, "failed to create event handler", return false, + AppExecFwk::EventRunner::Create()); +diff --git a/services/memmgrservice/src/reclaim_priority_manager/multi_account_manager.cpp b/services/memmgrservice/src/reclaim_priority_manager/multi_account_manager.cpp +index 3114356..c330fbc 100644 +--- a/services/memmgrservice/src/reclaim_priority_manager/multi_account_manager.cpp ++++ b/services/memmgrservice/src/reclaim_priority_manager/multi_account_manager.cpp +@@ -110,7 +110,9 @@ bool MultiAccountManager::SetAccountPriority(int accountId, std::string accountN + + HILOGI("Set acccount priority succeed, accountId = %{public}d, old = %{public}d, new = %{public}d.", + accountId, oldPriority, accountInfo->GetPriority()); ++#ifdef USE_HYPERHOLD_MEMORY + ReclaimStrategyManager::GetInstance().NotifyAccountPriorityChanged(accountId, accountInfo->GetPriority()); ++#endif + return true; + } + +@@ -245,7 +247,9 @@ bool MultiAccountManager::HandleAccountColdSwitch(std::vector &switchedAcco + for (int accountId : switchedAccountIds) { + HILOGI("Account cold switch account = %{public}d.", accountId); + KillProcessesOfAccount(accountId, osAccountsInfoMap_); ++#ifdef USE_HYPERHOLD_MEMORY + ReclaimStrategyManager::GetInstance().NotifyAccountDied(accountId); ++#endif + } + return true; + } +diff --git a/services/memmgrservice/src/reclaim_priority_manager/reclaim_priority_manager.cpp b/services/memmgrservice/src/reclaim_priority_manager/reclaim_priority_manager.cpp +index 18df9b9..1917767 100644 +--- a/services/memmgrservice/src/reclaim_priority_manager/reclaim_priority_manager.cpp ++++ b/services/memmgrservice/src/reclaim_priority_manager/reclaim_priority_manager.cpp +@@ -1037,10 +1037,12 @@ bool ReclaimPriorityManager::ApplyReclaimPriority(std::shared_ptruid_, bundle->name_, bundle->accountId_, bundle->priority_, action); + ReclaimStrategyManager::GetInstance().NotifyAppStateChanged(para); ++#endif + return OomScoreAdjUtils::WriteOomScoreAdjToKernel(bundle); + } + +diff --git a/test/BUILD.gn b/test/BUILD.gn +index 2703a54..b8bbdfe 100644 +--- a/test/BUILD.gn ++++ b/test/BUILD.gn +@@ -341,9 +341,11 @@ group("memmgr_unittest") { + ":oom_score_adj_utils_test", + ":purgeable_memory_manager_test", + ":reclaim_priority_manager_test", +- ":reclaim_strategy_manager_test", + ":system_memory_level_config_test", + ":user_memcg_test", + ":xml_helper_test", + ] ++ if (memmgr_hyperhold_memory) { ++ deps += [ ":reclaim_strategy_manager_test" ] ++ } + } +diff --git a/test/unittest/phone/low_memory_killer_test.cpp b/test/unittest/phone/low_memory_killer_test.cpp +index 52cb4fc..393bb1b 100644 +--- a/test/unittest/phone/low_memory_killer_test.cpp ++++ b/test/unittest/phone/low_memory_killer_test.cpp +@@ -79,14 +79,16 @@ HWTEST_F(LowMemoryKillerTest, PsiHandlerInnerTest, TestSize.Level1) + + HWTEST_F(LowMemoryKillerTest, KillOneBundleByPrioTest, TestSize.Level1) + { ++ int userId = 234; ++#ifdef USE_HYPERHOLD_MEMORY + int pid = 123; + int appId = 111; + std::string appName = "com.test"; +- int userId = 234; + int score = 100; + std::shared_ptr para = std::make_shared(pid, appId, appName, userId, score, + AppAction::OTHERS); + ReclaimStrategyManager::GetInstance().NotifyAppStateChanged(para); ++#endif + int minPrio = 10; + int ret = 1; + ret = LowMemoryKiller::GetInstance().KillOneBundleByPrio(minPrio); diff --git a/device_board_phytium/d2000/patch/0016=foundation-multimedia-player_framework=disable-decoding-in-avmetadata.patch b/device_board_phytium/d2000/patch/0016=foundation-multimedia-player_framework=disable-decoding-in-avmetadata.patch new file mode 100644 index 0000000..a5db195 --- /dev/null +++ b/device_board_phytium/d2000/patch/0016=foundation-multimedia-player_framework=disable-decoding-in-avmetadata.patch @@ -0,0 +1,38 @@ +diff --git a/services/engine/histreamer/avmetadatahelper/avmetadatahelper_impl.cpp b/services/engine/histreamer/avmetadatahelper/avmetadatahelper_impl.cpp +index 6e3251b6..40e04381 100644 +--- a/services/engine/histreamer/avmetadatahelper/avmetadatahelper_impl.cpp ++++ b/services/engine/histreamer/avmetadatahelper/avmetadatahelper_impl.cpp +@@ -147,7 +147,11 @@ void AVMetadataHelperImpl::OnOutputBufferAvailable(uint32_t index, std::shared_p + hasFetchedFrame_ = true; + sptr surfaceBuffer; + surfaceBuffer = buffer->memory_->GetSurfaceBuffer(); +- ConvertToAVSharedMemory(surfaceBuffer); ++ if(surfaceBuffer){ ++ ConvertToAVSharedMemory(surfaceBuffer); ++ }else{ ++ MEDIA_LOGD("surfaceBuffer is NULL, skip to convert to AVSharedMemory."); ++ } + cond_.notify_all(); + } + CHECK_AND_RETURN_LOG(videoDecoder_ != nullptr, "OnOutputBufferAvailable videoDecoder_ is nullptr"); +@@ -530,7 +534,19 @@ Status AVMetadataHelperImpl::InitDecoder() + return Status::OK; + } + MEDIA_LOGD("Init decoder start."); +- videoDecoder_ = MediaAVCodec::VideoDecoderFactory::CreateByMime(trackMime_); ++ //videoDecoder_ = MediaAVCodec::VideoDecoderFactory::CreateByMime(trackMime_); ++ if(trackMime_.find("avc") != std::string::npos){ ++ MEDIA_LOGD("trackMime_ = avc, Init avc decoder."); ++ //videoDecoder_ = MediaAVCodec::VideoDecoderFactory::CreateByName("OH.Media.Codec.Decoder.Video.AVC"); ++ return Status::OK; ++ }else if(trackMime_.find("hevc") != std::string::npos){ ++ MEDIA_LOGD("trackMime_ = hevc, Skip Init hevc decoder!"); ++ //videoDecoder_ = MediaAVCodec::VideoDecoderFactory::CreateByName("OH.Media.Codec.Decoder.Video.HEVC"); ++ return Status::OK; ++ }else{ ++ MEDIA_LOGD("trackMime_ UNKNOWN!!!"); ++ } ++ + CHECK_AND_RETURN_RET_LOG(videoDecoder_ != nullptr, Status::ERROR_NO_MEMORY, + "Create videoDecoder_ is nullptr"); + Format trackFormat {}; diff --git a/device_board_phytium/d2000/patch/0017=foundation-multimedia-av_codec=modify-hcodec-for-histreamer.patch b/device_board_phytium/d2000/patch/0017=foundation-multimedia-av_codec=modify-hcodec-for-histreamer.patch new file mode 100644 index 0000000..e7bd935 --- /dev/null +++ b/device_board_phytium/d2000/patch/0017=foundation-multimedia-av_codec=modify-hcodec-for-histreamer.patch @@ -0,0 +1,95 @@ +diff --git a/interfaces/inner_api/native/avcodec_codec_name.h b/interfaces/inner_api/native/avcodec_codec_name.h +index 5f1e764e..c43a9e2c 100644 +--- a/interfaces/inner_api/native/avcodec_codec_name.h ++++ b/interfaces/inner_api/native/avcodec_codec_name.h +@@ -39,6 +39,7 @@ public: + static constexpr std::string_view AUDIO_ENCODER_API9_AAC_NAME = "avenc_aac"; + + static constexpr std::string_view VIDEO_DECODER_AVC_NAME = "OH.Media.Codec.Decoder.Video.AVC"; ++ static constexpr std::string_view VIDEO_DECODER_HEVC_NAME = "OH.Media.Codec.Decoder.Video.HEVC"; + + private: + AVCodecCodecName() = delete; +diff --git a/services/engine/codec/video/fcodec.cpp b/services/engine/codec/video/fcodec.cpp +index 94fc031a..c0f4b1e5 100644 +--- a/services/engine/codec/video/fcodec.cpp ++++ b/services/engine/codec/video/fcodec.cpp +@@ -58,6 +58,7 @@ constexpr struct { + const bool isEncoder; + } SUPPORT_VCODEC[] = { + {AVCodecCodecName::VIDEO_DECODER_AVC_NAME, CodecMimeType::VIDEO_AVC, "h264", false}, ++ {AVCodecCodecName::VIDEO_DECODER_HEVC_NAME, CodecMimeType::VIDEO_HEVC, "hevc", false}, + }; + constexpr uint32_t SUPPORT_VCODEC_NUM = sizeof(SUPPORT_VCODEC) / sizeof(SUPPORT_VCODEC[0]); + } // namespace +diff --git a/services/engine/codec/video/hcodec/hcodec.cpp b/services/engine/codec/video/hcodec/hcodec.cpp +index 2a12581f..33a75e03 100644 +--- a/services/engine/codec/video/hcodec/hcodec.cpp ++++ b/services/engine/codec/video/hcodec/hcodec.cpp +@@ -344,6 +344,7 @@ bool HCodec::GetPixelFmtFromUser(const Format &format) + } else { + HLOGI("user don't set VideoPixelFormat, use default"); + for (int32_t f : caps_.port.video.supportPixFmts) { ++ HLOGI("Now caps_.port.video.supportPixFmts is %{public}d", f); + fmt = TypeConverter::GraphicFmtToFmt(static_cast(f)); + if (fmt.has_value()) { + break; +@@ -769,6 +770,7 @@ void HCodec::OnQueueInputBuffer(BufferOperationMode mode, BufferInfo* info) + if (eos) { + inputPortEos_ = true; + } ++ info->omxBuffer->flag |= OMX_BUFFERFLAG_ENDOFFRAME; + int32_t ret = NotifyOmxToEmptyThisInBuffer(*info); + if (ret != AVCS_ERR_OK) { + SignalError(AVCODEC_ERROR_INTERNAL, AVCS_ERR_UNKNOWN); +diff --git a/services/media_engine/modules/sink/video_sink.cpp b/services/media_engine/modules/sink/video_sink.cpp +index 836f5989..87438553 100644 +--- a/services/media_engine/modules/sink/video_sink.cpp ++++ b/services/media_engine/modules/sink/video_sink.cpp +@@ -43,6 +43,7 @@ VideoSink::VideoSink() + refreshTime_ = 0; + syncerPriority_ = IMediaSynchronizer::VIDEO_SINK; + fixDelay_ = GetvideoLatencyFixDelay(); ++ fixDelay_ /= HST_USECOND; + MEDIA_LOG_I("VideoSink ctor called..."); + } + +@@ -160,7 +161,7 @@ bool VideoSink::CheckBufferLatenessMayWait(const std::shared_ptr 0 && Plugins::HstTime2Ms(diff * HST_USECOND) > 40) { // > 40ms + // buffer is late + tooLate = true; +@@ -169,7 +170,7 @@ bool VideoSink::CheckBufferLatenessMayWait(const std::shared_ptrflag_ & BUFFER_FLAG_KEY_FRAME) == 0) { +- return true; ++ //return true; + } + } + return false; +diff --git a/services/media_engine/plugins/ffmpeg_adapter/demuxer/ffmpeg_demuxer_plugin.cpp b/services/media_engine/plugins/ffmpeg_adapter/demuxer/ffmpeg_demuxer_plugin.cpp +index c500286a..4a1f4c25 100644 +--- a/services/media_engine/plugins/ffmpeg_adapter/demuxer/ffmpeg_demuxer_plugin.cpp ++++ b/services/media_engine/plugins/ffmpeg_adapter/demuxer/ffmpeg_demuxer_plugin.cpp +@@ -77,6 +77,7 @@ static const std::map g_seekModeToFFmpegSeekFlags = { + + static const std::map g_bitstreamFilterMap = { + { AV_CODEC_ID_H264, "h264_mp4toannexb" }, ++ { AV_CODEC_ID_HEVC, "hevc_mp4toannexb" }, + }; + + static std::vector g_imageCodecID = { +@@ -452,7 +453,7 @@ Status FFmpegDemuxerPlugin::ConvertAVPacketToSample( + auto codecId = formatContext_->streams[samplePacket->pkt->stream_index]->codecpar->codec_id; + if (codecId == AV_CODEC_ID_HEVC && hevcParser_ != nullptr && hevcParserInited_) { + hevcParser_->ConvertPacketToAnnexb(&(samplePacket->pkt->data), samplePacket->pkt->size); +- } else if (codecId == AV_CODEC_ID_H264 && avbsfContext_ != nullptr) { ++ } else if ((codecId == AV_CODEC_ID_H264 || codecId == AV_CODEC_ID_HEVC) && avbsfContext_ != nullptr) { + ConvertAvcToAnnexb(*(samplePacket->pkt)); + } + diff --git a/device_board_phytium/d2000/patch/0018=foundation-graphic-graphic_2d=modify-bootanimation-for-histreamer.patch b/device_board_phytium/d2000/patch/0018=foundation-graphic-graphic_2d=modify-bootanimation-for-histreamer.patch new file mode 100644 index 0000000..93cab37 --- /dev/null +++ b/device_board_phytium/d2000/patch/0018=foundation-graphic-graphic_2d=modify-bootanimation-for-histreamer.patch @@ -0,0 +1,30 @@ +diff --git a/frameworks/bootanimation/src/boot_animation.cpp b/frameworks/bootanimation/src/boot_animation.cpp +index 315720149..338276495 100644 +--- a/frameworks/bootanimation/src/boot_animation.cpp ++++ b/frameworks/bootanimation/src/boot_animation.cpp +@@ -289,6 +289,7 @@ bool BootAnimation::CheckExitAnimation() + { + if (!isAnimationEnd_) { + LOGI("Boot animation is end"); ++ usleep(SLEEP_TIME_US); + system::SetParameter("bootevent.bootanimation.finished", "true"); + isAnimationEnd_ = true; + } +diff --git a/frameworks/bootanimation/src/boot_videoplayer.cpp b/frameworks/bootanimation/src/boot_videoplayer.cpp +index 08fa3c12f..b0e359f84 100644 +--- a/frameworks/bootanimation/src/boot_videoplayer.cpp ++++ b/frameworks/bootanimation/src/boot_videoplayer.cpp +@@ -100,6 +100,13 @@ bool BootVideoPlayer::PlayVideo() + void BootVideoPlayer::StopVideo() + { + LOGI("BootVideoPlayer StopVideo"); ++#ifdef PLAYER_FRAMEWORK_ENABLE ++ if (mediaPlayer_) { ++ usleep(400000); ++ mediaPlayer_->Release(); ++ LOGI("PlayVideo release"); ++ } ++#endif + vsyncCallbacks_(userData_); + } + diff --git a/device_board_phytium/d2000/patch/0019=third_party-ffmpeg=enable-hevc-related-compilation-for-histreamer.patch b/device_board_phytium/d2000/patch/0019=third_party-ffmpeg=enable-hevc-related-compilation-for-histreamer.patch new file mode 100644 index 0000000..32be45a --- /dev/null +++ b/device_board_phytium/d2000/patch/0019=third_party-ffmpeg=enable-hevc-related-compilation-for-histreamer.patch @@ -0,0 +1,95 @@ +diff --git a/BUILD.gn b/BUILD.gn +index d69554c786..4678ed1207 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -31,6 +31,9 @@ libffmpeg_media_aarch64_sources = [ + "//third_party/ffmpeg/libavcodec/aarch64/h264pred_neon.S", + "//third_party/ffmpeg/libavcodec/aarch64/h264qpel_init_aarch64.c", + "//third_party/ffmpeg/libavcodec/aarch64/h264qpel_neon.S", ++ "//third_party/ffmpeg/libavcodec/aarch64/hevcdsp_init_aarch64.c", ++ "//third_party/ffmpeg/libavcodec/aarch64/hevcdsp_idct_neon.S", ++ "//third_party/ffmpeg/libavcodec/aarch64/hevcdsp_sao_neon.S", + "//third_party/ffmpeg/libavcodec/aarch64/hpeldsp_init_aarch64.c", + "//third_party/ffmpeg/libavcodec/aarch64/hpeldsp_neon.S", + "//third_party/ffmpeg/libavcodec/aarch64/idctdsp_init_aarch64.c", +@@ -396,7 +399,7 @@ ohos_source_set("ffmpeg_dynamic") { + # "//third_party/ffmpeg/libavcodec/dvenc.c", + # "//third_party/ffmpeg/libavcodec/dxtory.c", + # "//third_party/ffmpeg/libavcodec/dxv.c", +- # "//third_party/ffmpeg/libavcodec/dynamic_hdr10_plus.c", ++ "//third_party/ffmpeg/libavcodec/dynamic_hdr10_plus.c", + # "//third_party/ffmpeg/libavcodec/eac3_core_bsf.c", + # "//third_party/ffmpeg/libavcodec/eac3_data.c", + # "//third_party/ffmpeg/libavcodec/eac3enc.c", +@@ -509,25 +512,25 @@ ohos_source_set("ffmpeg_dynamic") { + "//third_party/ffmpeg/libavcodec/h264qpel.c", + + # "//third_party/ffmpeg/libavcodec/h265_metadata_bsf.c", +- # "//third_party/ffmpeg/libavcodec/h265_profile_level.c", ++ "//third_party/ffmpeg/libavcodec/h265_profile_level.c", + # "//third_party/ffmpeg/libavcodec/hap.c", + # "//third_party/ffmpeg/libavcodec/hapdec.c", + # "//third_party/ffmpeg/libavcodec/hapqa_extract_bsf.c", + # "//third_party/ffmpeg/libavcodec/hcom.c", +- # "//third_party/ffmpeg/libavcodec/hevc_cabac.c", +- # "//third_party/ffmpeg/libavcodec/hevc_data.c", +- # "//third_party/ffmpeg/libavcodec/hevc_filter.c", +- # "//third_party/ffmpeg/libavcodec/hevc_mp4toannexb_bsf.c", +- # "//third_party/ffmpeg/libavcodec/hevc_mvs.c", +- # "//third_party/ffmpeg/libavcodec/hevc_parse.c", +- # "//third_party/ffmpeg/libavcodec/hevc_parser.c", +- # "//third_party/ffmpeg/libavcodec/hevc_ps.c", +- # "//third_party/ffmpeg/libavcodec/hevc_refs.c", +- # "//third_party/ffmpeg/libavcodec/hevc_sei.c", +- # "//third_party/ffmpeg/libavcodec/hevcdec.c", +- # "//third_party/ffmpeg/libavcodec/hevcdsp.c", +- # "//third_party/ffmpeg/libavcodec/hevcpred.c", +- # "//third_party/ffmpeg/libavcodec/hnm4video.c", ++ "//third_party/ffmpeg/libavcodec/hevc_cabac.c", ++ "//third_party/ffmpeg/libavcodec/hevc_data.c", ++ "//third_party/ffmpeg/libavcodec/hevc_filter.c", ++ "//third_party/ffmpeg/libavcodec/hevc_mp4toannexb_bsf.c", ++ "//third_party/ffmpeg/libavcodec/hevc_mvs.c", ++ "//third_party/ffmpeg/libavcodec/hevc_parse.c", ++ "//third_party/ffmpeg/libavcodec/hevc_parser.c", ++ "//third_party/ffmpeg/libavcodec/hevc_ps.c", ++ "//third_party/ffmpeg/libavcodec/hevc_refs.c", ++ "//third_party/ffmpeg/libavcodec/hevc_sei.c", ++ "//third_party/ffmpeg/libavcodec/hevcdec.c", ++ "//third_party/ffmpeg/libavcodec/hevcdsp.c", ++ "//third_party/ffmpeg/libavcodec/hevcpred.c", ++ "//third_party/ffmpeg/libavcodec/hnm4video.c", + "//third_party/ffmpeg/libavcodec/hpeldsp.c", + + # "//third_party/ffmpeg/libavcodec/hq_hqa.c", +@@ -1174,7 +1177,7 @@ ohos_source_set("ffmpeg_dynamic") { + # "//third_party/ffmpeg/libavformat/hdsenc.c", + "//third_party/ffmpeg/libavformat/hevc.c", + +- # "//third_party/ffmpeg/libavformat/hevcdec.c", ++ "//third_party/ffmpeg/libavformat/hevcdec.c", + # "//third_party/ffmpeg/libavformat/hls.c", + # "//third_party/ffmpeg/libavformat/hlsenc.c", + # "//third_party/ffmpeg/libavformat/hlsplaylist.c", +diff --git a/ohos_config.sh b/ohos_config.sh +index 35e50feae1..9fc6631439 100755 +--- a/ohos_config.sh ++++ b/ohos_config.sh +@@ -53,14 +53,14 @@ FF_CONFIG_OPTIONS=" + --disable-lzma + --enable-demuxer=mp3,aac,ape,flac,ogg,wav,mov,mpegts,amr,amrnb,amrwb,matroska + --enable-muxer=mp4,h264,ipod +- --enable-parser=h263,h264,mpeg4video,vp8,vp9,mpegvideo ++ --enable-parser=h263,h264,hevc,mpeg4video,vp8,vp9,mpegvideo + --enable-parser=mpegaudio,aac,aac_latm,av3a,amr +- --enable-decoder=h263,h264,mpeg2video,mpeg4,vp8,vp9 ++ --enable-decoder=h263,h264,hevc,mpeg2video,mpeg4,vp8,vp9 + --enable-decoder=mp3,mp3float,aac,aac_latm,ape,flac,vorbis,opus,amrnb,amrwb + --enable-decoder=png,bmp + --enable-encoder=aac,aac_latm,opus,flac + --enable-encoder=mpeg4,h263 +- --enable-bsf=h264_mp4toannexb ++ --enable-bsf=h264_mp4toannexb,hevc_mp4toannexb + --enable-protocol=file + --enable-cross-compile + --enable-shared diff --git a/device_soc_phytium/d2000/hardware/display/src/display_device/composer/display_composer_vdi_impl.cpp b/device_soc_phytium/d2000/hardware/display/src/display_device/composer/display_composer_vdi_impl.cpp index 0a0eeec..0b2bcde 100644 --- a/device_soc_phytium/d2000/hardware/display/src/display_device/composer/display_composer_vdi_impl.cpp +++ b/device_soc_phytium/d2000/hardware/display/src/display_device/composer/display_composer_vdi_impl.cpp @@ -25,7 +25,7 @@ namespace DISPLAY { DisplayComposerVdiImpl::DisplayComposerVdiImpl() { DISPLAY_LOGD(); - composerModel_.reset(&HdiSession::GetInstance()); + composerModel_ = &HdiSession::GetInstance(); } DisplayComposerVdiImpl::~DisplayComposerVdiImpl() diff --git a/device_soc_phytium/d2000/hardware/display/src/display_device/composer/display_composer_vdi_impl.h b/device_soc_phytium/d2000/hardware/display/src/display_device/composer/display_composer_vdi_impl.h index c3a2c76..cd4d31f 100644 --- a/device_soc_phytium/d2000/hardware/display/src/display_device/composer/display_composer_vdi_impl.h +++ b/device_soc_phytium/d2000/hardware/display/src/display_device/composer/display_composer_vdi_impl.h @@ -74,7 +74,7 @@ public: virtual int32_t SetLayerMaskInfo(uint32_t devId, uint32_t layerId, const MaskInfo maskInfo) override; virtual int32_t SetLayerColor(uint32_t devId, uint32_t layerId, const LayerColor& layerColor) override; private: - std::shared_ptr composerModel_; + HdiSession* composerModel_; }; } // DISPLAY } // HDI diff --git a/device_soc_phytium/d2000/hardware/display/src/display_device/drm/drm_vsync_worker.cpp b/device_soc_phytium/d2000/hardware/display/src/display_device/drm/drm_vsync_worker.cpp index 9553c78..0d0415f 100644 --- a/device_soc_phytium/d2000/hardware/display/src/display_device/drm/drm_vsync_worker.cpp +++ b/device_soc_phytium/d2000/hardware/display/src/display_device/drm/drm_vsync_worker.cpp @@ -104,6 +104,7 @@ uint64_t DrmVsyncWorker::WaitNextVBlank(unsigned int &sq) constexpr uint64_t USEC_TO_NSEC = 1000; constexpr uint64_t FRAME_INTERVAL_60HZ_NS = 16666667; + uint64_t timestamp = 0; uint32_t index = GetVBlankPipe(); uint32_t high_crtc = (index << DRM_VBLANK_HIGH_CRTC_SHIFT); drmVBlank vblank = { @@ -114,18 +115,22 @@ uint64_t DrmVsyncWorker::WaitNextVBlank(unsigned int &sq) } }; int ret = drmWaitVBlank(mDrmFd, &vblank); - if (ret < 0) { - DISPLAY_LOGD("wait vblank failed ret : %{public}d, using software to simulate frame rate 60Hz", ret); + if (ret == 0) { + sq = vblank.reply.sequence; + timestamp = static_cast(vblank.reply.tval_sec * SEC_TO_NSEC + vblank.reply.tval_usec * USEC_TO_NSEC); + DISPLAY_LOGD("Hardware VBlank timestamp: %{public}lu", timestamp); + return timestamp; + } else { + static unsigned int softwareSeq = 0; struct timespec req = {0, FRAME_INTERVAL_60HZ_NS}; struct timespec rem = {0, 0}; nanosleep(&req, &rem); struct timespec now; clock_gettime(CLOCK_MONOTONIC, &now); - sq = 1; - return static_cast(now.tv_sec * SEC_TO_NSEC + now.tv_nsec); - } else { - sq = vblank.reply.sequence; - return static_cast(vblank.reply.tval_sec * SEC_TO_NSEC + vblank.reply.tval_usec * USEC_TO_NSEC); + timestamp = static_cast(now.tv_sec * SEC_TO_NSEC + now.tv_nsec); + sq = ++softwareSeq; + DISPLAY_LOGD("Software simulated timestamp: %{public}lu, sequence: %{public}u", timestamp, sq); + return timestamp; } } diff --git a/device_soc_phytium/d2000/hardware/gpu/BUILD.gn b/device_soc_phytium/d2000/hardware/gpu/BUILD.gn index fa086aa..99bb22a 100755 --- a/device_soc_phytium/d2000/hardware/gpu/BUILD.gn +++ b/device_soc_phytium/d2000/hardware/gpu/BUILD.gn @@ -83,7 +83,7 @@ mesa3d_all_lib_deps += [ ":lib_pvr_dri" ] ohos_prebuilt_etc("phytiumvr.ini") { source = "phytiumvr.ini" install_enable = true - install_images = [ chipset_base_dir ] + install_images = [ "system" ] subsystem_name = "phytium_products" part_name = "device_d2000" } diff --git a/phytium_env.sh b/phytium_env.sh index 70ab8b0..ebf8926 100755 --- a/phytium_env.sh +++ b/phytium_env.sh @@ -73,7 +73,6 @@ echo -e "\033[32m #### sync device_soc_phytium end #### \033[0m" echo -e "\033[32m #### sync device_board_phytium #### \033[0m" mkdir -p $OHOS_PATH_ROOT/device/board/phytium cp device_board_phytium/* $OHOS_PATH_ROOT/device/board/phytium/ -R -chmod 777 $OHOS_PATH_ROOT/device/board/phytium/$DEVICE/kernel/* echo -e "\033[32m #### sync device_board_phytium end #### \033[0m" #sync vendor_phytium @@ -117,7 +116,7 @@ function apply_git_patch(){ else echo -e "\n\033[32m#### git reset $git_path #### \033[0m" git clean -df - git checkout ./* + git checkout . git lfs checkout echo -e "\033[32m#### git reset $git_path end #### \033[0m" fi diff --git a/vendor_phytium/d2000/hdf_config/uhdf/media_codec/codec_component_capabilities.hcs b/vendor_phytium/d2000/hdf_config/uhdf/media_codec/codec_component_capabilities.hcs index a3fc65e..19cfd70 100755 --- a/vendor_phytium/d2000/hdf_config/uhdf/media_codec/codec_component_capabilities.hcs +++ b/vendor_phytium/d2000/hdf_config/uhdf/media_codec/codec_component_capabilities.hcs @@ -41,7 +41,7 @@ root { maxBlocksPerSecond = 244800; blockSizeWidth = 16; blockSizeHeight = 16; - supportPixelFmts = [21]; + supportPixelFmts = [12, 24]; measuredFrameRate = [320, 240, 617, 617, 720, 480, 559, 559, 1280, 720, 276, 276, 1920, 1080, 164, 164, 3840, 2160, 30, 30]; bitRateMode = []; minFrameRate = 0; @@ -70,7 +70,7 @@ root { maxBlocksPerSecond = 244800; blockSizeWidth = 16; blockSizeHeight = 8; - supportPixelFmts = [21]; + supportPixelFmts = [12, 24]; measuredFrameRate = []; bitRateMode = []; minFrameRate = 0; @@ -99,7 +99,7 @@ root { maxBlocksPerSecond = 244800; blockSizeWidth = 16; blockSizeHeight = 16; - supportPixelFmts = [21]; + supportPixelFmts = [12, 24]; measuredFrameRate = [320, 180, 500, 500, 640, 360, 387, 387, 1280, 720, 112, 112, 1920, 1080, 77, 77]; bitRateMode = []; minFrameRate = 0; @@ -128,7 +128,7 @@ root { maxBlocksPerSecond = 244800; blockSizeWidth = 16; blockSizeHeight = 16; - supportPixelFmts = [21]; + supportPixelFmts = [12, 24]; measuredFrameRate = [176, 144, 600, 600, 352, 288, 600, 600]; bitRateMode = []; minFrameRate = 0; @@ -157,7 +157,7 @@ root { maxBlocksPerSecond = 244800; blockSizeWidth = 16; blockSizeHeight = 16; - supportPixelFmts = [21]; + supportPixelFmts = [12, 24]; measuredFrameRate = [176, 144, 600, 600]; bitRateMode = []; minFrameRate = 0; @@ -186,7 +186,7 @@ root { maxBlocksPerSecond = 244800; blockSizeWidth = 16; blockSizeHeight = 16; - supportPixelFmts = [21]; + supportPixelFmts = [12, 24]; measuredFrameRate = []; bitRateMode = []; minFrameRate = 0; @@ -215,7 +215,7 @@ root { maxBlocksPerSecond = 244800; blockSizeWidth = 16; blockSizeHeight = 16; - supportPixelFmts = [21]; + supportPixelFmts = [12, 24]; measuredFrameRate = [352, 288, 700, 700, 720, 480, 700, 700, 640, 360, 980, 980, 1280, 720, 600, 600, 1920, 1080, 130, 130, 3840, 2160, 130, 130]; bitRateMode = []; minFrameRate = 0; diff --git a/vendor_phytium/d2000/hdf_config/uhdf/media_codec/media_codec_capabilities.hcs b/vendor_phytium/d2000/hdf_config/uhdf/media_codec/media_codec_capabilities.hcs index c2a7fcb..def75a2 100755 --- a/vendor_phytium/d2000/hdf_config/uhdf/media_codec/media_codec_capabilities.hcs +++ b/vendor_phytium/d2000/hdf_config/uhdf/media_codec/media_codec_capabilities.hcs @@ -41,7 +41,7 @@ root { maxBlocksPerSecond = 244800; blockSizeWidth = 16; blockSizeHeight = 16; - supportPixelFmts = [21]; + supportPixelFmts = [12, 24]; measuredFrameRate = [320, 240, 617, 617, 720, 480, 559, 559, 1280, 720, 276, 276, 1920, 1080, 164, 164, 3840, 2160, 30, 30]; bitRateMode = []; minFrameRate = 0; @@ -70,7 +70,7 @@ root { maxBlocksPerSecond = 244800; blockSizeWidth = 16; blockSizeHeight = 8; - supportPixelFmts = [21]; + supportPixelFmts = [12, 24]; measuredFrameRate = []; bitRateMode = []; minFrameRate = 0; @@ -99,7 +99,7 @@ root { maxBlocksPerSecond = 244800; blockSizeWidth = 16; blockSizeHeight = 16; - supportPixelFmts = [21]; + supportPixelFmts = [12, 24]; measuredFrameRate = [320, 180, 500, 500, 640, 360, 387, 387, 1280, 720, 112, 112, 1920, 1080, 77, 77]; bitRateMode = []; minFrameRate = 0; @@ -128,7 +128,7 @@ root { maxBlocksPerSecond = 244800; blockSizeWidth = 16; blockSizeHeight = 16; - supportPixelFmts = [21]; + supportPixelFmts = [12, 24]; measuredFrameRate = [176, 144, 600, 600, 352, 288, 600, 600]; bitRateMode = []; minFrameRate = 0; @@ -157,7 +157,7 @@ root { maxBlocksPerSecond = 244800; blockSizeWidth = 16; blockSizeHeight = 16; - supportPixelFmts = [21]; + supportPixelFmts = [12, 24]; measuredFrameRate = [176, 144, 600, 600]; bitRateMode = []; minFrameRate = 0; @@ -186,7 +186,7 @@ root { maxBlocksPerSecond = 244800; blockSizeWidth = 16; blockSizeHeight = 16; - supportPixelFmts = [21]; + supportPixelFmts = [12, 24]; measuredFrameRate = []; bitRateMode = []; minFrameRate = 0; @@ -215,7 +215,7 @@ root { maxBlocksPerSecond = 244800; blockSizeWidth = 16; blockSizeHeight = 16; - supportPixelFmts = [21]; + supportPixelFmts = [12, 24]; measuredFrameRate = [352, 288, 700, 700, 720, 480, 700, 700, 640, 360, 980, 980, 1280, 720, 600, 600, 1920, 1080, 130, 130, 3840, 2160, 130, 130]; bitRateMode = []; minFrameRate = 0; -- Gitee