From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 1F41E42E20 for ; Sat, 9 Jul 2022 06:45:40 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 11AA368BA36; Sat, 9 Jul 2022 09:45:39 +0300 (EEST) Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C229468B7ED for ; Sat, 9 Jul 2022 09:45:32 +0300 (EEST) Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4Lg0yf1Nptz9sRp for ; Sat, 9 Jul 2022 08:45:30 +0200 (CEST) Content-Type: multipart/mixed; boundary="------------F1ZaGMeD6wVl5RFhI3MMn1Ya" Message-ID: <6301fb24-1d5d-b069-a773-0defdc2086df@ycbcr.xyz> Date: Sat, 9 Jul 2022 08:45:31 +0200 MIME-Version: 1.0 To: FFmpeg development discussions and patches Content-Language: en-US From: Steve Lhomme X-Rspamd-Queue-Id: 4Lg0yf1Nptz9sRp Subject: [FFmpeg-devel] [PATCH] avcodec/pthread_frame: update the main avctx from the current, ThreadContext 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: This is a multi-part message in MIME format. --------------F1ZaGMeD6wVl5RFhI3MMn1Ya Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Patch attached in the email. In some cases, the submit packet can result in configurations changes of the hardware decoders. The previous HW context is then freed and a new one created. That context is supposed to move up to the main context and the other threads. It appears that when more than 2 frame threads are involved, the new context doesn't move in the right place (or rather at the right time). And it can create a crash when reusing the old HW context. This patch fixes the issue I could reproduce in VLC with DXVA decoding. I have no idea if this is correct or the side effects induced by this. It seems the right thing to do. Keeping the previous call exhibits the issue. It seems odd the other existing thread context are not updated with the current hwaccel_priv_data. But maybe they are updated later from the "main" thread context, in which case this patch seems solid. --------------F1ZaGMeD6wVl5RFhI3MMn1Ya Content-Type: text/plain; charset=UTF-8; name="0001-avcodec-pthread_frame-update-the-main-avctx-from-the.patch" Content-Disposition: attachment; filename*0="0001-avcodec-pthread_frame-update-the-main-avctx-from-the.pa"; filename*1="tch" Content-Transfer-Encoding: base64 RnJvbSBlOGFiZWVmZjkyZjVkN2IzYjU1M2FjZGI3NTk1ZDQwMTUzY2JlYzFlIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBTdGV2ZSBMaG9tbWUgPHJvYnV4NEB5Y2Jjci54eXo+ CkRhdGU6IEZyaSwgOCBKdWwgMjAyMiAxMTo0OToyNyArMDIwMApTdWJqZWN0OiBbUEFUQ0hd IGF2Y29kZWMvcHRocmVhZF9mcmFtZTogdXBkYXRlIHRoZSBtYWluIGF2Y3R4IGZyb20gdGhl IGN1cnJlbnQKIFRocmVhZENvbnRleHQKCkFmdGVyIGEgc3VibWl0X2RlY29kZXIoKSB0aGUg aHdhY2NlbF9wcml2X2RhdGEgbWF5IGhhdmUgY2hhbmdlZCBpbiB0aGF0IGF2Y3R4LgoKRG9p bmcgaXQgYWZ0ZXIgdGhlICJuZXh0IGF2YWlsYWJsZSBmcmFtZSIgbG9vcCB3aWxsIGxpa2Vs eSBwb2ludCB0byB0aGUKaHdhY2NlbF9wcml2X2RhdGEgZnJvbS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AmJiAhKmdvdF9waWN0dXJlX3B0 ciAmJiBlcnIgPj0gMCAmJiBmaW5pc2hlZCAhPSBmY3R4LT5uZXh0X2ZpbmlzaGVkKTsKIAot ICAgIHVwZGF0ZV9jb250ZXh0X2Zyb21fdGhyZWFkKGF2Y3R4LCBwLT5hdmN0eCwgMSk7Ci0K ICAgICBpZiAoZmN0eC0+bmV4dF9kZWNvZGluZyA+PSBhdmN0eC0+dGhyZWFkX2NvdW50KSBm Y3R4LT5uZXh0X2RlY29kaW5nID0gMDsKIAogICAgIGZjdHgtPm5leHRfZmluaXNoZWQgPSBm aW5pc2hlZDsKLS0gCjIuMjcuMC53aW5kb3dzLjEKCg== --------------F1ZaGMeD6wVl5RFhI3MMn1Ya Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". --------------F1ZaGMeD6wVl5RFhI3MMn1Ya--