[PATCH 2/5] term change from drm to gbm in driver backend

Halley Zhao halley.zhao at intel.com
Mon Apr 23 01:37:53 PDT 2012


---
 src/egl/drivers/dri2/egl_dri2.c                    |   34 +++++-----
 src/egl/drivers/dri2/egl_dri2.h                    |    6 +-
 src/egl/drivers/dri2/platform_wayland.c            |   72
++++++++++----------
 .../egl/common/native_wayland_drm_bufmgr_helper.c  |   12 ++--
 .../egl/common/native_wayland_drm_bufmgr_helper.h  |   12 ++--
 src/gallium/state_trackers/egl/drm/native_drm.c    |   22 +++---
 src/gallium/state_trackers/egl/drm/native_drm.h    |    2 +-
 .../state_trackers/egl/wayland/native_drm.c        |   66
+++++++++---------
 src/gallium/state_trackers/egl/x11/native_dri2.c   |   24 +++---
 9 files changed, 125 insertions(+), 125 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c
b/src/egl/drivers/dri2/egl_dri2.c
index 4a02838..7bb32bd 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1078,10 +1078,10 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay
*disp, _EGLContext *ctx,
    _EGLImageAttribs attrs;
    EGLint format, name, stride, pitch, err;
 
-   if (!wayland_buffer_is_drm(buffer))
+   if (!wayland_buffer_is_gbm(buffer))
        return NULL;
 
-   dri_image = wayland_drm_buffer_get_buffer(buffer);
+   dri_image = wl_gbm_buffer_get_buffer(buffer);
    
    dri2_dpy->image->queryImage(dri_image, __DRI_IMAGE_ATTRIB_NAME,
&name);
    dri2_dpy->image->queryImage(dri_image, __DRI_IMAGE_ATTRIB_STRIDE,
&stride);
@@ -1093,11 +1093,11 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay
*disp, _EGLContext *ctx,
    attrs.Width = buffer->width;
    attrs.Height = buffer->height;
 
