From patchwork Fri Nov 12 05:50:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lynne X-Patchwork-Id: 31370 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp1382867iob; Thu, 11 Nov 2021 21:50:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxORgWivOuvEyWouHShfoXI+zroozRHYmRHRyBHB3OysgLxpFR4ku3fMa2VtxRuiFzPKvNA X-Received: by 2002:a17:906:b2d0:: with SMTP id cf16mr16491999ejb.52.1636696248869; Thu, 11 Nov 2021 21:50:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636696248; cv=none; d=google.com; s=arc-20160816; b=zL9VvdwdPC8hg06R41MGOG5J0HedyeMfFZjP2HVZ5Sg237PwZcPKUqyi2pvmS4o6/n Y+Bpn31pfUaDMhSwepjn1Kah3wMBsvrs8mSLtiE5Z3HTDkAwh1BYbQ7RQEznIj9fnc91 Wu5AN60tSW3x75qLYone21RzYPXhaORCdD/72COAapCLmVIDlcJKzrkDbUKHans8OAJx tqSdRW6T2E8oqf2lvCZPGbs18lTYC4+ZiIGucNhAvXscklSGcxxGFTbWXd43Rsx3oZK1 6caVAQNASfPtMq1g75dUYvzydn9RR9nFeFkNEgA0mbrQkSQPacc6c0KfrV6Tn3hLFMUV IkjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:to:from:date:dkim-signature:delivered-to; bh=Z0MLh3pGePibcONyKbKcOEJIHbjucYbmGq88AEvlefk=; b=kILIuRlgY1pWm77hbI4uKGjg1+AvwGMgcUIWQNEut1TNZMxtcbYusc/TDjB043ds7O tiMeqa8jEwYZKtJb+wPolk+fsvMwLZv5gtyYOJpMiqL/l6bLu2dA1qhRnJ1JZCisH2od uLcDy2A1ZE4KqwIjo3knMZyRip/gz42lWZ6j1wynwQ08xMcR3M1D3tulR7Q7ls7tK60q fb6nncQLYrpNwuKmkQ9h9Ifz95ENUTM8GlqTiki+gv/dhLCFa4AU/viVh3TUnrhxDHZ7 H5iI1P7xbyvSmpU7tsVGYArZH+aQFHwNg//fseXsJOtEqvQVVxI9tRNx7lbBuVszltFK LkaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@lynne.ee header.s=s1 header.b=VcU6HAjG; 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=lynne.ee Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q2si10097468ejx.746.2021.11.11.21.50.47; Thu, 11 Nov 2021 21:50:48 -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=@lynne.ee header.s=s1 header.b=VcU6HAjG; 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=lynne.ee Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0CEFC68A987; Fri, 12 Nov 2021 07:50:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 10367687F13 for ; Fri, 12 Nov 2021 07:50:37 +0200 (EET) Received: from w3.tutanota.de (unknown [192.168.1.164]) by w4.tutanota.de (Postfix) with ESMTP id ADB97106015E for ; Fri, 12 Nov 2021 05:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1636696236; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=Fw5GbzbXn3iredLj8Ny7ds6wvPmx0/HQV8VUVprDS20=; b=VcU6HAjG/cFThFMSYcdP5ENGmTueklP4/Yd+Ia7gt4o9NcSp3AVAj1uzZL78KXSV +VnPcYC1iRyPVBHHQv1hdu3rDI7sNRHWPGO3oTLMKcz7GhsWIElaERK3QMIHYFo3RMe dg8bA+6Tj3NNY6P51cjYjZh5f3kXJeIigG+6326zvSN2mNViODqRo+B6sY75D8BW1Ue Z/CB0oGwYSdicRQHi2Cwz0s6+uJ/3btzRMCG2YapgNM6WddWlyQt47tj1kYDyljL8gd bXxcWQc0nkxDDVheYxiBiiBBZKZS2USwtXik1t6f0CE+rsU7fBQ9Fjcm2nivXfL/UNs 4h8O00X+sQ== Date: Fri, 12 Nov 2021 06:50:36 +0100 (CET) From: Lynne To: Ffmpeg Devel Message-ID: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] configure: autodetect uuid and use it for dshow and vulkan 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" X-TUID: fUxfTVpZyLhp The UUID library is even more ubiquitous than iconv, and it hasn't changed its API and ABI for maybe 20 years. MediaFoundation and dshow already depends on it silently, and vulkan can optionally use it to parse user-given UUIDs, which I think would be a popular way to specify devices on servers. Patch attached. Subject: [PATCH] configure: autodetect uuid and use it for dshow and vulkan The UUID library is even more ubiquitous than iconv, and it hasn't changed its API and ABI for maybe 20 years. dshow already depends on it silently, and vulkan can optionally use it to parse user-given UUIDs, which I think would be a popular way to specify devices on servers. --- configure | 13 ++++++++++--- doc/ffmpeg.texi | 6 ++++-- libavutil/hwcontext_vulkan.c | 10 +++++++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/configure b/configure index eb451d2782..11bdff1a40 100755 --- a/configure +++ b/configure @@ -321,6 +321,7 @@ External library support: --disable-sdl2 disable sdl2 [autodetect] --disable-securetransport disable Secure Transport, needed for TLS support on OSX if openssl and gnutls are not used [autodetect] + --disable-uuid disable uuid [autodetect] --enable-vapoursynth enable VapourSynth demuxer [no] --enable-vulkan enable Vulkan code [no] --disable-xlib disable xlib [autodetect] @@ -1747,6 +1748,7 @@ EXTERNAL_AUTODETECT_LIBRARY_LIST=" sdl2 securetransport sndio + uuid xlib zlib " @@ -2964,6 +2966,7 @@ vaapi_x11_deps="xlib_x11" videotoolbox_hwaccel_deps="videotoolbox pthreads" videotoolbox_hwaccel_extralibs="-framework QuartzCore" vulkan_deps_any="libdl LoadLibrary" +vulkan_suggest="uuid" xvmc_deps="X11_extensions_XvMClib_h" av1_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_AV1" @@ -3454,8 +3457,8 @@ decklink_indev_extralibs="-lstdc++" decklink_outdev_deps="decklink threads" decklink_outdev_suggest="libklvanc" decklink_outdev_extralibs="-lstdc++" -dshow_indev_deps="IBaseFilter" -dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi" +dshow_indev_deps="IBaseFilter uuid" +dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -loleaut32 -lshlwapi" fbdev_indev_deps="linux_fb_h" fbdev_outdev_deps="linux_fb_h" gdigrab_indev_deps="CreateDIBSection" @@ -3743,7 +3746,7 @@ avfilter_deps="avutil" avfilter_suggest="libm" avformat_deps="avcodec avutil" avformat_suggest="libm network zlib" -avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt" +avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx uuid opencl user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt" postproc_deps="avutil gpl" postproc_suggest="libm" swresample_deps="avutil" @@ -6826,6 +6829,10 @@ enabled vdpau && enabled vdpau && check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11 +enabled uuid && + check_pkg_config uuid uuid "uuid/uuid.h" uuid_parse || + check_lib uuid "uuid/uuid.h" uuid_parse -luuid + enabled crystalhd && check_lib crystalhd "stdint.h libcrystalhd/libcrystalhd_if.h" DtsCrystalHDVersion -lcrystalhd if enabled vulkan; then diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 62d9703b7a..ddee99b364 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1184,8 +1184,10 @@ extension. @item vulkan If @var{device} is an integer, it selects the device by its index in a -system-dependent list of devices. If @var{device} is any other string, it -selects the first device with a name containing that string as a substring. +system-dependent list of devices. If @var{device} is a UUID, the device +will be selected by checking for matching UUIDs. If @var{device} is any other +string, it selects the first device with a name containing that string as a +substring. The following options are recognized: @table @option diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 93a304ca95..29197a2100 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -38,6 +38,10 @@ #include #endif +#if CONFIG_UUID +#include +#endif + #if CONFIG_LIBDRM #include #include @@ -1367,7 +1371,11 @@ static int vulkan_device_create(AVHWDeviceContext *ctx, const char *device, dev_select.index = strtol(device, &end, 10); if (end == device) { dev_select.index = 0; - dev_select.name = device; +#if CONFIG_UUID + if (!uuid_parse(device, dev_select.uuid)) + dev_select.has_uuid = 1; +#endif + dev_select.name = device; } }