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 0FEE643C70 for ; Wed, 27 Jul 2022 19:51:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2024E68B906; Wed, 27 Jul 2022 22:51:43 +0300 (EEST) Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AE11068B8BE for ; Wed, 27 Jul 2022 22:51:36 +0300 (EEST) Received: by mail-qt1-f179.google.com with SMTP id l14so13390357qtv.4 for ; Wed, 27 Jul 2022 12:51:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=ag86OQUbHrTB8g35y3JCe8RrsmZpqRGVfz4Cl+Qa5gY=; b=hJTqKzHXe/uMTcMM3ZKXzg5hPgl7uIxD1ciVySrqRxlPfPphLlShR8uXvTD577TjgV fCrzUmtXe91zBPGOA1fnxHcS8nFRRrU5NuhmLSqAx7zvG3j+pHP0ARYR1cDDjOI6CD+7 W9rZgWSSqa9j95lBxMihbcdPzZoEbI16Esj0+Sr+fCWdSxkMNaLZbQTyza0ILn2Cavw3 Wdr5vB9V6wiYMIGMOfcDtVymtJGfgcvT2d/Qy7tPFztEC1/mNRT9Zj20SyXwEs0lG0i4 qd0dp+fEXv+ISGSqg+mOV8lJXtY+ZR+hbCFczIiUIMLxNZr5XiwYGFRdZhBKh5M1LJ5K qvcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=ag86OQUbHrTB8g35y3JCe8RrsmZpqRGVfz4Cl+Qa5gY=; b=Fs8McbX/ttkiR04STcr33O3bqy3fojJY5+aC1fvB3qu4FU6jqc2U0XBAqsZIkgwW1z 6SgkT+KJmseYAuBzHAEpnvC6Q96RGBcvAAuGIJwRc4yG9KeK8NeIBRrHbf+WHTdddsVs mAjGTLBtkYq3SoiPJ1fZSsqSQyj07xsKVFvCt13PgXqoUPLVLzj9u0+uWrnpQkfRKnr/ th+IKgdviXksgbTzX8q7rZMa5aBLRZdOnyiPfa6Iz+dipoiD4eYrAwfuuX6sH5xqipb1 277d8rUfZiRu0MnMIBtGnLBLsnZw4m8RCIuThjtHmddSkGRJLfa2R4ZKp7JeczowTaKX c7LA== X-Gm-Message-State: AJIora+OZWgNdPViDugnvIxTLWGd2XwhrCt6HmLGc3HU64zBbG9/Lt1e llpQ+xg/bOFhJMuhuiKyxs19Bs+oGfXVowAkOcQrNYSjdKkjZQ== X-Google-Smtp-Source: AGRyM1vlCl+3w3Qqrhev2r+ZaiWBeow3L14ZDFNXSh7gQkIGOnPlo1U09t5peuil07MxR31YBbIdh2H+HdOwotoQDp0= X-Received: by 2002:a05:622a:48b:b0:31f:2416:2f3f with SMTP id p11-20020a05622a048b00b0031f24162f3fmr19562411qtx.376.1658951494922; Wed, 27 Jul 2022 12:51:34 -0700 (PDT) MIME-Version: 1.0 References: <20220719175310.647621-1-emil.l.velikov@gmail.com> In-Reply-To: From: Emil Velikov Date: Wed, 27 Jul 2022 20:51:23 +0100 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH v2 0/3] hwcontext_vaapi: dlopen libva-x11 and libva-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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Thu, 21 Jul 2022 at 21:47, Mark Thompson wrote: > > On 20/07/2022 17:41, Emil Velikov wrote: > > On Tue, 19 Jul 2022 at 19:16, Nicolas George wrote: > >> > >> Emil Velikov (12022-07-19): > >>> As you may know the libva* set of libraries share an internal ABI > >>> between them. In a resent libva commit, the va_fool API was removed. > >>> > >>> Thus if one is to mix different versions of libva.so and libva-x11.so > >>> they will get an error, leading to a crash of the whole stack. > >>> > >>> The simple solution is > >> > >> ... a configure check. > >> > >> If the person who installs replaces a library with another, it is their > >> responsibility to check they are compatible. > >> > > > > While I wholeheartedly agree, it's not so easy to enforce compile time > > decisions at runtime. In the past, I have debugged and reported issues > > where Linux distributions do not enforce the above. > > > > We do have the typical Linux distribution model (where we have dozens > > upon distros) and other distribution models. IMHO checking each > > instance and combination doesn't scale. We could bring awareness to > > the issue in say distribution/workflow X, which sadly may come as > > finger-pointing and thus alienating. > > > > Hope that makes sense and the team is willing to consider the extra 90 > > lines worth of code. > > The argument "libfoo can be broken in some particular configuration, so lets use dlopen() to make errors happen later" seems like it applies to every library. Why is this case so special? Who are the users running into this specific problem and who are stuck with broken versions they can't update? > It's a long story, hope I don't bore you to death :-P Even though I've been itching to hack on ffmpeg for a while, the bug that allowed me to do that is https://github.com/ValveSoftware/steam-for-linux/issues/8673 As a background, steam as well as some of the programs/games shipped use libraries provided by ffmpeg. In addition, steam ships with a steam runtime, which is effectively a partial chroot of an old Ubuntu. For various compatibility reasons, one cannot simply update it, so the startup scripting will try and promote a set of the host libraries (if newer) so that they're used instead of the bundled Ubuntu ones. What happens in the libva case is that distributions can provide only libva.so and omit libva-x11.so. Which due to the internal ABI break (removal of the va_fool API), means that steam and likely some games will simply crash out. Now let me try and draw an analogy to another set of libraries which also share internal ABI - libdrm.so, libdrm_nouveau.so, libdrm_amdgpu.so libdrm_intel.so, etc. To the best of my knowledge there was no breakage in there be that internal or public ABI. In addition, while distribution may allow you to install only some (say libdrm.so without libdrm_intel.so), a pair of those is pulled by the respective GL and Vulkan drivers. For example: the amdgpu GL driver (amdgpu_dri.so) and radv Vulkand driver (libvulkan_radeon.so) depend on libdrm_amdgpu.so and libdrm.so. Hence, in practical terms users cannot hit a similar issue... unless they very very deliberately try to do so. So while one solution is to go around telling users and distributions that they're "doing it wrong", IMHO a more pragmatic solution is to include this brief workaround in ffmpeg. At least in the short to mid term. As mentioned in the cover letter (sorry again for sending the series multiple times), I have some plans for a proper long term, which would reside in libva. Alas as you have experienced yourself, the libva maintainers can be rather busy, so we're looking at least a couple of months until a new libva release is out and further X months, until it ripples down to end-users. > (Also, shouldn't lazy binding save people in this situation if they don't actually use the feature, as they presumably don't if barfing at runtime makes sense?) > I suspect you meant using RTLD_LAZY - I believe it should work. Will test and re-spin for the next revision. Hope the above makes sense. I tried to stay brief and on-point, but if anyone likes further details I will be happy to provide. Thanks Emil _______________________________________________ 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".