-   switch (wayland_drm_buffer_get_format(buffer)) {
-   case WL_DRM_FORMAT_ARGB8888:
+   switch (wl_gbm_buffer_get_format(buffer)) {
+   case WL_GBM_FORMAT_ARGB8888:
       format = __DRI_IMAGE_FORMAT_ARGB8888;
       break;
-   case WL_DRM_FORMAT_XRGB8888:
+   case WL_GBM_FORMAT_XRGB8888:
       format = __DRI_IMAGE_FORMAT_XRGB8888;
       break;
    default:
@@ -1272,10 +1272,10 @@ dri2_wl_reference_buffer(void *user_data,
uint32_t name,
    int dri_format;
 
    switch (format) {
-   case WL_DRM_FORMAT_ARGB8888:
+   case WL_GBM_FORMAT_ARGB8888:
       dri_format =__DRI_IMAGE_FORMAT_ARGB8888;
       break;
-   case WL_DRM_FORMAT_XRGB8888:
+   case WL_GBM_FORMAT_XRGB8888:
       dri_format = __DRI_IMAGE_FORMAT_XRGB8888;
       break;
    default:
@@ -1300,7 +1300,7 @@ dri2_wl_release_buffer(void *user_data, void
*buffer)
    dri2_dpy->image->destroyImage(image);
 }
 
-static struct wayland_drm_callbacks wl_drm_callbacks = {
+static struct wl_gbm_callbacks wl_gbm_callbacks = {
 	.authenticate = NULL,
 	.reference_buffer = dri2_wl_reference_buffer,
 	.release_buffer = dri2_wl_release_buffer
@@ -1314,17 +1314,17 @@ dri2_bind_wayland_display_wl(_EGLDriver *drv,
_EGLDisplay *disp,
 
    (void) drv;
 
-   if (dri2_dpy->wl_server_drm)
+   if (dri2_dpy->wl_server_gbm)
 	   return EGL_FALSE;
 
-   wl_drm_callbacks.authenticate =
+   wl_gbm_callbacks.authenticate =
       (int(*)(void *, uint32_t)) dri2_dpy->authenticate;
 
-   dri2_dpy->wl_server_drm =
-	   wayland_drm_init(wl_dpy, dri2_dpy->device_name,
-                            &wl_drm_callbacks, disp);
+   dri2_dpy->wl_server_gbm =
+	   wl_gbm_init(wl_dpy, dri2_dpy->device_name,
+                            &wl_gbm_callbacks, disp);
 
-   if (!dri2_dpy->wl_server_drm)
+   if (!dri2_dpy->wl_server_gbm)
 	   return EGL_FALSE;
 
    return EGL_TRUE;
@@ -1338,11 +1338,11 @@ dri2_unbind_wayland_display_wl(_EGLDriver *drv,
_EGLDisplay *disp,
 
    (void) drv;
 
-   if (!dri2_dpy->wl_server_drm)
+   if (!dri2_dpy->wl_server_gbm)
 	   return EGL_FALSE;
 
-   wayland_drm_uninit(dri2_dpy->wl_server_drm);
-   dri2_dpy->wl_server_drm = NULL;
+   wl_gbm_uninit(dri2_dpy->wl_server_gbm);
+   dri2_dpy->wl_server_gbm = NULL;
 
    return EGL_TRUE;
 }
diff --git a/src/egl/drivers/dri2/egl_dri2.h
b/src/egl/drivers/dri2/egl_dri2.h
index c30e230..ae80562 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -121,8 +121,8 @@ struct dri2_egl_display
 
 #ifdef HAVE_WAYLAND_PLATFORM
    struct wl_display        *wl_dpy;
-   struct wl_drm            *wl_server_drm;
-   struct wl_drm            *wl_drm;
+   struct wl_gbm            *wl_server_gbm;
+   struct wl_gbm            *wl_gbm;
    int			     authenticated;
    int			     formats;
 #endif
@@ -166,7 +166,7 @@ struct dri2_egl_surface
 #ifdef HAVE_WAYLAND_PLATFORM
    struct wl_egl_window  *wl_win;
    struct wl_egl_pixmap  *wl_pix;
-   struct wl_buffer      *wl_drm_buffer[WL_BUFFER_COUNT];
+   struct wl_buffer      *wl_gbm_buffer[WL_BUFFER_COUNT];
    int                    wl_buffer_lock[WL_BUFFER_COUNT];
    int                    dx;
    int                    dy;
diff --git a/src/egl/drivers/dri2/platform_wayland.c
b/src/egl/drivers/dri2/platform_wayland.c
index d291f0f..cbc48eb 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -40,7 +40,7 @@
 #include <wayland-client.h>
 #include "wayland-drm-client-protocol.h"
 
-enum wl_drm_format_flags {
+enum wl_gbm_format_flags {
    HAS_ARGB8888 = 1,
    HAS_XRGB8888 = 2
 };
@@ -52,7 +52,7 @@ wl_buffer_release(void *data, struct wl_buffer
*buffer)
    int i;
 
    for (i = 0; i < WL_BUFFER_COUNT; ++i)
-      if (dri2_surf->wl_drm_buffer[i] == buffer)
+      if (dri2_surf->wl_gbm_buffer[i] == buffer)
          break;
 
    assert(i <= WL_BUFFER_COUNT);
@@ -95,7 +95,7 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay
*disp, EGLint type,
       goto cleanup_surf;
 
    for (i = 0; i < WL_BUFFER_COUNT; ++i) {
-      dri2_surf->wl_drm_buffer[i] = NULL;
+      dri2_surf->wl_gbm_buffer[i] = NULL;
       dri2_surf->wl_buffer_lock[i] = 0;
    }
 
@@ -107,9 +107,9 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay
*disp, EGLint type,
    dri2_surf->block_swap_buffers = EGL_FALSE;
 
    if (conf->AlphaSize == 0)
-      dri2_surf->format = WL_DRM_FORMAT_XRGB8888;
+      dri2_surf->format = WL_GBM_FORMAT_XRGB8888;
    else
-      dri2_surf->format = WL_DRM_FORMAT_ARGB8888;
+      dri2_surf->format = WL_GBM_FORMAT_ARGB8888;
 
    switch (type) {
    case EGL_WINDOW_BIT:
@@ -193,8 +193,8 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay
*disp, _EGLSurface *surf)
    (*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable);
 
    for (i = 0; i < WL_BUFFER_COUNT; ++i)
-      if (dri2_surf->wl_drm_buffer[i])
-         wl_buffer_destroy(dri2_surf->wl_drm_buffer[i]);
+      if (dri2_surf->wl_gbm_buffer[i])
+         wl_buffer_destroy(dri2_surf->wl_gbm_buffer[i]);
 
    for (i = 0; i < __DRI_BUFFER_COUNT; ++i)
       if (dri2_surf->dri_buffers[i] && !(i == __DRI_BUFFER_FRONT_LEFT
&&
@@ -236,7 +236,7 @@ wayland_create_buffer(struct dri2_egl_surface
*dri2_surf,
       dri2_egl_display(dri2_surf->base.Resource.Display);
    struct wl_buffer *buf;
 
-   buf = wl_drm_create_buffer(dri2_dpy->wl_drm, buffer->name,
+   buf = wl_gbm_create_buffer(dri2_dpy->wl_gbm, buffer->name,
                               dri2_surf->base.Width,
dri2_surf->base.Height,
                               buffer->pitch, dri2_surf->format);
    wl_buffer_add_listener(buf, &wl_buffer_listener, dri2_surf);
@@ -370,9 +370,9 @@ destroy_third_buffer(struct dri2_egl_surface
*dri2_surf)
                                  dri2_surf->third_buffer);
    dri2_surf->third_buffer = NULL;
 
-   if (dri2_surf->wl_drm_buffer[WL_BUFFER_THIRD])
-      wl_buffer_destroy(dri2_surf->wl_drm_buffer[WL_BUFFER_THIRD]);
-   dri2_surf->wl_drm_buffer[WL_BUFFER_THIRD] = NULL;
+   if (dri2_surf->wl_gbm_buffer[WL_BUFFER_THIRD])
+      wl_buffer_destroy(dri2_surf->wl_gbm_buffer[WL_BUFFER_THIRD]);
+   dri2_surf->wl_gbm_buffer[WL_BUFFER_THIRD] = NULL;
    dri2_surf->wl_buffer_lock[WL_BUFFER_THIRD] = 0;
 }
 
@@ -386,8 +386,8 @@ swap_wl_buffers(struct dri2_egl_surface *dri2_surf,
    dri2_surf->wl_buffer_lock[a] = dri2_surf->wl_buffer_lock[b];
    dri2_surf->wl_buffer_lock[b] = tmp;
       
-   pointer_swap((const void **) &dri2_surf->wl_drm_buffer[a],
-                (const void **) &dri2_surf->wl_drm_buffer[b]);
+   pointer_swap((const void **) &dri2_surf->wl_gbm_buffer[a],
+                (const void **) &dri2_surf->wl_gbm_buffer[b]);
 }
 
 static void
@@ -442,9 +442,9 @@ dri2_get_buffers_with_format(__DRIdrawable *
driDrawable,
       dri2_surf->dy = dri2_surf->wl_win->dy;
 
       for (i = 0; i < WL_BUFFER_COUNT; ++i) {
-         if (dri2_surf->wl_drm_buffer[i])
-            wl_buffer_destroy(dri2_surf->wl_drm_buffer[i]);
-         dri2_surf->wl_drm_buffer[i]  = NULL;
+         if (dri2_surf->wl_gbm_buffer[i])
+            wl_buffer_destroy(dri2_surf->wl_gbm_buffer[i]);
+         dri2_surf->wl_gbm_buffer[i]  = NULL;
          dri2_surf->wl_buffer_lock[i] = 0;
       }
    }
@@ -593,13 +593,13 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay
*disp, _EGLSurface *draw)
 
       swap_wl_buffers(dri2_surf, WL_BUFFER_FRONT, WL_BUFFER_BACK);
 
-      if (!dri2_surf->wl_drm_buffer[WL_BUFFER_FRONT])
-	 dri2_surf->wl_drm_buffer[WL_BUFFER_FRONT] =
+      if (!dri2_surf->wl_gbm_buffer[WL_BUFFER_FRONT])
+	 dri2_surf->wl_gbm_buffer[WL_BUFFER_FRONT] =
 	    wayland_create_buffer(dri2_surf,
 		  dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT]);
 
       wl_surface_attach(dri2_surf->wl_win->surface,
-	    dri2_surf->wl_drm_buffer[WL_BUFFER_FRONT],
+	    dri2_surf->wl_gbm_buffer[WL_BUFFER_FRONT],
 	    dri2_surf->dx, dri2_surf->dy);
       dri2_surf->wl_buffer_lock[WL_BUFFER_FRONT] = 1;
 
@@ -661,12 +661,12 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp,
_EGLContext *ctx,
    /* FIXME: Get buffer format from attr_list somehow... or from the
       wl_egl_piaxmap.  */
    wl_egl_pixmap->buffer =
-      wl_drm_create_buffer(dri2_dpy->wl_drm,
+      wl_gbm_create_buffer(dri2_dpy->wl_gbm,
 			   dri2_buf->dri_buffer->name,
 			   wl_egl_pixmap->width,
 			   wl_egl_pixmap->height,
 			   dri2_buf->dri_buffer->pitch,
-			   WL_DRM_FORMAT_ARGB8888);
+			   WL_GBM_FORMAT_ARGB8888);
 
    wl_attr_list[1] = wl_egl_pixmap->width;
    wl_attr_list[3] = wl_egl_pixmap->height;
@@ -699,7 +699,7 @@ dri2_wayland_authenticate(_EGLDisplay *disp,
uint32_t id)
 
    dri2_dpy->authenticated = 0;
 
-   wl_drm_authenticate(dri2_dpy->wl_drm, id);
+   wl_gbm_authenticate(dri2_dpy->wl_gbm, id);
    wl_display_roundtrip(dri2_dpy->wl_dpy);
 
    if (!dri2_dpy->authenticated)
@@ -727,7 +727,7 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp)
    dlclose(dri2_dpy->driver);
    free(dri2_dpy->driver_name);
    free(dri2_dpy->device_name);
-   wl_drm_destroy(dri2_dpy->wl_drm);
+   wl_gbm_destroy(dri2_dpy->wl_gbm);
    if (dri2_dpy->own_device)
       wl_display_disconnect(dri2_dpy->wl_dpy);
    free(dri2_dpy);
@@ -737,7 +737,7 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp)
 }
 
 static void
-drm_handle_device(void *data, struct wl_drm *drm, const char *device)
+drm_handle_device(void *data, struct wl_gbm *drm, const char *device)
 {
    struct dri2_egl_display *dri2_dpy = data;
    drm_magic_t magic;
@@ -763,33 +763,33 @@ drm_handle_device(void *data, struct wl_drm *drm,
const char *device)
    }
 
    drmGetMagic(dri2_dpy->fd, &magic);
-   wl_drm_authenticate(dri2_dpy->wl_drm, magic);
+   wl_gbm_authenticate(dri2_dpy->wl_gbm, magic);
 }
 
 static void
-drm_handle_format(void *data, struct wl_drm *drm, uint32_t format)
+drm_handle_format(void *data, struct wl_gbm *drm, uint32_t format)
 {
    struct dri2_egl_display *dri2_dpy = data;
 
    switch (format) {
-   case WL_DRM_FORMAT_ARGB8888:
+   case WL_GBM_FORMAT_ARGB8888:
       dri2_dpy->formats |= HAS_ARGB8888;
       break;
-   case WL_DRM_FORMAT_XRGB8888:
+   case WL_GBM_FORMAT_XRGB8888:
       dri2_dpy->formats |= HAS_XRGB8888;
       break;
    }
 }
 
 static void
-drm_handle_authenticated(void *data, struct wl_drm *drm)
+drm_handle_authenticated(void *data, struct wl_gbm *drm)
 {
    struct dri2_egl_display *dri2_dpy = data;
 
    dri2_dpy->authenticated = 1;
 }
 
-static const struct wl_drm_listener drm_listener = {
+static const struct wl_gbm_listener drm_listener = {
 	drm_handle_device,
 	drm_handle_format,
 	drm_handle_authenticated
@@ -829,16 +829,16 @@ dri2_initialize_wayland(_EGLDriver *drv,
_EGLDisplay *disp)
       dri2_dpy->wl_dpy = disp->PlatformDisplay;
    }
 
-   id = wl_display_get_global(dri2_dpy->wl_dpy, "wl_drm", 1);
+   id = wl_display_get_global(dri2_dpy->wl_dpy, "wl_gbm", 1);
    if (id == 0)
       wl_display_roundtrip(dri2_dpy->wl_dpy);
-   id = wl_display_get_global(dri2_dpy->wl_dpy, "wl_drm", 1);
+   id = wl_display_get_global(dri2_dpy->wl_dpy, "wl_gbm", 1);
    if (id == 0)
       goto cleanup_dpy;
-   dri2_dpy->wl_drm = wl_display_bind(dri2_dpy->wl_dpy, id,
&wl_drm_interface);
-   if (!dri2_dpy->wl_drm)
+   dri2_dpy->wl_gbm = wl_display_bind(dri2_dpy->wl_dpy, id,
&wl_gbm_interface);
+   if (!dri2_dpy->wl_gbm)
       goto cleanup_dpy;
-   wl_drm_add_listener(dri2_dpy->wl_drm, &drm_listener, dri2_dpy);
+   wl_gbm_add_listener(dri2_dpy->wl_gbm, &drm_listener, dri2_dpy);
    wl_display_roundtrip(dri2_dpy->wl_dpy);
    if (dri2_dpy->fd == -1)
       goto cleanup_drm;
@@ -899,7 +899,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay
*disp)
    close(dri2_dpy->fd);
  cleanup_drm:
    free(dri2_dpy->device_name);
-   wl_drm_destroy(dri2_dpy->wl_drm);
+   wl_gbm_destroy(dri2_dpy->wl_gbm);
  cleanup_dpy:
    free(dri2_dpy);
    
diff --git
a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c
index 80b3f22..1db7ff5 100644
---
a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c
+++
b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c
@@ -13,7 +13,7 @@
 #include "native_wayland_drm_bufmgr_helper.h"
 
 void *
-egl_g3d_wl_drm_helper_reference_buffer(void *user_data, uint32_t name,
+egl_g3d_wl_gbm_helper_reference_buffer(void *user_data, uint32_t name,
                                        int32_t width, int32_t height,
                                        uint32_t stride, uint32_t
format)
 {
@@ -23,10 +23,10 @@ egl_g3d_wl_drm_helper_reference_buffer(void
*user_data, uint32_t name,
    enum pipe_format pf;
 
    switch (format) {
-   case WL_DRM_FORMAT_ARGB8888:
+   case WL_GBM_FORMAT_ARGB8888:
       pf = PIPE_FORMAT_B8G8R8A8_UNORM;
       break;
-   case WL_DRM_FORMAT_XRGB8888:
+   case WL_GBM_FORMAT_XRGB8888:
       pf = PIPE_FORMAT_B8G8R8X8_UNORM;
       break;
    default:
@@ -54,7 +54,7 @@ egl_g3d_wl_drm_helper_reference_buffer(void
*user_data, uint32_t name,
 }
 
 void
-egl_g3d_wl_drm_helper_unreference_buffer(void *user_data, void *buffer)
+egl_g3d_wl_gbm_helper_unreference_buffer(void *user_data, void *buffer)
 {
    struct pipe_resource *resource = buffer;
 
@@ -62,10 +62,10 @@ egl_g3d_wl_drm_helper_unreference_buffer(void
*user_data, void *buffer)
 }
 
 struct pipe_resource *
-egl_g3d_wl_drm_common_wl_buffer_get_resource(struct native_display
*ndpy,
+egl_g3d_wl_gbm_common_wl_buffer_get_resource(struct native_display
*ndpy,
                                              struct wl_buffer *buffer)
 {
-   return wayland_drm_buffer_get_buffer(buffer);
+   return wl_gbm_buffer_get_buffer(buffer);
 }
 
 #endif
diff --git
a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.h b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.h
index 6085875..4d9a41d 100644
---
a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.h
+++
b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.h
@@ -23,21 +23,21 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#ifndef _NATIVE_WAYLAND_DRM_BUFMGR_HELPER_H_
-#define _NATIVE_WAYLAND_DRM_BUFMGR_HELPER_H_
+#ifndef _NATIVE_WAYLAND_GBM_BUFMGR_HELPER_H_
+#define _NATIVE_WAYLAND_GBM_BUFMGR_HELPER_H_
 
 #include "wayland-drm.h"
 
 void *
-egl_g3d_wl_drm_helper_reference_buffer(void *user_data, uint32_t name,
+egl_g3d_wl_gbm_helper_reference_buffer(void *user_data, uint32_t name,
                                        int32_t width, int32_t height,
                                        uint32_t stride, uint32_t
format);
 
 void
-egl_g3d_wl_drm_helper_unreference_buffer(void *user_data, void
*buffer);
+egl_g3d_wl_gbm_helper_unreference_buffer(void *user_data, void
*buffer);
 
 struct pipe_resource *
-egl_g3d_wl_drm_common_wl_buffer_get_resource(struct native_display
*ndpy,
+egl_g3d_wl_gbm_common_wl_buffer_get_resource(struct native_display
*ndpy,
                                              struct wl_buffer *buffer);
 
-#endif /* _NATIVE_WAYLAND_DRM_BUFMGR_HELPER_H_ */
+#endif /* _NATIVE_WAYLAND_GBM_BUFMGR_HELPER_H_ */
diff --git a/src/gallium/state_trackers/egl/drm/native_drm.c
b/src/gallium/state_trackers/egl/drm/native_drm.c
index 3c4c19f..4d1fba0 100644
--- a/src/gallium/state_trackers/egl/drm/native_drm.c
+++ b/src/gallium/state_trackers/egl/drm/native_drm.c
@@ -197,10 +197,10 @@ drm_display_authenticate(void *user_data, uint32_t
magic)
    return drmAuthMagic(drmdpy->fd, magic);
 }
 
-static struct wayland_drm_callbacks wl_drm_callbacks = {
+static struct wl_gbm_callbacks wl_gbm_callbacks = {
    drm_display_authenticate,
-   egl_g3d_wl_drm_helper_reference_buffer,
-   egl_g3d_wl_drm_helper_unreference_buffer
+   egl_g3d_wl_gbm_helper_reference_buffer,
+   egl_g3d_wl_gbm_helper_unreference_buffer
 };
 
 static boolean
@@ -209,14 +209,14 @@ drm_display_bind_wayland_display(struct
native_display *ndpy,
 {
    struct drm_display *drmdpy = drm_display(ndpy);
 
-   if (drmdpy->wl_server_drm)
+   if (drmdpy->wl_server_gbm)
       return FALSE;
 
-   drmdpy->wl_server_drm = wayland_drm_init(wl_dpy,
+   drmdpy->wl_server_gbm = wl_gbm_init(wl_dpy,
          drmdpy->device_name,
-         &wl_drm_callbacks, ndpy);
+         &wl_gbm_callbacks, ndpy);
 
-   if (!drmdpy->wl_server_drm)
+   if (!drmdpy->wl_server_gbm)
       return FALSE;
    
    return TRUE;
@@ -228,11 +228,11 @@ drm_display_unbind_wayland_display(struct
native_display *ndpy,
 {
    struct drm_display *drmdpy = drm_display(ndpy);
 
-   if (!drmdpy->wl_server_drm)
+   if (!drmdpy->wl_server_gbm)
       return FALSE;
 
-   wayland_drm_uninit(drmdpy->wl_server_drm);
-   drmdpy->wl_server_drm = NULL;
+   wl_gbm_uninit(drmdpy->wl_server_gbm);
+   drmdpy->wl_server_gbm = NULL;
 
    return TRUE;
 }
@@ -240,7 +240,7 @@ drm_display_unbind_wayland_display(struct
native_display *ndpy,
 static struct native_display_wayland_bufmgr drm_display_wayland_bufmgr
= {
    drm_display_bind_wayland_display,
    drm_display_unbind_wayland_display,
-   egl_g3d_wl_drm_common_wl_buffer_get_resource
+   egl_g3d_wl_gbm_common_wl_buffer_get_resource
 };
 
 #endif /* HAVE_WAYLAND_BACKEND */
diff --git a/src/gallium/state_trackers/egl/drm/native_drm.h
b/src/gallium/state_trackers/egl/drm/native_drm.h
index 18cebf4..2ef98db 100644
--- a/src/gallium/state_trackers/egl/drm/native_drm.h
+++ b/src/gallium/state_trackers/egl/drm/native_drm.h
@@ -70,7 +70,7 @@ struct drm_display {
    struct drm_crtc *saved_crtcs;
 
 #ifdef HAVE_WAYLAND_BACKEND
-   struct wl_drm *wl_server_drm; /* for EGL_WL_bind_wayland_display */
+   struct wl_gbm *wl_server_gbm; /* for EGL_WL_bind_wayland_display */
 #endif
 };
 
diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c
b/src/gallium/state_trackers/egl/wayland/native_drm.c
index e3bd628..dcdc1d5 100644
--- a/src/gallium/state_trackers/egl/wayland/native_drm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
@@ -53,8 +53,8 @@ struct wayland_drm_display {
 
    const struct native_event_handler *event_handler;
 
-   struct wl_drm *wl_drm;
-   struct wl_drm *wl_server_drm; /* for EGL_WL_bind_wayland_display */
+   struct wl_gbm *wl_gbm;
+   struct wl_gbm *wl_server_gbm; /* for EGL_WL_bind_wayland_display */
    int fd;
    char *device_name;
    boolean authenticated;
@@ -73,8 +73,8 @@ wayland_drm_display_destroy(struct native_display
*ndpy)
 
    if (drmdpy->fd)
       close(drmdpy->fd);
-   if (drmdpy->wl_drm)
-      wl_drm_destroy(drmdpy->wl_drm);
+   if (drmdpy->wl_gbm)
+      wl_gbm_destroy(drmdpy->wl_gbm);
    if (drmdpy->device_name)
       FREE(drmdpy->device_name);
    if (drmdpy->base.configs)
@@ -97,7 +97,7 @@ wayland_create_drm_buffer(struct wayland_display
*display,
    struct pipe_resource *resource;
    struct winsys_handle wsh;
    uint width, height;
-   enum wl_drm_format format;
+   enum wl_gbm_format format;
 
    resource = resource_surface_get_single_resource(surface->rsurf,
attachment);
    resource_surface_get_size(surface->rsurf, &width, &height);
@@ -109,22 +109,22 @@ wayland_create_drm_buffer(struct wayland_display
*display,
 
    switch (surface->color_format) {
    case PIPE_FORMAT_B8G8R8A8_UNORM:
-      format = WL_DRM_FORMAT_ARGB8888;
+      format = WL_GBM_FORMAT_ARGB8888;
       break;
    case PIPE_FORMAT_B8G8R8X8_UNORM:
-      format = WL_DRM_FORMAT_XRGB8888;
+      format = WL_GBM_FORMAT_XRGB8888;
       break;
    default:
       return NULL;
       break;
    }
 
-   return wl_drm_create_buffer(drmdpy->wl_drm, wsh.handle,
+   return wl_gbm_create_buffer(drmdpy->wl_gbm, wsh.handle,
                                width, height, wsh.stride, format);
 }
 
 static void
-drm_handle_device(void *data, struct wl_drm *drm, const char *device)
+drm_handle_device(void *data, struct wl_gbm *drm, const char *device)
 {
    struct wayland_drm_display *drmdpy = data;
    drm_magic_t magic;
@@ -149,33 +149,33 @@ drm_handle_device(void *data, struct wl_drm *drm,
const char *device)
    }
 
    drmGetMagic(drmdpy->fd, &magic);
-   wl_drm_authenticate(drmdpy->wl_drm, magic);
+   wl_gbm_authenticate(drmdpy->wl_gbm, magic);
 }
 
 static void
-drm_handle_format(void *data, struct wl_drm *drm, uint32_t format)
+drm_handle_format(void *data, struct wl_gbm *drm, uint32_t format)
 {
    struct wayland_drm_display *drmdpy = data;
 
    switch (format) {
-   case WL_DRM_FORMAT_ARGB8888:
+   case WL_GBM_FORMAT_ARGB8888:
       drmdpy->base.formats |= HAS_ARGB8888;
       break;
-   case WL_DRM_FORMAT_XRGB8888:
+   case WL_GBM_FORMAT_XRGB8888:
       drmdpy->base.formats |= HAS_XRGB8888;
       break;
    }
 }
 
 static void
-drm_handle_authenticated(void *data, struct wl_drm *drm)
+drm_handle_authenticated(void *data, struct wl_gbm *drm)
 {
    struct wayland_drm_display *drmdpy = data;
 
    drmdpy->authenticated = true;
 }
 
-static const struct wl_drm_listener drm_listener = {
+static const struct wl_gbm_listener drm_listener = {
    drm_handle_device,
    drm_handle_format,
    drm_handle_authenticated
@@ -187,18 +187,18 @@ wayland_drm_display_init_screen(struct
native_display *ndpy)
    struct wayland_drm_display *drmdpy = wayland_drm_display(ndpy);
    uint32_t id;
 
-   id = wl_display_get_global(drmdpy->base.dpy, "wl_drm", 1);
+   id = wl_display_get_global(drmdpy->base.dpy, "wl_gbm", 1);
    if (id == 0)
       wl_display_roundtrip(drmdpy->base.dpy);
-   id = wl_display_get_global(drmdpy->base.dpy, "wl_drm", 1);
+   id = wl_display_get_global(drmdpy->base.dpy, "wl_gbm", 1);
    if (id == 0)
       return FALSE;
 
-   drmdpy->wl_drm = wl_display_bind(drmdpy->base.dpy, id,
&wl_drm_interface);
-   if (!drmdpy->wl_drm)
+   drmdpy->wl_gbm = wl_display_bind(drmdpy->base.dpy, id,
&wl_gbm_interface);
+   if (!drmdpy->wl_gbm)
       return FALSE;
 
-   wl_drm_add_listener(drmdpy->wl_drm, &drm_listener, drmdpy);
+   wl_gbm_add_listener(drmdpy->wl_gbm, &drm_listener, drmdpy);
    wl_display_roundtrip(drmdpy->base.dpy);
    if (drmdpy->fd == -1)
       return FALSE;
@@ -238,7 +238,7 @@ wayland_drm_display_authenticate(void *user_data,
uint32_t magic)
 
    current_authenticate = drmdpy->authenticated;
 
-   wl_drm_authenticate(drmdpy->wl_drm, magic);
+   wl_gbm_authenticate(drmdpy->wl_gbm, magic);
    wl_display_roundtrip(drmdpy->base.dpy);
    authenticated = drmdpy->authenticated;
 
@@ -247,10 +247,10 @@ wayland_drm_display_authenticate(void *user_data,
uint32_t magic)
    return authenticated ? 0 : -1;
 }
 
-static struct wayland_drm_callbacks wl_drm_callbacks = {
+static struct wl_gbm_callbacks wl_gbm_callbacks = {
    wayland_drm_display_authenticate,
-   egl_g3d_wl_drm_helper_reference_buffer,
-   egl_g3d_wl_drm_helper_unreference_buffer
+   egl_g3d_wl_gbm_helper_reference_buffer,
+   egl_g3d_wl_gbm_helper_unreference_buffer
 };
 
 static boolean
@@ -259,14 +259,14 @@ wayland_drm_display_bind_wayland_display(struct
native_display *ndpy,
 {
    struct wayland_drm_display *drmdpy = wayland_drm_display(ndpy);
 
-   if (drmdpy->wl_server_drm)
+   if (drmdpy->wl_server_gbm)
       return FALSE;
 
-   drmdpy->wl_server_drm =
-      wayland_drm_init(wl_dpy, drmdpy->device_name,
-                       &wl_drm_callbacks, ndpy);
+   drmdpy->wl_server_gbm =
+      wl_gbm_init(wl_dpy, drmdpy->device_name,
+                       &wl_gbm_callbacks, ndpy);
 
-   if (!drmdpy->wl_server_drm)
+   if (!drmdpy->wl_server_gbm)
       return FALSE;
    
    return TRUE;
@@ -278,11 +278,11 @@ wayland_drm_display_unbind_wayland_display(struct
native_display *ndpy,
 {
    struct wayland_drm_display *drmdpy = wayland_drm_display(ndpy);
 
-   if (!drmdpy->wl_server_drm)
+   if (!drmdpy->wl_server_gbm)
       return FALSE;
 
-   wayland_drm_uninit(drmdpy->wl_server_drm);
-   drmdpy->wl_server_drm = NULL;
+   wl_gbm_uninit(drmdpy->wl_server_gbm);
+   drmdpy->wl_server_gbm = NULL;
 
    return TRUE;
 }
@@ -290,7 +290,7 @@ wayland_drm_display_unbind_wayland_display(struct
native_display *ndpy,
 static struct native_display_wayland_bufmgr
wayland_drm_display_wayland_bufmgr = {
    wayland_drm_display_bind_wayland_display,
    wayland_drm_display_unbind_wayland_display,
-   egl_g3d_wl_drm_common_wl_buffer_get_resource
+   egl_g3d_wl_gbm_common_wl_buffer_get_resource
 };
 
 
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c
b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 5d7d379..ee3e0fe 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -62,7 +62,7 @@ struct dri2_display {
 
    struct util_hash_table *surfaces;
 #ifdef HAVE_WAYLAND_BACKEND
-   struct wl_drm *wl_server_drm; /* for EGL_WL_bind_wayland_display */
+   struct wl_gbm *wl_server_gbm; /* for EGL_WL_bind_wayland_display */
 #endif
 };
 
@@ -847,10 +847,10 @@ dri2_display_authenticate(void *user_data,
uint32_t magic)
    return x11_screen_authenticate(dri2dpy->xscr, magic);
 }
 
-static struct wayland_drm_callbacks wl_drm_callbacks = {
+static struct wl_gbm_callbacks wl_gbm_callbacks = {
    dri2_display_authenticate,
-   egl_g3d_wl_drm_helper_reference_buffer,
-   egl_g3d_wl_drm_helper_unreference_buffer
+   egl_g3d_wl_gbm_helper_reference_buffer,
+   egl_g3d_wl_gbm_helper_unreference_buffer
 };
 
 static boolean
@@ -859,14 +859,14 @@ dri2_display_bind_wayland_display(struct
native_display *ndpy,
 {
    struct dri2_display *dri2dpy = dri2_display(ndpy);
 
-   if (dri2dpy->wl_server_drm)
+   if (dri2dpy->wl_server_gbm)
       return FALSE;
 
-   dri2dpy->wl_server_drm = wayland_drm_init(wl_dpy,
+   dri2dpy->wl_server_gbm = wl_gbm_init(wl_dpy,
          x11_screen_get_device_name(dri2dpy->xscr),
-         &wl_drm_callbacks, ndpy);
+         &wl_gbm_callbacks, ndpy);
 
-   if (!dri2dpy->wl_server_drm)
+   if (!dri2dpy->wl_server_gbm)
       return FALSE;
    
    return TRUE;
@@ -878,11 +878,11 @@ dri2_display_unbind_wayland_display(struct
native_display *ndpy,
 {
    struct dri2_display *dri2dpy = dri2_display(ndpy);
 
-   if (!dri2dpy->wl_server_drm)
+   if (!dri2dpy->wl_server_gbm)
       return FALSE;
 
-   wayland_drm_uninit(dri2dpy->wl_server_drm);
-   dri2dpy->wl_server_drm = NULL;
+   wl_gbm_uninit(dri2dpy->wl_server_gbm);
+   dri2dpy->wl_server_gbm = NULL;
 
    return TRUE;
 }
@@ -890,7 +890,7 @@ dri2_display_unbind_wayland_display(struct
native_display *ndpy,
 static struct native_display_wayland_bufmgr dri2_display_wayland_bufmgr
= {
    dri2_display_bind_wayland_display,
    dri2_display_unbind_wayland_display,
-   egl_g3d_wl_drm_common_wl_buffer_get_resource
+   egl_g3d_wl_gbm_common_wl_buffer_get_resource
 };
 
 #endif /* HAVE_WAYLAND_BACKEND */
-- 
1.7.5.4




More information about the wayland-devel mailing list