Re: [FFmpeg-devel] [PATCH 5/7] hwcontext_vaapi: Add option to set driver name
On 21/05/2019 06:18, Li, Zhong wrote: >> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf >> Of Mark Thompson >> Sent: Monday, May 6, 2019 10:49 PM >> To: ffmpeg-devel@ffmpeg.org >> Subject: [FFmpeg-devel] [PATCH 5/7] hwcontext_vaapi: Add option to set >> driver name >> >> For example: -init_hw_device vaapi:/dev/dri/renderD128,driver=foo >> >> This may be more convenient that using the environment variable, and >> allows loading different drivers for different devices in the same process. >> --- >> libavutil/hwcontext_vaapi.c | 19 +++ >> 1 file changed, 19 insertions(+) >> >> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index >> c151f8da93..35883d7855 100644 >> --- a/libavutil/hwcontext_vaapi.c >> +++ b/libavutil/hwcontext_vaapi.c >> @@ -1598,6 +1598,25 @@ static int >> vaapi_device_create(AVHWDeviceContext *ctx, const char *device, >> return AVERROR(EINVAL); >> } >> >> +ent = av_dict_get(opts, "driver", NULL, 0); >> +if (ent) { >> +#if VA_CHECK_VERSION(0, 38, 0) >> +VAStatus vas; >> +vas = vaSetDriverName(display, ent->value); >> +if (vas != VA_STATUS_SUCCESS) { >> +av_log(ctx, AV_LOG_ERROR, "Failed to set driver name to " >> + "%s: %d (%s).\n", ent->value, vas, vaErrorStr(vas)); >> +vaTerminate(display); >> +return AVERROR_EXTERNAL; >> +} >> +#else >> +av_log(ctx, AV_LOG_WARNING, "Driver name setting is not " >> + "supported with this VAAPI version.\n"); >> +vaTerminate(display); >> +return AVERROR(ENOSYS); > > Giving a warning message should be enough? Yes, that's fair. Changed to not fail in that case. On 07/05/2019 02:37, myp...@gmail.com wrote: > On Mon, May 6, 2019 at 10:55 PM Mark Thompson wrote: >>... > > LGTM, except for the need to update the document Doc patch sent. With that, this set applied. Thanks, - Mark ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 5/7] hwcontext_vaapi: Add option to set driver name
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf > Of Mark Thompson > Sent: Monday, May 6, 2019 10:49 PM > To: ffmpeg-devel@ffmpeg.org > Subject: [FFmpeg-devel] [PATCH 5/7] hwcontext_vaapi: Add option to set > driver name > > For example: -init_hw_device vaapi:/dev/dri/renderD128,driver=foo > > This may be more convenient that using the environment variable, and > allows loading different drivers for different devices in the same process. > --- > libavutil/hwcontext_vaapi.c | 19 +++ > 1 file changed, 19 insertions(+) > > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index > c151f8da93..35883d7855 100644 > --- a/libavutil/hwcontext_vaapi.c > +++ b/libavutil/hwcontext_vaapi.c > @@ -1598,6 +1598,25 @@ static int > vaapi_device_create(AVHWDeviceContext *ctx, const char *device, > return AVERROR(EINVAL); > } > > +ent = av_dict_get(opts, "driver", NULL, 0); > +if (ent) { > +#if VA_CHECK_VERSION(0, 38, 0) > +VAStatus vas; > +vas = vaSetDriverName(display, ent->value); > +if (vas != VA_STATUS_SUCCESS) { > +av_log(ctx, AV_LOG_ERROR, "Failed to set driver name to " > + "%s: %d (%s).\n", ent->value, vas, vaErrorStr(vas)); > +vaTerminate(display); > +return AVERROR_EXTERNAL; > +} > +#else > +av_log(ctx, AV_LOG_WARNING, "Driver name setting is not " > + "supported with this VAAPI version.\n"); > +vaTerminate(display); > +return AVERROR(ENOSYS); Giving a warning message should be enough? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 5/7] hwcontext_vaapi: Add option to set driver name
On Mon, May 6, 2019 at 10:55 PM Mark Thompson wrote: > > For example: -init_hw_device vaapi:/dev/dri/renderD128,driver=foo > > This may be more convenient that using the environment variable, and allows > loading different drivers for different devices in the same process. > --- > libavutil/hwcontext_vaapi.c | 19 +++ > 1 file changed, 19 insertions(+) > > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c > index c151f8da93..35883d7855 100644 > --- a/libavutil/hwcontext_vaapi.c > +++ b/libavutil/hwcontext_vaapi.c > @@ -1598,6 +1598,25 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, > const char *device, > return AVERROR(EINVAL); > } > > +ent = av_dict_get(opts, "driver", NULL, 0); > +if (ent) { > +#if VA_CHECK_VERSION(0, 38, 0) > +VAStatus vas; > +vas = vaSetDriverName(display, ent->value); > +if (vas != VA_STATUS_SUCCESS) { > +av_log(ctx, AV_LOG_ERROR, "Failed to set driver name to " > + "%s: %d (%s).\n", ent->value, vas, vaErrorStr(vas)); > +vaTerminate(display); > +return AVERROR_EXTERNAL; > +} > +#else > +av_log(ctx, AV_LOG_WARNING, "Driver name setting is not " > + "supported with this VAAPI version.\n"); > +vaTerminate(display); > +return AVERROR(ENOSYS); > +#endif > +} > + > return vaapi_device_connect(ctx, display); > } > LGTM, except for the need to update the document ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 5/7] hwcontext_vaapi: Add option to set driver name
For example: -init_hw_device vaapi:/dev/dri/renderD128,driver=foo This may be more convenient that using the environment variable, and allows loading different drivers for different devices in the same process. --- libavutil/hwcontext_vaapi.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index c151f8da93..35883d7855 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -1598,6 +1598,25 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device, return AVERROR(EINVAL); } +ent = av_dict_get(opts, "driver", NULL, 0); +if (ent) { +#if VA_CHECK_VERSION(0, 38, 0) +VAStatus vas; +vas = vaSetDriverName(display, ent->value); +if (vas != VA_STATUS_SUCCESS) { +av_log(ctx, AV_LOG_ERROR, "Failed to set driver name to " + "%s: %d (%s).\n", ent->value, vas, vaErrorStr(vas)); +vaTerminate(display); +return AVERROR_EXTERNAL; +} +#else +av_log(ctx, AV_LOG_WARNING, "Driver name setting is not " + "supported with this VAAPI version.\n"); +vaTerminate(display); +return AVERROR(ENOSYS); +#endif +} + return vaapi_device_connect(ctx, display); } -- 2.20.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-requ...@ffmpeg.org with subject "unsubscribe".