* [FFmpeg-devel] [PATCH 1/3] lavu/hwcontext_vaapi: Add option to allow to specify vendor id when init hw device
@ 2024-07-26 1:05 fei.w.wang-at-intel.com
2024-07-26 1:05 ` [FFmpeg-devel] [PATCH 2/3] lavu/hwcontext_qsv: Use vendor id to create device fei.w.wang-at-intel.com
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: fei.w.wang-at-intel.com @ 2024-07-26 1:05 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: fei.w.wang
From: Fei Wang <fei.w.wang@intel.com>
Vendor id will help to select desired device in case of kernel driver is
unknow or unsupported, for vendor may support different kernel driver on
different platforms.
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
doc/ffmpeg.texi | 8 ++++++++
libavutil/hwcontext_vaapi.c | 29 +++++++++++++++++++++++++++++
libavutil/version.h | 2 +-
3 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 877edae3b3..842e92ad1a 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1458,6 +1458,11 @@ The following options are recognized:
When @var{device} is not specified, use this option to specify the name of the kernel
driver associated with the desired device. This option is available only when
the hardware acceleration method @emph{drm} and @emph{vaapi} are enabled.
+@item vendor_id
+When @var{device} and @var{kernel_driver} are not specified, use this option to specify
+the vendor id associated with the desired device. This option is available only when the
+hardware acceleration method @emph{drm} and @emph{vaapi} are enabled and @emph{kernel_driver}
+is not specified.
@end table
Examples:
@@ -1473,6 +1478,9 @@ Create a vaapi device on DirectX adapter 1.
@item -init_hw_device vaapi:,kernel_driver=i915
Create a vaapi device on a device associated with kernel driver @samp{i915}.
+
+@item -init_hw_device vaapi:,vendor_id=0x8086
+Create a vaapi device on a device associated with vendor id @samp{0x8086}.
@end table
@item vdpau
diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 4cb25dd032..014541752a 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -1748,7 +1748,9 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device,
#if CONFIG_LIBDRM
drmVersion *info;
const AVDictionaryEntry *kernel_driver;
+ const AVDictionaryEntry *vendor_id;
kernel_driver = av_dict_get(opts, "kernel_driver", NULL, 0);
+ vendor_id = av_dict_get(opts, "vendor_id", NULL, 0);
#endif
for (n = 0; n < max_devices; n++) {
snprintf(path, sizeof(path),
@@ -1803,6 +1805,33 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device,
close(priv->drm_fd);
priv->drm_fd = -1;
continue;
+ } else if (vendor_id) {
+ drmDevicePtr device;
+ char drm_vendor[8];
+ if (drmGetDevice(priv->drm_fd, &device)) {
+ av_log(ctx, AV_LOG_VERBOSE,
+ "Failed to get DRM device info for device %d.\n", n);
+ close(priv->drm_fd);
+ priv->drm_fd = -1;
+ continue;
+ }
+
+ snprintf(drm_vendor, sizeof(drm_vendor), "0x%x", device->deviceinfo.pci->vendor_id);
+ if (strcmp(vendor_id->value, drm_vendor)) {
+ av_log(ctx, AV_LOG_VERBOSE, "Ignoring device %d "
+ "with non-matching vendor id (%s).\n",
+ n, vendor_id->value);
+ drmFreeDevice(&device);
+ close(priv->drm_fd);
+ priv->drm_fd = -1;
+ continue;
+ }
+ av_log(ctx, AV_LOG_VERBOSE, "Trying to use "
+ "DRM render node for device %d, "
+ "with matching vendor id (%s).\n",
+ n, vendor_id->value);
+ drmFreeDevice(&device);
+ break;
}
drmFreeVersion(info);
#endif
diff --git a/libavutil/version.h b/libavutil/version.h
index 814892a4d5..852eeef1d6 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 59
-#define LIBAVUTIL_VERSION_MINOR 28
+#define LIBAVUTIL_VERSION_MINOR 29
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
--
2.34.1
_______________________________________________
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* [FFmpeg-devel] [PATCH 2/3] lavu/hwcontext_qsv: Use vendor id to create device
2024-07-26 1:05 [FFmpeg-devel] [PATCH 1/3] lavu/hwcontext_vaapi: Add option to allow to specify vendor id when init hw device fei.w.wang-at-intel.com
@ 2024-07-26 1:05 ` fei.w.wang-at-intel.com
2024-07-26 1:05 ` [FFmpeg-devel] [PATCH 3/3] lavc/qsv: " fei.w.wang-at-intel.com
2024-08-05 2:14 ` [FFmpeg-devel] [PATCH 1/3] lavu/hwcontext_vaapi: Add option to allow to specify vendor id when init hw device Xiang, Haihao
2 siblings, 0 replies; 5+ messages in thread
From: fei.w.wang-at-intel.com @ 2024-07-26 1:05 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: fei.w.wang
From: Fei Wang <fei.w.wang@intel.com>
New kernel driver "xe" will be supported from Lunar Lake instead of
"i915".
"xe" kernel driver:
https://github.com/torvalds/linux/tree/master/drivers/gpu/drm/xe
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
libavutil/hwcontext_qsv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index 7cec347478..af0a3e1051 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -2569,8 +2569,8 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device,
// used on recent Intel hardware. Set options to the VAAPI device
// creation so that we should pick a usable setup by default if
// possible, even when multiple devices and drivers are available.
- av_dict_set(&child_device_opts, "kernel_driver", "i915", 0);
- av_dict_set(&child_device_opts, "driver", "iHD", 0);
+ av_dict_set(&child_device_opts, "vendor_id", "0x8086", 0);
+ av_dict_set(&child_device_opts, "driver", "iHD", 0);
}
break;
#endif
--
2.34.1
_______________________________________________
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* [FFmpeg-devel] [PATCH 3/3] lavc/qsv: Use vendor id to create device
2024-07-26 1:05 [FFmpeg-devel] [PATCH 1/3] lavu/hwcontext_vaapi: Add option to allow to specify vendor id when init hw device fei.w.wang-at-intel.com
2024-07-26 1:05 ` [FFmpeg-devel] [PATCH 2/3] lavu/hwcontext_qsv: Use vendor id to create device fei.w.wang-at-intel.com
@ 2024-07-26 1:05 ` fei.w.wang-at-intel.com
2024-08-05 2:14 ` [FFmpeg-devel] [PATCH 1/3] lavu/hwcontext_vaapi: Add option to allow to specify vendor id when init hw device Xiang, Haihao
2 siblings, 0 replies; 5+ messages in thread
From: fei.w.wang-at-intel.com @ 2024-07-26 1:05 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: fei.w.wang
From: Fei Wang <fei.w.wang@intel.com>
New kernel driver "xe" will be supported from Lunar Lake instead of
"i915".
"xe" kernel driver:
https://github.com/torvalds/linux/tree/master/drivers/gpu/drm/xe
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
libavcodec/qsv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 0c6fbd0dc0..acf0991757 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -464,8 +464,8 @@ static int ff_qsv_set_display_handle(AVCodecContext *avctx, QSVSession *qs)
AVVAAPIDeviceContext *hwctx;
int ret;
- av_dict_set(&child_device_opts, "kernel_driver", "i915", 0);
- av_dict_set(&child_device_opts, "driver", "iHD", 0);
+ av_dict_set(&child_device_opts, "vendor_id", "0x8086", 0);
+ av_dict_set(&child_device_opts, "driver", "iHD", 0);
ret = av_hwdevice_ctx_create(&qs->va_device_ref, AV_HWDEVICE_TYPE_VAAPI, NULL, child_device_opts, 0);
av_dict_free(&child_device_opts);
--
2.34.1
_______________________________________________
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/3] lavu/hwcontext_vaapi: Add option to allow to specify vendor id when init hw device
2024-07-26 1:05 [FFmpeg-devel] [PATCH 1/3] lavu/hwcontext_vaapi: Add option to allow to specify vendor id when init hw device fei.w.wang-at-intel.com
2024-07-26 1:05 ` [FFmpeg-devel] [PATCH 2/3] lavu/hwcontext_qsv: Use vendor id to create device fei.w.wang-at-intel.com
2024-07-26 1:05 ` [FFmpeg-devel] [PATCH 3/3] lavc/qsv: " fei.w.wang-at-intel.com
@ 2024-08-05 2:14 ` Xiang, Haihao
2024-08-09 7:31 ` Xiang, Haihao
2 siblings, 1 reply; 5+ messages in thread
From: Xiang, Haihao @ 2024-08-05 2:14 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Wang, Fei W
On Vr, 2024-07-26 at 09:05 +0800, fei.w.wang-at-intel.com@ffmpeg.org wrote:
> From: Fei Wang <fei.w.wang@intel.com>
>
> Vendor id will help to select desired device in case of kernel driver is
> unknow or unsupported, for vendor may support different kernel driver on
> different platforms.
>
> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> ---
> doc/ffmpeg.texi | 8 ++++++++
> libavutil/hwcontext_vaapi.c | 29 +++++++++++++++++++++++++++++
> libavutil/version.h | 2 +-
> 3 files changed, 38 insertions(+), 1 deletion(-)
>
> diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
> index 877edae3b3..842e92ad1a 100644
> --- a/doc/ffmpeg.texi
> +++ b/doc/ffmpeg.texi
> @@ -1458,6 +1458,11 @@ The following options are recognized:
> When @var{device} is not specified, use this option to specify the name of
> the kernel
> driver associated with the desired device. This option is available only when
> the hardware acceleration method @emph{drm} and @emph{vaapi} are enabled.
> +@item vendor_id
> +When @var{device} and @var{kernel_driver} are not specified, use this option
> to specify
> +the vendor id associated with the desired device. This option is available
> only when the
> +hardware acceleration method @emph{drm} and @emph{vaapi} are enabled and
> @emph{kernel_driver}
> +is not specified.
> @end table
>
> Examples:
> @@ -1473,6 +1478,9 @@ Create a vaapi device on DirectX adapter 1.
>
> @item -init_hw_device vaapi:,kernel_driver=i915
> Create a vaapi device on a device associated with kernel driver @samp{i915}.
> +
> +@item -init_hw_device vaapi:,vendor_id=0x8086
> +Create a vaapi device on a device associated with vendor id @samp{0x8086}.
> @end table
>
> @item vdpau
> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> index 4cb25dd032..014541752a 100644
> --- a/libavutil/hwcontext_vaapi.c
> +++ b/libavutil/hwcontext_vaapi.c
> @@ -1748,7 +1748,9 @@ static int vaapi_device_create(AVHWDeviceContext *ctx,
> const char *device,
> #if CONFIG_LIBDRM
> drmVersion *info;
> const AVDictionaryEntry *kernel_driver;
> + const AVDictionaryEntry *vendor_id;
> kernel_driver = av_dict_get(opts, "kernel_driver", NULL, 0);
> + vendor_id = av_dict_get(opts, "vendor_id", NULL, 0);
> #endif
> for (n = 0; n < max_devices; n++) {
> snprintf(path, sizeof(path),
> @@ -1803,6 +1805,33 @@ static int vaapi_device_create(AVHWDeviceContext *ctx,
> const char *device,
> close(priv->drm_fd);
> priv->drm_fd = -1;
> continue;
> + } else if (vendor_id) {
> + drmDevicePtr device;
> + char drm_vendor[8];
> + if (drmGetDevice(priv->drm_fd, &device)) {
> + av_log(ctx, AV_LOG_VERBOSE,
> + "Failed to get DRM device info for device
> %d.\n", n);
> + close(priv->drm_fd);
> + priv->drm_fd = -1;
> + continue;
> + }
> +
> + snprintf(drm_vendor, sizeof(drm_vendor), "0x%x", device-
> >deviceinfo.pci->vendor_id);
> + if (strcmp(vendor_id->value, drm_vendor)) {
> + av_log(ctx, AV_LOG_VERBOSE, "Ignoring device %d "
> + "with non-matching vendor id (%s).\n",
> + n, vendor_id->value);
> + drmFreeDevice(&device);
> + close(priv->drm_fd);
> + priv->drm_fd = -1;
> + continue;
> + }
> + av_log(ctx, AV_LOG_VERBOSE, "Trying to use "
> + "DRM render node for device %d, "
> + "with matching vendor id (%s).\n",
> + n, vendor_id->value);
> + drmFreeDevice(&device);
> + break;
> }
> drmFreeVersion(info);
> #endif
> diff --git a/libavutil/version.h b/libavutil/version.h
> index 814892a4d5..852eeef1d6 100644
> --- a/libavutil/version.h
> +++ b/libavutil/version.h
> @@ -79,7 +79,7 @@
> */
>
> #define LIBAVUTIL_VERSION_MAJOR 59
> -#define LIBAVUTIL_VERSION_MINOR 28
> +#define LIBAVUTIL_VERSION_MINOR 29
> #define LIBAVUTIL_VERSION_MICRO 100
>
> #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
Patchset LGTM, I will apply these patches if there are no objections.
Thanks
Haihao
_______________________________________________
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/3] lavu/hwcontext_vaapi: Add option to allow to specify vendor id when init hw device
2024-08-05 2:14 ` [FFmpeg-devel] [PATCH 1/3] lavu/hwcontext_vaapi: Add option to allow to specify vendor id when init hw device Xiang, Haihao
@ 2024-08-09 7:31 ` Xiang, Haihao
0 siblings, 0 replies; 5+ messages in thread
From: Xiang, Haihao @ 2024-08-09 7:31 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Wang, Fei W
On Ma, 2024-08-05 at 02:14 +0000, Xiang, Haihao wrote:
> On Vr, 2024-07-26 at 09:05 +0800, fei.w.wang-at-intel.com@ffmpeg.org wrote:
> > From: Fei Wang <fei.w.wang@intel.com>
> >
> > Vendor id will help to select desired device in case of kernel driver is
> > unknow or unsupported, for vendor may support different kernel driver on
> > different platforms.
> >
> > Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> > ---
> > doc/ffmpeg.texi | 8 ++++++++
> > libavutil/hwcontext_vaapi.c | 29 +++++++++++++++++++++++++++++
> > libavutil/version.h | 2 +-
> > 3 files changed, 38 insertions(+), 1 deletion(-)
> >
> > diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
> > index 877edae3b3..842e92ad1a 100644
> > --- a/doc/ffmpeg.texi
> > +++ b/doc/ffmpeg.texi
> > @@ -1458,6 +1458,11 @@ The following options are recognized:
> > When @var{device} is not specified, use this option to specify the name of
> > the kernel
> > driver associated with the desired device. This option is available only
> > when
> > the hardware acceleration method @emph{drm} and @emph{vaapi} are enabled.
> > +@item vendor_id
> > +When @var{device} and @var{kernel_driver} are not specified, use this
> > option
> > to specify
> > +the vendor id associated with the desired device. This option is available
> > only when the
> > +hardware acceleration method @emph{drm} and @emph{vaapi} are enabled and
> > @emph{kernel_driver}
> > +is not specified.
> > @end table
> >
> > Examples:
> > @@ -1473,6 +1478,9 @@ Create a vaapi device on DirectX adapter 1.
> >
> > @item -init_hw_device vaapi:,kernel_driver=i915
> > Create a vaapi device on a device associated with kernel driver
> > @samp{i915}.
> > +
> > +@item -init_hw_device vaapi:,vendor_id=0x8086
> > +Create a vaapi device on a device associated with vendor id @samp{0x8086}.
> > @end table
> >
> > @item vdpau
> > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> > index 4cb25dd032..014541752a 100644
> > --- a/libavutil/hwcontext_vaapi.c
> > +++ b/libavutil/hwcontext_vaapi.c
> > @@ -1748,7 +1748,9 @@ static int vaapi_device_create(AVHWDeviceContext *ctx,
> > const char *device,
> > #if CONFIG_LIBDRM
> > drmVersion *info;
> > const AVDictionaryEntry *kernel_driver;
> > + const AVDictionaryEntry *vendor_id;
> > kernel_driver = av_dict_get(opts, "kernel_driver", NULL, 0);
> > + vendor_id = av_dict_get(opts, "vendor_id", NULL, 0);
> > #endif
> > for (n = 0; n < max_devices; n++) {
> > snprintf(path, sizeof(path),
> > @@ -1803,6 +1805,33 @@ static int vaapi_device_create(AVHWDeviceContext
> > *ctx,
> > const char *device,
> > close(priv->drm_fd);
> > priv->drm_fd = -1;
> > continue;
> > + } else if (vendor_id) {
> > + drmDevicePtr device;
> > + char drm_vendor[8];
> > + if (drmGetDevice(priv->drm_fd, &device)) {
> > + av_log(ctx, AV_LOG_VERBOSE,
> > + "Failed to get DRM device info for device
> > %d.\n", n);
> > + close(priv->drm_fd);
> > + priv->drm_fd = -1;
> > + continue;
> > + }
> > +
> > + snprintf(drm_vendor, sizeof(drm_vendor), "0x%x",
> > device-
> > > deviceinfo.pci->vendor_id);
> > + if (strcmp(vendor_id->value, drm_vendor)) {
> > + av_log(ctx, AV_LOG_VERBOSE, "Ignoring device %d "
> > + "with non-matching vendor id (%s).\n",
> > + n, vendor_id->value);
> > + drmFreeDevice(&device);
> > + close(priv->drm_fd);
> > + priv->drm_fd = -1;
> > + continue;
> > + }
> > + av_log(ctx, AV_LOG_VERBOSE, "Trying to use "
> > + "DRM render node for device %d, "
> > + "with matching vendor id (%s).\n",
> > + n, vendor_id->value);
> > + drmFreeDevice(&device);
> > + break;
> > }
> > drmFreeVersion(info);
> > #endif
> > diff --git a/libavutil/version.h b/libavutil/version.h
> > index 814892a4d5..852eeef1d6 100644
> > --- a/libavutil/version.h
> > +++ b/libavutil/version.h
> > @@ -79,7 +79,7 @@
> > */
> >
> > #define LIBAVUTIL_VERSION_MAJOR 59
> > -#define LIBAVUTIL_VERSION_MINOR 28
> > +#define LIBAVUTIL_VERSION_MINOR 29
> > #define LIBAVUTIL_VERSION_MICRO 100
> >
> > #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
>
> Patchset LGTM, I will apply these patches if there are no objections.
>
Applied, thx
-Haihao
_______________________________________________
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-08-09 7:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-26 1:05 [FFmpeg-devel] [PATCH 1/3] lavu/hwcontext_vaapi: Add option to allow to specify vendor id when init hw device fei.w.wang-at-intel.com
2024-07-26 1:05 ` [FFmpeg-devel] [PATCH 2/3] lavu/hwcontext_qsv: Use vendor id to create device fei.w.wang-at-intel.com
2024-07-26 1:05 ` [FFmpeg-devel] [PATCH 3/3] lavc/qsv: " fei.w.wang-at-intel.com
2024-08-05 2:14 ` [FFmpeg-devel] [PATCH 1/3] lavu/hwcontext_vaapi: Add option to allow to specify vendor id when init hw device Xiang, Haihao
2024-08-09 7:31 ` Xiang, Haihao
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git