[gtk+] wayland: Drop code to use cairo-gl for rendering



commit d4a9863e199f00054b3fcf70b3ac6c6b804611b9
Author: Rob Bradford <rob linux intel com>
Date:   Thu Jan 17 16:19:23 2013 +0000

    wayland: Drop code to use cairo-gl for rendering
    
    The APIs that this code relied upon were removed in Wayland 1.0 and as such
    this code has been broken since then.

 gdk/wayland/gdkdisplay-wayland.c |   69 --------------------------------------
 gdk/wayland/gdkdisplay-wayland.h |   21 -----------
 gdk/wayland/gdkwindow-wayland.c  |   68 -------------------------------------
 3 files changed, 0 insertions(+), 158 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index a2eb8e0..de33525 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -17,10 +17,6 @@
 
 #include "config.h"
 
-#ifdef GDK_WAYLAND_USE_EGL
-#include <wayland-egl.h>
-#endif
-
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
@@ -155,63 +151,6 @@ gdk_registry_handle_global(void *data, struct wl_registry *registry, uint32_t id
   }
 }
 
-#ifdef GDK_WAYLAND_USE_EGL
-static gboolean
-gdk_display_init_egl(GdkDisplay *display)
-{
-  GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
-  EGLint major, minor, i;
-  void *p;
-
-  static const struct { const char *f; unsigned int offset; }
-  extension_functions[] = {
-    { "glEGLImageTargetTexture2DOES", offsetof(GdkWaylandDisplay, image_target_texture_2d) },
-    { "eglCreateImageKHR", offsetof(GdkWaylandDisplay, create_image) },
-    { "eglDestroyImageKHR", offsetof(GdkWaylandDisplay, destroy_image) }
-  };
-
-  display_wayland->egl_display =
-    eglGetDisplay(display_wayland->wl_display);
-  if (!eglInitialize(display_wayland->egl_display, &major, &minor)) {
-    fprintf(stderr, "failed to initialize display\n");
-    return FALSE;
-  }
-
-  eglBindAPI(EGL_OPENGL_API);
-
-  display_wayland->egl_context =
-    eglCreateContext(display_wayland->egl_display, NULL, EGL_NO_CONTEXT, NULL);
-  if (display_wayland->egl_context == NULL) {
-    fprintf(stderr, "failed to create context\n");
-    return FALSE;
-  }
-
-  if (!eglMakeCurrent(display_wayland->egl_display,
-		      NULL, NULL, display_wayland->egl_context)) {
-    fprintf(stderr, "faile to make context current\n");
-    return FALSE;
-  }
-
-  display_wayland->cairo_device =
-    cairo_egl_device_create(display_wayland->egl_display,
-			    display_wayland->egl_context);
-  if (cairo_device_status (display_wayland->cairo_device) != CAIRO_STATUS_SUCCESS) {
-    fprintf(stderr, "failed to get cairo drm device\n");
-    return FALSE;
-  }
-
-  for (i = 0; i < G_N_ELEMENTS(extension_functions); i++) {
-    p = eglGetProcAddress(extension_functions[i].f);
-    *(void **) ((char *) display_wayland + extension_functions[i].offset) = p;
-    if (p == NULL) {
-      fprintf(stderr, "failed to look up %s\n", extension_functions[i].f);
-      return FALSE;
-    }
-  }
-
-  return TRUE;
-}
-#endif
 
 static const struct wl_registry_listener registry_listener = {
 	gdk_registry_handle_global
@@ -241,11 +180,7 @@ _gdk_wayland_display_open (const gchar *display_name)
   display_wayland->wl_registry = wl_display_get_registry(display_wayland->wl_display);
   wl_registry_add_listener(display_wayland->wl_registry, &registry_listener, display_wayland);
 
-#ifdef GDK_WAYLAND_USE_EGL
-  gdk_display_init_egl(display);
-#else
   wl_display_dispatch(display_wayland->wl_display);
-#endif
 
   display_wayland->event_source =
     _gdk_wayland_display_event_source_new (display);
@@ -277,10 +212,6 @@ gdk_wayland_display_dispose (GObject *object)
       display_wayland->event_source = NULL;
     }
 
-#ifdef GDK_WAYLAND_USE_EGL
-  eglTerminate(display_wayland->egl_display);
-#endif
-
   G_OBJECT_CLASS (_gdk_wayland_display_parent_class)->dispose (object);
 }
 
diff --git a/gdk/wayland/gdkdisplay-wayland.h b/gdk/wayland/gdkdisplay-wayland.h
index 5e8e76f..ae95a17 100644
--- a/gdk/wayland/gdkdisplay-wayland.h
+++ b/gdk/wayland/gdkdisplay-wayland.h
@@ -27,15 +27,6 @@
 #include <wayland-client.h>
 #include <wayland-cursor.h>
 
