DRM -> DRI

This commit is contained in:
Vincent Wei
2019-07-05 12:41:54 +08:00
parent aa9bb68ad9
commit f4af247b15
10 changed files with 89 additions and 89 deletions
+13 -13
View File
@@ -41,8 +41,8 @@ rendering in order that MiniGUI can handle complex writing systems
Another important features of this version are the new following engines:
* The NEWGAL engine of `drm` to support modern DRM-driven graphics cards. By using
`drm` engine, one MiniGUI app can now use the hardware-accelerated graphics
* The NEWGAL engine of `dri` to support modern DRM-driven graphics cards. By using
`dri` engine, one MiniGUI app can now use the hardware-accelerated graphics
rendering for 2D/3D graphics.
* The IAL engine of `libinput` to support all modern input devices including
mouse, keyboard, joystick, switch, multi-touch panel, gesture, tablet tool,
@@ -265,11 +265,11 @@ the glyph orientation:
#### 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
new NEWGAL engine of `dri`. 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:
The `dri` engine uses `libdrm` developed by Free Desktop project:
https://dri.freedesktop.org/wiki/
@@ -278,13 +278,13 @@ MiniGUI mainly uses this library to support the dumb frame buffer
(no hardware acceleration).
To avoid modifying the MiniGUI source code when supporting new GPUs,
the `drm` engine has adopted a scalable design.
the `dri` engine has adopted a scalable design.
* You can directly use the `drm` engine to run MiniGUI on a GPU
* You can directly use the `dri` engine to run MiniGUI on a GPU
which supports dumb frame buffer.
* When you want to take advantage of the hardware acceleration of
your GPU, you can write some code for your GPU as a sub driver
of `drm` engine outside MiniGUI.
of `dri` engine outside MiniGUI.
In this situation, you need to configure MiniGUI with the following
option:
@@ -297,24 +297,24 @@ The header file `<minigui/exstubs.h>` 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.
in `mg-tests/dri-engine/`. 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`
when using the `dri` 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
Note that for `dri` engine, we introduce a new section in MiniGUI runtime
configuration:
```
[drm]
[dri]
defaultmode=1024x768-32bpp
device=/dev/dri/card0
dpi=96
```
You can use the key `drm.device` to specify your DRI device.
You can use the key `dri.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.
@@ -330,7 +330,7 @@ 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/`.
refer to `mg-tests/extra-input/`.
Currently, there are two built-in IAL engines which can generates
the extra input messages:
+14 -14
View File
@@ -264,7 +264,7 @@ enable_video_dfb_st7167="no"
enable_video_stgfb="no"
enable_video_fbcon="yes"
enable_video_drm="yes"
enable_video_dri="yes"
enable_video_commlcd="no"
enable_video_shadow="no"
enable_video_mlshadow="no"
@@ -889,23 +889,23 @@ CheckFBCON()
dnl Find the DRM includes
CheckDRM()
{
AC_ARG_ENABLE(videodrm,
[ --enable-videodrm include Linux DRM NEWGAL engine <default=yes>],
enable_video_drm=$enableval)
if test "x$enable_video_drm" = "xyes"; then
PKG_CHECK_MODULES(DRM, [libudev >= 200, libdrm >= 2.4], video_drm="yes",
video_drm="no; Linux DRM NEWGAL engine requires libdrm 2.4+ and libudev 200+")
if test "x$video_drm" = "xyes"; then
AC_DEFINE(_MGGAL_DRM, 1,
AC_ARG_ENABLE(videodri,
[ --enable-videodri include Linux DRM NEWGAL engine <default=yes>],
enable_video_dri=$enableval)
if test "x$enable_video_dri" = "xyes"; then
PKG_CHECK_MODULES(DRM, [libudev >= 200, libdrm >= 2.4], video_dri="yes",
video_dri="no; Linux DRM NEWGAL engine requires libdrm 2.4+ and libudev 200+")
if test "x$video_dri" = "xyes"; then
AC_DEFINE(_MGGAL_DRI, 1,
[Define if include Linux DRM NEWGAL engine])
VIDEO_SUBDIRS="$VIDEO_SUBDIRS drm"
VIDEO_DRIVERS="$VIDEO_DRIVERS drm/libvideo_drm.la"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS dri"
VIDEO_DRIVERS="$VIDEO_DRIVERS dri/libvideo_dri.la"
DEP_LIBS="$DEP_LIBS -ldrm"
need_udev="yes"
DRM_INC_DIR="`$PKG_CONFIG --variable includedir libdrm`/drm"
AC_SUBST(DRM_INC_DIR)
else
AC_MSG_WARN([$video_drm])
AC_MSG_WARN([$video_dri])
fi
fi
}
@@ -2603,7 +2603,7 @@ src/font/Makefile
src/font/in-core/Makefile
src/newgal/Makefile
src/newgal/fbcon/Makefile
src/newgal/drm/Makefile
src/newgal/dri/Makefile
src/newgal/qvfb/Makefile
src/newgal/pcxvfb/Makefile
src/newgal/wvfb/Makefile
@@ -2679,7 +2679,7 @@ AC_MSG_NOTICE([
* dummy: ${enable_video_dummy}
* pc_xvfb: ${enable_video_pc_xvfb}
* usvfb: ${enable_video_usvfb}
* drm: ${enable_video_drm}
* dri: ${enable_video_dri}
* fbcon: ${enable_video_fbcon}
* commlcd: ${enable_video_commlcd}
+2 -2
View File
@@ -33,8 +33,8 @@ mtype=IMPS2
# Linux IAL engine based on libinput
# ial_engine=libinut
#{{ifdef _MGGAL_DRM
[drm]
#{{ifdef _MGGAL_DRI
[dri]
defaultmode=1024x768-16bpp
device=/dev/dri/card0
# The resolution of the display
+17 -17
View File
@@ -84,49 +84,49 @@ struct commlcd_info {
extern "C" {
#endif /* __cplusplus */
#ifdef _MGGAL_DRM
#ifdef _MGGAL_DRI
#include <stdint.h>
/*
* this struct should be defined by the driver
*/
struct _DrmDriver;
typedef struct _DrmDriver DrmDriver;
struct _DriDriver;
typedef struct _DriDriver DriDriver;
typedef struct _DrmDriverOps {
DrmDriver* (*create_driver) (int device_fd);
void (*destroy_driver) (DrmDriver *driver);
typedef struct _DriDriverOps {
DriDriver* (*create_driver) (int device_fd);
void (*destroy_driver) (DriDriver *driver);
uint32_t (* create_buffer) (DrmDriver *driver,
uint32_t (* create_buffer) (DriDriver *driver,
int depth, int bpp,
unsigned int width, unsigned int height,
unsigned int *pitch);
BOOL (* fetch_buffer) (DrmDriver *driver,
BOOL (* fetch_buffer) (DriDriver *driver,
uint32_t buffer_id,
unsigned int *width, unsigned int *height,
unsigned int *pitch);
uint8_t* (* map_buffer) (DrmDriver *driver,
uint8_t* (* map_buffer) (DriDriver *driver,
uint32_t buffer_id);
void (* unmap_buffer) (DrmDriver *driver,
void (* unmap_buffer) (DriDriver *driver,
uint32_t buffer_id);
uint8_t * (* begin_flush) (DrmDriver *driver,
uint8_t * (* begin_flush) (DriDriver *driver,
uint32_t buffer_id);
void (* end_flush) (DrmDriver *driver,
void (* end_flush) (DriDriver *driver,
uint32_t buffer_id);
void (* destroy_buffer) (DrmDriver *driver,
void (* destroy_buffer) (DriDriver *driver,
uint32_t buffer_id);
} DrmDriverOps;
} DriDriverOps;
/* implement this stub to return the DRM driver operators */
DrmDriverOps* __drm_ex_driver_get (const char* driver_name);
/* implement this stub to return the DRI driver operators */
DriDriverOps* __dri_ex_driver_get (const char* driver_name);
#endif /* _MGGAL_DRM */
#endif /* _MGGAL_DRI */
/* external stubs for COMMLCD NEWGAL engine */
#ifdef _MGGAL_COMMLCD
+5 -5
View File
@@ -7,8 +7,8 @@ noinst_LTLIBRARIES = libnewgal.la
# Define which subdirectories need to be built
SUBDIRS = @VIDEO_SUBDIRS@
DIST_SUBDIRS = dummy fbcon qvfb wvfb em85xxyuv em85xxosd svpxxosd bf533 utpmc \
mb93493 commlcd shadow mlshadow dfb em86gfx hisi rtos_xvfb pcxvfb \
nexus s3c6410 sigma8654 mstar gdl stgfb usvfb
mb93493 commlcd shadow mlshadow dfb em86gfx hisi rtos_xvfb pcxvfb \
nexus s3c6410 sigma8654 mstar gdl stgfb usvfb dri
# x11 dga vgl svga ggi aalib
EXTRA_DIST=makefile.ng makefile.msvc
@@ -34,9 +34,9 @@ COMMON_SRCS = \
stretch_c.h \
sysvideo.h \
video.c \
newgal.c \
videomem-bucket.h \
videomem-bucket.c
newgal.c \
videomem-bucket.h \
videomem-bucket.c
libnewgal_la_SOURCES = $(COMMON_SRCS)
libnewgal_la_LIBADD = $(DRIVERS)
+18
View File
@@ -0,0 +1,18 @@
## Makefile.am for the dri video driver
AM_CPPFLAGS = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include -I$(abs_top_srcdir)/src/newgal/ -I$(DRM_INC_DIR)
noinst_LTLIBRARIES = libvideo_dri.la
# The dri video driver sources
SRC_FILES = \
drivideo.c
HDR_FILES= \
drivideo.h
libvideo_dri_la_SOURCES = $(SRC_FILES) $(HDR_FILES)
EXTRA_DIST=makefile.ng
LIB_NAME=libvideo_dri
@@ -38,7 +38,7 @@
#define _DEBUG
#include "common.h"
#ifdef _MGGAL_DRM
#ifdef _MGGAL_DRI
#include <sys/mman.h>
#include <sys/sysmacros.h>
@@ -54,7 +54,7 @@
#include "exstubs.h"
#include "pixels_c.h"
#include "drmvideo.h"
#include "drivideo.h"
#define DRM_DRIVER_NAME "drm"
@@ -121,7 +121,7 @@ struct drm_mode_info {
* drm_prepare(). It resets the CRTCs to their saved states and deallocates
* all memory.
*/
static void drm_cleanup(DrmVideoData* vdata)
static void drm_cleanup(DriVideoData* vdata)
{
if (vdata->saved_crtc) {
/* restore saved CRTC configuration */
@@ -259,7 +259,7 @@ static int open_drm_device(GAL_VideoDevice *device)
}
#ifdef __TARGET_EXTERNAL__
device->hidden->driver_ops = __drm_ex_driver_get(driver_name);
device->hidden->driver_ops = __dri_ex_driver_get(driver_name);
#endif
free (driver_name);
@@ -370,7 +370,7 @@ VideoBootStrap DRM_bootstrap = {
* 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,
static int drm_find_crtc(DriVideoData* vdata,
drmModeRes *res, drmModeConnector *conn, struct drm_mode_info *info)
{
drmModeEncoder *enc;
@@ -451,7 +451,7 @@ static int drm_find_crtc(DrmVideoData* vdata,
* drm_setup_connector:
* Set up a single connector.
*/
static int drm_setup_connector(DrmVideoData* vdata,
static int drm_setup_connector(DriVideoData* vdata,
drmModeRes *res, drmModeConnector *conn, struct drm_mode_info *info)
{
int ret;
@@ -492,7 +492,7 @@ static int drm_setup_connector(DrmVideoData* vdata,
* drm_prepare:
* Collect the connnectors and mode information.
*/
static int drm_prepare(DrmVideoData* vdata)
static int drm_prepare(DriVideoData* vdata)
{
drmModeRes *res;
drmModeConnector *conn;
@@ -614,7 +614,7 @@ static void DRM_VideoQuit(_THIS)
static int DRM_Resume(_THIS)
{
DrmVideoData* vdata = this->hidden;
DriVideoData* vdata = this->hidden;
int ret = -1;
_DBG_PRINTF ("NEWGAL>DRM: %s called\n", __FUNCTION__);
@@ -639,7 +639,7 @@ static int DRM_Resume(_THIS)
static int DRM_Suspend(_THIS)
{
DrmVideoData* vdata = this->hidden;
DriVideoData* vdata = this->hidden;
int ret = -1;
_DBG_PRINTF ("NEWGAL>DRM: %s called\n", __FUNCTION__);
@@ -670,7 +670,7 @@ static int DRM_Suspend(_THIS)
* Call this function to create a so called "dumb buffer".
* We can use it for unaccelerated software rendering on the CPU.
*/
static int drm_create_dumb_fb(DrmVideoData* vdata, const DrmModeInfo* info,
static int drm_create_dumb_fb(DriVideoData* vdata, const DrmModeInfo* info,
int depth, int bpp)
{
struct drm_mode_create_dumb creq;
@@ -738,7 +738,7 @@ err_destroy:
return ret;
}
static DrmModeInfo* find_mode(DrmVideoData* vdata, int width, int height)
static DrmModeInfo* find_mode(DriVideoData* vdata, int width, int height)
{
DrmModeInfo *iter;
@@ -754,7 +754,7 @@ static DrmModeInfo* find_mode(DrmVideoData* vdata, int width, int height)
static GAL_Surface *DRM_SetVideoMode_Dumb(_THIS, GAL_Surface *current,
int width, int height, int bpp, Uint32 flags)
{
DrmVideoData* vdata = this->hidden;
DriVideoData* vdata = this->hidden;
DrmModeInfo* info;
int depth;
int ret;
@@ -833,7 +833,7 @@ static void DRM_FreeHWSurface_Dumb(_THIS, GAL_Surface *surface)
static GAL_Surface *DRM_SetVideoMode_Accl(_THIS, GAL_Surface *current,
int width, int height, int bpp, Uint32 flags)
{
DrmVideoData* vdata = this->hidden;
DriVideoData* vdata = this->hidden;
DrmModeInfo* info;
int depth;
unsigned int pitch;
@@ -969,5 +969,5 @@ static int DRM_SetHWAlpha_Accl(_THIS, GAL_Surface *surface, Uint8 value)
return 0;
}
#endif /* _MGGAL_DRM */
#endif /* _MGGAL_DRI */
@@ -31,8 +31,8 @@
* <http://www.minigui.com/en/about/licensing-policy/>.
*/
#ifndef _NEWGAL_DRMVIDEO_H
#define _NEWGAL_DRMVIDEO_H
#ifndef _NEWGAL_DRIVIDEO_H
#define _NEWGAL_DRIVIDEO_H
#include <stdint.h>
@@ -51,8 +51,8 @@ typedef struct GAL_PrivateVideoData {
char dev_name[LEN_DEVICE_NAME + 1];
int dev_fd;
DrmDriverOps* driver_ops;
DrmDriver* driver;
DriDriverOps* driver_ops;
DriDriver* driver;
DrmModeInfo* mode_list;
GAL_Rect** modes;
@@ -74,7 +74,7 @@ typedef struct GAL_PrivateVideoData {
/* only valid when using DRM driver */
uint32_t console_buff_id;
} DrmVideoData;
} DriVideoData;
#endif /* _NEWGAL_DRMVIDEO_H */
#endif /* _NEWGAL_DRIVIDEO_H */
-18
View File
@@ -1,18 +0,0 @@
## Makefile.am for the drm video driver
AM_CPPFLAGS = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include -I$(abs_top_srcdir)/src/newgal/ -I$(DRM_INC_DIR)
noinst_LTLIBRARIES = libvideo_drm.la
# The drm video driver sources
SRC_FILES = \
drmvideo.c
HDR_FILES= \
drmvideo.h
libvideo_drm_la_SOURCES = $(SRC_FILES) $(HDR_FILES)
EXTRA_DIST=makefile.ng
LIB_NAME=libvideo_drm