From ea503ed08538f654049748630e7e3855d842c9f8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Wed, 4 Oct 2017 13:51:23 +0200 Subject: [PATCH] libs: surface: egl: error message if no extension Instead of silently fail to export the image if there is not available the EGL_MESA_drm_image, log an error message. Also a code refactoring was done. https://bugzilla.gnome.org/show_bug.cgi?id=773453 --- gst-libs/gst/vaapi/gstvaapisurface_egl.c | 34 ++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapisurface_egl.c b/gst-libs/gst/vaapi/gstvaapisurface_egl.c index 8c13851..8bc42e5 100644 --- a/gst-libs/gst/vaapi/gstvaapisurface_egl.c +++ b/gst-libs/gst/vaapi/gstvaapisurface_egl.c @@ -55,22 +55,30 @@ do_create_surface_with_egl_image_unlocked (GstVaapiDisplayEGL * display, memset (offset, 0, sizeof (offset)); memset (stride, 0, sizeof (stride)); - if (vtable->has_EGL_MESA_drm_image) { - /* EGL_MESA_drm_image extension */ - if (!vtable->eglExportDRMImageMESA (ctx->display->base.handle.p, image, - &name, NULL, &stride[0])) - goto error_export_image_gem_buf; - - size = height * stride[0]; - return gst_vaapi_surface_new_with_gem_buf_handle (base_display, name, size, - format, width, height, offset, stride); - } - return NULL; + if (!vtable->has_EGL_MESA_drm_image) + goto error_mission_extension; + + /* EGL_MESA_drm_image extension */ + if (!vtable->eglExportDRMImageMESA (ctx->display->base.handle.p, image, + &name, NULL, &stride[0])) + goto error_export_image_gem_buf; + + size = height * stride[0]; + return gst_vaapi_surface_new_with_gem_buf_handle (base_display, name, size, + format, width, height, offset, stride); /* ERRORS */ error_export_image_gem_buf: - GST_ERROR ("failed to export EGL image to GEM buffer"); - return NULL; + { + GST_ERROR ("failed to export EGL image to GEM buffer"); + return NULL; + } + +error_mission_extension: + { + GST_ERROR ("missing EGL_MESA_drm_image extension"); + return NULL; + } } static void -- 2.7.4