gbm: move gbm_drm_device::driver_name to gbm_dri_device
authorEmil Velikov <emil.velikov@collabora.com>
Tue, 9 May 2017 17:41:50 +0000 (18:41 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Mon, 29 May 2017 15:49:44 +0000 (16:49 +0100)
The former already keeps track of the DRI module opened, based on the
driver_name provided. So let's keep them together.

As a nice bonus this Will allows us to remove the gbm_drm_device all
together with next patch.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Rob Herring <robh@kernel.org>
src/egl/drivers/dri2/platform_drm.c
src/gbm/backends/dri/gbm_dri.c
src/gbm/backends/dri/gbm_driint.h
src/gbm/main/common_drm.h

index d5dae4a14ada877b8cc3594eaab2ae3c02883ac8..9cee91bbfcf6ad372e3cb071e8ea63ef19fb6430 100644 (file)
@@ -715,7 +715,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
    }
 
    dri2_dpy->fd = fd;
-   dri2_dpy->driver_name = strdup(dri2_dpy->gbm_dri->base.driver_name);
+   dri2_dpy->driver_name = strdup(dri2_dpy->gbm_dri->driver_name);
 
    dri2_dpy->dri_screen = dri2_dpy->gbm_dri->screen;
    dri2_dpy->core = dri2_dpy->gbm_dri->core;
index 9f3fe19417057481225f353b7eec328f207641d6..ceed0c10ca6b1cff65e26299e6b48aeaa359e2cd 100644 (file)
@@ -344,12 +344,12 @@ dri_open_driver(struct gbm_dri_device *dri)
       len = next - p;
 #if GLX_USE_TLS
       snprintf(path, sizeof path,
-               "%.*s/tls/%s_dri.so", len, p, dri->base.driver_name);
+               "%.*s/tls/%s_dri.so", len, p, dri->driver_name);
       dri->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
 #endif
       if (dri->driver == NULL) {
          snprintf(path, sizeof path,
-                  "%.*s/%s_dri.so", len, p, dri->base.driver_name);
+                  "%.*s/%s_dri.so", len, p, dri->driver_name);
          dri->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
       }
       /* not need continue to loop all paths once the driver is found */
@@ -373,7 +373,7 @@ dri_open_driver(struct gbm_dri_device *dri)
       return NULL;
    }
 
-   get_extensions_name = loader_get_extensions_name(dri->base.driver_name);
+   get_extensions_name = loader_get_extensions_name(dri->driver_name);
    if (get_extensions_name) {
       const __DRIextension **(*get_extensions)(void);
 
@@ -440,13 +440,13 @@ dri_screen_create_dri2(struct gbm_dri_device *dri, char *driver_name)
    const __DRIextension **extensions;
    int ret = 0;
 
-   dri->base.driver_name = driver_name;
-   if (dri->base.driver_name == NULL)
+   dri->driver_name = driver_name;
+   if (dri->driver_name == NULL)
       return -1;
 
    ret = dri_load_driver(dri);
    if (ret) {
-      fprintf(stderr, "failed to load driver: %s\n", dri->base.driver_name);
+      fprintf(stderr, "failed to load driver: %s\n", dri->driver_name);
       return ret;
    };
 
@@ -490,8 +490,8 @@ dri_screen_create_swrast(struct gbm_dri_device *dri)
 {
    int ret;
 
-   dri->base.driver_name = strdup("swrast");
-   if (dri->base.driver_name == NULL)
+   dri->driver_name = strdup("swrast");
+   if (dri->driver_name == NULL)
       return -1;
 
    ret = dri_load_driver_swrast(dri);
@@ -1336,7 +1336,7 @@ dri_destroy(struct gbm_device *gbm)
       free((__DRIconfig *) dri->driver_configs[i]);
    free(dri->driver_configs);
    dlclose(dri->driver);
-   free(dri->base.driver_name);
+   free(dri->driver_name);
 
    free(dri);
 }
index f060830c0c9baef9bfd593a0855f23af63680508..c4a4794e50d3153ae7e1c090de42c084010b500e 100644 (file)
@@ -46,6 +46,7 @@ struct gbm_dri_device {
    struct gbm_drm_device base;
 
    void *driver;
+   char *driver_name; /* Name of the DRI module, without the _dri suffix */
 
    __DRIscreen *screen;
    __DRIcontext *context;
index 69e51ef9926101230d14788615c7946fcaf935b5..1cc52ae93149ad40a551504e748a2e84b87bf112 100644 (file)
@@ -38,7 +38,6 @@ enum gbm_drm_driver_type {
 struct gbm_drm_device {
    struct gbm_device base;
    enum gbm_drm_driver_type type;
-   char *driver_name;
 };
 
 #endif