st/gbm: retrieve the driver-name via dd_driver_name()
authorEmil Velikov <emil.l.velikov@gmail.com>
Wed, 23 Jul 2014 17:10:08 +0000 (18:10 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Wed, 30 Jul 2014 15:33:09 +0000 (16:33 +0100)
... on static targets. Otherwise we'll crash badly as gdrm->dev is
NULL when we try to copy the string driver_name.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
src/gallium/state_trackers/gbm/gbm_drm.c

index bfd48a001bdf4bed71815b3ef27991cee59d3b9b..077d51806c5cea16a39242b2a41cba0f33d86b6c 100644 (file)
@@ -282,7 +282,13 @@ gbm_gallium_drm_device_create(int fd)
    if (gdrm->screen == NULL)
       goto out_no_screen;
 
+#if GALLIUM_STATIC_TARGETS
+   gdrm->base.driver_name = strdup(dd_driver_name());
+#else
+#ifdef HAVE_PIPE_LOADER_DRM
    gdrm->base.driver_name = strdup(gdrm->dev->driver_name);
+#endif /* HAVE_PIPE_LOADER_DRM */
+#endif
    return &gdrm->base.base;
 
 out_no_screen: