[vlc-commits] avcodec: remove vaapi_drm sub module
Thomas Guillem
git at videolan.org
Sun Feb 24 15:21:37 CET 2019
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Sun Feb 24 12:12:29 2019 +0100| [e1ce6d6378ebbbdaed699aeb370ead54b62d492e] | committer: Thomas Guillem
avcodec: remove vaapi_drm sub module
vaapi with DRM should be initialised from the decoder device now.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e1ce6d6378ebbbdaed699aeb370ead54b62d492e
---
modules/codec/Makefile.am | 9 ---
modules/codec/avcodec/vaapi.c | 134 ------------------------------------------
2 files changed, 143 deletions(-)
diff --git a/modules/codec/Makefile.am b/modules/codec/Makefile.am
index 760141d1f4..4cf2c0a7f4 100644
--- a/modules/codec/Makefile.am
+++ b/modules/codec/Makefile.am
@@ -406,21 +406,12 @@ endif
### avcodec hardware acceleration ###
-libvaapi_drm_plugin_la_SOURCES = \
- codec/avcodec/vaapi.c hw/vaapi/vlc_vaapi.c hw/vaapi/vlc_vaapi.h
-libvaapi_drm_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -DVLC_VA_BACKEND_DRM
-libvaapi_drm_plugin_la_CFLAGS = $(AM_CFLAGS) \
- $(LIBVA_DRM_CFLAGS) $(AVCODEC_CFLAGS)
-libvaapi_drm_plugin_la_LIBADD = $(LIBVA_DRM_LIBS)
libvaapi_plugin_la_SOURCES = \
codec/avcodec/vaapi.c hw/vaapi/vlc_vaapi.c hw/vaapi/vlc_vaapi.h
libvaapi_plugin_la_CPPFLAGS = $(AM_CPPFLAGS)
libvaapi_plugin_la_CFLAGS = $(AM_CFLAGS) $(AVCODEC_CFLAGS)
libvaapi_plugin_la_LIBADD = $(LIBVA_LIBS)
if HAVE_AVCODEC_VAAPI
-if HAVE_VAAPI_DRM
-codec_LTLIBRARIES += libvaapi_drm_plugin.la
-endif
codec_LTLIBRARIES += libvaapi_plugin.la
endif
diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index 0121910b97..8bc9609439 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -52,10 +52,6 @@ struct vlc_va_sys_t
{
struct vlc_vaapi_instance *va_inst;
struct vaapi_context hw_ctx;
-
-#ifdef VLC_VA_BACKEND_DRM
- picture_pool_t *pool;
-#endif
};
static int GetVaProfile(AVCodecContext *ctx, const es_format_t *fmt,
@@ -126,8 +122,6 @@ static int GetVaProfile(AVCodecContext *ctx, const es_format_t *fmt,
return VLC_SUCCESS;
}
-#ifndef VLC_VA_BACKEND_DRM
-
static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
{
(void) va;
@@ -228,139 +222,11 @@ error:
return ret;
}
-#else /* DRM */
-
-static int GetDRM(vlc_va_t *va, picture_t *pic, uint8_t **data)
-{
- vlc_va_sys_t *sys = va->sys;
-
- picture_t *vapic = picture_pool_Wait(sys->pool);
- if (vapic == NULL)
- return VLC_EGENERIC;
- vlc_vaapi_PicAttachContext(vapic);
-
- pic->context = vapic->context->copy(vapic->context);
- picture_Release(vapic);
- if (pic->context == NULL)
- return VLC_EGENERIC;
-
- *data = (void *)(uintptr_t)vlc_vaapi_PicGetSurface(pic);
- return VLC_SUCCESS;
-}
-
-static void DeleteDRM(vlc_va_t *va, void **hwctx)
-{
- vlc_va_sys_t *sys = va->sys;
- vlc_object_t *o = VLC_OBJECT(va);
-
- (void) hwctx;
- picture_pool_Release(sys->pool);
- vlc_vaapi_DestroyContext(o, sys->hw_ctx.display, sys->hw_ctx.context_id);
- vlc_vaapi_DestroyConfig(o, sys->hw_ctx.display, sys->hw_ctx.config_id);
- vlc_vaapi_ReleaseInstance(sys->va_inst);
- free(sys);
-}
-
-static int CreateDRM(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
- const es_format_t *fmt, void *p_sys)
-{
- if (pix_fmt != AV_PIX_FMT_VAAPI_VLD || p_sys)
- return VLC_EGENERIC;
-
- (void) fmt;
- (void) p_sys;
- vlc_object_t *o = VLC_OBJECT(va);
-
- VAProfile i_profile;
- unsigned count;
- int i_vlc_chroma;
- if (GetVaProfile(ctx, fmt, &i_profile, &i_vlc_chroma, &count) != VLC_SUCCESS)
- return VLC_EGENERIC;
-
- vlc_va_sys_t *sys;
-
- sys = malloc(sizeof(vlc_va_sys_t));
- if (!sys)
- return VLC_ENOMEM;
- memset(sys, 0, sizeof (*sys));
-
- /* */
- sys->hw_ctx.display = NULL;
- sys->hw_ctx.config_id = VA_INVALID_ID;
- sys->hw_ctx.context_id = VA_INVALID_ID;
- sys->pool = NULL;
- sys->va_inst = NULL;
-
- /* Create a VA display */
- sys->va_inst = vlc_vaapi_InitializeInstanceDRM(o, vaGetDisplayDRM,
- &sys->hw_ctx.display, NULL);
- if (!sys->va_inst)
- goto error;
-
- sys->hw_ctx.config_id =
- vlc_vaapi_CreateConfigChecked(o, sys->hw_ctx.display, i_profile,
- VAEntrypointVLD, 0);
- if (sys->hw_ctx.config_id == VA_INVALID_ID)
- goto error;
-
- /* Create surfaces */
- assert(ctx->coded_width > 0 && ctx->coded_height > 0);
- video_format_t vfmt = {
- .i_chroma = i_vlc_chroma,
- .i_width = ctx->coded_width,
- .i_height = ctx->coded_height,
- .i_visible_width = ctx->coded_width,
- .i_visible_height = ctx->coded_height
- };
-
- VASurfaceID *surfaces;
- sys->pool = vlc_vaapi_PoolNew(o, sys->va_inst, sys->hw_ctx.display, count,
- &surfaces, &vfmt, false);
-
- if (!sys->pool)
- goto error;
-
- /* Create a context */
- sys->hw_ctx.context_id =
- vlc_vaapi_CreateContext(o, sys->hw_ctx.display, sys->hw_ctx.config_id,
- ctx->coded_width, ctx->coded_height,
- VA_PROGRESSIVE, surfaces, count);
- if (sys->hw_ctx.context_id == VA_INVALID_ID)
- goto error;
-
- msg_Info(va, "Using %s", vaQueryVendorString(sys->hw_ctx.display));
-
- ctx->hwaccel_context = &sys->hw_ctx;
- va->sys = sys;
- va->get = GetDRM;
- return VLC_SUCCESS;
-
-error:
- if (sys->hw_ctx.context_id != VA_INVALID_ID)
- vlc_vaapi_DestroyContext(o, sys->hw_ctx.display, sys->hw_ctx.context_id);
- if (sys->pool != NULL)
- picture_pool_Release(sys->pool);
- if (sys->hw_ctx.config_id != VA_INVALID_ID)
- vlc_vaapi_DestroyConfig(o, sys->hw_ctx.display, sys->hw_ctx.config_id);
- if (sys->va_inst != NULL)
- vlc_vaapi_ReleaseInstance(sys->va_inst);
- free(sys);
- return VLC_EGENERIC;
-}
-#endif
-
vlc_module_begin ()
-#ifdef VLC_VA_BACKEND_DRM
- set_description( N_("VA-API video decoder via DRM") )
- set_capability( "hw decoder", 0 )
- set_callbacks( CreateDRM, DeleteDRM )
- add_shortcut( "vaapi", "vaapi_drm" )
-#else
set_description( N_("VA-API video decoder") )
set_capability( "hw decoder", 100 )
set_callbacks( Create, Delete )
add_shortcut( "vaapi" )
-#endif
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_VCODEC )
vlc_module_end ()
More information about the vlc-commits
mailing list