-
-
Save aperezdc/f6a65a95f2baa222c0ce9d65e516e13b to your computer and use it in GitHub Desktop.
/* | |
* SPDX-License-Identifier: MIT | |
* | |
* cc -o minicog minicog.c $(pkg-config wpe-webkit-1.1 cogcore --cflags --libs) | |
*/ | |
#include <cog/cog.h> | |
static const char *s_starturl = NULL; | |
static WebKitWebView* | |
on_create_view(CogShell *shell, CogPlatform *platform) | |
{ | |
g_autoptr(GError) error = NULL; | |
WebKitWebViewBackend *view_backend = cog_platform_get_view_backend(platform, NULL, &error); | |
if (!view_backend) | |
g_error("Cannot obtain view backend: %s", error->message); | |
g_autoptr(WebKitWebView) web_view = | |
g_object_new(WEBKIT_TYPE_WEB_VIEW, | |
"settings", cog_shell_get_web_settings(shell), | |
"web-context", cog_shell_get_web_context(shell), | |
"backend", view_backend, | |
NULL); | |
cog_platform_init_web_view(platform, web_view); | |
webkit_web_view_load_uri(web_view, s_starturl); | |
return g_steal_pointer(&web_view); | |
} | |
int | |
main(int argc, char *argv[]) | |
{ | |
g_set_application_name("minicog"); | |
if (argc != 2 && argc != 3) { | |
g_printerr("Usage: %s [URL [platform]]\n", argv[0]); | |
return EXIT_FAILURE; | |
} | |
g_autoptr(GError) error = NULL; | |
if (!(s_starturl = cog_uri_guess_from_user_input(argv[1], TRUE, &error))) | |
g_error("Invalid URL '%s': %s", argv[1], error->message); | |
cog_modules_add_directory(COG_MODULEDIR); | |
g_autoptr(GApplication) app = g_application_new(NULL, G_APPLICATION_DEFAULT_FLAGS); | |
g_autoptr(CogShell) shell = cog_shell_new("minicog", FALSE); | |
g_autoptr(CogPlatform) platform = | |
cog_platform_new((argc == 3) ? argv[2] : g_getenv("COG_PLATFORM"), &error); | |
if (!platform) | |
g_error("Cannot create platform: %s", error->message); | |
if (!cog_platform_setup(platform, shell, "", &error)) | |
g_error("Cannot setup platform: %s\n", error->message); | |
g_signal_connect(shell, "create-view", G_CALLBACK(on_create_view), platform); | |
g_signal_connect_swapped(app, "shutdown", G_CALLBACK(cog_shell_shutdown), shell); | |
g_signal_connect_swapped(app, "startup", G_CALLBACK(cog_shell_startup), shell); | |
g_signal_connect(app, "activate", G_CALLBACK(g_application_hold), NULL); | |
return g_application_run(app, 1, argv); | |
} |
Thanks for replying.
Do you pass anything after the
-P
? I suppose you use-P drm
.
I do, indeed, pass drm
after -P
. Typing too fast here.
Things should work the same in theory, because this sample application reused
libcogcore.so
and its plug-ins. Could you run the same command addingG_MESSAGES_DEBUG
in the environment to get some debug logging? Like this:G_MESSAGES_DEBUG='Cog-Core Cog-DRM' ./app index.html drm
I finally have time to look back at this; first off, there are a few things that seem to have disappeared in the version of libcogcore (12.0.0, cog version 0.19.1) i'm using.
The following are undefined:
cog_shell_shutdown
cog_shell_startup
cog_platform_new
So i commented out the two lines with g_signal_connect_swapped
and replaced the call to cog_platform_new
with:
cog_init((argc == 3) ? argv[2] : g_getenv("COG_PLATFORM"), NULL);
g_autoptr(CogPlatform) platform = cog_platform_get();
Now, running :
G_MESSAGES_DEBUG='Cog-Core Cog-DRM' ./app index.html drm
gives :
(process:20882): Cog-Core-DEBUG: 12:02:42.752: ensure_extension_points: Extension points registered.
(process:20882): Cog-Core-DEBUG: 12:02:42.753: cog_modules_add_directory: Scanning '/usr/lib/cog/modules'
(process:20882): Cog-Core-DEBUG: 12:02:42.780: cog_modules_add_directory: Default path already added, skipping.
(process:20882): Cog-Core-DEBUG: 12:02:42.780: cog_modules_add_directory: Default path already added, skipping.
(process:20882): Cog-Core-DEBUG: 12:02:42.780: ensure_builtin_types: Built-in platform types initialized.
(process:20882): Cog-Core-DEBUG: 12:02:42.780: cog_modules_add_directory: Default path already added, skipping.
(process:20882): Cog-Core-DEBUG: 12:02:42.789: cog_platform_ensure_singleton: drm requested, CogDrmPlatform chosen.
(process:20882): Cog-DRM-DEBUG: 12:02:42.789: init_config: overriding device_scale value, using 0.00 from shell
(process:20882): Cog-DRM-DEBUG: 12:02:42.790: init_drm: enumerated device 0x5ed0d8, available_nodes 5
(process:20882): Cog-DRM-DEBUG: 12:02:42.790: init_drm: DRM_NODE_PRIMARY: /dev/dri/card0
(process:20882): Cog-DRM-DEBUG: 12:02:42.790: init_drm: DRM_NODE_RENDER: /dev/dri/renderD128
(process:20882): Cog-DRM-DEBUG: 12:02:42.790: init_drm: using device 0x5ed0d8, DRM_NODE_PRIMARY /dev/dri/card0
(process:20882): Cog-DRM-DEBUG: 12:02:42.790: init_drm: 1 connectors available
(process:20882): Cog-DRM-DEBUG: 12:02:42.818: init_drm: connector id 89, type 11, connected, 44 usable modes
(process:20882): Cog-DRM-DEBUG: 12:02:42.818: init_drm: [0]: '1920x1080', 1920x1080@60, flags 5, type 72 (preferred)
(process:20882): Cog-DRM-DEBUG: 12:02:42.819: init_drm: [1]: '1920x1080', 1920x1080@60, flags 1048581, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.819: init_drm: [2]: '1920x1080', 1920x1080@60, flags 1048581, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.819: init_drm: [3]: '1920x1080i', 1920x1080@60, flags 1048597, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.819: init_drm: [4]: '1920x1080i', 1920x1080@60, flags 1048597, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.819: init_drm: [5]: '1920x1080', 1920x1080@50, flags 5, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.819: init_drm: [6]: '1920x1080', 1920x1080@50, flags 1048581, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.819: init_drm: [7]: '1920x1080i', 1920x1080@50, flags 21, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.819: init_drm: [8]: '1920x1080i', 1920x1080@50, flags 1048597, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.820: init_drm: [9]: '1600x1200', 1600x1200@60, flags 5, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.820: init_drm: [10]: '1680x1050', 1680x1050@60, flags 9, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.820: init_drm: [11]: '1280x1024', 1280x1024@75, flags 5, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.820: init_drm: [12]: '1280x1024', 1280x1024@60, flags 5, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.820: init_drm: [13]: '1440x900', 1440x900@60, flags 9, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.820: init_drm: [14]: '1280x960', 1280x960@60, flags 5, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.820: init_drm: [15]: '1152x864', 1152x864@75, flags 5, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.820: init_drm: [16]: '1280x720', 1280x720@60, flags 1048581, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.820: init_drm: [17]: '1280x720', 1280x720@60, flags 1048581, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.820: init_drm: [18]: '1280x720', 1280x720@50, flags 5, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.820: init_drm: [19]: '1280x720', 1280x720@50, flags 1048581, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.821: init_drm: [20]: '1152x720', 1152x720@60, flags 6, type 0
(process:20882): Cog-DRM-DEBUG: 12:02:42.821: init_drm: [21]: '1024x768', 1024x768@75, flags 5, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.821: init_drm: [22]: '1024x768', 1024x768@60, flags 10, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.821: init_drm: [23]: '832x624', 832x624@75, flags 10, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.821: init_drm: [24]: '800x600', 800x600@75, flags 5, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.821: init_drm: [25]: '800x600', 800x600@60, flags 5, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.821: init_drm: [26]: '720x576', 720x576@50, flags 10, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.821: init_drm: [27]: '720x576', 720x576@50, flags 524298, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.821: init_drm: [28]: '720x576', 720x576@50, flags 1048586, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.821: init_drm: [29]: '720x576i', 720x576@50, flags 528410, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.821: init_drm: [30]: '720x576i', 720x576@50, flags 1052698, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.821: init_drm: [31]: '720x480', 720x480@60, flags 1048586, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.821: init_drm: [32]: '720x480', 720x480@60, flags 524298, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.821: init_drm: [33]: '720x480', 720x480@60, flags 1048586, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.821: init_drm: [34]: '720x480', 720x480@60, flags 524298, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.822: init_drm: [35]: '720x480i', 720x480@60, flags 528410, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.822: init_drm: [36]: '720x480i', 720x480@60, flags 1052698, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.822: init_drm: [37]: '720x480i', 720x480@60, flags 528410, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.822: init_drm: [38]: '720x480i', 720x480@60, flags 1052698, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.822: init_drm: [39]: '640x480', 640x480@75, flags 10, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.822: init_drm: [40]: '640x480', 640x480@60, flags 524298, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.822: init_drm: [41]: '640x480', 640x480@60, flags 10, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.822: init_drm: [42]: '640x480', 640x480@60, flags 524298, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.822: init_drm: [43]: '720x400', 720x400@70, flags 6, type 64
(process:20882): Cog-DRM-DEBUG: 12:02:42.850: init_drm: using connector id 89, type 11
(process:20882): Cog-DRM-DEBUG: 12:02:42.850: init_drm: using mode [0] '1920x1080' @ 60Hz
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libEGL warning: Unrecognized EGL_LOG_LEVEL environment variable value. Expected one of "fatal", "warning", "info", "debug". Got "". Falling back to "warning".
(process:20882): Cog-DRM-DEBUG: 12:02:42.932: cog_drm_modeset_renderer_new: Capability addfb2_modifiers = 0x1
(process:20882): Cog-DRM-DEBUG: 12:02:42.932: cog_drm_modeset_renderer_new: Using plane #31, crtc #87, connector #89 (atomic).
(process:20882): Cog-DRM-WARNING **: 12:02:42.932: Renderer 'modeset' does not support rotation 0 (0 degrees).
(process:20882): Cog-DRM-DEBUG: 12:02:42.951: cog_drm_platform_setup: Renderer 'modeset' initialized.
(process:20882): Cog-Core-DEBUG: 12:02:42.951: gamepad setup: none
(process:20882): GLib-GObject-CRITICAL **: 12:02:42.951: /usr/src/debug/glib-2.0/2.78.6/gobject/gsignal.c:2625: signal 'create-view' is invalid for instance '0x5e7578' of type 'CogShell'
Commenting out the line that connect the signal for create-view
doesn't fix it; it only make the critical message disappear.
Do you pass anything after the
-P
? I suppose you use-P drm
.Things should work the same in theory, because this sample application reused
libcogcore.so
and its plug-ins. Could you run the same command addingG_MESSAGES_DEBUG
in the environment to get some debug logging? Like this:G_MESSAGES_DEBUG='Cog-Core Cog-DRM' ./app index.html drm