diff options
author | Chia-I Wu <olv@lunarg.com> | 2010-06-17 23:21:43 +0800 |
---|---|---|
committer | Chia-I Wu <olv@lunarg.com> | 2010-06-29 17:16:19 +0800 |
commit | f66a4e20c19d55005854bbee312947ec16e287e3 (patch) | |
tree | a8d4450952da24dd3a7f7e14965a28dcea86c677 /src/gallium/state_trackers/egl/kms | |
parent | f9574c5f890f3205efa4ab4ff509223e2a7c6b74 (diff) |
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.
Diffstat (limited to 'src/gallium/state_trackers/egl/kms')
-rw-r--r-- | src/gallium/state_trackers/egl/kms/native_kms.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/gallium/state_trackers/egl/kms/native_kms.c b/src/gallium/state_trackers/egl/kms/native_kms.c index 09a08f32b3..8ee80996a4 100644 --- a/src/gallium/state_trackers/egl/kms/native_kms.c +++ b/src/gallium/state_trackers/egl/kms/native_kms.c @@ -768,37 +768,40 @@ kms_create_display(int fd, struct native_event_handler *event_handler) return &kdpy->base; } -struct native_probe * -native_create_probe(void *dpy) +static struct native_display * +native_create_display(void *dpy, struct native_event_handler *event_handler) { - return NULL; -} + struct native_display *ndpy; + int fd; -enum native_probe_result -native_get_probe_result(struct native_probe *nprobe) -{ - return NATIVE_PROBE_UNKNOWN; + /* well, this makes fd 0 being ignored */ + fd = (dpy) ? (int) pointer_to_intptr(dpy) : -1; + ndpy = kms_create_display(fd, event_handler); + + return ndpy; } -const char * -native_get_name(void) +static void +kms_init_platform(struct native_platform *nplat) { static char kms_name[32]; + if (nplat->name) + return; util_snprintf(kms_name, sizeof(kms_name), "KMS/%s", driver_descriptor.name); - return kms_name; + nplat->name = kms_name; + nplat->create_probe = NULL; + nplat->get_probe_result = NULL; + nplat->create_display = native_create_display; } -struct native_display * -native_create_display(void *dpy, struct native_event_handler *event_handler) -{ - struct native_display *ndpy = NULL; - int fd; - - fd = (dpy != EGL_DEFAULT_DISPLAY) ? (int) pointer_to_intptr((void *) dpy) : -1; - ndpy = kms_create_display(fd, event_handler); +static struct native_platform kms_platform; - return ndpy; +const struct native_platform * +native_get_platform(void) +{ + kms_init_platform(&kms_platform); + return &kms_platform; } |