From 1a948f71d5e9a66f9041ad31470d79366dec7092 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Thu, 20 Jun 2019 11:29:57 +0800 Subject: [PATCH] describe support for DRI and extra input messages --- RELEASE-NOTES.md | 155 +++++++++++++++++++++++++++++++++++++- src/newgal/drm/drmvideo.c | 6 +- 2 files changed, 157 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 7ed547f5..c93c0c8f 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -259,10 +259,163 @@ the glyph orientation: - 'D': Glyphs are upside-down. - 'L': Glyphs are rotated 90 degrees counter-clockwise (sideways left). -#### Support for DRM +#### Support for Linux DRI + +In order to support modern graphics cards or GPU, we introduced a +new NEWGAL engine of `drm`. The developer can use this engine to +run MiniGUI apps on a Linux box on which the DRI +(Direct Rendering Infrastructure) is enabled. + +The `drm` engine uses `libdrm` developed by Free Desktop project: + +https://dri.freedesktop.org/wiki/ + +Libdrm is a user-space library implements the Direct Rendering Manager. +MiniGUI mainly uses this library to support the dumb frame buffer +(no hardware acceleration). + +In order to support the hardware acceleration, you need to write some +code for your graphics card or GPU as a sub driver of `drm` engine +outside MiniGUI. + +In this situation, you need to configure MiniGUI with the following +option: + + --with-targetname=external + +and implement the sub driver in your MiniGUI apps. + +The header file `` defines the operators (a set of +callback functions) you need to implement for your GPU externally. + +As an example, we implement the sub driver for `i915` graphics chard +in `mg-tests/drm-extra-input/`. Please refer to `mg-tests` repository. + +To exploit the GPU's accelerated rendering capabilities, a MiniGUI app +can use `cairo` and/or `OpenGL ES` to assist in rendering 2D/3D graphics +when using the `drm` engine. We will provide some samples in `mg-tests` +or `mg-samples` for this purpose. + +Note that for `drm` engine, we introduce a new section in MiniGUI runtime +configuration: + +``` +[drm] +defaultmode=1024x768-32bpp +device=/dev/dri/card0 +dpi=96 +``` + +You can use the key `drm.device` to specify your DRI device. + +Also note that when you use the hardware accelerated sub driver, MiniGUI app +may need the root privilege to call `drmSetMaster` to set the video mode. +However, under MiniGUI-Processes run mode, only the server (`mginit`) needs +this privilege. #### Extra input messages +In MiniGUI 4.0.0, we introduce the extra input messages to support modern +input devices including multiple touch panel, gesture, tablet tool, and +table pad. + +The extra input messages have the prefix `MSG_EXIN_`. If a MiniGUI app +want to handle these extra input events such as gestures, you need +to handle the `MSG_EXIN_XXX` messages in the app. For examples, please +refer to `mg-tests/drm-extra-input/`. + +Currently, there are two built-in IAL engines in MiniGUI can generates +the extra input messages: + +* The IAL engine of `libinput` to support all modern input devices on a +Linux box. This engine runs on `libinput` introduced by FreeDestkop project. + +* The enhanced IAL engine of `random` to generate extra input messages + automatically for testing. + +You can also write your own IAL engines to generate the extra messages. +Please see the implementation of `libinput` and `random` engines for +the details. + +For `libinput` engine, we introduce a new section in MiniGUI runtime +configuration: + +``` +[libinput] +seat=seat0 +``` + +The key `libinput.seat` specifies the seat identifier, the default +is `seat0`. + +For `random` engine, we introduce a new section in MiniGUI runtime +configuration: + +``` +[random] +logfile=events.out +eventtypes=mouse-keyboard-button-gesture-stouch +minkeycode=1 +maxkeycode=128 +minbtncode=0x100 +maxbtncode=0x1ff +``` + +The MiniGUI runtime configuration key `random.logfile` specifies +the log file which will store the input events generated by this engine. +If MiniGUI failed to open the log file, the log feature will be disabled. + +The MiniGUI runtime configuration key `random.eventtypes` specifies +the input event types which will be generated by this IAL engine, +in the following pattern: + + [-]* + +The `` can be one of the following values: + + - `mouse`: mouse. + - `keyboard`: keyboard. + - `button`: buttons. + - `single_touch`: touch pen or single touch panel. + - `multi_touch`: multiple touch panel. + - `gesture`: gesture. + - `tablet_tool`: tablet tool. + - `tablet_pad`: tablet pad. + - `switch`: switch. + +The MiniGUI ETC key `random.minkeycode` specifies the minimal key code +which can be generated by the engine if `keyboard` is included. + +The MiniGUI ETC key `random.maxkeycode` specifies the maximal key code +which can be generated by the engine if `keyboard` is included. + +The MiniGUI ETC key `random.minbtncode` specifies the minimal button code +which can be generated by the engine if `button` is included. + +The MiniGUI ETC key `random.maxbtncode` specifies the maximal key code +which can be generated by the engine if `button` is included. + +For invalid `random.eventtyps`, use `mouse` as default. + +For invalid `random.minkeycode`, and/or `random.maxkeycode` key values, use +`SCANCODE_ESCAPE`, and `SCANCODE_MICMUTE` respectively. + +For invalid `random.minbtncode`, and/or `random.maxbtncode key values, use +`0x100` (BTN_MISC defined by Linux kernel), and `0x2ff` (KEY_MAX defined by +Linux kernel) respectively. + +This engine maintains a state machine for each input event type, and +generates a reasonable event sequence for each type. If and only if +an event sequence finished or cancelled, the engine switch to another +event type randomly. + +Note that currently, the following event types are not implemented: + + - multi_touch + - tablet_tool + - tablet_pad + - switch + #### Slice allocator MiniGUI now provides an efficient way to allocate groups of equal-sized diff --git a/src/newgal/drm/drmvideo.c b/src/newgal/drm/drmvideo.c index 306f7878..be887076 100644 --- a/src/newgal/drm/drmvideo.c +++ b/src/newgal/drm/drmvideo.c @@ -126,8 +126,8 @@ struct drm_mode_info { }; /* - * modeset_cleanup(vdata): This cleans up all the devices we created during - * modeset_prepare(). It resets the CRTCs to their saved states and deallocates + * drm_cleanup(vdata): This cleans up all the devices we created during + * drm_prepare(). It resets the CRTCs to their saved states and deallocates * all memory. */ static void drm_cleanup(DrmVideoData* vdata) @@ -370,7 +370,7 @@ VideoBootStrap DRM_bootstrap = { }; /* - * modeset_find_crtc(vdata, res, conn, info): + * drm_find_crtc(vdata, res, conn, info): * This small helper tries to find a suitable CRTC for the given connector. */ static int drm_find_crtc(DrmVideoData* vdata,