[waffle] [PATCH 07/12] waffle: support platform-specific information

Frank Henigman fjhenigman at google.com
Wed Jan 6 11:56:36 PST 2016


Add a platform hook so platform-specific information can be included
by waffle_display_info_json().

Signed-off-by: Frank Henigman <fjhenigman at google.com>
---
 src/waffle/api/waffle_display.c  | 10 +++++++++-
 src/waffle/core/wcore_platform.h |  4 ++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/waffle/api/waffle_display.c b/src/waffle/api/waffle_display.c
index 7abe2ef..d6988ac 100644
--- a/src/waffle/api/waffle_display.c
+++ b/src/waffle/api/waffle_display.c
@@ -367,8 +367,16 @@ waffle_display_info_json(struct waffle_display *self, bool platform_too)
 
     json_appendv(jj, "{", "generic", "{", "");
     add_generic_info(jj, wc_self->current_context);
-    json_appendv(jj, "}", "}", "");
+    json_append(jj, "}");
 
+    if (platform_too) {
+        json_appendv(jj, "platform", "{", "");
+        if (api_platform->vtbl->display.info_json)
+            api_platform->vtbl->display.info_json(wc_self, jj);
+        json_append(jj, "}");
+    }
+
+    json_append(jj, "}");
     return json_destroy(jj);
 }
 
diff --git a/src/waffle/core/wcore_platform.h b/src/waffle/core/wcore_platform.h
index 30d1c6c..9e890c1 100644
--- a/src/waffle/core/wcore_platform.h
+++ b/src/waffle/core/wcore_platform.h
@@ -30,6 +30,7 @@
 #include <stdint.h>
 #include "c99_compat.h"
 
+struct json;
 struct wcore_config;
 struct wcore_config_attrs;
 struct wcore_context;
@@ -77,6 +78,9 @@ struct wcore_platform_vtbl {
                 struct wcore_display *display,
                 int32_t context_api);
 
+        void
+        (*info_json)(struct wcore_display *display, struct json *);
+
         /// May be null.
         union waffle_native_display*
         (*get_native)(struct wcore_display *display);
-- 
2.6.0.rc2.230.g3dd15c0



More information about the waffle mailing list