[FFmpeg-cvslog] avcodec/nvenc: change flag of cuCtxCreate to avoid CPU spins

Agatha Hu git at videolan.org
Fri Sep 11 10:14:39 CEST 2015


ffmpeg | branch: master | Agatha Hu <ahu at nvidia.com> | Fri Sep 11 10:54:08 2015 +0800| [81071eea7d90103dbbdbd878fc19822f10441fd5] | committer: Timo Rothenpieler

avcodec/nvenc: change flag of cuCtxCreate to avoid CPU spins

Signed-off-by: Timo Rothenpieler <timo at rothenpieler.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=81071eea7d90103dbbdbd878fc19822f10441fd5
---

 libavcodec/nvenc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 5490652..3174b01 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -580,7 +580,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
     }
 
     ctx->cu_context = NULL;
-    cu_res = dl_fn->cu_ctx_create(&ctx->cu_context, 0, dl_fn->nvenc_devices[ctx->gpu]);
+    cu_res = dl_fn->cu_ctx_create(&ctx->cu_context, 4, dl_fn->nvenc_devices[ctx->gpu]); // CU_CTX_SCHED_BLOCKING_SYNC=4, avoid CPU spins
 
     if (cu_res != CUDA_SUCCESS) {
         av_log(avctx, AV_LOG_FATAL, "Failed creating CUDA context for NVENC: 0x%x\n", (int)cu_res);



More information about the ffmpeg-cvslog mailing list