-#ifdef GDK_WAYLAND_USE_EGL
-#include <wayland-egl.h>
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GL/gl.h>
-#include <GL/glext.h>
-#include <cairo-gl.h>
-#endif
-
 #include <glib.h>
 #include <gdk/gdkkeys.h>
 #include <gdk/gdkwindow.h>
@@ -89,18 +80,6 @@ struct _GdkWaylandDisplay
   GSource *event_source;
 
   struct xkb_context *xkb_context;
-
-#ifdef GDK_WAYLAND_USE_EGL
-  EGLDisplay egl_display;
-  EGLContext egl_context;
-  cairo_device_t *cairo_device;
-#endif
-
-#ifdef GDK_WAYLAND_USE_EGL
-  PFNGLEGLIMAGETARGETTEXTURE2DOESPROC image_target_texture_2d;
-  PFNEGLCREATEIMAGEKHRPROC create_image;
-  PFNEGLDESTROYIMAGEKHRPROC destroy_image;
-#endif
 };
 
 struct _GdkWaylandDisplayClass
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 553d0b9..088c59c 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -302,15 +302,9 @@ _gdk_wayland_display_create_window_impl (GdkDisplay    *display,
 static const cairo_user_data_key_t gdk_wayland_cairo_key;
 
 typedef struct _GdkWaylandCairoSurfaceData {
-#ifdef GDK_WAYLAND_USE_EGL
-  EGLImageKHR image;
-  GLuint texture;
-  struct wl_egl_pixmap *pixmap;
-#else
   gpointer buf;
   size_t buf_length;
   struct wl_shm_pool *pool;
-#endif
   struct wl_buffer *buffer;
   GdkWaylandDisplay *display;
   int32_t width, height;
@@ -374,67 +368,6 @@ gdk_wayland_window_attach_image (GdkWindow *window)
   wl_surface_attach (impl->surface, data->buffer, dx, dy);
 }
 
-#ifdef GDK_WAYLAND_USE_EGL
-static void
-gdk_wayland_cairo_surface_destroy (void *p)
-{
-  GdkWaylandCairoSurfaceData *data = p;
-
-  data->display->destroy_image (data->display->egl_display, data->image);
-  cairo_device_acquire(data->display->cairo_device);
-  glDeleteTextures(1, &data->texture);
-  cairo_device_release(data->display->cairo_device);
-  if (data->buffer)
-    wl_buffer_destroy(data->buffer);
-  g_free(data);
-}
-
-static cairo_surface_t *
-gdk_wayland_create_cairo_surface (GdkWaylandDisplay *display,
-				  int width, int height)
-{
-  GdkWaylandCairoSurfaceData *data;
-  cairo_surface_t *surface;
-  cairo_status_t status;
-
-  data = g_new (GdkWaylandCairoSurfaceData, 1);
-  data->display = display;
-  data->buffer = NULL;
-  data->width = width;
-  data->height = height;
-  data->pixmap = wl_egl_pixmap_create(width, height, 0);
-  data->image =
-    display->create_image(display->egl_display, NULL, EGL_NATIVE_PIXMAP_KHR,
-			  (EGLClientBuffer) data->pixmap, NULL);
-
-  cairo_device_acquire(display->cairo_device);
-  glGenTextures(1, &data->texture);
-  glBindTexture(GL_TEXTURE_2D, data->texture);
-  display->image_target_texture_2d(GL_TEXTURE_2D, data->image);
-  cairo_device_release(display->cairo_device);
-
-  surface = cairo_gl_surface_create_for_texture(display->cairo_device,
-						CAIRO_CONTENT_COLOR_ALPHA,
-						data->texture, width, height);
-
-  cairo_surface_set_user_data (surface, &gdk_wayland_cairo_key,
-			       data, gdk_wayland_cairo_surface_destroy);
-
-  status = cairo_surface_status (surface);
-  if (status != CAIRO_STATUS_SUCCESS)
-    {
-      g_critical (G_STRLOC ": Unable to create Cairo GL surface: %s",
-                  cairo_status_to_string (status));
-
-    }
-
-  if (!data->buffer)
-    data->buffer =
-      wl_egl_pixmap_create_buffer(data->pixmap);
-
-  return surface;
-}
-#else
 static void
 gdk_wayland_cairo_surface_destroy (void *p)
 {
@@ -542,7 +475,6 @@ gdk_wayland_create_cairo_surface (GdkWaylandDisplay *display,
 
   return surface;
 }
-#endif
 
 /* On this first call this creates a double reference - the first reference
  * is held by the GdkWindowImplWayland struct - since unlike other backends



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]