Mesa (master): wayland-drm: Use new generic error event

Kristian Høgsberg krh at kemper.freedesktop.org
Thu May 19 16:09:26 UTC 2011


Module: Mesa
Branch: master
Commit: 339544f4bbef9be1b4b3465f28482b9699a99692
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=339544f4bbef9be1b4b3465f28482b9699a99692

Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Wed May 11 15:28:19 2011 -0400

wayland-drm: Use new generic error event

---

 .../wayland/wayland-drm/protocol/wayland-drm.xml   |    6 ++++
 src/egl/wayland/wayland-drm/wayland-drm.c          |   27 ++++++++-----------
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml b/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml
index cd5d191..0331f12 100644
--- a/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml
+++ b/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml
@@ -3,6 +3,12 @@
   <!-- drm support. This object is created by the server and published
        using the display's global event. -->
   <interface name="wl_drm" version="1">
+    <enum name="error">
+      <entry name="authenticate_fail" value="0"/>
+      <entry name="invalid_visual" value="1"/>
+      <entry name="invalid_name" value="2"/>
+    </enum>
+
     <!-- Call this request with the magic received from drmGetMagic().
          It will be passed on to the drmAuthMagic() or
          DRIAuthConnection() call.  This authentication must be
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c
index 03a756b..d68f9c7 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -101,12 +101,9 @@ drm_create_buffer(struct wl_client *client, struct wl_drm *drm,
 	buffer->buffer.visual = visual;
 
 	if (visual->object.interface != &wl_visual_interface) {
-		/* FIXME: Define a real exception event instead of
-		 * abusing this one */
-		wl_client_post_event(client,
-				     (struct wl_object *) drm->display,
-				     WL_DISPLAY_INVALID_OBJECT, 0);
-		fprintf(stderr, "invalid visual in create_buffer\n");
+		wl_client_post_error(client, &drm->object,
+				     WL_DRM_ERROR_INVALID_VISUAL,
+				     "invalid visual");
 		return;
 	}
 
@@ -116,12 +113,9 @@ drm_create_buffer(struct wl_client *client, struct wl_drm *drm,
 						 stride, visual);
 
 	if (buffer->driver_buffer == NULL) {
-		/* FIXME: Define a real exception event instead of
-		 * abusing this one */
-		wl_client_post_event(client,
-				     (struct wl_object *) drm->display,
-				     WL_DISPLAY_INVALID_OBJECT, 0);
-		fprintf(stderr, "failed to create image for name %d\n", name);
+		wl_client_post_error(client, &drm->object,
+				     WL_DRM_ERROR_INVALID_NAME,
+				     "invalid name");
 		return;
 	}
 
@@ -140,9 +134,9 @@ drm_authenticate(struct wl_client *client,
 		 struct wl_drm *drm, uint32_t id)
 {
 	if (drm->callbacks->authenticate(drm->user_data, id) < 0)
-		wl_client_post_event(client,
-				     (struct wl_object *) drm->display,
-				     WL_DISPLAY_INVALID_OBJECT, 0);
+		wl_client_post_error(client, &drm->object,
+				     WL_DRM_ERROR_AUTHENTICATE_FAIL,
+				     "authenicate failed");
 	else
 		wl_client_post_event(client, &drm->object,
 				     WL_DRM_AUTHENTICATED);
@@ -154,7 +148,8 @@ const static struct wl_drm_interface drm_interface = {
 };
 
 static void
-post_drm_device(struct wl_client *client, struct wl_object *global)
+post_drm_device(struct wl_client *client, 
+		struct wl_object *global, uint32_t version)
 {
 	struct wl_drm *drm = (struct wl_drm *) global;
 




More information about the mesa-commit mailing list