From patchwork Tue Nov 9 09:18:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenbin Chen X-Patchwork-Id: 31338 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp885749iob; Tue, 9 Nov 2021 01:23:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOUCrhLlE1Xm9PpsVIyqNG+syudzJyWB2LSsUxehI40WWkbLuN1s9SFjLrGB5HElck8T4q X-Received: by 2002:a05:6402:35c2:: with SMTP id z2mr8256440edc.135.1636449807234; Tue, 09 Nov 2021 01:23:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636449807; cv=none; d=google.com; s=arc-20160816; b=loYefhGPKWgk8RL9aXTmbwkoMxqtUvbKxj0Pvmekrnwthqds2Okaa90Eg9ZbwKWnZS XUkat6F37xvQ8PI9MhWG4gFrUnV9AqjRm+MxieoBO4WcussfEjHwgIkYJc6y1RRNtaK5 Ojdc8wtnRgwW5lST+TT4r0FcoS2hNTNkbHXkpGHeZdtjxxOKrc58zfD3cmm2ZJEELh9c o2AXDG9u1oRqhubb4dfD0agjZjIUJyAqwe1Pm+OC3P9VDUTcRTP2cbMDu/TJZ3zBcThf o7Z2JdrbV/6vEWPrM62fkurX/XfAyHjq3R4pR0aD6WV4rfE3P151wvCf9ghZPZMGY0ZZ zcFA== 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:references:in-reply-to :message-id:date:to:from:delivered-to; bh=ZZdyHKXWSSd13pedTT65xfETDWp0/Yps9QE5OeR6H+A=; b=sGfd/w+3yBfpsp7MP1MjQyQWT2m4zIhswXVxyldcOapZ5YrFIIxEf9ZV/xUDjnrVbN Fvus/89LM4BOky7V+zmgWzl9YNLaijhNw4qnAgYohJXNG+2+RjCxT1lFlM1i3DYUiXM0 L78PhaakiUmHJJ/o8X5CQeqMFL1gJWIl7+9bzkBRBrP+Btps2dkG0AaJiNPrhLSQFExD yiJ5fPnEZRjq5AKLEYq+dEDI/jpydeVrVDjlqcQqjSlktt0knT3aRtIlRiaWzI3igRND xNZqRkU5xuD/qK520f+lEKTuZrbxRTrX/MOyrPi9P5ktqvVXVVBF8gkIm7k8cYbJMrfP vofQ== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h20si31092393edw.297.2021.11.09.01.23.26; Tue, 09 Nov 2021 01:23:27 -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; 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=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9EEC668AB71; Tue, 9 Nov 2021 11:23:01 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 46E8A68A98A for ; Tue, 9 Nov 2021 11:22:54 +0200 (EET) X-IronPort-AV: E=McAfee;i="6200,9189,10162"; a="293245483" X-IronPort-AV: E=Sophos;i="5.87,219,1631602800"; d="scan'208";a="293245483" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2021 01:22:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,219,1631602800"; d="scan'208";a="491593963" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by orsmga007.jf.intel.com with ESMTP; 09 Nov 2021 01:22:51 -0800 From: Wenbin Chen To: ffmpeg-devel@ffmpeg.org Date: Tue, 9 Nov 2021 17:18:42 +0800 Message-Id: <20211109091843.2024927-6-wenbin.chen@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211109091843.2024927-1-wenbin.chen@intel.com> References: <20211109091843.2024927-1-wenbin.chen@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/7] libavutil/hwcontext_vulkan: fix a sem_wait bug when export drm 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: Wenbin Chen Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: KwSDM6/dm+uz sem_sig_val is wrongly assigned to pWaitSemaphoreValues when export drm. Now fix it. Signed-off-by: Wenbin Chen --- libavutil/hwcontext_vulkan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index b857d1a9ed..29ade94b7f 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -1718,7 +1718,7 @@ static int prepare_frame(AVHWFramesContext *hwfc, VulkanExecCtx *ectx, const int planes = av_pix_fmt_count_planes(hwfc->sw_format); VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; FFVulkanFunctions *vk = &p->vkfn; - uint64_t sem_sig_val[AV_NUM_DATA_POINTERS]; + uint64_t sem_sig_val[AV_NUM_DATA_POINTERS], sem_wait_val[AV_NUM_DATA_POINTERS]; VkImageMemoryBarrier img_bar[AV_NUM_DATA_POINTERS] = { 0 }; @@ -1738,6 +1738,7 @@ static int prepare_frame(AVHWFramesContext *hwfc, VulkanExecCtx *ectx, VkPipelineStageFlagBits wait_st[AV_NUM_DATA_POINTERS]; for (int i = 0; i < planes; i++) { wait_st[i] = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; + sem_wait_val[i] = frame->sem_value[i]; sem_sig_val[i] = frame->sem_value[i] + 1; } @@ -1756,7 +1757,7 @@ static int prepare_frame(AVHWFramesContext *hwfc, VulkanExecCtx *ectx, new_layout = VK_IMAGE_LAYOUT_GENERAL; new_access = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT; dst_qf = VK_QUEUE_FAMILY_EXTERNAL_KHR; - s_timeline_sem_info.pWaitSemaphoreValues = sem_sig_val; + s_timeline_sem_info.pWaitSemaphoreValues = sem_wait_val; s_timeline_sem_info.waitSemaphoreValueCount = planes; s_info.pWaitSemaphores = frame->sem; s_info.pWaitDstStageMask = wait_st;