From patchwork Tue May 8 13:31:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Rothenpieler X-Patchwork-Id: 8871 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:155:0:0:0:0:0 with SMTP id c82-v6csp4022426jad; Tue, 8 May 2018 06:32:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoVwj2RUKEkCSlU+caNWuJcqGGjpZ9ixyXn5uFUBQN1JMlZuAGS0o420ivpV5mvfb92wWig X-Received: by 2002:a1c:d6c9:: with SMTP id n192-v6mr3634450wmg.125.1525786363149; Tue, 08 May 2018 06:32:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525786363; cv=none; d=google.com; s=arc-20160816; b=m0zyMeDkKznuyyK63qdvyyJFkk/1lD22ahHfUIcjUKEr+tqb3qcWjGbELSJUnl0H7J Th69B3GWE9I/gpJieV3DC7X0ighqNmbbDex0jTCNHBtPcSjM9ANmeg7OTrDMW7KdeWFb KulqSRI39QBtJv5xp45V1CgL9sUI+WaSzfSr3QE93zwMJyyLsnP163ksX/XCbxTo1O27 ja0XZstO+3lM3c8b4jBDEiGlKM8O1ArOlaPwIFoameijTk7rHKksy/uk6XkoAJpvmYBZ aY5OGYTe29leSBjg/pLtBlvjQf2MD9uJy2/uE4RVUmI32sABkxAE3TYIAOAlfOu/niir DzXQ== 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=oFMB506+4VOZcaF+oqUEjyACXcnbFwdLvT7ydedk5E02rZVy4jkJVx6G+NCDhsVby9 lsk6srSEx247+IJcrOQTiL6veoXSgs95fyd9vFSkUhU5XWgJV0ogMVkzuM/vZfZzEis9 J9b3T/bBWJRHid7Oy1d7ZfYuuWE2GH/y0/383I2BQBiondJWZgujSYut+AMEqkGEoVmp tzKHe5HnueNb5vYNRCuoaZC7naxZu/si+ldzUJCtR3Nh94i9Hl9o/piwdf3dKN8tjttw VfSV5e59WkQYPR+e8hfvvSCZ/9Htv8HE7XFYjJjamIZugInTDVU7/lvWt0G/9P1u+ja8 DKtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org header.s=mail header.b=A0vl/6yj; 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 z70si7119656wmd.84.2018.05.08.06.32.42; Tue, 08 May 2018 06:32:43 -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=A0vl/6yj; 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 BA4D068A709; Tue, 8 May 2018 16:31: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 A7B1268A47C for ; Tue, 8 May 2018 16:31:15 +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 7A39A734C2; Tue, 8 May 2018 15:31:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rothenpieler.org; s=mail; t=1525786304; bh=A1+rjFXrF9VZfiSeJo6/dpl5rT33HZ5E9j4vfobDy9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=A0vl/6yjcSF5XQLALSBZOloVOJt+MQoPjwhW3+ueBNYaL3rp6og1zdNxBUrzFT+7o VeKveKAPMkoYiYIVTBMi+ss/LgmIxigf37pq7qarGW/fbtko9ciKg5xAuWefpl13Sx Q6Po9PxooHCy9egAAP3ubfpOoa+CNJrP57x6DVsI= From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Tue, 8 May 2018 15:31:32 +0200 Message-Id: <20180508133132.28940-6-timo@rothenpieler.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180508133132.28940-1-timo@rothenpieler.org> References: <20180508133132.28940-1-timo@rothenpieler.org> Subject: [FFmpeg-devel] [PATCH 6/6] 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) {