summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/egl/wayland
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2011-06-25 14:52:57 +0900
committerChia-I Wu <[email protected]>2011-06-25 16:23:20 +0900
commit73df31eedd0f33c8a9907855cb247c8f87964c48 (patch)
treeb8ea98593122e687b3f27a1c6ee40647f65549d6 /src/gallium/state_trackers/egl/wayland
parentac8f59b23ed8256bcce40c47b5773669b00ba78a (diff)
st/egl: reorganize backend initialization
Remove set_event_handler() and pass the event handler with native_get_XXX_platform(). Add init_screen() so that the pipe screen is created later. This way we don't need to pass user_data to create_display().
Diffstat (limited to 'src/gallium/state_trackers/egl/wayland')
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_drm.c11
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_shm.c12
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_wayland.c20
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_wayland.h7
4 files changed, 15 insertions, 35 deletions
diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c b/src/gallium/state_trackers/egl/wayland/native_drm.c
index 8317022ce65..e34b24b58b1 100644
--- a/src/gallium/state_trackers/egl/wayland/native_drm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
@@ -51,7 +51,7 @@
struct wayland_drm_display {
struct wayland_display base;
- struct native_event_handler *event_handler;
+ const struct native_event_handler *event_handler;
struct wl_drm *wl_drm;
struct wl_drm *wl_server_drm; /* for EGL_WL_bind_wayland_display */
@@ -285,8 +285,7 @@ static struct native_display_wayland_bufmgr wayland_drm_display_wayland_bufmgr =
struct wayland_display *
wayland_create_drm_display(struct wl_display *dpy,
- struct native_event_handler *event_handler,
- void *user_data)
+ const struct native_event_handler *event_handler)
{
struct wayland_drm_display *drmdpy;
@@ -295,7 +294,6 @@ wayland_create_drm_display(struct wl_display *dpy,
return NULL;
drmdpy->event_handler = event_handler;
- drmdpy->base.base.user_data = user_data;
drmdpy->base.dpy = dpy;
if (!drmdpy->base.dpy) {
@@ -303,10 +301,7 @@ wayland_create_drm_display(struct wl_display *dpy,
return NULL;
}
- if (!wayland_drm_display_init_screen(&drmdpy->base.base)) {
- wayland_drm_display_destroy(&drmdpy->base.base);
- return NULL;
- }
+ drmdpy->base.base.init_screen = wayland_drm_display_init_screen;
drmdpy->base.base.destroy = wayland_drm_display_destroy;
drmdpy->base.base.buffer = &wayland_drm_display_buffer;
drmdpy->base.base.wayland_bufmgr = &wayland_drm_display_wayland_bufmgr;
diff --git a/src/gallium/state_trackers/egl/wayland/native_shm.c b/src/gallium/state_trackers/egl/wayland/native_shm.c
index 8614a761abf..1c0799528fe 100644
--- a/src/gallium/state_trackers/egl/wayland/native_shm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_shm.c
@@ -47,7 +47,7 @@
struct wayland_shm_display {
struct wayland_display base;
- struct native_event_handler *event_handler;
+ const struct native_event_handler *event_handler;
struct wl_shm *wl_shm;
};
@@ -144,8 +144,7 @@ wayland_shm_display_init_screen(struct native_display *ndpy)
struct wayland_display *
wayland_create_shm_display(struct wl_display *dpy,
- struct native_event_handler *event_handler,
- void *user_data)
+ const struct native_event_handler *event_handler)
{
struct wayland_shm_display *shmdpy;
@@ -154,7 +153,6 @@ wayland_create_shm_display(struct wl_display *dpy,
return NULL;
shmdpy->event_handler = event_handler;
- shmdpy->base.base.user_data = user_data;
shmdpy->base.dpy = dpy;
if (!shmdpy->base.dpy) {
@@ -162,11 +160,7 @@ wayland_create_shm_display(struct wl_display *dpy,
return NULL;
}
- if (!wayland_shm_display_init_screen(&shmdpy->base.base)) {
- wayland_shm_display_destroy(&shmdpy->base.base);
- return NULL;
- }
-
+ shmdpy->base.base.init_screen = wayland_shm_display_init_screen;
shmdpy->base.base.destroy = wayland_shm_display_destroy;
shmdpy->base.create_buffer = wayland_create_shm_buffer;
diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.c b/src/gallium/state_trackers/egl/wayland/native_wayland.c
index f183538e7b6..0672c543bc3 100644
--- a/src/gallium/state_trackers/egl/wayland/native_wayland.c
+++ b/src/gallium/state_trackers/egl/wayland/native_wayland.c
@@ -35,7 +35,7 @@
#include "native_wayland.h"
-static struct native_event_handler *wayland_event_handler;
+static const struct native_event_handler *wayland_event_handler;
static void
sync_callback(void *data)
@@ -447,14 +447,8 @@ wayland_create_window_surface(struct native_display *ndpy,
return &surface->base;
}
-static void
-native_set_event_handler(struct native_event_handler *event_handler)
-{
- wayland_event_handler = event_handler;
-}
-
static struct native_display *
-native_create_display(void *dpy, boolean use_sw, void *user_data)
+native_create_display(void *dpy, boolean use_sw)
{
struct wayland_display *display = NULL;
boolean own_dpy = FALSE;
@@ -471,12 +465,10 @@ native_create_display(void *dpy, boolean use_sw, void *user_data)
if (use_sw) {
_eglLog(_EGL_INFO, "use software fallback");
display = wayland_create_shm_display((struct wl_display *) dpy,
- wayland_event_handler,
- user_data);
+ wayland_event_handler);
} else {
display = wayland_create_drm_display((struct wl_display *) dpy,
- wayland_event_handler,
- user_data);
+ wayland_event_handler);
}
if (!display)
@@ -495,13 +487,13 @@ native_create_display(void *dpy, boolean use_sw, void *user_data)
static const struct native_platform wayland_platform = {
"wayland", /* name */
- native_set_event_handler,
native_create_display
};
const struct native_platform *
-native_get_wayland_platform(void)
+native_get_wayland_platform(const struct native_event_handler *event_handler)
{
+ wayland_event_handler = event_handler;
return &wayland_platform;
}
diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.h b/src/gallium/state_trackers/egl/wayland/native_wayland.h
index 81c7a8b4840..5390f2f08c9 100644
--- a/src/gallium/state_trackers/egl/wayland/native_wayland.h
+++ b/src/gallium/state_trackers/egl/wayland/native_wayland.h
@@ -103,11 +103,10 @@ wayland_config(const struct native_config *nconf)
struct wayland_display *
wayland_create_shm_display(struct wl_display *display,
- struct native_event_handler *event_handler,
- void *user_data);
+ const struct native_event_handler *event_handler);
+
struct wayland_display *
wayland_create_drm_display(struct wl_display *display,
- struct native_event_handler *event_handler,
- void *user_data);
+ const struct native_event_handler *event_handler);
#endif /* _NATIVE_WAYLAND_H_ */