2
#include "fbdev_window.h"
11
#include <eglplatformcommon.h>
14
static int inited = 0;
15
static gralloc_module_t *gralloc = 0;
16
static framebuffer_device_t *framebuffer = 0;
17
static alloc_device_t *alloc = 0;
19
extern "C" int fbdevws_IsValidDisplay(EGLNativeDisplayType display)
21
if (__sync_fetch_and_add(&inited,1)==0)
24
err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (const hw_module_t **) &gralloc);
26
fprintf(stderr, "failed to get gralloc module: (%s)\n",strerror(-err));
30
err = framebuffer_open((hw_module_t *) gralloc, &framebuffer);
32
fprintf(stderr, "ERROR: failed to open framebuffer: (%s)\n",strerror(-err));
35
printf("** framebuffer_open: status=(%s) format=x%x", strerror(-err), framebuffer->format);
37
err = gralloc_open((const hw_module_t *) gralloc, &alloc);
39
fprintf(stderr, "ERROR: failed to open gralloc: (%s)\n",strerror(-err));
42
printf("** gralloc_open %p status=%s\n", gralloc, strerror(-err));
43
eglplatformcommon_init(gralloc);
46
return display == EGL_DEFAULT_DISPLAY;
49
extern "C" EGLNativeWindowType fbdevws_CreateWindow(EGLNativeWindowType win, EGLNativeDisplayType display)
52
return (EGLNativeWindowType) *(new FbDevNativeWindow(gralloc, alloc, framebuffer));
55
extern "C" __eglMustCastToProperFunctionPointerType fbdevws_eglGetProcAddress(const char *procname)
57
return eglplatformcommon_eglGetProcAddress(procname);
60
extern "C" void fbdevws_passthroughImageKHR(EGLenum *target, EGLClientBuffer *buffer)
62
eglplatformcommon_passthroughImageKHR(target, buffer);
65
struct ws_module ws_module_info = {
66
fbdevws_IsValidDisplay,
68
fbdevws_eglGetProcAddress,
69
fbdevws_passthroughImageKHR,
70
eglplatformcommon_eglQueryString
73
// vim:ts=4:sw=4:noexpandtab