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 D560C40DDE for ; Fri, 11 Mar 2022 08:35:32 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3785C68B26E; Fri, 11 Mar 2022 10:35:30 +0200 (EET) Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com [209.85.128.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 061E568B1DF for ; Fri, 11 Mar 2022 10:35:23 +0200 (EET) Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-2dc242a79beso85045507b3.8 for ; Fri, 11 Mar 2022 00:35:23 -0800 (PST) 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; bh=I7vbTBZvrJ/syLnvaUaSOPmi5/gS1ZXiCBtfQghPQ/c=; b=nYCe3C5N6H3mxdfBrcqsWjt7jvfcC9vY6UXkgFNjd0TrE14Gm4fz71Bgkr8s9/M9ci a1m3ikZsuYSVtNN2zkr/Mh3z1qaRIyqYFOlyoMkNRg4pzpAxxFLzE1EYjPOWTZRw2o6B yzSPVA6y8FqghbYcG5GUEInWM9ZbIaTFcS2RaQTZeIM1IvoO1lhnYjTFRyAofVPK0KZb gtTsgqjXaR1buq2wOYRjfyupvFKxGBktlObDT1ZdCSeUx7SV4cPpzUhg6IWutuKZue5H 0ohiFrduwHr1gOYyhI93E4QWiC8HA+TDpds0aGiAqUGJulR4F+AlUJwJR122cULtNmTS FjnQ== 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; bh=I7vbTBZvrJ/syLnvaUaSOPmi5/gS1ZXiCBtfQghPQ/c=; b=VCM3gFJ8KV9X4uvNhR4L4apRpWLiuXuRdOLPOTk+jfsZNuojbNU5VVaiZ/RsGYRt7K JFmlBWg/2HdHChcvlIsW7FpnOAGPeAcBXDXclhY9N79HYP6IzDWJ37t8ymmLd9Y/weEi LYo2wE0UyX5wOKKwysB5OhsV7eLbVKa5P0tYCWXjbvIGOYsQTZD6EgbSfwJr73rbtqNv t9mS1Y6x6+WltzQePX2SQZzUhZqXBbM3qRmnzmx5wVUwxtKVqMUgkLJg978QhXB/Ex7+ FFiS6mVzj3hiXCdvIzgVDXgsq4+og2SrG/U8DFganIN0KuE3qsUtaWbTyTkUjAwWj619 vuiA== X-Gm-Message-State: AOAM531sCoKWIEFgCFC7vqLFp0bjrdBp1ANcqG6WslD2r7lkGAIZh74W Fwc1K/IlNk6yVQ/u4ZJnd7dnsJ9DSoNswQ8+beucrl5TI10= X-Google-Smtp-Source: ABdhPJwYzNR5NpDXc6h4bo3/d4nFx8EEWJp7DqoaKkYz4F6K0qpha58UIz3jc07Wz/fZ2i5+xMdBowt5R35jjCQV1sg= X-Received: by 2002:a81:851:0:b0:2dc:e987:7acb with SMTP id 78-20020a810851000000b002dce9877acbmr7303805ywi.439.1646987722195; Fri, 11 Mar 2022 00:35:22 -0800 (PST) MIME-Version: 1.0 References: <20220311081630.21927-1-haihao.xiang@intel.com> <20220311081630.21927-10-haihao.xiang@intel.com> In-Reply-To: <20220311081630.21927-10-haihao.xiang@intel.com> From: Hendrik Leppkes Date: Fri, 11 Mar 2022 09:35:10 +0100 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH v7 09/10] qsv: use a new method to create mfx session when using oneVPL 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 Fri, Mar 11, 2022 at 9:18 AM Xiang, Haihao wrote: > diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c > index 8ab96bad25..e0e820f164 100644 > --- a/libavutil/hwcontext_d3d11va.c > +++ b/libavutil/hwcontext_d3d11va.c > @@ -525,6 +525,13 @@ static void d3d11va_device_uninit(AVHWDeviceContext *hwdev) > } > } > > +static void d3d11va_device_free(AVHWDeviceContext *ctx) > +{ > + AVD3D11VADeviceContext *hwctx = ctx->hwctx; > + > + av_free(hwctx->device_name); > +} > + > static int d3d11va_device_create(AVHWDeviceContext *ctx, const char *device, > AVDictionary *opts, int flags) > { > @@ -537,6 +544,8 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, const char *device, > int is_debug = !!av_dict_get(opts, "debug", NULL, 0); > int ret; > > + ctx->free = d3d11va_device_free; > + > // (On UWP we can't check this.) > #if !HAVE_UWP > if (!LoadLibrary("d3d11_1sdklayers.dll")) > @@ -561,6 +570,10 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, const char *device, > if (FAILED(IDXGIFactory2_EnumAdapters(pDXGIFactory, adapter, &pAdapter))) > pAdapter = NULL; > IDXGIFactory2_Release(pDXGIFactory); > + > + device_hwctx->device_name = av_strdup(device); > + if (!device_hwctx->device_name) > + return AVERROR(ENOMEM); > } > } > > diff --git a/libavutil/hwcontext_d3d11va.h b/libavutil/hwcontext_d3d11va.h > index 77d2d72f1b..41a315b9e6 100644 > --- a/libavutil/hwcontext_d3d11va.h > +++ b/libavutil/hwcontext_d3d11va.h > @@ -94,6 +94,11 @@ typedef struct AVD3D11VADeviceContext { > void (*lock)(void *lock_ctx); > void (*unlock)(void *lock_ctx); > void *lock_ctx; > + > + /** > + * The string for the used adapter > + */ > + char *device_name; > } AVD3D11VADeviceContext; > > /** > diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c > index 53d00fa815..6967357093 100644 > --- a/libavutil/hwcontext_dxva2.c > +++ b/libavutil/hwcontext_dxva2.c > @@ -431,6 +431,7 @@ static void dxva2_device_free(AVHWDeviceContext *ctx) > dlclose(priv->dxva2lib); > > av_freep(&ctx->user_opaque); > + av_free(hwctx->device_name); > } > > static int dxva2_device_create9(AVHWDeviceContext *ctx, UINT adapter) > @@ -571,6 +572,13 @@ static int dxva2_device_create(AVHWDeviceContext *ctx, const char *device, > return AVERROR_UNKNOWN; > } > > + if (device) { > + hwctx->device_name = av_strdup(device); > + > + if (!hwctx->device_name) > + return AVERROR(ENOMEM); > + } > + > return 0; > } > > diff --git a/libavutil/hwcontext_dxva2.h b/libavutil/hwcontext_dxva2.h > index e1b79bc0de..253ddbed51 100644 > --- a/libavutil/hwcontext_dxva2.h > +++ b/libavutil/hwcontext_dxva2.h > @@ -38,6 +38,10 @@ > */ > typedef struct AVDXVA2DeviceContext { > IDirect3DDeviceManager9 *devmgr; > + /** > + * The string for the used adapter > + */ > + char *device_name; > } AVDXVA2DeviceContext; > > /** Why are these device names required? I would think deriving a child device would use the actual device, eg. ID3D11Device or IDirect3DDeviceManager9 (and whatever for VAAPI), and not some string (that may or may not even be set). It feels quite a bit icky to store these in the context just for qsv to do... what with? - Hendrik _______________________________________________ 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".