From f66a4e20c19d55005854bbee312947ec16e287e3 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 17 Jun 2010 23:21:43 +0800 Subject: st/egl: Introduce native_platform. Move native_get_name, native_create_probe, native_get_probe_result, and native_create_display into struct native_platform, and add native_get_platform to get a handle to the struct. --- src/gallium/state_trackers/egl/x11/native_x11.c | 45 ++++++++++++++++--------- 1 file changed, 30 insertions(+), 15 deletions(-) (limited to 'src/gallium/state_trackers/egl/x11') diff --git a/src/gallium/state_trackers/egl/x11/native_x11.c b/src/gallium/state_trackers/egl/x11/native_x11.c index 6f1e599873..6c0201c26f 100644 --- a/src/gallium/state_trackers/egl/x11/native_x11.c +++ b/src/gallium/state_trackers/egl/x11/native_x11.c @@ -44,8 +44,8 @@ x11_probe_destroy(struct native_probe *nprobe) FREE(nprobe); } -struct native_probe * -native_create_probe(void *dpy) +static struct native_probe * +x11_create_probe(void *dpy) { struct native_probe *nprobe; struct x11_screen *xscr; @@ -89,8 +89,8 @@ native_create_probe(void *dpy) return nprobe; } -enum native_probe_result -native_get_probe_result(struct native_probe *nprobe) +static enum native_probe_result +x11_get_probe_result(struct native_probe *nprobe) { if (!nprobe || nprobe->magic != X11_PROBE_MAGIC) return NATIVE_PROBE_UNKNOWN; @@ -106,17 +106,7 @@ native_get_probe_result(struct native_probe *nprobe) return NATIVE_PROBE_EXACT; } -const char * -native_get_name(void) -{ - static char x11_name[32]; - - util_snprintf(x11_name, sizeof(x11_name), "X11/%s", driver_descriptor.name); - - return x11_name; -} - -struct native_display * +static struct native_display * native_create_display(void *dpy, struct native_event_handler *event_handler) { struct native_display *ndpy = NULL; @@ -139,3 +129,28 @@ native_create_display(void *dpy, struct native_event_handler *event_handler) return ndpy; } + +static void +x11_init_platform(struct native_platform *nplat) +{ + static char x11_name[32]; + + if (nplat->name) + return; + + util_snprintf(x11_name, sizeof(x11_name), "X11/%s", driver_descriptor.name); + + nplat->name = x11_name; + nplat->create_probe = x11_create_probe; + nplat->get_probe_result = x11_get_probe_result; + nplat->create_display = native_create_display; +} + +static struct native_platform x11_platform; + +const struct native_platform * +native_get_platform(void) +{ + x11_init_platform(&x11_platform); + return &x11_platform; +} -- cgit v1.2.3