From patchwork Mon Jan 3 03:24:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cameron Gutman X-Patchwork-Id: 33029 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp15797513iog; Sun, 2 Jan 2022 19:24:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJyRur0c4XFZX3qJv7HuSzVm5Pn8MfQH4RygpC8IOVAAdvOF5jFm3QbTzbm/N3t0+kKQK3cI X-Received: by 2002:a05:6402:1250:: with SMTP id l16mr43891261edw.0.1641180282029; Sun, 02 Jan 2022 19:24:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641180282; cv=none; d=google.com; s=arc-20160816; b=WhNtc6qBGANcaWA1sNx6BTzTNsm1SykCGqILbNDo8djLj3eQK21tKV9r2Otj+3gyEr m17LjlfNXHa0Rs5QuM0xObxbAFb6hT4szQreJF6PuPZTWis/AEJfviE4+wVJ14BG9/0R mWg87HpniYPg+s4xRqdDg56YNC6ZXEdupcjW3tY6MUnAabyw8Xj7G55TQr26ul9s5PRk CF9p3YM+3mpaFVotvHmz72w05XybZAX5hgxWz+zwPWfvQx4OSeVD0AI+hyv0qPomcpfM A1vIulWtCTrGccDsO6yv8YVVgZQM31cVDH735Sm8aVGZ6AVBbYBibtUIjjyFg3jKeZj2 QH5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=XfXo/EcoBMGzMfaptiPfK/fO5ibtkREm+CGDa3Upolw=; b=hY0seMMTREb7mY58RMR40x3dIip7896HdtKnP5JQuIN5olCUO96Bw7M+d+2lzbJKDQ nlH3LeZDjFYnbKkQx18KQzVqNprxjgiuvATc0AoZ+61nsT+w1L8GCIHOrQQTBDag3YDe pJ+rYNli7/L+6SPsqFhWvo/2o4fKwRVo2Pfq40kwZwGb+XZZ73ZKxPuO6c+HHg3WCRwv CPqXixJEx/pkw6DZhy6Ksr2G2pMX6lpWYo2ERrceTafWlXqFIseRdRAR2mJdnVjUMkwi Y0Ru9AeV3sZ8ngVs2L3AUE/TvUWgt1Umspxyu0LLphXSST+bDuulRjXi8gmUZdq0p1Kc z4Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=AMQ4wJd0; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id do7si19797774ejc.585.2022.01.02.19.24.41; Sun, 02 Jan 2022 19:24:42 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=AMQ4wJd0; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A642D68A516; Mon, 3 Jan 2022 05:24:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B293D68819D for ; Mon, 3 Jan 2022 05:24:30 +0200 (EET) Received: by mail-ot1-f54.google.com with SMTP id v22-20020a9d4e96000000b005799790cf0bso42220302otk.5 for ; Sun, 02 Jan 2022 19:24:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=HNkkBM9PYUsRrwgEJtko2XmuhQU4rqKL0qgSUMC+Lr8=; b=AMQ4wJd0AmXDzfwizb4hg/FXx4nh7IF6dJlBrP1eXyYuCzyI89JNEnsoafYp3RTCf0 8fv4ipvMUPvs3AH9tuGjdm5CyDesdoYZT/La7eFZt8o6HV6rW1xv5FDfastGz1lB9pWm v/vSzF4xBI2OaVuLbbz8NQADlkInyKuJAsBJB4PK7Gu0qT/2Wyi94laZkYWhTxcfyzg2 YESKMlWmEsXS3rqkqpcCS5M3Lj1P0lhBPyvn2op6bKwCpuZ7pxA7JKkXe9Kx2KtJHCa8 h3WfgoQN1P5sB1LXz4sZ/ei5OJeMCfMifjgGFpYtVmy2ejXiQ3bKSVD+Qi3NKlhyvrEI 3q6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=HNkkBM9PYUsRrwgEJtko2XmuhQU4rqKL0qgSUMC+Lr8=; b=viIWaN28Pfam5dQzngxj7w6Tsmd+ZrjNYLX/ZnqoV7dPzKirL/pEvGJqU5EtJix8No nmptsYu43cO5xtE/mQy4zdGfqwIpnlXAIP7AGADSSTmBO3VfHY486GLFA0sB1SwsxEkS d0XeHUz14qlnRr4+3PxQwb5Dm9Zef6fTt28v6SJPEt3k12LnimV1qi4lKbL+KoT5W5rx /Ej898YJ5oPPGDO0oKfdYiP6BVt0BlyZ0MoyEYuebakKZt2ZnsGctzVUmL2SrzH83h81 67DhRwmgZ1cH9cdrt94hoIMkTsIHzI4AigwfCRxTEo801j5i6DqysVEjBCXpu23j1tYs 2HWA== X-Gm-Message-State: AOAM533vpwT2yxJEtZyCc4FNRQ9znERXppi2PVtnCbN0c6AhVJ3uHis2 qUlx+RWdE01LAhFe7d//LyD3OTiezlfzMA== X-Received: by 2002:a05:6830:44a4:: with SMTP id r36mr30228972otv.365.1641180268940; Sun, 02 Jan 2022 19:24:28 -0800 (PST) Received: from ubuntu-vbuilder.localdomain ([2600:1700:4830:3f7f:20c:29ff:fe04:f136]) by smtp.gmail.com with ESMTPSA id f27sm7040767otc.16.2022.01.02.19.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jan 2022 19:24:28 -0800 (PST) From: Cameron Gutman To: ffmpeg-devel@ffmpeg.org Date: Mon, 3 Jan 2022 03:24:19 +0000 Message-Id: <20220103032418.539294-1-aicommander@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavu/hwcontext_drm: don't fail mapping when dst format is unset X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Cameron Gutman Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 8wa6eUuJ2VX7 av_hwframe_map() is documented to work with a blank dst frame, but hwcontext_drm currently fails if dst->format == AV_PIX_FMT_NONE. Signed-off-by: Cameron Gutman --- libavutil/hwcontext_drm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_drm.c b/libavutil/hwcontext_drm.c index 7a9fdbd263..85a9fd4984 100644 --- a/libavutil/hwcontext_drm.c +++ b/libavutil/hwcontext_drm.c @@ -287,7 +287,9 @@ static int drm_map_from(AVHWFramesContext *hwfc, AVFrame *dst, { int err; - if (hwfc->sw_format != dst->format) + if (dst->format == AV_PIX_FMT_NONE) + dst->format = hwfc->sw_format; + else if (hwfc->sw_format != dst->format) return AVERROR(ENOSYS); err = drm_map_frame(hwfc, dst, src, flags);