From 68a29d0e53dc6a8857c7dd3265d058da33b4b566 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Sun, 1 Dec 2019 12:46:10 +0800 Subject: [PATCH] check whether the driver is initialized --- src/newgal/drm/drmvideo.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/newgal/drm/drmvideo.c b/src/newgal/drm/drmvideo.c index 9f2e67f2..230679b5 100644 --- a/src/newgal/drm/drmvideo.c +++ b/src/newgal/drm/drmvideo.c @@ -1750,6 +1750,11 @@ GAL_Surface* __drm_create_surface_from_name (GHANDLE video, return NULL; } + if (vdata->driver_ops == NULL) { + _ERR_PRINTF ("NEWGAL>DRM: not hardware accelerated!\n"); + return NULL; + } + if (vdata->driver_ops->create_buffer_from_name == NULL) { _ERR_PRINTF ("NEWGAL>DRM: not implemented method: create_buffer_from_name!\n"); return NULL; @@ -1845,6 +1850,11 @@ GAL_Surface* __drm_create_surface_from_handle (GHANDLE video, return NULL; } + if (vdata->driver_ops == NULL) { + _ERR_PRINTF ("NEWGAL>DRM: not hardware accelerated!\n"); + return NULL; + } + if (vdata->driver_ops->create_buffer_from_handle == NULL) { _ERR_PRINTF ("NEWGAL>DRM: not implemented method: create_buffer_from_handle!\n"); return NULL; @@ -1940,6 +1950,11 @@ GAL_Surface* __drm_create_surface_from_prime_fd (GHANDLE video, return NULL; } + if (vdata->driver_ops == NULL) { + _ERR_PRINTF ("NEWGAL>DRM: not hardware accelerated!\n"); + return NULL; + } + if (vdata->driver_ops->create_buffer_from_prime_fd == NULL) { _ERR_PRINTF ("NEWGAL>DRM: not implemented method: create_buffer_from_prime_fd.\n"); return NULL;