From patchwork Tue May 8 18:36:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Rothenpieler X-Patchwork-Id: 8882 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:155:0:0:0:0:0 with SMTP id c82-v6csp4335424jad; Tue, 8 May 2018 11:37:26 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqRhB3hQeUWBJD1TiULQmeV0arT9taBKG+l9pvYqI+7oZrSri8pF9jvdxJNv9hNCv6QVuxl X-Received: by 2002:adf:ea90:: with SMTP id s16-v6mr32743039wrm.17.1525804646617; Tue, 08 May 2018 11:37:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525804646; cv=none; d=google.com; s=arc-20160816; b=aajYS2ODf2ACUi4FsRrJRs0W8RaX22d4Wg9kKT13zdJI00bI9jX6/7ksty66xKhdEe GcNHGVcFOnj+GCY+wYeYnoUtyo0imngVN2MOQm+oyhz/Nr/0zCElcMlWD+bMfLxFk61F GvP0S6cYtUb/8FVtVq7k7gy3uw3ouUveOPIfYNgHFINcll71fpaqZA2dlzhbjNq9Wgkl yU1PIVTN1bMJw2MPGtWYcJc3C1qDD2Y03BDdnQOFgzKnlbffmW4PjKVaZZKz7DINuQ9G wRCYZKGiYjS6hC/GYEnq7/MUGzOI9NFoDXhSGd53RWh/0zuJnstEVhGY4R+QB7Rp0js1 U+4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=z1GjH2rxbWKWYuMk+J5WM602qSmsVYgxghLJySKpylk=; b=KcoQ2yyLGZr8B8/WBcTrR+xIT4Sy/BCTjSngFC4YnRPljHyU3kzmFd0QxBf5jxbz0L WdftWeyYPue+MmWERy3plcfU3Nv9YjnahqTd+A3s+9P0tbutNcV07CsYWUQ/WczfjUCL S8jEaCZQEUg5V7X/gVyGFNv0LiX6MyFePWLBEJ9ib8mJFSG6ySOP1y9ErmlbhmUeKwyy x8iis/A3DjIEC7rbXhxU83U/TteRSjrMk8ZojzYbvsgVVNV4IyUxSlXiKrZL2425N2Rc Ie8tE4pXcuAet3k774XcROPfMxVxhMHSAHOOtRdYR+HOhoepgI3msNBCXjQoOBuiBQPr fkRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org header.s=mail header.b=vYVOYVPi; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b142si1702484wmf.137.2018.05.08.11.37.26; Tue, 08 May 2018 11:37:26 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org header.s=mail header.b=vYVOYVPi; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 205BE68A78E; Tue, 8 May 2018 21:36:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from btbn.de (btbn.de [5.9.118.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1713768A758 for ; Tue, 8 May 2018 21:36:11 +0300 (EEST) Received: from localhost.localdomain (200116b864513a00ba975afffe10ec69.dip.versatel-1u1.de [IPv6:2001:16b8:6451:3a00:ba97:5aff:fe10:ec69]) by btbn.de (Postfix) with ESMTPSA id 46C6C732F4; Tue, 8 May 2018 20:36:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rothenpieler.org; s=mail; t=1525804606; bh=A1+rjFXrF9VZfiSeJo6/dpl5rT33HZ5E9j4vfobDy9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vYVOYVPi4pgZ3rP7n/Mt0jjz0p8aMZg3Uc4ntgjIEOka8RpoEkPnjrpaGc/WBPcbN 0ywS2ySnEA1qiG+fM9EwgpAA9s9eSNxdFAr7mAfiMN52VY+4wi3DPcUprmwyF2hQSW tgGXgLNfbTKZ+cao7aVufxxBrduUd+VL0B5Qkseo= From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Tue, 8 May 2018 20:36:40 +0200 Message-Id: <20180508183640.13605-5-timo@rothenpieler.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180508183640.13605-1-timo@rothenpieler.org> References: <20180508133132.28940-1-timo@rothenpieler.org> <20180508183640.13605-1-timo@rothenpieler.org> Subject: [FFmpeg-devel] [PATCH 5/5] avcodec/cuviddec: explicitly synchronize cuMemcpy calls X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Timo Rothenpieler MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavcodec/cuviddec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c index 122c28f6e8..4d3caf924e 100644 --- a/libavcodec/cuviddec.c +++ b/libavcodec/cuviddec.c @@ -550,12 +550,16 @@ static int cuvid_output_frame(AVCodecContext *avctx, AVFrame *frame) .Height = avctx->height >> (i ? 1 : 0), }; - ret = CHECK_CU(ctx->cudl->cuMemcpy2D(&cpy)); + ret = CHECK_CU(ctx->cudl->cuMemcpy2DAsync(&cpy, device_hwctx->stream)); if (ret < 0) goto error; offset += avctx->height; } + + ret = CHECK_CU(ctx->cudl->cuStreamSynchronize(device_hwctx->stream)); + if (ret < 0) + goto error; } else if (avctx->pix_fmt == AV_PIX_FMT_NV12 || avctx->pix_fmt == AV_PIX_FMT_P010 || avctx->pix_fmt == AV_PIX_FMT_P016) {