From patchwork Sat Jul 1 09:40:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wm4 X-Patchwork-Id: 4172 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp6767317vsb; Sat, 1 Jul 2017 02:40:23 -0700 (PDT) X-Received: by 10.28.32.70 with SMTP id g67mr8340076wmg.101.1498902023121; Sat, 01 Jul 2017 02:40:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498902023; cv=none; d=google.com; s=arc-20160816; b=sTWc9S68vfbKycmuxpsor7+TgkNC/koiXm3yiM30V4PViKm5VTtWOukEXEjCchuRi7 lgXHZCkDBcGW3lTVv0wKSMF9L6ol5j6fwNO201UOlx3o8cck/aWt/XNQUAWjmygSiy4f dT6JwKh6tYOYd41a55QyKfppmtAGtKvQ0eexRMTulX/aBQ/+kxSsMQ8aJKrgk4r1AEzy YUXGb6AccgFZ/CjdXPxoMq+UTTWUEUpLhqazONeNyrVZQYDIPbxSWBBiR2tHKqbaOH9W wds+NXvrteWjBbWHvhnsq8afL9ixURDPBQBbZgUU/DvuUm/0Ca8GfWium7qHD+OmJdvl vuCQ== 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:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=KnmrHseiRKy9OOTHl9LX3HKwrQiVonwoS62MafOj/Hg=; b=J/3sXj7AYWaZIcV8RY1xpm6/hgd+1DAag2TOsmE1y5/j1ZMMX5t8EqBThZNAYsHN56 xqAyjdRLDFs0O3xeCe6I+ouwdqhfz8+qmx+jEpcHfKbSYf5PTcX91Bn50JOi3W7LuKGn g7l9kI6xK69GzVTE45PDmCpzjATgecOsqnHW/lBnkasgsJmWYBchGH+yXMReA6r8qCh6 tm2PcsEgin0rtNqMml65lDownHupHhiNVsBVqB+k+IpHb2ggcfSXBFR7Jnb6AmP7rZrm Egj0M7bxySVJQ28UVUUKx2HJDlmU8Er2uRu4mGHfP56Jne3N4i3AeL6MLh8j82QH/8Z6 h6QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@googlemail.com header.b=QjPKnCW4; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v193si12316275wme.197.2017.07.01.02.40.22; Sat, 01 Jul 2017 02:40:23 -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=@googlemail.com header.b=QjPKnCW4; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5ED2E689250; Sat, 1 Jul 2017 12:40:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E132B680B1B for ; Sat, 1 Jul 2017 12:40:11 +0300 (EEST) Received: by mail-wm0-f43.google.com with SMTP id i127so66342587wma.0 for ; Sat, 01 Jul 2017 02:40:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=QRKrscSucRBTEg4yGYj69VSBy5OHw2eV42J7x+/xsWw=; b=QjPKnCW4vrg+JENRLitYrMKnAt+dq6ZtVm/UnIaLJlq2yW/ZDVjo3qILAveu7oABZ6 leC7ZYa3WUrK61SJszPD/MNB5cckQLqGU84ROb9uR8IQ9X81dMhNY3XuDJrwwY/7YidY 5zjVrN9Sgk6heATBwGOoc7RDU1Fj7OExAsco3fgUtW5Ud7lGXh+PqBJ+Gd0Ql73rDplS P5Ze09QrN0VN7pEoxK5Qm2lKlaHT8Ib02LNW+WXCO002cXHOd+xhLcpm8xY/5+nPCMVZ XOaz5aWOYU75chGz0nSv5Uh6Qeu56y3vxWtOET5opj2SVqjTvvV2MfmM5oKGokdo9C8v b+Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=QRKrscSucRBTEg4yGYj69VSBy5OHw2eV42J7x+/xsWw=; b=qowpQqCphqX/IXAzN9eurGI1DPGzM1B5dyzfKGjTol1b/+F+jKIZVgglWO98vP7ydA 8WajYEBkk3Mvr+arQZ9TzYO3JRLaNzso2Flb6sB2nyVa7O84Hb+SXwnf/wJxe6X9Po41 KNe2g0uBz2U+4HWrD+HGwdWT2sWQJ0TPmlIMpIz87XP1YplFmuUqo+RoND1JDp6XB/65 y2oSmfWvIUkfQlyVmCZLteA6fMdn9ScGqhOq8moPPlIsujmLhYe2/zN0RJ83yCmqP1mK 2JjHvoJV4pH4FWqgQZji2MJqxbx54/1fB9gp4J2QrQTOmJg6icd3nFM5+K1ajvkVirN4 u6jQ== X-Gm-Message-State: AKS2vOzL3mGggfj6tE+I9NqNMk5P2sSOkS7w1y3IDp9rnIZZIp0nVjcJ 8zjM/CHQhGEKx8jY X-Received: by 10.28.56.198 with SMTP id f189mr17309230wma.88.1498902011842; Sat, 01 Jul 2017 02:40:11 -0700 (PDT) Received: from localhost.localdomain (p4FF0057F.dip0.t-ipconnect.de. [79.240.5.127]) by smtp.googlemail.com with ESMTPSA id w197sm15640704wme.20.2017.07.01.02.40.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Jul 2017 02:40:10 -0700 (PDT) From: wm4 To: ffmpeg-devel@ffmpeg.org Date: Sat, 1 Jul 2017 11:40:38 +0200 Message-Id: <20170701094038.23587-1-nfxjfg@googlemail.com> X-Mailer: git-send-email 2.11.0 Subject: [FFmpeg-devel] [PATCH] vdpau: do not use buggy HEVC support by default 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: wm4 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" NVIDIA broke its own API when using VDPAU decoding. If you retrieve the decoded YUV data, or if you map the surfaces with GL interop, the result are interlacing artifacts. The only way to get non-broken data is by using the vdpau video mixer to convert it to RGB. There is no way to block the non-working operations in a reasonable way (a VdpVideoSurface has to support all operations). NVIDIA refuses to fix this issue (it "fixed" it by making it work with the video mixer, but the rest is still broken). There is no sign of that changing. Do not use HEVC by default with the generic hwaccle API. Detect whether it's the NVIDIA native implementation, and exit with an error. (The same thing work with the MESA implementation.) As an escape hatch and to allow applications to use the decoder if they really want to (perhaps because they make sure to explicitly use the video mixer), reuse AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH to disable this check. Once NVIDIA fixes the bug, working driver versions could be detected, and it could be allowed again. --- libavcodec/vdpau.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 9c7804a287..42ebddbeee 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -127,6 +127,8 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, VdpVideoSurfaceQueryCapabilities *surface_query_caps; VdpDecoderQueryCapabilities *decoder_query_caps; VdpDecoderCreate *create; + VdpGetInformationString *info; + const char *info_string; void *func; VdpStatus status; VdpBool supported; @@ -209,6 +211,23 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, return AVERROR(ENOTSUP); status = vdctx->get_proc_address(vdctx->device, + VDP_FUNC_ID_GET_INFORMATION_STRING, + &func); + if (status != VDP_STATUS_OK) + return vdpau_error(status); + else + info = func; + + status = info(&info_string); + if (status != VDP_STATUS_OK) + return vdpau_error(status); + if (avctx->codec_id == AV_CODEC_ID_HEVC && strncmp(info_string, "NVIDIA ", 7) == 0 && + !(avctx->hwaccel_flags & AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH)) { + av_log(avctx, AV_LOG_VERBOSE, "HEVC with NVIDIA VDPAU drivers is buggy, skipping.\n"); + return AVERROR(ENOTSUP); + } + + status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES, &func); if (status != VDP_STATUS_OK)