diff options
author | Frank Henigman <fjhenigman@gmail.com> | 2014-12-30 13:27:47 -0500 |
---|---|---|
committer | Chad Versace <chad.versace@intel.com> | 2015-03-27 11:31:43 -0700 |
commit | 9534ac74657f15c810c7ff357001334dd7e7f265 (patch) | |
tree | 02d7fc5ff3f70d00a7888f546134875ae6eb28ea | |
parent | 1c6ca09a0c1aa141370c4aa4e86a6552db56b199 (diff) | |
download | waffle-pu.tar.gz |
wflinfo: show platform-specific informationpu
Add waffle_display_print_info() which calls a new display struct member
function "print_info" to print platform-specific information, such as
glx or egl version and extensions.
Call this new function from wflinfo when the -s flag is given.
Gbm, glx and x11_egl platforms supported so far.
-rw-r--r-- | include/waffle/waffle.h | 3 | ||||
-rw-r--r-- | src/utils/wflinfo.c | 2 | ||||
-rw-r--r-- | src/waffle/api/waffle_display.c | 20 | ||||
-rw-r--r-- | src/waffle/core/wcore_platform.h | 5 | ||||
-rw-r--r-- | src/waffle/egl/wegl_display.c | 27 | ||||
-rw-r--r-- | src/waffle/egl/wegl_display.h | 4 | ||||
-rw-r--r-- | src/waffle/egl/wegl_platform.h | 3 | ||||
-rw-r--r-- | src/waffle/gbm/wgbm_platform.c | 1 | ||||
-rw-r--r-- | src/waffle/glx/glx_display.c | 32 | ||||
-rw-r--r-- | src/waffle/glx/glx_display.h | 4 | ||||
-rw-r--r-- | src/waffle/glx/glx_platform.c | 4 | ||||
-rw-r--r-- | src/waffle/glx/glx_platform.h | 3 | ||||
-rw-r--r-- | src/waffle/xegl/xegl_platform.c | 1 |
13 files changed, 106 insertions, 3 deletions
diff --git a/include/waffle/waffle.h b/include/waffle/waffle.h index 297a487..c08610c 100644 --- a/include/waffle/waffle.h +++ b/include/waffle/waffle.h @@ -213,6 +213,9 @@ bool waffle_display_supports_context_api(struct waffle_display *self, int32_t context_api); +bool +waffle_display_print_info(struct waffle_display *self, bool verbose); + union waffle_native_display* waffle_display_get_native(struct waffle_display *self); diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c index 57ec9d2..8dfead5 100644 --- a/src/utils/wflinfo.c +++ b/src/utils/wflinfo.c @@ -1134,7 +1134,7 @@ main(int argc, char **argv) error_waffle(); if (opts.specific) { - //TODO print platform-specific information + waffle_display_print_info(dpy, opts.verbose); } ok = waffle_make_current(dpy, NULL, NULL); diff --git a/src/waffle/api/waffle_display.c b/src/waffle/api/waffle_display.c index fa19462..3eaf57e 100644 --- a/src/waffle/api/waffle_display.c +++ b/src/waffle/api/waffle_display.c @@ -90,6 +90,26 @@ waffle_display_supports_context_api( context_api); } +WAFFLE_API bool +waffle_display_print_info(struct waffle_display *self, bool verbose) +{ + struct wcore_display *wc_self = wcore_display(self); + + const struct api_object *obj_list[] = { + wc_self ? &wc_self->api : NULL, + }; + + if (!api_check_entry(obj_list, 1)) + return false; + + if (api_platform->vtbl->display.print_info) { + return api_platform->vtbl->display.print_info(wc_self, verbose); + } + + wcore_error(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM); + return false; +} + WAFFLE_API union waffle_native_display* waffle_display_get_native(struct waffle_display *self) { diff --git a/src/waffle/core/wcore_platform.h b/src/waffle/core/wcore_platform.h index 780d07a..a96bf8b 100644 --- a/src/waffle/core/wcore_platform.h +++ b/src/waffle/core/wcore_platform.h @@ -77,6 +77,11 @@ struct wcore_platform_vtbl { struct wcore_display *display, int32_t context_api); + bool + (*print_info)( + struct wcore_display *display, + bool verbose); + /// May be null. union waffle_native_display* (*get_native)(struct wcore_display *display); diff --git a/src/waffle/egl/wegl_display.c b/src/waffle/egl/wegl_display.c index 88fce7a..587ef30 100644 --- a/src/waffle/egl/wegl_display.c +++ b/src/waffle/egl/wegl_display.c @@ -24,6 +24,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <assert.h> +#include <stdio.h> #include "wcore_error.h" #include "wcore_platform.h" @@ -63,7 +64,6 @@ wegl_display_init(struct wegl_display *dpy, { struct wegl_platform *plat = wegl_platform(wc_plat); bool ok; - EGLint major, minor; ok = wcore_display_init(&dpy->wcore, wc_plat); if (!ok) @@ -75,7 +75,7 @@ wegl_display_init(struct wegl_display *dpy, goto fail; } - ok = plat->eglInitialize(dpy->egl, &major, &minor); + ok = plat->eglInitialize(dpy->egl, &plat->major, &plat->minor); if (!ok) { wegl_emit_error(plat, "eglInitialize"); goto fail; @@ -139,3 +139,26 @@ wegl_display_supports_context_api(struct wcore_display *wc_dpy, return wc_plat->vtbl->dl_can_open(wc_plat, waffle_dl); } + +bool +wegl_display_print_info(struct wcore_display *wc_dpy, + bool verbose) +{ + struct wegl_display *dpy = wegl_display(wc_dpy); + struct wegl_platform *plat = wegl_platform(dpy->wcore.platform); + + printf("EGL API version: %d.%d\n", + plat->major, plat->minor); + printf("EGL vendor string: %s\n", + plat->eglQueryString(dpy->egl, EGL_VENDOR)); + printf("EGL version string: %s\n", + plat->eglQueryString(dpy->egl, EGL_VERSION)); +#ifdef EGL_VERSION_1_2 + printf("EGL client APIs: %s\n", + plat->eglQueryString(dpy->egl, EGL_CLIENT_APIS)); +#endif + printf("EGL extensions string: %s\n", + plat->eglQueryString(dpy->egl, EGL_EXTENSIONS)); + + return true; +} diff --git a/src/waffle/egl/wegl_display.h b/src/waffle/egl/wegl_display.h index 43b83ef..c69fabd 100644 --- a/src/waffle/egl/wegl_display.h +++ b/src/waffle/egl/wegl_display.h @@ -56,3 +56,7 @@ wegl_display_teardown(struct wegl_display *dpy); bool wegl_display_supports_context_api(struct wcore_display *wc_dpy, int32_t waffle_context_api); + +bool +wegl_display_print_info(struct wcore_display *wc_self, + bool verbose); diff --git a/src/waffle/egl/wegl_platform.h b/src/waffle/egl/wegl_platform.h index 645c3f8..4907757 100644 --- a/src/waffle/egl/wegl_platform.h +++ b/src/waffle/egl/wegl_platform.h @@ -33,6 +33,9 @@ struct wegl_platform { struct wcore_platform wcore; + // EGL version from eglInitialize + EGLint major, minor; + // EGL function pointers void *eglHandle; diff --git a/src/waffle/gbm/wgbm_platform.c b/src/waffle/gbm/wgbm_platform.c index 981c366..7bb84e9 100644 --- a/src/waffle/gbm/wgbm_platform.c +++ b/src/waffle/gbm/wgbm_platform.c @@ -179,6 +179,7 @@ static const struct wcore_platform_vtbl wgbm_platform_vtbl = { .destroy = wgbm_display_destroy, .supports_context_api = wegl_display_supports_context_api, .get_native = wgbm_display_get_native, + .print_info = wegl_display_print_info, }, .config = { diff --git a/src/waffle/glx/glx_display.c b/src/waffle/glx/glx_display.c index 567d442..1800384 100644 --- a/src/waffle/glx/glx_display.c +++ b/src/waffle/glx/glx_display.c @@ -23,6 +23,7 @@ // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include <stdio.h> #include <stdlib.h> #include "wcore_error.h" @@ -141,6 +142,37 @@ glx_display_supports_context_api(struct wcore_display *wc_self, } } +bool +glx_display_print_info(struct wcore_display *wc_self, + bool verbose) +{ + struct glx_display *self = glx_display(wc_self); + struct glx_platform *plat = glx_platform(wc_self->platform); + + int major, minor; + if (!plat->glXQueryVersion(self->x11.xlib, &major, &minor)) { + return false; + } + + printf("server glx vendor string: %s\n", + plat->glXQueryServerString(self->x11.xlib, self->x11.screen, GLX_VENDOR)); + printf("server glx version string: %s\n", + plat->glXQueryServerString(self->x11.xlib, self->x11.screen, GLX_VERSION)); + printf("server glx extensions: %s\n", + plat->glXQueryServerString(self->x11.xlib, self->x11.screen, GLX_EXTENSIONS)); + printf("client glx vendor string: %s\n", + plat->glXGetClientString(self->x11.xlib, GLX_VENDOR)); + printf("client glx version string: %s\n", + plat->glXGetClientString(self->x11.xlib, GLX_VERSION)); + printf("client glx extensions: %s\n", + plat->glXGetClientString(self->x11.xlib, GLX_EXTENSIONS)); + printf("GLX version: %d.%d\n", major, minor); + printf("GLX extensions: %s\n", + plat->glXQueryExtensionsString(self->x11.xlib, self->x11.screen)); + + return true; +} + union waffle_native_display* glx_display_get_native(struct wcore_display *wc_self) { diff --git a/src/waffle/glx/glx_display.h b/src/waffle/glx/glx_display.h index 4b8f687..fd9f83b 100644 --- a/src/waffle/glx/glx_display.h +++ b/src/waffle/glx/glx_display.h @@ -66,5 +66,9 @@ bool glx_display_supports_context_api(struct wcore_display *wc_self, int32_t context_api); +bool +glx_display_print_info(struct wcore_display *wc_self, + bool verbose); + union waffle_native_display* glx_display_get_native(struct wcore_display *wc_self); diff --git a/src/waffle/glx/glx_platform.c b/src/waffle/glx/glx_platform.c index 4fb2eed..7d22d4e 100644 --- a/src/waffle/glx/glx_platform.c +++ b/src/waffle/glx/glx_platform.c @@ -105,6 +105,9 @@ glx_platform_create(void) RETRIEVE_GLX_SYMBOL(glXMakeCurrent); RETRIEVE_GLX_SYMBOL(glXQueryExtensionsString); + RETRIEVE_GLX_SYMBOL(glXQueryServerString); + RETRIEVE_GLX_SYMBOL(glXQueryVersion); + RETRIEVE_GLX_SYMBOL(glXGetClientString); RETRIEVE_GLX_SYMBOL(glXGetProcAddress); RETRIEVE_GLX_SYMBOL(glXGetVisualFromFBConfig); @@ -186,6 +189,7 @@ static const struct wcore_platform_vtbl glx_platform_vtbl = { .connect = glx_display_connect, .destroy = glx_display_destroy, .supports_context_api = glx_display_supports_context_api, + .print_info = glx_display_print_info, .get_native = glx_display_get_native, }, diff --git a/src/waffle/glx/glx_platform.h b/src/waffle/glx/glx_platform.h index 36ddff6..aefc0ee 100644 --- a/src/waffle/glx/glx_platform.h +++ b/src/waffle/glx/glx_platform.h @@ -47,6 +47,9 @@ struct glx_platform { Bool (*glXMakeCurrent)(Display *dpy, GLXDrawable drawable, GLXContext ctx); const char *(*glXQueryExtensionsString)(Display *dpy, int screen); + const char *(*glXQueryServerString)(Display *dpy, int screen, int name); + const char *(*glXQueryVersion)(Display *dpy, int *major, int *minor); + const char *(*glXGetClientString)(Display *dpy, int name); void *(*glXGetProcAddress)(const GLubyte *procname); XVisualInfo *(*glXGetVisualFromFBConfig)(Display *dpy, GLXFBConfig config); diff --git a/src/waffle/xegl/xegl_platform.c b/src/waffle/xegl/xegl_platform.c index e36a41b..6ffe8ec 100644 --- a/src/waffle/xegl/xegl_platform.c +++ b/src/waffle/xegl/xegl_platform.c @@ -152,6 +152,7 @@ static const struct wcore_platform_vtbl xegl_platform_vtbl = { .connect = xegl_display_connect, .destroy = xegl_display_destroy, .supports_context_api = wegl_display_supports_context_api, + .print_info = wegl_display_print_info, .get_native = xegl_display_get_native, }, |