[PATCH 1/5] term change from drm to gbm inside wayland-drm
Halley Zhao
halley.zhao at intel.com
Mon Apr 23 01:37:21 PDT 2012
---
.../wayland/wayland-drm/protocol/wayland-drm.xml | 8 +-
src/egl/wayland/wayland-drm/wayland-drm.c | 110
++++++++++----------
src/egl/wayland/wayland-drm/wayland-drm.h | 22 ++--
3 files changed, 70 insertions(+), 70 deletions(-)
diff --git a/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml
b/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml
index 89fd8f0..1615baf 100644
--- a/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml
+++ b/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<protocol name="drm">
+<protocol name="gbm">
<copyright>
Copyright © 2008-2011 Kristian Høgsberg
@@ -27,9 +27,9 @@
THIS SOFTWARE.
</copyright>
- <!-- drm support. This object is created by the server and published
+ <!-- gbm support. This object is created by the server and published
using the display's global event. -->
- <interface name="wl_drm" version="1">
+ <interface name="wl_gbm" version="1">
<enum name="error">
<entry name="authenticate_fail" value="0"/>
<entry name="invalid_format" value="1"/>
@@ -37,7 +37,7 @@
</enum>
<enum name="format">
- <!-- The drm format codes match the #defines in drm_fourcc.h.
+ <!-- The gbm format codes match the #defines in drm_fourcc.h.
The formats actually supported by the compositor will be
reported by the format event. -->
<entry name="c8" value="0x20203843"/>
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c
b/src/egl/wayland/wayland-drm/wayland-drm.c
index 5f831b3..3403555 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -47,18 +47,18 @@
#define HAS_WAYLAND_0_85
#endif
-struct wl_drm {
+struct wl_gbm {
struct wl_display *display;
void *user_data;
char *device_name;
- struct wayland_drm_callbacks *callbacks;
+ struct wl_gbm_callbacks *callbacks;
};
-struct wl_drm_buffer {
+struct wl_gbm_buffer {
struct wl_buffer buffer;
- struct wl_drm *drm;
+ struct wl_gbm *gbm;
uint32_t format;
void *driver_buffer;
@@ -67,10 +67,10 @@ struct wl_drm_buffer {
static void
destroy_buffer(struct wl_resource *resource)
{
- struct wl_drm_buffer *buffer = resource->data;
- struct wl_drm *drm = buffer->drm;
+ struct wl_gbm_buffer *buffer = resource->data;
+ struct wl_gbm *gbm = buffer->gbm;
- drm->callbacks->release_buffer(drm->user_data,
+ gbm->callbacks->release_buffer(gbm->user_data,
buffer->driver_buffer);
free(buffer);
}
@@ -93,7 +93,7 @@ buffer_damage(struct wl_client *client, struct
wl_resource *buffer,
}
#endif
-const static struct wl_buffer_interface drm_buffer_interface = {
+const static struct wl_buffer_interface gbm_buffer_interface = {
#ifdef HAS_WAYLAND_0_85
buffer_damage,
#endif
@@ -101,20 +101,20 @@ const static struct wl_buffer_interface
drm_buffer_interface = {
};
static void
-drm_create_buffer(struct wl_client *client, struct wl_resource
*resource,
+gbm_create_buffer(struct wl_client *client, struct wl_resource
*resource,
uint32_t id, uint32_t name, int32_t width, int32_t height,
uint32_t stride, uint32_t format)
{
- struct wl_drm *drm = resource->data;
- struct wl_drm_buffer *buffer;
+ struct wl_gbm *gbm = resource->data;
+ struct wl_gbm_buffer *buffer;
switch (format) {
- case WL_DRM_FORMAT_ARGB8888:
- case WL_DRM_FORMAT_XRGB8888:
+ case WL_GBM_FORMAT_ARGB8888:
+ case WL_GBM_FORMAT_XRGB8888:
break;
default:
wl_resource_post_error(resource,
- WL_DRM_ERROR_INVALID_FORMAT,
+ WL_GBM_ERROR_INVALID_FORMAT,
"invalid format");
return;
}
@@ -125,19 +125,19 @@ drm_create_buffer(struct wl_client *client, struct
wl_resource *resource,
return;
}
- buffer->drm = drm;
+ buffer->gbm = gbm;
buffer->buffer.width = width;
buffer->buffer.height = height;
buffer->format = format;
buffer->driver_buffer =
- drm->callbacks->reference_buffer(drm->user_data, name,
+ gbm->callbacks->reference_buffer(gbm->user_data, name,
width, height,
stride, format);
if (buffer->driver_buffer == NULL) {
wl_resource_post_error(resource,
- WL_DRM_ERROR_INVALID_NAME,
+ WL_GBM_ERROR_INVALID_NAME,
"invalid name");
return;
}
@@ -145,7 +145,7 @@ drm_create_buffer(struct wl_client *client, struct
wl_resource *resource,
buffer->buffer.resource.object.id = id;
buffer->buffer.resource.object.interface = &wl_buffer_interface;
buffer->buffer.resource.object.implementation =
- (void (**)(void)) &drm_buffer_interface;
+ (void (**)(void)) &gbm_buffer_interface;
buffer->buffer.resource.data = buffer;
buffer->buffer.resource.destroy = destroy_buffer;
@@ -155,86 +155,86 @@ drm_create_buffer(struct wl_client *client, struct
wl_resource *resource,
}
static void
-drm_authenticate(struct wl_client *client,
+gbm_authenticate(struct wl_client *client,
struct wl_resource *resource, uint32_t id)
{
- struct wl_drm *drm = resource->data;
+ struct wl_gbm *gbm = resource->data;
- if (drm->callbacks->authenticate(drm->user_data, id) < 0)
+ if (gbm->callbacks->authenticate(gbm->user_data, id) < 0)
wl_resource_post_error(resource,
- WL_DRM_ERROR_AUTHENTICATE_FAIL,
+ WL_GBM_ERROR_AUTHENTICATE_FAIL,
"authenicate failed");
else
- wl_resource_post_event(resource, WL_DRM_AUTHENTICATED);
+ wl_resource_post_event(resource, WL_GBM_AUTHENTICATED);
}
-const static struct wl_drm_interface drm_interface = {
- drm_authenticate,
- drm_create_buffer
+const static struct wl_gbm_interface gbm_interface = {
+ gbm_authenticate,
+ gbm_create_buffer
};
static void
-bind_drm(struct wl_client *client, void *data, uint32_t version,
uint32_t id)
+bind_gbm(struct wl_client *client, void *data, uint32_t version,
uint32_t id)
{
- struct wl_drm *drm = data;
+ struct wl_gbm *gbm = data;
struct wl_resource *resource;
- resource = wl_client_add_object(client, &wl_drm_interface,
- &drm_interface, id, data);
- wl_resource_post_event(resource, WL_DRM_DEVICE, drm->device_name);
- wl_resource_post_event(resource, WL_DRM_FORMAT,
- WL_DRM_FORMAT_ARGB8888);
- wl_resource_post_event(resource, WL_DRM_FORMAT,
- WL_DRM_FORMAT_XRGB8888);
+ resource = wl_client_add_object(client, &wl_gbm_interface,
+ &gbm_interface, id, data);
+ wl_resource_post_event(resource, WL_GBM_DEVICE, gbm->device_name);
+ wl_resource_post_event(resource, WL_GBM_FORMAT,
+ WL_GBM_FORMAT_ARGB8888);
+ wl_resource_post_event(resource, WL_GBM_FORMAT,
+ WL_GBM_FORMAT_XRGB8888);
}
-struct wl_drm *
-wayland_drm_init(struct wl_display *display, char *device_name,
- struct wayland_drm_callbacks *callbacks, void
*user_data)
+struct wl_gbm *
+wl_gbm_init(struct wl_display *display, char *device_name,
+ struct wl_gbm_callbacks *callbacks, void *user_data)
{
- struct wl_drm *drm;
+ struct wl_gbm *gbm;
- drm = malloc(sizeof *drm);
+ gbm = malloc(sizeof *gbm);
- drm->display = display;
- drm->device_name = strdup(device_name);
- drm->callbacks = callbacks;
- drm->user_data = user_data;
+ gbm->display = display;
+ gbm->device_name = strdup(device_name);
+ gbm->callbacks = callbacks;
+ gbm->user_data = user_data;
- wl_display_add_global(display, &wl_drm_interface, drm, bind_drm);
+ wl_display_add_global(display, &wl_gbm_interface, gbm, bind_gbm);
- return drm;
+ return gbm;
}
void
-wayland_drm_uninit(struct wl_drm *drm)
+wl_gbm_uninit(struct wl_gbm *gbm)
{
- free(drm->device_name);
+ free(gbm->device_name);
/* FIXME: need wl_display_del_{object,global} */
- free(drm);
+ free(gbm);
}
int
-wayland_buffer_is_drm(struct wl_buffer *buffer)
+wayland_buffer_is_gbm(struct wl_buffer *buffer)
{
return buffer->resource.object.implementation ==
- (void (**)(void)) &drm_buffer_interface;
+ (void (**)(void)) &gbm_buffer_interface;
}
uint32_t
-wayland_drm_buffer_get_format(struct wl_buffer *buffer_base)
+wl_gbm_buffer_get_format(struct wl_buffer *buffer_base)
{
- struct wl_drm_buffer *buffer = (struct wl_drm_buffer *) buffer_base;
+ struct wl_gbm_buffer *buffer = (struct wl_gbm_buffer *) buffer_base;
return buffer->format;
}
void *
-wayland_drm_buffer_get_buffer(struct wl_buffer *buffer_base)
+wl_gbm_buffer_get_buffer(struct wl_buffer *buffer_base)
{
- struct wl_drm_buffer *buffer = (struct wl_drm_buffer *) buffer_base;
+ struct wl_gbm_buffer *buffer = (struct wl_gbm_buffer *) buffer_base;
return buffer->driver_buffer;
}
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.h
b/src/egl/wayland/wayland-drm/wayland-drm.h
index bec50a5..0422dc5 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.h
+++ b/src/egl/wayland/wayland-drm/wayland-drm.h
@@ -1,5 +1,5 @@
-#ifndef WAYLAND_DRM_H
-#define WAYLAND_DRM_H
+#ifndef WAYLAND_GBM_H
+#define WAYLAND_GBM_H
#include "egldisplay.h"
#include "eglimage.h"
@@ -7,9 +7,9 @@
#include <wayland-server.h>
#include "wayland-drm-server-protocol.h"
-struct wl_drm;
+struct wl_gbm;
-struct wayland_drm_callbacks {
+struct wl_gbm_callbacks {
int (*authenticate)(void *user_data, uint32_t id);
void *(*reference_buffer)(void *user_data, uint32_t name,
@@ -19,20 +19,20 @@ struct wayland_drm_callbacks {
void (*release_buffer)(void *user_data, void *buffer);
};
-struct wl_drm *
-wayland_drm_init(struct wl_display *display, char *device_name,
- struct wayland_drm_callbacks *callbacks, void *user_data);
+struct wl_gbm *
+wl_gbm_init(struct wl_display *display, char *device_name,
+ struct wl_gbm_callbacks *callbacks, void *user_data);
void
-wayland_drm_uninit(struct wl_drm *drm);
+wl_gbm_uninit(struct wl_gbm *gbm);
int
-wayland_buffer_is_drm(struct wl_buffer *buffer);
+wayland_buffer_is_gbm(struct wl_buffer *buffer);
uint32_t
-wayland_drm_buffer_get_format(struct wl_buffer *buffer_base);
+wl_gbm_buffer_get_format(struct wl_buffer *buffer_base);
void *
-wayland_drm_buffer_get_buffer(struct wl_buffer *buffer);
+wl_gbm_buffer_get_buffer(struct wl_buffer *buffer);
#endif
--
1.7.5.4
More information about the wayland-devel
mailing list